diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 19c076242f8..5e56ac2a1fc 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -101,28 +101,30 @@ Long description (Can span accross multiple lines).
### Pull Requests
-When submitting a pull request, use same rule as [Commits](#commits) for the message.
+Pull Request (PR) process is the process to submit a change (enhancement, bug fix, ...) into the code of the project. There is some rules to know and
+a process to follow to optimize the chance to have PRs merged efficiently...
-If your pull request only contains one commit, GitHub will be smart enough to fill it for you.
+When submitting a pull request, use same rule as [Commits](#commits) for the message.
+If your pull request only contains 1 commit, GitHub will be smart enough to fill it for you.
Otherwise, please be a bit verbose about what you're providing.
-Your Pull Request (PR) must pass the Continuous Integration checks.
+Your Pull Request (PR) must pass the Continuous Integration checks and code quality checks.
Also, some code changes need a prior approbation:
* if you want to include a new external library (into htdocs/includes directory), please ask before to the project manager (@eldy) to see if such a library can be accepted.
-* if you add a new table, you must first create a page on http://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Than ask the project manager (@eldy) if the new data model you plan to add can be accepted as you suggest.
+* if you add a new table, you must first create a page on https://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Then ask the project manager (@eldy) if the new data model you plan to add is compatible with curent and future works in progress and can be accepted as you suggest.
-Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR.
+Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR (A label is added in such a case).
If the label of PR start with "WIP" (Work In Progress), it will not be analyzed (until you change the label of PR).
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration.
If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR and why the PR is kept open. By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet.
-In most cases, it gives you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the flag ask you. The majority of PR are waiting an action of the developer/author.
+In most cases, it gives you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the tag ask you. The majority of open PR are waiting an action of the author of the PR.
-Statistics on Dolibarr project shows that around 95% of submitted PR are reviewed and tagged. This is one of the most important ratio of answered PR in Open Source world. Don't expect the core team to reach the 100%. With the increasing popularity of Dolibarr, this ratio will probably decrease in future.
+Statistics on Dolibarr project shows that around 95% of submitted PR are reviewed and tagged. Average answer delay is also one of the best among Open source project (just few days before having the Answer Tag set). This is one of the most important ratio of answered PR in Open Source world for a major project. Don't expect the core team to reach the 100%. A so high ratio is very rare on a so popular project and with the increasing popularity of Dolibarr, this ratio will probably decrease in future to a more common level.
### Resources
diff --git a/.github/workflows/stale-issues-safe.yml b/.github/workflows/stale-issues-safe.yml
new file mode 100644
index 00000000000..55599654707
--- /dev/null
+++ b/.github/workflows/stale-issues-safe.yml
@@ -0,0 +1,24 @@
+# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
+name: "Close stale issues (bugs and feature requests)"
+
+on:
+ schedule:
+ - cron: "0 21 * * *"
+ issue_comment:
+ types: [created]
+
+jobs:
+ stale:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: Dolibarr/stale@staleunstale
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
+ stale-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).'
+ stale-label: 'Issue Stale (automatic label)'
+ exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,Hacktoberfest,good first issue,Bug Security (CVE)'
+ days-before-stale: 365
+ days-before-close: 15
+ operations-per-run: 100
+ dry-run: false
+
\ No newline at end of file
diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml.disabled
similarity index 87%
rename from .github/workflows/stale-issues.yml
rename to .github/workflows/stale-issues.yml.disabled
index 633cc53437b..6e7dad5dc9b 100644
--- a/.github/workflows/stale-issues.yml
+++ b/.github/workflows/stale-issues.yml.disabled
@@ -12,12 +12,12 @@ jobs:
- uses: Dolibarr/stale@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- stale-issue-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. Without comment, this issue will be closed automatically by stale bot in 15 days.'
+ stale-issue-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).'
stale-issue-label: 'Issue Stale (automatic label)'
exempt-issue-label: 'Priority High / Blocking'
days-before-stale: 365
- days-before-close: 15
- operations-per-run: 50
+ days-before-close: -1
+ operations-per-run: 100
#stale-pr-message: 'This PR is stale because it has been open 1 year with no activity. If this PR is still mergeable (no conflict, nor Continuous Integration errors), please comment to confirm this merge is still expected. Without comment, this issue will be closed automatically by stale bot in 15 days.'
stale-pr-label: 'PR Stale (automatic label)'
stale-pr-message:
diff --git a/.gitignore b/.gitignore
index ffacba65feb..30151359365 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,3 +40,4 @@ htdocs/includes/sebastian/
htdocs/includes/squizlabs/
htdocs/includes/symfony/
htdocs/includes/webmozart/
+htdocs/.well-known/apple-developer-merchantid-domain-association
diff --git a/COPYRIGHT b/COPYRIGHT
index fe707c1d63d..c1f400aff4e 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -17,7 +17,7 @@ CKEditor 4.12.1 LGPL-2.1+ Yes
EvalMath 1.0 BSD Yes Safe math expressions evaluation
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
-Mobiledetect 2.8.33 MIT License Yes Detect mobile devices browsers
+Mobiledetect 2.8.34 MIT License Yes Detect mobile devices browsers
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
ParseDown 1.6 MIT License Yes Markdown parser
@@ -32,15 +32,16 @@ PSR/simple-cache ? Library for cache (used by PHPSp
Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
Sabre 3.2.2 BSD Yes DAV support
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
-Stripe 6.41 MIT licence Yes Library for Stripe module
+Stripe 6.43.1 MIT licence Yes Library for Stripe module
TCPDF 6.3.2 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
JS libraries:
-Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea.
+Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
+Chart 2.9.3 MIT License Yes JS library for graph
jQuery 3.4.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
-jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
+jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
jQuery Flot 0.8.3 MIT License Yes JS library to build graph
diff --git a/ChangeLog b/ChangeLog
index c6cd7463316..6f48691d299 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,7 +8,10 @@ For Users:
NEW: Module MO (Manufacturing Order) is available as stable module.
For Developers or integrators:
-
+* A new way to navigate between pages in list is available. To use it, you must
+ - replace $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
+ - remove input field in form ' ';'
+ - add parameter $pagenavastextinput to value 1 when calling print_barre_liste
WARNING:
@@ -20,8 +23,73 @@ Following changes may create regressions for some external modules, but were nec
the HTML into content (in such a case, sanitize data later)
* Removed hidden constant MAIN_EXTRAFIELDS_IN_ONE_TD that was useless.
* Reference of object including a "/" are no more allowed. It is never used by default but to support setup that introduced it, the "/" will be replaced
- by a "_" automatically when a reference is generated.
+ by a "_" automatically when a reference (with a custom numbering mask that use it) is generated.
+
+***** ChangeLog for 11.0.2 compared to 11.0.1 *****
+FIX: #10309
+FIX: #13110
+FIX: #13118
+FIX: #13124
+FIX: #13131
+FIX: #13135
+FIX: #13146 #13198
+FIX: #13175
+FIX: #13182
+FIX: #13183
+FIX: #13184
+FIX: #13263
+FIX: #13267
+FIX: an external user can not approve
+FIX: API Get list of documents for supplier_invoice
+FIX: API to push an expense report
+FIX: API upload/download doc for expensereport
+FIX: Avoid to download the export if we just press enter to refresh form
+FIX: Bad link to template invoices
+FIX: Bad sort link in accounting report
+FIX: Bad translation for productlot EatBy and SellBy
+FIX: better method to check user rights AND usergroup rights !
+FIX: CA by product list filter
+FIX: CSS
+FIX: Disable js if no javascript
+FIX: duplicate class name into some log lines
+FIX: etrafield with visibilty=5 were not in read only.
+FIX: excess paid from situation invoices not counted when calculating remain to pay.
+FIX: Force FEC export to txt format.
+FIX: Free input for email no more visible.
+FIX: Keep assigned users in session when loading projects and tasks
+FIX: List of viewed projects too large in task widget.
+FIX: Menu truncated. Add tooltip to have all content.
+FIX: Missing field "billed" in export.
+FIX: missing "statut" for getNomUrl() function
+FIX: modFournisseur is required by modSupplierProposal
+FIX: Multicompany compatibility
+FIX: must be == and not =
+FIX: option for topbar search and bookmarks
+FIX: option MAIN_OPTIMIZEFORTEXTBROWSER
+FIX: some responsive troubles
+FIX: round MT in accountancy books
+FIX: search with '0'
+FIX: sort link
+FIX: SQL Overload in default contact trigger.
+FIX: SQl syntax error.
+FIX: Submit of documents for supplier invoices.
+FIX: timezone must be tzserver and not tzuser as on contract card
+FIX: token in barcode tools page missing
+FIX: Bad name of trigger PROPAL_SUPPLIER_TRIGGER, should be PROPOSAL_SUPPLIER_TRIGGER
+FIX: Type of contact for event does not exists and not supported
+FIX: Type of contact not saved when creating a contact
+FIX: typo on ckeck method
+FIX: undefined function measuringUnitString in product list
+FIX: Usage of project not available in export.
+FIX: wrong test
+FIX: z-index for moretabsList with constant MAIN_MAXTABS_IN_CARD
+FIX: Use GETPOST instead of POST
+FIX: HTML Injection
+FIX: Visualization rights correction on last modified contacts box.
+FIX: Vulnerability in module from modulebuilder.
+FIX: Vulnerability reported by code16
+
***** ChangeLog for 11.0.1 compared to 11.0.0 *****
FIX: advanced target emailing sql and ergonomy.
FIX: After import of a website template, home page was not set.
diff --git a/composer.json b/composer.json
index 86acd2f8d60..d26bbb05ad9 100644
--- a/composer.json
+++ b/composer.json
@@ -28,11 +28,12 @@
"ext-curl" : "*",
"ckeditor/ckeditor" : "4.12.1",
"mike42/escpos-php" : "2.2",
- "mobiledetect/mobiledetectlib" : "2.8.33",
+ "mobiledetect/mobiledetectlib" : "2.8.34",
"phpoffice/phpexcel" : "1.8.1",
"restler/framework" : "3.0.0-RC6",
- "tecnickcom/tcpdf" : "^6.2",
- "luracast/restler" : "^3.0"
+ "tecnickcom/tcpdf" : "6.3.2",
+ "nnnick/chartjs" : "^2.9",
+ "stripe/stripe-php" : "6.43.1"
},
"require-dev" : {
"jakub-onderka/php-parallel-lint" : "^0",
@@ -56,4 +57,4 @@
"ext-zip" : "ODT, Excel and file compression support",
"ext-xml" : "Excel support"
}
-}
\ No newline at end of file
+}
diff --git a/composer.lock b/composer.lock
index e9ea391bba2..09c71674512 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "16c94fd4f22ac17820d85ee57b0616e1",
+ "content-hash": "17e906996157e8a94564f686a6096dc5",
"packages": [
{
"name": "ckeditor/ckeditor",
@@ -49,24 +49,31 @@
},
{
"name": "mike42/escpos-php",
- "version": "v1.2.1",
+ "version": "v2.2",
"source": {
"type": "git",
"url": "https://github.com/mike42/escpos-php.git",
- "reference": "cfea4c4fc95516ac953e1e5b623f854632afa2ee"
+ "reference": "e5496cf819b048b11877117bd14a9cea4fb17c03"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/mike42/escpos-php/zipball/cfea4c4fc95516ac953e1e5b623f854632afa2ee",
- "reference": "cfea4c4fc95516ac953e1e5b623f854632afa2ee",
+ "url": "https://api.github.com/repos/mike42/escpos-php/zipball/e5496cf819b048b11877117bd14a9cea4fb17c03",
+ "reference": "e5496cf819b048b11877117bd14a9cea4fb17c03",
"shasum": ""
},
"require": {
- "php": ">=5.3.0"
+ "ext-mbstring": "*",
+ "php": ">=5.4.0"
},
"require-dev": {
- "phpunit/phpunit": "4.5.*",
- "squizlabs/php_codesniffer": "2.*"
+ "guzzlehttp/guzzle": "^5.3",
+ "phpunit/phpunit": "^4.8",
+ "squizlabs/php_codesniffer": "^3.2"
+ },
+ "suggest": {
+ "ext-gd": "Used for image printing if present.",
+ "ext-imagick": "Will be used for image printing if present. Required for PDF printing or use of custom fonts.",
+ "guzzlehttp/guzzle": "Allows the use of the ApiConnector to send print jobs over HTTP."
},
"type": "library",
"autoload": {
@@ -79,28 +86,12 @@
"MIT"
],
"authors": [
- {
- "name": "Roni Saha",
- "email": "roni.cse@gmail.com"
- },
{
"name": "Michael Billington",
"email": "michael.billington@gmail.com"
- },
- {
- "name": "Gergely Radics",
- "email": "gerifield@ustream.tv"
- },
- {
- "name": "Warren Doyle",
- "email": "w.doyle@fuelled.co"
- },
- {
- "name": "vharo",
- "email": "vharo@geepok.com"
}
],
- "description": "Thermal receipt printer library, for use with ESC/POS compatible printers",
+ "description": "PHP receipt printer library for use with ESC/POS-compatible thermal and impact printers",
"homepage": "https://github.com/mike42/escpos-php",
"keywords": [
"ESC-POS",
@@ -109,20 +100,20 @@
"print",
"receipt"
],
- "time": "2016-04-25T01:14:07+00:00"
+ "time": "2019-10-05T05:59:00+00:00"
},
{
"name": "mobiledetect/mobiledetectlib",
- "version": "2.8.33",
+ "version": "2.8.34",
"source": {
"type": "git",
"url": "https://github.com/serbanghita/Mobile-Detect.git",
- "reference": "cd385290f9a0d609d2eddd165a1e44ec1bf12102"
+ "reference": "6f8113f57a508494ca36acbcfa2dc2d923c7ed5b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/cd385290f9a0d609d2eddd165a1e44ec1bf12102",
- "reference": "cd385290f9a0d609d2eddd165a1e44ec1bf12102",
+ "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/6f8113f57a508494ca36acbcfa2dc2d923c7ed5b",
+ "reference": "6f8113f57a508494ca36acbcfa2dc2d923c7ed5b",
"shasum": ""
},
"require": {
@@ -161,7 +152,48 @@
"mobile detector",
"php mobile detect"
],
- "time": "2018-09-01T15:05:15+00:00"
+ "time": "2019-09-18T18:44:20+00:00"
+ },
+ {
+ "name": "nnnick/chartjs",
+ "version": "v2.9.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/chartjs/Chart.js.git",
+ "reference": "06f73dc3590084b2c464bf08189c7aee2b6b92d2"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/chartjs/Chart.js/zipball/06f73dc3590084b2c464bf08189c7aee2b6b92d2",
+ "reference": "06f73dc3590084b2c464bf08189c7aee2b6b92d2",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "release/2.0": "v2.0-dev"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "NICK DOWNIE",
+ "email": "hello@nickdownie.com"
+ }
+ ],
+ "description": "Simple HTML5 charts using the canvas element.",
+ "homepage": "https://www.chartjs.org/",
+ "keywords": [
+ "JS",
+ "chart"
+ ],
+ "time": "2019-11-14T18:37:30+00:00"
},
{
"name": "phpoffice/phpexcel",
@@ -282,6 +314,62 @@
],
"time": "2019-05-12T15:15:11+00:00"
},
+ {
+ "name": "stripe/stripe-php",
+ "version": "v6.43.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/stripe/stripe-php.git",
+ "reference": "42fcdaf99c44bb26937223f8eae1f263491d5ab8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/stripe/stripe-php/zipball/42fcdaf99c44bb26937223f8eae1f263491d5ab8",
+ "reference": "42fcdaf99c44bb26937223f8eae1f263491d5ab8",
+ "shasum": ""
+ },
+ "require": {
+ "ext-curl": "*",
+ "ext-json": "*",
+ "ext-mbstring": "*",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "php-coveralls/php-coveralls": "1.*",
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "~2.0",
+ "symfony/process": "~2.8"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Stripe\\": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Stripe and contributors",
+ "homepage": "https://github.com/stripe/stripe-php/contributors"
+ }
+ ],
+ "description": "Stripe PHP Library",
+ "homepage": "https://stripe.com/",
+ "keywords": [
+ "api",
+ "payment processing",
+ "stripe"
+ ],
+ "time": "2019-08-29T16:56:12+00:00"
+ },
{
"name": "tecnickcom/tcpdf",
"version": "6.3.2",
@@ -1815,7 +1903,7 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
- "php": ">=5.3.0",
+ "php": ">=5.5.0",
"ext-curl": "*"
},
"platform-dev": []
diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php
index 6d59a9de1f6..7da6de23725 100644
--- a/htdocs/accountancy/admin/account.php
+++ b/htdocs/accountancy/admin/account.php
@@ -56,7 +56,7 @@ if (!$user->rights->accounting->chartofaccount) accessforbidden();
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
@@ -70,9 +70,12 @@ $arrayfields = array(
'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1),
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
- 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
+ 'aa.reconciliable'=>array('label'=>$langs->trans("Reconciliable"), 'checked'=>1),
+ 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
);
+if ($conf->global->MAIN_FEATURES_LEVEL < 2) unset($arrayfields['aa.reconciliable']);
+
$accounting = new AccountingAccount($db);
@@ -157,7 +160,8 @@ if (empty($reshook))
if ($action == 'disable') {
if ($accounting->fetch($id)) {
- $result = $accounting->account_desactivate($id);
+ $mode = GETPOST('mode', 'int');
+ $result = $accounting->account_desactivate($id, $mode);
}
$action = 'update';
@@ -166,7 +170,8 @@ if (empty($reshook))
}
} elseif ($action == 'enable') {
if ($accounting->fetch($id)) {
- $result = $accounting->account_activate($id);
+ $mode = GETPOST('mode', 'int');
+ $result = $accounting->account_activate($id, $mode);
}
$action = 'update';
if ($result < 0) {
@@ -192,7 +197,7 @@ if ($action == 'delete') {
$pcgver = $conf->global->CHARTOFACCOUNTS;
-$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.active, ";
+$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.reconciliable, aa.active, ";
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".$conf->entity;
@@ -352,6 +357,7 @@ if ($resql)
print '';
}
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '
';
+ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconciliable']['checked'])) print ' '; }
if (!empty($arrayfields['aa.active']['checked'])) print ' ';
print '';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
@@ -365,6 +371,7 @@ if ($resql)
if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
if (!empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']);
+ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconciliable']['checked'])) print_liste_field_titre($arrayfields['aa.reconciliable']['label'], $_SERVER["PHP_SELF"], 'aa.reconciliable', '', $param, '', $sortfield, $sortorder); }
if (!empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "\n";
@@ -441,16 +448,36 @@ if ($resql)
if (!$i) $totalarray['nbfield']++;
}
+ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
+ // Activated or not reconciliation on accounting account
+ if (!empty($arrayfields['aa.reconciliable']['checked'])) {
+ print ' ';
+ if (empty($obj->reconciliable)) {
+ print 'rowid . '&action=enable&mode=1">';
+ print img_picto($langs->trans("Disabled"), 'switch_off');
+ print ' ';
+ } else {
+ print 'rowid . '&action=disable&mode=1">';
+ print img_picto($langs->trans("Activated"), 'switch_on');
+ print ' ';
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ }
+
// Activated or not
if (!empty($arrayfields['aa.active']['checked']))
{
- print '';
+ print ' ';
if (empty($obj->active)) {
- print 'rowid.'&action=enable">';
+ print ' rowid.'&action=enable&mode=0">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print ' ';
} else {
- print 'rowid.'&action=disable">';
+ print ' rowid.'&action=disable&mode=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print ' ';
}
diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php
index 2ed3ad44695..0ab42d582d1 100644
--- a/htdocs/accountancy/admin/accountmodel.php
+++ b/htdocs/accountancy/admin/accountmodel.php
@@ -61,7 +61,7 @@ $active = 1;
$sortfield = GETPOST("sortfield", 'aZ09comma');
$sortorder = GETPOST("sortorder", 'aZ09comma');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $listlimit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php
index 50cf04a490a..500a0d3cbba 100644
--- a/htdocs/accountancy/admin/categories_list.php
+++ b/htdocs/accountancy/admin/categories_list.php
@@ -56,7 +56,7 @@ $active = 1;
$sortfield = GETPOST("sortfield", 'aZ09comma');
$sortorder = GETPOST("sortorder", 'aZ09comma');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $listlimit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php
index c0c3f835481..ad22a88f415 100644
--- a/htdocs/accountancy/admin/defaultaccounts.php
+++ b/htdocs/accountancy/admin/defaultaccounts.php
@@ -1,7 +1,7 @@
* Copyright (C) 2013-2014 Florian Henry
- * Copyright (C) 2013-2019 Alexandre Spangaro
+ * Copyright (C) 2013-2020 Alexandre Spangaro
* Copyright (C) 2014-2015 Ari Elbaz (elarifr)
* Copyright (C) 2014 Marcos García
* Copyright (C) 2014 Juanjo Menent
@@ -46,27 +46,35 @@ if (empty($user->rights->accounting->chartofaccount))
$action = GETPOST('action', 'aZ09');
-$list_account_main = array (
+$list_account_main = array(
'ACCOUNTING_ACCOUNT_CUSTOMER',
'ACCOUNTING_ACCOUNT_SUPPLIER',
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
);
-$list_account = array ();
+$list_account = array();
$list_account[] = '---Product---';
-$list_account[] = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
if ($mysoc->isInEEC()) {
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT';
}
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT';
+$list_account[] = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
+if ($mysoc->isInEEC()) {
+ $list_account[] = 'ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT';
+}
+$list_account[] = 'ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT';
$list_account[] = '---Service---';
-$list_account[] = 'ACCOUNTING_SERVICE_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
if ($mysoc->isInEEC()) {
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT';
}
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT';
+$list_account[] = 'ACCOUNTING_SERVICE_BUY_ACCOUNT';
+if ($mysoc->isInEEC()) {
+ $list_account[] = 'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
+}
+$list_account[] = 'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
$list_account[] = '---Other---';
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
@@ -112,25 +120,25 @@ if ($action == 'update') {
foreach ($list_account_main as $constname) {
$constvalue = GETPOST($constname, 'alpha');
- if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
- $error ++;
+ if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
+ $error++;
}
}
foreach ($list_account as $constname) {
- $reg=array();
+ $reg = array();
if (preg_match('/---(.*)---/', $constname, $reg)) { // This is a separator
continue;
}
$constvalue = GETPOST($constname, 'alpha');
- if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
- $error ++;
+ if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
+ $error++;
}
}
- if (! $error) {
+ if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
@@ -182,7 +190,7 @@ foreach ($list_account_main as $key) {
foreach ($list_account as $key) {
- $reg=array();
+ $reg = array();
if (preg_match('/---(.*)---/', $key, $reg)) {
print ''.$langs->trans($reg[1]).' ';
}
@@ -190,9 +198,9 @@ foreach ($list_account as $key) {
print '';
// Param
$label = $langs->trans($key);
- print '' . $label . ' ';
+ print ''.$label.' ';
// Value
- print ''; // Do not force class=right, or it align also the content of the select box
+ print ' '; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print ' ';
print ' ';
diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php
index 7dd4ae1a935..b5cc46a3d0d 100644
--- a/htdocs/accountancy/admin/fiscalyear.php
+++ b/htdocs/accountancy/admin/fiscalyear.php
@@ -31,7 +31,7 @@ $action = GETPOST('action', 'aZ09');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php
index e47fba72756..eccb7450594 100644
--- a/htdocs/accountancy/admin/journals_list.php
+++ b/htdocs/accountancy/admin/journals_list.php
@@ -57,7 +57,7 @@ $active = 1;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $listlimit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php
index 60c9c88f0c8..c6c76a57621 100644
--- a/htdocs/accountancy/admin/productaccount.php
+++ b/htdocs/accountancy/admin/productaccount.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2013-2019 Alexandre Spangaro
+ * Copyright (C) 2013-2020 Alexandre Spangaro
* Copyright (C) 2014 Florian Henry
* Copyright (C) 2014 Juanjo Menent
* Copyright (C) 2015 Ari Elbaz (elarifr)
@@ -59,7 +59,7 @@ $search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc', 'alpha');
$search_current_account = GETPOST('search_current_account', 'alpha');
$search_current_account_valid = GETPOST('search_current_account_valid', 'alpha');
-if ($search_current_account_valid == '') $search_current_account_valid='withoutvalidaccount';
+if ($search_current_account_valid == '') $search_current_account_valid = 'withoutvalidaccount';
$search_onsell = GETPOST('search_onsell', 'alpha');
$search_onpurchase = GETPOST('search_onpurchase', 'alpha');
@@ -67,12 +67,12 @@ $accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
$btn_changeaccount = GETPOST('changeaccount', 'alpha');
$btn_changetype = GETPOST('changetype', 'alpha');
-if (empty($accounting_product_mode)) $accounting_product_mode='ACCOUNTANCY_SELL';
+if (empty($accounting_product_mode)) $accounting_product_mode = 'ACCOUNTANCY_SELL';
-$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
+$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
@@ -117,7 +117,9 @@ if ($action == 'update') {
'ACCOUNTANCY_SELL',
'ACCOUNTANCY_SELL_INTRA',
'ACCOUNTANCY_SELL_EXPORT',
- 'ACCOUNTANCY_BUY'
+ 'ACCOUNTANCY_BUY',
+ 'ACCOUNTANCY_BUY_INTRA',
+ 'ACCOUNTANCY_BUY_EXPORT'
);
if (in_array($accounting_product_mode, $accounting_product_modes)) {
@@ -159,6 +161,12 @@ if ($action == 'update') {
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$sql .= " SET accountancy_code_buy = ".$accounting->account_number;
}
+ if ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
+ $sql .= " SET accountancy_code_buy_intra = ".$accounting->account_number;
+ }
+ if ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
+ $sql .= " SET accountancy_code_buy_export = ".$accounting->account_number;
+ }
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
$sql .= " SET accountancy_code_sell = ".$accounting->account_number;
}
@@ -204,7 +212,11 @@ $form = new FormAccounting($db);
$accounting = new AccountingAccount($db);
// TODO: we should need to check if result is already exists accountaccount rowid.....
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
+$aarowid_servbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT, 1);
+$aarowid_servbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT, 1);
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
+$aarowid_prodbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT, 1);
+$aarowid_prodbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT, 1);
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
$aarowid_servsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT, 1);
$aarowid_servsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT, 1);
@@ -212,47 +224,68 @@ $aarowid_prodsell = $accounting->fetch('', $conf->global->ACCOUNTING_P
$aarowid_prodsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT, 1);
$aarowid_prodsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT, 1);
-$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
-$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
-$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
-$aacompta_servsell_intra = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
-$aacompta_servsell_export = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
-$aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
-$aacompta_prodsell_intra = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
-$aacompta_prodsell_export = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
+$aacompta_servbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
+$aacompta_servbuy_intra = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
+$aacompta_servbuy_export = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
+$aacompta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
+$aacompta_prodbuy_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
+$aacompta_prodbuy_export = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
+$aacompta_servsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
+$aacompta_servsell_intra = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
+$aacompta_servsell_export = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
+$aacompta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
+$aacompta_prodsell_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
+$aacompta_prodsell_export = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
llxHeader('', $langs->trans("ProductsBinding"));
$pcgverid = $conf->global->CHARTOFACCOUNTS;
$pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
-if (empty($pcgvercode)) $pcgvercode=$pcgverid;
+if (empty($pcgvercode)) $pcgvercode = $pcgverid;
$sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy,";
-$sql.= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,";
-$sql.= " p.tms, p.fk_product_type as product_type,";
-$sql.= " aa.rowid as aaid";
-$sql.= " FROM " . MAIN_DB_PREFIX . "product as p";
-$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
+$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
+$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
+$sql .= " p.tms, p.fk_product_type as product_type,";
+$sql .= " aa.rowid as aaid";
+$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
- $sql.=" p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
+ $sql .= " p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
+}
+elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA')
+{
+ $sql .= " p.accountancy_code_buy_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
+}
+elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT')
+{
+ $sql .= " p.accountancy_code_buy_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL')
{
- $sql.=" p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
+ $sql .= " p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA')
{
- $sql.=" p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
+ $sql .= " p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
}
else
{
- $sql.=" p.accountancy_code_sell_export = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
+ $sql .= " p.accountancy_code_sell_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
}
-$sql.= ' WHERE p.entity IN ('.getEntity('product').')';
+$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy", $search_current_account);
}
+} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
+ if (strlen(trim($search_current_account))) {
+ $sql .= natural_search("p.accountancy_code_buy_intra", $search_current_account);
+ }
+} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
+ if (strlen(trim($search_current_account))) {
+ $sql .= natural_search("p.accountancy_code_buy_export", $search_current_account);
+ }
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell", $search_current_account);
@@ -286,8 +319,8 @@ if (strlen(trim($search_label))) {
if (strlen(trim($search_desc))) {
$sql .= natural_search("p.description", $search_desc);
}
-if ($search_onsell != '' && $search_onsell != '-1') $sql.= natural_search('p.tosell', $search_onsell, 1);
-if ($search_onpurchase != '' && $search_onpurchase != '-1') $sql.= natural_search('p.tobuy', $search_onpurchase, 1);
+if ($search_onsell != '' && $search_onsell != '-1') $sql .= natural_search('p.tosell', $search_onsell, 1);
+if ($search_onpurchase != '' && $search_onpurchase != '-1') $sql .= natural_search('p.tobuy', $search_onpurchase, 1);
$sql .= $db->order($sortfield, $sortorder);
@@ -334,70 +367,77 @@ if ($result)
print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
print ' ';
- print ''.$langs->trans("InitAccountancyDesc") . ' ';
+ print ''.$langs->trans("InitAccountancyDesc").' ';
print ' ';
// Select mode
print '\n";
- print '
';
+ print '
';
print " \n";
// Filter on categories
- $moreforfilter='';
- $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
- $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+ $moreforfilter = '';
+ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
- $buttonsave = ' ';
+ $buttonsave = ' ';
//print ''.$buttonsave.'
';
- $texte=$langs->trans("ListOfProductsServices");
+ $texte = $langs->trans("ListOfProductsServices");
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit);
print '';
- print '
';
+ print '';
print '';
- print ' ';
- print ' ';
- if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print ' ';
+ print ' ';
+ print ' ';
+ if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print ' ';
// On sell
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print ''.$form->selectyesno('search_onsell', $search_onsell, 1, false, 1).' ';
}
// On buy
- elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
+ elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY' || $accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
print ''.$form->selectyesno('search_onpurchase', $search_onpurchase, 1, false, 1).' ';
}
// Current account
print '';
- print ' ';
- $listofvals=array('withoutvalidaccount'=>$langs->trans("WithoutValidAccount"), 'withvalidaccount'=>$langs->trans("WithValidAccount"));
+ print ' ';
+ $listofvals = array('withoutvalidaccount'=>$langs->trans("WithoutValidAccount"), 'withvalidaccount'=>$langs->trans("WithValidAccount"));
print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1);
print ' ';
print ' ';
print '';
- $searchpicto=$form->showFilterButtons();
+ $searchpicto = $form->showFilterButtons();
print $searchpicto;
print ' ';
print ' ';
@@ -405,30 +445,36 @@ if ($result)
print '';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
- if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
+ if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
// On sell / On purchase
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
- $fieldtosortaccount="p.accountancy_code_sell";
+ $fieldtosortaccount = "p.accountancy_code_sell";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
- $fieldtosortaccount="p.accountancy_code_sell_intra";
+ $fieldtosortaccount = "p.accountancy_code_sell_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
- $fieldtosortaccount="p.accountancy_code_sell_export";
- } else {
- if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
- $fieldtosortaccount="p.accountancy_code_buy";
- }
+ $fieldtosortaccount = "p.accountancy_code_sell_export";
+ } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
+ print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
+ $fieldtosortaccount = "p.accountancy_code_buy";
+ } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
+ print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
+ $fieldtosortaccount = "p.accountancy_code_buy_intra";
+ } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
+ print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
+ $fieldtosortaccount = "p.accountancy_code_buy_export";
+ }
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AssignDedicatedAccountingAccount");
- $clickpitco=$form->showCheckAddButtons('checkforselect', 1);
+ $clickpitco = $form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');
print ' ';
$product_static = new Product($db);
- $i=0;
+ $i = 0;
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
@@ -445,48 +491,77 @@ if ($result)
// Sales
if ($obj->product_type == 0) {
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
- $compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell;
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
- $compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell_intra;
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
- $compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell_export;
}
else {
- $compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
- $compta_prodsell_id = $aarowid_servsell;
+ $compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodsell_id = $aarowid_prodsell;
}
}
else {
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
- $compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
- $compta_prodsell_id = $aarowid_prodsell;
+ $compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodsell_id = $aarowid_servsell;
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
- $compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
- $compta_prodsell_id = $aarowid_prodsell_intra;
+ $compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodsell_id = $aarowid_servsell_intra;
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
- $compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
- $compta_prodsell_id = $aarowid_prodsell_export;
+ $compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodsell_id = $aarowid_servsell_export;
}
else {
- $compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_servsell;
}
}
// Purchases
if ($obj->product_type == 0) {
- $compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
- $compta_prodbuy_id = $aarowid_prodbuy;
- } else {
- $compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
- $compta_prodbuy_id = $aarowid_servbuy;
+ if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
+ $compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodbuy_id = $aarowid_prodbuy;
+ }
+ elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
+ $compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodbuy_id = $aarowid_prodbuy_intra;
+ }
+ elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
+ $compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodbuy_id = $aarowid_prodbuy_export;
+ }
+ else {
+ $compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodbuy_id = $aarowid_prodbuy;
+ }
+ }
+ else {
+ if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
+ $compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodbuy_id = $aarowid_servbuy;
+ }
+ elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
+ $compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodbuy_id = $aarowid_servbuy_intra;
+ }
+ elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
+ $compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodbuy_id = $aarowid_servbuy_export;
+ }
+ else {
+ $compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
+ $compta_prodbuy_id = $aarowid_servbuy;
+ }
}
print '';
@@ -509,7 +584,7 @@ if ($result)
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT')
print ''.$product_static->getLibStatut(3, 0).' ';
- if ($accounting_product_mode == 'ACCOUNTANCY_BUY')
+ if ($accounting_product_mode == 'ACCOUNTANCY_BUY' || $accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT')
print ''.$product_static->getLibStatut(3, 1).' ';
// Current accounting account
@@ -517,7 +592,13 @@ if ($result)
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
print length_accountg($obj->accountancy_code_buy);
if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
- } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
+ } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
+ print length_accountg($obj->accountancy_code_buy_intra);
+ if ($obj->accountancy_code_buy_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
+ } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
+ print length_accountg($obj->accountancy_code_buy_export);
+ if ($obj->accountancy_code_buy_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
+ } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print length_accountg($obj->accountancy_code_sell);
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
@@ -530,52 +611,72 @@ if ($result)
print '';
// New account to set
- $defaultvalue='';
+ $defaultvalue = '';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
// Accounting account buy
print '';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
- if (empty($defaultvalue)) $defaultvalue=$compta_prodbuy;
- $codesell=length_accountg($obj->accountancy_code_buy);
- if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
- print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
+ if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy;
+ $codesell = length_accountg($obj->accountancy_code_buy);
+ if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
+ print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
+ print ' ';
+ } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
+ // Accounting account buy intra (In EEC)
+ print '';
+ //$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
+ if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy_intra;
+ $codesell = length_accountg($obj->accountancy_code_buy_intra);
+ //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
+ if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
+ print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
+ print ' ';
+ } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
+ // Accounting account buy export (Out of EEC)
+ print '';
+ //$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
+ if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy_export;
+ $codesell = length_accountg($obj->accountancy_code_buy_export);
+ //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
+ if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
+ print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print ' ';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
// Accounting account sell
print '';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
- if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
- $codesell=length_accountg($obj->accountancy_code_sell);
+ if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
+ $codesell = length_accountg($obj->accountancy_code_sell);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
- if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
- print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
+ if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
+ print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print ' ';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
// Accounting account sell intra (In EEC)
print '';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
- if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
- $codesell=length_accountg($obj->accountancy_code_sell_intra);
+ if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
+ $codesell = length_accountg($obj->accountancy_code_sell_intra);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
- if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
- print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
+ if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
+ print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print ' ';
} else {
// Accounting account sell export (Out of EEC)
print '';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
- if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
- $codesell=length_accountg($obj->accountancy_code_sell_export);
- if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
- print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
+ if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
+ $codesell = length_accountg($obj->accountancy_code_sell_export);
+ if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
+ print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print ' ';
}
// Checkbox select
print '';
- print ' ';
+ print ' ';
print " ";
- $i ++;
+ $i++;
}
print '
';
print '';
diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php
index 58dbf20e7bf..b2a25b00ce2 100644
--- a/htdocs/accountancy/bookkeeping/balance.php
+++ b/htdocs/accountancy/bookkeeping/balance.php
@@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Load translation files required by the page
$langs->loadLangs(array("accountancy"));
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$sortorder = GETPOST("sortorder", 'alpha');
$sortfield = GETPOST("sortfield", 'alpha');
$action = GETPOST('action', 'aZ09');
@@ -47,7 +47,7 @@ $action = GETPOST('action', 'aZ09');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
@@ -254,7 +254,7 @@ if ($action != 'export_csv')
print '';
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
- print_liste_field_titre("Opening Balance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
+ print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
@@ -271,7 +271,7 @@ if ($action != 'export_csv')
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte";
$resql = $db->query($sql);
$nrows = $resql->num_rows;
- $opening_balances = Array();
+ $opening_balances = array();
for ($i = 0; $i < $nrows; $i++) {
$arr = $resql->fetch_array();
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance'];
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 9b6ad2fbbb0..e50112f7ff1 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -93,7 +93,7 @@ $search_not_reconciled = GETPOST('search_reconciled_option', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
@@ -204,7 +204,7 @@ if (empty($reshook))
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
- $search_not_reconciled='';
+ $search_not_reconciled = '';
}
// Must be after the remove filter action, before the export.
@@ -276,32 +276,32 @@ if (empty($reshook))
if (!empty($search_date_creation_start)) {
$filter['t.date_creation>='] = $search_date_creation_start;
$tmp = dol_getdate($search_date_creation_start);
- $param .= '&date_creation_startmonth=' . urlencode($tmp['mon']) . '&date_creation_startday=' . urlencode($tmp['mday']) . '&date_creation_startyear=' . urlencode($tmp['year']);
+ $param .= '&date_creation_startmonth='.urlencode($tmp['mon']).'&date_creation_startday='.urlencode($tmp['mday']).'&date_creation_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_creation_end)) {
$filter['t.date_creation<='] = $search_date_creation_end;
$tmp = dol_getdate($search_date_creation_end);
- $param .= '&date_creation_endmonth=' .urlencode($tmp['mon']) . '&date_creation_endday=' . urlencode($tmp['mday']) . '&date_creation_endyear=' . urlencode($tmp['year']);
+ $param .= '&date_creation_endmonth='.urlencode($tmp['mon']).'&date_creation_endday='.urlencode($tmp['mday']).'&date_creation_endyear='.urlencode($tmp['year']);
}
if (!empty($search_date_modification_start)) {
$filter['t.tms>='] = $search_date_modification_start;
$tmp = dol_getdate($search_date_modification_start);
- $param .= '&date_modification_startmonth=' . urlencode($tmp['mon']) . '&date_modification_startday=' . urlencode($tmp['mday']) . '&date_modification_startyear=' . urlencode($tmp['year']);
+ $param .= '&date_modification_startmonth='.urlencode($tmp['mon']).'&date_modification_startday='.urlencode($tmp['mday']).'&date_modification_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_modification_end)) {
$filter['t.tms<='] = $search_date_modification_end;
$tmp = dol_getdate($search_date_modification_end);
- $param .= '&date_modification_endmonth=' . urlencode($tmp['mon']) . '&date_modification_endday=' . urlencode($tmp['mday']) . '&date_modification_endyear=' . urlencode($tmp['year']);
+ $param .= '&date_modification_endmonth='.urlencode($tmp['mon']).'&date_modification_endday='.urlencode($tmp['mday']).'&date_modification_endyear='.urlencode($tmp['year']);
}
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $search_date_export_start;
$tmp = dol_getdate($search_date_export_start);
- $param .= '&date_export_startmonth=' . urlencode($tmp['mon']) . '&date_export_startday=' . urlencode($tmp['mday']) . '&date_export_startyear=' . urlencode($tmp['year']);
+ $param .= '&date_export_startmonth='.urlencode($tmp['mon']).'&date_export_startday='.urlencode($tmp['mday']).'&date_export_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $search_date_export_end;
$tmp = dol_getdate($search_date_export_end);
- $param .= '&date_export_endmonth=' . urlencode($tmp['mon']) . '&date_export_endday=' . urlencode($tmp['mday']) . '&date_export_endyear=' . urlencode($tmp['year']);
+ $param .= '&date_export_endmonth='.urlencode($tmp['mon']).'&date_export_endday='.urlencode($tmp['mday']).'&date_export_endyear='.urlencode($tmp['year']);
}
if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit;
@@ -315,9 +315,9 @@ if (empty($reshook))
$filter['t.lettering_code'] = $search_lettering_code;
$param .= '&search_lettering_code='.urlencode($search_lettering_code);
}
- if (! empty($search_not_reconciled)) {
+ if (!empty($search_not_reconciled)) {
$filter['t.reconciled_option'] = $search_not_reconciled;
- $param .= '&search_not_reconciled=' . urlencode($search_not_reconciled);
+ $param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
}
}
@@ -768,7 +768,7 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
{
print '';
print ' ';
- print ' '.$langs->trans("NotReconciled").' ';
+ print ' '.$langs->trans("NotReconciled").' ';
print ' ';
}
// Code journal
@@ -953,9 +953,9 @@ while ($i < min($num, $limit))
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'expensereport';
- $filename=dol_sanitizeFileName($line->doc_ref);
- $filedir=$conf->expensereport->dir_output . '/' . dol_sanitizeFileName($line->doc_ref);
- $urlsource=$_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
+ $filename = dol_sanitizeFileName($line->doc_ref);
+ $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
+ $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
}
else
@@ -969,7 +969,7 @@ while ($i < min($num, $limit))
// Picto + Ref
print '';
- if($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report')
+ if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report')
{
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
print $documentlink;
diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php
index 2cb28b59584..bb6f95d9047 100644
--- a/htdocs/accountancy/bookkeeping/listbyaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbyaccount.php
@@ -62,7 +62,7 @@ $search_credit = GETPOST('search_credit', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
index 91ce9f5e31a..1dfb324599c 100644
--- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
+++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
@@ -47,7 +47,7 @@ $socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == - 1) {
$page = 0;
} // If $page is not defined, or '' or -1
diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php
index 867f5303ff8..5a5a4d36c21 100644
--- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php
+++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php
@@ -46,7 +46,7 @@ $socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == - 1) {
$page = 0;
} // If $page is not defined, or '' or -1
diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php
index 847aa3ef47e..bb1f1b8679c 100644
--- a/htdocs/accountancy/class/accountancyexport.class.php
+++ b/htdocs/accountancy/class/accountancyexport.class.php
@@ -54,6 +54,7 @@ class AccountancyExport
public static $EXPORT_TYPE_QUADRATUS = 60;
public static $EXPORT_TYPE_OPENCONCERTO = 100;
public static $EXPORT_TYPE_LDCOMPTA = 110;
+ public static $EXPORT_TYPE_LDCOMPTA10 = 120;
public static $EXPORT_TYPE_FEC = 1000;
@@ -110,8 +111,9 @@ class AccountancyExport
self::$EXPORT_TYPE_OPENCONCERTO => $langs->trans('Modelcsv_openconcerto'),
self::$EXPORT_TYPE_SAGE50_SWISS => $langs->trans('Modelcsv_Sage50_Swiss'),
self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'),
+ self::$EXPORT_TYPE_LDCOMPTA10 => $langs->trans('Modelcsv_LDCompta10'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
- self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'),
+ self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'),
);
ksort($listofexporttypes, SORT_NUMERIC);
@@ -140,6 +142,7 @@ class AccountancyExport
self::$EXPORT_TYPE_OPENCONCERTO => 'openconcerto',
self::$EXPORT_TYPE_SAGE50_SWISS => 'sage50ch',
self::$EXPORT_TYPE_LDCOMPTA => 'ldcompta',
+ self::$EXPORT_TYPE_LDCOMPTA10 => 'ldcompta10',
self::$EXPORT_TYPE_FEC => 'fec',
);
@@ -201,6 +204,10 @@ class AccountancyExport
self::$EXPORT_TYPE_LDCOMPTA => array(
'label' => $langs->trans('Modelcsv_LDCompta'),
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
+ ),
+ self::$EXPORT_TYPE_LDCOMPTA10 => array(
+ 'label' => $langs->trans('Modelcsv_LDCompta10'),
+ 'ACCOUNTING_EXPORT_FORMAT' => 'csv',
),
self::$EXPORT_TYPE_FEC => array(
'label' => $langs->trans('Modelcsv_FEC'),
@@ -280,6 +287,9 @@ class AccountancyExport
case self::$EXPORT_TYPE_LDCOMPTA :
$this->exportLDCompta($TData);
break;
+ case self::$EXPORT_TYPE_LDCOMPTA10 :
+ $this->exportLDCompta10($TData);
+ break;
case self::$EXPORT_TYPE_FEC :
$this->exportFEC($TData);
break;
@@ -921,7 +931,7 @@ class AccountancyExport
/**
* Export format : LD Compta version 9 & higher
- * http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf
+ * http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW9.pdf
*
* @param array $objectLines data
*
@@ -1051,6 +1061,261 @@ class AccountancyExport
}
}
+ /**
+ * Export format : LD Compta version 10 & higher
+ * http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf
+ *
+ * @param array $objectLines data
+ *
+ * @return void
+ */
+ public function exportLDCompta10($objectLines)
+ {
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+
+ $separator = ';';
+ $end_line = "\r\n";
+ $last_codeinvoice = '';
+
+ foreach ($objectLines as $line) {
+ // TYPE C
+ if($last_codeinvoice != $line->doc_ref){
+ //recherche societe en fonction de son code client
+ $sql = "SELECT code_client, fk_forme_juridique, nom, address, zip, town, fk_pays, phone, siret FROM ".MAIN_DB_PREFIX."societe WHERE code_client = '".$line->thirdparty_code ."'";
+ $resql = $this->db->query($sql);
+
+ if($resql && $this->db->num_rows($resql)>0)
+ {
+ $soc = $this->db->fetch_object($resql);
+
+ $address = str_replace(array("\t", "\n", "\r"), " ", $soc->address);
+
+ $type_enregistrement = 'C';
+ print $type_enregistrement.$separator;
+ //NOCL
+ print $soc->code_client.$separator;
+ //NMCM
+ print $separator;
+ //LIBI
+ print $separator;
+ //TITR
+ print getFormeJuridiqueLabel($soc->fk_forme_juridique).$separator;
+ //RSSO
+ print $soc->nom.$separator;
+ //CAD1
+ print substr($address, 0, 40).$separator;
+ //CAD2
+ print substr($address, 41, 40).$separator;
+ //CAD3
+ print substr($address, 82, 40).$separator;
+ //COPO
+ print $soc->zip.$separator;
+ //BUDI
+ print substr($soc->town, 0, 40).$separator;
+ //CPAY
+ print $separator;
+ //PAYS
+ print substr(getCountry($soc->fk_pays), 0, 40).$separator;
+ //NTEL
+ print $soc->phone.$separator;
+ //TLEX
+ print $separator;
+ //TLPO
+ print $separator;
+ //TLCY
+ print $separator;
+ //NINT
+ print $separator;
+ //COMM
+ print $separator;
+ //SIRE
+ print $soc->siret.$separator;
+ //RIBP
+ print $separator;
+ //DOBQ
+ print $separator;
+ //IBBQ
+ print $separator;
+ //COBQ
+ print $separator;
+ //GUBQ
+ print $separator;
+ //CPBQ
+ print $separator;
+ //CLBQ
+ print $separator;
+ //BIBQ
+ print $separator;
+ //MOPM
+ print $separator;
+ //DJPM
+ print $separator;
+ //DMPM
+ print $separator;
+ //REFM
+ print $separator;
+ //SLVA
+ print $separator;
+ //PLCR
+ print $separator;
+ //ECFI
+ print $separator;
+ //CREP
+ print $separator;
+ //NREP
+ print $separator;
+ //TREP
+ print $separator;
+ //MREP
+ print $separator;
+ //GRRE
+ print $separator;
+ //LTTA
+ print $separator;
+ //CACT
+ print $separator;
+ //CODV
+ print $separator;
+ //GRTR
+ print $separator;
+ //NOFP
+ print $separator;
+ //BQAF
+ print $separator;
+ //BONP
+ print $separator;
+ //CESC
+ print $separator;
+
+ print $end_line;
+ }
+ }
+
+ $date_document = dol_print_date($line->doc_date, '%Y%m%d');
+ $date_creation = dol_print_date($line->date_creation, '%Y%m%d');
+ $date_lim_reglement = dol_print_date($line->date_lim_reglement, '%Y%m%d');
+
+ // TYPE E
+ $type_enregistrement = 'E'; // For write movement
+ print $type_enregistrement.$separator;
+ // JNAL
+ print substr($line->code_journal, 0, 2).$separator;
+ // NECR
+ print $line->id.$separator;
+ // NPIE
+ print $line->piece_num.$separator;
+ // DATP
+ print $date_document.$separator;
+ // LIBE
+ print dol_trunc($line->label_operation, 25, 'right', 'UTF-8', 1).$separator;
+ // DATH
+ print $date_lim_reglement.$separator;
+ // CNPI
+ if ($line->doc_type == 'supplier_invoice') {
+ if ($line->montant < 0) {
+ $nature_piece = 'AF';
+ } else {
+ $nature_piece = 'FF';
+ }
+ } elseif ($line->doc_type == 'customer_invoice') {
+ if ($line->montant < 0) {
+ $nature_piece = 'AC';
+ } else {
+ $nature_piece = 'FC';
+ }
+ } else {
+ $nature_piece = '';
+ }
+ print $nature_piece.$separator;
+ // RACI
+ // if (! empty($line->subledger_account)) {
+ // if ($line->doc_type == 'supplier_invoice') {
+ // $racine_subledger_account = '40';
+ // } elseif ($line->doc_type == 'customer_invoice') {
+ // $racine_subledger_account = '41';
+ // } else {
+ // $racine_subledger_account = '';
+ // }
+ // } else {
+ $racine_subledger_account = ''; // for records of type E leave this field blank
+ // }
+
+ print $racine_subledger_account . $separator; // deprecated CPTG & CPTA use instead
+ // MONT
+ print price(abs($line->montant), 0, '', 1, 2).$separator;
+ // CODC
+ print $line->sens.$separator;
+ // CPTG
+ print length_accountg($line->numero_compte).$separator;
+ // DATE
+ print $date_document.$separator;
+ // CLET
+ print $line->lettering_code.$separator;
+ // DATL
+ print $line->date_lettering.$separator;
+ // CPTA
+ if (!empty($line->subledger_account)) {
+ print length_accounta($line->subledger_account).$separator;
+ } else {
+ print $separator;
+ }
+ // CNAT
+ if ($line->doc_type == 'supplier_invoice' && !empty($line->subledger_account)) {
+ print 'F'.$separator;
+ } elseif ($line->doc_type == 'customer_invoice' && !empty($line->subledger_account)) {
+ print 'C'.$separator;
+ } else {
+ print $separator;
+ }
+ // SECT
+ print $separator;
+ // CTRE
+ print $separator;
+ // NORL
+ print $separator;
+ // DATV
+ print $separator;
+ // REFD
+ print $line->doc_ref.$separator;
+ // NECA
+ print '0'.$separator;
+ // CSEC
+ print $separator;
+ // CAFF
+ print $separator;
+ // CDES
+ print $separator;
+ // QTUE
+ print '0'.$separator;
+ // MTDV
+ print $separator;
+ // CODV
+ print '0'.$separator;
+ // TXDV
+ print $separator;
+ // MOPM
+ print $separator;
+ // BONP
+ print $separator;
+ // BQAF
+ print $separator;
+ // ECES
+ print $separator;
+ // TXTL
+ print $separator;
+ // ECRM
+ print $separator;
+ // DATK
+ print $separator;
+ // HEUK
+ print $separator;
+
+ print $end_line;
+
+ $last_codeinvoice = $line->doc_ref;
+ }
+ }
+
/**
* Export format : Charlemagne
*
diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php
index 21f7c1cb210..0178f87a32d 100644
--- a/htdocs/accountancy/class/accountingaccount.class.php
+++ b/htdocs/accountancy/class/accountingaccount.class.php
@@ -135,6 +135,11 @@ class AccountingAccount extends CommonObject
*/
public $active;
+ /**
+ * @var int reconciliable
+ */
+ public $reconciliable;
+
/**
* Constructor
*
@@ -162,7 +167,7 @@ class AccountingAccount extends CommonObject
global $conf;
if ($rowid || $account_number) {
- $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active";
+ $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active, a.reconciliable";
$sql .= ", ca.label as category_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid";
@@ -203,6 +208,7 @@ class AccountingAccount extends CommonObject
$this->fk_user_modif = $obj->fk_user_modif;
$this->active = $obj->active;
$this->status = $obj->active;
+ $this->reconciliable = $obj->reconciliable;
return $this->id;
} else {
@@ -261,6 +267,7 @@ class AccountingAccount extends CommonObject
$sql .= ", fk_accounting_category";
$sql .= ", fk_user_author";
$sql .= ", active";
+ $sql .= ", reconciliable";
$sql .= ") VALUES (";
$sql .= " '" . $this->db->idate($now) . "'";
$sql .= ", " . $conf->entity;
@@ -273,6 +280,7 @@ class AccountingAccount extends CommonObject
$sql .= ", " . (empty($this->account_category) ? 0 : (int) $this->account_category);
$sql .= ", " . $user->id;
$sql .= ", " . (int) $this->active;
+ $sql .= ", " . (int) $this->reconciliable;
$sql .= ")";
$this->db->begin();
@@ -340,6 +348,7 @@ class AccountingAccount extends CommonObject
$sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : (int) $this->account_category);
$sql .= " , fk_user_modif = " . $user->id;
$sql .= " , active = " . (int) $this->active;
+ $sql .= " , reconciliable = " . (int) $this->reconciliable;
$sql .= " WHERE rowid = " . $this->id;
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
@@ -565,21 +574,31 @@ class AccountingAccount extends CommonObject
* Account deactivated
*
* @param int $id Id
+ * @param int $mode 0=field active, 1=field active_customer_list, 2=field_active_supplier_list
* @return int <0 if KO, >0 if OK
*/
- public function account_desactivate($id)
+ public function account_desactivate($id, $mode = 0)
{
// phpcs:enable
$result = $this->checkUsage();
+ if ($mode == 0)
+ {
+ $fieldtouse = 'active';
+ }
+ elseif ($mode == 1)
+ {
+ $fieldtouse = 'reconciliable';
+ }
+
if ($result > 0) {
$this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
- $sql .= "SET active = '0'";
+ $sql .= "SET " . $fieldtouse . " = '0'";
$sql .= " WHERE rowid = " . $this->db->escape($id);
- dol_syslog(get_class($this) . "::desactivate sql=" . $sql, LOG_DEBUG);
+ dol_syslog(get_class($this) . "::account_desactivate " . $fieldtouse . " sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
@@ -600,18 +619,28 @@ class AccountingAccount extends CommonObject
* Account activated
*
* @param int $id Id
+ * @param int $mode 0=field active, 1=field reconciliable, 2=field active_customer_list, 3=field_active_supplier_list
* @return int <0 if KO, >0 if OK
*/
- public function account_activate($id)
+ public function account_activate($id, $mode = 0)
{
// phpcs:enable
$this->db->begin();
+ if ($mode == 0)
+ {
+ $fieldtouse = 'active';
+ }
+ elseif ($mode == 1)
+ {
+ $fieldtouse = 'reconciliable';
+ }
+
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
- $sql .= "SET active = '1'";
+ $sql .= "SET " . $fieldtouse . " = '1'";
$sql .= " WHERE rowid = " . $this->db->escape($id);
- dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG);
+ dol_syslog(get_class($this) . "::account_activate " . $fieldtouse . " sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$this->db->commit();
diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php
index 48df5ce374a..19a5adcca34 100644
--- a/htdocs/accountancy/customer/index.php
+++ b/htdocs/accountancy/customer/index.php
@@ -122,8 +122,8 @@ if ($action == 'validatehistory') {
// Customer Invoice lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
- $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
- $sql .= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
+ $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
+ $sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
$sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.tva_intra";
@@ -154,14 +154,22 @@ if ($action == 'validatehistory') {
$isBuyerInEEC = isInEEC($objp);
- // Search suggested account for product/service
+ // Search suggested account for product/service (similar code exists in page list.php to make manual binding)
$suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_sell_p = $objp->code_sell;
$objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = '';
} else {
- if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
+ if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with VAT
+ $objp->code_sell_p = $objp->code_sell;
+ $objp->aarowid_suggest = $objp->aarowid;
+ $suggestedaccountingaccountfor = 'eecwithvat';
+ } elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
+ $objp->code_sell_p = $objp->code_sell;
+ $objp->aarowid_suggest = 0; // There is a doubt, no automatic binding
+ $suggestedaccountingaccountfor = 'eecwithoutvatnumber';
+ } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_sell_p = $objp->code_sell_intra;
$objp->aarowid_suggest = $objp->aarowid_intra;
$suggestedaccountingaccountfor = 'eec';
diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index d52c4c51f07..55342a98c27 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -60,7 +60,7 @@ $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) $page = 0;
$pageprev = $page - 1;
$pagenext = $page + 1;
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index d964d348889..9e4f73d8f7a 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -69,7 +69,7 @@ $btn_ventil = GETPOST('ventil', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
@@ -206,8 +206,10 @@ if (empty($chartaccountcode))
// Customer Invoice lines
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
-$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
-$sql .= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
+$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
+$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
+$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
+$sql .= " p.tosell as status, p.tobuy as status_buy,";
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
$sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.tva_intra";
@@ -399,7 +401,7 @@ if ($result) {
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
- print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
+ print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
$checkpicto = '';
if ($massactionbutton) $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
@@ -423,6 +425,14 @@ if ($result) {
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
$product_static->label = $objp->product_label;
+ $product_static->status = $objp->status;
+ $product_static->status_buy = $objp->status_buy;
+ $product_static->accountancy_code_sell = $objp->code_sell;
+ $product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
+ $product_static->accountancy_code_sell_export = $objp->code_sell_export;
+ $product_static->accountancy_code_buy = $objp->code_buy;
+ $product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
+ $product_static->accountancy_code_buy_export = $objp->code_buy_export;
$facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid;
@@ -433,13 +443,20 @@ if ($result) {
$isBuyerInEEC = isInEEC($objp);
+ // Search suggested default account for product/service
$suggestedaccountingaccountbydefaultfor = '';
if ($objp->type_l == 1) {
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = '';
} else {
- if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
+ if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with a VAT
+ $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
+ $suggestedaccountingaccountbydefaultfor = 'eecwithvat';
+ } elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
+ $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
+ $suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
+ } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = 'eec';
} else { // Foreign sale
@@ -452,7 +469,13 @@ if ($result) {
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = '';
} else {
- if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
+ if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with a VAT
+ $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
+ $suggestedaccountingaccountbydefaultfor = 'eecwithvat';
+ } elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
+ $objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
+ $suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
+ } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = 'eec';
} else {
@@ -463,14 +486,22 @@ if ($result) {
}
if ($objp->code_sell_l == -1) $objp->code_sell_l = '';
- // Search suggested account for product/service
+ // Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
$suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_sell_p = $objp->code_sell;
$objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = '';
} else {
- if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
+ if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with VAT
+ $objp->code_sell_p = $objp->code_sell;
+ $objp->aarowid_suggest = $objp->aarowid;
+ $suggestedaccountingaccountfor = 'eecwithvat';
+ } elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
+ $objp->code_sell_p = $objp->code_sell;
+ $objp->aarowid_suggest = $objp->aarowid; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ?
+ $suggestedaccountingaccountfor = 'eecwithoutvatnumber';
+ } elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_sell_p = $objp->code_sell_intra;
$objp->aarowid_suggest = $objp->aarowid_intra;
$suggestedaccountingaccountfor = 'eec';
@@ -487,6 +518,7 @@ if ($result) {
$code_sell_p_notset = 'color:orange';
}
if (empty($objp->code_sell_l) && empty($objp->code_sell_p)) $code_sell_p_notset = 'color:red';
+ if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber' && empty($code_sell_p_notset)) $code_sell_p_notset = 'color:orange';
// $objp->code_sell_l is now default code of product/service
// $objp->code_sell_p is now code of product/service
@@ -503,9 +535,10 @@ if ($result) {
// Ref Product
print ' ';
- if ($product_static->id > 0)
+ if ($product_static->id > 0) {
print $product_static->getNomUrl(1);
- if ($objp->product_label) print ' '.$objp->product_label;
+ }
+ if ($objp->product_label) print ''.$objp->product_label.' ';
print ' ';
print '';
@@ -535,7 +568,7 @@ if ($result) {
// Current account
print ' ';
- $s = (($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
+ $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
@@ -544,9 +577,11 @@ if ($result) {
if ($objp->product_id > 0)
{
print ' ';
- $s = (($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
+ $s = ''.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
$shelp = '';
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
+ elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT");
+ elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber");
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
$s .= (empty($objp->code_sell_p) ? $langs->trans("NotDefined") : length_accountg($objp->code_sell_p));
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
@@ -582,6 +617,7 @@ if ($result) {
print ' ';
//var_dump($objp->aarowid);var_dump($objp->aarowid_intra);var_dump($objp->aarowid_export);var_dump($objp->aarowid_suggest);
$ischecked = $objp->aarowid_suggest;
+ if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $ischecked = 0;
print ' ';
print ' ';
diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php
index cc606555b37..63b142e1bdd 100644
--- a/htdocs/accountancy/expensereport/lines.php
+++ b/htdocs/accountancy/expensereport/lines.php
@@ -55,7 +55,7 @@ $search_year = GETPOST("search_year", "int");
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) $page = 0;
$pageprev = $page - 1;
$pagenext = $page + 1;
diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php
index c0d9d1a03b5..e03c717039f 100644
--- a/htdocs/accountancy/expensereport/list.php
+++ b/htdocs/accountancy/expensereport/list.php
@@ -62,7 +62,7 @@ $search_year = GETPOST("search_year", "int");
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
@@ -313,8 +313,8 @@ if ($result) {
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
- print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', $sortfield, $sortorder, 'center ');
- print_liste_field_titre("IntoAccount", '', '', '', '', '', $sortfield, $sortorder, 'center ');
+ print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
+ print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', '');
$checkpicto = '';
if ($massactionbutton) $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
@@ -366,12 +366,12 @@ if ($result) {
print '';
// Current account
- print '';
+ print ' ';
print length_accountg(html_entity_decode($objp->code_buy));
print ' ';
// Suggested accounting account
- print '';
+ print ' ';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
print ' ';
diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php
index 71fce0be43a..ec193b2922a 100644
--- a/htdocs/accountancy/index.php
+++ b/htdocs/accountancy/index.php
@@ -66,7 +66,7 @@ if ($conf->accounting->enabled)
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
- $helpisexpanded = empty($resultboxes['boxactivated']); // If there is no widget, the tooltip help is expanded by default.
+ $helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default.
$showtutorial = '';
if (!$helpisexpanded)
@@ -222,10 +222,6 @@ if ($conf->accounting->enabled)
$boxlist .= '';
$boxlist .= '
';
- if (!empty($nbworkboardcount))
- {
- $boxlist .= $boxwork;
- }
$boxlist .= $resultboxes['boxlista'];
@@ -233,7 +229,6 @@ if ($conf->accounting->enabled)
$boxlist .= '
';
- $boxlist .= $boxstat;
$boxlist .= $resultboxes['boxlistb'];
$boxlist .= '
';
diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php
index 3bc44698029..07877378ce1 100644
--- a/htdocs/accountancy/supplier/index.php
+++ b/htdocs/accountancy/supplier/index.php
@@ -1,7 +1,7 @@
* Copyright (C) 2013-2014 Florian Henry
- * Copyright (C) 2013-2015 Alexandre Spangaro
+ * Copyright (C) 2013-2020 Alexandre Spangaro
* Copyright (C) 2014 Juanjo Menent
*
* This program is free software; you can redistribute it and/or modify
@@ -119,8 +119,9 @@ if ($action == 'validatehistory') {
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
- $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
- $sql .= " aa.rowid as aarowid,";
+ $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,";
+ $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export, p.tva_tx as tva_tx_prod,";
+ $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
$sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.tva_intra";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
@@ -128,7 +129,9 @@ if ($action == 'validatehistory') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$chartaccountcode."' AND aa2.entity = ".$conf->entity;
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
@@ -157,16 +160,12 @@ if ($action == 'validatehistory') {
$suggestedaccountingaccountfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
- //$objp->code_buy_p = $objp->code_buy_intra;
- $objp->code_buy_p = $objp->code_buy;
- //$objp->aarowid_suggest = $objp->aarowid_intra;
- $objp->aarowid_suggest = $objp->aarowid;
+ $objp->code_buy_p = $objp->code_buy_intra;
+ $objp->aarowid_suggest = $objp->aarowid_intra;
$suggestedaccountingaccountfor = 'eec';
} else { // Foreign sale
- //$objp->code_buy_p = $objp->code_buy_export;
- $objp->code_buy_p = $objp->code_buy;
- //$objp->aarowid_suggest = $objp->aarowid_export;
- $objp->aarowid_suggest = $objp->aarowid;
+ $objp->code_buy_p = $objp->code_buy_export;
+ $objp->aarowid_suggest = $objp->aarowid_export;
$suggestedaccountingaccountfor = 'export';
}
}
diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php
index a035aed2b1f..ef44222568f 100644
--- a/htdocs/accountancy/supplier/lines.php
+++ b/htdocs/accountancy/supplier/lines.php
@@ -62,7 +62,7 @@ $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) $page = 0;
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index ecd41f2f9da..b6c220c347a 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2013-2017 Alexandre Spangaro
+ * Copyright (C) 2013-2020 Alexandre Spangaro
* Copyright (C) 2014-2015 Ari Elbaz (elarifr)
* Copyright (C) 2013-2014 Florian Henry
* Copyright (C) 2014 Juanjo Menent s
@@ -69,7 +69,7 @@ $btn_ventil = GETPOST('ventil', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
@@ -210,8 +210,11 @@ if (empty($chartaccountcode))
// Supplier Invoice Lines
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
-$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
-$sql .= " aa.rowid as aarowid,";
+$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
+$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
+$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
+$sql .= " p.tosell as status, p.tobuy as status_buy,";
+$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
$sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.tva_intra";
$parameters = array();
@@ -222,7 +225,9 @@ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
-$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$chartaccountcode."' AND aa2.entity = ".$conf->entity;
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
// Add search filter like
@@ -396,7 +401,7 @@ if ($result) {
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
- print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
+ print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
$checkpicto = '';
if ($massactionbutton) $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
@@ -414,40 +419,86 @@ if ($result) {
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
$objp->code_buy_l = '';
$objp->code_buy_p = '';
- $objp->aarowid_suggest = '';
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
$product_static->label = $objp->product_label;
+ $product_static->status = $objp->status;
+ $product_static->status_buy = $objp->status_buy;
+ $product_static->accountancy_code_sell = $objp->code_sell;
+ $product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
+ $product_static->accountancy_code_sell_export = $objp->code_sell_export;
+ $product_static->accountancy_code_buy = $objp->code_buy;
+ $product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
+ $product_static->accountancy_code_buy_export = $objp->code_buy_export;
$facturefourn_static->ref = $objp->ref;
$facturefourn_static->id = $objp->facid;
$facturefourn_static->type = $objp->type;
$code_buy_p_notset = '';
- $objp->aarowid_suggest = $objp->aarowid;
+ $objp->aarowid_suggest = ''; // Will be set later
+ $isBuyerInEEC = isInEEC($objp);
+
+ $suggestedaccountingaccountbydefaultfor = '';
if ($objp->type_l == 1) {
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
- if ($objp->aarowid == '')
- $objp->aarowid_suggest = $aarowid_s;
+ if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
+ $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
+ $suggestedaccountingaccountbydefaultfor = '';
+ } else {
+ if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
+ $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : '');
+ $suggestedaccountingaccountbydefaultfor = 'eec';
+ } else { // Foreign sale
+ $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : '');
+ $suggestedaccountingaccountbydefaultfor = 'export';
+ }
+ }
} elseif ($objp->type_l == 0) {
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : '');
- if ($objp->aarowid == '')
- $objp->aarowid_suggest = $aarowid_p;
+ if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
+ $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
+ $suggestedaccountingaccountbydefaultfor = '';
+ } else {
+ if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
+ $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : '');
+ $suggestedaccountingaccountbydefaultfor = 'eec';
+ } else {
+ $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : '');
+ $suggestedaccountingaccountbydefaultfor = 'export';
+ }
+ }
}
- if ($objp->code_buy_l == -1) $objp->code_buy_l = '';
+ if ($objp->code_sell_l == -1) $objp->code_sell_l = '';
- if (!empty($objp->code_buy)) {
- $objp->code_buy_p = $objp->code_buy; // Code on product
+ // Search suggested account for product/service
+ $suggestedaccountingaccountfor = '';
+ if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
+ $objp->code_buy_p = $objp->code_buy;
+ $objp->aarowid_suggest = $objp->aarowid;
+ $suggestedaccountingaccountfor = '';
+ } else {
+ if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
+ $objp->code_buy_p = $objp->code_buy_intra;
+ $objp->aarowid_suggest = $objp->aarowid_intra;
+ $suggestedaccountingaccountfor = 'eec';
+ } else { // Foreign sale
+ $objp->code_buy_p = $objp->code_buy_export;
+ $objp->aarowid_suggest = $objp->aarowid_export;
+ $suggestedaccountingaccountfor = 'export';
+ }
+ }
+
+ if (!empty($objp->code_buy_p)) {
+ // Value was defined previously
} else {
$code_buy_p_notset = 'color:orange';
}
if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) $code_buy_p_notset = 'color:red';
- // $objp->code_buy_p is now code of product/service
// $objp->code_buy_l is now default code of product/service
+ // $objp->code_buy_p is now code of product/service
print '';
@@ -467,7 +518,7 @@ if ($result) {
print '';
if ($product_static->id > 0)
print $product_static->getNomUrl(1);
- if ($objp->product_label) print ' '.$objp->product_label;
+ if ($objp->product_label) print ''.$objp->product_label.' ';
print ' ';
// Description
@@ -498,8 +549,8 @@ if ($result) {
print ''.$objp->tva_intra.' ';
// Current account
- print '';
- $s = (($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
+ print ' ';
+ $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
@@ -508,7 +559,7 @@ if ($result) {
if ($objp->product_id > 0)
{
print ' ';
- $s = (($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
+ $s = ''.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
$shelp = '';
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
@@ -520,6 +571,21 @@ if ($result) {
// Suggested accounting account
print ' ';
$suggestedid = $objp->aarowid_suggest;
+ if (empty($suggestedid) && empty($objp->code_buy_p) && !empty($objp->code_buy_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC))
+ {
+ if (empty($accountingaccount_codetotid_cache[$objp->code_buy_l]))
+ {
+ $tmpaccount = new AccountingAccount($db);
+ $tmpaccount->fetch(0, $objp->code_buy_l, 1);
+ if ($tmpaccount->id > 0) {
+ $suggestedid = $tmpaccount->id;
+ }
+ $accountingaccount_codetotid_cache[$objp->code_buy_l] = $tmpaccount->id;
+ }
+ else {
+ $suggestedid = $accountingaccount_codetotid_cache[$objp->code_buy_l];
+ }
+ }
print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print ' ';
@@ -540,6 +606,9 @@ if ($result) {
} else {
print $db->error();
}
+if ($db->type == 'mysqli') {
+ $db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation
+}
// Add code to auto check the box when we select an account
print ''."\n";
}
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Build a graph using Chart library. Input when calling this method should be:
+ * $this->data = array(array(0=>'labelxA',1=>yA), array('labelxB',yB));
+ * $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // or when there is n series to show for each x
+ * $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // Syntax deprecated
+ * $this->legend= array("Val1",...,"Valn"); // list of n series name
+ * $this->type = array('bars',...'lines', 'linesnopoint'); or array('pie') or array('polar') or array('piesemicircle');
+ * $this->mode = 'depth' ???
+ * $this->bgcolorgrid
+ * $this->datacolor
+ * $this->shownodatagraph
+ *
+ * @param string $file Image file name to use to save onto disk (also used as javascript unique id)
+ * @param string $fileurl Url path to show image if saved onto disk. Never used here.
+ * @return void
+ */
+ private function draw_chart($file, $fileurl)
+ {
+ // phpcs:enable
+ global $conf, $langs;
+
+ dol_syslog(get_class($this)."::draw_chart this->type=".join(',', $this->type)." this->MaxValue=".$this->MaxValue);
+
+ if (empty($this->width) && empty($this->height))
+ {
+ print 'Error width or height not set';
+ return;
+ }
+
+ $showlegend = $this->showlegend;
+
+ $legends = array();
+ $nblot = 0;
+ if (is_array($this->data)) {
+ foreach ($this->data as $valarray) // Loop on each x
+ {
+ $nblot = max($nblot, count($valarray) - 1); // -1 to remove legend
+ }
+ }
+ //var_dump($nblot);
+ if ($nblot < 0) dol_syslog('Bad value for property ->data. Must be set by mydolgraph->SetData before calling mydolgrapgh->draw', LOG_WARNING);
+ $firstlot = 0;
+ // Works with line but not with bars
+ //if ($nblot > 2) $firstlot = ($nblot - 2); // We limit nblot to 2 because jflot can't manage more than 2 bars on same x
+
+ $serie = array(); $arrayofgroupslegend = array();
+ //var_dump($this->data);
+
+ $i = $firstlot;
+ while ($i < $nblot) // Loop on each serie
+ {
+ $values = array(); // Array with horizontal y values (specific values of a serie) for each abscisse x (with x=0,1,2,...)
+ $serie[$i] = "";
+
+ // Fill array $values
+ $x = 0;
+ foreach ($this->data as $valarray) // Loop on each x
+ {
+ $legends[$x] = (array_key_exists('label', $valarray) ? $valarray['label'] : $valarray[0]);
+ $array_of_ykeys = array_keys($valarray);
+ $alabelexists = 1;
+ $tmpykey = explode('_', ($array_of_ykeys[$i + ($alabelexists ? 1 : 0)]), 3);
+ if (!empty($tmpykey[2]) || $tmpykey[2] == '0') { // This is a 'Group by' array
+ $tmpvalue = (array_key_exists('y_'.$tmpykey[1].'_'.$tmpykey[2], $valarray) ? $valarray['y_'.$tmpykey[1].'_'.$tmpykey[2]] : $valarray[$i + 1]);
+ $values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
+ $arrayofgroupslegend[$i] = array(
+ 'stacknum'=> $tmpykey[1],
+ 'legend' => $this->Legend[$tmpykey[1]],
+ 'legendwithgroup' => $this->Legend[$tmpykey[1]].' - '.$tmpykey[2]
+ );
+ } else {
+ $tmpvalue = (array_key_exists('y_'.$i, $valarray) ? $valarray['y_'.$i] : $valarray[$i + 1]);
+ //var_dump($i.'_'.$x.'_'.$tmpvalue);
+ $values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
+ }
+ $x++;
+ }
+ //var_dump($values);
+ $j = 0;
+ foreach ($values as $x => $y) {
+ if (isset($y)) {
+ $serie[$i] .= ($j > 0 ? ", " : "").$y;
+ } else {
+ $serie[$i] .= ($j > 0 ? ", " : "").'null';
+ }
+ $j++;
+ }
+
+ $values = null; // Free mem
+ $i++;
+ }
+ //var_dump($serie);
+ //var_dump($arrayofgroupslegend);
+
+ $tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
+
+ $this->stringtoshow = ''."\n";
+ if (!empty($this->title)) $this->stringtoshow .= ''.$this->title.'
';
+ if (!empty($this->shownographyet))
+ {
+ $this->stringtoshow .= '
';
+ $this->stringtoshow .= ''.$langs->trans("NotEnoughDataYet").'...
';
+ return;
+ }
+
+ // Start the div that will contains all the graph
+ $dolxaxisvertical='';
+ if (count($this->data) > 20) $dolxaxisvertical='dol-xaxis-vertical';
+ // No height for the pie grah
+ $cssfordiv = 'dolgraphchart';
+ if (isset($this->type[$firstlot])) $cssfordiv .= ' dolgraphchar'.$this->type[$firstlot];
+ $this->stringtoshow .= '
'."\n";
+
+ $this->stringtoshow .= ''."\n";
+ }
+
+
/**
* Output HTML string to total value
*
@@ -1159,11 +1313,11 @@ class DolGraph
if ($shownographyet)
{
$s = '
';
- $s .= '';
+ $s .= '
';
if (is_numeric($shownographyet)) {
- $s .= $langs->trans("NotEnoughDataYet");
+ $s .= $langs->trans("NotEnoughDataYet").'...';
} else {
- $s .= $shownographyet;
+ $s .= $shownographyet.'...';
}
$s .= '
';
return $s;
diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php
new file mode 100644
index 00000000000..a520ebb3a21
--- /dev/null
+++ b/htdocs/core/class/evalmath.class.php
@@ -0,0 +1,507 @@
+
+ *
+ * ================================================================================
+ *
+ * NAME
+ * EvalMath - safely evaluate math expressions
+ *
+ * SYNOPSIS
+ * include('evalmath.class.php');
+ * $m = new EvalMath;
+ * // basic evaluation:
+ * $result = $m->evaluate('2+2');
+ * // supports: order of operation; parentheses; negation; built-in functions
+ * $result = $m->evaluate('-8(5/2)^2*(1-sqrt(4))-8');
+ * // create your own variables
+ * $m->evaluate('a = e^(ln(pi))');
+ * // or functions
+ * $m->evaluate('f(x,y) = x^2 + y^2 - 2x*y + 1');
+ * // and then use them
+ * $result = $m->evaluate('3*f(42,a)');
+ *
+ * DESCRIPTION
+ * Use the EvalMath class when you want to evaluate mathematical expressions
+ * from untrusted sources. You can define your own variables and functions,
+ * which are stored in the object. Try it, it's fun!
+ *
+ * METHODS
+ * $m->evalute($expr)
+ * Evaluates the expression and returns the result. If an error occurs,
+ * prints a warning and returns false. If $expr is a function assignment,
+ * returns true on success.
+ *
+ * $m->e($expr)
+ * A synonym for $m->evaluate().
+ *
+ * $m->vars()
+ * Returns an associative array of all user-defined variables and values.
+ *
+ * $m->funcs()
+ * Returns an array of all user-defined functions.
+ *
+ * PARAMETERS
+ * $m->suppress_errors
+ * Set to true to turn off warnings when evaluating expressions
+ *
+ * $m->last_error
+ * If the last evaluation failed, contains a string describing the error.
+ * (Useful when suppress_errors is on).
+ *
+ * $m->last_error_code
+ * If the last evaluation failed, 2 element array with numeric code and extra info
+ *
+ * AUTHOR INFORMATION
+ * Copyright 2005, Miles Kaufmann.
+ *
+ * LICENSE
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1 Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file core/class/evalmath.class.php
+ * \ingroup core
+ * \brief This file for Math evaluation
+ */
+
+/**
+ * Class EvalMath
+ */
+class EvalMath
+{
+
+ public $suppress_errors = false;
+
+ public $last_error = null;
+
+ public $last_error_code = null;
+
+ public $v = array('e' => 2.71,'pi' => 3.14159);
+
+ // variables (and constants)
+ public $f = array();
+
+ // user-defined functions
+ public $vb = array('e','pi');
+
+ // constants
+ public $fb = array( // built-in functions
+ 'sin','sinh','arcsin','asin','arcsinh','asinh','cos','cosh','arccos','acos','arccosh','acosh','tan','tanh','arctan','atan','arctanh','atanh','sqrt','abs','ln','log','intval');
+
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ // make the variables a little more accurate
+ $this->v['pi'] = pi();
+ $this->v['e'] = exp(1);
+ }
+
+ /**
+ * Evaluate
+ *
+ * @param string $expr String
+ * @return boolean|number|NULL|mixed Result
+ */
+ public function e($expr)
+ {
+ return $this->evaluate($expr);
+ }
+
+ /**
+ * Evaluate
+ *
+ * @param string $expr String
+ * @return boolean|number|NULL|mixed Result
+ */
+ public function evaluate($expr)
+ {
+ $this->last_error = null;
+ $this->last_error_code = null;
+ $expr = trim($expr);
+ if (substr($expr, - 1, 1) == ';')
+ $expr = substr($expr, 0, strlen($expr) - 1); // strip semicolons at the end
+ // ===============
+ // is it a variable assignment?
+ $matches = array();
+ if (preg_match('/^\s*([a-z]\w*)\s*=\s*(.+)$/', $expr, $matches)) {
+ if (in_array($matches[1], $this->vb)) { // make sure we're not assigning to a constant
+ return $this->trigger(1, "cannot assign to constant '$matches[1]'", $matches[1]);
+ }
+ if (($tmp = $this->pfx($this->nfx($matches[2]))) === false)
+ return false; // get the result and make sure it's good
+ $this->v[$matches[1]] = $tmp; // if so, stick it in the variable array
+ return $this->v[$matches[1]]; // and return the resulting value
+ // ===============
+ // is it a function assignment?
+ } elseif (preg_match('/^\s*([a-z]\w*)\s*\(\s*([a-z]\w*(?:\s*,\s*[a-z]\w*)*)\s*\)\s*=\s*(.+)$/', $expr, $matches)) {
+ $fnn = $matches[1]; // get the function name
+ if (in_array($matches[1], $this->fb)) { // make sure it isn't built in
+ return $this->trigger(2, "cannot redefine built-in function '$matches[1]()'", $matches[1]);
+ }
+ $args = explode(",", preg_replace("/\s+/", "", $matches[2])); // get the arguments
+ if (($stack = $this->nfx($matches[3])) === false)
+ return false; // see if it can be converted to postfix
+ $nbstack = count($stack);
+ for ($i = 0; $i < $nbstack; $i ++) { // freeze the state of the non-argument variables
+ $token = $stack[$i];
+ if (preg_match('/^[a-z]\w*$/', $token) and ! in_array($token, $args)) {
+ if (array_key_exists($token, $this->v)) {
+ $stack[$i] = $this->v[$token];
+ } else {
+ return $this->trigger(3, "undefined variable '$token' in function definition", $token);
+ }
+ }
+ }
+ $this->f[$fnn] = array('args' => $args,'func' => $stack);
+ return true;
+ // ===============
+ } else {
+ return $this->pfx($this->nfx($expr)); // straight up evaluation, woo
+ }
+ }
+
+ /**
+ * vars
+ *
+ * @return string Output
+ */
+ private function vars()
+ {
+ $output = $this->v;
+ unset($output['pi']);
+ unset($output['e']);
+ return $output;
+ }
+
+ /**
+ * vars
+ *
+ * @return string Output
+ */
+ private function funcs()
+ {
+ $output = array();
+ foreach ($this->f as $fnn => $dat)
+ $output[] = $fnn . '(' . implode(',', $dat['args']) . ')';
+ return $output;
+ }
+
+ // ===================== HERE BE INTERNAL METHODS ====================\\
+
+ /**
+ * Convert infix to postfix notation
+ *
+ * @param string $expr Expression
+ * @return string Output
+ */
+ private function nfx($expr)
+ {
+ $index = 0;
+ $stack = new EvalMathStack();
+ $output = array(); // postfix form of expression, to be passed to pfx()
+ $expr = trim(strtolower($expr));
+
+ $ops = array('+','-','*','/','^','_');
+ $ops_r = array('+' => 0,'-' => 0,'*' => 0,'/' => 0,'^' => 1); // right-associative operator?
+ $ops_p = array('+' => 0,'-' => 0,'*' => 1,'/' => 1,'_' => 1,'^' => 2); // operator precedence
+
+ $expecting_op = false; // we use this in syntax-checking the expression
+ // and determining when a - is a negation
+
+ $matches = array();
+ if (preg_match("/[^\w\s+*^\/()\.,-]/", $expr, $matches)) { // make sure the characters are all good
+ return $this->trigger(4, "illegal character '{$matches[0]}'", $matches[0]);
+ }
+
+ while (1) { // 1 Infinite Loop ;)
+ $op = substr($expr, $index, 1); // get the first character at the current index
+ // find out if we're currently at the beginning of a number/variable/function/parenthesis/operand
+ $match = array();
+ $ex = preg_match('/^([a-z]\w*\(?|\d+(?:\.\d*)?|\.\d+|\()/', substr($expr, $index), $match);
+ // ===============
+ if ($op == '-' and ! $expecting_op) { // is it a negation instead of a minus?
+ $stack->push('_'); // put a negation on the stack
+ $index ++;
+ } elseif ($op == '_') { // we have to explicitly deny this, because it's legal on the stack
+ return $this->trigger(4, "illegal character '_'", "_"); // but not in the input expression
+ // ===============
+ } elseif ((in_array($op, $ops) or $ex) and $expecting_op) { // are we putting an operator on the stack?
+ if ($ex) { // are we expecting an operator but have a number/variable/function/opening parethesis?
+ $op = '*';
+ $index --; // it's an implicit multiplication
+ }
+ // heart of the algorithm:
+ while ($stack->count > 0 and ($o2 = $stack->last()) and in_array($o2, $ops) and ($ops_r[$op] ? $ops_p[$op] < $ops_p[$o2] : $ops_p[$op] <= $ops_p[$o2])) {
+ $output[] = $stack->pop(); // pop stuff off the stack into the output
+ }
+ // many thanks: http://en.wikipedia.org/wiki/Reverse_Polish_notation#The_algorithm_in_detail
+ $stack->push($op); // finally put OUR operator onto the stack
+ $index ++;
+ $expecting_op = false;
+ // ===============
+ } elseif ($op == ')' and $expecting_op) { // ready to close a parenthesis?
+ while (($o2 = $stack->pop()) != '(') { // pop off the stack back to the last (
+ if (is_null($o2))
+ return $this->trigger(5, "unexpected ')'", ")");
+ else
+ $output[] = $o2;
+ }
+ if (preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches)) { // did we just close a function?
+ $fnn = $matches[1]; // get the function name
+ $arg_count = $stack->pop(); // see how many arguments there were (cleverly stored on the stack, thank you)
+ $output[] = $stack->pop(); // pop the function and push onto the output
+ if (in_array($fnn, $this->fb)) { // check the argument count
+ if ($arg_count > 1)
+ return $this->trigger(6, "wrong number of arguments ($arg_count given, 1 expected)", array($arg_count,1));
+ } elseif (array_key_exists($fnn, $this->f)) {
+ if ($arg_count != count($this->f[$fnn]['args']))
+ return $this->trigger(6, "wrong number of arguments ($arg_count given, " . count($this->f[$fnn]['args']) . " expected)", array($arg_count,count($this->f[$fnn]['args'])));
+ } else { // did we somehow push a non-function on the stack? this should never happen
+ return $this->trigger(7, "internal error");
+ }
+ }
+ $index ++;
+ // ===============
+ } elseif ($op == ',' and $expecting_op) { // did we just finish a function argument?
+ while (($o2 = $stack->pop()) != '(') {
+ if (is_null($o2))
+ return $this->trigger(5, "unexpected ','", ","); // oops, never had a (
+ else
+ $output[] = $o2; // pop the argument expression stuff and push onto the output
+ }
+ // make sure there was a function
+ if (! preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches))
+ return $this->trigger(5, "unexpected ','", ",");
+ $stack->push($stack->pop() + 1); // increment the argument count
+ $stack->push('('); // put the ( back on, we'll need to pop back to it again
+ $index ++;
+ $expecting_op = false;
+ // ===============
+ } elseif ($op == '(' and ! $expecting_op) {
+ $stack->push('('); // that was easy
+ $index ++;
+ $allow_neg = true;
+ // ===============
+ } elseif ($ex and ! $expecting_op) { // do we now have a function/variable/number?
+ $expecting_op = true;
+ $val = $match[1];
+ if (preg_match("/^([a-z]\w*)\($/", $val, $matches)) { // may be func, or variable w/ implicit multiplication against parentheses...
+ if (in_array($matches[1], $this->fb) or array_key_exists($matches[1], $this->f)) { // it's a func
+ $stack->push($val);
+ $stack->push(1);
+ $stack->push('(');
+ $expecting_op = false;
+ } else { // it's a var w/ implicit multiplication
+ $val = $matches[1];
+ $output[] = $val;
+ }
+ } else { // it's a plain old var or num
+ $output[] = $val;
+ }
+ $index += strlen($val);
+ // ===============
+ } elseif ($op == ')') { // miscellaneous error checking
+ return $this->trigger(5, "unexpected ')'", ")");
+ } elseif (in_array($op, $ops) and ! $expecting_op) {
+ return $this->trigger(8, "unexpected operator '$op'", $op);
+ } else { // I don't even want to know what you did to get here
+ return $this->trigger(9, "an unexpected error occured");
+ }
+ if ($index == strlen($expr)) {
+ if (in_array($op, $ops)) { // did we end with an operator? bad.
+ return $this->trigger(10, "operator '$op' lacks operand", $op);
+ } else {
+ break;
+ }
+ }
+ while (substr($expr, $index, 1) == ' ') { // step the index past whitespace (pretty much turns whitespace
+ $index ++; // into implicit multiplication if no operator is there)
+ }
+ }
+ while (! is_null($op = $stack->pop())) { // pop everything off the stack and push onto output
+ if ($op == '(')
+ return $this->trigger(11, "expecting ')'", ")"); // if there are (s on the stack, ()s were unbalanced
+ $output[] = $op;
+ }
+ return $output;
+ }
+
+ /**
+ * evaluate postfix notation
+ *
+ * @param string $tokens Expression
+ * @param array $vars Array
+ * @return string Output
+ */
+ private function pfx($tokens, $vars = array())
+ {
+ if ($tokens == false)
+ return false;
+
+ $stack = new EvalMathStack();
+
+ foreach ($tokens as $token) { // nice and easy
+ // if the token is a binary operator, pop two values off the stack, do the operation, and push the result back on
+ $matches = array();
+ if (in_array($token, array('+','-','*','/','^'))) {
+ if (is_null($op2 = $stack->pop()))
+ return $this->trigger(12, "internal error");
+ if (is_null($op1 = $stack->pop()))
+ return $this->trigger(13, "internal error");
+ switch ($token) {
+ case '+':
+ $stack->push($op1 + $op2);
+ break;
+ case '-':
+ $stack->push($op1 - $op2);
+ break;
+ case '*':
+ $stack->push($op1 * $op2);
+ break;
+ case '/':
+ if ($op2 == 0)
+ return $this->trigger(14, "division by zero");
+ $stack->push($op1 / $op2);
+ break;
+ case '^':
+ $stack->push(pow($op1, $op2));
+ break;
+ }
+ // if the token is a unary operator, pop one value off the stack, do the operation, and push it back on
+ } elseif ($token == "_") {
+ $stack->push(- 1 * $stack->pop());
+ // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on
+ } elseif (preg_match("/^([a-z]\w*)\($/", $token, $matches)) { // it's a function!
+ $fnn = $matches[1];
+ if (in_array($fnn, $this->fb)) { // built-in function:
+ if (is_null($op1 = $stack->pop()))
+ return $this->trigger(15, "internal error");
+ $fnn = preg_replace("/^arc/", "a", $fnn); // for the 'arc' trig synonyms
+ if ($fnn == 'ln')
+ $fnn = 'log';
+ eval('$stack->push(' . $fnn . '($op1));'); // perfectly safe eval()
+ } elseif (array_key_exists($fnn, $this->f)) { // user function
+ // get args
+ $args = array();
+ for ($i = count($this->f[$fnn]['args']) - 1; $i >= 0; $i --) {
+ if (is_null($args[$this->f[$fnn]['args'][$i]] = $stack->pop()))
+ return $this->trigger(16, "internal error");
+ }
+ $stack->push($this->pfx($this->f[$fnn]['func'], $args)); // yay... recursion!!!!
+ }
+ // if the token is a number or variable, push it on the stack
+ } else {
+ if (is_numeric($token)) {
+ $stack->push($token);
+ } elseif (array_key_exists($token, $this->v)) {
+ $stack->push($this->v[$token]);
+ } elseif (array_key_exists($token, $vars)) {
+ $stack->push($vars[$token]);
+ } else {
+ return $this->trigger(17, "undefined variable '$token'", $token);
+ }
+ }
+ }
+ // when we're out of tokens, the stack should have a single element, the final result
+ if ($stack->count != 1)
+ return $this->trigger(18, "internal error");
+ return $stack->pop();
+ }
+
+ /**
+ * trigger an error, but nicely, if need be
+ *
+ * @param string $code Code
+ * @param string $msg Msg
+ * @param string|null $info String
+ * @return boolean False
+ */
+ public function trigger($code, $msg, $info = null)
+ {
+ $this->last_error = $msg;
+ $this->last_error_code = array($code,$info);
+ if (! $this->suppress_errors)
+ trigger_error($msg, E_USER_WARNING);
+ return false;
+ }
+}
+
+/**
+ * Class for internal use
+ */
+class EvalMathStack
+{
+
+ public $stack = array();
+
+ public $count = 0;
+
+ /**
+ * push
+ *
+ * @param string $val Val
+ * @return void
+ */
+ public function push($val)
+ {
+ $this->stack[$this->count] = $val;
+ $this->count ++;
+ }
+
+ /**
+ * pop
+ *
+ * @return mixed Stack
+ */
+ public function pop()
+ {
+ if ($this->count > 0) {
+ $this->count --;
+ return $this->stack[$this->count];
+ }
+ return null;
+ }
+
+ /**
+ * last
+ *
+ * @param int $n N
+ * @return mixed Stack
+ */
+ public function last($n = 1)
+ {
+ if (isset($this->stack[$this->count - $n])) {
+ return $this->stack[$this->count - $n];
+ }
+ return;
+ }
+}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index b31607c1d60..02b8529257d 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -202,7 +202,7 @@ class Form
$ret .= '
';
if (empty($notabletag)) $ret .= '
';
if (empty($notabletag)) $ret .= '';
- if (preg_match('/^(string|email)/', $typeofdata))
+ if (preg_match('/^(string|safehtmlstring|email)/', $typeofdata))
{
$tmp = explode(':', $typeofdata);
$ret .= ' ';
@@ -276,6 +276,7 @@ class Form
if (preg_match('/^(email)/', $typeofdata)) $ret .= dol_print_email($value, 0, 0, 0, 0, 1);
elseif (preg_match('/^(amount|numeric)/', $typeofdata)) $ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : '');
elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) $ret .= dol_htmlentitiesbr($value);
+ elseif (preg_match('/^safehtmlstring/', $typeofdata)) $ret .= dol_string_onlythesehtmltags($value);
elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret .= dol_print_date($value, 'day');
elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') $ret .= dol_print_date($value, 'dayhour');
elseif (preg_match('/^select;/', $typeofdata))
@@ -2906,7 +2907,7 @@ class Form
$objp->fprice = $price_result;
if ($objp->quantity >= 1)
{
- $objp->unitprice = $objp->fprice / $objp->quantity;
+ $objp->unitprice = $objp->fprice / $objp->quantity; // Replace dynamically unitprice
}
}
}
@@ -2973,7 +2974,7 @@ class Form
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) $opt .= ' disabled';
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0)
{
- $opt .= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqpercent="'.$objp->remise_percent.'"';
+ $opt .= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqup="'.$objp->unitprice.'" data-pbqpercent="'.$objp->remise_percent.'"';
}
$opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"';
$opt .= '>';
@@ -2988,7 +2989,7 @@ class Form
// "key" value of json key array is used by jQuery automatically as selected value
// "label" value of json key array is used by jQuery automatically as text for combo box
$out .= $opt;
- array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false)));
+ array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'up'=>$objp->unitprice, 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false)));
// Exemple of var_dump $outarray
// array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp"
// ["label"]=>string(76) "ppp (f ff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)"
@@ -3507,7 +3508,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of payment methods
- * Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want.
+ * Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want.
*
* @param string $selected Id du mode de paiement pre-selectionne
* @param string $htmlname Nom de la zone select
@@ -5268,8 +5269,9 @@ class Form
$disabled = false; $title = '';
if (is_object($societe_vendeuse) && $societe_vendeuse->id == $mysoc->id && $societe_vendeuse->tva_assuj == "0")
{
- // Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses
- if (empty($conf->global->OVERRIDE_VAT_FOR_EXPENSE_REPORT))
+ // Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
+ // of using supplier invoices (this is a very bad idea !)
+ if (empty($conf->global->EXPENSEREPORT_OVERRIDE_VAT))
{
$title = ' title="'.$langs->trans('VATIsNotUsed').'"';
$disabled = true;
@@ -6201,7 +6203,7 @@ class Form
$out .= ajax_combobox($htmlname);
}
- $out .= 'trans("Filters");
$ret .= '';
//$ret .= ' ';
- $ret .= '';
- $ret .= '
';
+ $ret .= '
';
+ $texttoshow = '
'.$langs->trans("Search").'
';
+
+ $ret .= '
'.$texttoshow.'
';
$ret .= '
';
+ $ret .= '
';
+ // For compatibility with forms that show themself the search criteria in addition of this component, we output the fields
foreach ($arrayofcriterias as $criterias) {
foreach ($criterias as $criteriafamilykey => $criteriafamilyval) {
if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) continue;
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index 79c87f1ba92..e084028b430 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -959,7 +959,7 @@ class FormCompany extends Form
$out .= '
'.$langs->trans('Prospect').' ';
}
$out .= '
'.$langs->trans('Supplier').' ';
- $out .= '
'.$langs->trans('Others').' ';
+ $out .= '
'.$langs->trans('Other').' ';
} elseif ($typeinput == 'admin') {
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
$out .= '
'.$langs->trans('ProspectCustomer').' ';
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 111605d38b7..e84feb90601 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -125,7 +125,7 @@ class FormFile
$out .= '
';
}
- $out .= '
';
+ $out .= '';
$out .= '';
if (!empty($options)) $out .= ''.$options.' ';
@@ -168,7 +168,7 @@ class FormFile
$out .= ' ';
}
- $out .= ' global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic') ? ' name="userfile"' : ' name="userfile[]" multiple');
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
$out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""');
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 238c3cad60a..d961cd20536 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1027,6 +1027,7 @@ class FormMail extends Form
$out .= ' $(document).on("keypress", \'#mailform\', function (e) { /* Note this is called at every key pressed ! */
var code = e.keyCode || e.which;
if (code == 13) {
+ console.log("Enter was intercepted and blocked");
e.preventDefault();
return false;
}
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index 3b5dbd664d6..cc4d0d0b8e5 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -97,7 +97,7 @@ class FormOther
if ($obj->fk_user == 0) {
$label .= ' ('.$langs->trans("Everybody").') ';
}
- elseif (! empty($conf->global->EXPORTS_SHARE_MODELS) && empty($fk_user) && is_object($user) && $user->id != $obj->fk_user) {
+ elseif (!empty($conf->global->EXPORTS_SHARE_MODELS) && empty($fk_user) && is_object($user) && $user->id != $obj->fk_user) {
$tmpuser = new User($this->db);
$tmpuser->fetch($obj->fk_user);
$label .= ' ('.$tmpuser->getFullName($langs).') ';
@@ -164,7 +164,7 @@ class FormOther
if ($obj->fk_user == 0) {
$label .= ' ('.$langs->trans("Everybody").') ';
}
- elseif (! empty($conf->global->EXPORTS_SHARE_MODELS) && empty($fk_user) && is_object($user) && $user->id != $obj->fk_user) {
+ elseif (!empty($conf->global->EXPORTS_SHARE_MODELS) && empty($fk_user) && is_object($user) && $user->id != $obj->fk_user) {
$tmpuser = new User($this->db);
$tmpuser->fetch($obj->fk_user);
$label .= ' ('.$tmpuser->getFullName($langs).') ';
@@ -432,61 +432,61 @@ class FormOther
// Enhance with select2
if ($conf->use_javascript_ajax)
{
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlname);
if ($comboenhancement)
{
- $out.=$comboenhancement;
+ $out .= $comboenhancement;
}
}
// Select each sales and print them in a select input
- $out.='';
- if ($showempty) $out.=' ';
+ $out .= '';
+ if ($showempty) $out .= ' ';
// Get list of users allowed to be viewed
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";
- $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
+ $sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u";
- if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
+ if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{
- if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
- $sql_usr.= " WHERE u.entity IS NOT NULL"; // Show all users
+ if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
+ $sql_usr .= " WHERE u.entity IS NOT NULL"; // Show all users
} else {
- $sql_usr.= " WHERE EXISTS (SELECT ug.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug WHERE u.rowid = ug.fk_user AND ug.entity IN (".getEntity('usergroup')."))";
- $sql_usr.= " OR u.entity = 0"; // Show always superadmin
+ $sql_usr .= " WHERE EXISTS (SELECT ug.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug WHERE u.rowid = ug.fk_user AND ug.entity IN (".getEntity('usergroup')."))";
+ $sql_usr .= " OR u.entity = 0"; // Show always superadmin
}
}
else
{
- $sql_usr.= " WHERE u.entity IN (".getEntity('user').")";
+ $sql_usr .= " WHERE u.entity IN (".getEntity('user').")";
}
- if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id;
- if (! empty($user->socid)) $sql_usr.=" AND u.fk_soc = ".$user->socid;
+ if (empty($user->rights->user->user->lire)) $sql_usr .= " AND u.rowid = ".$user->id;
+ if (!empty($user->socid)) $sql_usr .= " AND u.fk_soc = ".$user->socid;
// Add existing sales representatives of thirdparty of external user
if (empty($user->rights->user->user->lire) && $user->socid)
{
- $sql_usr.=" UNION ";
- $sql_usr.= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut, u2.login";
- $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ $sql_usr .= " UNION ";
+ $sql_usr .= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut, u2.login";
+ $sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
+ if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{
- if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
- $sql_usr.= " WHERE u2.entity IS NOT NULL"; // Show all users
+ if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
+ $sql_usr .= " WHERE u2.entity IS NOT NULL"; // Show all users
} else {
- $sql_usr.= " WHERE EXISTS (SELECT ug2.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug2 WHERE u2.rowid = ug2.fk_user AND ug2.entity IN (".getEntity('usergroup')."))";
+ $sql_usr .= " WHERE EXISTS (SELECT ug2.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug2 WHERE u2.rowid = ug2.fk_user AND ug2.entity IN (".getEntity('usergroup')."))";
}
}
else
{
- $sql_usr.= " WHERE u2.entity IN (".getEntity('user').")";
+ $sql_usr .= " WHERE u2.entity IN (".getEntity('user').")";
}
- $sql_usr.= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->socid;
+ $sql_usr .= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->socid;
}
- $sql_usr.= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
+ $sql_usr .= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
//print $sql_usr;exit;
$resql_usr = $this->db->query($sql_usr);
@@ -494,34 +494,34 @@ class FormOther
{
while ($obj_usr = $this->db->fetch_object($resql_usr))
{
- $out.='rowid.'"';
- if ($obj_usr->rowid == $selected) $out.=' selected';
+ if ($obj_usr->rowid == $selected) $out .= ' selected';
- $out.='>';
- $out.=dolGetFirstLastname($obj_usr->firstname, $obj_usr->lastname);
+ $out .= '>';
+ $out .= dolGetFirstLastname($obj_usr->firstname, $obj_usr->lastname);
// Complete name with more info
- $moreinfo=0;
- if (! empty($conf->global->MAIN_SHOW_LOGIN))
+ $moreinfo = 0;
+ if (!empty($conf->global->MAIN_SHOW_LOGIN))
{
- $out.=($moreinfo?' - ':' (').$obj_usr->login;
+ $out .= ($moreinfo ? ' - ' : ' (').$obj_usr->login;
$moreinfo++;
}
if ($showstatus >= 0)
{
if ($obj_usr->statut == 1 && $showstatus == 1)
{
- $out.=($moreinfo?' - ':' (').$langs->trans('Enabled');
+ $out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
$moreinfo++;
}
if ($obj_usr->statut == 0)
{
- $out.=($moreinfo?' - ':' (').$langs->trans('Disabled');
+ $out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
$moreinfo++;
}
}
- $out.=($moreinfo?')':'');
- $out.=' ';
+ $out .= ($moreinfo ? ')' : '');
+ $out .= '';
}
$this->db->free($resql_usr);
}
@@ -533,10 +533,10 @@ class FormOther
if ($norepresentative)
{
$langs->load("companies");
- $out.='- '.$langs->trans("NoSalesRepresentativeAffected").' - ';
+ $out .= '- '.$langs->trans("NoSalesRepresentativeAffected").' - ';
}
- $out.=' ';
+ $out .= ' ';
return $out;
}
@@ -1331,11 +1331,129 @@ class FormOther
}
else
{
- $selected=(($useempty && $value != '0' && $value != 'manual')?'':' selected');
+ $selected = (($useempty && $value != '0' && $value != 'manual') ? '' : ' selected');
$resultautomanual .= ''.$langs->trans("Automatic").' '."\n";
$resultautomanual .= ''.$langs->trans("Manual").' '."\n";
}
$resultautomanual .= ''."\n";
return $resultautomanual;
}
+
+
+ /**
+ * Return HTML select list to select a group by field
+ *
+ * @param mixed $object Object analyzed
+ * @param array $search_groupby Array of preselected fields
+ * @param array $arrayofgroupby Array of groupby to fill
+ * @return string HTML string component
+ */
+ public function selectGroupByField($object, $search_groupby, &$arrayofgroupby)
+ {
+ global $langs, $extrafields, $form;
+
+ $YYYY = substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
+ $MM = substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
+ $DD = substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
+ $HH = substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
+ $MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
+ $SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
+
+ foreach ($object->fields as $key => $val) {
+ if (!$val['measure']) {
+ if (in_array($key, array(
+ 'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
+ 'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) continue;
+ if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) continue;
+ if (isset($val['visible']) && !dol_eval($val['visible'], 1)) continue;
+ if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) continue;
+ if (preg_match('/^pass/', $key)) continue;
+ if (in_array($val['type'], array('html', 'text'))) continue;
+ if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
+ $arrayofgroupby['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position'].'-y');
+ $arrayofgroupby['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position'].'-m');
+ $arrayofgroupby['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position'].'-d');
+ } else {
+ $arrayofgroupby['t.'.$key] = array('label' => $langs->trans($val['label']), 'position' => (int) $val['position']);
+ }
+ }
+ }
+ // Add extrafields to Group by
+ if ($object->isextrafieldmanaged) {
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
+ if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') continue;
+ if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) continue;
+ $arrayofgroupby['te.'.$key] = array('label' => $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
+ }
+ }
+
+ $arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 0, 0, 1);
+ $arrayofgroupbylabel = array();
+ foreach ($arrayofgroupby as $key => $val) {
+ $arrayofgroupbylabel[$key] = $val['label'];
+ }
+ $result = $form->selectarray('search_groupby', $arrayofgroupbylabel, $search_groupby, 1, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1);
+
+ return $result;
+ }
+
+ /**
+ * Return HTML select list to select a group by field
+ *
+ * @param mixed $object Object analyzed
+ * @param array $search_xaxis Array of preselected fields
+ * @param array $arrayofxaxis Array of groupby to fill
+ * @return string HTML string component
+ */
+ public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis)
+ {
+ global $langs, $extrafields, $form;
+
+ $YYYY = substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
+ $MM = substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
+ $DD = substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
+ $HH = substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
+ $MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
+ $SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
+
+
+ foreach ($object->fields as $key => $val) {
+ if (!$val['measure']) {
+ if (in_array($key, array(
+ 'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
+ 'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) continue;
+ if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) continue;
+ if (isset($val['visible']) && !dol_eval($val['visible'], 1)) continue;
+ if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) continue;
+ if (preg_match('/^pass/', $key)) continue;
+ if (in_array($val['type'], array('html', 'text'))) continue;
+ if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
+ $arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position'].'-y');
+ $arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position'].'-m');
+ $arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position'].'-d');
+ } else {
+ $arrayofxaxis['t.'.$key] = array('label' => $langs->trans($val['label']), 'position' => (int) $val['position']);
+ }
+ }
+ }
+
+ // Add extrafields to X-Axis
+ if ($object->isextrafieldmanaged) {
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
+ if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') continue;
+ if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) continue;
+ $arrayofxaxis['te.'.$key] = array('label' => $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
+ }
+ }
+
+ $arrayofxaxis = dol_sort_array($arrayofxaxis, 'position', 'asc', 0, 0, 1);
+
+ $arrayofxaxislabel = array();
+ foreach ($arrayofxaxis as $key => $val) {
+ $arrayofxaxislabel[$key] = $val['label'];
+ }
+ $result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, 1, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1);
+
+ return $result;
+ }
}
diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php
index c4f10c69469..26de63f10cc 100644
--- a/htdocs/core/class/stats.class.php
+++ b/htdocs/core/class/stats.class.php
@@ -30,8 +30,8 @@
abstract class Stats
{
protected $db;
- protected $lastfetchdate=array(); // Dates of cache file read by methods
- public $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts)
+ protected $lastfetchdate = array(); // Dates of cache file read by methods
+ public $cachefilesuffix = ''; // Suffix to add to name of cache file (to avoid file name conflicts)
/**
* Return nb of elements by month for several years
@@ -46,33 +46,33 @@ abstract class Stats
*/
public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 1)
{
- global $conf,$user,$langs;
+ global $conf, $user, $langs;
if ($startyear > $endyear) return -1;
- $datay=array();
+ $datay = array();
// Search into cache
- if (! empty($cachedelay))
+ if (!empty($cachedelay))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
}
- $newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
- $newmask='0644';
+ $newpathofdestfile = $conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix) ? '' : $this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
+ $newmask = '0644';
$nowgmt = dol_now();
- $foundintocache=0;
+ $foundintocache = 0;
if ($cachedelay > 0)
{
- $filedate=dol_filemtime($newpathofdestfile);
+ $filedate = dol_filemtime($newpathofdestfile);
if ($filedate >= ($nowgmt - $cachedelay))
{
- $foundintocache=1;
+ $foundintocache = 1;
- $this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$filedate;
+ $this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $filedate;
}
else
{
@@ -87,7 +87,7 @@ abstract class Stats
}
else
{
- $year=$startyear;
+ $year = $startyear;
$sm = $startmonth - 1;
if ($sm != 0) $year = $year - 1;
while ($year <= $endyear)
@@ -98,13 +98,13 @@ abstract class Stats
$data = array();
- for ($i = 0 ; $i < 12 ; $i++)
+ for ($i = 0; $i < 12; $i++)
{
- $data[$i][]=$datay[$endyear][($i+$sm)%12][0];
- $year=$startyear;
- while($year <= $endyear)
+ $data[$i][] = $datay[$endyear][($i + $sm) % 12][0];
+ $year = $startyear;
+ while ($year <= $endyear)
{
- $data[$i][]=$datay[$year - (1 - ((int) ($i+$sm)/12)) + ($sm == 0 ? 1 : 0)][($i+$sm)%12][1];
+ $data[$i][] = $datay[$year - (1 - ((int) ($i + $sm) / 12)) + ($sm == 0 ? 1 : 0)][($i + $sm) % 12][1];
$year++;
}
}
@@ -114,14 +114,14 @@ abstract class Stats
if (empty($foundintocache) && ($cachedelay > 0 || $cachedelay == -1))
{
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
- if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
+ if (!dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
$fp = fopen($newpathofdestfile, 'w');
fwrite($fp, json_encode($data));
fclose($fp);
- if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
+ if (!empty($conf->global->MAIN_UMASK)) $newmask = $conf->global->MAIN_UMASK;
@chmod($newpathofdestfile, octdec($newmask));
- $this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt;
+ $this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $nowgmt;
}
// return array(array('Month',val1,val2,val3),...)
@@ -143,33 +143,33 @@ abstract class Stats
*/
public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 1)
{
- global $conf,$user,$langs;
+ global $conf, $user, $langs;
if ($startyear > $endyear) return -1;
- $datay=array();
+ $datay = array();
// Search into cache
- if (! empty($cachedelay))
+ if (!empty($cachedelay))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
}
- $newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
- $newmask='0644';
+ $newpathofdestfile = $conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix) ? '' : $this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
+ $newmask = '0644';
$nowgmt = dol_now();
- $foundintocache=0;
+ $foundintocache = 0;
if ($cachedelay > 0)
{
- $filedate=dol_filemtime($newpathofdestfile);
+ $filedate = dol_filemtime($newpathofdestfile);
if ($filedate >= ($nowgmt - $cachedelay))
{
- $foundintocache=1;
+ $foundintocache = 1;
- $this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$filedate;
+ $this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $filedate;
}
else
{
@@ -185,10 +185,10 @@ abstract class Stats
}
else
{
- $year=$startyear;
+ $year = $startyear;
$sm = $startmonth - 1;
if ($sm != 0) $year = $year - 1;
- while($year <= $endyear)
+ while ($year <= $endyear)
{
$datay[$year] = $this->getAmountByMonth($year, $format);
$year++;
@@ -196,13 +196,13 @@ abstract class Stats
$data = array();
// $data = array('xval'=>array(0=>xlabel,1=>yval1,2=>yval2...),...)
- for ($i = 0 ; $i < 12 ; $i++)
+ for ($i = 0; $i < 12; $i++)
{
- $data[$i][]=$datay[$endyear][($i+$sm)%12][0]; // set label
- $year=$startyear;
- while($year <= $endyear)
+ $data[$i][] = $datay[$endyear][($i + $sm) % 12]['label']; // set label
+ $year = $startyear;
+ while ($year <= $endyear)
{
- $data[$i][]=$datay[$year - (1 - ((int) ($i+$sm)/12)) + ($sm == 0 ? 1 : 0)][($i+$sm)%12][1]; // set yval for x=i
+ $data[$i][] = $datay[$year - (1 - ((int) ($i + $sm) / 12)) + ($sm == 0 ? 1 : 0)][($i + $sm) % 12][1]; // set yval for x=i
$year++;
}
}
@@ -212,17 +212,17 @@ abstract class Stats
if (empty($foundintocache) && ($cachedelay > 0 || $cachedelay == -1))
{
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
- if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
+ if (!dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
$fp = fopen($newpathofdestfile, 'w');
if ($fp)
{
fwrite($fp, json_encode($data));
fclose($fp);
- if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
+ if (!empty($conf->global->MAIN_UMASK)) $newmask = $conf->global->MAIN_UMASK;
@chmod($newpathofdestfile, octdec($newmask));
}
else dol_syslog("Failed to write cache file", LOG_ERR);
- $this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt;
+ $this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $nowgmt;
}
return $data;
@@ -239,10 +239,10 @@ abstract class Stats
{
if ($startyear > $endyear) return -1;
- $datay=array();
+ $datay = array();
- $year=$startyear;
- while($year <= $endyear)
+ $year = $startyear;
+ while ($year <= $endyear)
{
$datay[$year] = $this->getAverageByMonth($year);
$year++;
@@ -250,13 +250,13 @@ abstract class Stats
$data = array();
- for ($i = 0 ; $i < 12 ; $i++)
+ for ($i = 0; $i < 12; $i++)
{
- $data[$i][]=$datay[$endyear][$i][0];
- $year=$startyear;
- while($year <= $endyear)
+ $data[$i][] = $datay[$endyear][$i][0];
+ $year = $startyear;
+ while ($year <= $endyear)
{
- $data[$i][]=$datay[$year][$i][1];
+ $data[$i][] = $datay[$year][$i][1];
$year++;
}
}
@@ -269,35 +269,36 @@ abstract class Stats
*
* @param int $year Year
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
+ * @param int $limit Limit
* @return array Array of values
*/
- public function getAllByProductEntry($year, $cachedelay = 0)
+ public function getAllByProductEntry($year, $cachedelay = 0, $limit = 10)
{
- global $conf,$user,$langs;
+ global $conf, $user, $langs;
- $datay=array();
+ $data = array();
// Search into cache
- if (! empty($cachedelay))
+ if (!empty($cachedelay))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
}
- $newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
- $newmask='0644';
+ $newpathofdestfile = $conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix) ? '' : $this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
+ $newmask = '0644';
$nowgmt = dol_now();
- $foundintocache=0;
+ $foundintocache = 0;
if ($cachedelay > 0)
{
- $filedate=dol_filemtime($newpathofdestfile);
+ $filedate = dol_filemtime($newpathofdestfile);
if ($filedate >= ($nowgmt - $cachedelay))
{
- $foundintocache=1;
+ $foundintocache = 1;
- $this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$filedate;
+ $this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $filedate;
}
else
{
@@ -313,7 +314,7 @@ abstract class Stats
}
else
{
- $data=$this->getAllByProduct($year);
+ $data = $this->getAllByProduct($year, $limit);
// $data[$i][]=$datay[$year][$i][1]; // set yval for x=i
}
@@ -321,16 +322,16 @@ abstract class Stats
if (empty($foundintocache) && ($cachedelay > 0 || $cachedelay == -1))
{
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
- if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
+ if (!dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
$fp = fopen($newpathofdestfile, 'w');
if ($fp)
{
fwrite($fp, json_encode($data));
fclose($fp);
- if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
+ if (!empty($conf->global->MAIN_UMASK)) $newmask = $conf->global->MAIN_UMASK;
@chmod($newpathofdestfile, octdec($newmask));
}
- $this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt;
+ $this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $nowgmt;
}
return $data;
@@ -353,7 +354,7 @@ abstract class Stats
$result = array();
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
@@ -385,7 +386,7 @@ abstract class Stats
$result = array();
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
@@ -395,16 +396,16 @@ abstract class Stats
$row = $this->db->fetch_object($resql);
$result[$i]['year'] = $row->year;
$result[$i]['nb'] = $row->nb;
- if($i>0 && $row->nb>0) $result[$i-1]['nb_diff'] = ($result[$i-1]['nb'] - $row->nb) / $row->nb * 100;
+ if ($i > 0 && $row->nb > 0) $result[$i - 1]['nb_diff'] = ($result[$i - 1]['nb'] - $row->nb) / $row->nb * 100;
$result[$i]['total'] = $row->total;
- if($i>0 && $row->total>0) $result[$i-1]['total_diff'] = ($result[$i-1]['total'] - $row->total) / $row->total * 100;
+ if ($i > 0 && $row->total > 0) $result[$i - 1]['total_diff'] = ($result[$i - 1]['total'] - $row->total) / $row->total * 100;
$result[$i]['avg'] = $row->avg;
- if($i>0 && $row->avg>0) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
+ if ($i > 0 && $row->avg > 0) $result[$i - 1]['avg_diff'] = ($result[$i - 1]['avg'] - $row->avg) / $row->avg * 100;
// For some $sql only
if (isset($row->weighted))
{
$result[$i]['weighted'] = $row->weighted;
- if($i>0 && $row->weighted>0) $result[$i-1]['avg_weighted'] = ($result[$i-1]['weighted'] - $row->weighted) / $row->weighted * 100;
+ if ($i > 0 && $row->weighted > 0) $result[$i - 1]['avg_weighted'] = ($result[$i - 1]['weighted'] - $row->weighted) / $row->weighted * 100;
}
$i++;
}
@@ -431,11 +432,11 @@ abstract class Stats
// phpcs:enable
global $langs;
- $result=array();
- $res=array();
+ $result = array();
+ $res = array();
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
@@ -454,22 +455,22 @@ abstract class Stats
dol_print_error($this->db);
}
- for ($i = 1 ; $i < 13 ; $i++)
+ for ($i = 1; $i < 13; $i++)
{
- $res[$i] = (isset($result[$i])?$result[$i]:0);
+ $res[$i] = (isset($result[$i]) ? $result[$i] : 0);
}
$data = array();
- for ($i = 1 ; $i < 13 ; $i++)
+ for ($i = 1; $i < 13; $i++)
{
- $month='unknown';
- if ($format == 0) $month=$langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
- elseif ($format == 1) $month=$i;
- elseif ($format == 2) $month=$langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
+ $month = 'unknown';
+ if ($format == 0) $month = $langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
+ elseif ($format == 1) $month = $i;
+ elseif ($format == 2) $month = $langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
//$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),($format?"%m":"%b"));
//$month=dol_substr($month,0,3);
- $data[$i-1] = array($month, $res[$i]);
+ $data[$i - 1] = array($month, $res[$i]);
}
return $data;
@@ -478,7 +479,6 @@ abstract class Stats
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
- * Renvoie le montant totalise par mois pour une annee donnee
* Return the amount per month for a given year
*
* @param int $year Year
@@ -491,12 +491,12 @@ abstract class Stats
// phpcs:enable
global $langs;
- $result=array();
- $res=array();
+ $result = array();
+ $res = array();
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
@@ -512,22 +512,22 @@ abstract class Stats
}
else dol_print_error($this->db);
- for ($i = 1 ; $i < 13 ; $i++)
+ for ($i = 1; $i < 13; $i++)
{
- $res[$i] = (int) round((isset($result[$i])?$result[$i]:0));
+ $res[$i] = (int) round((isset($result[$i]) ? $result[$i] : 0));
}
$data = array();
- for ($i = 1 ; $i < 13 ; $i++)
+ for ($i = 1; $i < 13; $i++)
{
- $month='unknown';
- if ($format == 0) $month=$langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
- elseif ($format == 1) $month=$i;
- elseif ($format == 2) $month=$langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
+ $month = 'unknown';
+ if ($format == 0) $month = $langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
+ elseif ($format == 1) $month = $i;
+ elseif ($format == 2) $month = $langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
//$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),($format?"%m":"%b"));
//$month=dol_substr($month,0,3);
- $data[$i-1] = array($month, $res[$i]);
+ $data[$i - 1] = array($month, $res[$i]);
}
return $data;
@@ -548,11 +548,11 @@ abstract class Stats
// phpcs:enable
global $langs;
- $result=array();
- $res=array();
+ $result = array();
+ $res = array();
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
@@ -568,22 +568,22 @@ abstract class Stats
}
else dol_print_error($this->db);
- for ($i = 1 ; $i < 13 ; $i++)
+ for ($i = 1; $i < 13; $i++)
{
- $res[$i] = (isset($result[$i])?$result[$i]:0);
+ $res[$i] = (isset($result[$i]) ? $result[$i] : 0);
}
$data = array();
- for ($i = 1 ; $i < 13 ; $i++)
+ for ($i = 1; $i < 13; $i++)
{
- $month='unknown';
- if ($format == 0) $month=$langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
- elseif ($format == 1) $month=$i;
- elseif ($format == 2) $month=$langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
+ $month = 'unknown';
+ if ($format == 0) $month = $langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
+ elseif ($format == 1) $month = $i;
+ elseif ($format == 2) $month = $langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
//$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),($format?"%m":"%b"));
//$month=dol_substr($month,0,3);
- $data[$i-1] = array($month, $res[$i]);
+ $data[$i - 1] = array($month, $res[$i]);
}
return $data;
@@ -603,23 +603,22 @@ abstract class Stats
// phpcs:enable
global $langs;
- $result=array();
- $res=array();
+ $result = array();
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
- $i = 0; $other=0;
+ $i = 0; $other = 0;
while ($i < $num)
{
$row = $this->db->fetch_row($resql);
- if ($i < $limit || $num == $limit) $result[$i] = array($row[0],$row[1]); // Ref of product, nb
+ if ($i < $limit || $num == $limit) $result[$i] = array($row[0], $row[1]); // Ref of product, nb
else $other += $row[1];
$i++;
}
- if ($num > $limit) $result[$i] = array($langs->transnoentitiesnoconv("Other"),$other);
+ if ($num > $limit) $result[$i] = array($langs->transnoentitiesnoconv("Other"), $other);
$this->db->free($resql);
}
else dol_print_error($this->db);
diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php
index 766e063e80c..9a93f886ef4 100644
--- a/htdocs/core/customreports.php
+++ b/htdocs/core/customreports.php
@@ -28,10 +28,6 @@
if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
{
require '../main.inc.php';
- require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
- require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php";
- require_once DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php";
- require_once DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php";
// Get parameters
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
@@ -45,7 +41,14 @@ if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
$search_filters = GETPOST('search_filters', 'array');
$search_measures = GETPOST('search_measures', 'array');
- $search_xaxis = GETPOST('search_xaxis', 'array');
+
+ //$search_xaxis = GETPOST('search_xaxis', 'array');
+ if (GETPOST('search_xaxis', 'alpha') && GETPOST('search_xaxis', 'alpha') != '-1') $search_xaxis = array(GETPOST('search_xaxis', 'alpha'));
+ else $search_xaxis = array();
+ //$search_groupby = GETPOST('search_groupby', 'array');
+ if (GETPOST('search_groupby', 'alpha') && GETPOST('search_groupby', 'alpha') != '-1') $search_groupby = array(GETPOST('search_groupby', 'alpha'));
+ else $search_groupby = array();
+
$search_yaxis = GETPOST('search_yaxis', 'array');
$search_graph = GETPOST('search_graph', 'none');
@@ -53,7 +56,7 @@ if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
- $page = GETPOST('page', 'int');
+ $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
@@ -62,8 +65,14 @@ if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
$diroutputmassaction = $conf->user->dir_temp.'/'.$user->id.'/customreport';
}
+require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
+require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php";
+require_once DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php";
+require_once DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php";
+require_once DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php";
+
// Load traductions files requiredby by page
-$langs->loadLangs(array("companies", "other", "exports"));
+$langs->loadLangs(array("companies", "other", "exports", "sendings"));
$extrafields = new ExtraFields($db);
@@ -76,16 +85,18 @@ $object = null;
$ObjectClassName = '';
// Objects available by default
$arrayoftype = array(
- 'thirdparty' => array('label' => 'ThirdParties', 'ObjectClassName' => 'Societe', 'enabled' => $conf->societe->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"),
- 'contact' => array('label' => 'Contacts', 'ObjectClassName' => 'Contact', 'enabled' => $conf->societe->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"),
- 'contract' => array('label' => 'Contracts', 'ObjectClassName' => 'Contrat', 'enabled' => $conf->contrat->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", 'langs'=>'contract'),
- 'invoice' => array('label' => 'Invoices', 'ObjectClassName' => 'Facture', 'enabled' => $conf->facture->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"),
- 'invoice_template'=>array('label' => 'PredefinedInvoices', 'ObjectClassName' => 'FactureRec', 'enabled' => $conf->facture->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/compta/class/facturerec.class.php", 'langs'=>'bills'),
+ 'thirdparty' => array('label' => 'ThirdParties', 'ObjectClassName' => 'Societe', 'enabled' => $conf->societe->enabled, 'ClassPath' => "/societe/class/societe.class.php"),
+ 'contact' => array('label' => 'Contacts', 'ObjectClassName' => 'Contact', 'enabled' => $conf->societe->enabled, 'ClassPath' => "/contact/class/contact.class.php"),
+ 'proposal' => array('label' => 'Proposals', 'ObjectClassName' => 'Propal', 'enabled' => $conf->propal->enabled, 'ClassPath' => "/comm/propal/class/propal.class.php"),
+ 'order' => array('label' => 'Orders', 'ObjectClassName' => 'Commande', 'enabled' => $conf->commande->enabled, 'ClassPath' => "/commande/class/commande.class.php"),
+ 'invoice' => array('label' => 'Invoices', 'ObjectClassName' => 'Facture', 'enabled' => $conf->facture->enabled, 'ClassPath' => "/compta/facture/class/facture.class.php"),
+ 'invoice_template'=>array('label' => 'PredefinedInvoices', 'ObjectClassName' => 'FactureRec', 'enabled' => $conf->facture->enabled, 'ClassPath' => "/compta/class/facturerec.class.php", 'langs'=>'bills'),
+ 'contract' => array('label' => 'Contracts', 'ObjectClassName' => 'Contrat', 'enabled' => $conf->contrat->enabled, 'ClassPath' => "/contrat/class/contrat.class.php", 'langs'=>'contract'),
'bom' => array('label' => 'BOM', 'ObjectClassName' => 'Bom', 'enabled' => $conf->bom->enabled),
- 'mo' => array('label' => 'MO', 'ObjectClassName' => 'Mo', 'enabled' => $conf->mrp->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/mrp/class/mo.class.php"),
+ 'mo' => array('label' => 'MO', 'ObjectClassName' => 'Mo', 'enabled' => $conf->mrp->enabled, 'ClassPath' => "/mrp/class/mo.class.php"),
'ticket' => array('label' => 'Ticket', 'ObjectClassName' => 'Ticket', 'enabled' => $conf->ticket->enabled),
- 'member' => array('label' => 'Adherent', 'ObjectClassName' => 'Adherent', 'enabled' => $conf->adherent->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", 'langs'=>'members'),
- 'cotisation' => array('label' => 'Subscriptions', 'ObjectClassName' => 'Subscription', 'enabled' => $conf->adherent->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/adherents/class/subscription.class.php", 'langs'=>'members'),
+ 'member' => array('label' => 'Adherent', 'ObjectClassName' => 'Adherent', 'enabled' => $conf->adherent->enabled, 'ClassPath' => "/adherents/class/adherent.class.php", 'langs'=>'members'),
+ 'cotisation' => array('label' => 'Subscriptions', 'ObjectClassName' => 'Subscription', 'enabled' => $conf->adherent->enabled, 'ClassPath' => "/adherents/class/subscription.class.php", 'langs'=>'members'),
);
// Complete $arrayoftype by external modules
@@ -107,17 +118,14 @@ elseif (is_array($hookmanager->resArray)) {
$arrayoftype[$key] = $val;
}
}
- if (!empty($hookmanager->resArray['modenotusedforlist'])) { // Show objecttype selection even if objecttype is set
- $modenotusedforlist = $hookmanager->resArray['modenotusedforlist'];
- }
}
if ($objecttype) {
try {
- if ($arrayoftype[$objecttype]['ClassPath']) {
- include_once $arrayoftype[$objecttype]['ClassPath'];
+ if (!empty($arrayoftype[$objecttype]['ClassPath'])) {
+ dol_include_once($arrayoftype[$objecttype]['ClassPath']);
} else {
- include_once DOL_DOCUMENT_ROOT."/".$objecttype."/class/".$objecttype.".class.php";
+ dol_include_once("/".$objecttype."/class/".$objecttype.".class.php");
}
$ObjectClassName = $arrayoftype[$objecttype]['ObjectClassName'];
$object = new $ObjectClassName($db);
@@ -134,6 +142,7 @@ if ($user->socid > 0) // Protection if external user
//$socid = $user->socid;
accessforbidden();
}
+
$result = restrictedArea($user, $object->element, 0, '');
// Fetch optionals attributes and labels
@@ -144,6 +153,23 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
$search_component_params = array('');
+$MAXUNIQUEVALFORGROUP = 20;
+$MAXMEASURESINBARGRAPH = 20;
+
+$YYYY = substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
+$MM = substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
+$DD = substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
+$HH = substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
+$MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
+$SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
+
+$arrayofmesures = array('t.count'=>'Count');
+$arrayofxaxis = array();
+$arrayofgroupby = array();
+$arrayofyaxis = array();
+$arrayofvaluesforgroupby = array();
+
+
/*
* Actions
@@ -158,6 +184,7 @@ $search_component_params = array('');
*/
$form = new Form($db);
+$formother = new FormOther($db);
if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE')) {
llxHeader('', $langs->transnoentitiesnoconv('CustomReports'), '');
@@ -173,14 +200,91 @@ if ($action == 'viewgraph') {
setEventMessages($langs->trans("OnlyOneFieldForXAxisIsPossible"), null, 'warnings');
$search_xaxis = array(0 => $search_xaxis[0]);
}
+ if (count($search_groupby) >= 2) {
+ setEventMessages($langs->trans("ErrorOnlyOneFieldForGroupByIsPossible"), null, 'warnings');
+ $search_groupby = array(0 => $search_groupby[0]);
+ }
if (!count($search_xaxis)) {
setEventMessages($langs->trans("AtLeastOneXAxisIsRequired"), null, 'warnings');
- } elseif ($mode == 'graph' && $search_graph == 'bars' && count($search_measures) > 3) {
- setEventMessages($langs->trans("GraphInBarsAreLimitedTo3Measures"), null, 'warnings');
+ } elseif ($mode == 'graph' && $search_graph == 'bars' && count($search_measures) > $MAXMEASURESINBARGRAPH) {
+ $langs->load("errors");
+ setEventMessages($langs->trans("GraphInBarsAreLimitedToNMeasures", $MAXMEASURESINBARGRAPH), null, 'warnings');
$search_graph = 'lines';
}
}
+// Get all possible values of fields when a 'group by' is set, and save this into $arrayofvaluesforgroupby
+if (is_array($search_groupby) && count($search_groupby)) {
+ foreach ($search_groupby as $gkey => $gval) {
+ $gvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $gval);
+
+ if (preg_match('/\-year$/', $search_groupby[$gkey])) {
+ $tmpval = preg_replace('/\-year$/', '', $search_groupby[$gkey]);
+ $fieldtocount .= 'DATE_FORMAT('.$tmpval.", '%Y')";
+ } elseif (preg_match('/\-month$/', $search_groupby[$gkey])) {
+ $tmpval = preg_replace('/\-month$/', '', $search_groupby[$gkey]);
+ $fieldtocount .= 'DATE_FORMAT('.$tmpval.", '%Y-%m')";
+ } elseif (preg_match('/\-day$/', $search_groupby[$gkey])) {
+ $tmpval = preg_replace('/\-day$/', '', $search_groupby[$gkey]);
+ $fieldtocount .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d')";
+ } else {
+ $fieldtocount = $search_groupby[$gkey];
+ }
+
+ $sql = 'SELECT DISTINCT '.$fieldtocount.' as val';
+ if (strpos($fieldtocount, 'te.') === 0) {
+ $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.'_extrafields as te';
+ } else {
+ $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
+ }
+ // TODO Add the where here
+
+ $sql .= ' LIMIT '.($MAXUNIQUEVALFORGROUP + 1);
+
+ //print $sql;
+ $resql = $db->query($sql);
+ if (!$resql) {
+ dol_print_error($db);
+ }
+
+ while ($obj = $db->fetch_object($resql)) {
+ if (is_null($obj->val)) {
+ $keytouse = '__NULL__';
+ $valuetranslated = $langs->transnoentitiesnoconv("NotDefined");
+ }
+ elseif ($obj->val === '') {
+ $keytouse = '';
+ $valuetranslated = $langs->transnoentitiesnoconv("Empty");
+ }
+ else {
+ $keytouse = (string) $obj->val;
+ $valuetranslated = $obj->val;
+ }
+ if (!empty($object->fields[$gvalwithoutprefix]['arrayofkeyval'])) {
+ $valuetranslated = $object->fields[$gvalwithoutprefix]['arrayofkeyval'][$obj->val];
+ if (is_null($valuetranslated)) $valuetranslated = $langs->transnoentitiesnoconv("UndefinedKey");
+ $valuetranslated = $langs->trans($valuetranslated);
+ }
+
+ $arrayofvaluesforgroupby['g_'.$gkey][$keytouse] = $valuetranslated;
+ }
+ asort($arrayofvaluesforgroupby['g_'.$gkey]);
+
+ if (count($arrayofvaluesforgroupby['g_'.$gkey]) > $MAXUNIQUEVALFORGROUP) {
+ $langs->load("errors");
+ //var_dump($gkey.' '.$gval.' '.$gvalwithoutprefix);
+ $gvalwithoutprefix = preg_replace('/\-(year|month|day)/', '', $gvalwithoutprefix);
+ $labeloffield = $langs->transnoentitiesnoconv($object->fields[$gvalwithoutprefix]['label']);
+ setEventMessages($langs->trans("ErrorTooManyDifferentValueForSelectedGroupBy", $MAXUNIQUEVALFORGROUP, $labeloffield), null, 'warnings');
+ $search_groupby = array();
+ }
+
+ $db->free($resql);
+ }
+}
+//var_dump($arrayofvaluesforgroupby);exit;
+
+
$tmparray = dol_getdate(dol_now());
$endyear = $tmparray['year'];
$endmonth = $tmparray['mon'];
@@ -189,10 +293,6 @@ $startyear = $endyear - 2;
$param = '';
-$arrayofmesures = array('t.count'=>'Count');
-$arrayofxaxis = array();
-$arrayofyaxis = array();
-
print '
-
+
@@ -176,36 +176,36 @@ $langs->load("modulebuilder");
-trans("Position"); ?>
+trans("Position"); ?>
trans("LanguageFile"); ?>
global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { ?>
-
+
-
+
-
+
-
+
-
+
+
>
+
-
+
textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?>
multicompany->enabled) { ?>
- trans("AllEntities"); ?> >
+ trans("AllEntities"); ?> >
diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
index f2d3e4e7bb5..d0eaaec25f2 100644
--- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
@@ -27,7 +27,7 @@
*/
// Protection to avoid direct call of template
-if (empty($conf) || ! is_object($conf))
+if (empty($conf) || !is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
@@ -54,7 +54,7 @@ $langs->load("modulebuilder");
var list = jQuery("#list");
var totalizable = jQuery("#totalizable");
load("modulebuilder");
attributes[$elementtype]['label'][$attrname];
-$type=$extrafields->attributes[$elementtype]['type'][$attrname];
-$size=$extrafields->attributes[$elementtype]['size'][$attrname];
-$computed=$extrafields->attributes[$elementtype]['computed'][$attrname];
-$default=$extrafields->attributes[$elementtype]['default'][$attrname];
-$unique=$extrafields->attributes[$elementtype]['unique'][$attrname];
-$required=$extrafields->attributes[$elementtype]['required'][$attrname];
-$pos=$extrafields->attributes[$elementtype]['pos'][$attrname];
-$alwayseditable=$extrafields->attributes[$elementtype]['alwayseditable'][$attrname];
-$param=$extrafields->attributes[$elementtype]['param'][$attrname];
-$perms=$extrafields->attributes[$elementtype]['perms'][$attrname];
-$langfile=$extrafields->attributes[$elementtype]['langfile'][$attrname];
-$list=$extrafields->attributes[$elementtype]['list'][$attrname];
+$label = $extrafields->attributes[$elementtype]['label'][$attrname];
+$type = $extrafields->attributes[$elementtype]['type'][$attrname];
+$size = $extrafields->attributes[$elementtype]['size'][$attrname];
+$computed = $extrafields->attributes[$elementtype]['computed'][$attrname];
+$default = $extrafields->attributes[$elementtype]['default'][$attrname];
+$unique = $extrafields->attributes[$elementtype]['unique'][$attrname];
+$required = $extrafields->attributes[$elementtype]['required'][$attrname];
+$pos = $extrafields->attributes[$elementtype]['pos'][$attrname];
+$alwayseditable = $extrafields->attributes[$elementtype]['alwayseditable'][$attrname];
+$param = $extrafields->attributes[$elementtype]['param'][$attrname];
+$perms = $extrafields->attributes[$elementtype]['perms'][$attrname];
+$langfile = $extrafields->attributes[$elementtype]['langfile'][$attrname];
+$list = $extrafields->attributes[$elementtype]['list'][$attrname];
$totalizable = $extrafields->attributes[$elementtype]['totalizable'][$attrname];
-$help=$extrafields->attributes[$elementtype]['help'][$attrname];
-$entitycurrentorall=$extrafields->attributes[$elementtype]['entityid'][$attrname];
-$printable=$extrafields->attributes[$elementtype]['printable'][$attrname];
+$help = $extrafields->attributes[$elementtype]['help'][$attrname];
+$entitycurrentorall = $extrafields->attributes[$elementtype]['entityid'][$attrname];
+$printable = $extrafields->attributes[$elementtype]['printable'][$attrname];
-if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
+if ((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
{
$param_chain = '';
foreach ($param['options'] as $key => $value)
{
- if(strlen($key))
+ if (strlen($key))
{
$param_chain .= $key.','.$value."\n";
}
}
}
-elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password') || ($type == 'separate'))
+elseif (($type == 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password') || ($type == 'separate'))
{
- $paramlist=array_keys($param['options']);
+ $paramlist = array_keys($param['options']);
$param_chain = $paramlist[0];
}
?>
@@ -192,10 +192,10 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($t
trans("Type"); ?>
array('varchar', 'phone', 'mail', 'url', 'select', 'password', 'text', 'html'),
- 'text'=>array('text','html'),
- 'html'=>array('text','html'),
+ 'text'=>array('text', 'html'),
+ 'html'=>array('text', 'html'),
'password'=>array('password', 'varchar'),
'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'),
'url'=>array('varchar', 'phone', 'mail', 'url', 'select'),
@@ -204,12 +204,12 @@ $typewecanchangeinto=array(
);
if (in_array($type, array_keys($typewecanchangeinto)))
{
- $newarray=array();
+ $newarray = array();
print '';
- foreach($type2label as $key => $val)
+ foreach ($type2label as $key => $val)
{
- $selected='';
- if ($key == (GETPOST('type', 'alpha')?GETPOST('type', 'alpha'):$type)) $selected=' selected="selected"';
+ $selected = '';
+ if ($key == (GETPOST('type', 'alpha') ?GETPOST('type', 'alpha') : $type)) $selected = ' selected="selected"';
if (in_array($key, $typewecanchangeinto[$type])) print ''.$val.' ';
else print ''.$val.' ';
}
@@ -245,9 +245,9 @@ else
-trans("Position"); ?>
+trans("Position"); ?>
-trans("LanguageFile"); ?>
+trans("LanguageFile"); ?>
global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { ?>
@@ -257,23 +257,23 @@ else
-
+
-
+
-
+
+
>
-
+
+
textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?>
multicompany->enabled) { ?>
- trans("AllEntities"); ?> >
+ trans("AllEntities"); ?> >
diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php
index 769c12ceaa5..b2bb69aa0bf 100644
--- a/htdocs/core/tpl/admin_extrafields_view.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php
@@ -25,7 +25,7 @@
*/
// Protection to avoid direct call of template
-if (empty($langs) || ! is_object($langs))
+if (empty($langs) || !is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
@@ -66,7 +66,7 @@ print ''.$langs->trans("AlwaysEditable").' ';
print ''.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).' ';
print ''.$form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")).' ';
print ''.$form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")).' ';
-if ($conf->multicompany->enabled){
+if ($conf->multicompany->enabled) {
print ''.$langs->trans("Entities").' ';
}
print ' ';
@@ -74,16 +74,16 @@ print "\n";
if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafields->attributes[$elementtype]['type']))
{
- foreach($extrafields->attributes[$elementtype]['type'] as $key => $value)
+ foreach ($extrafields->attributes[$elementtype]['type'] as $key => $value)
{
// Load language if required
- if (! empty($extrafields->attributes[$elementtype]['langfile'][$key])) {
+ if (!empty($extrafields->attributes[$elementtype]['langfile'][$key])) {
$langs->load($extrafields->attributes[$elementtype]['langfile'][$key]);
}
print '';
print "".$extrafields->attributes[$elementtype]['pos'][$key]." \n";
- print "".$extrafields->attributes[$elementtype]['label'][$key]." \n"; // We don't translate here, we want admin to know what is the key not translated value
+ print "".$extrafields->attributes[$elementtype]['label'][$key]." \n"; // We don't translate here, we want admin to know what is the key not translated value
print "".$langs->trans($extrafields->attributes[$elementtype]['label'][$key])." \n";
print "".$key." \n";
print "".$type2label[$extrafields->attributes[$elementtype]['type'][$key]]." \n";
@@ -93,9 +93,9 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
print ''.yn($extrafields->attributes[$elementtype]['required'][$key])." \n";
print ''.yn($extrafields->attributes[$elementtype]['alwayseditable'][$key])." \n";
print ''.$extrafields->attributes[$elementtype]['list'][$key]." \n";
- print ''.yn($extrafields->attributes[$elementtype]['printable'][$key])." \n";
+ print ''.$extrafields->attributes[$elementtype]['printable'][$key]." \n";
print ''.yn($extrafields->attributes[$elementtype]['totalizable'][$key])." \n";
- if (! empty($conf->multicompany->enabled)) {
+ if (!empty($conf->multicompany->enabled)) {
print '';
if (empty($extrafields->attributes[$elementtype]['entityid'][$key]))
{
@@ -103,7 +103,7 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
}
else {
global $multicompanylabel_cache;
- if (! is_array($multicompanylabel_cache)) $multicompanylabel_cache = array();
+ if (!is_array($multicompanylabel_cache)) $multicompanylabel_cache = array();
if (empty($multicompanylabel_cache[$extrafields->attributes[$elementtype]['entityid'][$key]])) {
global $mc;
$mc->getInfo($extrafields->attributes[$elementtype]['entityid'][$key]);
@@ -120,8 +120,8 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
}
else
{
- $colspan=13;
- if (! empty($conf->multicompany->enabled)) $colspan++;
+ $colspan = 13;
+ if (!empty($conf->multicompany->enabled)) $colspan++;
print ' ';
print '';
diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php
index d14503a9039..eca100731ac 100644
--- a/htdocs/core/tpl/contacts.tpl.php
+++ b/htdocs/core/tpl/contacts.tpl.php
@@ -28,7 +28,6 @@ if (empty($object) || !is_object($object))
exit;
}
-
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@@ -66,8 +65,9 @@ $userstatic = new User($db);
select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp');
+ $nbofcontacts = $form->select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp');
$newcardbutton = '';
- if (! empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer)
+ if (!empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer)
{
$newcardbutton .= '
id).'" title="'.$langs->trans('NewContact').'"> ';
}
@@ -140,111 +140,182 @@ if ($permission) {
element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc;
+ $tmpobject = $object;
+ if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject = $objectsrc;
$formcompany->selectTypeContact($tmpobject, '', 'type', 'external', 'position', 0, 'minwidth100imp'); ?>
- ">
+ ">
-
- trans("NatureOfContact"); ?>
- trans("ThirdParty"); ?>
- trans("Users").'/'.$langs->trans("Contacts"); ?>
- trans("ContactType"); ?>
- trans("Status"); ?>
-
-
+print "";
-element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc;
+/**
+* Prepare list
+*/
+
+// TODO: replace this with direct SQL string to use $db->sort($sortfield, $sortorder)
+$list = array();
+foreach (array('internal', 'external') as $source)
+{
+ $tmpobject = $object;
+
+ if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc))
+ {
+ $tmpobject = $objectsrc;
+ }
$tab = $tmpobject->liste_contact(-1, $source);
- $num=count($tab);
+ $num = count($tab);
$i = 0;
- while ($i < $num) {
- ?>
+ while ($i < $num)
+ {
+ $entry = new stdClass();
+
+ $entry->id = $tab[$i]['rowid'];
+ $entry->type = $tab[$i]['libelle'];
+
+ if ($tab[$i]['source'] == 'internal')
+ {
+ $entry->nature = $langs->trans("User");
+ }
+ elseif ($tab[$i]['source'] == 'external')
+ {
+ $entry->nature = $langs->trans("ThirdPartyContact");
+ }
-
-
- trans("User"); ?>
- trans("ThirdPartyContact"); ?>
-
-
- 0)
{
$companystatic->fetch($tab[$i]['socid']);
- echo $companystatic->getNomUrl(1);
+ $entry->thirdparty = $companystatic->getNomUrl(1);
}
- if ($tab[$i]['socid'] < 0)
+ elseif ($tab[$i]['socid'] < 0)
{
- echo $conf->global->MAIN_INFO_SOCIETE_NOM;
+ $entry->thirdparty = $conf->global->MAIN_INFO_SOCIETE_NOM;
}
- if (! $tab[$i]['socid'])
+ elseif (!$tab[$i]['socid'])
{
- echo ' ';
+ $entry->thirdparty = "";
}
- ?>
-
-
- fetch($tab[$i]['id']);
- echo $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle');
+ $entry->contact = $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle');
}
- if ($tab[$i]['source']=='external')
+ elseif ($tab[$i]['source'] == 'external')
{
$contactstatic->fetch($tab[$i]['id']);
- echo $contactstatic->getNomUrl(1, '', 0, '', 0, 0);
+ $entry->contact = $contactstatic->getNomUrl(1, '', 0, '', 0, 0);
}
- ?>
-
-
-
-
-
- status = $userstatic->LibStatut($tab[$i]['statuscontact'], 3);
+ }
+ elseif ($tab[$i]['source'] == 'external')
+ {
+ $entry->status = $contactstatic->LibStatut($tab[$i]['statuscontact'], 3);
+ }
+
+ $i++;
+ $list[] = $entry;
}
}
-print "\n";
-print "\n";
+
+$sortfield = GETPOST("sortfield", "alpha");
+$sortorder = GETPOST("sortorder", 'alpha');
+
+if (!$sortfield) $sortfield = "nature";
+if (!$sortorder) $sortorder = "asc";
+
+// Re-sort list
+$list = dol_sort_array($list, $sortfield, $sortorder, 1, 0, 1);
+
+$arrayfields = array(
+ 'rowid' => array('label'=>$langs->trans("Id"), 'checked'=>1),
+ 'nature' => array('label'=>$langs->trans("NatureOfContact"), 'checked'=>1),
+ 'thirdparty' => array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
+ 'contact' => array('label'=>$langs->trans("Users").'/'.$langs->trans("Contacts"), 'checked'=>1),
+ 'type' => array('label'=>$langs->trans("ContactType"), 'checked'=>1),
+ 'status' => array('label'=>$langs->trans("Status"), 'checked'=>1),
+ 'link' => array('label'=>$langs->trans("Link"), 'checked'=>1),
+);
+
+$param = 'id='.$object->id.'&mainmenu=home';
+
+/**
+ * Show list
+ */
+
+print ' ';
+
+print '';
+print ' ';
+print ' ';
+print ' ';
+print ' ';
+print ' ';
+
+print '';
+
+print '';
+print ' ';
+
+print '';
+print_liste_field_titre($arrayfields['nature']['label'], $_SERVER["PHP_SELF"], "nature", "", $param, "", $sortfield, $sortorder);
+print_liste_field_titre($arrayfields['thirdparty']['label'], $_SERVER["PHP_SELF"], "thirdparty", "", $param, "", $sortfield, $sortorder);
+print_liste_field_titre($arrayfields['contact']['label'], $_SERVER["PHP_SELF"], "contact", "", $param, "", $sortfield, $sortorder);
+print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, "", $sortfield, $sortorder);
+print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "statut", "", $param, "", $sortfield, $sortorder, 'center ');
+print_liste_field_titre($arrayfields['link']['label'], $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder, 'center maxwidthsearch ');
+print " ";
+
+foreach ($list as $entry)
+{
+ print '';
+
+ print ''.$entry->nature.' ';
+ print ''.$entry->thirdparty.' ';
+ print ''.$entry->contact.' ';
+ print ''.$entry->type.' ';
+ print ''.$entry->status.' ';
+
+ if ($permission)
+ {
+ $href = $_SERVER["PHP_SELF"];
+ $href .= "?id=".$object->id;
+ $href .= "&action=deletecontact";
+ $href .= "&lineid=".$entry->id;
+
+ print "";
+ print "";
+ print img_picto($langs->trans("Unlink"), "unlink");
+ print " ";
+ print " ";
+ }
+
+ print " ";
+}
+
+print "
";
+print "";
+print " ";
+print "";
+
print "\n";
if (is_object($hookmanager)) {
$hookmanager->initHooks(array('contacttpl'));
- $parameters=array();
- $reshook=$hookmanager->executeHooks('formContactTpl', $parameters, $object, $action);
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('formContactTpl', $parameters, $object, $action);
}
print "\n";
+
diff --git a/htdocs/core/tpl/extrafields_add.tpl.php b/htdocs/core/tpl/extrafields_add.tpl.php
index 0579c464d30..45ca9a29197 100644
--- a/htdocs/core/tpl/extrafields_add.tpl.php
+++ b/htdocs/core/tpl/extrafields_add.tpl.php
@@ -37,11 +37,14 @@ if (empty($conf) || !is_object($conf))
executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- $params = isset($tpl_context) ? array('tpl_context' => $tpl_context) : array(); // BUG #11554 : Add tpl_context in params
+ $params = array();
+ if (isset($tpl_context)) $params['tpl_context'] = $tpl_context;
+ $params['cols'] = $parameters['colspanvalue'];
print $object->showOptionals($extrafields, 'edit', $params); // BUG #11554 : Add context in params
}
diff --git a/htdocs/core/tpl/extrafields_edit.tpl.php b/htdocs/core/tpl/extrafields_edit.tpl.php
index adca8b50fab..dbc2b9745cd 100644
--- a/htdocs/core/tpl/extrafields_edit.tpl.php
+++ b/htdocs/core/tpl/extrafields_edit.tpl.php
@@ -26,7 +26,7 @@
*/
// Protection to avoid direct call of template
-if (empty($conf) || ! is_object($conf))
+if (empty($conf) || !is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
@@ -37,11 +37,13 @@ if (empty($conf) || ! is_object($conf))
executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit');
+ $params = array();
+ $params['cols'] = $parameters['colspanvalue'];
+ print $object->showOptionals($extrafields, 'edit', $params);
}
?>
diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index 954a6a8b089..5fc268013c6 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -261,7 +261,7 @@ if ($nolinesbefore) {
if ($senderissupplier != 2)
{
$ajaxoptions = array(
- 'update' => array('qty'=>'qty', 'remise_percent' => 'discount', 'idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key
+ 'update' => array('qty'=>'qty', 'remise_percent' => 'discount', 'idprod' => 'idprod'), // html id tags that will be edited with each ajax json response key
'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo)
);
@@ -378,7 +378,7 @@ if ($nolinesbefore) {
">
global->PRODUCT_USE_UNITS)) {
+ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$coldisplay++;
print '';
print $form->selectUnits($line->fk_unit, "units");
@@ -636,11 +636,15 @@ if (!empty($usemargins) && $user->rights->margins->creer)
{
console.log("We are in a price per qty context, we do not call ajax/product");
} else {
+ global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { ?>
+ if (isNaN(pbq)) { console.log("We use experimental option PRODUIT_CUSTOMER_PRICES_BY_QTY or PRODUIT_CUSTOMER_PRICES_BY_QTY but we are not yet able to get the id of pbq from product combo list, so load of price may be 0 if product has differet prices"); }
+
// Get the HT price for the product and display it
- console.log("Load price without tax and set it into #price_ht for id="+$(this).val()+" socid=socid; ?>");
+ console.log("Load unit price without tax and set it into #price_ht for product id="+$(this).val()+" socid=socid; ?>");
$.post('/product/ajax/products.php?action=fetch',
{ 'id': $(this).val(), 'socid': socid; ?> },
function(data) {
+ console.log("Load unit price end, we got value "+data.price_ht);
jQuery("#price_ht").val(data.price_ht);
},
'json'
@@ -658,95 +662,96 @@ if (!empty($usemargins) && $user->rights->margins->creer)
$("#fournprice_predef").find("option").remove();
$("#fournprice_predef").hide();
$("#buying_price").val("").show();
+
/* Call post to load content of combo list fournprice_predef */
$.post('/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val() }, function(data) {
- if (data && data.length > 0)
- {
- var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0;
-
- var bestpriceid = 0; var bestpricevalue = 0;
- var pmppriceid = 0; var pmppricevalue = 0;
- var costpriceid = 0; var costpricevalue = 0;
-
- /* setup of margin calculation */
- var defaultbuyprice = 'global->MARGIN_TYPE))
- {
- if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice';
- if ($conf->global->MARGIN_TYPE == 'pmp') print 'pmp';
- if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice';
- } ?>';
- console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice);
-
- var i = 0;
- $(data).each(function() {
- /* Warning: Lines must be processed in order: best supplier price, then pmpprice line then costprice */
- if (this.id != 'pmpprice' && this.id != 'costprice')
+ if (data && data.length > 0)
{
- i++;
- this.price = parseFloat(this.price); // to fix when this.price >0
- // If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
- //console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0));
- if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
- }
- if (this.id == 'pmpprice')
- {
- // If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
- console.log("id="+this.id+"-price="+this.price);
- if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
+ var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0;
+
+ var bestpriceid = 0; var bestpricevalue = 0;
+ var pmppriceid = 0; var pmppricevalue = 0;
+ var costpriceid = 0; var costpricevalue = 0;
+
+ /* setup of margin calculation */
+ var defaultbuyprice = 'global->MARGIN_TYPE))
{
- if (this.price > 0) {
- defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
- //console.log("pmppricevalue="+pmppricevalue);
+ if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice';
+ if ($conf->global->MARGIN_TYPE == 'pmp') print 'pmp';
+ if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice';
+ } ?>';
+ console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice);
+
+ var i = 0;
+ $(data).each(function() {
+ /* Warning: Lines must be processed in order: best supplier price, then pmpprice line then costprice */
+ if (this.id != 'pmpprice' && this.id != 'costprice')
+ {
+ i++;
+ this.price = parseFloat(this.price); // to fix when this.price >0
+ // If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
+ //console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0));
+ if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
}
- }
- }
- if (this.id == 'costprice')
- {
- // If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
- console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue);
- if ('costprice' == defaultbuyprice)
+ if (this.id == 'pmpprice')
+ {
+ // If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
+ console.log("id="+this.id+"-price="+this.price);
+ if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
+ {
+ if (this.price > 0) {
+ defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
+ //console.log("pmppricevalue="+pmppricevalue);
+ }
+ }
+ }
+ if (this.id == 'costprice')
+ {
+ // If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
+ console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue);
+ if ('costprice' == defaultbuyprice)
+ {
+ if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; }
+ else if (pmppricevalue > 0) { defaultkey = 'pmpprice'; defaultprice = pmppricevalue; }
+ }
+ }
+ options += ''+this.label+' ';
+ });
+ options += 'trans("InputPrice"); ?> ';
+
+ console.log("finally selected defaultkey="+defaultkey+" defaultprice for buying price="+defaultprice);
+
+ $("#fournprice_predef").html(options).show();
+ if (defaultkey != '')
{
- if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; }
- else if (pmppricevalue > 0) { defaultkey = 'pmpprice'; defaultprice = pmppricevalue; }
+ $("#fournprice_predef").val(defaultkey);
}
+
+ /* At loading, no product are yet selected, so we hide field of buying_price */
+ $("#buying_price").hide();
+
+ /* Define default price at loading */
+ var defaultprice = $("#fournprice_predef").find('option:selected').attr("price");
+ $("#buying_price").val(defaultprice);
+
+ $("#fournprice_predef").change(function() {
+ console.log("change on fournprice_predef");
+ /* Hide field buying_price according to choice into list (if 'inputprice' or not) */
+ var linevalue=$(this).find('option:selected').val();
+ var pricevalue = $(this).find('option:selected').attr("price");
+ if (linevalue != 'inputprice' && linevalue != 'pmpprice') {
+ $("#buying_price").val(pricevalue).hide(); /* We set value then hide field */
+ }
+ if (linevalue == 'inputprice') {
+ $('#buying_price').show();
+ }
+ if (linevalue == 'pmpprice') {
+ $("#buying_price").val(pricevalue);
+ $('#buying_price').hide();
+ }
+ });
}
- options += ''+this.label+' ';
- });
- options += 'trans("InputPrice"); ?> ';
-
- console.log("finally selected defaultkey="+defaultkey+" defaultprice="+defaultprice);
-
- $("#fournprice_predef").html(options).show();
- if (defaultkey != '')
- {
- $("#fournprice_predef").val(defaultkey);
- }
-
- /* At loading, no product are yet selected, so we hide field of buying_price */
- $("#buying_price").hide();
-
- /* Define default price at loading */
- var defaultprice = $("#fournprice_predef").find('option:selected').attr("price");
- $("#buying_price").val(defaultprice);
-
- $("#fournprice_predef").change(function() {
- console.log("change on fournprice_predef");
- /* Hide field buying_price according to choice into list (if 'inputprice' or not) */
- var linevalue=$(this).find('option:selected').val();
- var pricevalue = $(this).find('option:selected').attr("price");
- if (linevalue != 'inputprice' && linevalue != 'pmpprice') {
- $("#buying_price").val(pricevalue).hide(); /* We set value then hide field */
- }
- if (linevalue == 'inputprice') {
- $('#buying_price').show();
- }
- if (linevalue == 'pmpprice') {
- $("#buying_price").val(pricevalue);
- $('#buying_price').hide();
- }
- });
- }
},
'json');
@@ -756,7 +761,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
/* To process customer price per quantity (CUSTOMER_PRICE_PER_QTY works only if combo product is not an ajax after x key pressed) */
var pbq = parseInt($('option:selected', this).attr('data-pbq'));
- var pbqup = parseInt($('option:selected', this).attr('data-pbqup'));
+ var pbqup = parseFloat($('option:selected', this).attr('data-pbqup'));
var pbqbase = $('option:selected', this).attr('data-pbqbase');
var pbqqty = parseFloat($('option:selected', this).attr('data-pbqqty'));
var pbqpercent = parseFloat($('option:selected', this).attr('data-pbqpercent'));
diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php
index 93d1b37c690..7acd977e714 100644
--- a/htdocs/core/triggers/interface_20_all_Logevents.class.php
+++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php
@@ -59,13 +59,13 @@ class InterfaceLogevents extends DolibarrTriggers
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
- if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features)
+ if (!empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features)
- $key='MAIN_LOGEVENTS_'.$action;
+ $key = 'MAIN_LOGEVENTS_'.$action;
//dol_syslog("xxxxxxxxxxx".$key);
- if (empty($conf->global->$key)) return 0; // Log events not enabled for this action
+ if (empty($conf->global->$key)) return 0; // Log events not enabled for this action
- if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form)
+ if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form)
$date = dol_now();
@@ -76,18 +76,18 @@ class InterfaceLogevents extends DolibarrTriggers
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text="(UserLogged,".$object->login.")";
- $text.=(empty($object->trigger_mesg)?'':' - '.$object->trigger_mesg);
- $desc="(UserLogged,".$object->login.")";
- $desc.=(empty($object->trigger_mesg)?'':' - '.$object->trigger_mesg);
+ $text = "(UserLogged,".$object->login.")";
+ $text .= (empty($object->trigger_mesg) ? '' : ' - '.$object->trigger_mesg);
+ $desc = "(UserLogged,".$object->login.")";
+ $desc .= (empty($object->trigger_mesg) ? '' : ' - '.$object->trigger_mesg);
}
if ($action == 'USER_LOGIN_FAILED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Initialisation donnees (date,duree,texte,desc)
- $text=$object->trigger_mesg; // Message direct
- $desc=$object->trigger_mesg; // Message direct
+ $text = $object->trigger_mesg; // Message direct
+ $desc = $object->trigger_mesg; // Message direct
}
if ($action == 'USER_LOGOUT')
{
@@ -95,8 +95,8 @@ class InterfaceLogevents extends DolibarrTriggers
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text="(UserLogoff,".$object->login.")";
- $desc="(UserLogoff,".$object->login.")";
+ $text = "(UserLogoff,".$object->login.")";
+ $desc = "(UserLogoff,".$object->login.")";
}
if ($action == 'USER_CREATE')
{
@@ -104,8 +104,8 @@ class InterfaceLogevents extends DolibarrTriggers
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("NewUserCreated", $object->login);
- $desc=$langs->transnoentities("NewUserCreated", $object->login);
+ $text = $langs->transnoentities("NewUserCreated", $object->login);
+ $desc = $langs->transnoentities("NewUserCreated", $object->login);
}
elseif ($action == 'USER_MODIFY')
{
@@ -113,8 +113,8 @@ class InterfaceLogevents extends DolibarrTriggers
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("EventUserModified", $object->login);
- $desc=$langs->transnoentities("EventUserModified", $object->login);
+ $text = $langs->transnoentities("EventUserModified", $object->login);
+ $desc = $langs->transnoentities("EventUserModified", $object->login);
}
elseif ($action == 'USER_NEW_PASSWORD')
{
@@ -122,8 +122,8 @@ class InterfaceLogevents extends DolibarrTriggers
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("NewUserPassword", $object->login);
- $desc=$langs->transnoentities("NewUserPassword", $object->login);
+ $text = $langs->transnoentities("NewUserPassword", $object->login);
+ $desc = $langs->transnoentities("NewUserPassword", $object->login);
}
elseif ($action == 'USER_ENABLEDISABLE')
{
@@ -132,13 +132,13 @@ class InterfaceLogevents extends DolibarrTriggers
// Initialisation donnees (date,duree,texte,desc)
if ($object->statut == 0)
{
- $text=$langs->transnoentities("UserEnabled", $object->login);
- $desc=$langs->transnoentities("UserEnabled", $object->login);
+ $text = $langs->transnoentities("UserEnabled", $object->login);
+ $desc = $langs->transnoentities("UserEnabled", $object->login);
}
if ($object->statut == 1)
{
- $text=$langs->transnoentities("UserDisabled", $object->login);
- $desc=$langs->transnoentities("UserDisabled", $object->login);
+ $text = $langs->transnoentities("UserDisabled", $object->login);
+ $desc = $langs->transnoentities("UserDisabled", $object->login);
}
}
elseif ($action == 'USER_DELETE')
@@ -146,8 +146,8 @@ class InterfaceLogevents extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("UserDeleted", $object->login);
- $desc=$langs->transnoentities("UserDeleted", $object->login);
+ $text = $langs->transnoentities("UserDeleted", $object->login);
+ $desc = $langs->transnoentities("UserDeleted", $object->login);
}
// Groupes
@@ -156,24 +156,24 @@ class InterfaceLogevents extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("NewGroupCreated", $object->name);
- $desc=$langs->transnoentities("NewGroupCreated", $object->name);
+ $text = $langs->transnoentities("NewGroupCreated", $object->name);
+ $desc = $langs->transnoentities("NewGroupCreated", $object->name);
}
elseif ($action == 'GROUP_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("GroupModified", $object->name);
- $desc=$langs->transnoentities("GroupModified", $object->name);
+ $text = $langs->transnoentities("GroupModified", $object->name);
+ $desc = $langs->transnoentities("GroupModified", $object->name);
}
elseif ($action == 'GROUP_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("GroupDeleted", $object->name);
- $desc=$langs->transnoentities("GroupDeleted", $object->name);
+ $text = $langs->transnoentities("GroupDeleted", $object->name);
+ $desc = $langs->transnoentities("GroupDeleted", $object->name);
}
// If not found
@@ -186,29 +186,30 @@ class InterfaceLogevents extends DolibarrTriggers
*/
// Add more information into desc from the context property
- if (! empty($desc) && ! empty($object->context['audit'])) $desc.=' - '.$object->context['audit'];
+ if (!empty($desc) && !empty($object->context['audit'])) $desc .= ' - '.$object->context['audit'];
// Add entry in event table
include_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
- $event=new Events($this->db);
- $event->type=$action;
- $event->dateevent=$date;
- $event->label=$text;
- $event->description=$desc;
- $event->user_agent=$_SERVER["HTTP_USER_AGENT"];
+ $event = new Events($this->db);
+ $event->type = $action;
+ $event->dateevent = $date;
+ $event->label = $text;
+ $event->description = $desc;
+ $event->user_agent = $_SERVER["HTTP_USER_AGENT"];
- $result=$event->create($user);
+ $result = $event->create($user);
if ($result > 0)
{
return 1;
}
else
{
- $error ="Failed to insert security event: ".$event->error;
- $this->error=$error;
+ $error = "Failed to insert security event: ".$event->error;
+ $this->errors[] = $error;
+ $this->error = $error;
- dol_syslog(get_class($this).": ".$this->error, LOG_ERR);
+ dol_syslog(get_class($this).": ".$error, LOG_ERR);
return -1;
}
}
diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
index 26958aed875..3fe9d63c380 100644
--- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
+++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
@@ -71,7 +71,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
- if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing
+ if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing
$key = 'MAIN_AGENDA_ACTIONAUTO_'.$action;
@@ -82,25 +82,25 @@ class InterfaceActionsAuto extends DolibarrTriggers
$langs->load("agenda");
- if (empty($object->actiontypecode)) $object->actiontypecode='AC_OTH_AUTO';
+ if (empty($object->actiontypecode)) $object->actiontypecode = 'AC_OTH_AUTO';
// Actions
if ($action == 'COMPANY_CREATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","companies"));
+ $langs->loadLangs(array("agenda", "other", "companies"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr", $object->name);
- $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr", $object->name);
- if (! empty($object->prefix)) $object->actionmsg.=" (".$object->prefix.")";
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("NewCompanyToDolibarr", $object->name);
+ $object->actionmsg = $langs->transnoentities("NewCompanyToDolibarr", $object->name);
+ if (!empty($object->prefix)) $object->actionmsg .= " (".$object->prefix.")";
- $object->sendtoid=0;
- $object->socid=$object->id;
+ $object->sendtoid = 0;
+ $object->socid = $object->id;
}
elseif ($action == 'COMPANY_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
if (empty($object->actionmsg2)) dol_syslog('Trigger called with property actionmsg2 on object not defined', LOG_ERR);
@@ -110,22 +110,22 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'CONTRACT_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","contracts"));
+ $langs->loadLangs(array("agenda", "other", "contracts"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("ContractValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'CONTRACT_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","contracts"));
+ $langs->loadLangs(array("agenda", "other", "contracts"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ContractSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ContractSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ContractSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -134,22 +134,22 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'PROPAL_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'PROPAL_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ProposalSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -158,82 +158,82 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'PROPAL_CLOSE_SIGNED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'PROPAL_CLASSIFY_BILLED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'PROPAL_CLOSE_REFUSED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","orders"));
+ $langs->loadLangs(array("agenda", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_CLOSE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderDeliveredInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("OrderDeliveredInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderDeliveredInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("OrderDeliveredInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_CLASSIFY_BILLED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderBilledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("OrderBilledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderBilledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("OrderBilledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_CANCEL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("OrderSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("OrderSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -242,32 +242,32 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'BILL_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_UNVALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("InvoiceSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoiceSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -276,69 +276,69 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'BILL_PAYED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
// Values for this action can't be defined by caller.
- $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
+ $object->actionmsg2 = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_CANCEL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'FICHINTER_CREATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionCreatedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InterventionCreatedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionCreatedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InterventionCreatedInDolibarr", $object->ref);
- $object->sendtoid=0;
- $object->fk_element=0;
- $object->elementtype='';
+ $object->sendtoid = 0;
+ $object->fk_element = 0;
+ $object->elementtype = '';
}
elseif ($action == 'FICHINTER_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
- $object->fk_element=0;
- $object->elementtype='';
+ $object->sendtoid = 0;
+ $object->fk_element = 0;
+ $object->elementtype = '';
}
elseif ($action == 'FICHINTER_MODIFY')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionModifiedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InterventionModifiedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionModifiedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InterventionModifiedInDolibarr", $object->ref);
- $object->sendtoid=0;
- $object->fk_element=0;
- $object->elementtype='';
+ $object->sendtoid = 0;
+ $object->fk_element = 0;
+ $object->elementtype = '';
}
elseif ($action == 'FICHINTER_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("InterventionSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InterventionSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -347,44 +347,44 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'FICHINTER_CLASSIFY_BILLED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'FICHINTER_DELETE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionDeletedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InterventionDeletedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionDeletedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InterventionDeletedInDolibarr", $object->ref);
- $object->sendtoid=0;
- $object->fk_element=0;
- $object->elementtype='';
+ $object->sendtoid = 0;
+ $object->fk_element = 0;
+ $object->elementtype = '';
}
elseif ($action == 'SHIPPING_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","sendings"));
+ $langs->loadLangs(array("agenda", "other", "sendings"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingValidated", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref));
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ShippingValidated", ($object->newref?$object->newref:$object->ref));
+ $object->actionmsg = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref));
}
// Parameters $object->sendtoid defined by caller
@@ -393,12 +393,12 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'SHIPPING_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","sendings"));
+ $langs->loadLangs(array("agenda", "other", "sendings"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ShippingSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ShippingSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ShippingSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -409,10 +409,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
$langs->load("other");
$langs->load("receptions");
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ReceptionValidated", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref));
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ReceptionValidated", ($object->newref?$object->newref:$object->ref));
+ $object->actionmsg = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref));
}
// Parameters $object->sendtoid defined by caller
@@ -424,10 +424,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
$langs->load("other");
$langs->load("receptions");
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ReceptionSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ReceptionSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ReceptionSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ReceptionSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -436,22 +436,22 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ProposalSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -460,92 +460,92 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_CREATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderCreatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("OrderCreatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_APPROVE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderApprovedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("OrderApprovedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderApprovedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("OrderApprovedInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_REFUSE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderRefusedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("OrderRefusedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_SUBMIT')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_RECEIVE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills","orders"));
+ $langs->loadLangs(array("agenda", "other", "bills", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -554,45 +554,45 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills","orders"));
+ $langs->loadLangs(array("agenda", "other", "bills", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
+ $object->actionmsg = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
}
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_SUPPLIER_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_SUPPLIER_UNVALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills","orders"));
+ $langs->loadLangs(array("agenda", "other", "bills", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -601,244 +601,244 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'BILL_SUPPLIER_PAYED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_SUPPLIER_CANCELED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
// Members
elseif ($action == 'MEMBER_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'MEMBER_MODIFY')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
$member = $this->context['member'];
- if (! is_object($member)) // This should not happen
+ if (!is_object($member)) // This should not happen
{
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db);
$member->fetch($this->fk_adherent);
}
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->fk_type;
- $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->amount;
- $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->fk_type;
+ $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->amount;
+ $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
- $object->sendtoid=0;
- if ($object->fk_soc > 0) $object->socid=$object->fk_soc;
+ $object->sendtoid = 0;
+ if ($object->fk_soc > 0) $object->socid = $object->fk_soc;
}
elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
$member = $this->context['member'];
- if (! is_object($member)) // This should not happen
+ if (!is_object($member)) // This should not happen
{
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db);
$member->fetch($this->fk_adherent);
}
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->fk_type;
- $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->amount;
- $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->fk_type;
+ $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->amount;
+ $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
- $object->sendtoid=0;
- if ($object->fk_soc > 0) $object->socid=$object->fk_soc;
+ $object->sendtoid = 0;
+ if ($object->fk_soc > 0) $object->socid = $object->fk_soc;
}
elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
- $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
- $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day');
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
+ $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
+ $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day');
- $object->sendtoid=0;
- if ($object->fk_soc > 0) $object->socid=$object->fk_soc;
+ $object->sendtoid = 0;
+ if ($object->fk_soc > 0) $object->socid = $object->fk_soc;
}
elseif ($action == 'MEMBER_RESILIATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'MEMBER_DELETE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
// Projects
elseif ($action == 'PROJECT_CREATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("ProjectCreatedInDolibarr", $object->ref);
- $object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProjectCreatedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ProjectCreatedInDolibarr", $object->ref);
+ $object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
- elseif($action == 'PROJECT_VALIDATE')
+ elseif ($action == 'PROJECT_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectValidatedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("ProjectValidatedInDolibarr", $object->ref);
- $object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProjectValidatedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ProjectValidatedInDolibarr", $object->ref);
+ $object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
- elseif($action == 'PROJECT_MODIFY')
+ elseif ($action == 'PROJECT_MODIFY')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectModifiedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("ProjectModifiedInDolibarr", $object->ref);
- $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProjectModifiedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ProjectModifiedInDolibarr", $object->ref);
+ $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
// Project tasks
- elseif($action == 'TASK_CREATE')
+ elseif ($action == 'TASK_CREATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskCreatedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("TaskCreatedInDolibarr", $object->ref);
- $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TaskCreatedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("TaskCreatedInDolibarr", $object->ref);
+ $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
- elseif($action == 'TASK_MODIFY')
+ elseif ($action == 'TASK_MODIFY')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskModifiedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("TaskModifieddInDolibarr", $object->ref);
- $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TaskModifiedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("TaskModifieddInDolibarr", $object->ref);
+ $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
- elseif($action == 'TASK_DELETE')
+ elseif ($action == 'TASK_DELETE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskDeletedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("TaskDeletedInDolibarr", $object->ref);
- $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TaskDeletedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("TaskDeletedInDolibarr", $object->ref);
+ $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
- elseif($action == 'TICKET_ASSIGNED')
+ elseif ($action == 'TICKET_ASSIGNED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref);
if ($object->oldcopy->fk_user_assign > 0)
{
- $tmpuser=new User($this->db);
+ $tmpuser = new User($this->db);
$tmpuser->fetch($object->oldcopy->fk_user_assign);
- $object->actionmsg.="\n".$langs->transnoentities("OldUser").': '.$tmpuser->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("OldUser").': '.$tmpuser->getFullName($langs);
}
else
{
- $object->actionmsg.="\n".$langs->transnoentities("OldUser").': '.$langs->trans("None");
+ $object->actionmsg .= "\n".$langs->transnoentities("OldUser").': '.$langs->trans("None");
}
if ($object->fk_user_assign > 0)
{
- $tmpuser=new User($this->db);
+ $tmpuser = new User($this->db);
$tmpuser->fetch($object->fk_user_assign);
- $object->actionmsg.="\n".$langs->transnoentities("NewUser").': '.$tmpuser->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("NewUser").': '.$tmpuser->getFullName($langs);
}
else
{
- $object->actionmsg.="\n".$langs->transnoentities("NewUser").': '.$langs->trans("None");
+ $object->actionmsg .= "\n".$langs->transnoentities("NewUser").': '.$langs->trans("None");
}
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
// TODO Merge all previous cases into this generic one
- else // $action = TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, ...
+ else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, ...
{
// Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function). Key can be set in agenda setup if defined into c_action_trigger
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other"));
+ $langs->loadLangs(array("agenda", "other"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities($action."InDolibarr", $object->ref);
- if (empty($object->actionmsg)) $object->actionmsg=$langs->transnoentities($action."InDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities($action."InDolibarr", $object->ref);
+ if (empty($object->actionmsg)) $object->actionmsg = $langs->transnoentities($action."InDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
$object->actionmsg = $langs->transnoentities("Author").': '.$user->login."\n".$object->actionmsg;
@@ -846,21 +846,21 @@ class InterfaceActionsAuto extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Add entry in event table
- $now=dol_now();
+ $now = dol_now();
if (isset($_SESSION['listofnames-'.$object->trackid]))
{
- $attachs=$_SESSION['listofnames-'.$object->trackid];
+ $attachs = $_SESSION['listofnames-'.$object->trackid];
if ($attachs && strpos($action, 'SENTBYMAIL'))
{
- $object->actionmsg=dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs);
+ $object->actionmsg = dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs);
}
}
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
- $contactforaction=new Contact($this->db);
- $societeforaction=new Societe($this->db);
+ $contactforaction = new Contact($this->db);
+ $societeforaction = new Societe($this->db);
// Set contactforaction if there is only 1 contact.
if (is_array($object->sendtoid))
{
@@ -874,7 +874,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
if ($object->socid > 0) $societeforaction->fetch($object->socid);
elseif ($object->fk_soc > 0) $societeforaction->fetch($object->fk_soc);
- $projectid = isset($object->fk_project)?$object->fk_project:0;
+ $projectid = isset($object->fk_project) ? $object->fk_project : 0;
if ($object->element == 'project') $projectid = $object->id;
$elementid = $object->id;
@@ -889,20 +889,20 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Insertion action
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$actioncomm = new ActionComm($this->db);
- $actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
+ $actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$actioncomm->code = 'AC_'.$action;
$actioncomm->label = $object->actionmsg2;
- $actioncomm->note_private= $object->actionmsg; // TODO Replace with ($actioncomm->email_msgid ? $object->email_content : $object->actionmsg)
+ $actioncomm->note_private = $object->actionmsg; // TODO Replace with ($actioncomm->email_msgid ? $object->email_content : $object->actionmsg)
$actioncomm->fk_project = $projectid;
$actioncomm->datep = $now;
$actioncomm->datef = $now;
$actioncomm->durationp = 0;
$actioncomm->punctual = 1;
- $actioncomm->percentage = -1; // Not applicable
+ $actioncomm->percentage = -1; // Not applicable
$actioncomm->socid = $societeforaction->id;
$actioncomm->contactid = $contactforaction->id;
- $actioncomm->authorid = $user->id; // User saving action
- $actioncomm->userownerid = $user->id; // Owner of action
+ $actioncomm->authorid = $user->id; // User saving action
+ $actioncomm->userownerid = $user->id; // Owner of action
// Fields defined when action is an email (content should be into object->actionmsg to be added into note, subject into object->actionms2 to be added into label)
$actioncomm->email_msgid = $object->email_msgid;
$actioncomm->email_from = $object->email_from;
@@ -915,28 +915,28 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table
// for such objects because there is already a dedicated field into table llx_actioncomm.
- if (! in_array($elementtype, array('societe','contact','project')))
+ if (!in_array($elementtype, array('societe', 'contact', 'project')))
{
$actioncomm->fk_element = $elementid;
$actioncomm->elementtype = $elementtype;
}
- if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles)>0) {
- $actioncomm->attachedfiles=$object->attachedfiles;
+ if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles) > 0) {
+ $actioncomm->attachedfiles = $object->attachedfiles;
}
- if (property_exists($object, 'sendtouserid') && is_array($object->sendtouserid) && count($object->sendtouserid)>0) {
- $actioncomm->userassigned=$object->sendtouserid;
+ if (property_exists($object, 'sendtouserid') && is_array($object->sendtouserid) && count($object->sendtouserid) > 0) {
+ $actioncomm->userassigned = $object->sendtouserid;
}
- $ret=$actioncomm->create($user); // User creating action
+ $ret = $actioncomm->create($user); // User creating action
if ($ret > 0 && $conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO)
{
- if (is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths'])>0) {
- foreach($object->attachedfiles['paths'] as $key=>$filespath) {
+ if (is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) {
+ foreach ($object->attachedfiles['paths'] as $key=>$filespath) {
$srcfile = $filespath;
- $destdir = $conf->agenda->dir_output . '/' . $ret;
- $destfile = $destdir . '/' . $object->attachedfiles['names'][$key];
+ $destdir = $conf->agenda->dir_output.'/'.$ret;
+ $destfile = $destdir.'/'.$object->attachedfiles['names'][$key];
if (dol_mkdir($destdir) >= 0) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_copy($srcfile, $destfile);
@@ -945,7 +945,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
}
}
- unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action.
+ unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action.
if ($ret > 0)
{
@@ -954,8 +954,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
}
else
{
- $this->error="Failed to insert event : ".$actioncomm->error." ".join(',', $actioncomm->errors);
- $this->errors=$actioncomm->errors;
+ $this->error = "Failed to insert event : ".$actioncomm->error." ".join(',', $actioncomm->errors);
+ $this->errors = $actioncomm->errors;
dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR);
return -1;
diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php
index ac9f178b163..0b73d95a140 100644
--- a/htdocs/cron/list.php
+++ b/htdocs/cron/list.php
@@ -47,7 +47,7 @@ $id = GETPOST('id', 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/don/document.php b/htdocs/don/document.php
index 9e23fe46452..dba5b4cff7b 100644
--- a/htdocs/don/document.php
+++ b/htdocs/don/document.php
@@ -57,7 +57,7 @@ $result = restrictedArea($user, 'don', $id, '');
// Get parameters
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/don/index.php b/htdocs/don/index.php
index 6366d0fb6e6..39155dae768 100644
--- a/htdocs/don/index.php
+++ b/htdocs/don/index.php
@@ -137,10 +137,10 @@ if ($conf->use_javascript_ajax)
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
- $dolgraph->setShowLegend(1);
+ $dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
- $dolgraph->setWidth('100%');
+ $dolgraph->setHeight('200');
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($total ? 0 : 1);
@@ -159,7 +159,7 @@ $totalnb = 0;
foreach ($listofstatus as $status)
{
print ' ';
- print ''.$donstatic->LibStatut($status, 4).' ';
+ print ''.$donstatic->LibStatut($status, 4).' ';
print ''.(!empty($nb[$status]) ? $nb[$status] : ' ').' ';
print ''.(!empty($nb[$status]) ?price($somme[$status], 'MT') : ' ').' ';
print ''.(!empty($nb[$status]) ?price(price2num($somme[$status] / $nb[$status], 'MT')) : ' ').' ';
diff --git a/htdocs/don/list.php b/htdocs/don/list.php
index 48b5f108b81..a61a97f7c78 100644
--- a/htdocs/don/list.php
+++ b/htdocs/don/list.php
@@ -27,27 +27,27 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
-if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("companies","donations"));
+$langs->loadLangs(array("companies", "donations"));
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
-$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
+$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (! $sortorder) $sortorder="DESC";
-if (! $sortfield) $sortfield="d.datedon";
+if (!$sortorder) $sortorder = "DESC";
+if (!$sortfield) $sortfield = "d.datedon";
-$search_status=(GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_status", 'intcomma') : "-1";
-$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
-$search_ref=GETPOST('search_ref', 'alpha');
-$search_company=GETPOST('search_company', 'alpha');
-$search_name=GETPOST('search_name', 'alpha');
+$search_status = (GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_status", 'intcomma') : "-4";
+$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
+$search_ref = GETPOST('search_ref', 'alpha');
+$search_company = GETPOST('search_company', 'alpha');
+$search_name = GETPOST('search_name', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
@@ -60,6 +60,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_company = "";
$search_name = "";
$search_amount = "";
+ $search_status = '';
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -78,26 +79,26 @@ $fieldstosearchall = array(
* View
*/
-$form=new Form($db);
-if (! empty($conf->projet->enabled)) $projectstatic=new Project($db);
+$form = new Form($db);
+if (!empty($conf->projet->enabled)) $projectstatic = new Project($db);
llxHeader('', $langs->trans("Donations"), 'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones');
-$donationstatic=new Don($db);
+$donationstatic = new Don($db);
// Genere requete de liste des dons
$sql = "SELECT d.rowid, d.datedon, d.fk_soc as socid, d.firstname, d.lastname, d.societe,";
-$sql.= " d.amount, d.fk_statut as status,";
-$sql.= " p.rowid as pid, p.ref, p.title, p.public";
-$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
-$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
-if ($search_status != '' && $search_status != '-1')
+$sql .= " d.amount, d.fk_statut as status,";
+$sql .= " p.rowid as pid, p.ref, p.title, p.public";
+$sql .= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
+$sql .= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
+if ($search_status != '' && $search_status != '-4')
{
$sql .= " AND d.fk_statut IN (".$db->escape($search_status).")";
}
if (trim($search_ref) != '')
{
- $sql.= natural_search('d.ref', $search_ref);
+ $sql .= natural_search('d.ref', $search_ref);
}
if (trim($search_all) != '')
{
@@ -136,17 +137,17 @@ if ($resql)
$i = 0;
$param = '';
- if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
+ if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if ($search_status && $search_status != -1) $param .= '&search_status='.urlencode($search_status);
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
if ($search_company) $param .= '&search_company='.urlencode($search_company);
if ($search_name) $param .= '&search_name='.urlencode($search_name);
if ($search_amount) $param .= '&search_amount='.urlencode($search_amount);
- $newcardbutton='';
+ $newcardbutton = '';
if ($user->rights->don->creer)
{
- $newcardbutton.= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create');
+ $newcardbutton .= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create');
}
print ''."\n";
@@ -162,19 +163,19 @@ if ($resql)
if ($search_all)
{
- foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
- print ''.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'
';
+ foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
+ print ''.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
';
}
print '';
- print '
'."\n";
+ print ''."\n";
// Filters lines
print '';
print '';
print ' ';
print ' ';
- if (! empty($conf->global->DONATION_USE_THIRDPARTIES)) {
+ if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) {
print '';
print ' ';
print ' ';
@@ -196,23 +197,31 @@ if ($resql)
print '';
}
print ' ';
- print ' ';
+ print '';
+ $liststatus = array(
+ Don::STATUS_DRAFT=>$langs->trans("DonationStatusPromiseNotValidated"),
+ Don::STATUS_VALIDATED=>$langs->trans("DonationStatusPromiseValidated"),
+ Don::STATUS_PAID=>$langs->trans("DonationStatusPaid"),
+ Don::STATUS_CANCELED=>$langs->trans("Canceled")
+ );
+ print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
+ print ' ';
print '';
- $searchpicto=$form->showFilterAndCheckAddButtons(0);
+ $searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print ' ';
print " \n";
print '';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", $param, "", $sortfield, $sortorder);
- if (! empty($conf->global->DONATION_USE_THIRDPARTIES)) {
+ if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) {
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "d.fk_soc", "", $param, "", $sortfield, $sortorder);
} else {
print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "d.societe", "", $param, "", $sortfield, $sortorder);
}
print_liste_field_titre("Name", $_SERVER["PHP_SELF"], "d.lastname", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "d.datedon", "", $param, '', $sortfield, $sortorder, 'center ');
- if (! empty($conf->projet->enabled))
+ if (!empty($conf->projet->enabled))
{
$langs->load("projects");
print_liste_field_titre("Project", $_SERVER["PHP_SELF"], "d.fk_projet", "", $param, "", $sortfield, $sortorder);
@@ -227,15 +236,15 @@ if ($resql)
$objp = $db->fetch_object($resql);
print ' ';
- $donationstatic->id=$objp->rowid;
- $donationstatic->ref=$objp->rowid;
- $donationstatic->lastname=$objp->lastname;
- $donationstatic->firstname=$objp->firstname;
+ $donationstatic->id = $objp->rowid;
+ $donationstatic->ref = $objp->rowid;
+ $donationstatic->lastname = $objp->lastname;
+ $donationstatic->firstname = $objp->firstname;
print "".$donationstatic->getNomUrl(1)." ";
- if (! empty($conf->global->DONATION_USE_THIRDPARTIES)) {
- $company=new Societe($db);
- $result=$company->fetch($objp->socid);
- if (!empty($objp->socid) && $company->id > 0) {
+ if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) {
+ $company = new Societe($db);
+ $result = $company->fetch($objp->socid);
+ if (!empty($objp->socid) && $company->id > 0) {
print "".$company->getNomUrl(1)." ";
} else {
print "".$objp->societe." ";
diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php
index 4d04648a3d0..979d4cf2709 100644
--- a/htdocs/ecm/dir_add_card.php
+++ b/htdocs/ecm/dir_add_card.php
@@ -64,7 +64,7 @@ else // For example $module == 'medias'
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php
index 45ef7370681..55aeeda5f90 100644
--- a/htdocs/ecm/dir_card.php
+++ b/htdocs/ecm/dir_card.php
@@ -44,7 +44,7 @@ if (empty($module)) $module='ecm';
// Get parameters
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php
index 3664a2e7f28..4b2d6006c5c 100644
--- a/htdocs/ecm/file_card.php
+++ b/htdocs/ecm/file_card.php
@@ -48,7 +48,7 @@ if ($user->socid > 0)
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index e51efb01aaa..e88417c526a 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -47,7 +47,7 @@ $section_dir=GETPOST('section_dir', 'alpha');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php
index 2fb4e88368a..be3cc7a372c 100644
--- a/htdocs/ecm/index_auto.php
+++ b/htdocs/ecm/index_auto.php
@@ -49,7 +49,7 @@ $search_doc_ref=GETPOST('search_doc_ref', 'alpha');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php
index eb5eeef8c5d..c5c799d82c3 100644
--- a/htdocs/ecm/search.php
+++ b/htdocs/ecm/search.php
@@ -54,7 +54,7 @@ $upload_dir = $conf->ecm->dir_output.'/'.$section;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php
index b6a295949a7..11cf2477720 100644
--- a/htdocs/emailcollector/class/emailcollector.class.php
+++ b/htdocs/emailcollector/class/emailcollector.class.php
@@ -814,7 +814,7 @@ class EmailCollector extends CommonObject
{
//var_dump($regforval[count($regforval)-1]);exit;
// Overwrite param $tmpproperty
- $object->$tmpproperty = isset($regforval[count($regforval)-1]) ?trim($regforval[count($regforval)-1]) : null;
+ $object->$tmpproperty = isset($regforval[count($regforval) - 1]) ?trim($regforval[count($regforval) - 1]) : null;
}
else
{
@@ -1135,7 +1135,7 @@ class EmailCollector extends CommonObject
if (function_exists('imap_mime_header_decode')) {
$elements = imap_mime_header_decode($overview[0]->subject);
$newstring = '';
- if (! empty($elements)) {
+ if (!empty($elements)) {
$num = count($elements);
for ($i = 0; $i < $num; $i++) {
$newstring .= ($newstring ? ' ' : '').$elements[$i]->text;
@@ -1236,13 +1236,14 @@ class EmailCollector extends CommonObject
// References: <1542377954.SMTPs-dolibarr-tic649@8f6014fde11ec6cdec9a822234fc557e>
// References: <1542377954.SMTPs-dolibarr-abc649@8f6014fde11ec6cdec9a822234fc557e>
$trackid = '';
+ $objectid = 0;
+ $objectemail = null;
+
$reg = array();
if (!empty($headers['References']) && preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $headers['References'], $reg))
{
$trackid = $reg[1].$reg[2];
- $objectid = 0;
- $objectemail = null;
if ($reg[1] == 'inv')
{
$objectid = $reg[2];
@@ -1425,7 +1426,7 @@ class EmailCollector extends CommonObject
{
//var_dump($regforval[count($regforval)-1]);exit;
// Overwrite param $tmpproperty
- $nametouseforthirdparty = isset($regforval[count($regforval)-1]) ?trim($regforval[count($regforval)-1]) : null;
+ $nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ?trim($regforval[count($regforval) - 1]) : null;
}
else
{
@@ -1795,10 +1796,10 @@ class EmailCollector extends CommonObject
}
// Create event specific on hook
// this code action is hook..... for support this call
- elseif (substr($operation['type'], 0, 4) == 'hook'){
+ elseif (substr($operation['type'], 0, 4) == 'hook') {
global $hookmanager;
- if(!is_object($hookmanager))
+ if (!is_object($hookmanager))
$hookmanager->initHooks(array('emailcollectorcard'));
$parameters = array(
@@ -1806,24 +1807,24 @@ class EmailCollector extends CommonObject
'imapemail'=>$imapemail,
'overview'=>$overview,
- 'from' => $from ,
+ 'from' => $from,
'fromtext' => $fromtext,
'actionparam'=> $operation['actionparam'],
- 'thirdpartyid' => $thirdpartyid ,
- 'objectid'=>@$objectid,
- 'objectemail'=>@$objectemail,
+ 'thirdpartyid' => $thirdpartyid,
+ 'objectid'=> $objectid,
+ 'objectemail'=> $objectemail,
'messagetext'=>$messagetext,
'subject'=>$subject,
'header'=>$header,
- ) ;
+ );
$res = $hookmanager->executeHooks('doCollectOneCollector', $parameters, $this, $operation['type']);
- if($res < 0 )
+ if ($res < 0)
$this->error = $hookmanager->resPrint;
}
@@ -2046,7 +2047,7 @@ class EmailCollector extends CommonObject
// TEXT
if ($p->type == 0 && $data) {
- if(!empty($params['charset'])) {
+ if (!empty($params['charset'])) {
$data = $this->convertStringEncoding($data, $params['charset']);
}
// Messages may be split in different parts because of inline attachments,
@@ -2064,7 +2065,7 @@ class EmailCollector extends CommonObject
// There are no PHP functions to parse embedded messages,
// so this just appends the raw source to the main message.
elseif ($p->type == 2 && $data) {
- if(!empty($params['charset'])) {
+ if (!empty($params['charset'])) {
$data = $this->convertStringEncoding($data, $params['charset']);
}
$plainmsg .= $data."\n\n";
@@ -2090,14 +2091,14 @@ class EmailCollector extends CommonObject
*/
protected function convertStringEncoding($string, $fromEncoding, $toEncoding = 'UTF-8')
{
- if(!$string || $fromEncoding == $toEncoding) {
+ if (!$string || $fromEncoding == $toEncoding) {
return $string;
}
- $convertedString = function_exists('iconv') ? @iconv($fromEncoding, $toEncoding . '//IGNORE', $string) : null;
- if(!$convertedString && extension_loaded('mbstring')) {
+ $convertedString = function_exists('iconv') ? @iconv($fromEncoding, $toEncoding.'//IGNORE', $string) : null;
+ if (!$convertedString && extension_loaded('mbstring')) {
$convertedString = @mb_convert_encoding($string, $toEncoding, $fromEncoding);
}
- if(!$convertedString) {
+ if (!$convertedString) {
throw new Exception('Mime string encoding conversion failed');
}
return $convertedString;
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index 741b0c09611..b465297fe34 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -1967,7 +1967,7 @@ elseif ($id || $ref)
// Tracking Number
print ' '.$form->editfieldkey("TrackingNumber", 'tracking_number', $object->tracking_number, $object, $user->rights->expedition->creer).' ';
- print $form->editfieldval("TrackingNumber", 'tracking_number', $object->tracking_url, $object, $user->rights->expedition->creer, 'string', $object->tracking_number);
+ print $form->editfieldval("TrackingNumber", 'tracking_number', $object->tracking_url, $object, $user->rights->expedition->creer, 'safehtmlstring', $object->tracking_number);
print ' ';
// Incoterms
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 82d7c942a8d..52540901c33 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -85,6 +85,7 @@ class Expedition extends CommonObject
/**
* @var string internal ref
+ * @deprecated
*/
public $ref_int;
@@ -286,90 +287,90 @@ class Expedition extends CommonObject
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition (";
- $sql.= "ref";
- $sql.= ", entity";
- $sql.= ", ref_customer";
- $sql.= ", ref_int";
- $sql.= ", date_creation";
- $sql.= ", fk_user_author";
- $sql.= ", date_expedition";
- $sql.= ", date_delivery";
- $sql.= ", fk_soc";
- $sql.= ", fk_projet";
- $sql.= ", fk_address";
- $sql.= ", fk_shipping_method";
- $sql.= ", tracking_number";
- $sql.= ", weight";
- $sql.= ", size";
- $sql.= ", width";
- $sql.= ", height";
- $sql.= ", weight_units";
- $sql.= ", size_units";
- $sql.= ", note_private";
- $sql.= ", note_public";
- $sql.= ", model_pdf";
- $sql.= ", fk_incoterms, location_incoterms";
- $sql.= ") VALUES (";
- $sql.= "'(PROV)'";
- $sql.= ", ".$conf->entity;
- $sql.= ", ".($this->ref_customer?"'".$this->db->escape($this->ref_customer)."'":"null");
- $sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null");
- $sql.= ", '".$this->db->idate($now)."'";
- $sql.= ", ".$user->id;
- $sql.= ", ".($this->date_expedition>0?"'".$this->db->idate($this->date_expedition)."'":"null");
- $sql.= ", ".($this->date_delivery>0?"'".$this->db->idate($this->date_delivery)."'":"null");
- $sql.= ", ".$this->socid;
- $sql.= ", ".$this->fk_project;
- $sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:"null");
- $sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:"null");
- $sql.= ", '".$this->db->escape($this->tracking_number)."'";
- $sql.= ", ".$this->weight;
- $sql.= ", ".$this->sizeS; // TODO Should use this->trueDepth
- $sql.= ", ".$this->sizeW; // TODO Should use this->trueWidth
- $sql.= ", ".$this->sizeH; // TODO Should use this->trueHeight
- $sql.= ", ".($this->weight_units != '' ? (int) $this->weight_units : 'NULL');
- $sql.= ", ".($this->size_units != '' ? (int) $this->size_units : 'NULL');
- $sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
- $sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
- $sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null");
- $sql.= ", ".(int) $this->fk_incoterms;
- $sql.= ", '".$this->db->escape($this->location_incoterms)."'";
- $sql.= ")";
+ $sql .= "ref";
+ $sql .= ", entity";
+ $sql .= ", ref_customer";
+ $sql .= ", ref_int";
+ $sql .= ", date_creation";
+ $sql .= ", fk_user_author";
+ $sql .= ", date_expedition";
+ $sql .= ", date_delivery";
+ $sql .= ", fk_soc";
+ $sql .= ", fk_projet";
+ $sql .= ", fk_address";
+ $sql .= ", fk_shipping_method";
+ $sql .= ", tracking_number";
+ $sql .= ", weight";
+ $sql .= ", size";
+ $sql .= ", width";
+ $sql .= ", height";
+ $sql .= ", weight_units";
+ $sql .= ", size_units";
+ $sql .= ", note_private";
+ $sql .= ", note_public";
+ $sql .= ", model_pdf";
+ $sql .= ", fk_incoterms, location_incoterms";
+ $sql .= ") VALUES (";
+ $sql .= "'(PROV)'";
+ $sql .= ", ".$conf->entity;
+ $sql .= ", ".($this->ref_customer ? "'".$this->db->escape($this->ref_customer)."'" : "null");
+ $sql .= ", ".($this->ref_int ? "'".$this->db->escape($this->ref_int)."'" : "null");
+ $sql .= ", '".$this->db->idate($now)."'";
+ $sql .= ", ".$user->id;
+ $sql .= ", ".($this->date_expedition > 0 ? "'".$this->db->idate($this->date_expedition)."'" : "null");
+ $sql .= ", ".($this->date_delivery > 0 ? "'".$this->db->idate($this->date_delivery)."'" : "null");
+ $sql .= ", ".$this->socid;
+ $sql .= ", ".$this->fk_project;
+ $sql .= ", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address : "null");
+ $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : "null");
+ $sql .= ", '".$this->db->escape($this->tracking_number)."'";
+ $sql .= ", ".$this->weight;
+ $sql .= ", ".$this->sizeS; // TODO Should use this->trueDepth
+ $sql .= ", ".$this->sizeW; // TODO Should use this->trueWidth
+ $sql .= ", ".$this->sizeH; // TODO Should use this->trueHeight
+ $sql .= ", ".($this->weight_units != '' ? (int) $this->weight_units : 'NULL');
+ $sql .= ", ".($this->size_units != '' ? (int) $this->size_units : 'NULL');
+ $sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null");
+ $sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null");
+ $sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null");
+ $sql .= ", ".(int) $this->fk_incoterms;
+ $sql .= ", '".$this->db->escape($this->location_incoterms)."'";
+ $sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."expedition");
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition";
- $sql.= " SET ref = '(PROV".$this->id.")'";
- $sql.= " WHERE rowid = ".$this->id;
+ $sql .= " SET ref = '(PROV".$this->id.")'";
+ $sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::create", LOG_DEBUG);
if ($this->db->query($sql))
{
// Insert of lines
- $num=count($this->lines);
+ $num = count($this->lines);
for ($i = 0; $i < $num; $i++)
{
- if (! isset($this->lines[$i]->detail_batch))
+ if (!isset($this->lines[$i]->detail_batch))
{ // no batch management
- if (! $this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) > 0)
+ if (!$this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) > 0)
{
$error++;
}
}
else
{ // with batch management
- if (! $this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) > 0)
+ if (!$this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) > 0)
{
$error++;
}
}
}
- if (! $error && $this->id && $this->origin_id)
+ if (!$error && $this->id && $this->origin_id)
{
$ret = $this->add_object_linked();
if (!$ret)
@@ -523,35 +524,35 @@ class Expedition extends CommonObject
* @param int $id Id of object to load
* @param string $ref Ref of object
* @param string $ref_ext External reference of object
- * @param string $ref_int Internal reference of other object
+ * @param string $notused Internal reference of other object
* @return int >0 if OK, 0 if not found, <0 if KO
*/
- public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
+ public function fetch($id, $ref = '', $ref_ext = '', $notused = '')
{
global $conf;
// Check parameters
- if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
+ if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
$sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet as fk_project, e.billed";
- $sql.= ", e.date_valid";
- $sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
- $sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery";
- $sql.= ", e.fk_shipping_method, e.tracking_number";
- $sql.= ", e.note_private, e.note_public";
- $sql.= ', e.fk_incoterms, e.location_incoterms';
- $sql.= ', i.libelle as label_incoterms';
- $sql.= ', s.libelle as shipping_method';
- $sql.= ", el.fk_source as origin_id, el.sourcetype as origin";
- $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'";
- $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid';
- $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_shipment_mode as s ON e.fk_shipping_method = s.rowid';
- $sql.= " WHERE e.entity IN (".getEntity('expedition').")";
- if ($id) $sql.= " AND e.rowid=".$id;
- if ($ref) $sql.= " AND e.ref='".$this->db->escape($ref)."'";
- if ($ref_ext) $sql.= " AND e.ref_ext='".$this->db->escape($ref_ext)."'";
- if ($ref_int) $sql.= " AND e.ref_int='".$this->db->escape($ref_int)."'";
+ $sql .= ", e.date_valid";
+ $sql .= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
+ $sql .= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery";
+ $sql .= ", e.fk_shipping_method, e.tracking_number";
+ $sql .= ", e.note_private, e.note_public";
+ $sql .= ', e.fk_incoterms, e.location_incoterms';
+ $sql .= ', i.libelle as label_incoterms';
+ $sql .= ', s.libelle as shipping_method';
+ $sql .= ", el.fk_source as origin_id, el.sourcetype as origin";
+ $sql .= " FROM ".MAIN_DB_PREFIX."expedition as e";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'";
+ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid';
+ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_shipment_mode as s ON e.fk_shipping_method = s.rowid';
+ $sql .= " WHERE e.entity IN (".getEntity('expedition').")";
+ if ($id) $sql .= " AND e.rowid=".$id;
+ if ($ref) $sql .= " AND e.ref='".$this->db->escape($ref)."'";
+ if ($ref_ext) $sql .= " AND e.ref_ext='".$this->db->escape($ref_ext)."'";
+ if ($notused) $sql .= " AND e.ref_int='".$this->db->escape($notused)."'";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);
@@ -564,26 +565,26 @@ class Expedition extends CommonObject
$this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->socid = $obj->socid;
- $this->ref_customer = $obj->ref_customer;
+ $this->ref_customer = $obj->ref_customer;
$this->ref_ext = $obj->ref_ext;
$this->ref_int = $obj->ref_int;
$this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->date_creation = $this->db->jdate($obj->date_creation);
- $this->date_valid = $this->db->jdate($obj->date_valid);
- $this->date = $this->db->jdate($obj->date_expedition); // TODO deprecated
- $this->date_expedition = $this->db->jdate($obj->date_expedition); // TODO deprecated
- $this->date_shipping = $this->db->jdate($obj->date_expedition); // Date real
- $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed
+ $this->date_valid = $this->db->jdate($obj->date_valid);
+ $this->date = $this->db->jdate($obj->date_expedition); // TODO deprecated
+ $this->date_expedition = $this->db->jdate($obj->date_expedition); // TODO deprecated
+ $this->date_shipping = $this->db->jdate($obj->date_expedition); // Date real
+ $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed
$this->fk_delivery_address = $obj->fk_address;
$this->modelpdf = $obj->model_pdf;
$this->shipping_method_id = $obj->fk_shipping_method;
- $this->shipping_method = $obj->shipping_method;
+ $this->shipping_method = $obj->shipping_method;
$this->tracking_number = $obj->tracking_number;
- $this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility
+ $this->origin = ($obj->origin ? $obj->origin : 'commande'); // For compatibility
$this->origin_id = $obj->origin_id;
$this->billed = $obj->billed;
- $this->fk_project = $obj->fk_project;
+ $this->fk_project = $obj->fk_project;
$this->trueWeight = $obj->weight;
$this->weight_units = $obj->weight_units;
@@ -762,7 +763,7 @@ class Expedition extends CommonObject
// line without batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
- $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr", $numref));
+ $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr", $numref));
if ($result < 0) {
$error++;
$this->error = $mouvS->error;
@@ -776,7 +777,7 @@ class Expedition extends CommonObject
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
// Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version)
- $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr", $numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
+ $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr", $numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
if ($result < 0) {
$error++;
$this->error = $mouvS->error;
@@ -818,17 +819,17 @@ class Expedition extends CommonObject
if (preg_match('/^[\(]?PROV/i', $this->ref))
{
// Now we rename also files into index
- $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'expedition/sending/".$this->db->escape($this->newref)."'";
- $sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'expedition/sending/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
+ $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'expedition/sending/".$this->db->escape($this->newref)."'";
+ $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'expedition/sending/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
- if (! $resql) { $error++; $this->error = $this->db->lasterror(); }
+ if (!$resql) { $error++; $this->error = $this->db->lasterror(); }
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
$oldref = dol_sanitizeFileName($this->ref);
$newref = dol_sanitizeFileName($numref);
$dirsource = $conf->expedition->dir_output.'/sending/'.$oldref;
$dirdest = $conf->expedition->dir_output.'/sending/'.$newref;
- if (! $error && file_exists($dirsource))
+ if (!$error && file_exists($dirsource))
{
dol_syslog(get_class($this)."::valid rename dir ".$dirsource." into ".$dirdest);
@@ -851,13 +852,13 @@ class Expedition extends CommonObject
}
// Set new ref and current status
- if (! $error)
+ if (!$error)
{
$this->ref = $numref;
$this->statut = self::STATUS_VALIDATED;
}
- if (! $error)
+ if (!$error)
{
$this->db->commit();
return 1;
@@ -865,7 +866,7 @@ class Expedition extends CommonObject
else
{
$this->db->rollback();
- return -1*$error;
+ return -1 * $error;
}
}
@@ -1172,32 +1173,32 @@ class Expedition extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
- $error=0;
- $this->error='';
+ $error = 0;
+ $this->error = '';
$this->db->begin();
// Add a protection to refuse deleting if shipment has at least one delivery
- $this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment
+ $this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment
if (count($this->linkedObjectsIds) > 0)
{
- $this->error='ErrorThereIsSomeDeliveries';
+ $this->error = 'ErrorThereIsSomeDeliveries';
$error++;
}
- if (! $error)
+ if (!$error)
{
- if (! $notrigger)
+ if (!$notrigger)
{
// Call trigger
- $result=$this->call_trigger('SHIPPING_DELETE', $user);
+ $result = $this->call_trigger('SHIPPING_DELETE', $user);
if ($result < 0) { $error++; }
// End call triggers
}
}
// Stock control
- if (! $error && $conf->stock->enabled &&
+ if (!$error && $conf->stock->enabled &&
(($conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT) ||
($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE && $this->statut == self::STATUS_CLOSED && $also_update_stock)))
{
@@ -1386,20 +1387,20 @@ class Expedition extends CommonObject
// phpcs:enable
global $conf, $mysoc;
// TODO: recuperer les champs du document associe a part
- $this->lines=array();
+ $this->lines = array();
$sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type";
- $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
- $sql.= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.info_bits, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
- $sql.= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc, cd.rang";
- $sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
- $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
- $sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
- $sql.= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product";
- $sql.= " WHERE ed.fk_expedition = ".$this->id;
- $sql.= " AND ed.fk_origin_line = cd.rowid";
- $sql.= " ORDER BY cd.rang, ed.fk_origin_line";
+ $sql .= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
+ $sql .= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.info_bits, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
+ $sql .= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc, cd.rang";
+ $sql .= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
+ $sql .= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
+ $sql .= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
+ $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product";
+ $sql .= " WHERE ed.fk_expedition = ".$this->id;
+ $sql .= " AND ed.fk_origin_line = cd.rowid";
+ $sql .= " ORDER BY cd.rang, ed.fk_origin_line";
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -1460,7 +1461,7 @@ class Expedition extends CommonObject
$line->label = $obj->custom_label;
$line->description = $obj->description;
$line->qty_asked = $obj->qty_asked;
- $line->rang = $obj->rang;
+ $line->rang = $obj->rang;
$line->weight = $obj->weight;
$line->weight_units = $obj->weight_units;
$line->length = $obj->length;
@@ -1749,23 +1750,23 @@ class Expedition extends CommonObject
$this->origin_id = 1;
$this->origin = 'commande';
- $this->note_private = 'Private note';
- $this->note_public = 'Public note';
+ $this->note_private = 'Private note';
+ $this->note_public = 'Public note';
$nbp = 5;
$xnbp = 0;
while ($xnbp < $nbp)
{
- $line=new ExpeditionLigne($this->db);
- $line->desc=$langs->trans("Description")." ".$xnbp;
- $line->libelle=$langs->trans("Description")." ".$xnbp; // deprecated
- $line->label=$langs->trans("Description")." ".$xnbp;
- $line->qty=10;
- $line->qty_asked=5;
- $line->qty_shipped=4;
- $line->fk_product=$this->commande->lines[$xnbp]->fk_product;
+ $line = new ExpeditionLigne($this->db);
+ $line->desc = $langs->trans("Description")." ".$xnbp;
+ $line->libelle = $langs->trans("Description")." ".$xnbp; // deprecated
+ $line->label = $langs->trans("Description")." ".$xnbp;
+ $line->qty = 10;
+ $line->qty_asked = 5;
+ $line->qty_shipped = 4;
+ $line->fk_product = $this->commande->lines[$xnbp]->fk_product;
- $this->lines[]=$line;
+ $this->lines[] = $line;
$xnbp++;
}
}
@@ -1819,17 +1820,17 @@ class Expedition extends CommonObject
$this->meths = array();
$sql = "SELECT em.rowid, em.code, em.libelle as label";
- $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
- $sql.= " WHERE em.active = 1";
- $sql.= " ORDER BY em.libelle ASC";
+ $sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
+ $sql .= " WHERE em.active = 1";
+ $sql .= " ORDER BY em.libelle ASC";
$resql = $this->db->query($sql);
if ($resql)
{
while ($obj = $this->db->fetch_object($resql))
{
- $label=$langs->trans('SendingMethod'.$obj->code);
- $this->meths[$obj->rowid] = ($label != 'SendingMethod'.$obj->code?$label:$obj->label);
+ $label = $langs->trans('SendingMethod'.$obj->code);
+ $this->meths[$obj->rowid] = ($label != 'SendingMethod'.$obj->code ? $label : $obj->label);
}
}
}
@@ -1847,11 +1848,11 @@ class Expedition extends CommonObject
global $langs;
$this->listmeths = array();
- $i=0;
+ $i = 0;
$sql = "SELECT em.rowid, em.code, em.libelle as label, em.description, em.tracking, em.active";
- $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
- if ($id!='') $sql.= " WHERE em.rowid=".$id;
+ $sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
+ if ($id != '') $sql .= " WHERE em.rowid=".$id;
$resql = $this->db->query($sql);
if ($resql)
@@ -1860,8 +1861,8 @@ class Expedition extends CommonObject
{
$this->listmeths[$i]['rowid'] = $obj->rowid;
$this->listmeths[$i]['code'] = $obj->code;
- $label=$langs->trans('SendingMethod'.$obj->code);
- $this->listmeths[$i]['libelle'] = ($label != 'SendingMethod'.$obj->code?$label:$obj->label);
+ $label = $langs->trans('SendingMethod'.$obj->code);
+ $this->listmeths[$i]['libelle'] = ($label != 'SendingMethod'.$obj->code ? $label : $obj->label);
$this->listmeths[$i]['description'] = $obj->description;
$this->listmeths[$i]['tracking'] = $obj->tracking;
$this->listmeths[$i]['active'] = $obj->active;
@@ -2315,16 +2316,16 @@ class Expedition extends CommonObject
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{
- global $conf,$langs;
+ global $conf, $langs;
$langs->load("sendings");
- if (! dol_strlen($modele)) {
+ if (!dol_strlen($modele)) {
$modele = 'rouget';
if ($this->modelpdf) {
$modele = $this->modelpdf;
- } elseif (! empty($conf->global->EXPEDITION_ADDON_PDF)) {
+ } elseif (!empty($conf->global->EXPEDITION_ADDON_PDF)) {
$modele = $conf->global->EXPEDITION_ADDON_PDF;
}
}
@@ -2566,10 +2567,10 @@ class ExpeditionLigne extends CommonObjectLine
{
global $langs, $conf;
- $error=0;
+ $error = 0;
// Check parameters
- if (empty($this->fk_expedition) || empty($this->fk_origin_line) || ! is_numeric($this->qty))
+ if (empty($this->fk_expedition) || empty($this->fk_origin_line) || !is_numeric($this->qty))
{
$this->error = 'ErrorMandatoryParametersNotProvided';
return -1;
@@ -2588,18 +2589,18 @@ class ExpeditionLigne extends CommonObjectLine
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expeditiondet (";
- $sql.= "fk_expedition";
- $sql.= ", fk_entrepot";
- $sql.= ", fk_origin_line";
- $sql.= ", qty";
- $sql.= ", rang";
- $sql.= ") VALUES (";
- $sql.= $this->fk_expedition;
- $sql.= ", ".(empty($this->entrepot_id) ? 'NULL' : $this->entrepot_id);
- $sql.= ", ".$this->fk_origin_line;
- $sql.= ", ".$this->qty;
- $sql.= ", ".$ranktouse;
- $sql.= ")";
+ $sql .= "fk_expedition";
+ $sql .= ", fk_entrepot";
+ $sql .= ", fk_origin_line";
+ $sql .= ", qty";
+ $sql .= ", rang";
+ $sql .= ") VALUES (";
+ $sql .= $this->fk_expedition;
+ $sql .= ", ".(empty($this->entrepot_id) ? 'NULL' : $this->entrepot_id);
+ $sql .= ", ".$this->fk_origin_line;
+ $sql .= ", ".$this->qty;
+ $sql .= ", ".$ranktouse;
+ $sql .= ")";
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php
index ab83142cc4b..65786dfbdae 100644
--- a/htdocs/expedition/document.php
+++ b/htdocs/expedition/document.php
@@ -55,7 +55,7 @@ $result = restrictedArea($user, 'expedition', $id, '');
// Get parameters
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index f7ff3565e10..5122ac5897e 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -69,7 +69,7 @@ $optioncss = GETPOST('optioncss', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (!$sortfield) $sortfield = "e.ref";
if (!$sortorder) $sortorder = "DESC";
if (empty($page) || $page == -1 || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 79e418206a5..77c2cf07f8e 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -2029,7 +2029,8 @@ else
$paymentexpensereportstatic->id = $objp->rowid;
$paymentexpensereportstatic->datepaye = $db->jdate($objp->dp);
$paymentexpensereportstatic->ref = $objp->rowid;
- $paymentexpensereportstatic->num_paiement = $objp->num_paiement;
+ $paymentexpensereportstatic->num_paiement = $objp->num_payment;
+ $paymentexpensereportstatic->num_payment = $objp->num_payment;
$paymentexpensereportstatic->payment_code = $objp->payment_code;
print '';
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 88238506125..d78ac9e6261 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -1015,7 +1015,9 @@ class ExpenseReport extends CommonObject
public function fetch_lines()
{
// phpcs:enable
- $this->lines = array();
+ global $conf;
+
+ $this->lines = array();
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,';
$sql .= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project, de.tva_tx, de.fk_ecm_files,';
diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php
index 48461eec8bf..25018653acb 100644
--- a/htdocs/expensereport/document.php
+++ b/htdocs/expensereport/document.php
@@ -50,7 +50,7 @@ $result = restrictedArea($user, 'expensereport', $id, 'expensereport');
// Get parameters
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php
index ec6f78d91f7..945c2387dc5 100644
--- a/htdocs/expensereport/index.php
+++ b/htdocs/expensereport/index.php
@@ -47,7 +47,7 @@ $result = restrictedArea($user, 'expensereport', '', '');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
@@ -136,10 +136,10 @@ if ($conf->use_javascript_ajax)
$dolgraph->SetData($dataseries);
$dolgraph->setHeight(350);
$dolgraph->combine = empty($conf->global->MAIN_EXPENSEREPORT_COMBINE_GRAPH_STAT) ? 0.05 : $conf->global->MAIN_EXPENSEREPORT_COMBINE_GRAPH_STAT;
- $dolgraph->setShowLegend(1);
+ $dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
- $dolgraph->setWidth('100%');
+ $dolgraph->setHeight('200');
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($totalnb ? 0 : 1);
diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php
index 5604ee77dc3..7689c5e172f 100644
--- a/htdocs/expensereport/list.php
+++ b/htdocs/expensereport/list.php
@@ -76,7 +76,7 @@ $diroutputmassaction = $conf->expensereport->dir_output.'/temp/massgeneration/'.
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php
index 2f915b3f8e8..872bd5a0792 100644
--- a/htdocs/expensereport/payment/payment.php
+++ b/htdocs/expensereport/payment/payment.php
@@ -31,14 +31,14 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page
$langs->loadLangs(array('bills', 'banks', 'trips'));
-$id=GETPOST("id", 'int');
-$ref=GETPOST('ref', 'alpha');
-$action=GETPOST('action', 'aZ09');
+$id = GETPOST("id", 'int');
+$ref = GETPOST('ref', 'alpha');
+$action = GETPOST('action', 'aZ09');
$amounts = array();
-$accountid=GETPOST('accountid', 'int');
+$accountid = GETPOST('accountid', 'int');
// Security check
-$socid=0;
+$socid = 0;
if ($user->socid > 0)
{
$socid = $user->socid;
@@ -51,7 +51,7 @@ if ($user->socid > 0)
if ($action == 'add_payment')
{
- $error=0;
+ $error = 0;
if ($_POST["cancel"])
{
@@ -62,7 +62,7 @@ if ($action == 'add_payment')
$expensereport = new ExpenseReport($db);
$result = $expensereport->fetch($id, $ref);
- if (! $result)
+ if (!$result)
{
$error++;
setEventMessages($expensereport->error, $expensereport->errors, 'errors');
@@ -70,7 +70,7 @@ if ($action == 'add_payment')
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
- if (! ($_POST["fk_typepayment"] > 0))
+ if (!($_POST["fk_typepayment"] > 0))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors');
$error++;
@@ -80,13 +80,13 @@ if ($action == 'add_payment')
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
$error++;
}
- if (! empty($conf->banque->enabled) && ! ($accountid > 0))
+ if (!empty($conf->banque->enabled) && !($accountid > 0))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToDebit")), null, 'errors');
$error++;
}
- if (! $error)
+ if (!$error)
{
$paymentid = 0;
$total = 0;
@@ -104,10 +104,10 @@ if ($action == 'add_payment')
if (count($amounts) <= 0)
{
$error++;
- $errmsg='ErrorNoPaymentDefined';
+ $errmsg = 'ErrorNoPaymentDefined';
}
- if (! $error)
+ if (!$error)
{
$db->begin();
@@ -115,13 +115,13 @@ if ($action == 'add_payment')
$payment = new PaymentExpenseReport($db);
$payment->fk_expensereport = $expensereport->id;
$payment->datepaid = $datepaid;
- $payment->amounts = $amounts; // Tableau de montant
+ $payment->amounts = $amounts; // Tableau de montant
$payment->total = $total;
$payment->fk_typepayment = GETPOST("fk_typepayment", 'int');
$payment->num_payment = GETPOST("num_payment", 'alphanothtml');
$payment->note_public = GETPOST("note_public", 'none');
- if (! $error)
+ if (!$error)
{
$paymentid = $payment->create($user);
if ($paymentid < 0)
@@ -131,10 +131,10 @@ if ($action == 'add_payment')
}
}
- if (! $error)
+ if (!$error)
{
- $result=$payment->addPaymentToBank($user, 'payment_expensereport', '(ExpenseReportPayment)', $accountid, '', '');
- if (! $result > 0)
+ $result = $payment->addPaymentToBank($user, 'payment_expensereport', '(ExpenseReportPayment)', $accountid, '', '');
+ if (!$result > 0)
{
setEventMessages($payment->error, $payment->errors, 'errors');
$error++;
@@ -152,7 +152,7 @@ if ($action == 'add_payment')
}
}
- if (! $error)
+ if (!$error)
{
$db->commit();
$loc = DOL_URL_ROOT.'/expensereport/card.php?id='.$id;
@@ -166,7 +166,7 @@ if ($action == 'add_payment')
}
}
- $action='create';
+ $action = 'create';
}
@@ -176,7 +176,7 @@ if ($action == 'add_payment')
llxHeader();
-$form=new Form($db);
+$form = new Form($db);
// Form to create expense report payment
@@ -188,7 +188,7 @@ if ($action == 'create' || empty($action))
$total = $expensereport->total_ttc;
// autofill remainder amount
- if (! empty($conf->use_javascript_ajax)) {
+ if (!empty($conf->use_javascript_ajax)) {
print "\n".'';
}
- print ' '.$langs->trans("AddThirdParty").' ';
+ print ' ';
}
print '';
@@ -1661,8 +1661,8 @@ if ($action == 'create')
$langs->load('projects');
print ' '.$langs->trans('Project').' ';
- $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
- print ' id).'">'.$langs->trans("AddProject").' ';
+ $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500');
+ print ' id).'"> ';
print ' ';
}
diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php
index 203ee0be5df..0d8924b8fc5 100644
--- a/htdocs/fourn/commande/document.php
+++ b/htdocs/fourn/commande/document.php
@@ -53,7 +53,7 @@ $result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'com
// Get parameters
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php
index 45abd70e0be..25c4868fd5e 100644
--- a/htdocs/fourn/commande/index.php
+++ b/htdocs/fourn/commande/index.php
@@ -137,10 +137,10 @@ if ($resql)
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
- $dolgraph->setShowLegend(1);
+ $dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
- $dolgraph->setWidth('100%');
+ $dolgraph->setHeight('200');
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($total ? 0 : 1);
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 78cb4ecf7c7..d7836d47d86 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -104,7 +104,7 @@ $diroutputmassaction = $conf->fournisseur->commande->dir_output.'/temp/massgener
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
@@ -436,14 +436,14 @@ if (empty($reshook))
// Fac builddoc
$donotredirect = 1;
$upload_dir = $conf->facture->dir_output;
- $permissiontoadd=$user->rights->facture->creer;
+ $permissiontoadd = $user->rights->facture->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
}
$massaction = $action = 'confirm_createbills';
}
- if (! $error)
+ if (!$error)
{
$db->commit();
setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs');
@@ -559,7 +559,7 @@ if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.eleme
if ($search_total_ht != '') $sql .= natural_search('cf.total_ht', $search_total_ht, 1);
if ($search_total_vat != '') $sql .= natural_search('cf.tva', $search_total_vat, 1);
if ($search_total_ttc != '') $sql .= natural_search('cf.total_ttc', $search_total_ttc, 1);
-if ($search_multicurrency_code != '') $sql .= ' AND cf.multicurrency_code = "' . $db->escape($search_multicurrency_code) . '"';
+if ($search_multicurrency_code != '') $sql .= ' AND cf.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
if ($search_multicurrency_tx != '') $sql .= natural_search('cf.multicurrency_tx', $search_multicurrency_tx, 1);
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('cf.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('cf.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
@@ -1064,98 +1064,98 @@ if ($resql)
$thirdpartytmp->email = $obj->email;
print $thirdpartytmp->getNomUrl(1, 'supplier');
print ''."\n";
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Town
- if (! empty($arrayfields['s.town']['checked']))
+ if (!empty($arrayfields['s.town']['checked']))
{
print '';
print $obj->town;
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Zip
- if (! empty($arrayfields['s.zip']['checked']))
+ if (!empty($arrayfields['s.zip']['checked']))
{
print '';
print $obj->zip;
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// State
- if (! empty($arrayfields['state.nom']['checked']))
+ if (!empty($arrayfields['state.nom']['checked']))
{
print "".$obj->state_name." \n";
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Country
- if (! empty($arrayfields['country.code_iso']['checked']))
+ if (!empty($arrayfields['country.code_iso']['checked']))
{
print '';
- $tmparray=getCountry($obj->fk_pays, 'all');
+ $tmparray = getCountry($obj->fk_pays, 'all');
print $tmparray['label'];
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Type ent
- if (! empty($arrayfields['typent.code']['checked']))
+ if (!empty($arrayfields['typent.code']['checked']))
{
print '';
- if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
+ if (count($typenArray) == 0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code];
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Order date
- if (! empty($arrayfields['cf.date_commande']['checked']))
+ if (!empty($arrayfields['cf.date_commande']['checked']))
{
print '';
if ($obj->date_commande) print dol_print_date($db->jdate($obj->date_commande), 'day');
else print '';
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Plannned date of delivery
- if (! empty($arrayfields['cf.date_delivery']['checked']))
+ if (!empty($arrayfields['cf.date_delivery']['checked']))
{
print '';
print dol_print_date($db->jdate($obj->date_delivery), 'day');
- if ($objectstatic->hasDelay() && ! empty($objectstatic->date_delivery)) {
+ if ($objectstatic->hasDelay() && !empty($objectstatic->date_delivery)) {
print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning");
}
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Amount HT
- if (! empty($arrayfields['cf.total_ht']['checked']))
+ if (!empty($arrayfields['cf.total_ht']['checked']))
{
print ''.price($obj->total_ht)." \n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cf.total_ht';
+ if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_ht';
$totalarray['val']['cf.total_ht'] += $obj->total_ht;
}
// Amount VAT
- if (! empty($arrayfields['cf.total_vat']['checked']))
+ if (!empty($arrayfields['cf.total_vat']['checked']))
{
print ''.price($obj->total_tva)." \n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cf.total_vat';
+ if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_vat';
$totalarray['val']['cf.total_vat'] += $obj->total_tva;
}
// Amount TTC
- if (! empty($arrayfields['cf.total_ttc']['checked']))
+ if (!empty($arrayfields['cf.total_ttc']['checked']))
{
print ''.price($obj->total_ttc)." \n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cf.total_ttc';
+ if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_ttc';
$totalarray['val']['cf.total_ttc'] += $obj->total_ttc;
}
// Currency
if (!empty($arrayfields['cf.multicurrency_code']['checked']))
{
- print ''.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)." \n";
+ print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)." \n";
if (!$i) $totalarray['nbfield']++;
}
@@ -1163,7 +1163,7 @@ if ($resql)
if (!empty($arrayfields['cf.multicurrency_tx']['checked']))
{
print '';
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
print " \n";
if (!$i) $totalarray['nbfield']++;
}
@@ -1189,48 +1189,48 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
- $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
- $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
+ $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
+ $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
- if (! empty($arrayfields['cf.datec']['checked']))
+ if (!empty($arrayfields['cf.datec']['checked']))
{
print '';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Date modification
- if (! empty($arrayfields['cf.tms']['checked']))
+ if (!empty($arrayfields['cf.tms']['checked']))
{
print '';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Status
- if (! empty($arrayfields['cf.fk_statut']['checked']))
+ if (!empty($arrayfields['cf.fk_statut']['checked']))
{
print ''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Billed
- if (! empty($arrayfields['cf.billed']['checked']))
+ if (!empty($arrayfields['cf.billed']['checked']))
{
print ''.yn($obj->billed).' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Action column
print '';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
- $selected=0;
- if (in_array($obj->rowid, $arrayofselected)) $selected=1;
- print ' ';
+ $selected = 0;
+ if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
+ print ' ';
}
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
print "\n";
$i++;
diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php
index 35d21ab04f3..06e7f09edd7 100644
--- a/htdocs/fourn/contact.php
+++ b/htdocs/fourn/contact.php
@@ -43,7 +43,7 @@ if ($user->socid > 0)
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index f901500cc6f..329ee266362 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -1807,7 +1807,7 @@ if ($action == 'create')
});
';
}
- print ' '.$langs->trans("AddThirdParty").' ';
+ print ' ';
}
print '';
diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index 2c409b08ea7..3a05c0bed97 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -52,7 +52,7 @@ $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
// Get parameters
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php
index 4d6e85006c3..cdcdcff23c3 100644
--- a/htdocs/fourn/facture/impayees.php
+++ b/htdocs/fourn/facture/impayees.php
@@ -54,7 +54,7 @@ $search_company = GETPOST('search_company', 'alpha');
$search_amount_no_tax = GETPOST('search_amount_no_tax', 'alpha');
$search_amount_all_tax = GETPOST('search_amount_all_tax', 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 48d56d8e502..7be2c5e9b26 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -102,7 +102,7 @@ $day = GETPOST('day', 'int');
$month = GETPOST('month', 'int');
$year = GETPOST('year', 'int');
$day_lim = GETPOST('day_lim', 'int');
-$month_lim = GETPOST('month_lim', 'int');
+$month_lim = GETPOST('month_lim', 'int');
$year_lim = GETPOST('year_lim', 'int');
$toselect = GETPOST('toselect', 'array');
$search_btn = GETPOST('button_search', 'alpha');
@@ -117,7 +117,7 @@ $filter = GETPOST('filtre', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if ($page == -1 || $page == null || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
@@ -213,52 +213,52 @@ if (empty($reshook))
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha')) // All tests must be present to be compatible with all browsers
{
- $search_all="";
- $search_user='';
- $search_sale='';
- $search_product_category='';
- $search_ref="";
- $search_refsupplier="";
- $search_type="";
- $search_label="";
- $search_project='';
- $search_company="";
- $search_amount_no_tax="";
- $search_amount_all_tax="";
- $search_montant_ht='';
- $search_montant_vat='';
- $search_montant_localtax1='';
- $search_montant_localtax2='';
- $search_montant_ttc='';
+ $search_all = "";
+ $search_user = '';
+ $search_sale = '';
+ $search_product_category = '';
+ $search_ref = "";
+ $search_refsupplier = "";
+ $search_type = "";
+ $search_label = "";
+ $search_project = '';
+ $search_company = "";
+ $search_amount_no_tax = "";
+ $search_amount_all_tax = "";
+ $search_montant_ht = '';
+ $search_montant_vat = '';
+ $search_montant_localtax1 = '';
+ $search_montant_localtax2 = '';
+ $search_montant_ttc = '';
$search_multicurrency_code = '';
$search_multicurrency_tx = '';
$search_multicurrency_montant_ht = '';
$search_multicurrency_montant_vat = '';
$search_multicurrency_montant_ttc = '';
- $search_status='';
- $search_paymentmode='';
- $search_town='';
- $search_zip="";
- $search_state="";
- $search_type='';
- $search_country='';
- $search_type_thirdparty='';
- $year="";
- $month="";
- $day="";
- $year_lim="";
- $month_lim="";
- $day_lim="";
- $toselect='';
- $search_array_options=array();
- $filter='';
- $option='';
- $socid="";
+ $search_status = '';
+ $search_paymentmode = '';
+ $search_town = '';
+ $search_zip = "";
+ $search_state = "";
+ $search_type = '';
+ $search_country = '';
+ $search_type_thirdparty = '';
+ $year = "";
+ $month = "";
+ $day = "";
+ $year_lim = "";
+ $month_lim = "";
+ $day_lim = "";
+ $toselect = '';
+ $search_array_options = array();
+ $filter = '';
+ $option = '';
+ $socid = "";
}
// Mass actions
- $objectclass='FactureFournisseur';
- $objectlabel='SupplierInvoices';
+ $objectclass = 'FactureFournisseur';
+ $objectlabel = 'SupplierInvoices';
$permissiontoread = $user->rights->fournisseur->facture->lire;
$permissiontoadd = $user->rights->fournisseur->facture->creer;
$permissiontodelete = $user->rights->fournisseur->facture->supprimer;
@@ -354,7 +354,7 @@ if ($search_montant_vat != '') $sql .= natural_search('f.total_tva', $search_mon
if ($search_montant_localtax1 != '') $sql .= natural_search('f.localtax1', $search_montant_localtax1, 1);
if ($search_montant_localtax2 != '') $sql .= natural_search('f.localtax2', $search_montant_localtax2, 1);
if ($search_montant_ttc != '') $sql .= natural_search('f.total_ttc', $search_montant_ttc, 1);
-if ($search_multicurrency_code != '') $sql .= ' AND f.multicurrency_code = "' . $db->escape($search_multicurrency_code) . '"';
+if ($search_multicurrency_code != '') $sql .= ' AND f.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
if ($search_multicurrency_tx != '') $sql .= natural_search('f.multicurrency_tx', $search_multicurrency_tx, 1);
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
@@ -1014,143 +1014,143 @@ if ($resql)
print img_warning($langs->trans('Late'));
}
print '';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Project
- if (! empty($arrayfields['p.ref']['checked']))
+ if (!empty($arrayfields['p.ref']['checked']))
{
print '';
if ($obj->project_id > 0)
{
- $projectstatic->id=$obj->project_id;
- $projectstatic->ref=$obj->project_ref;
- $projectstatic->title=$obj->project_label;
+ $projectstatic->id = $obj->project_id;
+ $projectstatic->ref = $obj->project_ref;
+ $projectstatic->title = $obj->project_label;
print $projectstatic->getNomUrl(1);
}
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Third party
- if (! empty($arrayfields['s.nom']['checked']))
+ if (!empty($arrayfields['s.nom']['checked']))
{
print '';
print $thirdparty->getNomUrl(1, 'supplier');
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Town
- if (! empty($arrayfields['s.town']['checked']))
+ if (!empty($arrayfields['s.town']['checked']))
{
print '';
print $obj->town;
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Zip
- if (! empty($arrayfields['s.zip']['checked']))
+ if (!empty($arrayfields['s.zip']['checked']))
{
print '';
print $obj->zip;
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// State
- if (! empty($arrayfields['state.nom']['checked']))
+ if (!empty($arrayfields['state.nom']['checked']))
{
print "".$obj->state_name." \n";
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Country
- if (! empty($arrayfields['country.code_iso']['checked']))
+ if (!empty($arrayfields['country.code_iso']['checked']))
{
print '';
- $tmparray=getCountry($obj->fk_pays, 'all');
+ $tmparray = getCountry($obj->fk_pays, 'all');
print $tmparray['label'];
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Type ent
- if (! empty($arrayfields['typent.code']['checked']))
+ if (!empty($arrayfields['typent.code']['checked']))
{
print '';
- if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
+ if (count($typenArray) == 0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code];
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Payment mode
- if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
+ if (!empty($arrayfields['f.fk_mode_reglement']['checked']))
{
print '';
$form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1);
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Amount HT
- if (! empty($arrayfields['f.total_ht']['checked']))
+ if (!empty($arrayfields['f.total_ht']['checked']))
{
print ''.price($obj->total_ht)." \n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ht';
+ if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht';
$totalarray['val']['f.total_ht'] += $obj->total_ht;
}
// Amount VAT
- if (! empty($arrayfields['f.total_vat']['checked']))
+ if (!empty($arrayfields['f.total_vat']['checked']))
{
print ''.price($obj->total_vat)." \n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_vat';
+ if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_vat';
$totalarray['val']['f.total_vat'] += $obj->total_vat;
}
// Amount LocalTax1
- if (! empty($arrayfields['f.total_localtax1']['checked']))
+ if (!empty($arrayfields['f.total_localtax1']['checked']))
{
print ''.price($obj->total_localtax1)." \n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_localtax1';
+ if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax1';
$totalarray['val']['f.total_localtax1'] += $obj->total_localtax1;
}
// Amount LocalTax2
- if (! empty($arrayfields['f.total_localtax2']['checked']))
+ if (!empty($arrayfields['f.total_localtax2']['checked']))
{
print ''.price($obj->total_localtax2)." \n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_localtax2';
+ if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax2';
$totalarray['val']['f.total_localtax2'] += $obj->total_localtax2;
}
// Amount TTC
- if (! empty($arrayfields['f.total_ttc']['checked']))
+ if (!empty($arrayfields['f.total_ttc']['checked']))
{
print ''.price($obj->total_ttc)." \n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ttc';
+ if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc';
$totalarray['val']['f.total_ttc'] += $obj->total_ttc;
}
- if (! empty($arrayfields['dynamount_payed']['checked']))
+ if (!empty($arrayfields['dynamount_payed']['checked']))
{
- print ''.(! empty($totalpay)?price($totalpay, 0, $langs):' ').' '; // TODO Use a denormalized field
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalam';
+ print ''.(!empty($totalpay) ?price($totalpay, 0, $langs) : ' ').' '; // TODO Use a denormalized field
+ if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalam';
$totalarray['val']['totalam'] += $totalpay;
}
- if (! empty($arrayfields['rtp']['checked']))
+ if (!empty($arrayfields['rtp']['checked']))
{
- print ''.(! empty($remaintopay)?price($remaintopay, 0, $langs):' ').' '; // TODO Use a denormalized field
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='rtp';
+ print ''.(!empty($remaintopay) ?price($remaintopay, 0, $langs) : ' ').' '; // TODO Use a denormalized field
+ if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'rtp';
$totalarray['val']['rtp'] += $remaintopay;
}
// Currency
if (!empty($arrayfields['f.multicurrency_code']['checked']))
{
- print ''.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)." \n";
+ print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)." \n";
if (!$i) $totalarray['nbfield']++;
}
@@ -1158,7 +1158,7 @@ if ($resql)
if (!empty($arrayfields['f.multicurrency_tx']['checked']))
{
print '';
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
print " \n";
if (!$i) $totalarray['nbfield']++;
}
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index 1b6f8257977..f45160b427e 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -62,7 +62,7 @@ $search_payment_num = GETPOST('search_payment_num', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
@@ -299,10 +299,12 @@ if (empty($reshook))
$paiement->multicurrency_amounts = $multicurrency_amounts;
$paiement->paiementid = GETPOST('paiementid', 'int');
- $paiement->num_payment = GETPOST('num_paiement', 'alpha');
+ $paiement->num_payment = GETPOST('num_paiement', 'alphanohtml');
$paiement->note_private = GETPOST('comment', 'alpha');
- $paiement->num_paiement = $paiement->num_payment; // For bacward compatibility
- $paiement->note = $paiement->note_private; // For bacward compatibility
+ $paiement->num_paiement = $paiement->num_payment; // For backward compatibility
+ $paiement->num_payment = $paiement->num_payment;
+ $paiement->note = $paiement->note_private; // For backward compatibility
+ $paiement->note_private = $paiement->note_private;
if (!$error)
{
@@ -812,7 +814,7 @@ if (empty($action) || $action == 'list')
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
- $page = GETPOST("page", 'int');
+ $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php
index 6f46e0823ca..5e83ae93923 100644
--- a/htdocs/fourn/product/list.php
+++ b/htdocs/fourn/product/list.php
@@ -45,7 +45,7 @@ $optioncss = GETPOST('optioncss', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php
index a421926387d..2d8efadc472 100644
--- a/htdocs/ftp/index.php
+++ b/htdocs/ftp/index.php
@@ -49,7 +49,7 @@ $download_dir = $conf->ftp->dir_temp;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php
index fc91e86fbb8..17c1bcd75b8 100644
--- a/htdocs/holiday/define_holiday.php
+++ b/htdocs/holiday/define_holiday.php
@@ -43,7 +43,7 @@ $search_supervisor=GETPOST('search_supervisor', 'int');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php
index 64dca56c290..4b8757bf9bf 100644
--- a/htdocs/holiday/document.php
+++ b/htdocs/holiday/document.php
@@ -51,7 +51,7 @@ $result = restrictedArea($user, 'holiday', $id, 'holiday');
// Get parameters
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php
index 2361edf8a27..4aad973d1e9 100644
--- a/htdocs/holiday/list.php
+++ b/htdocs/holiday/list.php
@@ -85,7 +85,7 @@ $diroutputmassaction = $conf->holiday->dir_output.'/temp/massgeneration/'.$user-
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php
index 7c5ebb36d7c..59aac9e94d9 100644
--- a/htdocs/holiday/view_log.php
+++ b/htdocs/holiday/view_log.php
@@ -50,7 +50,7 @@ if (empty($year))
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php
index 11a08d400a3..b8af96ffb8e 100644
--- a/htdocs/hrm/establishment/card.php
+++ b/htdocs/hrm/establishment/card.php
@@ -225,7 +225,7 @@ if ($action == 'create')
print '';
print ''.$form->editfieldkey('Town', 'town', '', $object, 0).' ';
print '';
- print $formcompany->select_ziptown(GETPOST('town', 'alpha'), 'town', array (
+ print $formcompany->select_ziptown(GETPOSTISSET('town') ? GETPOST('town', 'alpha') : $object->town, 'town', array (
'zipcode',
'selectcountry_id'
));
@@ -236,7 +236,7 @@ if ($action == 'create')
print ' ';
print ''.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).' ';
print '';
- print $form->select_country(GETPOST('country_id', 'int')>0?GETPOST('country_id', 'int'):$mysoc->country_id, 'country_id');
+ print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : ($object->country_id ? $object->country_id : $mysoc->country_id), 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print ' ';
print ' ';
@@ -245,7 +245,7 @@ if ($action == 'create')
print '';
print ''.$form->editfieldkey('Status', 'status', '', $object, 0, 'string', '', 1).' ';
print '';
- print $form->selectarray('status', $status2label, GETPOST('status', 'alpha'));
+ print $form->selectarray('status', $status2label, GETPOSTISSET('status') ? GETPOST('status', 'alpha') : 1);
print ' ';
print '
';
@@ -318,7 +318,7 @@ if (($id || $ref) && $action == 'edit')
// Country
print ''.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).' ';
print '';
- print $form->select_country($object->fk_country, 'country_id');
+ print $form->select_country($object->country_id, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print ' ';
print ' ';
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index 6f4a1092194..87696535d2f 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -522,6 +522,7 @@ if ($step == 3 && $datatoimport)
print load_fiche_titre($langs->trans("InformationOnSourceFile"), '', '');
+
print '
';
print '';
print '
';
@@ -540,6 +541,13 @@ if ($step == 3 && $datatoimport)
dol_fiche_end();
+
+ if ($format == 'xlsx' && ! class_exists('XMLWriter')) {
+ $langs->load("install");
+ print info_admin($langs->trans("ErrorPHPDoesNotSupport", 'php-xml'), 0, 0, 1, 'error');
+ }
+
+
print ' ';
print '';
diff --git a/htdocs/includes/ace/ChangeLog.txt b/htdocs/includes/ace/ChangeLog.txt
index 237a2cdd66f..824f8750e12 100644
--- a/htdocs/includes/ace/ChangeLog.txt
+++ b/htdocs/includes/ace/ChangeLog.txt
@@ -1,3 +1,12 @@
+2020.01.14 Version 1.4.8
+* highlight both matched braces, and highlight unmatched brace in red
+* improve snippet manager
+* compatibility with webpack file-loader v5
+* improve vim mode
+
+2019.10.17 Version 1.4.7
+* add placeholder option
+
2019.09.08 Version 1.4.6
* restore native behavior of ctrl-p on mac (jumptomatching command is moved to cmd-\)
* improve snippet manager
diff --git a/htdocs/includes/ace/ace.d.ts b/htdocs/includes/ace/ace.d.ts
index 3d7ce109bb7..dd1a2952a06 100644
--- a/htdocs/includes/ace/ace.d.ts
+++ b/htdocs/includes/ace/ace.d.ts
@@ -214,6 +214,7 @@ export namespace Ace {
wrapBehavioursEnabled: boolean;
autoScrollEditorIntoView: boolean;
keyboardHandler: string;
+ placeholder: string;
value: string;
session: EditSession;
}
diff --git a/htdocs/includes/ace/kitchen-sink.html b/htdocs/includes/ace/kitchen-sink.html
index e4bab25a335..27014fa6004 100644
--- a/htdocs/includes/ace/kitchen-sink.html
+++ b/htdocs/includes/ace/kitchen-sink.html
@@ -8,7 +8,7 @@
diff --git a/htdocs/includes/ace/package.json b/htdocs/includes/ace/package.json
index 16587d65d90..a00dddeb40a 100644
--- a/htdocs/includes/ace/package.json
+++ b/htdocs/includes/ace/package.json
@@ -2,7 +2,7 @@
"name": "ace-builds",
"main": "./src-noconflict/ace.js",
"typings": "ace.d.ts",
- "version": "1.4.6",
+ "version": "1.4.8",
"description": "Ace (Ajax.org Cloud9 Editor)",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
diff --git a/htdocs/includes/ace/src/ace.js b/htdocs/includes/ace/src/ace.js
index 378ba7cf463..43d9931a3c4 100644
--- a/htdocs/includes/ace/src/ace.js
+++ b/htdocs/includes/ace/src/ace.js
@@ -880,10 +880,10 @@ if (!Date.now) {
return new Date().getTime();
};
}
-var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
+var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
"\u2029\uFEFF";
-if (!String.prototype.trim || ws.trim()) {
+if (!String.prototype.trim) {
ws = "[" + ws + "]";
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
trimEndRegexp = new RegExp(ws + ws + "*$");
@@ -1404,26 +1404,30 @@ var useragent = require("./useragent");
var pressedKeys = null;
var ts = 0;
+var activeListenerOptions;
+function detectListenerOptionsSupport() {
+ activeListenerOptions = false;
+ try {
+ document.createComment("").addEventListener("test", function() {}, {
+ get passive() {
+ activeListenerOptions = {passive: false};
+ }
+ });
+ } catch(e) {}
+}
+
+function getListenerOptions() {
+ if (activeListenerOptions == undefined)
+ detectListenerOptionsSupport();
+ return activeListenerOptions;
+}
+
exports.addListener = function(elem, type, callback) {
- if (elem.addEventListener) {
- return elem.addEventListener(type, callback, false);
- }
- if (elem.attachEvent) {
- var wrapper = function() {
- callback.call(elem, window.event);
- };
- callback._wrapper = wrapper;
- elem.attachEvent("on" + type, wrapper);
- }
+ return elem.addEventListener(type, callback, getListenerOptions());
};
exports.removeListener = function(elem, type, callback) {
- if (elem.removeEventListener) {
- return elem.removeEventListener(type, callback, false);
- }
- if (elem.detachEvent) {
- elem.detachEvent("on" + type, callback._wrapper || callback);
- }
+ return elem.removeEventListener(type, callback, getListenerOptions());
};
exports.stopEvent = function(e) {
exports.stopPropagation(e);
@@ -1434,27 +1438,18 @@ exports.stopEvent = function(e) {
exports.stopPropagation = function(e) {
if (e.stopPropagation)
e.stopPropagation();
- else
- e.cancelBubble = true;
};
exports.preventDefault = function(e) {
if (e.preventDefault)
e.preventDefault();
- else
- e.returnValue = false;
};
exports.getButton = function(e) {
if (e.type == "dblclick")
return 0;
if (e.type == "contextmenu" || (useragent.isMac && (e.ctrlKey && !e.altKey && !e.shiftKey)))
return 2;
- if (e.preventDefault) {
- return e.button;
- }
- else {
- return {1:0, 2:2, 4:1}[e.button];
- }
+ return e.button;
};
exports.capture = function(el, eventHandler, releaseCaptureHandler) {
@@ -1560,30 +1555,16 @@ exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, c
else if (clicks > 1)
return eventHandler[callbackName](eventNames[clicks], e);
}
- function onDblclick(e) {
- clicks = 2;
- if (timer)
- clearTimeout(timer);
- timer = setTimeout(function() {timer = null;}, timeouts[clicks - 1] || 600);
- eventHandler[callbackName]("mousedown", e);
- eventHandler[callbackName](eventNames[clicks], e);
- }
if (!Array.isArray(elements))
elements = [elements];
elements.forEach(function(el) {
exports.addListener(el, "mousedown", onMousedown);
- if (useragent.isOldIE)
- exports.addListener(el, "dblclick", onDblclick);
});
};
-var getModifierHash = useragent.isMac && useragent.isOpera && !("KeyboardEvent" in window)
- ? function(e) {
- return 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
- }
- : function(e) {
- return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
- };
+var getModifierHash = function(e) {
+ return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
+};
exports.getModifierString = function(e) {
return keys.KEY_MODS[getModifierHash(e)];
@@ -2228,6 +2209,7 @@ var TextInput = function(parentNode, host) {
var lastValue = "";
var lastSelectionStart = 0;
var lastSelectionEnd = 0;
+ var lastRestoreEnd = 0;
try { var isFocused = document.activeElement === text; } catch(e) {}
event.addListener(text, "blur", function(e) {
@@ -2447,9 +2429,8 @@ var TextInput = function(parentNode, host) {
endIndex = 0;
}
inserted = inserted.slice(0, endIndex);
- if (!fromInput && restoreStart == inserted.length && !extendLeft && !extendRight && !restoreEnd)
+ if (!fromInput && !inserted && !restoreStart && !extendLeft && !extendRight && !restoreEnd)
return "";
-
sendingText = true;
if (inserted && !extendLeft && !extendRight && !restoreStart && !restoreEnd || commandMode) {
host.onTextInput(inserted);
@@ -2466,6 +2447,7 @@ var TextInput = function(parentNode, host) {
lastValue = value;
lastSelectionStart = selectionStart;
lastSelectionEnd = selectionEnd;
+ lastRestoreEnd = restoreEnd;
return inserted;
}
};
@@ -2628,7 +2610,7 @@ var TextInput = function(parentNode, host) {
= inComposition.context.compositionStartOffset;
}
inComposition.markerRange.end.column = inComposition.markerRange.start.column
- + lastSelectionEnd - inComposition.selectionStart;
+ + lastSelectionEnd - inComposition.selectionStart + lastRestoreEnd;
}
}
};
@@ -3786,10 +3768,11 @@ exports.DragdropHandler = DragdropHandler;
});
-define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/dom"], function(require, exports, module) {
+define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"], function(require, exports, module) {
"use strict";
var MouseEvent = require("./mouse_event").MouseEvent;
+var event = require("../lib/event");
var dom = require("../lib/dom");
exports.addTouchListeners = function(el, editor) {
@@ -3916,12 +3899,12 @@ exports.addTouchListeners = function(el, editor) {
}
mode = "wait";
}
- el.addEventListener("contextmenu", function(e) {
+ event.addListener(el, "contextmenu", function(e) {
if (!pressed) return;
var textarea = editor.textInput.getElement();
textarea.focus();
});
- el.addEventListener("touchstart", function (e) {
+ event.addListener(el, "touchstart", function (e) {
var touches = e.touches;
if (longTouchTimer || touches.length > 1) {
clearTimeout(longTouchTimer);
@@ -3995,7 +3978,7 @@ exports.addTouchListeners = function(el, editor) {
touchStartT = t;
});
- el.addEventListener("touchend", function (e) {
+ event.addListener(el, "touchend", function (e) {
pressed = editor.$mouseHandler.isMousePressed = false;
if (animationTimer) clearInterval(animationTimer);
if (mode == "zoom") {
@@ -4015,7 +3998,7 @@ exports.addTouchListeners = function(el, editor) {
clearTimeout(longTouchTimer);
longTouchTimer = null;
});
- el.addEventListener("touchmove", function (e) {
+ event.addListener(el, "touchmove", function (e) {
if (longTouchTimer) {
clearTimeout(longTouchTimer);
longTouchTimer = null;
@@ -4577,7 +4560,7 @@ function deHyphenate(str) {
return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); });
}
-exports.version = "1.4.6";
+exports.version = "1.4.8";
});
@@ -5677,6 +5660,8 @@ var Selection = function(session) {
};
this.$setSelection = function(anchorRow, anchorColumn, cursorRow, cursorColumn) {
+ if (this.$silent)
+ return;
var wasEmpty = this.$isEmpty;
var wasMultiselect = this.inMultiSelectMode;
this.$silent = true;
@@ -6070,14 +6055,19 @@ var Selection = function(session) {
else
this.$desiredColumn = screenPos.column;
}
-
+
+ if (rows != 0 && this.session.lineWidgets && this.session.lineWidgets[this.lead.row]) {
+ var widget = this.session.lineWidgets[this.lead.row];
+ if (rows < 0)
+ rows -= widget.rowsAbove || 0;
+ else if (rows > 0)
+ rows += widget.rowCount - (widget.rowsAbove || 0);
+ }
+
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column, offsetX);
if (rows !== 0 && chars === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column) {
- if (this.session.lineWidgets && this.session.lineWidgets[docPos.row]) {
- if (docPos.row > 0 || rows > 0)
- docPos.row++;
- }
+
}
this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
};
@@ -9710,7 +9700,7 @@ function BracketMatch() {
var line = this.getLine(pos.row);
var before = true, range;
- var chr = line.charAt(pos.column-1);
+ var chr = line.charAt(pos.column - 1);
var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
if (!match) {
chr = line.charAt(pos.column);
@@ -9745,6 +9735,29 @@ function BracketMatch() {
return range;
};
+ this.getMatchingBracketRanges = function(pos) {
+ var line = this.getLine(pos.row);
+
+ var chr = line.charAt(pos.column - 1);
+ var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
+ if (!match) {
+ chr = line.charAt(pos.column);
+ pos = {row: pos.row, column: pos.column + 1};
+ match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
+ }
+
+ if (!match)
+ return null;
+
+ var startRange = new Range(pos.row, pos.column - 1, pos.row, pos.column);
+ var bracketPos = match[1] ? this.$findClosingBracket(match[1], pos)
+ : this.$findOpeningBracket(match[2], pos);
+ if (!bracketPos)
+ return [startRange];
+ var endRange = new Range(bracketPos.row, bracketPos.column, bracketPos.row, bracketPos.column + 1);
+
+ return [startRange, endRange];
+ };
this.$brackets = {
")": "(",
@@ -11147,15 +11160,14 @@ EditSession.$uid = 0;
this.lineWidgets = null;
this.getRowLength = function(row) {
+ var h = 1;
if (this.lineWidgets)
- var h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
- else
- h = 0;
- if (!this.$useWrapMode || !this.$wrapData[row]) {
- return 1 + h;
- } else {
- return this.$wrapData[row].length + 1 + h;
- }
+ h += this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
+
+ if (!this.$useWrapMode || !this.$wrapData[row])
+ return h;
+ else
+ return this.$wrapData[row].length + h;
};
this.getRowLineCount = function(row) {
if (!this.$useWrapMode || !this.$wrapData[row]) {
@@ -11367,6 +11379,9 @@ EditSession.$uid = 0;
wrapIndent = screenRowOffset > 0 ? wrapRow.indent : 0;
}
}
+
+ if (this.lineWidgets && this.lineWidgets[row] && this.lineWidgets[row].rowsAbove)
+ screenRow += this.lineWidgets[row].rowsAbove;
return {
row: screenRow,
@@ -13034,6 +13049,26 @@ exports.commands = [{
},
readOnly: true,
scrollIntoView: "none"
+}, {
+ name: "addLineAfter",
+ exec: function(editor) {
+ editor.selection.clearSelection();
+ editor.navigateLineEnd();
+ editor.insert("\n");
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
+}, {
+ name: "addLineBefore",
+ exec: function(editor) {
+ editor.selection.clearSelection();
+ var cursor = editor.getCursorPosition();
+ editor.selection.moveTo(cursor.row - 1, Number.MAX_VALUE);
+ editor.insert("\n");
+ if (cursor.row === 0) editor.navigateUp();
+ },
+ multiSelectAction: "forEach",
+ scrollIntoView: "cursor"
}, {
name: "openCommandPallete",
description: "Open command pallete",
@@ -13419,28 +13454,46 @@ Editor.$uid = 0;
};
this.$highlightBrackets = function() {
- if (this.session.$bracketHighlight) {
- this.session.removeMarker(this.session.$bracketHighlight);
- this.session.$bracketHighlight = null;
- }
-
if (this.$highlightPending) {
return;
}
var self = this;
this.$highlightPending = true;
- setTimeout(function() {
+ setTimeout(function () {
self.$highlightPending = false;
var session = self.session;
if (!session || !session.bgTokenizer) return;
- var pos = session.findMatchingBracket(self.getCursorPosition());
- if (pos) {
- var range = new Range(pos.row, pos.column, pos.row, pos.column + 1);
- } else if (session.$mode.getMatching) {
- var range = session.$mode.getMatching(self.session);
+ if (session.$bracketHighlight) {
+ session.$bracketHighlight.markerIds.forEach(function(id) {
+ session.removeMarker(id);
+ });
+ session.$bracketHighlight = null;
}
- if (range)
- session.$bracketHighlight = session.addMarker(range, "ace_bracket", "text");
+ var ranges = session.getMatchingBracketRanges(self.getCursorPosition());
+ if (!ranges && session.$mode.getMatching)
+ ranges = session.$mode.getMatching(self.session);
+ if (!ranges)
+ return;
+
+ var markerType = "ace_bracket";
+ if (!Array.isArray(ranges)) {
+ ranges = [ranges];
+ } else if (ranges.length == 1) {
+ markerType = "ace_error_bracket";
+ }
+ if (ranges.length == 2) {
+ if (Range.comparePoints(ranges[0].end, ranges[1].start) == 0)
+ ranges = [Range.fromPoints(ranges[0].start, ranges[1].end)];
+ else if (Range.comparePoints(ranges[0].start, ranges[1].end) == 0)
+ ranges = [Range.fromPoints(ranges[1].start, ranges[0].end)];
+ }
+
+ session.$bracketHighlight = {
+ ranges: ranges,
+ markerIds: ranges.map(function(range) {
+ return session.addMarker(range, markerType, "text");
+ })
+ };
}, 50);
};
this.$highlightTags = function() {
@@ -14263,6 +14316,7 @@ Editor.$uid = 0;
["up", "down"],
["before", "after"],
["even", "odd"],
+ ["in", "out"],
["inside", "outside"],
["next", "previous"],
["increase", "decrease"],
@@ -14870,9 +14924,11 @@ Editor.$uid = 0;
this.destroy = function() {
this.renderer.destroy();
this._signal("destroy", this);
- if (this.session) {
+ if (this.session)
this.session.destroy();
- }
+ if (this._$emitInputEvent)
+ this._$emitInputEvent.cancel();
+ this.session = null;
};
this.setAutoScrollEditorIntoView = function(enable) {
if (!enable)
@@ -15028,6 +15084,31 @@ config.defineOptions(Editor.prototype, "editor", {
relativeNumberRenderer.detach(this);
}
},
+ placeholder: {
+ set: function(message) {
+ if (!this.$updatePlaceholder) {
+ this.$updatePlaceholder = function() {
+ var value = this.renderer.$composition || this.getValue();
+ if (value && this.renderer.placeholderNode) {
+ this.renderer.off("afterRender", this.$updatePlaceholder);
+ dom.removeCssClass(this.container, "ace_hasPlaceholder");
+ this.renderer.placeholderNode.remove();
+ this.renderer.placeholderNode = null;
+ } else if (!value && !this.renderer.placeholderNode) {
+ this.renderer.on("afterRender", this.$updatePlaceholder);
+ dom.addCssClass(this.container, "ace_hasPlaceholder");
+ var el = dom.createElement("div");
+ el.className = "ace_placeholder";
+ el.textContent = this.$placeholder || "";
+ this.renderer.placeholderNode = el;
+ this.renderer.content.appendChild(this.renderer.placeholderNode);
+ }
+ }.bind(this);
+ this.on("input", this.$updatePlaceholder);
+ }
+ this.$updatePlaceholder();
+ }
+ },
hScrollBarAlwaysVisible: "renderer",
vScrollBarAlwaysVisible: "renderer",
@@ -15118,6 +15199,7 @@ var UndoManager = function() {
this.add = function(delta, allowMerge, session) {
if (this.$fromUndo) return;
if (delta == this.$lastDelta) return;
+ if (!this.$keepRedoStack) this.$redoStack.length = 0;
if (allowMerge === false || !this.lastDeltas) {
this.lastDeltas = [];
this.$undoStack.push(this.lastDeltas);
@@ -15194,6 +15276,25 @@ var UndoManager = function() {
if (to == null) to = this.$rev + 1;
};
+
+ this.validateDeltaBoundaries = function(deltaSet, docLength, invertAction) {
+ if (!deltaSet) {
+ return false;
+ }
+ return deltaSet.every(function(delta) {
+ var action = delta.action;
+ if (invertAction && delta.action === "insert") action = "remove";
+ if (invertAction && delta.action === "remove") action = "insert";
+ switch(action) {
+ case "insert":
+ return delta.start.row <= docLength;
+ case "remove":
+ return delta.start.row < docLength && delta.end.row < docLength;
+ default:
+ return true;
+ }
+ });
+ };
this.undo = function(session, dontSelect) {
this.lastDeltas = null;
var stack = this.$undoStack;
@@ -15211,7 +15312,7 @@ var UndoManager = function() {
var deltaSet = stack.pop();
var undoSelectionRange = null;
- if (deltaSet && deltaSet.length) {
+ if (this.validateDeltaBoundaries(deltaSet, session.getLength(), true)) {
undoSelectionRange = session.undoChanges(deltaSet, dontSelect);
this.$redoStack.push(deltaSet);
this.$syncRev();
@@ -15239,7 +15340,7 @@ var UndoManager = function() {
var deltaSet = this.$redoStack.pop();
var redoSelectionRange = null;
- if (deltaSet) {
+ if (this.validateDeltaBoundaries(deltaSet, session.getLength(), false)) {
redoSelectionRange = session.redoChanges(deltaSet, dontSelect);
this.$undoStack.push(deltaSet);
this.$syncRev();
@@ -15618,7 +15719,7 @@ var Lines = function(element, canvasHeight) {
};
this.computeLineHeight = function(row, config, session) {
- return config.lineHeight * session.getRowLength(row);
+ return config.lineHeight * session.getRowLineCount(row);
};
this.getLength = function() {
@@ -15645,10 +15746,10 @@ var Lines = function(element, canvasHeight) {
fragment.appendChild(cell[i].element);
}
this.element.appendChild(fragment);
- } else {
+ } else {
this.cells.push(cell);
this.element.appendChild(cell.element);
- }
+ }
};
this.unshift = function(cell) {
@@ -15662,10 +15763,10 @@ var Lines = function(element, canvasHeight) {
this.element.insertBefore(fragment, this.element.firstChild);
else
this.element.appendChild(fragment);
- } else {
+ } else {
this.cells.unshift(cell);
this.element.insertAdjacentElement("afterbegin", cell.element);
- }
+ }
};
this.last = function() {
@@ -17633,6 +17734,7 @@ position: absolute;\
box-sizing: border-box;\
min-width: 100%;\
contain: style size layout;\
+font-variant-ligatures: no-common-ligatures;\
}\
.ace_dragging .ace_scroller:before{\
position: absolute;\
@@ -17764,7 +17866,6 @@ margin-top: 1px;\
[ace_nocontext=true] {\
transform: none!important;\
filter: none!important;\
-perspective: none!important;\
clip-path: none!important;\
mask : none!important;\
contain: none!important;\
@@ -17843,6 +17944,9 @@ border-bottom: 1px solid;\
.ace_hidden-cursors .ace_cursor {\
opacity: 0.2;\
}\
+.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {\
+opacity: 0;\
+}\
.ace_smooth-blinking .ace_cursor {\
transition: opacity 0.18s;\
}\
@@ -17879,6 +17983,11 @@ z-index: 5;\
position: absolute;\
z-index: 6;\
}\
+.ace_marker-layer .ace_error_bracket {\
+position: absolute;\
+border-bottom: 1px solid #DE5555;\
+border-radius: 0;\
+}\
.ace_marker-layer .ace_active-line {\
position: absolute;\
z-index: 2;\
@@ -18062,6 +18171,14 @@ opacity:1;\
}\
.ace_mobile-button:active {\
background-color: #ddd;\
+}\
+.ace_placeholder {\
+font-family: arial;\
+transform: scale(0.9);\
+transform-origin: left;\
+white-space: pre;\
+opacity: 0.7;\
+margin: 0 10px;\
}";
var useragent = require("./lib/useragent");
@@ -18522,7 +18639,6 @@ var VirtualRenderer = function(container, theme) {
if (composition.useTextareaForIME) {
var val = this.textarea.value;
w = this.characterWidth * (this.session.$getStringScreenWidth(val)[0]);
- h += 2;
}
else {
posTop += this.lineHeight + 2;
@@ -18649,7 +18765,7 @@ var VirtualRenderer = function(container, theme) {
this.$textLayer.checkForSizeChanges();
}
- this._signal("beforeRender");
+ this._signal("beforeRender", changes);
if (this.session && this.session.$bidiHandler)
this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);
@@ -18697,7 +18813,7 @@ var VirtualRenderer = function(container, theme) {
this.$markerFront.update(config);
this.$cursorLayer.update(config);
this.$moveTextAreaToCursor();
- this._signal("afterRender");
+ this._signal("afterRender", changes);
return;
}
if (changes & this.CHANGE_SCROLL) {
@@ -18717,7 +18833,7 @@ var VirtualRenderer = function(container, theme) {
this.$markerFront.update(config);
this.$cursorLayer.update(config);
this.$moveTextAreaToCursor();
- this._signal("afterRender");
+ this._signal("afterRender", changes);
return;
}
@@ -18753,7 +18869,7 @@ var VirtualRenderer = function(container, theme) {
this.$markerBack.update(config);
}
- this._signal("afterRender");
+ this._signal("afterRender", changes);
};
@@ -19185,7 +19301,7 @@ var VirtualRenderer = function(container, theme) {
this.$moveTextAreaToCursor();
this.$cursorLayer.element.style.display = "none";
}
- else {
+ else {
composition.markerId = this.session.addMarker(composition.markerRange, "ace_composition_marker", "text");
}
};
@@ -20079,10 +20195,20 @@ exports.defaultCommands = [{
scrollIntoView: "cursor",
readOnly: true
}, {
- name: "splitIntoLines",
+ name: "toggleSplitSelectionIntoLines",
+ description: "Split into lines",
+ exec: function(editor) {
+ if (editor.multiSelect.rangeCount > 1)
+ editor.multiSelect.joinSelections();
+ else
+ editor.multiSelect.splitIntoLines();
+ },
+ bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
+ readOnly: true
+}, {
+ name: "splitSelectionIntoLines",
description: "Split into lines",
exec: function(editor) { editor.multiSelect.splitIntoLines(); },
- bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
readOnly: true
}, {
name: "alignCursors",
@@ -20177,7 +20303,6 @@ var EditSession = require("./edit_session").EditSession;
return $blockChangeEvents || this.fromOrientedRange(range);
};
-
this.toSingleRange = function(range) {
range = range || this.ranges[0];
var removed = this.rangeList.removeAll();
@@ -20242,45 +20367,36 @@ var EditSession = require("./edit_session").EditSession;
this.getAllRanges = function() {
return this.rangeCount ? this.rangeList.ranges.concat() : [this.getRange()];
};
-
this.splitIntoLines = function () {
- if (this.rangeCount > 1) {
- var ranges = this.rangeList.ranges;
- var lastRange = ranges[ranges.length - 1];
- var range = Range.fromPoints(ranges[0].start, lastRange.end);
-
- this.toSingleRange();
- this.setSelectionRange(range, lastRange.cursor == lastRange.start);
- } else {
- var range = this.getRange();
- var isBackwards = this.isBackwards();
- var startRow = range.start.row;
+ var ranges = this.ranges.length ? this.ranges : [this.getRange()];
+ var newRanges = [];
+ for (var i = 0; i < ranges.length; i++) {
+ var range = ranges[i];
+ var row = range.start.row;
var endRow = range.end.row;
- if (startRow == endRow) {
- if (isBackwards)
- var start = range.end, end = range.start;
- else
- var start = range.start, end = range.end;
-
- this.addRange(Range.fromPoints(end, end));
- this.addRange(Range.fromPoints(start, start));
- return;
+ if (row === endRow) {
+ newRanges.push(range.clone());
+ } else {
+ newRanges.push(new Range(row, range.start.column, row, this.session.getLine(row).length));
+ while (++row < endRow)
+ newRanges.push(this.getLineRange(row, true));
+ newRanges.push(new Range(endRow, 0, endRow, range.end.column));
}
-
- var rectSel = [];
- var r = this.getLineRange(startRow, true);
- r.start.column = range.start.column;
- rectSel.push(r);
-
- for (var i = startRow + 1; i < endRow; i++)
- rectSel.push(this.getLineRange(i, true));
-
- r = this.getLineRange(endRow, true);
- r.end.column = range.end.column;
- rectSel.push(r);
-
- rectSel.forEach(this.addRange, this);
+ if (i == 0 && !this.isBackwards())
+ newRanges = newRanges.reverse();
}
+ this.toSingleRange();
+ for (var i = newRanges.length; i--;)
+ this.addRange(newRanges[i]);
+ };
+
+ this.joinSelections = function () {
+ var ranges = this.rangeList.ranges;
+ var lastRange = ranges[ranges.length - 1];
+ var range = Range.fromPoints(ranges[0].start, lastRange.end);
+
+ this.toSingleRange();
+ this.setSelectionRange(range, lastRange.cursor == lastRange.start);
};
this.toggleBlockSelection = function () {
if (this.rangeCount > 1) {
@@ -21146,13 +21262,10 @@ var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
});
-define("ace/line_widgets",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/range"], function(require, exports, module) {
+define("ace/line_widgets",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
"use strict";
-var oop = require("./lib/oop");
var dom = require("./lib/dom");
-var Range = require("./range").Range;
-
function LineWidgets(session) {
this.session = session;
@@ -21266,14 +21379,21 @@ function LineWidgets(session) {
var len = delta.end.row - startRow;
if (len === 0) {
- } else if (delta.action == 'remove') {
+ } else if (delta.action == "remove") {
var removed = lineWidgets.splice(startRow + 1, len);
+ if (!lineWidgets[startRow] && removed[removed.length - 1]) {
+ lineWidgets[startRow] = removed.pop();
+ }
removed.forEach(function(w) {
w && this.removeLineWidget(w);
}, this);
this.$updateRows();
} else {
var args = new Array(len);
+ if (lineWidgets[startRow] && lineWidgets[startRow].column != null) {
+ if (delta.start.column > lineWidgets[startRow].column)
+ startRow++;
+ }
args.unshift(startRow, 0);
lineWidgets.splice.apply(lineWidgets, args);
this.$updateRows();
@@ -21298,7 +21418,7 @@ function LineWidgets(session) {
this.session.lineWidgets = null;
};
- this.addLineWidget = function(w) {
+ this.$registerLineWidget = function(w) {
if (!this.session.lineWidgets)
this.session.lineWidgets = new Array(this.session.getLength());
@@ -21312,9 +21432,15 @@ function LineWidgets(session) {
}
this.session.lineWidgets[w.row] = w;
-
+ return w;
+ };
+
+ this.addLineWidget = function(w) {
+ this.$registerLineWidget(w);
w.session = this.session;
+ if (!this.editor) return w;
+
var renderer = this.editor.renderer;
if (w.html && !w.el) {
w.el = dom.createElement("div");
@@ -21326,13 +21452,13 @@ function LineWidgets(session) {
w.el.style.zIndex = 5;
renderer.container.appendChild(w.el);
w._inDocument = true;
- }
-
- if (!w.coverGutter) {
- w.el.style.zIndex = 3;
- }
- if (w.pixelHeight == null) {
- w.pixelHeight = w.el.offsetHeight;
+
+ if (!w.coverGutter) {
+ w.el.style.zIndex = 3;
+ }
+ if (w.pixelHeight == null) {
+ w.pixelHeight = w.el.offsetHeight;
+ }
}
if (w.rowCount == null) {
w.rowCount = w.pixelHeight / renderer.layerConfig.lineHeight;
diff --git a/htdocs/includes/ace/src/ext-code_lens.js b/htdocs/includes/ace/src/ext-code_lens.js
new file mode 100644
index 00000000000..4b7e4340f22
--- /dev/null
+++ b/htdocs/includes/ace/src/ext-code_lens.js
@@ -0,0 +1,234 @@
+define("ace/ext/code_lens",["require","exports","module","ace/line_widgets","ace/lib/lang","ace/lib/dom","ace/editor","ace/config"], function(require, exports, module) {
+"use strict";
+var LineWidgets = require("../line_widgets").LineWidgets;
+var lang = require("../lib/lang");
+var dom = require("../lib/dom");
+
+function clearLensElements(renderer) {
+ var textLayer = renderer.$textLayer;
+ var lensElements = textLayer.$lenses;
+ if (lensElements)
+ lensElements.forEach(function(el) {el.remove(); });
+ textLayer.$lenses = null;
+}
+
+function renderWidgets(changes, renderer) {
+ var changed = changes & renderer.CHANGE_LINES
+ || changes & renderer.CHANGE_FULL
+ || changes & renderer.CHANGE_SCROLL
+ || changes & renderer.CHANGE_TEXT;
+ if (!changed)
+ return;
+
+ var session = renderer.session;
+ var lineWidgets = renderer.session.lineWidgets;
+ var textLayer = renderer.$textLayer;
+ var lensElements = textLayer.$lenses;
+ if (!lineWidgets) {
+ if (lensElements)
+ clearLensElements(renderer);
+ return;
+ }
+
+ var textCells = renderer.$textLayer.$lines.cells;
+ var config = renderer.layerConfig;
+ var padding = renderer.$padding;
+
+ if (!lensElements)
+ lensElements = textLayer.$lenses = [];
+
+
+ var index = 0;
+ for (var i = 0; i < textCells.length; i++) {
+ var row = textCells[i].row;
+ var widget = lineWidgets[row];
+ var lenses = widget && widget.lenses;
+
+ if (!lenses || !lenses.length) continue;
+
+ var lensContainer = lensElements[index];
+ if (!lensContainer) {
+ lensContainer = lensElements[index]
+ = dom.buildDom(["div", {class: "ace_codeLens"}], renderer.container);
+ }
+ lensContainer.style.height = config.lineHeight + "px";
+ index++;
+
+ for (var j = 0; j < lenses.length; j++) {
+ var el = lensContainer.childNodes[2 * j];
+ if (!el) {
+ if (j != 0) lensContainer.appendChild(dom.createTextNode("\xa0|\xa0"));
+ el = dom.buildDom(["a"], lensContainer);
+ }
+ el.textContent = lenses[j].title;
+ el.lensCommand = lenses[j];
+ }
+ while (lensContainer.childNodes.length > 2 * j - 1)
+ lensContainer.lastChild.remove();
+
+ var top = renderer.$cursorLayer.getPixelPosition({
+ row: row,
+ column: 0
+ }, true).top - config.lineHeight * widget.rowsAbove - config.offset;
+ lensContainer.style.top = top + "px";
+
+ var left = renderer.gutterWidth;
+ var indent = session.getLine(row).search(/\S|$/);
+ if (indent == -1)
+ indent = 0;
+ left += indent * config.characterWidth;
+ left -= renderer.scrollLeft;
+ lensContainer.style.paddingLeft = padding + left + "px";
+ }
+ while (index < lensElements.length)
+ lensElements.pop().remove();
+}
+
+function clearCodeLensWidgets(session) {
+ if (!session.lineWidgets) return;
+ var widgetManager = session.widgetManager;
+ session.lineWidgets.forEach(function(widget) {
+ if (widget && widget.lenses)
+ widgetManager.removeLineWidget(widget);
+ });
+}
+
+exports.setLenses = function(session, lenses) {
+ var firstRow = Number.MAX_VALUE;
+
+ clearCodeLensWidgets(session);
+ lenses && lenses.forEach(function(lens) {
+ var row = lens.start.row;
+ var column = lens.start.column;
+ var widget = session.lineWidgets && session.lineWidgets[row];
+ if (!widget || !widget.lenses) {
+ widget = session.widgetManager.$registerLineWidget({
+ rowCount: 1,
+ rowsAbove: 1,
+ row: row,
+ column: column,
+ lenses: []
+ });
+ }
+ widget.lenses.push(lens.command);
+ if (row < firstRow)
+ firstRow = row;
+ });
+ session._emit("changeFold", {data: {start: {row: firstRow}}});
+};
+
+function attachToEditor(editor) {
+ editor.codeLensProviders = [];
+ editor.renderer.on("afterRender", renderWidgets);
+ editor.$codeLensClickHandler = function(e) {
+ var command = e.target.lensCommand;
+ if (command)
+ editor.execCommand(command.id, command.arguments);
+ };
+ editor.container.addEventListener("click", editor.$codeLensClickHandler);
+ editor.$updateLenses = function() {
+ var session = editor.session;
+ if (!session) return;
+
+ if (!session.widgetManager) {
+ session.widgetManager = new LineWidgets(session);
+ session.widgetManager.attach(editor);
+ }
+
+ var providersToWaitNum = editor.codeLensProviders.length;
+ var lenses = [];
+ editor.codeLensProviders.forEach(function(provider) {
+ provider.provideCodeLenses(session, function(currentLenses) {
+ currentLenses.forEach(function(lens) {
+ lenses.push(lens);
+ });
+ providersToWaitNum--;
+ if (providersToWaitNum == 0) {
+ applyLenses();
+ }
+ });
+ });
+
+ function applyLenses() {
+ var cursor = session.selection.cursor;
+ var oldRow = session.documentToScreenRow(cursor);
+ exports.setLenses(session, lenses);
+
+ var lastDelta = session.$undoManager && session.$undoManager.$lastDelta;
+ if (lastDelta && lastDelta.action == "remove" && lastDelta.lines.length > 1)
+ return;
+ var row = session.documentToScreenRow(cursor);
+ var lineHeight = editor.renderer.layerConfig.lineHeight;
+ var top = session.getScrollTop() + (row - oldRow) * lineHeight;
+ session.setScrollTop(top);
+ }
+ };
+ var updateLenses = lang.delayedCall(editor.$updateLenses);
+ editor.$updateLensesOnInput = function() {
+ updateLenses.delay(250);
+ };
+ editor.on("input", editor.$updateLensesOnInput);
+}
+
+function detachFromEditor(editor) {
+ editor.off("input", editor.$updateLensesOnInput);
+ editor.renderer.off("afterRender", renderWidgets);
+ if (editor.$codeLensClickHandler)
+ editor.container.removeEventListener("click", editor.$codeLensClickHandler);
+}
+
+exports.registerCodeLensProvider = function(editor, codeLensProvider) {
+ editor.setOption("enableCodeLens", true);
+ editor.codeLensProviders.push(codeLensProvider);
+ editor.$updateLensesOnInput();
+};
+
+exports.clear = function(session) {
+ exports.setLenses(session, null);
+};
+
+var Editor = require("../editor").Editor;
+require("../config").defineOptions(Editor.prototype, "editor", {
+ enableCodeLens: {
+ set: function(val) {
+ if (val) {
+ attachToEditor(this);
+ } else {
+ detachFromEditor(this);
+ }
+ }
+ }
+});
+
+dom.importCssString("\
+.ace_codeLens {\
+ position: absolute;\
+ color: #aaa;\
+ font-size: 88%;\
+ background: inherit;\
+ width: 100%;\
+ display: flex;\
+ align-items: flex-end;\
+ pointer-events: none;\
+}\
+.ace_codeLens > a {\
+ cursor: pointer;\
+ pointer-events: auto;\
+}\
+.ace_codeLens > a:hover {\
+ color: #0000ff;\
+ text-decoration: underline;\
+}\
+.ace_dark > .ace_codeLens > a:hover {\
+ color: #4e94ce;\
+}\
+", "");
+
+}); (function() {
+ window.require(["ace/ext/code_lens"], function(m) {
+ if (typeof module == "object" && typeof exports == "object" && module) {
+ module.exports = m;
+ }
+ });
+ })();
+
\ No newline at end of file
diff --git a/htdocs/includes/ace/src/ext-emmet.js b/htdocs/includes/ace/src/ext-emmet.js
index 30425a69273..3cb3818d1b5 100644
--- a/htdocs/includes/ace/src/ext-emmet.js
+++ b/htdocs/includes/ace/src/ext-emmet.js
@@ -747,15 +747,16 @@ var TabstopManager = function(editor) {
this.onChange = function(delta) {
var isRemove = delta.action[0] == "r";
- var parents = this.selectedTabstop && this.selectedTabstop.parents || {};
+ var selectedTabstop = this.selectedTabstop || {};
+ var parents = selectedTabstop.parents || {};
var tabstops = (this.tabstops || []).slice();
for (var i = 0; i < tabstops.length; i++) {
var ts = tabstops[i];
- var active = ts == this.selectedTabstop || parents[ts.index];
+ var active = ts == selectedTabstop || parents[ts.index];
ts.rangeList.$bias = active ? 0 : 1;
- if (delta.action == "remove" && ts !== this.selectedTabstop) {
- var parentActive = ts.parents && ts.parents[this.selectedTabstop.index];
+ if (delta.action == "remove" && ts !== selectedTabstop) {
+ var parentActive = ts.parents && ts.parents[selectedTabstop.index];
var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
@@ -868,8 +869,6 @@ var TabstopManager = function(editor) {
var ranges = this.ranges;
tabstops.forEach(function(ts, index) {
var dest = this.$openTabstops[index] || ts;
- ts.rangeList = new RangeList();
- ts.rangeList.$bias = 0;
for (var i = 0; i < ts.length; i++) {
var p = ts[i];
@@ -879,7 +878,6 @@ var TabstopManager = function(editor) {
range.original = p;
range.tabstop = dest;
ranges.push(range);
- ts.rangeList.ranges.push(range);
if (dest != ts)
dest.unshift(range);
else
@@ -897,6 +895,9 @@ var TabstopManager = function(editor) {
this.$openTabstops[index] = dest;
}
this.addTabstopMarkers(dest);
+ dest.rangeList = dest.rangeList || new RangeList();
+ dest.rangeList.$bias = 0;
+ dest.rangeList.addList(dest);
}, this);
if (arg.length > 2) {
@@ -939,21 +940,18 @@ var TabstopManager = function(editor) {
this.keyboardHandler = new HashHandler();
this.keyboardHandler.bindKeys({
- "Tab": function(ed) {
- if (exports.snippetManager && exports.snippetManager.expandWithTab(ed)) {
+ "Tab": function(editor) {
+ if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
return;
- }
-
- ed.tabstopManager.tabNext(1);
+ editor.tabstopManager.tabNext(1);
+ editor.renderer.scrollCursorIntoView();
},
- "Shift-Tab": function(ed) {
- ed.tabstopManager.tabNext(-1);
+ "Shift-Tab": function(editor) {
+ editor.tabstopManager.tabNext(-1);
+ editor.renderer.scrollCursorIntoView();
},
- "Esc": function(ed) {
- ed.tabstopManager.detach();
- },
- "Return": function(ed) {
- return false;
+ "Esc": function(editor) {
+ editor.tabstopManager.detach();
}
});
}).call(TabstopManager.prototype);
diff --git a/htdocs/includes/ace/src/ext-keybinding_menu.js b/htdocs/includes/ace/src/ext-keybinding_menu.js
index 501c5f9ccad..4f980686e68 100644
--- a/htdocs/includes/ace/src/ext-keybinding_menu.js
+++ b/htdocs/includes/ace/src/ext-keybinding_menu.js
@@ -65,6 +65,7 @@ dom.importCssString(cssText);
module.exports.overlayPage = function overlayPage(editor, contentElement, callback) {
var closer = document.createElement('div');
+ var ignoreFocusOut = false;
function documentEscListener(e) {
if (e.keyCode === 27) {
@@ -76,17 +77,28 @@ module.exports.overlayPage = function overlayPage(editor, contentElement, callba
if (!closer) return;
document.removeEventListener('keydown', documentEscListener);
closer.parentNode.removeChild(closer);
- editor.focus();
+ if (editor) {
+ editor.focus();
+ }
closer = null;
callback && callback();
}
+ function setIgnoreFocusOut(ignore) {
+ ignoreFocusOut = ignore;
+ if (ignore) {
+ closer.style.pointerEvents = "none";
+ contentElement.style.pointerEvents = "auto";
+ }
+ }
closer.style.cssText = 'margin: 0; padding: 0; ' +
'position: fixed; top:0; bottom:0; left:0; right:0;' +
'z-index: 9990; ' +
- 'background-color: rgba(0, 0, 0, 0.3);';
- closer.addEventListener('click', function() {
- close();
+ (editor ? 'background-color: rgba(0, 0, 0, 0.3);' : '');
+ closer.addEventListener('click', function(e) {
+ if (!ignoreFocusOut) {
+ close();
+ }
});
document.addEventListener('keydown', documentEscListener);
@@ -96,9 +108,12 @@ module.exports.overlayPage = function overlayPage(editor, contentElement, callba
closer.appendChild(contentElement);
document.body.appendChild(closer);
- editor.blur();
+ if (editor) {
+ editor.blur();
+ }
return {
- close: close
+ close: close,
+ setIgnoreFocusOut: setIgnoreFocusOut
};
};
diff --git a/htdocs/includes/ace/src/ext-language_tools.js b/htdocs/includes/ace/src/ext-language_tools.js
index 80af02df566..7e6967e0d7a 100644
--- a/htdocs/includes/ace/src/ext-language_tools.js
+++ b/htdocs/includes/ace/src/ext-language_tools.js
@@ -747,15 +747,16 @@ var TabstopManager = function(editor) {
this.onChange = function(delta) {
var isRemove = delta.action[0] == "r";
- var parents = this.selectedTabstop && this.selectedTabstop.parents || {};
+ var selectedTabstop = this.selectedTabstop || {};
+ var parents = selectedTabstop.parents || {};
var tabstops = (this.tabstops || []).slice();
for (var i = 0; i < tabstops.length; i++) {
var ts = tabstops[i];
- var active = ts == this.selectedTabstop || parents[ts.index];
+ var active = ts == selectedTabstop || parents[ts.index];
ts.rangeList.$bias = active ? 0 : 1;
- if (delta.action == "remove" && ts !== this.selectedTabstop) {
- var parentActive = ts.parents && ts.parents[this.selectedTabstop.index];
+ if (delta.action == "remove" && ts !== selectedTabstop) {
+ var parentActive = ts.parents && ts.parents[selectedTabstop.index];
var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
@@ -868,8 +869,6 @@ var TabstopManager = function(editor) {
var ranges = this.ranges;
tabstops.forEach(function(ts, index) {
var dest = this.$openTabstops[index] || ts;
- ts.rangeList = new RangeList();
- ts.rangeList.$bias = 0;
for (var i = 0; i < ts.length; i++) {
var p = ts[i];
@@ -879,7 +878,6 @@ var TabstopManager = function(editor) {
range.original = p;
range.tabstop = dest;
ranges.push(range);
- ts.rangeList.ranges.push(range);
if (dest != ts)
dest.unshift(range);
else
@@ -897,6 +895,9 @@ var TabstopManager = function(editor) {
this.$openTabstops[index] = dest;
}
this.addTabstopMarkers(dest);
+ dest.rangeList = dest.rangeList || new RangeList();
+ dest.rangeList.$bias = 0;
+ dest.rangeList.addList(dest);
}, this);
if (arg.length > 2) {
@@ -939,21 +940,18 @@ var TabstopManager = function(editor) {
this.keyboardHandler = new HashHandler();
this.keyboardHandler.bindKeys({
- "Tab": function(ed) {
- if (exports.snippetManager && exports.snippetManager.expandWithTab(ed)) {
+ "Tab": function(editor) {
+ if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
return;
- }
-
- ed.tabstopManager.tabNext(1);
+ editor.tabstopManager.tabNext(1);
+ editor.renderer.scrollCursorIntoView();
},
- "Shift-Tab": function(ed) {
- ed.tabstopManager.tabNext(-1);
+ "Shift-Tab": function(editor) {
+ editor.tabstopManager.tabNext(-1);
+ editor.renderer.scrollCursorIntoView();
},
- "Esc": function(ed) {
- ed.tabstopManager.detach();
- },
- "Return": function(ed) {
- return false;
+ "Esc": function(editor) {
+ editor.tabstopManager.detach();
}
});
}).call(TabstopManager.prototype);
@@ -1355,7 +1353,7 @@ exports.parForEach = function(array, fn, callback) {
}
};
-var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\uFFFF]/;
+var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
exports.retrievePrecedingIdentifier = function(text, pos, regex) {
regex = regex || ID_REGEX;
diff --git a/htdocs/includes/ace/src/ext-modelist.js b/htdocs/includes/ace/src/ext-modelist.js
index 0032ecd178f..8b771ffeb99 100644
--- a/htdocs/includes/ace/src/ext-modelist.js
+++ b/htdocs/includes/ace/src/ext-modelist.js
@@ -101,6 +101,7 @@ var supportedModes = {
Jade: ["jade|pug"],
Java: ["java"],
JavaScript: ["js|jsm|jsx"],
+ JSON5: ["json5"],
JSON: ["json"],
JSONiq: ["jq"],
JSP: ["jsp"],
@@ -131,6 +132,7 @@ var supportedModes = {
Nix: ["nix"],
Nim: ["nim"],
NSIS: ["nsi|nsh"],
+ Nunjucks: ["nunjucks|nunjs|nj|njk"],
ObjectiveC: ["m|mm"],
OCaml: ["ml|mli"],
Pascal: ["pas|p"],
diff --git a/htdocs/includes/ace/src/ext-options.js b/htdocs/includes/ace/src/ext-options.js
index e01961df4ed..d1d01cefa05 100644
--- a/htdocs/includes/ace/src/ext-options.js
+++ b/htdocs/includes/ace/src/ext-options.js
@@ -65,6 +65,7 @@ dom.importCssString(cssText);
module.exports.overlayPage = function overlayPage(editor, contentElement, callback) {
var closer = document.createElement('div');
+ var ignoreFocusOut = false;
function documentEscListener(e) {
if (e.keyCode === 27) {
@@ -76,17 +77,28 @@ module.exports.overlayPage = function overlayPage(editor, contentElement, callba
if (!closer) return;
document.removeEventListener('keydown', documentEscListener);
closer.parentNode.removeChild(closer);
- editor.focus();
+ if (editor) {
+ editor.focus();
+ }
closer = null;
callback && callback();
}
+ function setIgnoreFocusOut(ignore) {
+ ignoreFocusOut = ignore;
+ if (ignore) {
+ closer.style.pointerEvents = "none";
+ contentElement.style.pointerEvents = "auto";
+ }
+ }
closer.style.cssText = 'margin: 0; padding: 0; ' +
'position: fixed; top:0; bottom:0; left:0; right:0;' +
'z-index: 9990; ' +
- 'background-color: rgba(0, 0, 0, 0.3);';
- closer.addEventListener('click', function() {
- close();
+ (editor ? 'background-color: rgba(0, 0, 0, 0.3);' : '');
+ closer.addEventListener('click', function(e) {
+ if (!ignoreFocusOut) {
+ close();
+ }
});
document.addEventListener('keydown', documentEscListener);
@@ -96,9 +108,12 @@ module.exports.overlayPage = function overlayPage(editor, contentElement, callba
closer.appendChild(contentElement);
document.body.appendChild(closer);
- editor.blur();
+ if (editor) {
+ editor.blur();
+ }
return {
- close: close
+ close: close,
+ setIgnoreFocusOut: setIgnoreFocusOut
};
};
@@ -207,6 +222,7 @@ var supportedModes = {
Jade: ["jade|pug"],
Java: ["java"],
JavaScript: ["js|jsm|jsx"],
+ JSON5: ["json5"],
JSON: ["json"],
JSONiq: ["jq"],
JSP: ["jsp"],
@@ -237,6 +253,7 @@ var supportedModes = {
Nix: ["nix"],
Nim: ["nim"],
NSIS: ["nsi|nsh"],
+ Nunjucks: ["nunjucks|nunjs|nj|njk"],
ObjectiveC: ["m|mm"],
OCaml: ["ml|mli"],
Pascal: ["pas|p"],
@@ -396,9 +413,9 @@ exports.themes = themeData.map(function(data) {
define("ace/ext/options",["require","exports","module","ace/ext/menu_tools/overlay_page","ace/lib/dom","ace/lib/oop","ace/config","ace/lib/event_emitter","ace/ext/modelist","ace/ext/themelist"], function(require, exports, module) {
"use strict";
-var overlayPage = require('./menu_tools/overlay_page').overlayPage;
-
+require("./menu_tools/overlay_page");
+
var dom = require("../lib/dom");
var oop = require("../lib/oop");
var config = require("../config");
@@ -437,7 +454,8 @@ var optionGroups = {
{ caption : "Ace", value : null },
{ caption : "Vim", value : "ace/keyboard/vim" },
{ caption : "Emacs", value : "ace/keyboard/emacs" },
- { caption : "Sublime", value : "ace/keyboard/sublime" }
+ { caption : "Sublime", value : "ace/keyboard/sublime" },
+ { caption : "VSCode", value : "ace/keyboard/vscode" }
]
},
"Font Size": {
diff --git a/htdocs/includes/ace/src/ext-prompt.js b/htdocs/includes/ace/src/ext-prompt.js
index 815c7cda214..bcc99f70806 100644
--- a/htdocs/includes/ace/src/ext-prompt.js
+++ b/htdocs/includes/ace/src/ext-prompt.js
@@ -387,7 +387,7 @@ exports.parForEach = function(array, fn, callback) {
}
};
-var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\uFFFF]/;
+var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
exports.retrievePrecedingIdentifier = function(text, pos, regex) {
regex = regex || ID_REGEX;
@@ -1179,15 +1179,16 @@ var TabstopManager = function(editor) {
this.onChange = function(delta) {
var isRemove = delta.action[0] == "r";
- var parents = this.selectedTabstop && this.selectedTabstop.parents || {};
+ var selectedTabstop = this.selectedTabstop || {};
+ var parents = selectedTabstop.parents || {};
var tabstops = (this.tabstops || []).slice();
for (var i = 0; i < tabstops.length; i++) {
var ts = tabstops[i];
- var active = ts == this.selectedTabstop || parents[ts.index];
+ var active = ts == selectedTabstop || parents[ts.index];
ts.rangeList.$bias = active ? 0 : 1;
- if (delta.action == "remove" && ts !== this.selectedTabstop) {
- var parentActive = ts.parents && ts.parents[this.selectedTabstop.index];
+ if (delta.action == "remove" && ts !== selectedTabstop) {
+ var parentActive = ts.parents && ts.parents[selectedTabstop.index];
var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
@@ -1300,8 +1301,6 @@ var TabstopManager = function(editor) {
var ranges = this.ranges;
tabstops.forEach(function(ts, index) {
var dest = this.$openTabstops[index] || ts;
- ts.rangeList = new RangeList();
- ts.rangeList.$bias = 0;
for (var i = 0; i < ts.length; i++) {
var p = ts[i];
@@ -1311,7 +1310,6 @@ var TabstopManager = function(editor) {
range.original = p;
range.tabstop = dest;
ranges.push(range);
- ts.rangeList.ranges.push(range);
if (dest != ts)
dest.unshift(range);
else
@@ -1329,6 +1327,9 @@ var TabstopManager = function(editor) {
this.$openTabstops[index] = dest;
}
this.addTabstopMarkers(dest);
+ dest.rangeList = dest.rangeList || new RangeList();
+ dest.rangeList.$bias = 0;
+ dest.rangeList.addList(dest);
}, this);
if (arg.length > 2) {
@@ -1371,21 +1372,18 @@ var TabstopManager = function(editor) {
this.keyboardHandler = new HashHandler();
this.keyboardHandler.bindKeys({
- "Tab": function(ed) {
- if (exports.snippetManager && exports.snippetManager.expandWithTab(ed)) {
+ "Tab": function(editor) {
+ if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
return;
- }
-
- ed.tabstopManager.tabNext(1);
+ editor.tabstopManager.tabNext(1);
+ editor.renderer.scrollCursorIntoView();
},
- "Shift-Tab": function(ed) {
- ed.tabstopManager.tabNext(-1);
+ "Shift-Tab": function(editor) {
+ editor.tabstopManager.tabNext(-1);
+ editor.renderer.scrollCursorIntoView();
},
- "Esc": function(ed) {
- ed.tabstopManager.detach();
- },
- "Return": function(ed) {
- return false;
+ "Esc": function(editor) {
+ editor.tabstopManager.detach();
}
});
}).call(TabstopManager.prototype);
@@ -2004,6 +2002,7 @@ dom.importCssString(cssText);
module.exports.overlayPage = function overlayPage(editor, contentElement, callback) {
var closer = document.createElement('div');
+ var ignoreFocusOut = false;
function documentEscListener(e) {
if (e.keyCode === 27) {
@@ -2015,17 +2014,28 @@ module.exports.overlayPage = function overlayPage(editor, contentElement, callba
if (!closer) return;
document.removeEventListener('keydown', documentEscListener);
closer.parentNode.removeChild(closer);
- editor.focus();
+ if (editor) {
+ editor.focus();
+ }
closer = null;
callback && callback();
}
+ function setIgnoreFocusOut(ignore) {
+ ignoreFocusOut = ignore;
+ if (ignore) {
+ closer.style.pointerEvents = "none";
+ contentElement.style.pointerEvents = "auto";
+ }
+ }
closer.style.cssText = 'margin: 0; padding: 0; ' +
'position: fixed; top:0; bottom:0; left:0; right:0;' +
'z-index: 9990; ' +
- 'background-color: rgba(0, 0, 0, 0.3);';
- closer.addEventListener('click', function() {
- close();
+ (editor ? 'background-color: rgba(0, 0, 0, 0.3);' : '');
+ closer.addEventListener('click', function(e) {
+ if (!ignoreFocusOut) {
+ close();
+ }
});
document.addEventListener('keydown', documentEscListener);
@@ -2035,9 +2045,12 @@ module.exports.overlayPage = function overlayPage(editor, contentElement, callba
closer.appendChild(contentElement);
document.body.appendChild(closer);
- editor.blur();
+ if (editor) {
+ editor.blur();
+ }
return {
- close: close
+ close: close,
+ setIgnoreFocusOut: setIgnoreFocusOut
};
};
@@ -2146,6 +2159,7 @@ var supportedModes = {
Jade: ["jade|pug"],
Java: ["java"],
JavaScript: ["js|jsm|jsx"],
+ JSON5: ["json5"],
JSON: ["json"],
JSONiq: ["jq"],
JSP: ["jsp"],
@@ -2176,6 +2190,7 @@ var supportedModes = {
Nix: ["nix"],
Nim: ["nim"],
NSIS: ["nsi|nsh"],
+ Nunjucks: ["nunjucks|nunjs|nj|njk"],
ObjectiveC: ["m|mm"],
OCaml: ["ml|mli"],
Pascal: ["pas|p"],
@@ -2305,14 +2320,18 @@ function prompt(editor, message, options, callback) {
var cmdLine = $singleLineEditor();
cmdLine.session.setUndoManager(new UndoManager());
- cmdLine.setOption("fontSize", editor.getOption("fontSize"));
- var el = dom.buildDom(["div", {class: "ace_prompt_container"}]);
+ var el = dom.buildDom(["div", {class: "ace_prompt_container" + (options.hasDescription ? " input-box-with-description" : "")}]);
var overlay = overlayPage(editor, el, done);
el.appendChild(cmdLine.container);
- editor.cmdLine = cmdLine;
- cmdLine.setValue(message, 1);
+ if (editor) {
+ editor.cmdLine = cmdLine;
+ cmdLine.setOption("fontSize", editor.getOption("fontSize"));
+ }
+ if (message) {
+ cmdLine.setValue(message, 1);
+ }
if (options.selection) {
cmdLine.selection.setRange({
start: cmdLine.session.doc.indexToPosition(options.selection[0]),
@@ -2348,14 +2367,26 @@ function prompt(editor, message, options, callback) {
cmdLine.session.bgTokenizer.setTokenizer(tokenizer);
}
+ if (options.placeholder) {
+ cmdLine.setOption("placeholder", options.placeholder);
+ }
+
+ if (options.hasDescription) {
+ var promptTextContainer = dom.buildDom(["div", {class: "ace_prompt_text_container"}]);
+ dom.buildDom(options.prompt || "Press 'Enter' to confirm or 'Escape' to cancel", promptTextContainer);
+ el.appendChild(promptTextContainer);
+ }
+
+ overlay.setIgnoreFocusOut(options.ignoreFocusOut);
+
function accept() {
var val;
- if (popup.getCursorPosition().row > 0) {
+ if (popup && popup.getCursorPosition().row > 0) {
val = valueFromRecentList();
} else {
val = cmdLine.getValue();
}
- var curData = popup.getData(popup.getRow());
+ var curData = popup ? popup.getData(popup.getRow()) : val;
if (curData && !curData.error) {
done();
options.onAccept && options.onAccept({
@@ -2365,22 +2396,29 @@ function prompt(editor, message, options, callback) {
}
}
- cmdLine.commands.bindKeys({
+ var keys = {
"Enter": accept,
"Esc|Shift-Esc": function() {
options.onCancel && options.onCancel(cmdLine.getValue(), cmdLine);
done();
- },
- "Up": function(editor) { popup.goTo("up"); valueFromRecentList();},
- "Down": function(editor) { popup.goTo("down"); valueFromRecentList();},
- "Ctrl-Up|Ctrl-Home": function(editor) { popup.goTo("start"); valueFromRecentList();},
- "Ctrl-Down|Ctrl-End": function(editor) { popup.goTo("end"); valueFromRecentList();},
- "Tab": function(editor) {
- popup.goTo("down"); valueFromRecentList();
- },
- "PageUp": function(editor) { popup.gotoPageUp(); valueFromRecentList();},
- "PageDown": function(editor) { popup.gotoPageDown(); valueFromRecentList();}
- });
+ }
+ };
+
+ if (popup) {
+ Object.assign(keys, {
+ "Up": function(editor) { popup.goTo("up"); valueFromRecentList();},
+ "Down": function(editor) { popup.goTo("down"); valueFromRecentList();},
+ "Ctrl-Up|Ctrl-Home": function(editor) { popup.goTo("start"); valueFromRecentList();},
+ "Ctrl-Down|Ctrl-End": function(editor) { popup.goTo("end"); valueFromRecentList();},
+ "Tab": function(editor) {
+ popup.goTo("down"); valueFromRecentList();
+ },
+ "PageUp": function(editor) { popup.gotoPageUp(); valueFromRecentList();},
+ "PageDown": function(editor) { popup.gotoPageDown(); valueFromRecentList();}
+ });
+ }
+
+ cmdLine.commands.bindKeys(keys);
function done() {
overlay.close();
@@ -2413,7 +2451,9 @@ function prompt(editor, message, options, callback) {
}
cmdLine.resize(true);
- popup.resize(true);
+ if (popup) {
+ popup.resize(true);
+ }
cmdLine.focus();
openPrompt = {
diff --git a/htdocs/includes/ace/src/ext-settings_menu.js b/htdocs/includes/ace/src/ext-settings_menu.js
index d10afac8f34..ebfa4108519 100644
--- a/htdocs/includes/ace/src/ext-settings_menu.js
+++ b/htdocs/includes/ace/src/ext-settings_menu.js
@@ -65,6 +65,7 @@ dom.importCssString(cssText);
module.exports.overlayPage = function overlayPage(editor, contentElement, callback) {
var closer = document.createElement('div');
+ var ignoreFocusOut = false;
function documentEscListener(e) {
if (e.keyCode === 27) {
@@ -76,17 +77,28 @@ module.exports.overlayPage = function overlayPage(editor, contentElement, callba
if (!closer) return;
document.removeEventListener('keydown', documentEscListener);
closer.parentNode.removeChild(closer);
- editor.focus();
+ if (editor) {
+ editor.focus();
+ }
closer = null;
callback && callback();
}
+ function setIgnoreFocusOut(ignore) {
+ ignoreFocusOut = ignore;
+ if (ignore) {
+ closer.style.pointerEvents = "none";
+ contentElement.style.pointerEvents = "auto";
+ }
+ }
closer.style.cssText = 'margin: 0; padding: 0; ' +
'position: fixed; top:0; bottom:0; left:0; right:0;' +
'z-index: 9990; ' +
- 'background-color: rgba(0, 0, 0, 0.3);';
- closer.addEventListener('click', function() {
- close();
+ (editor ? 'background-color: rgba(0, 0, 0, 0.3);' : '');
+ closer.addEventListener('click', function(e) {
+ if (!ignoreFocusOut) {
+ close();
+ }
});
document.addEventListener('keydown', documentEscListener);
@@ -96,9 +108,12 @@ module.exports.overlayPage = function overlayPage(editor, contentElement, callba
closer.appendChild(contentElement);
document.body.appendChild(closer);
- editor.blur();
+ if (editor) {
+ editor.blur();
+ }
return {
- close: close
+ close: close,
+ setIgnoreFocusOut: setIgnoreFocusOut
};
};
@@ -207,6 +222,7 @@ var supportedModes = {
Jade: ["jade|pug"],
Java: ["java"],
JavaScript: ["js|jsm|jsx"],
+ JSON5: ["json5"],
JSON: ["json"],
JSONiq: ["jq"],
JSP: ["jsp"],
@@ -237,6 +253,7 @@ var supportedModes = {
Nix: ["nix"],
Nim: ["nim"],
NSIS: ["nsi|nsh"],
+ Nunjucks: ["nunjucks|nunjs|nj|njk"],
ObjectiveC: ["m|mm"],
OCaml: ["ml|mli"],
Pascal: ["pas|p"],
@@ -396,9 +413,9 @@ exports.themes = themeData.map(function(data) {
define("ace/ext/options",["require","exports","module","ace/ext/menu_tools/overlay_page","ace/lib/dom","ace/lib/oop","ace/config","ace/lib/event_emitter","ace/ext/modelist","ace/ext/themelist"], function(require, exports, module) {
"use strict";
-var overlayPage = require('./menu_tools/overlay_page').overlayPage;
-
+require("./menu_tools/overlay_page");
+
var dom = require("../lib/dom");
var oop = require("../lib/oop");
var config = require("../config");
@@ -437,7 +454,8 @@ var optionGroups = {
{ caption : "Ace", value : null },
{ caption : "Vim", value : "ace/keyboard/vim" },
{ caption : "Emacs", value : "ace/keyboard/emacs" },
- { caption : "Sublime", value : "ace/keyboard/sublime" }
+ { caption : "Sublime", value : "ace/keyboard/sublime" },
+ { caption : "VSCode", value : "ace/keyboard/vscode" }
]
},
"Font Size": {
diff --git a/htdocs/includes/ace/src/ext-spellcheck.js b/htdocs/includes/ace/src/ext-spellcheck.js
index 6f5af5049d7..10d3901f49f 100644
--- a/htdocs/includes/ace/src/ext-spellcheck.js
+++ b/htdocs/includes/ace/src/ext-spellcheck.js
@@ -28,7 +28,6 @@ exports.contextMenuHandler = function(e){
});
host.textInput.setInputHandler(function(newVal) {
- console.log(newVal , value, text.selectionStart, text.selectionEnd);
if (newVal == value)
return '';
if (newVal.lastIndexOf(value, 0) === 0)
diff --git a/htdocs/includes/ace/src/keybinding-emacs.js b/htdocs/includes/ace/src/keybinding-emacs.js
index 960ff734b3d..58e79cd44fc 100644
--- a/htdocs/includes/ace/src/keybinding-emacs.js
+++ b/htdocs/includes/ace/src/keybinding-emacs.js
@@ -548,8 +548,6 @@ function objectToRegExp(obj) {
if (this.$editor.showCommandLine) {
this.$editor.showCommandLine(msg);
this.$editor.focus();
- } else {
- console.log(msg);
}
};
diff --git a/htdocs/includes/ace/src/keybinding-sublime.js b/htdocs/includes/ace/src/keybinding-sublime.js
index e34735b2ae0..21fcb3803c6 100644
--- a/htdocs/includes/ace/src/keybinding-sublime.js
+++ b/htdocs/includes/ace/src/keybinding-sublime.js
@@ -1,9 +1,6 @@
-define("ace/keyboard/sublime",["require","exports","module","ace/lib/keys","ace/lib/oop","ace/lib/useragent","ace/keyboard/hash_handler"], function(require, exports, module) {
+define("ace/keyboard/sublime",["require","exports","module","ace/keyboard/hash_handler"], function(require, exports, module) {
"use strict";
-var keyUtil = require("../lib/keys");
-var oop = require("../lib/oop");
-var useragent = require("../lib/useragent");
var HashHandler = require("../keyboard/hash_handler").HashHandler;
function moveBySubWords(editor, direction, extend) {
@@ -373,7 +370,7 @@ exports.handler.addCommands([{
},
{
bindKey: { mac: "cmd-shift-l", win: "ctrl-shift-l" },
- name: "splitIntoLines"
+ name: "splitSelectionIntoLines"
}, {
bindKey: { mac: "ctrl-cmd-down", win: "ctrl-shift-down" },
name: "movelinesdown"
diff --git a/htdocs/includes/ace/src/keybinding-vim.js b/htdocs/includes/ace/src/keybinding-vim.js
index 889c2269ac7..79761280e93 100644
--- a/htdocs/includes/ace/src/keybinding-vim.js
+++ b/htdocs/includes/ace/src/keybinding-vim.js
@@ -435,6 +435,7 @@ define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/eve
if (!e) e = s;
return this.ace.session.replace(new Range(s.line, s.ch, e.line, e.ch), text);
};
+ this.replaceSelection =
this.replaceSelections = function(p) {
var sel = this.ace.selection;
if (this.ace.inVirtualSelectionMode) {
@@ -846,6 +847,8 @@ dom.importCssString(".normal-mode .ace_cursor{\
{ keys: '', type: 'keyToKey', toKeys: '' },
{ keys: '', type: 'keyToKey', toKeys: '', context: 'insert' },
{ keys: '', type: 'keyToKey', toKeys: '', context: 'insert' },
+ { keys: '', type: 'keyToKey', toKeys: '' }, // ace_patch ipad keyboard sends C-Esc instead of C-[
+ { keys: '', type: 'keyToKey', toKeys: '', context: 'insert' },
{ keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' },
{ keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual'},
{ keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' },
@@ -940,7 +943,9 @@ dom.importCssString(".normal-mode .ace_cursor{\
{ keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'eol' }, context: 'normal' },
{ keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'endOfSelectedArea' }, context: 'visual' },
{ keys: 'i', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'inplace' }, context: 'normal' },
+ { keys: 'gi', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'lastEdit' }, context: 'normal' },
{ keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'firstNonBlank'}, context: 'normal' },
+ { keys: 'gI', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'bol'}, context: 'normal' },
{ keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'startOfSelectedArea' }, context: 'visual' },
{ keys: 'o', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: true }, context: 'normal' },
{ keys: 'O', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: false }, context: 'normal' },
@@ -950,6 +955,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
{ keys: '', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }},
{ keys: 'gv', type: 'action', action: 'reselectLastSelection' },
{ keys: 'J', type: 'action', action: 'joinLines', isEdit: true },
+ { keys: 'gJ', type: 'action', action: 'joinLines', actionArgs: { keepSpaces: true }, isEdit: true },
{ keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true }},
{ keys: 'P', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true }},
{ keys: 'r', type: 'action', action: 'replace', isEdit: true },
@@ -1026,7 +1032,6 @@ dom.importCssString(".normal-mode .ace_cursor{\
CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm));
cm.state.vim = null;
}
-
function detachVimMap(cm, next) {
if (this == CodeMirror.keyMap.vim)
CodeMirror.rmClass(cm.getWrapperElement(), "cm-fat-cursor");
@@ -1296,9 +1301,16 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
return mark;
}
+ function find(cm, offset) {
+ var oldPointer = pointer;
+ var mark = move(cm, offset);
+ pointer = oldPointer;
+ return mark && mark.find();
+ }
return {
cachedCursor: undefined, //used for # and * jumps
add: add,
+ find: find,
move: move
};
};
@@ -1943,6 +1955,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
});
}
function onPromptClose(query) {
+ cm.scrollTo(originalScrollPos.left, originalScrollPos.top);
handleQuery(query, true /** ignoreCase */, true /** smartCase */);
var macroModeState = vimGlobalState.macroModeState;
if (macroModeState.isRecording) {
@@ -2514,7 +2527,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
}
if (ch < lineText.length) {
- var re = /[<>]/.test(lineText[ch]) ? /[(){}[\]<>]/ : /[(){}[\]]/;
+ var re = /[<>]/.test(lineText[ch]) ? /[(){}[\]<>]/ : /[(){}[\]]/; //ace_patch?
var matched = cm.findMatchingBracket(Pos(line, ch+1), {bracketRegex: re});
return matched.to;
} else {
@@ -2643,8 +2656,8 @@ dom.importCssString(".normal-mode .ace_cursor{\
head.line--;
cm.setSelection(anchor, head)
text = cm.getSelection();
- cm.replaceSelections("");
- finalHead = anchor
+ cm.replaceSelection("");
+ finalHead = anchor;
} else {
text = cm.getSelection();
var replacement = fillArray('', ranges.length);
@@ -2864,6 +2877,8 @@ dom.importCssString(".normal-mode .ace_cursor{\
var height = cm.listSelections().length;
if (insertAt == 'eol') {
head = Pos(head.line, lineLength(cm, head.line));
+ } else if (insertAt == 'bol') {
+ head = Pos(head.line, 0);
} else if (insertAt == 'charAfter') {
head = offsetCursor(head, 0, 1);
} else if (insertAt == 'firstNonBlank') {
@@ -2902,6 +2917,8 @@ dom.importCssString(".normal-mode .ace_cursor{\
if (vim.visualMode){
return;
}
+ } else if (insertAt == 'lastEdit') {
+ head = getLastEditPos(cm) || head;
}
cm.setOption('disableInput', false);
if (actionArgs && actionArgs.replace) {
@@ -3001,7 +3018,9 @@ dom.importCssString(".normal-mode .ace_cursor{\
var tmp = Pos(curStart.line + 1,
lineLength(cm, curStart.line + 1));
var text = cm.getRange(curStart, tmp);
- text = text.replace(/\n\s*/g, ' ');
+ text = actionArgs.keepSpaces
+ ? text.replace(/\n\r?/g, '')
+ : text.replace(/\n\s*/g, ' ');
cm.replaceRange(text, curStart, tmp);
}
var curFinalPos = Pos(curStart.line, finalCh);
@@ -4583,11 +4602,22 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
function getMarkPos(cm, vim, markName) {
+ if (markName == '\'' || markName == '`') {
+ return vimGlobalState.jumpList.find(cm, -1) || Pos(0, 0);
+ } else if (markName == '.') {
+ return getLastEditPos(cm);
+ }
var mark = vim.marks[markName];
return mark && mark.find();
}
+ function getLastEditPos(cm) {
+ var undoManager = cm.ace.session.$undoManager;
+ if (undoManager && undoManager.$lastDelta)
+ return toCmPos(undoManager.$lastDelta.end);
+ }
+
var ExCommandDispatcher = function() {
this.buildCommandMap_();
};
@@ -5068,6 +5098,9 @@ dom.importCssString(".normal-mode .ace_cursor{\
var global = false; // True to replace all instances on a line, false to replace only 1.
if (tokens.length) {
regexPart = tokens[0];
+ if (getOption('pcre') && regexPart !== '') {
+ regexPart = new RegExp(regexPart).source; //normalize not escaped characters
+ }
replacePart = tokens[1];
if (regexPart && regexPart[regexPart.length - 1] === '$') {
regexPart = regexPart.slice(0, regexPart.length - 1) + '\\n';
@@ -5075,7 +5108,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
}
if (replacePart !== undefined) {
if (getOption('pcre')) {
- replacePart = unescapeRegexReplace(replacePart);
+ replacePart = unescapeRegexReplace(replacePart.replace(/([^\\])&/g,"$1$$&"));
} else {
replacePart = translateRegexReplace(replacePart);
}
@@ -5101,7 +5134,11 @@ dom.importCssString(".normal-mode .ace_cursor{\
global = true;
flagsPart.replace('g', '');
}
- regexPart = regexPart.replace(/\//g, "\\/") + '/' + flagsPart;
+ if (getOption('pcre')) {
+ regexPart = regexPart + '/' + flagsPart;
+ } else {
+ regexPart = regexPart.replace(/\//g, "\\/") + '/' + flagsPart;
+ }
}
}
if (regexPart) {
diff --git a/htdocs/includes/ace/src/keybinding-vscode.js b/htdocs/includes/ace/src/keybinding-vscode.js
new file mode 100644
index 00000000000..45ac5cf03ff
--- /dev/null
+++ b/htdocs/includes/ace/src/keybinding-vscode.js
@@ -0,0 +1,262 @@
+define("ace/keyboard/vscode",["require","exports","module","ace/keyboard/hash_handler","ace/config"], function(require, exports, module) {
+"use strict";
+
+var HashHandler = require("../keyboard/hash_handler").HashHandler;
+var config = require("../config");
+
+exports.handler = new HashHandler();
+exports.handler.$id = "ace/keyboard/vscode";
+
+exports.handler.addCommands([{
+ name: "toggleWordWrap",
+ exec: function(editor) {
+ var wrapUsed = editor.session.getUseWrapMode();
+ editor.session.setUseWrapMode(!wrapUsed);
+ },
+ readOnly: true
+}, {
+ name: "navigateToLastEditLocation",
+ exec: function(editor) {
+ var lastDelta = editor.session.getUndoManager().$lastDelta;
+ var range = (lastDelta.action == "remove")? lastDelta.start: lastDelta.end;
+ editor.moveCursorTo(range.row, range.column);
+ editor.clearSelection();
+ }
+}, {
+ name: "replaceAll",
+ exec: function (editor) {
+ if (!editor.searchBox) {
+ config.loadModule("ace/ext/searchbox", function(e) {
+ e.Search(editor, true);
+ });
+ } else {
+ if (editor.searchBox.active === true && editor.searchBox.replaceOption.checked === true) {
+ editor.searchBox.replaceAll();
+ }
+ }
+ }
+}, {
+ name: "replaceOne",
+ exec: function (editor) {
+ if (!editor.searchBox) {
+ config.loadModule("ace/ext/searchbox", function(e) {
+ e.Search(editor, true);
+ });
+ } else {
+ if (editor.searchBox.active === true && editor.searchBox.replaceOption.checked === true) {
+ editor.searchBox.replace();
+ }
+ }
+ }
+}, {
+ name: "selectAllMatches",
+ exec: function (editor) {
+ if (!editor.searchBox) {
+ config.loadModule("ace/ext/searchbox", function(e) {
+ e.Search(editor, false);
+ });
+ } else {
+ if (editor.searchBox.active === true) {
+ editor.searchBox.findAll();
+ }
+ }
+ }
+}, {
+ name: "toggleFindCaseSensitive",
+ exec: function (editor) {
+ config.loadModule("ace/ext/searchbox", function(e) {
+ e.Search(editor, false);
+ var sb = editor.searchBox;
+ sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked;
+ sb.$syncOptions();
+ });
+
+ }
+}, {
+ name: "toggleFindInSelection",
+ exec: function (editor) {
+ config.loadModule("ace/ext/searchbox", function(e) {
+ e.Search(editor, false);
+ var sb = editor.searchBox;
+ sb.searchOption.checked = !sb.searchRange;
+ sb.setSearchRange(sb.searchOption.checked && sb.editor.getSelectionRange());
+ sb.$syncOptions();
+ });
+ }
+}, {
+ name: "toggleFindRegex",
+ exec: function (editor) {
+ config.loadModule("ace/ext/searchbox", function(e) {
+ e.Search(editor, false);
+ var sb = editor.searchBox;
+ sb.regExpOption.checked = !sb.regExpOption.checked;
+ sb.$syncOptions();
+ });
+ }
+}, {
+ name: "toggleFindWholeWord",
+ exec: function (editor) {
+ config.loadModule("ace/ext/searchbox", function(e) {
+ e.Search(editor, false);
+ var sb = editor.searchBox;
+ sb.wholeWordOption.checked = !sb.wholeWordOption.checked;
+ sb.$syncOptions();
+ });
+ }
+}, {
+ name: "removeSecondaryCursors",
+ exec: function (editor) {
+ var ranges = editor.selection.ranges;
+ if (ranges && ranges.length > 1)
+ editor.selection.toSingleRange(ranges[ranges.length - 1]);
+ else
+ editor.selection.clearSelection();
+ }
+}]);
+
+
+[{
+ bindKey: {mac: "Control-G", win: "Ctrl-G"},
+ name: "gotoline"
+}, {
+ bindKey: {mac: "Command-Shift-L|Command-F2", win: "Ctrl-Shift-L|Ctrl-F2"},
+ name: "findAll"
+}, {
+ bindKey: {mac: "Shift-F8|Shift-Option-F8", win: "Shift-F8|Shift-Alt-F8"},
+ name: "goToPreviousError"
+}, {
+ bindKey: {mac: "F8|Option-F8", win: "F8|Alt-F8"},
+ name: "goToNextError"
+}, {
+ bindKey: {mac: "Command-Shift-P|F1", win: "Ctrl-Shift-P|F1"},
+ name: "openCommandPallete"
+}, {
+ bindKey: {mac: "Command-K|Command-S", win: "Ctrl-K|Ctrl-S"},
+ name: "showKeyboardShortcuts"
+}, {
+ bindKey: {mac: "Shift-Option-Up", win: "Alt-Shift-Up"},
+ name: "copylinesup"
+}, {
+ bindKey: {mac: "Shift-Option-Down", win: "Alt-Shift-Down"},
+ name: "copylinesdown"
+}, {
+ bindKey: {mac: "Command-Shift-K", win: "Ctrl-Shift-K"},
+ name: "removeline"
+}, {
+ bindKey: {mac: "Command-Enter", win: "Ctrl-Enter"},
+ name: "addLineAfter"
+}, {
+ bindKey: {mac: "Command-Shift-Enter", win: "Ctrl-Shift-Enter"},
+ name: "addLineBefore"
+}, {
+ bindKey: {mac: "Command-Shift-\\", win: "Ctrl-Shift-\\"},
+ name: "jumptomatching"
+}, {
+ bindKey: {mac: "Command-]", win: "Ctrl-]"},
+ name: "blockindent"
+}, {
+ bindKey: {mac: "Command-[", win: "Ctrl-["},
+ name: "blockoutdent"
+}, {
+ bindKey: {mac: "Control-PageDown", win: "Alt-PageDown"},
+ name: "pagedown"
+}, {
+ bindKey: {mac: "Control-PageUp", win: "Alt-PageUp"},
+ name: "pageup"
+}, {
+ bindKey: {mac: "Shift-Option-A", win: "Shift-Alt-A"},
+ name: "toggleBlockComment"
+}, {
+ bindKey: {mac: "Option-Z", win: "Alt-Z"},
+ name: "toggleWordWrap"
+}, {
+ bindKey: {mac: "Command-G", win: "F3|Ctrl-K Ctrl-D"},
+ name: "findnext"
+}, {
+ bindKey: {mac: "Command-Shift-G", win: "Shift-F3"},
+ name: "findprevious"
+}, {
+ bindKey: {mac: "Option-Enter", win: "Alt-Enter"},
+ name: "selectAllMatches"
+}, {
+ bindKey: {mac: "Command-D", win: "Ctrl-D"},
+ name: "selectMoreAfter"
+}, {
+ bindKey: {mac: "Command-K Command-D", win: "Ctrl-K Ctrl-D"},
+ name: "selectOrFindNext"
+}, {
+ bindKey: {mac: "Shift-Option-I", win: "Shift-Alt-I"},
+ name: "splitSelectionIntoLines"
+}, {
+ bindKey: {mac: "Command-K M", win: "Ctrl-K M"},
+ name: "modeSelect"
+}, {
+ bindKey: {mac: "Command-Option-[", win: "Ctrl-Shift-["},
+ name: "toggleFoldWidget"
+}, {
+ bindKey: {mac: "Command-Option-]", win: "Ctrl-Shift-]"},
+ name: "toggleFoldWidget"
+}, {
+ bindKey: {mac: "Command-K Command-0", win: "Ctrl-K Ctrl-0"},
+ name: "foldall"
+}, {
+ bindKey: {mac: "Command-K Command-J", win: "Ctrl-K Ctrl-J"},
+ name: "unfoldall"
+}, {
+ bindKey: { mac: "Command-K Command-1", win: "Ctrl-K Ctrl-1" },
+ name: "foldOther"
+}, {
+ bindKey: { mac: "Command-K Command-Q", win: "Ctrl-K Ctrl-Q" },
+ name: "navigateToLastEditLocation"
+}, {
+ bindKey: { mac: "Command-K Command-R|Command-K Command-S", win: "Ctrl-K Ctrl-R|Ctrl-K Ctrl-S" },
+ name: "showKeyboardShortcuts"
+}, {
+ bindKey: { mac: "Command-K Command-X", win: "Ctrl-K Ctrl-X" },
+ name: "trimTrailingSpace"
+}, {
+ bindKey: {mac: "Shift-Down|Command-Shift-Down", win: "Shift-Down|Ctrl-Shift-Down"},
+ name: "selectdown"
+}, {
+ bindKey: {mac: "Shift-Up|Command-Shift-Up", win: "Shift-Up|Ctrl-Shift-Up"},
+ name: "selectup"
+}, {
+ bindKey: {mac: "Command-Alt-Enter", win: "Ctrl-Alt-Enter"},
+ name: "replaceAll"
+}, {
+ bindKey: {mac: "Command-Shift-1", win: "Ctrl-Shift-1"},
+ name: "replaceOne"
+}, {
+ bindKey: {mac: "Option-C", win: "Alt-C"},
+ name: "toggleFindCaseSensitive"
+}, {
+ bindKey: {mac: "Option-L", win: "Alt-L"},
+ name: "toggleFindInSelection"
+}, {
+ bindKey: {mac: "Option-R", win: "Alt-R"},
+ name: "toggleFindRegex"
+}, {
+ bindKey: {mac: "Option-W", win: "Alt-W"},
+ name: "toggleFindWholeWord"
+}, {
+ bindKey: {mac: "Command-L", win: "Ctrl-L"},
+ name: "expandtoline"
+}, {
+ bindKey: {mac: "Shift-Esc", win: "Shift-Esc"},
+ name: "removeSecondaryCursors"
+}
+].forEach(function(binding) {
+ var command = exports.handler.commands[binding.name];
+ if (command)
+ command.bindKey = binding.bindKey;
+ exports.handler.bindKey(binding.bindKey, command || binding.name);
+});
+
+}); (function() {
+ window.require(["ace/keyboard/vscode"], function(m) {
+ if (typeof module == "object" && typeof exports == "object" && module) {
+ module.exports = m;
+ }
+ });
+ })();
+
\ No newline at end of file
diff --git a/htdocs/includes/ace/src/mode-csound_document.js b/htdocs/includes/ace/src/mode-csound_document.js
index b4495c6892f..ae92fce17e1 100644
--- a/htdocs/includes/ace/src/mode-csound_document.js
+++ b/htdocs/includes/ace/src/mode-csound_document.js
@@ -1146,6 +1146,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"ampdb",
"ampdbfs",
"ampmidi",
+ "ampmidicurve",
"ampmidid",
"areson",
"aresonk",
@@ -1194,7 +1195,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"ceps",
"cepsinv",
"chanctrl",
- "changed",
"changed2",
"chani",
"chano",
@@ -1363,6 +1363,17 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"flooper",
"flooper2",
"floor",
+ "fluidAllOut",
+ "fluidCCi",
+ "fluidCCk",
+ "fluidControl",
+ "fluidEngine",
+ "fluidInfo",
+ "fluidLoad",
+ "fluidNote",
+ "fluidOut",
+ "fluidProgramSelect",
+ "fluidSetInterpMethod",
"fmanal",
"fmax",
"fmb3",
@@ -1437,6 +1448,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"grain2",
"grain3",
"granule",
+ "gtf",
"guiro",
"harmon",
"harmon2",
@@ -1845,6 +1857,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"nsamp",
"nstance",
"nstrnum",
+ "nstrstr",
+ "ntof",
"ntom",
"ntrpol",
"nxtpow2",
@@ -1975,7 +1989,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"ptable",
"ptable3",
"ptablei",
- "ptableiw",
"ptablew",
"ptrack",
"puts",
@@ -2282,6 +2295,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"strget",
"strindex",
"strindexk",
+ "string2array",
"strlen",
"strlenk",
"strlower",
@@ -2325,7 +2339,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"tableigpw",
"tableikt",
"tableimix",
- "tableiw",
"tablekt",
"tablemix",
"tableng",
@@ -2533,6 +2546,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"array",
"bformdec",
"bformenc",
+ "changed",
"copy2ftab",
"copy2ttab",
"hrtfer",
@@ -2542,6 +2556,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"mintab",
"pop",
"pop_f",
+ "ptableiw",
"push",
"push_f",
"scalet",
@@ -2560,6 +2575,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"stack",
"sumtab",
"tabgen",
+ "tableiw",
"tabmap",
"tabmap_i",
"tabslice",
diff --git a/htdocs/includes/ace/src/mode-csound_orchestra.js b/htdocs/includes/ace/src/mode-csound_orchestra.js
index 7f1a60442aa..7cb3917c9f4 100644
--- a/htdocs/includes/ace/src/mode-csound_orchestra.js
+++ b/htdocs/includes/ace/src/mode-csound_orchestra.js
@@ -1146,6 +1146,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"ampdb",
"ampdbfs",
"ampmidi",
+ "ampmidicurve",
"ampmidid",
"areson",
"aresonk",
@@ -1194,7 +1195,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"ceps",
"cepsinv",
"chanctrl",
- "changed",
"changed2",
"chani",
"chano",
@@ -1363,6 +1363,17 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"flooper",
"flooper2",
"floor",
+ "fluidAllOut",
+ "fluidCCi",
+ "fluidCCk",
+ "fluidControl",
+ "fluidEngine",
+ "fluidInfo",
+ "fluidLoad",
+ "fluidNote",
+ "fluidOut",
+ "fluidProgramSelect",
+ "fluidSetInterpMethod",
"fmanal",
"fmax",
"fmb3",
@@ -1437,6 +1448,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"grain2",
"grain3",
"granule",
+ "gtf",
"guiro",
"harmon",
"harmon2",
@@ -1845,6 +1857,8 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"nsamp",
"nstance",
"nstrnum",
+ "nstrstr",
+ "ntof",
"ntom",
"ntrpol",
"nxtpow2",
@@ -1975,7 +1989,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"ptable",
"ptable3",
"ptablei",
- "ptableiw",
"ptablew",
"ptrack",
"puts",
@@ -2282,6 +2295,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"strget",
"strindex",
"strindexk",
+ "string2array",
"strlen",
"strlenk",
"strlower",
@@ -2325,7 +2339,6 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"tableigpw",
"tableikt",
"tableimix",
- "tableiw",
"tablekt",
"tablemix",
"tableng",
@@ -2533,6 +2546,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"array",
"bformdec",
"bformenc",
+ "changed",
"copy2ftab",
"copy2ttab",
"hrtfer",
@@ -2542,6 +2556,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"mintab",
"pop",
"pop_f",
+ "ptableiw",
"push",
"push_f",
"scalet",
@@ -2560,6 +2575,7 @@ var CsoundOrchestraHighlightRules = function(embeddedRulePrefix) {
"stack",
"sumtab",
"tabgen",
+ "tableiw",
"tabmap",
"tabmap_i",
"tabslice",
diff --git a/htdocs/includes/ace/src/mode-jade.js b/htdocs/includes/ace/src/mode-jade.js
index 51c796d73f2..5c3488944ce 100644
--- a/htdocs/includes/ace/src/mode-jade.js
+++ b/htdocs/includes/ace/src/mode-jade.js
@@ -1083,7 +1083,7 @@ var MarkdownHighlightRules = function() {
next : "blockquote"
}, { // HR * - _
token : "constant",
- regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$",
+ regex : "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
next: "allowBlock"
}, { // list
token : "markup.list",
diff --git a/htdocs/includes/ace/src/mode-json5.js b/htdocs/includes/ace/src/mode-json5.js
new file mode 100644
index 00000000000..539fd2f2160
--- /dev/null
+++ b/htdocs/includes/ace/src/mode-json5.js
@@ -0,0 +1,360 @@
+define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var JsonHighlightRules = function() {
+ this.$rules = {
+ "start" : [
+ {
+ token : "variable", // single line
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'
+ }, {
+ token : "string", // single line
+ regex : '"',
+ next : "string"
+ }, {
+ token : "constant.numeric", // hex
+ regex : "0[xX][0-9a-fA-F]+\\b"
+ }, {
+ token : "constant.numeric", // float
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+ }, {
+ token : "constant.language.boolean",
+ regex : "(?:true|false)\\b"
+ }, {
+ token : "text", // single quoted strings are not allowed
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+ }, {
+ token : "comment", // comments are not allowed, but who cares?
+ regex : "\\/\\/.*$"
+ }, {
+ token : "comment.start", // comments are not allowed, but who cares?
+ regex : "\\/\\*",
+ next : "comment"
+ }, {
+ token : "paren.lparen",
+ regex : "[[({]"
+ }, {
+ token : "paren.rparen",
+ regex : "[\\])}]"
+ }, {
+ token : "text",
+ regex : "\\s+"
+ }
+ ],
+ "string" : [
+ {
+ token : "constant.language.escape",
+ regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/
+ }, {
+ token : "string",
+ regex : '"|$',
+ next : "start"
+ }, {
+ defaultToken : "string"
+ }
+ ],
+ "comment" : [
+ {
+ token : "comment.end", // comments are not allowed, but who cares?
+ regex : "\\*\\/",
+ next : "start"
+ }, {
+ defaultToken: "comment"
+ }
+ ]
+ };
+
+};
+
+oop.inherits(JsonHighlightRules, TextHighlightRules);
+
+exports.JsonHighlightRules = JsonHighlightRules;
+});
+
+define("ace/mode/json5_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/json_highlight_rules"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var JsonHighlightRules = require("./json_highlight_rules").JsonHighlightRules;
+
+var Json5HighlightRules = function() {
+ JsonHighlightRules.call(this);
+
+ var startRules = [{
+ token : "variable",
+ regex : /[a-zA-Z$_\u00a1-\uffff][\w$\u00a1-\uffff]*\s*(?=:)/
+ }, {
+ token : "variable",
+ regex : /['](?:(?:\\.)|(?:[^'\\]))*?[']\s*(?=:)/
+ }, {
+ token : "constant.language.boolean",
+ regex : /(?:null)\b/
+ }, {
+ token : "string",
+ regex : /'/,
+ next : [{
+ token : "constant.language.escape",
+ regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\/bfnrt]|$)/,
+ consumeLineEnd : true
+ }, {
+ token : "string",
+ regex : /'|$/,
+ next : "start"
+ }, {
+ defaultToken : "string"
+ }]
+ }, {
+ token : "string",
+ regex : /"(?![^"]*":)/,
+ next : [{
+ token : "constant.language.escape",
+ regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\/bfnrt]|$)/,
+ consumeLineEnd : true
+ }, {
+ token : "string",
+ regex : /"|$/,
+ next : "start"
+ }, {
+ defaultToken : "string"
+ }]
+ }, {
+ token : "constant.numeric",
+ regex : /[+-]?(?:Infinity|NaN)\b/
+ }];
+
+ for (var key in this.$rules)
+ this.$rules[key].unshift.apply(this.$rules[key], startRules);
+
+ this.normalizeRules();
+};
+
+oop.inherits(Json5HighlightRules, JsonHighlightRules);
+
+exports.Json5HighlightRules = Json5HighlightRules;
+});
+
+define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
+"use strict";
+
+var Range = require("../range").Range;
+
+var MatchingBraceOutdent = function() {};
+
+(function() {
+
+ this.checkOutdent = function(line, input) {
+ if (! /^\s+$/.test(line))
+ return false;
+
+ return /^\s*\}/.test(input);
+ };
+
+ this.autoOutdent = function(doc, row) {
+ var line = doc.getLine(row);
+ var match = line.match(/^(\s*\})/);
+
+ if (!match) return 0;
+
+ var column = match[1].length;
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
+
+ if (!openBracePos || openBracePos.row == row) return 0;
+
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
+ doc.replace(new Range(row, 0, row, column-1), indent);
+ };
+
+ this.$getIndent = function(line) {
+ return line.match(/^\s*/)[0];
+ };
+
+}).call(MatchingBraceOutdent.prototype);
+
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
+});
+
+define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Range = require("../../range").Range;
+var BaseFoldMode = require("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function(commentRegex) {
+ if (commentRegex) {
+ this.foldingStartMarker = new RegExp(
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
+ );
+ this.foldingStopMarker = new RegExp(
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
+ );
+ }
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+ this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
+ this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
+ this._getFoldWidgetBase = this.getFoldWidget;
+ this.getFoldWidget = function(session, foldStyle, row) {
+ var line = session.getLine(row);
+
+ if (this.singleLineBlockCommentRe.test(line)) {
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
+ return "";
+ }
+
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
+
+ if (!fw && this.startRegionRe.test(line))
+ return "start"; // lineCommentRegionStart
+
+ return fw;
+ };
+
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
+ var line = session.getLine(row);
+
+ if (this.startRegionRe.test(line))
+ return this.getCommentRegionBlock(session, line, row);
+
+ var match = line.match(this.foldingStartMarker);
+ if (match) {
+ var i = match.index;
+
+ if (match[1])
+ return this.openingBracketBlock(session, match[1], row, i);
+
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
+
+ if (range && !range.isMultiLine()) {
+ if (forceMultiline) {
+ range = this.getSectionRange(session, row);
+ } else if (foldStyle != "all")
+ range = null;
+ }
+
+ return range;
+ }
+
+ if (foldStyle === "markbegin")
+ return;
+
+ var match = line.match(this.foldingStopMarker);
+ if (match) {
+ var i = match.index + match[0].length;
+
+ if (match[1])
+ return this.closingBracketBlock(session, match[1], row, i);
+
+ return session.getCommentFoldRange(row, i, -1);
+ }
+ };
+
+ this.getSectionRange = function(session, row) {
+ var line = session.getLine(row);
+ var startIndent = line.search(/\S/);
+ var startRow = row;
+ var startColumn = line.length;
+ row = row + 1;
+ var endRow = row;
+ var maxRow = session.getLength();
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var indent = line.search(/\S/);
+ if (indent === -1)
+ continue;
+ if (startIndent > indent)
+ break;
+ var subRange = this.getFoldWidgetRange(session, "all", row);
+
+ if (subRange) {
+ if (subRange.start.row <= startRow) {
+ break;
+ } else if (subRange.isMultiLine()) {
+ row = subRange.end.row;
+ } else if (startIndent == indent) {
+ break;
+ }
+ }
+ endRow = row;
+ }
+
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
+ };
+ this.getCommentRegionBlock = function(session, line, row) {
+ var startColumn = line.search(/\s*$/);
+ var maxRow = session.getLength();
+ var startRow = row;
+
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
+ var depth = 1;
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var m = re.exec(line);
+ if (!m) continue;
+ if (m[1]) depth--;
+ else depth++;
+
+ if (!depth) break;
+ }
+
+ var endRow = row;
+ if (endRow > startRow) {
+ return new Range(startRow, startColumn, endRow, line.length);
+ }
+ };
+
+}).call(FoldMode.prototype);
+
+});
+
+define("ace/mode/json5",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json5_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var HighlightRules = require("./json5_highlight_rules").Json5HighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+ this.HighlightRules = HighlightRules;
+ this.$outdent = new MatchingBraceOutdent();
+ this.$behaviour = new CstyleBehaviour();
+ this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+ this.lineCommentStart = "//";
+ this.blockComment = {start: "/*", end: "*/"};
+
+ this.checkOutdent = function(state, line, input) {
+ return this.$outdent.checkOutdent(line, input);
+ };
+
+ this.autoOutdent = function(state, doc, row) {
+ this.$outdent.autoOutdent(doc, row);
+ };
+
+ this.$id = "ace/mode/json5";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+}); (function() {
+ window.require(["ace/mode/json5"], function(m) {
+ if (typeof module == "object" && typeof exports == "object" && module) {
+ module.exports = m;
+ }
+ });
+ })();
+
\ No newline at end of file
diff --git a/htdocs/includes/ace/src/mode-markdown.js b/htdocs/includes/ace/src/mode-markdown.js
index 380fab69915..ac4072175ec 100644
--- a/htdocs/includes/ace/src/mode-markdown.js
+++ b/htdocs/includes/ace/src/mode-markdown.js
@@ -2625,7 +2625,7 @@ var MarkdownHighlightRules = function() {
next : "blockquote"
}, { // HR * - _
token : "constant",
- regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$",
+ regex : "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
next: "allowBlock"
}, { // list
token : "markup.list",
diff --git a/htdocs/includes/ace/src/mode-mask.js b/htdocs/includes/ace/src/mode-mask.js
index 83cc5fe70b3..7a60ff04e9a 100644
--- a/htdocs/includes/ace/src/mode-mask.js
+++ b/htdocs/includes/ace/src/mode-mask.js
@@ -1083,7 +1083,7 @@ var MarkdownHighlightRules = function() {
next : "blockquote"
}, { // HR * - _
token : "constant",
- regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$",
+ regex : "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
next: "allowBlock"
}, { // list
token : "markup.list",
diff --git a/htdocs/includes/ace/src/mode-nsis.js b/htdocs/includes/ace/src/mode-nsis.js
index 2b8b5061a6d..67c2abec063 100644
--- a/htdocs/includes/ace/src/mode-nsis.js
+++ b/htdocs/includes/ace/src/mode-nsis.js
@@ -13,7 +13,7 @@ var NSISHighlightRules = function() {
caseInsensitive: true
}, {
token: "keyword.command.nsis",
- regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEDllCharacteristics|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/,
+ regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/,
caseInsensitive: true
}, {
token: "keyword.control.nsis",
diff --git a/htdocs/includes/ace/src/mode-nunjucks.js b/htdocs/includes/ace/src/mode-nunjucks.js
new file mode 100644
index 00000000000..57f1e9f32bb
--- /dev/null
+++ b/htdocs/includes/ace/src/mode-nunjucks.js
@@ -0,0 +1,2695 @@
+define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var DocCommentHighlightRules = function() {
+ this.$rules = {
+ "start" : [ {
+ token : "comment.doc.tag",
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
+ },
+ DocCommentHighlightRules.getTagRule(),
+ {
+ defaultToken : "comment.doc",
+ caseInsensitive: true
+ }]
+ };
+};
+
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
+
+DocCommentHighlightRules.getTagRule = function(start) {
+ return {
+ token : "comment.doc.tag.storage.type",
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
+ };
+};
+
+DocCommentHighlightRules.getStartRule = function(start) {
+ return {
+ token : "comment.doc", // doc comment
+ regex : "\\/\\*(?=\\*)",
+ next : start
+ };
+};
+
+DocCommentHighlightRules.getEndRule = function (start) {
+ return {
+ token : "comment.doc", // closing comment
+ regex : "\\*\\/",
+ next : start
+ };
+};
+
+
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
+
+});
+
+define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
+
+var JavaScriptHighlightRules = function(options) {
+ var keywordMapper = this.createKeywordMapper({
+ "variable.language":
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
+ "Namespace|QName|XML|XMLList|" + // E4X
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
+ "SyntaxError|TypeError|URIError|" +
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
+ "isNaN|parseFloat|parseInt|" +
+ "JSON|Math|" + // Other
+ "this|arguments|prototype|window|document" , // Pseudo
+ "keyword":
+ "const|yield|import|get|set|async|await|" +
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
+ "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
+ "storage.type":
+ "const|let|var|function",
+ "constant.language":
+ "null|Infinity|NaN|undefined",
+ "support.function":
+ "alert",
+ "constant.language.boolean": "true|false"
+ }, "identifier");
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
+
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
+ "u[0-9a-fA-F]{4}|" + // unicode
+ "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
+ "[0-2][0-7]{0,2}|" + // oct
+ "3[0-7][0-7]?|" + // oct
+ "[4-7][0-7]?|" + //oct
+ ".)";
+
+ this.$rules = {
+ "no_regex" : [
+ DocCommentHighlightRules.getStartRule("doc-start"),
+ comments("no_regex"),
+ {
+ token : "string",
+ regex : "'(?=.)",
+ next : "qstring"
+ }, {
+ token : "string",
+ regex : '"(?=.)',
+ next : "qqstring"
+ }, {
+ token : "constant.numeric", // hexadecimal, octal and binary
+ regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
+ }, {
+ token : "constant.numeric", // decimal integers and floats
+ regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
+ }, {
+ token : [
+ "storage.type", "punctuation.operator", "support.function",
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
+ ],
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
+ next: "function_arguments"
+ }, {
+ token : [
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
+ ],
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : [
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
+ "text", "paren.lparen"
+ ],
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : [
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
+ "keyword.operator", "text",
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
+ ],
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : [
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
+ ],
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : [
+ "entity.name.function", "text", "punctuation.operator",
+ "text", "storage.type", "text", "paren.lparen"
+ ],
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : [
+ "text", "text", "storage.type", "text", "paren.lparen"
+ ],
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : "keyword",
+ regex : "from(?=\\s*('|\"))"
+ }, {
+ token : "keyword",
+ regex : "(?:" + kwBeforeRe + ")\\b",
+ next : "start"
+ }, {
+ token : ["support.constant"],
+ regex : /that\b/
+ }, {
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
+ regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
+ }, {
+ token : keywordMapper,
+ regex : identifierRe
+ }, {
+ token : "punctuation.operator",
+ regex : /[.](?![.])/,
+ next : "property"
+ }, {
+ token : "storage.type",
+ regex : /=>/,
+ next : "start"
+ }, {
+ token : "keyword.operator",
+ regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
+ next : "start"
+ }, {
+ token : "punctuation.operator",
+ regex : /[?:,;.]/,
+ next : "start"
+ }, {
+ token : "paren.lparen",
+ regex : /[\[({]/,
+ next : "start"
+ }, {
+ token : "paren.rparen",
+ regex : /[\])}]/
+ }, {
+ token: "comment",
+ regex: /^#!.*$/
+ }
+ ],
+ property: [{
+ token : "text",
+ regex : "\\s+"
+ }, {
+ token : [
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
+ "keyword.operator", "text",
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
+ ],
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
+ next: "function_arguments"
+ }, {
+ token : "punctuation.operator",
+ regex : /[.](?![.])/
+ }, {
+ token : "support.function",
+ regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
+ }, {
+ token : "support.function.dom",
+ regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
+ }, {
+ token : "support.constant",
+ regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
+ }, {
+ token : "identifier",
+ regex : identifierRe
+ }, {
+ regex: "",
+ token: "empty",
+ next: "no_regex"
+ }
+ ],
+ "start": [
+ DocCommentHighlightRules.getStartRule("doc-start"),
+ comments("start"),
+ {
+ token: "string.regexp",
+ regex: "\\/",
+ next: "regex"
+ }, {
+ token : "text",
+ regex : "\\s+|^$",
+ next : "start"
+ }, {
+ token: "empty",
+ regex: "",
+ next: "no_regex"
+ }
+ ],
+ "regex": [
+ {
+ token: "regexp.keyword.operator",
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
+ }, {
+ token: "string.regexp",
+ regex: "/[sxngimy]*",
+ next: "no_regex"
+ }, {
+ token : "invalid",
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
+ }, {
+ token : "constant.language.escape",
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
+ }, {
+ token : "constant.language.delimiter",
+ regex: /\|/
+ }, {
+ token: "constant.language.escape",
+ regex: /\[\^?/,
+ next: "regex_character_class"
+ }, {
+ token: "empty",
+ regex: "$",
+ next: "no_regex"
+ }, {
+ defaultToken: "string.regexp"
+ }
+ ],
+ "regex_character_class": [
+ {
+ token: "regexp.charclass.keyword.operator",
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
+ }, {
+ token: "constant.language.escape",
+ regex: "]",
+ next: "regex"
+ }, {
+ token: "constant.language.escape",
+ regex: "-"
+ }, {
+ token: "empty",
+ regex: "$",
+ next: "no_regex"
+ }, {
+ defaultToken: "string.regexp.charachterclass"
+ }
+ ],
+ "function_arguments": [
+ {
+ token: "variable.parameter",
+ regex: identifierRe
+ }, {
+ token: "punctuation.operator",
+ regex: "[, ]+"
+ }, {
+ token: "punctuation.operator",
+ regex: "$"
+ }, {
+ token: "empty",
+ regex: "",
+ next: "no_regex"
+ }
+ ],
+ "qqstring" : [
+ {
+ token : "constant.language.escape",
+ regex : escapedRe
+ }, {
+ token : "string",
+ regex : "\\\\$",
+ consumeLineEnd : true
+ }, {
+ token : "string",
+ regex : '"|$',
+ next : "no_regex"
+ }, {
+ defaultToken: "string"
+ }
+ ],
+ "qstring" : [
+ {
+ token : "constant.language.escape",
+ regex : escapedRe
+ }, {
+ token : "string",
+ regex : "\\\\$",
+ consumeLineEnd : true
+ }, {
+ token : "string",
+ regex : "'|$",
+ next : "no_regex"
+ }, {
+ defaultToken: "string"
+ }
+ ]
+ };
+
+
+ if (!options || !options.noES6) {
+ this.$rules.no_regex.unshift({
+ regex: "[{}]", onMatch: function(val, state, stack) {
+ this.next = val == "{" ? this.nextState : "";
+ if (val == "{" && stack.length) {
+ stack.unshift("start", state);
+ }
+ else if (val == "}" && stack.length) {
+ stack.shift();
+ this.next = stack.shift();
+ if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
+ return "paren.quasi.end";
+ }
+ return val == "{" ? "paren.lparen" : "paren.rparen";
+ },
+ nextState: "start"
+ }, {
+ token : "string.quasi.start",
+ regex : /`/,
+ push : [{
+ token : "constant.language.escape",
+ regex : escapedRe
+ }, {
+ token : "paren.quasi.start",
+ regex : /\${/,
+ push : "start"
+ }, {
+ token : "string.quasi.end",
+ regex : /`/,
+ next : "pop"
+ }, {
+ defaultToken: "string.quasi"
+ }]
+ });
+
+ if (!options || options.jsx != false)
+ JSX.call(this);
+ }
+
+ this.embedRules(DocCommentHighlightRules, "doc-",
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
+
+ this.normalizeRules();
+};
+
+oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
+
+function JSX() {
+ var tagRegex = identifierRe.replace("\\d", "\\d\\-");
+ var jsxTag = {
+ onMatch : function(val, state, stack) {
+ var offset = val.charAt(1) == "/" ? 2 : 1;
+ if (offset == 1) {
+ if (state != this.nextState)
+ stack.unshift(this.next, this.nextState, 0);
+ else
+ stack.unshift(this.next);
+ stack[2]++;
+ } else if (offset == 2) {
+ if (state == this.nextState) {
+ stack[1]--;
+ if (!stack[1] || stack[1] < 0) {
+ stack.shift();
+ stack.shift();
+ }
+ }
+ }
+ return [{
+ type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
+ value: val.slice(0, offset)
+ }, {
+ type: "meta.tag.tag-name.xml",
+ value: val.substr(offset)
+ }];
+ },
+ regex : "?" + tagRegex + "",
+ next: "jsxAttributes",
+ nextState: "jsx"
+ };
+ this.$rules.start.unshift(jsxTag);
+ var jsxJsRule = {
+ regex: "{",
+ token: "paren.quasi.start",
+ push: "start"
+ };
+ this.$rules.jsx = [
+ jsxJsRule,
+ jsxTag,
+ {include : "reference"},
+ {defaultToken: "string"}
+ ];
+ this.$rules.jsxAttributes = [{
+ token : "meta.tag.punctuation.tag-close.xml",
+ regex : "/?>",
+ onMatch : function(value, currentState, stack) {
+ if (currentState == stack[0])
+ stack.shift();
+ if (value.length == 2) {
+ if (stack[0] == this.nextState)
+ stack[1]--;
+ if (!stack[1] || stack[1] < 0) {
+ stack.splice(0, 2);
+ }
+ }
+ this.next = stack[0] || "start";
+ return [{type: this.token, value: value}];
+ },
+ nextState: "jsx"
+ },
+ jsxJsRule,
+ comments("jsxAttributes"),
+ {
+ token : "entity.other.attribute-name.xml",
+ regex : tagRegex
+ }, {
+ token : "keyword.operator.attribute-equals.xml",
+ regex : "="
+ }, {
+ token : "text.tag-whitespace.xml",
+ regex : "\\s+"
+ }, {
+ token : "string.attribute-value.xml",
+ regex : "'",
+ stateName : "jsx_attr_q",
+ push : [
+ {token : "string.attribute-value.xml", regex: "'", next: "pop"},
+ {include : "reference"},
+ {defaultToken : "string.attribute-value.xml"}
+ ]
+ }, {
+ token : "string.attribute-value.xml",
+ regex : '"',
+ stateName : "jsx_attr_qq",
+ push : [
+ {token : "string.attribute-value.xml", regex: '"', next: "pop"},
+ {include : "reference"},
+ {defaultToken : "string.attribute-value.xml"}
+ ]
+ },
+ jsxTag
+ ];
+ this.$rules.reference = [{
+ token : "constant.language.escape.reference.xml",
+ regex : "(?:[0-9]+;)|(?:[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
+ }];
+}
+
+function comments(next) {
+ return [
+ {
+ token : "comment", // multi line comment
+ regex : /\/\*/,
+ next: [
+ DocCommentHighlightRules.getTagRule(),
+ {token : "comment", regex : "\\*\\/", next : next || "pop"},
+ {defaultToken : "comment", caseInsensitive: true}
+ ]
+ }, {
+ token : "comment",
+ regex : "\\/\\/",
+ next: [
+ DocCommentHighlightRules.getTagRule(),
+ {token : "comment", regex : "$|^", next : next || "pop"},
+ {defaultToken : "comment", caseInsensitive: true}
+ ]
+ }
+ ];
+}
+exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
+});
+
+define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
+"use strict";
+
+var Range = require("../range").Range;
+
+var MatchingBraceOutdent = function() {};
+
+(function() {
+
+ this.checkOutdent = function(line, input) {
+ if (! /^\s+$/.test(line))
+ return false;
+
+ return /^\s*\}/.test(input);
+ };
+
+ this.autoOutdent = function(doc, row) {
+ var line = doc.getLine(row);
+ var match = line.match(/^(\s*\})/);
+
+ if (!match) return 0;
+
+ var column = match[1].length;
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
+
+ if (!openBracePos || openBracePos.row == row) return 0;
+
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
+ doc.replace(new Range(row, 0, row, column-1), indent);
+ };
+
+ this.$getIndent = function(line) {
+ return line.match(/^\s*/)[0];
+ };
+
+}).call(MatchingBraceOutdent.prototype);
+
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
+});
+
+define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Range = require("../../range").Range;
+var BaseFoldMode = require("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function(commentRegex) {
+ if (commentRegex) {
+ this.foldingStartMarker = new RegExp(
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
+ );
+ this.foldingStopMarker = new RegExp(
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
+ );
+ }
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+ this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
+ this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
+ this._getFoldWidgetBase = this.getFoldWidget;
+ this.getFoldWidget = function(session, foldStyle, row) {
+ var line = session.getLine(row);
+
+ if (this.singleLineBlockCommentRe.test(line)) {
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
+ return "";
+ }
+
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
+
+ if (!fw && this.startRegionRe.test(line))
+ return "start"; // lineCommentRegionStart
+
+ return fw;
+ };
+
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
+ var line = session.getLine(row);
+
+ if (this.startRegionRe.test(line))
+ return this.getCommentRegionBlock(session, line, row);
+
+ var match = line.match(this.foldingStartMarker);
+ if (match) {
+ var i = match.index;
+
+ if (match[1])
+ return this.openingBracketBlock(session, match[1], row, i);
+
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
+
+ if (range && !range.isMultiLine()) {
+ if (forceMultiline) {
+ range = this.getSectionRange(session, row);
+ } else if (foldStyle != "all")
+ range = null;
+ }
+
+ return range;
+ }
+
+ if (foldStyle === "markbegin")
+ return;
+
+ var match = line.match(this.foldingStopMarker);
+ if (match) {
+ var i = match.index + match[0].length;
+
+ if (match[1])
+ return this.closingBracketBlock(session, match[1], row, i);
+
+ return session.getCommentFoldRange(row, i, -1);
+ }
+ };
+
+ this.getSectionRange = function(session, row) {
+ var line = session.getLine(row);
+ var startIndent = line.search(/\S/);
+ var startRow = row;
+ var startColumn = line.length;
+ row = row + 1;
+ var endRow = row;
+ var maxRow = session.getLength();
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var indent = line.search(/\S/);
+ if (indent === -1)
+ continue;
+ if (startIndent > indent)
+ break;
+ var subRange = this.getFoldWidgetRange(session, "all", row);
+
+ if (subRange) {
+ if (subRange.start.row <= startRow) {
+ break;
+ } else if (subRange.isMultiLine()) {
+ row = subRange.end.row;
+ } else if (startIndent == indent) {
+ break;
+ }
+ }
+ endRow = row;
+ }
+
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
+ };
+ this.getCommentRegionBlock = function(session, line, row) {
+ var startColumn = line.search(/\s*$/);
+ var maxRow = session.getLength();
+ var startRow = row;
+
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
+ var depth = 1;
+ while (++row < maxRow) {
+ line = session.getLine(row);
+ var m = re.exec(line);
+ if (!m) continue;
+ if (m[1]) depth--;
+ else depth++;
+
+ if (!depth) break;
+ }
+
+ var endRow = row;
+ if (endRow > startRow) {
+ return new Range(startRow, startColumn, endRow, line.length);
+ }
+ };
+
+}).call(FoldMode.prototype);
+
+});
+
+define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var WorkerClient = require("../worker/worker_client").WorkerClient;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+ this.HighlightRules = JavaScriptHighlightRules;
+
+ this.$outdent = new MatchingBraceOutdent();
+ this.$behaviour = new CstyleBehaviour();
+ this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+ this.lineCommentStart = "//";
+ this.blockComment = {start: "/*", end: "*/"};
+ this.$quotes = {'"': '"', "'": "'", "`": "`"};
+
+ this.getNextLineIndent = function(state, line, tab) {
+ var indent = this.$getIndent(line);
+
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+ var tokens = tokenizedLine.tokens;
+ var endState = tokenizedLine.state;
+
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
+ return indent;
+ }
+
+ if (state == "start" || state == "no_regex") {
+ var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
+ if (match) {
+ indent += tab;
+ }
+ } else if (state == "doc-start") {
+ if (endState == "start" || endState == "no_regex") {
+ return "";
+ }
+ var match = line.match(/^\s*(\/?)\*/);
+ if (match) {
+ if (match[1]) {
+ indent += " ";
+ }
+ indent += "* ";
+ }
+ }
+
+ return indent;
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ return this.$outdent.checkOutdent(line, input);
+ };
+
+ this.autoOutdent = function(state, doc, row) {
+ this.$outdent.autoOutdent(doc, row);
+ };
+
+ this.createWorker = function(session) {
+ var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
+ worker.attachToDocument(session.getDocument());
+
+ worker.on("annotate", function(results) {
+ session.setAnnotations(results.data);
+ });
+
+ worker.on("terminate", function() {
+ session.clearAnnotations();
+ });
+
+ return worker;
+ };
+
+ this.$id = "ace/mode/javascript";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
+
+define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index";
+var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
+var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom";
+var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen";
+var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
+
+var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
+var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
+var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
+
+var CssHighlightRules = function() {
+
+ var keywordMapper = this.createKeywordMapper({
+ "support.function": supportFunction,
+ "support.constant": supportConstant,
+ "support.type": supportType,
+ "support.constant.color": supportConstantColor,
+ "support.constant.fonts": supportConstantFonts
+ }, "text", true);
+
+ this.$rules = {
+ "start" : [{
+ include : ["strings", "url", "comments"]
+ }, {
+ token: "paren.lparen",
+ regex: "\\{",
+ next: "ruleset"
+ }, {
+ token: "paren.rparen",
+ regex: "\\}"
+ }, {
+ token: "string",
+ regex: "@(?!viewport)",
+ next: "media"
+ }, {
+ token: "keyword",
+ regex: "#[a-z0-9-_]+"
+ }, {
+ token: "keyword",
+ regex: "%"
+ }, {
+ token: "variable",
+ regex: "\\.[a-z0-9-_]+"
+ }, {
+ token: "string",
+ regex: ":[a-z0-9-_]+"
+ }, {
+ token : "constant.numeric",
+ regex : numRe
+ }, {
+ token: "constant",
+ regex: "[a-z0-9-_]+"
+ }, {
+ caseInsensitive: true
+ }],
+
+ "media": [{
+ include : ["strings", "url", "comments"]
+ }, {
+ token: "paren.lparen",
+ regex: "\\{",
+ next: "start"
+ }, {
+ token: "paren.rparen",
+ regex: "\\}",
+ next: "start"
+ }, {
+ token: "string",
+ regex: ";",
+ next: "start"
+ }, {
+ token: "keyword",
+ regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
+ + "|page|font|keyframes|viewport|counter-style|font-feature-values"
+ + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
+ }],
+
+ "comments" : [{
+ token: "comment", // multi line comment
+ regex: "\\/\\*",
+ push: [{
+ token : "comment",
+ regex : "\\*\\/",
+ next : "pop"
+ }, {
+ defaultToken : "comment"
+ }]
+ }],
+
+ "ruleset" : [{
+ regex : "-(webkit|ms|moz|o)-",
+ token : "text"
+ }, {
+ token : "punctuation.operator",
+ regex : "[:;]"
+ }, {
+ token : "paren.rparen",
+ regex : "\\}",
+ next : "start"
+ }, {
+ include : ["strings", "url", "comments"]
+ }, {
+ token : ["constant.numeric", "keyword"],
+ regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)"
+ }, {
+ token : "constant.numeric",
+ regex : numRe
+ }, {
+ token : "constant.numeric", // hex6 color
+ regex : "#[a-f0-9]{6}"
+ }, {
+ token : "constant.numeric", // hex3 color
+ regex : "#[a-f0-9]{3}"
+ }, {
+ token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
+ regex : pseudoElements
+ }, {
+ token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
+ regex : pseudoClasses
+ }, {
+ include: "url"
+ }, {
+ token : keywordMapper,
+ regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
+ }, {
+ caseInsensitive: true
+ }],
+
+ url: [{
+ token : "support.function",
+ regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
+ push: [{
+ token : "support.function",
+ regex : "\\)",
+ next : "pop"
+ }, {
+ defaultToken: "string"
+ }]
+ }],
+
+ strings: [{
+ token : "string.start",
+ regex : "'",
+ push : [{
+ token : "string.end",
+ regex : "'|$",
+ next: "pop"
+ }, {
+ include : "escapes"
+ }, {
+ token : "constant.language.escape",
+ regex : /\\$/,
+ consumeLineEnd: true
+ }, {
+ defaultToken: "string"
+ }]
+ }, {
+ token : "string.start",
+ regex : '"',
+ push : [{
+ token : "string.end",
+ regex : '"|$',
+ next: "pop"
+ }, {
+ include : "escapes"
+ }, {
+ token : "constant.language.escape",
+ regex : /\\$/,
+ consumeLineEnd: true
+ }, {
+ defaultToken: "string"
+ }]
+ }],
+ escapes: [{
+ token : "constant.language.escape",
+ regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
+ }]
+
+ };
+
+ this.normalizeRules();
+};
+
+oop.inherits(CssHighlightRules, TextHighlightRules);
+
+exports.CssHighlightRules = CssHighlightRules;
+
+});
+
+define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
+"use strict";
+
+var propertyMap = {
+ "background": {"#$0": 1},
+ "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
+ "background-image": {"url('/$0')": 1},
+ "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
+ "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
+ "background-attachment": {"scroll": 1, "fixed": 1},
+ "background-size": {"cover": 1, "contain": 1},
+ "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
+ "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
+ "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
+ "border-color": {"#$0": 1},
+ "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
+ "border-collapse": {"collapse": 1, "separate": 1},
+ "bottom": {"px": 1, "em": 1, "%": 1},
+ "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
+ "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
+ "cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1},
+ "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
+ "empty-cells": {"show": 1, "hide": 1},
+ "float": {"left": 1, "right": 1, "none": 1},
+ "font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1},
+ "font-size": {"px": 1, "em": 1, "%": 1},
+ "font-weight": {"bold": 1, "normal": 1},
+ "font-style": {"italic": 1, "normal": 1},
+ "font-variant": {"normal": 1, "small-caps": 1},
+ "height": {"px": 1, "em": 1, "%": 1},
+ "left": {"px": 1, "em": 1, "%": 1},
+ "letter-spacing": {"normal": 1},
+ "line-height": {"normal": 1},
+ "list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1},
+ "margin": {"px": 1, "em": 1, "%": 1},
+ "margin-right": {"px": 1, "em": 1, "%": 1},
+ "margin-left": {"px": 1, "em": 1, "%": 1},
+ "margin-top": {"px": 1, "em": 1, "%": 1},
+ "margin-bottom": {"px": 1, "em": 1, "%": 1},
+ "max-height": {"px": 1, "em": 1, "%": 1},
+ "max-width": {"px": 1, "em": 1, "%": 1},
+ "min-height": {"px": 1, "em": 1, "%": 1},
+ "min-width": {"px": 1, "em": 1, "%": 1},
+ "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
+ "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
+ "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
+ "padding": {"px": 1, "em": 1, "%": 1},
+ "padding-top": {"px": 1, "em": 1, "%": 1},
+ "padding-right": {"px": 1, "em": 1, "%": 1},
+ "padding-bottom": {"px": 1, "em": 1, "%": 1},
+ "padding-left": {"px": 1, "em": 1, "%": 1},
+ "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
+ "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
+ "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
+ "right": {"px": 1, "em": 1, "%": 1},
+ "table-layout": {"fixed": 1, "auto": 1},
+ "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
+ "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
+ "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
+ "top": {"px": 1, "em": 1, "%": 1},
+ "vertical-align": {"top": 1, "bottom": 1},
+ "visibility": {"hidden": 1, "visible": 1},
+ "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
+ "width": {"px": 1, "em": 1, "%": 1},
+ "word-spacing": {"normal": 1},
+ "filter": {"alpha(opacity=$0100)": 1},
+
+ "text-shadow": {"$02px 2px 2px #777": 1},
+ "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
+ "-moz-border-radius": 1,
+ "-moz-border-radius-topright": 1,
+ "-moz-border-radius-bottomright": 1,
+ "-moz-border-radius-topleft": 1,
+ "-moz-border-radius-bottomleft": 1,
+ "-webkit-border-radius": 1,
+ "-webkit-border-top-right-radius": 1,
+ "-webkit-border-top-left-radius": 1,
+ "-webkit-border-bottom-right-radius": 1,
+ "-webkit-border-bottom-left-radius": 1,
+ "-moz-box-shadow": 1,
+ "-webkit-box-shadow": 1,
+ "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
+ "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
+ "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
+};
+
+var CssCompletions = function() {
+
+};
+
+(function() {
+
+ this.completionsDefined = false;
+
+ this.defineCompletions = function() {
+ if (document) {
+ var style = document.createElement('c').style;
+
+ for (var i in style) {
+ if (typeof style[i] !== 'string')
+ continue;
+
+ var name = i.replace(/[A-Z]/g, function(x) {
+ return '-' + x.toLowerCase();
+ });
+
+ if (!propertyMap.hasOwnProperty(name))
+ propertyMap[name] = 1;
+ }
+ }
+
+ this.completionsDefined = true;
+ };
+
+ this.getCompletions = function(state, session, pos, prefix) {
+ if (!this.completionsDefined) {
+ this.defineCompletions();
+ }
+
+ if (state==='ruleset' || session.$mode.$id == "ace/mode/scss") {
+ var line = session.getLine(pos.row).substr(0, pos.column);
+ if (/:[^;]+$/.test(line)) {
+ /([\w\-]+):[^:]*$/.test(line);
+
+ return this.getPropertyValueCompletions(state, session, pos, prefix);
+ } else {
+ return this.getPropertyCompletions(state, session, pos, prefix);
+ }
+ }
+
+ return [];
+ };
+
+ this.getPropertyCompletions = function(state, session, pos, prefix) {
+ var properties = Object.keys(propertyMap);
+ return properties.map(function(property){
+ return {
+ caption: property,
+ snippet: property + ': $0;',
+ meta: "property",
+ score: 1000000
+ };
+ });
+ };
+
+ this.getPropertyValueCompletions = function(state, session, pos, prefix) {
+ var line = session.getLine(pos.row).substr(0, pos.column);
+ var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
+
+ if (!property)
+ return [];
+ var values = [];
+ if (property in propertyMap && typeof propertyMap[property] === "object") {
+ values = Object.keys(propertyMap[property]);
+ }
+ return values.map(function(value){
+ return {
+ caption: value,
+ snippet: value,
+ meta: "property value",
+ score: 1000000
+ };
+ });
+ };
+
+}).call(CssCompletions.prototype);
+
+exports.CssCompletions = CssCompletions;
+});
+
+define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Behaviour = require("../behaviour").Behaviour;
+var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
+var TokenIterator = require("../../token_iterator").TokenIterator;
+
+var CssBehaviour = function () {
+
+ this.inherit(CstyleBehaviour);
+
+ this.add("colon", "insertion", function (state, action, editor, session, text) {
+ if (text === ':' && editor.selection.isEmpty()) {
+ var cursor = editor.getCursorPosition();
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
+ var token = iterator.getCurrentToken();
+ if (token && token.value.match(/\s+/)) {
+ token = iterator.stepBackward();
+ }
+ if (token && token.type === 'support.type') {
+ var line = session.doc.getLine(cursor.row);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar === ':') {
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
+ return {
+ text: ':;',
+ selection: [1, 1]
+ };
+ }
+ }
+ }
+ });
+
+ this.add("colon", "deletion", function (state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && selected === ':') {
+ var cursor = editor.getCursorPosition();
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
+ var token = iterator.getCurrentToken();
+ if (token && token.value.match(/\s+/)) {
+ token = iterator.stepBackward();
+ }
+ if (token && token.type === 'support.type') {
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
+ if (rightChar === ';') {
+ range.end.column ++;
+ return range;
+ }
+ }
+ }
+ });
+
+ this.add("semicolon", "insertion", function (state, action, editor, session, text) {
+ if (text === ';' && editor.selection.isEmpty()) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ if (rightChar === ';') {
+ return {
+ text: '',
+ selection: [1, 1]
+ };
+ }
+ }
+ });
+
+ this.add("!important", "insertion", function (state, action, editor, session, text) {
+ if (text === '!' && editor.selection.isEmpty()) {
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+
+ if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
+ return {
+ text: '!important',
+ selection: [10, 10]
+ };
+ }
+ }
+ });
+
+};
+oop.inherits(CssBehaviour, CstyleBehaviour);
+
+exports.CssBehaviour = CssBehaviour;
+});
+
+define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var WorkerClient = require("../worker/worker_client").WorkerClient;
+var CssCompletions = require("./css_completions").CssCompletions;
+var CssBehaviour = require("./behaviour/css").CssBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+ this.HighlightRules = CssHighlightRules;
+ this.$outdent = new MatchingBraceOutdent();
+ this.$behaviour = new CssBehaviour();
+ this.$completer = new CssCompletions();
+ this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+ this.foldingRules = "cStyle";
+ this.blockComment = {start: "/*", end: "*/"};
+
+ this.getNextLineIndent = function(state, line, tab) {
+ var indent = this.$getIndent(line);
+ var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
+ return indent;
+ }
+
+ var match = line.match(/^.*\{\s*$/);
+ if (match) {
+ indent += tab;
+ }
+
+ return indent;
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ return this.$outdent.checkOutdent(line, input);
+ };
+
+ this.autoOutdent = function(state, doc, row) {
+ this.$outdent.autoOutdent(doc, row);
+ };
+
+ this.getCompletions = function(state, session, pos, prefix) {
+ return this.$completer.getCompletions(state, session, pos, prefix);
+ };
+
+ this.createWorker = function(session) {
+ var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
+ worker.attachToDocument(session.getDocument());
+
+ worker.on("annotate", function(e) {
+ session.setAnnotations(e.data);
+ });
+
+ worker.on("terminate", function() {
+ session.clearAnnotations();
+ });
+
+ return worker;
+ };
+
+ this.$id = "ace/mode/css";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});
+
+define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var XmlHighlightRules = function(normalize) {
+ var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
+
+ this.$rules = {
+ start : [
+ {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
+ {
+ token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
+ regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
+ },
+ {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
+ {
+ token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
+ regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
+ },
+ {include : "tag"},
+ {token : "text.end-tag-open.xml", regex: ""},
+ {token : "text.tag-open.xml", regex: "<"},
+ {include : "reference"},
+ {defaultToken : "text.xml"}
+ ],
+
+ processing_instruction : [{
+ token : "entity.other.attribute-name.decl-attribute-name.xml",
+ regex : tagRegex
+ }, {
+ token : "keyword.operator.decl-attribute-equals.xml",
+ regex : "="
+ }, {
+ include: "whitespace"
+ }, {
+ include: "string"
+ }, {
+ token : "punctuation.xml-decl.xml",
+ regex : "\\?>",
+ next : "start"
+ }],
+
+ doctype : [
+ {include : "whitespace"},
+ {include : "string"},
+ {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
+ {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
+ {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
+ ],
+
+ int_subset : [{
+ token : "text.xml",
+ regex : "\\s+"
+ }, {
+ token: "punctuation.int-subset.xml",
+ regex: "]",
+ next: "pop"
+ }, {
+ token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
+ regex : "(<\\!)(" + tagRegex + ")",
+ push : [{
+ token : "text",
+ regex : "\\s+"
+ },
+ {
+ token : "punctuation.markup-decl.xml",
+ regex : ">",
+ next : "pop"
+ },
+ {include : "string"}]
+ }],
+
+ cdata : [
+ {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
+ {token : "text.xml", regex : "\\s+"},
+ {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
+ ],
+
+ comment : [
+ {token : "comment.end.xml", regex : "-->", next : "start"},
+ {defaultToken : "comment.xml"}
+ ],
+
+ reference : [{
+ token : "constant.language.escape.reference.xml",
+ regex : "(?:[0-9]+;)|(?:[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
+ }],
+
+ attr_reference : [{
+ token : "constant.language.escape.reference.attribute-value.xml",
+ regex : "(?:[0-9]+;)|(?:[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
+ }],
+
+ tag : [{
+ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
+ regex : "(?:(<)|())((?:" + tagRegex + ":)?" + tagRegex + ")",
+ next: [
+ {include : "attributes"},
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
+ ]
+ }],
+
+ tag_whitespace : [
+ {token : "text.tag-whitespace.xml", regex : "\\s+"}
+ ],
+ whitespace : [
+ {token : "text.whitespace.xml", regex : "\\s+"}
+ ],
+ string: [{
+ token : "string.xml",
+ regex : "'",
+ push : [
+ {token : "string.xml", regex: "'", next: "pop"},
+ {defaultToken : "string.xml"}
+ ]
+ }, {
+ token : "string.xml",
+ regex : '"',
+ push : [
+ {token : "string.xml", regex: '"', next: "pop"},
+ {defaultToken : "string.xml"}
+ ]
+ }],
+
+ attributes: [{
+ token : "entity.other.attribute-name.xml",
+ regex : tagRegex
+ }, {
+ token : "keyword.operator.attribute-equals.xml",
+ regex : "="
+ }, {
+ include: "tag_whitespace"
+ }, {
+ include: "attribute_value"
+ }],
+
+ attribute_value: [{
+ token : "string.attribute-value.xml",
+ regex : "'",
+ push : [
+ {token : "string.attribute-value.xml", regex: "'", next: "pop"},
+ {include : "attr_reference"},
+ {defaultToken : "string.attribute-value.xml"}
+ ]
+ }, {
+ token : "string.attribute-value.xml",
+ regex : '"',
+ push : [
+ {token : "string.attribute-value.xml", regex: '"', next: "pop"},
+ {include : "attr_reference"},
+ {defaultToken : "string.attribute-value.xml"}
+ ]
+ }]
+ };
+
+ if (this.constructor === XmlHighlightRules)
+ this.normalizeRules();
+};
+
+
+(function() {
+
+ this.embedTagRules = function(HighlightRules, prefix, tag){
+ this.$rules.tag.unshift({
+ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
+ regex : "(<)(" + tag + "(?=\\s|>|$))",
+ next: [
+ {include : "attributes"},
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
+ ]
+ });
+
+ this.$rules[tag + "-end"] = [
+ {include : "attributes"},
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
+ onMatch : function(value, currentState, stack) {
+ stack.splice(0);
+ return this.token;
+ }}
+ ];
+
+ this.embedRules(HighlightRules, prefix, [{
+ token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
+ regex : "()(" + tag + "(?=\\s|>|$))",
+ next: tag + "-end"
+ }, {
+ token: "string.cdata.xml",
+ regex : "<\\!\\[CDATA\\["
+ }, {
+ token: "string.cdata.xml",
+ regex : "\\]\\]>"
+ }]);
+ };
+
+}).call(TextHighlightRules.prototype);
+
+oop.inherits(XmlHighlightRules, TextHighlightRules);
+
+exports.XmlHighlightRules = XmlHighlightRules;
+});
+
+define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
+var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
+var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
+
+var tagMap = lang.createMap({
+ a : 'anchor',
+ button : 'form',
+ form : 'form',
+ img : 'image',
+ input : 'form',
+ label : 'form',
+ option : 'form',
+ script : 'script',
+ select : 'form',
+ textarea : 'form',
+ style : 'style',
+ table : 'table',
+ tbody : 'table',
+ td : 'table',
+ tfoot : 'table',
+ th : 'table',
+ tr : 'table'
+});
+
+var HtmlHighlightRules = function() {
+ XmlHighlightRules.call(this);
+
+ this.addRules({
+ attributes: [{
+ include : "tag_whitespace"
+ }, {
+ token : "entity.other.attribute-name.xml",
+ regex : "[-_a-zA-Z0-9:.]+"
+ }, {
+ token : "keyword.operator.attribute-equals.xml",
+ regex : "=",
+ push : [{
+ include: "tag_whitespace"
+ }, {
+ token : "string.unquoted.attribute-value.html",
+ regex : "[^<>='\"`\\s]+",
+ next : "pop"
+ }, {
+ token : "empty",
+ regex : "",
+ next : "pop"
+ }]
+ }, {
+ include : "attribute_value"
+ }],
+ tag: [{
+ token : function(start, tag) {
+ var group = tagMap[tag];
+ return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
+ "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
+ },
+ regex : "(?)([-_a-zA-Z0-9:.]+)",
+ next: "tag_stuff"
+ }],
+ tag_stuff: [
+ {include : "attributes"},
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
+ ]
+ });
+
+ this.embedTagRules(CssHighlightRules, "css-", "style");
+ this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
+
+ if (this.constructor === HtmlHighlightRules)
+ this.normalizeRules();
+};
+
+oop.inherits(HtmlHighlightRules, XmlHighlightRules);
+
+exports.HtmlHighlightRules = HtmlHighlightRules;
+});
+
+define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Behaviour = require("../behaviour").Behaviour;
+var TokenIterator = require("../../token_iterator").TokenIterator;
+var lang = require("../../lib/lang");
+
+function is(token, type) {
+ return token && token.type.lastIndexOf(type + ".xml") > -1;
+}
+
+var XmlBehaviour = function () {
+
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
+ if (text == '"' || text == "'") {
+ var quote = text;
+ var selected = session.doc.getTextRange(editor.getSelectionRange());
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
+ return {
+ text: quote + selected + quote,
+ selection: false
+ };
+ }
+
+ var cursor = editor.getCursorPosition();
+ var line = session.doc.getLine(cursor.row);
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
+ var token = iterator.getCurrentToken();
+
+ if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
+ return {
+ text: "",
+ selection: [1, 1]
+ };
+ }
+
+ if (!token)
+ token = iterator.stepBackward();
+
+ if (!token)
+ return;
+
+ while (is(token, "tag-whitespace") || is(token, "whitespace")) {
+ token = iterator.stepBackward();
+ }
+ var rightSpace = !rightChar || rightChar.match(/\s/);
+ if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
+ return {
+ text: quote + quote,
+ selection: [1, 1]
+ };
+ }
+ }
+ });
+
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
+ var selected = session.doc.getTextRange(range);
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
+ var line = session.doc.getLine(range.start.row);
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+ if (rightChar == selected) {
+ range.end.column++;
+ return range;
+ }
+ }
+ });
+
+ this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
+ if (text == '>') {
+ var position = editor.getSelectionRange().start;
+ var iterator = new TokenIterator(session, position.row, position.column);
+ var token = iterator.getCurrentToken() || iterator.stepBackward();
+ if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
+ return;
+ if (is(token, "reference.attribute-value"))
+ return;
+ if (is(token, "attribute-value")) {
+ var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
+ if (position.column < tokenEndColumn)
+ return;
+ if (position.column == tokenEndColumn) {
+ var nextToken = iterator.stepForward();
+ if (nextToken && is(nextToken, "attribute-value"))
+ return;
+ iterator.stepBackward();
+ }
+ }
+
+ if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
+ return;
+ while (!is(token, "tag-name")) {
+ token = iterator.stepBackward();
+ if (token.value == "<") {
+ token = iterator.stepForward();
+ break;
+ }
+ }
+
+ var tokenRow = iterator.getCurrentTokenRow();
+ var tokenColumn = iterator.getCurrentTokenColumn();
+ if (is(iterator.stepBackward(), "end-tag-open"))
+ return;
+
+ var element = token.value;
+ if (tokenRow == position.row)
+ element = element.substring(0, position.column - tokenColumn);
+
+ if (this.voidElements.hasOwnProperty(element.toLowerCase()))
+ return;
+
+ return {
+ text: ">" + "" + element + ">",
+ selection: [1, 1]
+ };
+ }
+ });
+
+ this.add("autoindent", "insertion", function (state, action, editor, session, text) {
+ if (text == "\n") {
+ var cursor = editor.getCursorPosition();
+ var line = session.getLine(cursor.row);
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
+ var token = iterator.getCurrentToken();
+
+ if (token && token.type.indexOf("tag-close") !== -1) {
+ if (token.value == "/>")
+ return;
+ while (token && token.type.indexOf("tag-name") === -1) {
+ token = iterator.stepBackward();
+ }
+
+ if (!token) {
+ return;
+ }
+
+ var tag = token.value;
+ var row = iterator.getCurrentTokenRow();
+ token = iterator.stepBackward();
+ if (!token || token.type.indexOf("end-tag") !== -1) {
+ return;
+ }
+
+ if (this.voidElements && !this.voidElements[tag]) {
+ var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
+ var line = session.getLine(row);
+ var nextIndent = this.$getIndent(line);
+ var indent = nextIndent + session.getTabString();
+
+ if (nextToken && nextToken.value === "") {
+ return {
+ text: "\n" + indent + "\n" + nextIndent,
+ selection: [1, indent.length, 1, indent.length]
+ };
+ } else {
+ return {
+ text: "\n" + indent
+ };
+ }
+ }
+ }
+ }
+ });
+
+};
+
+oop.inherits(XmlBehaviour, Behaviour);
+
+exports.XmlBehaviour = XmlBehaviour;
+});
+
+define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var BaseFoldMode = require("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
+ this.defaultMode = defaultMode;
+ this.subModes = subModes;
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+
+ this.$getMode = function(state) {
+ if (typeof state != "string")
+ state = state[0];
+ for (var key in this.subModes) {
+ if (state.indexOf(key) === 0)
+ return this.subModes[key];
+ }
+ return null;
+ };
+
+ this.$tryMode = function(state, session, foldStyle, row) {
+ var mode = this.$getMode(state);
+ return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
+ };
+
+ this.getFoldWidget = function(session, foldStyle, row) {
+ return (
+ this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
+ this.$tryMode(session.getState(row), session, foldStyle, row) ||
+ this.defaultMode.getFoldWidget(session, foldStyle, row)
+ );
+ };
+
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
+ var mode = this.$getMode(session.getState(row-1));
+
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
+ mode = this.$getMode(session.getState(row));
+
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
+ mode = this.defaultMode;
+
+ return mode.getFoldWidgetRange(session, foldStyle, row);
+ };
+
+}).call(FoldMode.prototype);
+
+});
+
+define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var lang = require("../../lib/lang");
+var Range = require("../../range").Range;
+var BaseFoldMode = require("./fold_mode").FoldMode;
+var TokenIterator = require("../../token_iterator").TokenIterator;
+
+var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
+ BaseFoldMode.call(this);
+ this.voidElements = voidElements || {};
+ this.optionalEndTags = oop.mixin({}, this.voidElements);
+ if (optionalEndTags)
+ oop.mixin(this.optionalEndTags, optionalEndTags);
+
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+var Tag = function() {
+ this.tagName = "";
+ this.closing = false;
+ this.selfClosing = false;
+ this.start = {row: 0, column: 0};
+ this.end = {row: 0, column: 0};
+};
+
+function is(token, type) {
+ return token.type.lastIndexOf(type + ".xml") > -1;
+}
+
+(function() {
+
+ this.getFoldWidget = function(session, foldStyle, row) {
+ var tag = this._getFirstTagInLine(session, row);
+
+ if (!tag)
+ return this.getCommentFoldWidget(session, row);
+
+ if (tag.closing || (!tag.tagName && tag.selfClosing))
+ return foldStyle == "markbeginend" ? "end" : "";
+
+ if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
+ return "";
+
+ if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
+ return "";
+
+ return "start";
+ };
+
+ this.getCommentFoldWidget = function(session, row) {
+ if (/comment/.test(session.getState(row)) && /';
+ break;
+ }
+ }
+ return tag;
+ } else if (is(token, "tag-close")) {
+ tag.selfClosing = token.value == '/>';
+ return tag;
+ }
+ tag.start.column += token.value.length;
+ }
+
+ return null;
+ };
+
+ this._findEndTagInLine = function(session, row, tagName, startColumn) {
+ var tokens = session.getTokens(row);
+ var column = 0;
+ for (var i = 0; i < tokens.length; i++) {
+ var token = tokens[i];
+ column += token.value.length;
+ if (column < startColumn)
+ continue;
+ if (is(token, "end-tag-open")) {
+ token = tokens[i + 1];
+ if (token && token.value == tagName)
+ return true;
+ }
+ }
+ return false;
+ };
+ this._readTagForward = function(iterator) {
+ var token = iterator.getCurrentToken();
+ if (!token)
+ return null;
+
+ var tag = new Tag();
+ do {
+ if (is(token, "tag-open")) {
+ tag.closing = is(token, "end-tag-open");
+ tag.start.row = iterator.getCurrentTokenRow();
+ tag.start.column = iterator.getCurrentTokenColumn();
+ } else if (is(token, "tag-name")) {
+ tag.tagName = token.value;
+ } else if (is(token, "tag-close")) {
+ tag.selfClosing = token.value == "/>";
+ tag.end.row = iterator.getCurrentTokenRow();
+ tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
+ iterator.stepForward();
+ return tag;
+ }
+ } while(token = iterator.stepForward());
+
+ return null;
+ };
+
+ this._readTagBackward = function(iterator) {
+ var token = iterator.getCurrentToken();
+ if (!token)
+ return null;
+
+ var tag = new Tag();
+ do {
+ if (is(token, "tag-open")) {
+ tag.closing = is(token, "end-tag-open");
+ tag.start.row = iterator.getCurrentTokenRow();
+ tag.start.column = iterator.getCurrentTokenColumn();
+ iterator.stepBackward();
+ return tag;
+ } else if (is(token, "tag-name")) {
+ tag.tagName = token.value;
+ } else if (is(token, "tag-close")) {
+ tag.selfClosing = token.value == "/>";
+ tag.end.row = iterator.getCurrentTokenRow();
+ tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
+ }
+ } while(token = iterator.stepBackward());
+
+ return null;
+ };
+
+ this._pop = function(stack, tag) {
+ while (stack.length) {
+
+ var top = stack[stack.length-1];
+ if (!tag || top.tagName == tag.tagName) {
+ return stack.pop();
+ }
+ else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
+ stack.pop();
+ continue;
+ } else {
+ return null;
+ }
+ }
+ };
+
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
+ var firstTag = this._getFirstTagInLine(session, row);
+
+ if (!firstTag) {
+ return this.getCommentFoldWidget(session, row)
+ && session.getCommentFoldRange(row, session.getLine(row).length);
+ }
+
+ var isBackward = firstTag.closing || firstTag.selfClosing;
+ var stack = [];
+ var tag;
+
+ if (!isBackward) {
+ var iterator = new TokenIterator(session, row, firstTag.start.column);
+ var start = {
+ row: row,
+ column: firstTag.start.column + firstTag.tagName.length + 2
+ };
+ if (firstTag.start.row == firstTag.end.row)
+ start.column = firstTag.end.column;
+ while (tag = this._readTagForward(iterator)) {
+ if (tag.selfClosing) {
+ if (!stack.length) {
+ tag.start.column += tag.tagName.length + 2;
+ tag.end.column -= 2;
+ return Range.fromPoints(tag.start, tag.end);
+ } else
+ continue;
+ }
+
+ if (tag.closing) {
+ this._pop(stack, tag);
+ if (stack.length == 0)
+ return Range.fromPoints(start, tag.start);
+ }
+ else {
+ stack.push(tag);
+ }
+ }
+ }
+ else {
+ var iterator = new TokenIterator(session, row, firstTag.end.column);
+ var end = {
+ row: row,
+ column: firstTag.start.column
+ };
+
+ while (tag = this._readTagBackward(iterator)) {
+ if (tag.selfClosing) {
+ if (!stack.length) {
+ tag.start.column += tag.tagName.length + 2;
+ tag.end.column -= 2;
+ return Range.fromPoints(tag.start, tag.end);
+ } else
+ continue;
+ }
+
+ if (!tag.closing) {
+ this._pop(stack, tag);
+ if (stack.length == 0) {
+ tag.start.column += tag.tagName.length + 2;
+ if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
+ tag.start.column = tag.end.column;
+ return Range.fromPoints(tag.start, end);
+ }
+ }
+ else {
+ stack.push(tag);
+ }
+ }
+ }
+
+ };
+
+}).call(FoldMode.prototype);
+
+});
+
+define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var MixedFoldMode = require("./mixed").FoldMode;
+var XmlFoldMode = require("./xml").FoldMode;
+var CStyleFoldMode = require("./cstyle").FoldMode;
+
+var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
+ MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
+ "js-": new CStyleFoldMode(),
+ "css-": new CStyleFoldMode()
+ });
+};
+
+oop.inherits(FoldMode, MixedFoldMode);
+
+});
+
+define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
+"use strict";
+
+var TokenIterator = require("../token_iterator").TokenIterator;
+
+var commonAttributes = [
+ "accesskey",
+ "class",
+ "contenteditable",
+ "contextmenu",
+ "dir",
+ "draggable",
+ "dropzone",
+ "hidden",
+ "id",
+ "inert",
+ "itemid",
+ "itemprop",
+ "itemref",
+ "itemscope",
+ "itemtype",
+ "lang",
+ "spellcheck",
+ "style",
+ "tabindex",
+ "title",
+ "translate"
+];
+
+var eventAttributes = [
+ "onabort",
+ "onblur",
+ "oncancel",
+ "oncanplay",
+ "oncanplaythrough",
+ "onchange",
+ "onclick",
+ "onclose",
+ "oncontextmenu",
+ "oncuechange",
+ "ondblclick",
+ "ondrag",
+ "ondragend",
+ "ondragenter",
+ "ondragleave",
+ "ondragover",
+ "ondragstart",
+ "ondrop",
+ "ondurationchange",
+ "onemptied",
+ "onended",
+ "onerror",
+ "onfocus",
+ "oninput",
+ "oninvalid",
+ "onkeydown",
+ "onkeypress",
+ "onkeyup",
+ "onload",
+ "onloadeddata",
+ "onloadedmetadata",
+ "onloadstart",
+ "onmousedown",
+ "onmousemove",
+ "onmouseout",
+ "onmouseover",
+ "onmouseup",
+ "onmousewheel",
+ "onpause",
+ "onplay",
+ "onplaying",
+ "onprogress",
+ "onratechange",
+ "onreset",
+ "onscroll",
+ "onseeked",
+ "onseeking",
+ "onselect",
+ "onshow",
+ "onstalled",
+ "onsubmit",
+ "onsuspend",
+ "ontimeupdate",
+ "onvolumechange",
+ "onwaiting"
+];
+
+var globalAttributes = commonAttributes.concat(eventAttributes);
+
+var attributeMap = {
+ "a": {"href": 1, "target": {"_blank": 1, "top": 1}, "ping": 1, "rel": {"nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1}, "media": 1, "hreflang": 1, "type": 1},
+ "abbr": {},
+ "address": {},
+ "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
+ "article": {"pubdate": 1},
+ "aside": {},
+ "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
+ "b": {},
+ "base": {"href": 1, "target": 1},
+ "bdi": {},
+ "bdo": {},
+ "blockquote": {"cite": 1},
+ "body": {"onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1},
+ "br": {},
+ "button": {"autofocus": 1, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": {"button": 1, "submit": 1}},
+ "canvas": {"width": 1, "height": 1},
+ "caption": {},
+ "cite": {},
+ "code": {},
+ "col": {"span": 1},
+ "colgroup": {"span": 1},
+ "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
+ "data": {},
+ "datalist": {},
+ "dd": {},
+ "del": {"cite": 1, "datetime": 1},
+ "details": {"open": 1},
+ "dfn": {},
+ "dialog": {"open": 1},
+ "div": {},
+ "dl": {},
+ "dt": {},
+ "em": {},
+ "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
+ "fieldset": {"disabled": 1, "form": 1, "name": 1},
+ "figcaption": {},
+ "figure": {},
+ "footer": {},
+ "form": {"accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": {"multipart/form-data": 1, "application/x-www-form-urlencoded": 1}, "method": {"get": 1, "post": 1}, "name": 1, "novalidate": 1, "target": {"_blank": 1, "top": 1}},
+ "h1": {},
+ "h2": {},
+ "h3": {},
+ "h4": {},
+ "h5": {},
+ "h6": {},
+ "head": {},
+ "header": {},
+ "hr": {},
+ "html": {"manifest": 1},
+ "i": {},
+ "iframe": {"name": 1, "src": 1, "height": 1, "width": 1, "sandbox": {"allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1}, "seamless": {"seamless": 1}},
+ "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
+ "input": {
+ "type": {"text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1},
+ "accept": 1, "alt": 1, "autocomplete": {"on": 1, "off": 1}, "autofocus": {"autofocus": 1}, "checked": {"checked": 1}, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": {"application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1}, "formmethod": {"get": 1, "post": 1}, "formnovalidate": {"formnovalidate": 1}, "formtarget": {"_blank": 1, "_self": 1, "_parent": 1, "_top": 1}, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": {"multiple": 1}, "name": 1, "pattern": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1},
+ "ins": {"cite": 1, "datetime": 1},
+ "kbd": {},
+ "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
+ "label": {"form": 1, "for": 1},
+ "legend": {},
+ "li": {"value": 1},
+ "link": {"href": 1, "hreflang": 1, "rel": {"stylesheet": 1, "icon": 1}, "media": {"all": 1, "screen": 1, "print": 1}, "type": {"text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1}, "sizes": 1},
+ "main": {},
+ "map": {"name": 1},
+ "mark": {},
+ "math": {},
+ "menu": {"type": 1, "label": 1},
+ "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
+ "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
+ "nav": {},
+ "noscript": {"href": 1},
+ "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
+ "ol": {"start": 1, "reversed": 1},
+ "optgroup": {"disabled": 1, "label": 1},
+ "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
+ "output": {"for": 1, "form": 1, "name": 1},
+ "p": {},
+ "param": {"name": 1, "value": 1},
+ "pre": {},
+ "progress": {"value": 1, "max": 1},
+ "q": {"cite": 1},
+ "rp": {},
+ "rt": {},
+ "ruby": {},
+ "s": {},
+ "samp": {},
+ "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
+ "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
+ "small": {},
+ "source": {"src": 1, "type": 1, "media": 1},
+ "span": {},
+ "strong": {},
+ "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
+ "sub": {},
+ "sup": {},
+ "svg": {},
+ "table": {"summary": 1},
+ "tbody": {},
+ "td": {"headers": 1, "rowspan": 1, "colspan": 1},
+ "textarea": {"autofocus": {"autofocus": 1}, "disabled": {"disabled": 1}, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "rows": 1, "cols": 1, "wrap": {"on": 1, "off": 1, "hard": 1, "soft": 1}},
+ "tfoot": {},
+ "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
+ "thead": {},
+ "time": {"datetime": 1},
+ "title": {},
+ "tr": {},
+ "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
+ "section": {},
+ "summary": {},
+ "u": {},
+ "ul": {},
+ "var": {},
+ "video": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "width": 1, "height": 1, "poster": 1, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1}},
+ "wbr": {}
+};
+
+var elements = Object.keys(attributeMap);
+
+function is(token, type) {
+ return token.type.lastIndexOf(type + ".xml") > -1;
+}
+
+function findTagName(session, pos) {
+ var iterator = new TokenIterator(session, pos.row, pos.column);
+ var token = iterator.getCurrentToken();
+ while (token && !is(token, "tag-name")){
+ token = iterator.stepBackward();
+ }
+ if (token)
+ return token.value;
+}
+
+function findAttributeName(session, pos) {
+ var iterator = new TokenIterator(session, pos.row, pos.column);
+ var token = iterator.getCurrentToken();
+ while (token && !is(token, "attribute-name")){
+ token = iterator.stepBackward();
+ }
+ if (token)
+ return token.value;
+}
+
+var HtmlCompletions = function() {
+
+};
+
+(function() {
+
+ this.getCompletions = function(state, session, pos, prefix) {
+ var token = session.getTokenAt(pos.row, pos.column);
+
+ if (!token)
+ return [];
+ if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
+ return this.getTagCompletions(state, session, pos, prefix);
+ if (is(token, "tag-whitespace") || is(token, "attribute-name"))
+ return this.getAttributeCompletions(state, session, pos, prefix);
+ if (is(token, "attribute-value"))
+ return this.getAttributeValueCompletions(state, session, pos, prefix);
+ var line = session.getLine(pos.row).substr(0, pos.column);
+ if (/&[a-z]*$/i.test(line))
+ return this.getHTMLEntityCompletions(state, session, pos, prefix);
+
+ return [];
+ };
+
+ this.getTagCompletions = function(state, session, pos, prefix) {
+ return elements.map(function(element){
+ return {
+ value: element,
+ meta: "tag",
+ score: 1000000
+ };
+ });
+ };
+
+ this.getAttributeCompletions = function(state, session, pos, prefix) {
+ var tagName = findTagName(session, pos);
+ if (!tagName)
+ return [];
+ var attributes = globalAttributes;
+ if (tagName in attributeMap) {
+ attributes = attributes.concat(Object.keys(attributeMap[tagName]));
+ }
+ return attributes.map(function(attribute){
+ return {
+ caption: attribute,
+ snippet: attribute + '="$0"',
+ meta: "attribute",
+ score: 1000000
+ };
+ });
+ };
+
+ this.getAttributeValueCompletions = function(state, session, pos, prefix) {
+ var tagName = findTagName(session, pos);
+ var attributeName = findAttributeName(session, pos);
+
+ if (!tagName)
+ return [];
+ var values = [];
+ if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
+ values = Object.keys(attributeMap[tagName][attributeName]);
+ }
+ return values.map(function(value){
+ return {
+ caption: value,
+ snippet: value,
+ meta: "attribute value",
+ score: 1000000
+ };
+ });
+ };
+
+ this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
+ var values = ['Aacute;', 'aacute;', 'Acirc;', 'acirc;', 'acute;', 'AElig;', 'aelig;', 'Agrave;', 'agrave;', 'alefsym;', 'Alpha;', 'alpha;', 'amp;', 'and;', 'ang;', 'Aring;', 'aring;', 'asymp;', 'Atilde;', 'atilde;', 'Auml;', 'auml;', 'bdquo;', 'Beta;', 'beta;', 'brvbar;', 'bull;', 'cap;', 'Ccedil;', 'ccedil;', 'cedil;', 'cent;', 'Chi;', 'chi;', 'circ;', 'clubs;', 'cong;', 'copy;', 'crarr;', 'cup;', 'curren;', 'Dagger;', 'dagger;', 'dArr;', 'darr;', 'deg;', 'Delta;', 'delta;', 'diams;', 'divide;', 'Eacute;', 'eacute;', 'Ecirc;', 'ecirc;', 'Egrave;', 'egrave;', 'empty;', 'emsp;', 'ensp;', 'Epsilon;', 'epsilon;', 'equiv;', 'Eta;', 'eta;', 'ETH;', 'eth;', 'Euml;', 'euml;', 'euro;', 'exist;', 'fnof;', 'forall;', 'frac12;', 'frac14;', 'frac34;', 'frasl;', 'Gamma;', 'gamma;', 'ge;', 'gt;', 'hArr;', 'harr;', 'hearts;', 'hellip;', 'Iacute;', 'iacute;', 'Icirc;', 'icirc;', 'iexcl;', 'Igrave;', 'igrave;', 'image;', 'infin;', 'int;', 'Iota;', 'iota;', 'iquest;', 'isin;', 'Iuml;', 'iuml;', 'Kappa;', 'kappa;', 'Lambda;', 'lambda;', 'lang;', 'laquo;', 'lArr;', 'larr;', 'lceil;', 'ldquo;', 'le;', 'lfloor;', 'lowast;', 'loz;', 'lrm;', 'lsaquo;', 'lsquo;', 'lt;', 'macr;', 'mdash;', 'micro;', 'middot;', 'minus;', 'Mu;', 'mu;', 'nabla;', 'nbsp;', 'ndash;', 'ne;', 'ni;', 'not;', 'notin;', 'nsub;', 'Ntilde;', 'ntilde;', 'Nu;', 'nu;', 'Oacute;', 'oacute;', 'Ocirc;', 'ocirc;', 'OElig;', 'oelig;', 'Ograve;', 'ograve;', 'oline;', 'Omega;', 'omega;', 'Omicron;', 'omicron;', 'oplus;', 'or;', 'ordf;', 'ordm;', 'Oslash;', 'oslash;', 'Otilde;', 'otilde;', 'otimes;', 'Ouml;', 'ouml;', 'para;', 'part;', 'permil;', 'perp;', 'Phi;', 'phi;', 'Pi;', 'pi;', 'piv;', 'plusmn;', 'pound;', 'Prime;', 'prime;', 'prod;', 'prop;', 'Psi;', 'psi;', 'quot;', 'radic;', 'rang;', 'raquo;', 'rArr;', 'rarr;', 'rceil;', 'rdquo;', 'real;', 'reg;', 'rfloor;', 'Rho;', 'rho;', 'rlm;', 'rsaquo;', 'rsquo;', 'sbquo;', 'Scaron;', 'scaron;', 'sdot;', 'sect;', 'shy;', 'Sigma;', 'sigma;', 'sigmaf;', 'sim;', 'spades;', 'sub;', 'sube;', 'sum;', 'sup;', 'sup1;', 'sup2;', 'sup3;', 'supe;', 'szlig;', 'Tau;', 'tau;', 'there4;', 'Theta;', 'theta;', 'thetasym;', 'thinsp;', 'THORN;', 'thorn;', 'tilde;', 'times;', 'trade;', 'Uacute;', 'uacute;', 'uArr;', 'uarr;', 'Ucirc;', 'ucirc;', 'Ugrave;', 'ugrave;', 'uml;', 'upsih;', 'Upsilon;', 'upsilon;', 'Uuml;', 'uuml;', 'weierp;', 'Xi;', 'xi;', 'Yacute;', 'yacute;', 'yen;', 'Yuml;', 'yuml;', 'Zeta;', 'zeta;', 'zwj;', 'zwnj;'];
+
+ return values.map(function(value){
+ return {
+ caption: value,
+ snippet: value,
+ meta: "html entity",
+ score: 1000000
+ };
+ });
+ };
+
+}).call(HtmlCompletions.prototype);
+
+exports.HtmlCompletions = HtmlCompletions;
+});
+
+define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var TextMode = require("./text").Mode;
+var JavaScriptMode = require("./javascript").Mode;
+var CssMode = require("./css").Mode;
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
+var HtmlFoldMode = require("./folding/html").FoldMode;
+var HtmlCompletions = require("./html_completions").HtmlCompletions;
+var WorkerClient = require("../worker/worker_client").WorkerClient;
+var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
+var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
+
+var Mode = function(options) {
+ this.fragmentContext = options && options.fragmentContext;
+ this.HighlightRules = HtmlHighlightRules;
+ this.$behaviour = new XmlBehaviour();
+ this.$completer = new HtmlCompletions();
+
+ this.createModeDelegates({
+ "js-": JavaScriptMode,
+ "css-": CssMode
+ });
+
+ this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+ this.blockComment = {start: ""};
+
+ this.voidElements = lang.arrayToMap(voidElements);
+
+ this.getNextLineIndent = function(state, line, tab) {
+ return this.$getIndent(line);
+ };
+
+ this.checkOutdent = function(state, line, input) {
+ return false;
+ };
+
+ this.getCompletions = function(state, session, pos, prefix) {
+ return this.$completer.getCompletions(state, session, pos, prefix);
+ };
+
+ this.createWorker = function(session) {
+ if (this.constructor != Mode)
+ return;
+ var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
+ worker.attachToDocument(session.getDocument());
+
+ if (this.fragmentContext)
+ worker.call("setOptions", [{context: this.fragmentContext}]);
+
+ worker.on("error", function(e) {
+ session.setAnnotations(e.data);
+ });
+
+ worker.on("terminate", function() {
+ session.clearAnnotations();
+ });
+
+ return worker;
+ };
+
+ this.$id = "ace/mode/html";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
+
+define("ace/mode/nunjucks_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+
+var NunjucksHighlightRules = function() {
+ HtmlHighlightRules.call(this);
+ this.$rules["start"].unshift({
+ token: "punctuation.begin",
+ regex: /{{-?/,
+ push: [{
+ token: "punctuation.end",
+ regex: /-?}}/,
+ next: "pop"
+ },
+ {include: "expression"}
+ ]
+ }, {
+ token: "punctuation.begin",
+ regex: /{%-?/,
+ push: [{
+ token: "punctuation.end",
+ regex: /-?%}/,
+ next: "pop"
+ }, {
+ token: "constant.language.escape",
+ regex: /\b(r\/.*\/[gimy]?)\b/
+ },
+ {include: "statement"}
+ ]
+ }, {
+ token: "comment.begin",
+ regex: /{#/,
+ push: [{
+ token: "comment.end",
+ regex: /#}/,
+ next: "pop"
+ },
+ {defaultToken: "comment"}
+ ]
+ });
+ this.addRules({
+ attribute_value: [{
+ token: "string.attribute-value.xml",
+ regex: "'",
+ push: [
+ {token: "string.attribute-value.xml", regex: "'", next: "pop"},
+ {
+ token: "punctuation.begin",
+ regex: /{{-?/,
+ push: [{
+ token: "punctuation.end",
+ regex: /-?}}/,
+ next: "pop"
+ },
+ {include: "expression"}
+ ]
+ },
+ {include: "attr_reference"},
+ {defaultToken: "string.attribute-value.xml"}
+ ]
+ }, {
+ token: "string.attribute-value.xml",
+ regex: '"',
+ push: [
+ {token: "string.attribute-value.xml", regex: '"', next: "pop"},
+ {
+ token: "punctuation.begin",
+ regex: /{{-?/,
+ push: [{
+ token: "punctuation.end",
+ regex: /-?}}/,
+ next: "pop"
+ },
+ {include: "expression"}
+ ]
+ },
+ {include: "attr_reference"},
+ {defaultToken: "string.attribute-value.xml"}
+ ]
+ }],
+ "statement": [{
+ token: "keyword.control",
+ regex: /\b(block|endblock|extends|endif|elif|for|endfor|asyncEach|endeach|include|asyncAll|endall|macro|endmacro|set|endset|ignore missing|as|from|raw|verbatim|filter|endfilter)\b/
+ },
+ {include: "expression"}
+ ],
+ "expression": [{
+ token: "constant.language",
+ regex: /\b(true|false|none)\b/
+ }, {
+ token: "string",
+ regex: /"/,
+ push: [{
+ token: "string",
+ regex: /"/,
+ next: "pop"
+ },
+ {include: "escapeStrings"},
+ {defaultToken: "string"}
+ ]
+ }, {
+ token: "string",
+ regex: /'/,
+ push: [{
+ token: "string",
+ regex: /'/,
+ next: "pop"
+ },
+ {include: "escapeStrings"},
+ {defaultToken: "string"}
+ ]
+ }, {
+ token: "constant.numeric", // hexadecimal, octal and binary
+ regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
+ }, {
+ token: "constant.numeric", // decimal integers and floats
+ regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
+ }, {
+ token: "keyword.operator",
+ regex: /\+|-|\/\/|\/|%|\*\*|\*|===|==|!==|!=|>=|>|<=|
+ }, {
+ token: "keyword.control",
+ regex: /\b(and|else|if|in|import|not|or)\b/
+ }, {
+ token: "support.function",
+ regex: /[a-zA-Z_]+(?=\()/
+ }, {
+ token: "paren.lpar",
+ regex: /[(\[{]/
+ }, {
+ token: "paren.rpar",
+ regex: /[)\]}]/
+ }, {
+ token: "punctuation",
+ regex: /[,]/
+ }, {
+ token: ["punctuation", "support.function"],
+ regex: /(\.)([a-zA-Z_][a-zA-Z0-9_]*)(?=\()/
+ }, {
+ token: ["punctuation", "variable.parameter"],
+ regex: /(\.)([a-zA-Z_][a-zA-Z0-9_]*)/
+ }, {
+ token: ["punctuation", "text", "support.other"],
+ regex: /(\|)(\s)*([a-zA-Z_][a-zA-Z0-9_]*)/
+ }, {
+ token: "variable",
+ regex: /[a-zA-Z_][a-zA-Z0-9_]*/
+ }
+ ],
+ "escapeStrings": [{
+ token: "constant.language.escape",
+ regex: /(\\\\n)|(\\\\)|(\\")|(\\')|(\\a)|(\\b)|(\\f)|(\\n)|(\\r)|(\\t)|(\\v)/
+ }, {
+ token: "constant.language.escape",
+ regex: /\\(?:x[0-9A-F]{2}|(?:U[0-9A-Fa-f]{8})|(?:u[0-9A-Fa-f]{4})|(?:N{[a-zA-Z ]+}))/
+ }]
+ });
+
+ this.normalizeRules();
+};
+
+oop.inherits(NunjucksHighlightRules, TextHighlightRules);
+
+exports.NunjucksHighlightRules = NunjucksHighlightRules;
+});
+
+define("ace/mode/nunjucks",["require","exports","module","ace/lib/oop","ace/mode/html","ace/mode/nunjucks_highlight_rules"], function(require, exports, module) {
+ "use strict";
+
+var oop = require("../lib/oop");
+var HtmlMode = require("./html").Mode;
+var NunjucksHighlightRules = require("./nunjucks_highlight_rules").NunjucksHighlightRules;
+
+var Mode = function() {
+ this.HighlightRules = NunjucksHighlightRules;
+};
+
+oop.inherits(Mode, HtmlMode);
+
+(function() {
+ this.$id = "ace/mode/nunjucks";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+}); (function() {
+ window.require(["ace/mode/nunjucks"], function(m) {
+ if (typeof module == "object" && typeof exports == "object" && module) {
+ module.exports = m;
+ }
+ });
+ })();
+
\ No newline at end of file
diff --git a/htdocs/includes/ace/src/mode-rust.js b/htdocs/includes/ace/src/mode-rust.js
index d10bdfce408..e24ed47a680 100644
--- a/htdocs/includes/ace/src/mode-rust.js
+++ b/htdocs/includes/ace/src/mode-rust.js
@@ -56,7 +56,7 @@ var RustHighlightRules = function() {
regex: '\\b(fn)(\\s+)((?:r#)?[a-zA-Z_][a-zA-Z0-9_]*)' },
{ token: 'support.constant', regex: '\\b[a-zA-Z_][\\w\\d]*::' },
{ token: 'keyword.source.rust',
- regex: '\\b(?:abstract|alignof|as|become|box|break|catch|continue|const|crate|default|do|dyn|else|enum|extern|for|final|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\\b' },
+ regex: '\\b(?:abstract|alignof|as|async|await|become|box|break|catch|continue|const|crate|default|do|dyn|else|enum|extern|for|final|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\\b' },
{ token: 'storage.type.source.rust',
regex: '\\b(?:Self|isize|usize|char|bool|u8|u16|u32|u64|u128|f16|f32|f64|i8|i16|i32|i64|i128|str|option|either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b' },
{ token: 'variable.language.source.rust', regex: '\\bself\\b' },
diff --git a/htdocs/includes/ace/src/mode-slim.js b/htdocs/includes/ace/src/mode-slim.js
index 320e6a75b92..7f243bde705 100644
--- a/htdocs/includes/ace/src/mode-slim.js
+++ b/htdocs/includes/ace/src/mode-slim.js
@@ -2831,7 +2831,7 @@ var MarkdownHighlightRules = function() {
next : "blockquote"
}, { // HR * - _
token : "constant",
- regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$",
+ regex : "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
next: "allowBlock"
}, { // list
token : "markup.list",
diff --git a/htdocs/includes/ace/src/mode-vhdl.js b/htdocs/includes/ace/src/mode-vhdl.js
index e6222383e60..75f22a1f512 100644
--- a/htdocs/includes/ace/src/mode-vhdl.js
+++ b/htdocs/includes/ace/src/mode-vhdl.js
@@ -12,15 +12,14 @@ var VHDLHighlightRules = function() {
"begin|block|buffer|bus|case|component|configuration|"+
"disconnect|downto|else|elsif|end|entity|file|for|function|"+
"generate|generic|guarded|if|impure|in|inertial|inout|is|"+
- "label|linkage|literal|loop|mapnew|next|of|on|open|"+
- "others|out|port|process|pure|range|record|reject|"+
- "report|return|select|shared|subtype|then|to|transport|"+
+ "label|linkage|literal|loop|mapnew|next|of|on|open|others|"+
+ "out|port|process|pure|range|record|reject|report|return|"+
+ "select|severity|shared|signal|subtype|then|to|transport|"+
"type|unaffected|united|until|wait|when|while|with";
var storageType = "bit|bit_vector|boolean|character|integer|line|natural|"+
- "positive|real|register|severity|signal|signed|"+
- "std_logic|std_logic_vector|string||text|time|unsigned|"+
- "variable";
+ "positive|real|register|signed|std_logic|"+
+ "std_logic_vector|string||text|time|unsigned|variable";
var storageModifiers = "array|constant";
diff --git a/htdocs/includes/ace/src/snippets/json5.js b/htdocs/includes/ace/src/snippets/json5.js
new file mode 100644
index 00000000000..8afbead737d
--- /dev/null
+++ b/htdocs/includes/ace/src/snippets/json5.js
@@ -0,0 +1,14 @@
+define("ace/snippets/json5",["require","exports","module"], function(require, exports, module) {
+"use strict";
+
+exports.snippetText =undefined;
+exports.scope = "json5";
+
+}); (function() {
+ window.require(["ace/snippets/json5"], function(m) {
+ if (typeof module == "object" && typeof exports == "object" && module) {
+ module.exports = m;
+ }
+ });
+ })();
+
\ No newline at end of file
diff --git a/htdocs/includes/ace/src/snippets/nunjucks.js b/htdocs/includes/ace/src/snippets/nunjucks.js
new file mode 100644
index 00000000000..961adec5778
--- /dev/null
+++ b/htdocs/includes/ace/src/snippets/nunjucks.js
@@ -0,0 +1,14 @@
+define("ace/snippets/nunjucks",["require","exports","module"], function(require, exports, module) {
+"use strict";
+
+exports.snippetText =undefined;
+exports.scope = "nunjucks";
+
+}); (function() {
+ window.require(["ace/snippets/nunjucks"], function(m) {
+ if (typeof module == "object" && typeof exports == "object" && module) {
+ module.exports = m;
+ }
+ });
+ })();
+
\ No newline at end of file
diff --git a/htdocs/includes/ace/src/worker-coffee.js b/htdocs/includes/ace/src/worker-coffee.js
index 38a3b4a12c6..e924c0c88a4 100644
--- a/htdocs/includes/ace/src/worker-coffee.js
+++ b/htdocs/includes/ace/src/worker-coffee.js
@@ -2092,10 +2092,10 @@ if (!Date.now) {
return new Date().getTime();
};
}
-var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
+var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
"\u2029\uFEFF";
-if (!String.prototype.trim || ws.trim()) {
+if (!String.prototype.trim) {
ws = "[" + ws + "]";
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
trimEndRegexp = new RegExp(ws + ws + "*$");
diff --git a/htdocs/includes/ace/src/worker-css.js b/htdocs/includes/ace/src/worker-css.js
index 78d75c18028..a7d914e3397 100644
--- a/htdocs/includes/ace/src/worker-css.js
+++ b/htdocs/includes/ace/src/worker-css.js
@@ -8709,10 +8709,10 @@ if (!Date.now) {
return new Date().getTime();
};
}
-var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
+var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
"\u2029\uFEFF";
-if (!String.prototype.trim || ws.trim()) {
+if (!String.prototype.trim) {
ws = "[" + ws + "]";
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
trimEndRegexp = new RegExp(ws + ws + "*$");
diff --git a/htdocs/includes/ace/src/worker-html.js b/htdocs/includes/ace/src/worker-html.js
index 6d60761b9a1..f52f5eeb204 100644
--- a/htdocs/includes/ace/src/worker-html.js
+++ b/htdocs/includes/ace/src/worker-html.js
@@ -11544,10 +11544,10 @@ if (!Date.now) {
return new Date().getTime();
};
}
-var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
+var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
"\u2029\uFEFF";
-if (!String.prototype.trim || ws.trim()) {
+if (!String.prototype.trim) {
ws = "[" + ws + "]";
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
trimEndRegexp = new RegExp(ws + ws + "*$");
diff --git a/htdocs/includes/ace/src/worker-javascript.js b/htdocs/includes/ace/src/worker-javascript.js
index 19f5058d5c1..4d3d2a85e99 100644
--- a/htdocs/includes/ace/src/worker-javascript.js
+++ b/htdocs/includes/ace/src/worker-javascript.js
@@ -12467,10 +12467,10 @@ if (!Date.now) {
return new Date().getTime();
};
}
-var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
+var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
"\u2029\uFEFF";
-if (!String.prototype.trim || ws.trim()) {
+if (!String.prototype.trim) {
ws = "[" + ws + "]";
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
trimEndRegexp = new RegExp(ws + ws + "*$");
diff --git a/htdocs/includes/ace/src/worker-json.js b/htdocs/includes/ace/src/worker-json.js
index 3f5abb5c5fe..0f7fa308c6f 100644
--- a/htdocs/includes/ace/src/worker-json.js
+++ b/htdocs/includes/ace/src/worker-json.js
@@ -2337,10 +2337,10 @@ if (!Date.now) {
return new Date().getTime();
};
}
-var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
+var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
"\u2029\uFEFF";
-if (!String.prototype.trim || ws.trim()) {
+if (!String.prototype.trim) {
ws = "[" + ws + "]";
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
trimEndRegexp = new RegExp(ws + ws + "*$");
diff --git a/htdocs/includes/ace/src/worker-lua.js b/htdocs/includes/ace/src/worker-lua.js
index 6e1ebb68275..9884d2a8759 100644
--- a/htdocs/includes/ace/src/worker-lua.js
+++ b/htdocs/includes/ace/src/worker-lua.js
@@ -3572,10 +3572,10 @@ if (!Date.now) {
return new Date().getTime();
};
}
-var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
+var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
"\u2029\uFEFF";
-if (!String.prototype.trim || ws.trim()) {
+if (!String.prototype.trim) {
ws = "[" + ws + "]";
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
trimEndRegexp = new RegExp(ws + ws + "*$");
diff --git a/htdocs/includes/ace/src/worker-php.js b/htdocs/includes/ace/src/worker-php.js
index 7d41f37cb50..9be61099005 100644
--- a/htdocs/includes/ace/src/worker-php.js
+++ b/htdocs/includes/ace/src/worker-php.js
@@ -2394,7 +2394,7 @@ PHP.Lexer = function(src, ini) {
};
-PHP.Parser = function ( preprocessedTokens, eval ) {
+PHP.Parser = function ( preprocessedTokens, evaluate ) {
var yybase = this.yybase,
yydefault = this.yydefault,
@@ -2516,7 +2516,7 @@ PHP.Parser = function ( preprocessedTokens, eval ) {
this.yyastk[ this.stackPos ] = this.yyval;
attributeStack[ this.stackPos ] = this.startAttributes;
} else {
- if (eval !== true) {
+ if (evaluate !== true) {
var expected = [];
@@ -4241,10 +4241,10 @@ if (!Date.now) {
return new Date().getTime();
};
}
-var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
+var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
"\u2029\uFEFF";
-if (!String.prototype.trim || ws.trim()) {
+if (!String.prototype.trim) {
ws = "[" + ws + "]";
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
trimEndRegexp = new RegExp(ws + ws + "*$");
diff --git a/htdocs/includes/ace/src/worker-xml.js b/htdocs/includes/ace/src/worker-xml.js
index f6ea2cbf148..d661272a9d2 100644
--- a/htdocs/includes/ace/src/worker-xml.js
+++ b/htdocs/includes/ace/src/worker-xml.js
@@ -1824,10 +1824,15 @@ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '',start+9);
- domBuilder.startCDATA();
- domBuilder.characters(source,start+9,end-start-9);
- domBuilder.endCDATA()
- return end+3;
+ if (end > start) {
+ domBuilder.startCDATA();
+ domBuilder.characters(source,start+9,end-start-9);
+ domBuilder.endCDATA()
+ return end+3;
+ } else {
+ errorHandler.error("Unclosed CDATA");
+ return -1;
+ }
}
var matchs = split(source,start);
var len = matchs.length;
@@ -3825,10 +3830,10 @@ if (!Date.now) {
return new Date().getTime();
};
}
-var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
+var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
"\u2029\uFEFF";
-if (!String.prototype.trim || ws.trim()) {
+if (!String.prototype.trim) {
ws = "[" + ws + "]";
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
trimEndRegexp = new RegExp(ws + ws + "*$");
diff --git a/htdocs/includes/ace/src/worker-xquery.js b/htdocs/includes/ace/src/worker-xquery.js
index a20b76c2c28..6f0f68123d2 100644
--- a/htdocs/includes/ace/src/worker-xquery.js
+++ b/htdocs/includes/ace/src/worker-xquery.js
@@ -58290,10 +58290,10 @@ if (!Date.now) {
return new Date().getTime();
};
}
-var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
+var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
"\u2029\uFEFF";
-if (!String.prototype.trim || ws.trim()) {
+if (!String.prototype.trim) {
ws = "[" + ws + "]";
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
trimEndRegexp = new RegExp(ws + ws + "*$");
diff --git a/htdocs/includes/ace/webpack-resolver.js b/htdocs/includes/ace/webpack-resolver.js
index 1d5de60d98a..6205871f242 100644
--- a/htdocs/includes/ace/webpack-resolver.js
+++ b/htdocs/includes/ace/webpack-resolver.js
@@ -1,403 +1,403 @@
-ace.config.setModuleUrl('ace/ext/beautify', require('file-loader!./src-noconflict/ext-beautify.js'))
-ace.config.setModuleUrl('ace/ext/elastic_tabstops_lite', require('file-loader!./src-noconflict/ext-elastic_tabstops_lite.js'))
-ace.config.setModuleUrl('ace/ext/emmet', require('file-loader!./src-noconflict/ext-emmet.js'))
-ace.config.setModuleUrl('ace/ext/error_marker', require('file-loader!./src-noconflict/ext-error_marker.js'))
-ace.config.setModuleUrl('ace/ext/keyboard_menu', require('file-loader!./src-noconflict/ext-keybinding_menu.js'))
-ace.config.setModuleUrl('ace/ext/language_tools', require('file-loader!./src-noconflict/ext-language_tools.js'))
-ace.config.setModuleUrl('ace/ext/linking', require('file-loader!./src-noconflict/ext-linking.js'))
-ace.config.setModuleUrl('ace/ext/modelist', require('file-loader!./src-noconflict/ext-modelist.js'))
-ace.config.setModuleUrl('ace/ext/options', require('file-loader!./src-noconflict/ext-options.js'))
-ace.config.setModuleUrl('ace/ext/prompt', require('file-loader!./src-noconflict/ext-prompt.js'))
-ace.config.setModuleUrl('ace/ext/rtl', require('file-loader!./src-noconflict/ext-rtl.js'))
-ace.config.setModuleUrl('ace/ext/searchbox', require('file-loader!./src-noconflict/ext-searchbox.js'))
-ace.config.setModuleUrl('ace/ext/settings_menu', require('file-loader!./src-noconflict/ext-settings_menu.js'))
-ace.config.setModuleUrl('ace/ext/spellcheck', require('file-loader!./src-noconflict/ext-spellcheck.js'))
-ace.config.setModuleUrl('ace/ext/split', require('file-loader!./src-noconflict/ext-split.js'))
-ace.config.setModuleUrl('ace/ext/static_highlight', require('file-loader!./src-noconflict/ext-static_highlight.js'))
-ace.config.setModuleUrl('ace/ext/statusbar', require('file-loader!./src-noconflict/ext-statusbar.js'))
-ace.config.setModuleUrl('ace/ext/textarea', require('file-loader!./src-noconflict/ext-textarea.js'))
-ace.config.setModuleUrl('ace/ext/themelist', require('file-loader!./src-noconflict/ext-themelist.js'))
-ace.config.setModuleUrl('ace/ext/whitespace', require('file-loader!./src-noconflict/ext-whitespace.js'))
-ace.config.setModuleUrl('ace/keyboard/emacs', require('file-loader!./src-noconflict/keybinding-emacs.js'))
-ace.config.setModuleUrl('ace/keyboard/sublime', require('file-loader!./src-noconflict/keybinding-sublime.js'))
-ace.config.setModuleUrl('ace/keyboard/vim', require('file-loader!./src-noconflict/keybinding-vim.js'))
-ace.config.setModuleUrl('ace/mode/abap', require('file-loader!./src-noconflict/mode-abap.js'))
-ace.config.setModuleUrl('ace/mode/abc', require('file-loader!./src-noconflict/mode-abc.js'))
-ace.config.setModuleUrl('ace/mode/actionscript', require('file-loader!./src-noconflict/mode-actionscript.js'))
-ace.config.setModuleUrl('ace/mode/ada', require('file-loader!./src-noconflict/mode-ada.js'))
-ace.config.setModuleUrl('ace/mode/apache_conf', require('file-loader!./src-noconflict/mode-apache_conf.js'))
-ace.config.setModuleUrl('ace/mode/apex', require('file-loader!./src-noconflict/mode-apex.js'))
-ace.config.setModuleUrl('ace/mode/applescript', require('file-loader!./src-noconflict/mode-applescript.js'))
-ace.config.setModuleUrl('ace/mode/aql', require('file-loader!./src-noconflict/mode-aql.js'))
-ace.config.setModuleUrl('ace/mode/asciidoc', require('file-loader!./src-noconflict/mode-asciidoc.js'))
-ace.config.setModuleUrl('ace/mode/asl', require('file-loader!./src-noconflict/mode-asl.js'))
-ace.config.setModuleUrl('ace/mode/assembly_x86', require('file-loader!./src-noconflict/mode-assembly_x86.js'))
-ace.config.setModuleUrl('ace/mode/autohotkey', require('file-loader!./src-noconflict/mode-autohotkey.js'))
-ace.config.setModuleUrl('ace/mode/batchfile', require('file-loader!./src-noconflict/mode-batchfile.js'))
-ace.config.setModuleUrl('ace/mode/bro', require('file-loader!./src-noconflict/mode-bro.js'))
-ace.config.setModuleUrl('ace/mode/c9search', require('file-loader!./src-noconflict/mode-c9search.js'))
-ace.config.setModuleUrl('ace/mode/cirru', require('file-loader!./src-noconflict/mode-cirru.js'))
-ace.config.setModuleUrl('ace/mode/clojure', require('file-loader!./src-noconflict/mode-clojure.js'))
-ace.config.setModuleUrl('ace/mode/cobol', require('file-loader!./src-noconflict/mode-cobol.js'))
-ace.config.setModuleUrl('ace/mode/coffee', require('file-loader!./src-noconflict/mode-coffee.js'))
-ace.config.setModuleUrl('ace/mode/coldfusion', require('file-loader!./src-noconflict/mode-coldfusion.js'))
-ace.config.setModuleUrl('ace/mode/crystal', require('file-loader!./src-noconflict/mode-crystal.js'))
-ace.config.setModuleUrl('ace/mode/csharp', require('file-loader!./src-noconflict/mode-csharp.js'))
-ace.config.setModuleUrl('ace/mode/csound_document', require('file-loader!./src-noconflict/mode-csound_document.js'))
-ace.config.setModuleUrl('ace/mode/csound_orchestra', require('file-loader!./src-noconflict/mode-csound_orchestra.js'))
-ace.config.setModuleUrl('ace/mode/csound_score', require('file-loader!./src-noconflict/mode-csound_score.js'))
-ace.config.setModuleUrl('ace/mode/csp', require('file-loader!./src-noconflict/mode-csp.js'))
-ace.config.setModuleUrl('ace/mode/css', require('file-loader!./src-noconflict/mode-css.js'))
-ace.config.setModuleUrl('ace/mode/curly', require('file-loader!./src-noconflict/mode-curly.js'))
-ace.config.setModuleUrl('ace/mode/c_cpp', require('file-loader!./src-noconflict/mode-c_cpp.js'))
-ace.config.setModuleUrl('ace/mode/d', require('file-loader!./src-noconflict/mode-d.js'))
-ace.config.setModuleUrl('ace/mode/dart', require('file-loader!./src-noconflict/mode-dart.js'))
-ace.config.setModuleUrl('ace/mode/diff', require('file-loader!./src-noconflict/mode-diff.js'))
-ace.config.setModuleUrl('ace/mode/django', require('file-loader!./src-noconflict/mode-django.js'))
-ace.config.setModuleUrl('ace/mode/dockerfile', require('file-loader!./src-noconflict/mode-dockerfile.js'))
-ace.config.setModuleUrl('ace/mode/dot', require('file-loader!./src-noconflict/mode-dot.js'))
-ace.config.setModuleUrl('ace/mode/drools', require('file-loader!./src-noconflict/mode-drools.js'))
-ace.config.setModuleUrl('ace/mode/edifact', require('file-loader!./src-noconflict/mode-edifact.js'))
-ace.config.setModuleUrl('ace/mode/eiffel', require('file-loader!./src-noconflict/mode-eiffel.js'))
-ace.config.setModuleUrl('ace/mode/ejs', require('file-loader!./src-noconflict/mode-ejs.js'))
-ace.config.setModuleUrl('ace/mode/elixir', require('file-loader!./src-noconflict/mode-elixir.js'))
-ace.config.setModuleUrl('ace/mode/elm', require('file-loader!./src-noconflict/mode-elm.js'))
-ace.config.setModuleUrl('ace/mode/erlang', require('file-loader!./src-noconflict/mode-erlang.js'))
-ace.config.setModuleUrl('ace/mode/forth', require('file-loader!./src-noconflict/mode-forth.js'))
-ace.config.setModuleUrl('ace/mode/fortran', require('file-loader!./src-noconflict/mode-fortran.js'))
-ace.config.setModuleUrl('ace/mode/fsharp', require('file-loader!./src-noconflict/mode-fsharp.js'))
-ace.config.setModuleUrl('ace/mode/fsl', require('file-loader!./src-noconflict/mode-fsl.js'))
-ace.config.setModuleUrl('ace/mode/ftl', require('file-loader!./src-noconflict/mode-ftl.js'))
-ace.config.setModuleUrl('ace/mode/gcode', require('file-loader!./src-noconflict/mode-gcode.js'))
-ace.config.setModuleUrl('ace/mode/gherkin', require('file-loader!./src-noconflict/mode-gherkin.js'))
-ace.config.setModuleUrl('ace/mode/gitignore', require('file-loader!./src-noconflict/mode-gitignore.js'))
-ace.config.setModuleUrl('ace/mode/glsl', require('file-loader!./src-noconflict/mode-glsl.js'))
-ace.config.setModuleUrl('ace/mode/gobstones', require('file-loader!./src-noconflict/mode-gobstones.js'))
-ace.config.setModuleUrl('ace/mode/golang', require('file-loader!./src-noconflict/mode-golang.js'))
-ace.config.setModuleUrl('ace/mode/graphqlschema', require('file-loader!./src-noconflict/mode-graphqlschema.js'))
-ace.config.setModuleUrl('ace/mode/groovy', require('file-loader!./src-noconflict/mode-groovy.js'))
-ace.config.setModuleUrl('ace/mode/haml', require('file-loader!./src-noconflict/mode-haml.js'))
-ace.config.setModuleUrl('ace/mode/handlebars', require('file-loader!./src-noconflict/mode-handlebars.js'))
-ace.config.setModuleUrl('ace/mode/haskell', require('file-loader!./src-noconflict/mode-haskell.js'))
-ace.config.setModuleUrl('ace/mode/haskell_cabal', require('file-loader!./src-noconflict/mode-haskell_cabal.js'))
-ace.config.setModuleUrl('ace/mode/haxe', require('file-loader!./src-noconflict/mode-haxe.js'))
-ace.config.setModuleUrl('ace/mode/hjson', require('file-loader!./src-noconflict/mode-hjson.js'))
-ace.config.setModuleUrl('ace/mode/html', require('file-loader!./src-noconflict/mode-html.js'))
-ace.config.setModuleUrl('ace/mode/html_elixir', require('file-loader!./src-noconflict/mode-html_elixir.js'))
-ace.config.setModuleUrl('ace/mode/html_ruby', require('file-loader!./src-noconflict/mode-html_ruby.js'))
-ace.config.setModuleUrl('ace/mode/ini', require('file-loader!./src-noconflict/mode-ini.js'))
-ace.config.setModuleUrl('ace/mode/io', require('file-loader!./src-noconflict/mode-io.js'))
-ace.config.setModuleUrl('ace/mode/jack', require('file-loader!./src-noconflict/mode-jack.js'))
-ace.config.setModuleUrl('ace/mode/jade', require('file-loader!./src-noconflict/mode-jade.js'))
-ace.config.setModuleUrl('ace/mode/java', require('file-loader!./src-noconflict/mode-java.js'))
-ace.config.setModuleUrl('ace/mode/javascript', require('file-loader!./src-noconflict/mode-javascript.js'))
-ace.config.setModuleUrl('ace/mode/json', require('file-loader!./src-noconflict/mode-json.js'))
-ace.config.setModuleUrl('ace/mode/jsoniq', require('file-loader!./src-noconflict/mode-jsoniq.js'))
-ace.config.setModuleUrl('ace/mode/jsp', require('file-loader!./src-noconflict/mode-jsp.js'))
-ace.config.setModuleUrl('ace/mode/jssm', require('file-loader!./src-noconflict/mode-jssm.js'))
-ace.config.setModuleUrl('ace/mode/jsx', require('file-loader!./src-noconflict/mode-jsx.js'))
-ace.config.setModuleUrl('ace/mode/julia', require('file-loader!./src-noconflict/mode-julia.js'))
-ace.config.setModuleUrl('ace/mode/kotlin', require('file-loader!./src-noconflict/mode-kotlin.js'))
-ace.config.setModuleUrl('ace/mode/latex', require('file-loader!./src-noconflict/mode-latex.js'))
-ace.config.setModuleUrl('ace/mode/less', require('file-loader!./src-noconflict/mode-less.js'))
-ace.config.setModuleUrl('ace/mode/liquid', require('file-loader!./src-noconflict/mode-liquid.js'))
-ace.config.setModuleUrl('ace/mode/lisp', require('file-loader!./src-noconflict/mode-lisp.js'))
-ace.config.setModuleUrl('ace/mode/livescript', require('file-loader!./src-noconflict/mode-livescript.js'))
-ace.config.setModuleUrl('ace/mode/logiql', require('file-loader!./src-noconflict/mode-logiql.js'))
-ace.config.setModuleUrl('ace/mode/logtalk', require('file-loader!./src-noconflict/mode-logtalk.js'))
-ace.config.setModuleUrl('ace/mode/lsl', require('file-loader!./src-noconflict/mode-lsl.js'))
-ace.config.setModuleUrl('ace/mode/lua', require('file-loader!./src-noconflict/mode-lua.js'))
-ace.config.setModuleUrl('ace/mode/luapage', require('file-loader!./src-noconflict/mode-luapage.js'))
-ace.config.setModuleUrl('ace/mode/lucene', require('file-loader!./src-noconflict/mode-lucene.js'))
-ace.config.setModuleUrl('ace/mode/makefile', require('file-loader!./src-noconflict/mode-makefile.js'))
-ace.config.setModuleUrl('ace/mode/markdown', require('file-loader!./src-noconflict/mode-markdown.js'))
-ace.config.setModuleUrl('ace/mode/mask', require('file-loader!./src-noconflict/mode-mask.js'))
-ace.config.setModuleUrl('ace/mode/matlab', require('file-loader!./src-noconflict/mode-matlab.js'))
-ace.config.setModuleUrl('ace/mode/maze', require('file-loader!./src-noconflict/mode-maze.js'))
-ace.config.setModuleUrl('ace/mode/mel', require('file-loader!./src-noconflict/mode-mel.js'))
-ace.config.setModuleUrl('ace/mode/mixal', require('file-loader!./src-noconflict/mode-mixal.js'))
-ace.config.setModuleUrl('ace/mode/mushcode', require('file-loader!./src-noconflict/mode-mushcode.js'))
-ace.config.setModuleUrl('ace/mode/mysql', require('file-loader!./src-noconflict/mode-mysql.js'))
-ace.config.setModuleUrl('ace/mode/nginx', require('file-loader!./src-noconflict/mode-nginx.js'))
-ace.config.setModuleUrl('ace/mode/nim', require('file-loader!./src-noconflict/mode-nim.js'))
-ace.config.setModuleUrl('ace/mode/nix', require('file-loader!./src-noconflict/mode-nix.js'))
-ace.config.setModuleUrl('ace/mode/nsis', require('file-loader!./src-noconflict/mode-nsis.js'))
-ace.config.setModuleUrl('ace/mode/objectivec', require('file-loader!./src-noconflict/mode-objectivec.js'))
-ace.config.setModuleUrl('ace/mode/ocaml', require('file-loader!./src-noconflict/mode-ocaml.js'))
-ace.config.setModuleUrl('ace/mode/pascal', require('file-loader!./src-noconflict/mode-pascal.js'))
-ace.config.setModuleUrl('ace/mode/perl', require('file-loader!./src-noconflict/mode-perl.js'))
-ace.config.setModuleUrl('ace/mode/perl6', require('file-loader!./src-noconflict/mode-perl6.js'))
-ace.config.setModuleUrl('ace/mode/pgsql', require('file-loader!./src-noconflict/mode-pgsql.js'))
-ace.config.setModuleUrl('ace/mode/php', require('file-loader!./src-noconflict/mode-php.js'))
-ace.config.setModuleUrl('ace/mode/php_laravel_blade', require('file-loader!./src-noconflict/mode-php_laravel_blade.js'))
-ace.config.setModuleUrl('ace/mode/pig', require('file-loader!./src-noconflict/mode-pig.js'))
-ace.config.setModuleUrl('ace/mode/plain_text', require('file-loader!./src-noconflict/mode-plain_text.js'))
-ace.config.setModuleUrl('ace/mode/powershell', require('file-loader!./src-noconflict/mode-powershell.js'))
-ace.config.setModuleUrl('ace/mode/praat', require('file-loader!./src-noconflict/mode-praat.js'))
-ace.config.setModuleUrl('ace/mode/prolog', require('file-loader!./src-noconflict/mode-prolog.js'))
-ace.config.setModuleUrl('ace/mode/properties', require('file-loader!./src-noconflict/mode-properties.js'))
-ace.config.setModuleUrl('ace/mode/protobuf', require('file-loader!./src-noconflict/mode-protobuf.js'))
-ace.config.setModuleUrl('ace/mode/puppet', require('file-loader!./src-noconflict/mode-puppet.js'))
-ace.config.setModuleUrl('ace/mode/python', require('file-loader!./src-noconflict/mode-python.js'))
-ace.config.setModuleUrl('ace/mode/r', require('file-loader!./src-noconflict/mode-r.js'))
-ace.config.setModuleUrl('ace/mode/razor', require('file-loader!./src-noconflict/mode-razor.js'))
-ace.config.setModuleUrl('ace/mode/rdoc', require('file-loader!./src-noconflict/mode-rdoc.js'))
-ace.config.setModuleUrl('ace/mode/red', require('file-loader!./src-noconflict/mode-red.js'))
-ace.config.setModuleUrl('ace/mode/redshift', require('file-loader!./src-noconflict/mode-redshift.js'))
-ace.config.setModuleUrl('ace/mode/rhtml', require('file-loader!./src-noconflict/mode-rhtml.js'))
-ace.config.setModuleUrl('ace/mode/rst', require('file-loader!./src-noconflict/mode-rst.js'))
-ace.config.setModuleUrl('ace/mode/ruby', require('file-loader!./src-noconflict/mode-ruby.js'))
-ace.config.setModuleUrl('ace/mode/rust', require('file-loader!./src-noconflict/mode-rust.js'))
-ace.config.setModuleUrl('ace/mode/sass', require('file-loader!./src-noconflict/mode-sass.js'))
-ace.config.setModuleUrl('ace/mode/scad', require('file-loader!./src-noconflict/mode-scad.js'))
-ace.config.setModuleUrl('ace/mode/scala', require('file-loader!./src-noconflict/mode-scala.js'))
-ace.config.setModuleUrl('ace/mode/scheme', require('file-loader!./src-noconflict/mode-scheme.js'))
-ace.config.setModuleUrl('ace/mode/scss', require('file-loader!./src-noconflict/mode-scss.js'))
-ace.config.setModuleUrl('ace/mode/sh', require('file-loader!./src-noconflict/mode-sh.js'))
-ace.config.setModuleUrl('ace/mode/sjs', require('file-loader!./src-noconflict/mode-sjs.js'))
-ace.config.setModuleUrl('ace/mode/slim', require('file-loader!./src-noconflict/mode-slim.js'))
-ace.config.setModuleUrl('ace/mode/smarty', require('file-loader!./src-noconflict/mode-smarty.js'))
-ace.config.setModuleUrl('ace/mode/snippets', require('file-loader!./src-noconflict/mode-snippets.js'))
-ace.config.setModuleUrl('ace/mode/soy_template', require('file-loader!./src-noconflict/mode-soy_template.js'))
-ace.config.setModuleUrl('ace/mode/space', require('file-loader!./src-noconflict/mode-space.js'))
-ace.config.setModuleUrl('ace/mode/sparql', require('file-loader!./src-noconflict/mode-sparql.js'))
-ace.config.setModuleUrl('ace/mode/sql', require('file-loader!./src-noconflict/mode-sql.js'))
-ace.config.setModuleUrl('ace/mode/sqlserver', require('file-loader!./src-noconflict/mode-sqlserver.js'))
-ace.config.setModuleUrl('ace/mode/stylus', require('file-loader!./src-noconflict/mode-stylus.js'))
-ace.config.setModuleUrl('ace/mode/svg', require('file-loader!./src-noconflict/mode-svg.js'))
-ace.config.setModuleUrl('ace/mode/swift', require('file-loader!./src-noconflict/mode-swift.js'))
-ace.config.setModuleUrl('ace/mode/tcl', require('file-loader!./src-noconflict/mode-tcl.js'))
-ace.config.setModuleUrl('ace/mode/terraform', require('file-loader!./src-noconflict/mode-terraform.js'))
-ace.config.setModuleUrl('ace/mode/tex', require('file-loader!./src-noconflict/mode-tex.js'))
-ace.config.setModuleUrl('ace/mode/text', require('file-loader!./src-noconflict/mode-text.js'))
-ace.config.setModuleUrl('ace/mode/textile', require('file-loader!./src-noconflict/mode-textile.js'))
-ace.config.setModuleUrl('ace/mode/toml', require('file-loader!./src-noconflict/mode-toml.js'))
-ace.config.setModuleUrl('ace/mode/tsx', require('file-loader!./src-noconflict/mode-tsx.js'))
-ace.config.setModuleUrl('ace/mode/turtle', require('file-loader!./src-noconflict/mode-turtle.js'))
-ace.config.setModuleUrl('ace/mode/twig', require('file-loader!./src-noconflict/mode-twig.js'))
-ace.config.setModuleUrl('ace/mode/typescript', require('file-loader!./src-noconflict/mode-typescript.js'))
-ace.config.setModuleUrl('ace/mode/vala', require('file-loader!./src-noconflict/mode-vala.js'))
-ace.config.setModuleUrl('ace/mode/vbscript', require('file-loader!./src-noconflict/mode-vbscript.js'))
-ace.config.setModuleUrl('ace/mode/velocity', require('file-loader!./src-noconflict/mode-velocity.js'))
-ace.config.setModuleUrl('ace/mode/verilog', require('file-loader!./src-noconflict/mode-verilog.js'))
-ace.config.setModuleUrl('ace/mode/vhdl', require('file-loader!./src-noconflict/mode-vhdl.js'))
-ace.config.setModuleUrl('ace/mode/visualforce', require('file-loader!./src-noconflict/mode-visualforce.js'))
-ace.config.setModuleUrl('ace/mode/wollok', require('file-loader!./src-noconflict/mode-wollok.js'))
-ace.config.setModuleUrl('ace/mode/xml', require('file-loader!./src-noconflict/mode-xml.js'))
-ace.config.setModuleUrl('ace/mode/xquery', require('file-loader!./src-noconflict/mode-xquery.js'))
-ace.config.setModuleUrl('ace/mode/yaml', require('file-loader!./src-noconflict/mode-yaml.js'))
-ace.config.setModuleUrl('ace/mode/zeek', require('file-loader!./src-noconflict/mode-zeek.js'))
+ace.config.setModuleUrl('ace/ext/beautify', require('file-loader?esModule=false!./src-noconflict/ext-beautify.js'))
+ace.config.setModuleUrl('ace/ext/elastic_tabstops_lite', require('file-loader?esModule=false!./src-noconflict/ext-elastic_tabstops_lite.js'))
+ace.config.setModuleUrl('ace/ext/emmet', require('file-loader?esModule=false!./src-noconflict/ext-emmet.js'))
+ace.config.setModuleUrl('ace/ext/error_marker', require('file-loader?esModule=false!./src-noconflict/ext-error_marker.js'))
+ace.config.setModuleUrl('ace/ext/keyboard_menu', require('file-loader?esModule=false!./src-noconflict/ext-keybinding_menu.js'))
+ace.config.setModuleUrl('ace/ext/language_tools', require('file-loader?esModule=false!./src-noconflict/ext-language_tools.js'))
+ace.config.setModuleUrl('ace/ext/linking', require('file-loader?esModule=false!./src-noconflict/ext-linking.js'))
+ace.config.setModuleUrl('ace/ext/modelist', require('file-loader?esModule=false!./src-noconflict/ext-modelist.js'))
+ace.config.setModuleUrl('ace/ext/options', require('file-loader?esModule=false!./src-noconflict/ext-options.js'))
+ace.config.setModuleUrl('ace/ext/prompt', require('file-loader?esModule=false!./src-noconflict/ext-prompt.js'))
+ace.config.setModuleUrl('ace/ext/rtl', require('file-loader?esModule=false!./src-noconflict/ext-rtl.js'))
+ace.config.setModuleUrl('ace/ext/searchbox', require('file-loader?esModule=false!./src-noconflict/ext-searchbox.js'))
+ace.config.setModuleUrl('ace/ext/settings_menu', require('file-loader?esModule=false!./src-noconflict/ext-settings_menu.js'))
+ace.config.setModuleUrl('ace/ext/spellcheck', require('file-loader?esModule=false!./src-noconflict/ext-spellcheck.js'))
+ace.config.setModuleUrl('ace/ext/split', require('file-loader?esModule=false!./src-noconflict/ext-split.js'))
+ace.config.setModuleUrl('ace/ext/static_highlight', require('file-loader?esModule=false!./src-noconflict/ext-static_highlight.js'))
+ace.config.setModuleUrl('ace/ext/statusbar', require('file-loader?esModule=false!./src-noconflict/ext-statusbar.js'))
+ace.config.setModuleUrl('ace/ext/textarea', require('file-loader?esModule=false!./src-noconflict/ext-textarea.js'))
+ace.config.setModuleUrl('ace/ext/themelist', require('file-loader?esModule=false!./src-noconflict/ext-themelist.js'))
+ace.config.setModuleUrl('ace/ext/whitespace', require('file-loader?esModule=false!./src-noconflict/ext-whitespace.js'))
+ace.config.setModuleUrl('ace/keyboard/emacs', require('file-loader?esModule=false!./src-noconflict/keybinding-emacs.js'))
+ace.config.setModuleUrl('ace/keyboard/sublime', require('file-loader?esModule=false!./src-noconflict/keybinding-sublime.js'))
+ace.config.setModuleUrl('ace/keyboard/vim', require('file-loader?esModule=false!./src-noconflict/keybinding-vim.js'))
+ace.config.setModuleUrl('ace/mode/abap', require('file-loader?esModule=false!./src-noconflict/mode-abap.js'))
+ace.config.setModuleUrl('ace/mode/abc', require('file-loader?esModule=false!./src-noconflict/mode-abc.js'))
+ace.config.setModuleUrl('ace/mode/actionscript', require('file-loader?esModule=false!./src-noconflict/mode-actionscript.js'))
+ace.config.setModuleUrl('ace/mode/ada', require('file-loader?esModule=false!./src-noconflict/mode-ada.js'))
+ace.config.setModuleUrl('ace/mode/apache_conf', require('file-loader?esModule=false!./src-noconflict/mode-apache_conf.js'))
+ace.config.setModuleUrl('ace/mode/apex', require('file-loader?esModule=false!./src-noconflict/mode-apex.js'))
+ace.config.setModuleUrl('ace/mode/applescript', require('file-loader?esModule=false!./src-noconflict/mode-applescript.js'))
+ace.config.setModuleUrl('ace/mode/aql', require('file-loader?esModule=false!./src-noconflict/mode-aql.js'))
+ace.config.setModuleUrl('ace/mode/asciidoc', require('file-loader?esModule=false!./src-noconflict/mode-asciidoc.js'))
+ace.config.setModuleUrl('ace/mode/asl', require('file-loader?esModule=false!./src-noconflict/mode-asl.js'))
+ace.config.setModuleUrl('ace/mode/assembly_x86', require('file-loader?esModule=false!./src-noconflict/mode-assembly_x86.js'))
+ace.config.setModuleUrl('ace/mode/autohotkey', require('file-loader?esModule=false!./src-noconflict/mode-autohotkey.js'))
+ace.config.setModuleUrl('ace/mode/batchfile', require('file-loader?esModule=false!./src-noconflict/mode-batchfile.js'))
+ace.config.setModuleUrl('ace/mode/bro', require('file-loader?esModule=false!./src-noconflict/mode-bro.js'))
+ace.config.setModuleUrl('ace/mode/c9search', require('file-loader?esModule=false!./src-noconflict/mode-c9search.js'))
+ace.config.setModuleUrl('ace/mode/cirru', require('file-loader?esModule=false!./src-noconflict/mode-cirru.js'))
+ace.config.setModuleUrl('ace/mode/clojure', require('file-loader?esModule=false!./src-noconflict/mode-clojure.js'))
+ace.config.setModuleUrl('ace/mode/cobol', require('file-loader?esModule=false!./src-noconflict/mode-cobol.js'))
+ace.config.setModuleUrl('ace/mode/coffee', require('file-loader?esModule=false!./src-noconflict/mode-coffee.js'))
+ace.config.setModuleUrl('ace/mode/coldfusion', require('file-loader?esModule=false!./src-noconflict/mode-coldfusion.js'))
+ace.config.setModuleUrl('ace/mode/crystal', require('file-loader?esModule=false!./src-noconflict/mode-crystal.js'))
+ace.config.setModuleUrl('ace/mode/csharp', require('file-loader?esModule=false!./src-noconflict/mode-csharp.js'))
+ace.config.setModuleUrl('ace/mode/csound_document', require('file-loader?esModule=false!./src-noconflict/mode-csound_document.js'))
+ace.config.setModuleUrl('ace/mode/csound_orchestra', require('file-loader?esModule=false!./src-noconflict/mode-csound_orchestra.js'))
+ace.config.setModuleUrl('ace/mode/csound_score', require('file-loader?esModule=false!./src-noconflict/mode-csound_score.js'))
+ace.config.setModuleUrl('ace/mode/csp', require('file-loader?esModule=false!./src-noconflict/mode-csp.js'))
+ace.config.setModuleUrl('ace/mode/css', require('file-loader?esModule=false!./src-noconflict/mode-css.js'))
+ace.config.setModuleUrl('ace/mode/curly', require('file-loader?esModule=false!./src-noconflict/mode-curly.js'))
+ace.config.setModuleUrl('ace/mode/c_cpp', require('file-loader?esModule=false!./src-noconflict/mode-c_cpp.js'))
+ace.config.setModuleUrl('ace/mode/d', require('file-loader?esModule=false!./src-noconflict/mode-d.js'))
+ace.config.setModuleUrl('ace/mode/dart', require('file-loader?esModule=false!./src-noconflict/mode-dart.js'))
+ace.config.setModuleUrl('ace/mode/diff', require('file-loader?esModule=false!./src-noconflict/mode-diff.js'))
+ace.config.setModuleUrl('ace/mode/django', require('file-loader?esModule=false!./src-noconflict/mode-django.js'))
+ace.config.setModuleUrl('ace/mode/dockerfile', require('file-loader?esModule=false!./src-noconflict/mode-dockerfile.js'))
+ace.config.setModuleUrl('ace/mode/dot', require('file-loader?esModule=false!./src-noconflict/mode-dot.js'))
+ace.config.setModuleUrl('ace/mode/drools', require('file-loader?esModule=false!./src-noconflict/mode-drools.js'))
+ace.config.setModuleUrl('ace/mode/edifact', require('file-loader?esModule=false!./src-noconflict/mode-edifact.js'))
+ace.config.setModuleUrl('ace/mode/eiffel', require('file-loader?esModule=false!./src-noconflict/mode-eiffel.js'))
+ace.config.setModuleUrl('ace/mode/ejs', require('file-loader?esModule=false!./src-noconflict/mode-ejs.js'))
+ace.config.setModuleUrl('ace/mode/elixir', require('file-loader?esModule=false!./src-noconflict/mode-elixir.js'))
+ace.config.setModuleUrl('ace/mode/elm', require('file-loader?esModule=false!./src-noconflict/mode-elm.js'))
+ace.config.setModuleUrl('ace/mode/erlang', require('file-loader?esModule=false!./src-noconflict/mode-erlang.js'))
+ace.config.setModuleUrl('ace/mode/forth', require('file-loader?esModule=false!./src-noconflict/mode-forth.js'))
+ace.config.setModuleUrl('ace/mode/fortran', require('file-loader?esModule=false!./src-noconflict/mode-fortran.js'))
+ace.config.setModuleUrl('ace/mode/fsharp', require('file-loader?esModule=false!./src-noconflict/mode-fsharp.js'))
+ace.config.setModuleUrl('ace/mode/fsl', require('file-loader?esModule=false!./src-noconflict/mode-fsl.js'))
+ace.config.setModuleUrl('ace/mode/ftl', require('file-loader?esModule=false!./src-noconflict/mode-ftl.js'))
+ace.config.setModuleUrl('ace/mode/gcode', require('file-loader?esModule=false!./src-noconflict/mode-gcode.js'))
+ace.config.setModuleUrl('ace/mode/gherkin', require('file-loader?esModule=false!./src-noconflict/mode-gherkin.js'))
+ace.config.setModuleUrl('ace/mode/gitignore', require('file-loader?esModule=false!./src-noconflict/mode-gitignore.js'))
+ace.config.setModuleUrl('ace/mode/glsl', require('file-loader?esModule=false!./src-noconflict/mode-glsl.js'))
+ace.config.setModuleUrl('ace/mode/gobstones', require('file-loader?esModule=false!./src-noconflict/mode-gobstones.js'))
+ace.config.setModuleUrl('ace/mode/golang', require('file-loader?esModule=false!./src-noconflict/mode-golang.js'))
+ace.config.setModuleUrl('ace/mode/graphqlschema', require('file-loader?esModule=false!./src-noconflict/mode-graphqlschema.js'))
+ace.config.setModuleUrl('ace/mode/groovy', require('file-loader?esModule=false!./src-noconflict/mode-groovy.js'))
+ace.config.setModuleUrl('ace/mode/haml', require('file-loader?esModule=false!./src-noconflict/mode-haml.js'))
+ace.config.setModuleUrl('ace/mode/handlebars', require('file-loader?esModule=false!./src-noconflict/mode-handlebars.js'))
+ace.config.setModuleUrl('ace/mode/haskell', require('file-loader?esModule=false!./src-noconflict/mode-haskell.js'))
+ace.config.setModuleUrl('ace/mode/haskell_cabal', require('file-loader?esModule=false!./src-noconflict/mode-haskell_cabal.js'))
+ace.config.setModuleUrl('ace/mode/haxe', require('file-loader?esModule=false!./src-noconflict/mode-haxe.js'))
+ace.config.setModuleUrl('ace/mode/hjson', require('file-loader?esModule=false!./src-noconflict/mode-hjson.js'))
+ace.config.setModuleUrl('ace/mode/html', require('file-loader?esModule=false!./src-noconflict/mode-html.js'))
+ace.config.setModuleUrl('ace/mode/html_elixir', require('file-loader?esModule=false!./src-noconflict/mode-html_elixir.js'))
+ace.config.setModuleUrl('ace/mode/html_ruby', require('file-loader?esModule=false!./src-noconflict/mode-html_ruby.js'))
+ace.config.setModuleUrl('ace/mode/ini', require('file-loader?esModule=false!./src-noconflict/mode-ini.js'))
+ace.config.setModuleUrl('ace/mode/io', require('file-loader?esModule=false!./src-noconflict/mode-io.js'))
+ace.config.setModuleUrl('ace/mode/jack', require('file-loader?esModule=false!./src-noconflict/mode-jack.js'))
+ace.config.setModuleUrl('ace/mode/jade', require('file-loader?esModule=false!./src-noconflict/mode-jade.js'))
+ace.config.setModuleUrl('ace/mode/java', require('file-loader?esModule=false!./src-noconflict/mode-java.js'))
+ace.config.setModuleUrl('ace/mode/javascript', require('file-loader?esModule=false!./src-noconflict/mode-javascript.js'))
+ace.config.setModuleUrl('ace/mode/json', require('file-loader?esModule=false!./src-noconflict/mode-json.js'))
+ace.config.setModuleUrl('ace/mode/jsoniq', require('file-loader?esModule=false!./src-noconflict/mode-jsoniq.js'))
+ace.config.setModuleUrl('ace/mode/jsp', require('file-loader?esModule=false!./src-noconflict/mode-jsp.js'))
+ace.config.setModuleUrl('ace/mode/jssm', require('file-loader?esModule=false!./src-noconflict/mode-jssm.js'))
+ace.config.setModuleUrl('ace/mode/jsx', require('file-loader?esModule=false!./src-noconflict/mode-jsx.js'))
+ace.config.setModuleUrl('ace/mode/julia', require('file-loader?esModule=false!./src-noconflict/mode-julia.js'))
+ace.config.setModuleUrl('ace/mode/kotlin', require('file-loader?esModule=false!./src-noconflict/mode-kotlin.js'))
+ace.config.setModuleUrl('ace/mode/latex', require('file-loader?esModule=false!./src-noconflict/mode-latex.js'))
+ace.config.setModuleUrl('ace/mode/less', require('file-loader?esModule=false!./src-noconflict/mode-less.js'))
+ace.config.setModuleUrl('ace/mode/liquid', require('file-loader?esModule=false!./src-noconflict/mode-liquid.js'))
+ace.config.setModuleUrl('ace/mode/lisp', require('file-loader?esModule=false!./src-noconflict/mode-lisp.js'))
+ace.config.setModuleUrl('ace/mode/livescript', require('file-loader?esModule=false!./src-noconflict/mode-livescript.js'))
+ace.config.setModuleUrl('ace/mode/logiql', require('file-loader?esModule=false!./src-noconflict/mode-logiql.js'))
+ace.config.setModuleUrl('ace/mode/logtalk', require('file-loader?esModule=false!./src-noconflict/mode-logtalk.js'))
+ace.config.setModuleUrl('ace/mode/lsl', require('file-loader?esModule=false!./src-noconflict/mode-lsl.js'))
+ace.config.setModuleUrl('ace/mode/lua', require('file-loader?esModule=false!./src-noconflict/mode-lua.js'))
+ace.config.setModuleUrl('ace/mode/luapage', require('file-loader?esModule=false!./src-noconflict/mode-luapage.js'))
+ace.config.setModuleUrl('ace/mode/lucene', require('file-loader?esModule=false!./src-noconflict/mode-lucene.js'))
+ace.config.setModuleUrl('ace/mode/makefile', require('file-loader?esModule=false!./src-noconflict/mode-makefile.js'))
+ace.config.setModuleUrl('ace/mode/markdown', require('file-loader?esModule=false!./src-noconflict/mode-markdown.js'))
+ace.config.setModuleUrl('ace/mode/mask', require('file-loader?esModule=false!./src-noconflict/mode-mask.js'))
+ace.config.setModuleUrl('ace/mode/matlab', require('file-loader?esModule=false!./src-noconflict/mode-matlab.js'))
+ace.config.setModuleUrl('ace/mode/maze', require('file-loader?esModule=false!./src-noconflict/mode-maze.js'))
+ace.config.setModuleUrl('ace/mode/mel', require('file-loader?esModule=false!./src-noconflict/mode-mel.js'))
+ace.config.setModuleUrl('ace/mode/mixal', require('file-loader?esModule=false!./src-noconflict/mode-mixal.js'))
+ace.config.setModuleUrl('ace/mode/mushcode', require('file-loader?esModule=false!./src-noconflict/mode-mushcode.js'))
+ace.config.setModuleUrl('ace/mode/mysql', require('file-loader?esModule=false!./src-noconflict/mode-mysql.js'))
+ace.config.setModuleUrl('ace/mode/nginx', require('file-loader?esModule=false!./src-noconflict/mode-nginx.js'))
+ace.config.setModuleUrl('ace/mode/nim', require('file-loader?esModule=false!./src-noconflict/mode-nim.js'))
+ace.config.setModuleUrl('ace/mode/nix', require('file-loader?esModule=false!./src-noconflict/mode-nix.js'))
+ace.config.setModuleUrl('ace/mode/nsis', require('file-loader?esModule=false!./src-noconflict/mode-nsis.js'))
+ace.config.setModuleUrl('ace/mode/objectivec', require('file-loader?esModule=false!./src-noconflict/mode-objectivec.js'))
+ace.config.setModuleUrl('ace/mode/ocaml', require('file-loader?esModule=false!./src-noconflict/mode-ocaml.js'))
+ace.config.setModuleUrl('ace/mode/pascal', require('file-loader?esModule=false!./src-noconflict/mode-pascal.js'))
+ace.config.setModuleUrl('ace/mode/perl', require('file-loader?esModule=false!./src-noconflict/mode-perl.js'))
+ace.config.setModuleUrl('ace/mode/perl6', require('file-loader?esModule=false!./src-noconflict/mode-perl6.js'))
+ace.config.setModuleUrl('ace/mode/pgsql', require('file-loader?esModule=false!./src-noconflict/mode-pgsql.js'))
+ace.config.setModuleUrl('ace/mode/php', require('file-loader?esModule=false!./src-noconflict/mode-php.js'))
+ace.config.setModuleUrl('ace/mode/php_laravel_blade', require('file-loader?esModule=false!./src-noconflict/mode-php_laravel_blade.js'))
+ace.config.setModuleUrl('ace/mode/pig', require('file-loader?esModule=false!./src-noconflict/mode-pig.js'))
+ace.config.setModuleUrl('ace/mode/plain_text', require('file-loader?esModule=false!./src-noconflict/mode-plain_text.js'))
+ace.config.setModuleUrl('ace/mode/powershell', require('file-loader?esModule=false!./src-noconflict/mode-powershell.js'))
+ace.config.setModuleUrl('ace/mode/praat', require('file-loader?esModule=false!./src-noconflict/mode-praat.js'))
+ace.config.setModuleUrl('ace/mode/prolog', require('file-loader?esModule=false!./src-noconflict/mode-prolog.js'))
+ace.config.setModuleUrl('ace/mode/properties', require('file-loader?esModule=false!./src-noconflict/mode-properties.js'))
+ace.config.setModuleUrl('ace/mode/protobuf', require('file-loader?esModule=false!./src-noconflict/mode-protobuf.js'))
+ace.config.setModuleUrl('ace/mode/puppet', require('file-loader?esModule=false!./src-noconflict/mode-puppet.js'))
+ace.config.setModuleUrl('ace/mode/python', require('file-loader?esModule=false!./src-noconflict/mode-python.js'))
+ace.config.setModuleUrl('ace/mode/r', require('file-loader?esModule=false!./src-noconflict/mode-r.js'))
+ace.config.setModuleUrl('ace/mode/razor', require('file-loader?esModule=false!./src-noconflict/mode-razor.js'))
+ace.config.setModuleUrl('ace/mode/rdoc', require('file-loader?esModule=false!./src-noconflict/mode-rdoc.js'))
+ace.config.setModuleUrl('ace/mode/red', require('file-loader?esModule=false!./src-noconflict/mode-red.js'))
+ace.config.setModuleUrl('ace/mode/redshift', require('file-loader?esModule=false!./src-noconflict/mode-redshift.js'))
+ace.config.setModuleUrl('ace/mode/rhtml', require('file-loader?esModule=false!./src-noconflict/mode-rhtml.js'))
+ace.config.setModuleUrl('ace/mode/rst', require('file-loader?esModule=false!./src-noconflict/mode-rst.js'))
+ace.config.setModuleUrl('ace/mode/ruby', require('file-loader?esModule=false!./src-noconflict/mode-ruby.js'))
+ace.config.setModuleUrl('ace/mode/rust', require('file-loader?esModule=false!./src-noconflict/mode-rust.js'))
+ace.config.setModuleUrl('ace/mode/sass', require('file-loader?esModule=false!./src-noconflict/mode-sass.js'))
+ace.config.setModuleUrl('ace/mode/scad', require('file-loader?esModule=false!./src-noconflict/mode-scad.js'))
+ace.config.setModuleUrl('ace/mode/scala', require('file-loader?esModule=false!./src-noconflict/mode-scala.js'))
+ace.config.setModuleUrl('ace/mode/scheme', require('file-loader?esModule=false!./src-noconflict/mode-scheme.js'))
+ace.config.setModuleUrl('ace/mode/scss', require('file-loader?esModule=false!./src-noconflict/mode-scss.js'))
+ace.config.setModuleUrl('ace/mode/sh', require('file-loader?esModule=false!./src-noconflict/mode-sh.js'))
+ace.config.setModuleUrl('ace/mode/sjs', require('file-loader?esModule=false!./src-noconflict/mode-sjs.js'))
+ace.config.setModuleUrl('ace/mode/slim', require('file-loader?esModule=false!./src-noconflict/mode-slim.js'))
+ace.config.setModuleUrl('ace/mode/smarty', require('file-loader?esModule=false!./src-noconflict/mode-smarty.js'))
+ace.config.setModuleUrl('ace/mode/snippets', require('file-loader?esModule=false!./src-noconflict/mode-snippets.js'))
+ace.config.setModuleUrl('ace/mode/soy_template', require('file-loader?esModule=false!./src-noconflict/mode-soy_template.js'))
+ace.config.setModuleUrl('ace/mode/space', require('file-loader?esModule=false!./src-noconflict/mode-space.js'))
+ace.config.setModuleUrl('ace/mode/sparql', require('file-loader?esModule=false!./src-noconflict/mode-sparql.js'))
+ace.config.setModuleUrl('ace/mode/sql', require('file-loader?esModule=false!./src-noconflict/mode-sql.js'))
+ace.config.setModuleUrl('ace/mode/sqlserver', require('file-loader?esModule=false!./src-noconflict/mode-sqlserver.js'))
+ace.config.setModuleUrl('ace/mode/stylus', require('file-loader?esModule=false!./src-noconflict/mode-stylus.js'))
+ace.config.setModuleUrl('ace/mode/svg', require('file-loader?esModule=false!./src-noconflict/mode-svg.js'))
+ace.config.setModuleUrl('ace/mode/swift', require('file-loader?esModule=false!./src-noconflict/mode-swift.js'))
+ace.config.setModuleUrl('ace/mode/tcl', require('file-loader?esModule=false!./src-noconflict/mode-tcl.js'))
+ace.config.setModuleUrl('ace/mode/terraform', require('file-loader?esModule=false!./src-noconflict/mode-terraform.js'))
+ace.config.setModuleUrl('ace/mode/tex', require('file-loader?esModule=false!./src-noconflict/mode-tex.js'))
+ace.config.setModuleUrl('ace/mode/text', require('file-loader?esModule=false!./src-noconflict/mode-text.js'))
+ace.config.setModuleUrl('ace/mode/textile', require('file-loader?esModule=false!./src-noconflict/mode-textile.js'))
+ace.config.setModuleUrl('ace/mode/toml', require('file-loader?esModule=false!./src-noconflict/mode-toml.js'))
+ace.config.setModuleUrl('ace/mode/tsx', require('file-loader?esModule=false!./src-noconflict/mode-tsx.js'))
+ace.config.setModuleUrl('ace/mode/turtle', require('file-loader?esModule=false!./src-noconflict/mode-turtle.js'))
+ace.config.setModuleUrl('ace/mode/twig', require('file-loader?esModule=false!./src-noconflict/mode-twig.js'))
+ace.config.setModuleUrl('ace/mode/typescript', require('file-loader?esModule=false!./src-noconflict/mode-typescript.js'))
+ace.config.setModuleUrl('ace/mode/vala', require('file-loader?esModule=false!./src-noconflict/mode-vala.js'))
+ace.config.setModuleUrl('ace/mode/vbscript', require('file-loader?esModule=false!./src-noconflict/mode-vbscript.js'))
+ace.config.setModuleUrl('ace/mode/velocity', require('file-loader?esModule=false!./src-noconflict/mode-velocity.js'))
+ace.config.setModuleUrl('ace/mode/verilog', require('file-loader?esModule=false!./src-noconflict/mode-verilog.js'))
+ace.config.setModuleUrl('ace/mode/vhdl', require('file-loader?esModule=false!./src-noconflict/mode-vhdl.js'))
+ace.config.setModuleUrl('ace/mode/visualforce', require('file-loader?esModule=false!./src-noconflict/mode-visualforce.js'))
+ace.config.setModuleUrl('ace/mode/wollok', require('file-loader?esModule=false!./src-noconflict/mode-wollok.js'))
+ace.config.setModuleUrl('ace/mode/xml', require('file-loader?esModule=false!./src-noconflict/mode-xml.js'))
+ace.config.setModuleUrl('ace/mode/xquery', require('file-loader?esModule=false!./src-noconflict/mode-xquery.js'))
+ace.config.setModuleUrl('ace/mode/yaml', require('file-loader?esModule=false!./src-noconflict/mode-yaml.js'))
+ace.config.setModuleUrl('ace/mode/zeek', require('file-loader?esModule=false!./src-noconflict/mode-zeek.js'))
-ace.config.setModuleUrl('ace/theme/ambiance', require('file-loader!./src-noconflict/theme-ambiance.js'))
-ace.config.setModuleUrl('ace/theme/chaos', require('file-loader!./src-noconflict/theme-chaos.js'))
-ace.config.setModuleUrl('ace/theme/chrome', require('file-loader!./src-noconflict/theme-chrome.js'))
-ace.config.setModuleUrl('ace/theme/clouds', require('file-loader!./src-noconflict/theme-clouds.js'))
-ace.config.setModuleUrl('ace/theme/clouds_midnight', require('file-loader!./src-noconflict/theme-clouds_midnight.js'))
-ace.config.setModuleUrl('ace/theme/cobalt', require('file-loader!./src-noconflict/theme-cobalt.js'))
-ace.config.setModuleUrl('ace/theme/crimson_editor', require('file-loader!./src-noconflict/theme-crimson_editor.js'))
-ace.config.setModuleUrl('ace/theme/dawn', require('file-loader!./src-noconflict/theme-dawn.js'))
-ace.config.setModuleUrl('ace/theme/dracula', require('file-loader!./src-noconflict/theme-dracula.js'))
-ace.config.setModuleUrl('ace/theme/dreamweaver', require('file-loader!./src-noconflict/theme-dreamweaver.js'))
-ace.config.setModuleUrl('ace/theme/eclipse', require('file-loader!./src-noconflict/theme-eclipse.js'))
-ace.config.setModuleUrl('ace/theme/github', require('file-loader!./src-noconflict/theme-github.js'))
-ace.config.setModuleUrl('ace/theme/gob', require('file-loader!./src-noconflict/theme-gob.js'))
-ace.config.setModuleUrl('ace/theme/gruvbox', require('file-loader!./src-noconflict/theme-gruvbox.js'))
-ace.config.setModuleUrl('ace/theme/idle_fingers', require('file-loader!./src-noconflict/theme-idle_fingers.js'))
-ace.config.setModuleUrl('ace/theme/iplastic', require('file-loader!./src-noconflict/theme-iplastic.js'))
-ace.config.setModuleUrl('ace/theme/katzenmilch', require('file-loader!./src-noconflict/theme-katzenmilch.js'))
-ace.config.setModuleUrl('ace/theme/kr_theme', require('file-loader!./src-noconflict/theme-kr_theme.js'))
-ace.config.setModuleUrl('ace/theme/kuroir', require('file-loader!./src-noconflict/theme-kuroir.js'))
-ace.config.setModuleUrl('ace/theme/merbivore', require('file-loader!./src-noconflict/theme-merbivore.js'))
-ace.config.setModuleUrl('ace/theme/merbivore_soft', require('file-loader!./src-noconflict/theme-merbivore_soft.js'))
-ace.config.setModuleUrl('ace/theme/monokai', require('file-loader!./src-noconflict/theme-monokai.js'))
-ace.config.setModuleUrl('ace/theme/mono_industrial', require('file-loader!./src-noconflict/theme-mono_industrial.js'))
-ace.config.setModuleUrl('ace/theme/pastel_on_dark', require('file-loader!./src-noconflict/theme-pastel_on_dark.js'))
-ace.config.setModuleUrl('ace/theme/solarized_dark', require('file-loader!./src-noconflict/theme-solarized_dark.js'))
-ace.config.setModuleUrl('ace/theme/solarized_light', require('file-loader!./src-noconflict/theme-solarized_light.js'))
-ace.config.setModuleUrl('ace/theme/sqlserver', require('file-loader!./src-noconflict/theme-sqlserver.js'))
-ace.config.setModuleUrl('ace/theme/terminal', require('file-loader!./src-noconflict/theme-terminal.js'))
-ace.config.setModuleUrl('ace/theme/textmate', require('file-loader!./src-noconflict/theme-textmate.js'))
-ace.config.setModuleUrl('ace/theme/tomorrow', require('file-loader!./src-noconflict/theme-tomorrow.js'))
-ace.config.setModuleUrl('ace/theme/tomorrow_night', require('file-loader!./src-noconflict/theme-tomorrow_night.js'))
-ace.config.setModuleUrl('ace/theme/tomorrow_night_blue', require('file-loader!./src-noconflict/theme-tomorrow_night_blue.js'))
-ace.config.setModuleUrl('ace/theme/tomorrow_night_bright', require('file-loader!./src-noconflict/theme-tomorrow_night_bright.js'))
-ace.config.setModuleUrl('ace/theme/tomorrow_night_eighties', require('file-loader!./src-noconflict/theme-tomorrow_night_eighties.js'))
-ace.config.setModuleUrl('ace/theme/twilight', require('file-loader!./src-noconflict/theme-twilight.js'))
-ace.config.setModuleUrl('ace/theme/vibrant_ink', require('file-loader!./src-noconflict/theme-vibrant_ink.js'))
-ace.config.setModuleUrl('ace/theme/xcode', require('file-loader!./src-noconflict/theme-xcode.js'))
-ace.config.setModuleUrl('ace/mode/coffee_worker', require('file-loader!./src-noconflict/worker-coffee.js'))
-ace.config.setModuleUrl('ace/mode/css_worker', require('file-loader!./src-noconflict/worker-css.js'))
-ace.config.setModuleUrl('ace/mode/html_worker', require('file-loader!./src-noconflict/worker-html.js'))
-ace.config.setModuleUrl('ace/mode/javascript_worker', require('file-loader!./src-noconflict/worker-javascript.js'))
-ace.config.setModuleUrl('ace/mode/json_worker', require('file-loader!./src-noconflict/worker-json.js'))
-ace.config.setModuleUrl('ace/mode/lua_worker', require('file-loader!./src-noconflict/worker-lua.js'))
-ace.config.setModuleUrl('ace/mode/php_worker', require('file-loader!./src-noconflict/worker-php.js'))
-ace.config.setModuleUrl('ace/mode/xml_worker', require('file-loader!./src-noconflict/worker-xml.js'))
-ace.config.setModuleUrl('ace/mode/xquery_worker', require('file-loader!./src-noconflict/worker-xquery.js'))
-ace.config.setModuleUrl('ace/snippets/abap', require('file-loader!./src-noconflict/snippets/abap.js'))
-ace.config.setModuleUrl('ace/snippets/abc', require('file-loader!./src-noconflict/snippets/abc.js'))
-ace.config.setModuleUrl('ace/snippets/actionscript', require('file-loader!./src-noconflict/snippets/actionscript.js'))
-ace.config.setModuleUrl('ace/snippets/ada', require('file-loader!./src-noconflict/snippets/ada.js'))
-ace.config.setModuleUrl('ace/snippets/apache_conf', require('file-loader!./src-noconflict/snippets/apache_conf.js'))
-ace.config.setModuleUrl('ace/snippets/apex', require('file-loader!./src-noconflict/snippets/apex.js'))
-ace.config.setModuleUrl('ace/snippets/applescript', require('file-loader!./src-noconflict/snippets/applescript.js'))
-ace.config.setModuleUrl('ace/snippets/aql', require('file-loader!./src-noconflict/snippets/aql.js'))
-ace.config.setModuleUrl('ace/snippets/asciidoc', require('file-loader!./src-noconflict/snippets/asciidoc.js'))
-ace.config.setModuleUrl('ace/snippets/asl', require('file-loader!./src-noconflict/snippets/asl.js'))
-ace.config.setModuleUrl('ace/snippets/assembly_x86', require('file-loader!./src-noconflict/snippets/assembly_x86.js'))
-ace.config.setModuleUrl('ace/snippets/autohotkey', require('file-loader!./src-noconflict/snippets/autohotkey.js'))
-ace.config.setModuleUrl('ace/snippets/batchfile', require('file-loader!./src-noconflict/snippets/batchfile.js'))
-ace.config.setModuleUrl('ace/snippets/bro', require('file-loader!./src-noconflict/snippets/bro.js'))
-ace.config.setModuleUrl('ace/snippets/c9search', require('file-loader!./src-noconflict/snippets/c9search.js'))
-ace.config.setModuleUrl('ace/snippets/cirru', require('file-loader!./src-noconflict/snippets/cirru.js'))
-ace.config.setModuleUrl('ace/snippets/clojure', require('file-loader!./src-noconflict/snippets/clojure.js'))
-ace.config.setModuleUrl('ace/snippets/cobol', require('file-loader!./src-noconflict/snippets/cobol.js'))
-ace.config.setModuleUrl('ace/snippets/coffee', require('file-loader!./src-noconflict/snippets/coffee.js'))
-ace.config.setModuleUrl('ace/snippets/coldfusion', require('file-loader!./src-noconflict/snippets/coldfusion.js'))
-ace.config.setModuleUrl('ace/snippets/crystal', require('file-loader!./src-noconflict/snippets/crystal.js'))
-ace.config.setModuleUrl('ace/snippets/csharp', require('file-loader!./src-noconflict/snippets/csharp.js'))
-ace.config.setModuleUrl('ace/snippets/csound_document', require('file-loader!./src-noconflict/snippets/csound_document.js'))
-ace.config.setModuleUrl('ace/snippets/csound_orchestra', require('file-loader!./src-noconflict/snippets/csound_orchestra.js'))
-ace.config.setModuleUrl('ace/snippets/csound_score', require('file-loader!./src-noconflict/snippets/csound_score.js'))
-ace.config.setModuleUrl('ace/snippets/csp', require('file-loader!./src-noconflict/snippets/csp.js'))
-ace.config.setModuleUrl('ace/snippets/css', require('file-loader!./src-noconflict/snippets/css.js'))
-ace.config.setModuleUrl('ace/snippets/curly', require('file-loader!./src-noconflict/snippets/curly.js'))
-ace.config.setModuleUrl('ace/snippets/c_cpp', require('file-loader!./src-noconflict/snippets/c_cpp.js'))
-ace.config.setModuleUrl('ace/snippets/d', require('file-loader!./src-noconflict/snippets/d.js'))
-ace.config.setModuleUrl('ace/snippets/dart', require('file-loader!./src-noconflict/snippets/dart.js'))
-ace.config.setModuleUrl('ace/snippets/diff', require('file-loader!./src-noconflict/snippets/diff.js'))
-ace.config.setModuleUrl('ace/snippets/django', require('file-loader!./src-noconflict/snippets/django.js'))
-ace.config.setModuleUrl('ace/snippets/dockerfile', require('file-loader!./src-noconflict/snippets/dockerfile.js'))
-ace.config.setModuleUrl('ace/snippets/dot', require('file-loader!./src-noconflict/snippets/dot.js'))
-ace.config.setModuleUrl('ace/snippets/drools', require('file-loader!./src-noconflict/snippets/drools.js'))
-ace.config.setModuleUrl('ace/snippets/edifact', require('file-loader!./src-noconflict/snippets/edifact.js'))
-ace.config.setModuleUrl('ace/snippets/eiffel', require('file-loader!./src-noconflict/snippets/eiffel.js'))
-ace.config.setModuleUrl('ace/snippets/ejs', require('file-loader!./src-noconflict/snippets/ejs.js'))
-ace.config.setModuleUrl('ace/snippets/elixir', require('file-loader!./src-noconflict/snippets/elixir.js'))
-ace.config.setModuleUrl('ace/snippets/elm', require('file-loader!./src-noconflict/snippets/elm.js'))
-ace.config.setModuleUrl('ace/snippets/erlang', require('file-loader!./src-noconflict/snippets/erlang.js'))
-ace.config.setModuleUrl('ace/snippets/forth', require('file-loader!./src-noconflict/snippets/forth.js'))
-ace.config.setModuleUrl('ace/snippets/fortran', require('file-loader!./src-noconflict/snippets/fortran.js'))
-ace.config.setModuleUrl('ace/snippets/fsharp', require('file-loader!./src-noconflict/snippets/fsharp.js'))
-ace.config.setModuleUrl('ace/snippets/fsl', require('file-loader!./src-noconflict/snippets/fsl.js'))
-ace.config.setModuleUrl('ace/snippets/ftl', require('file-loader!./src-noconflict/snippets/ftl.js'))
-ace.config.setModuleUrl('ace/snippets/gcode', require('file-loader!./src-noconflict/snippets/gcode.js'))
-ace.config.setModuleUrl('ace/snippets/gherkin', require('file-loader!./src-noconflict/snippets/gherkin.js'))
-ace.config.setModuleUrl('ace/snippets/gitignore', require('file-loader!./src-noconflict/snippets/gitignore.js'))
-ace.config.setModuleUrl('ace/snippets/glsl', require('file-loader!./src-noconflict/snippets/glsl.js'))
-ace.config.setModuleUrl('ace/snippets/gobstones', require('file-loader!./src-noconflict/snippets/gobstones.js'))
-ace.config.setModuleUrl('ace/snippets/golang', require('file-loader!./src-noconflict/snippets/golang.js'))
-ace.config.setModuleUrl('ace/snippets/graphqlschema', require('file-loader!./src-noconflict/snippets/graphqlschema.js'))
-ace.config.setModuleUrl('ace/snippets/groovy', require('file-loader!./src-noconflict/snippets/groovy.js'))
-ace.config.setModuleUrl('ace/snippets/haml', require('file-loader!./src-noconflict/snippets/haml.js'))
-ace.config.setModuleUrl('ace/snippets/handlebars', require('file-loader!./src-noconflict/snippets/handlebars.js'))
-ace.config.setModuleUrl('ace/snippets/haskell', require('file-loader!./src-noconflict/snippets/haskell.js'))
-ace.config.setModuleUrl('ace/snippets/haskell_cabal', require('file-loader!./src-noconflict/snippets/haskell_cabal.js'))
-ace.config.setModuleUrl('ace/snippets/haxe', require('file-loader!./src-noconflict/snippets/haxe.js'))
-ace.config.setModuleUrl('ace/snippets/hjson', require('file-loader!./src-noconflict/snippets/hjson.js'))
-ace.config.setModuleUrl('ace/snippets/html', require('file-loader!./src-noconflict/snippets/html.js'))
-ace.config.setModuleUrl('ace/snippets/html_elixir', require('file-loader!./src-noconflict/snippets/html_elixir.js'))
-ace.config.setModuleUrl('ace/snippets/html_ruby', require('file-loader!./src-noconflict/snippets/html_ruby.js'))
-ace.config.setModuleUrl('ace/snippets/ini', require('file-loader!./src-noconflict/snippets/ini.js'))
-ace.config.setModuleUrl('ace/snippets/io', require('file-loader!./src-noconflict/snippets/io.js'))
-ace.config.setModuleUrl('ace/snippets/jack', require('file-loader!./src-noconflict/snippets/jack.js'))
-ace.config.setModuleUrl('ace/snippets/jade', require('file-loader!./src-noconflict/snippets/jade.js'))
-ace.config.setModuleUrl('ace/snippets/java', require('file-loader!./src-noconflict/snippets/java.js'))
-ace.config.setModuleUrl('ace/snippets/javascript', require('file-loader!./src-noconflict/snippets/javascript.js'))
-ace.config.setModuleUrl('ace/snippets/json', require('file-loader!./src-noconflict/snippets/json.js'))
-ace.config.setModuleUrl('ace/snippets/jsoniq', require('file-loader!./src-noconflict/snippets/jsoniq.js'))
-ace.config.setModuleUrl('ace/snippets/jsp', require('file-loader!./src-noconflict/snippets/jsp.js'))
-ace.config.setModuleUrl('ace/snippets/jssm', require('file-loader!./src-noconflict/snippets/jssm.js'))
-ace.config.setModuleUrl('ace/snippets/jsx', require('file-loader!./src-noconflict/snippets/jsx.js'))
-ace.config.setModuleUrl('ace/snippets/julia', require('file-loader!./src-noconflict/snippets/julia.js'))
-ace.config.setModuleUrl('ace/snippets/kotlin', require('file-loader!./src-noconflict/snippets/kotlin.js'))
-ace.config.setModuleUrl('ace/snippets/latex', require('file-loader!./src-noconflict/snippets/latex.js'))
-ace.config.setModuleUrl('ace/snippets/less', require('file-loader!./src-noconflict/snippets/less.js'))
-ace.config.setModuleUrl('ace/snippets/liquid', require('file-loader!./src-noconflict/snippets/liquid.js'))
-ace.config.setModuleUrl('ace/snippets/lisp', require('file-loader!./src-noconflict/snippets/lisp.js'))
-ace.config.setModuleUrl('ace/snippets/livescript', require('file-loader!./src-noconflict/snippets/livescript.js'))
-ace.config.setModuleUrl('ace/snippets/logiql', require('file-loader!./src-noconflict/snippets/logiql.js'))
-ace.config.setModuleUrl('ace/snippets/logtalk', require('file-loader!./src-noconflict/snippets/logtalk.js'))
-ace.config.setModuleUrl('ace/snippets/lsl', require('file-loader!./src-noconflict/snippets/lsl.js'))
-ace.config.setModuleUrl('ace/snippets/lua', require('file-loader!./src-noconflict/snippets/lua.js'))
-ace.config.setModuleUrl('ace/snippets/luapage', require('file-loader!./src-noconflict/snippets/luapage.js'))
-ace.config.setModuleUrl('ace/snippets/lucene', require('file-loader!./src-noconflict/snippets/lucene.js'))
-ace.config.setModuleUrl('ace/snippets/makefile', require('file-loader!./src-noconflict/snippets/makefile.js'))
-ace.config.setModuleUrl('ace/snippets/markdown', require('file-loader!./src-noconflict/snippets/markdown.js'))
-ace.config.setModuleUrl('ace/snippets/mask', require('file-loader!./src-noconflict/snippets/mask.js'))
-ace.config.setModuleUrl('ace/snippets/matlab', require('file-loader!./src-noconflict/snippets/matlab.js'))
-ace.config.setModuleUrl('ace/snippets/maze', require('file-loader!./src-noconflict/snippets/maze.js'))
-ace.config.setModuleUrl('ace/snippets/mel', require('file-loader!./src-noconflict/snippets/mel.js'))
-ace.config.setModuleUrl('ace/snippets/mixal', require('file-loader!./src-noconflict/snippets/mixal.js'))
-ace.config.setModuleUrl('ace/snippets/mushcode', require('file-loader!./src-noconflict/snippets/mushcode.js'))
-ace.config.setModuleUrl('ace/snippets/mysql', require('file-loader!./src-noconflict/snippets/mysql.js'))
-ace.config.setModuleUrl('ace/snippets/nginx', require('file-loader!./src-noconflict/snippets/nginx.js'))
-ace.config.setModuleUrl('ace/snippets/nim', require('file-loader!./src-noconflict/snippets/nim.js'))
-ace.config.setModuleUrl('ace/snippets/nix', require('file-loader!./src-noconflict/snippets/nix.js'))
-ace.config.setModuleUrl('ace/snippets/nsis', require('file-loader!./src-noconflict/snippets/nsis.js'))
-ace.config.setModuleUrl('ace/snippets/objectivec', require('file-loader!./src-noconflict/snippets/objectivec.js'))
-ace.config.setModuleUrl('ace/snippets/ocaml', require('file-loader!./src-noconflict/snippets/ocaml.js'))
-ace.config.setModuleUrl('ace/snippets/pascal', require('file-loader!./src-noconflict/snippets/pascal.js'))
-ace.config.setModuleUrl('ace/snippets/perl', require('file-loader!./src-noconflict/snippets/perl.js'))
-ace.config.setModuleUrl('ace/snippets/perl6', require('file-loader!./src-noconflict/snippets/perl6.js'))
-ace.config.setModuleUrl('ace/snippets/pgsql', require('file-loader!./src-noconflict/snippets/pgsql.js'))
-ace.config.setModuleUrl('ace/snippets/php', require('file-loader!./src-noconflict/snippets/php.js'))
-ace.config.setModuleUrl('ace/snippets/php_laravel_blade', require('file-loader!./src-noconflict/snippets/php_laravel_blade.js'))
-ace.config.setModuleUrl('ace/snippets/pig', require('file-loader!./src-noconflict/snippets/pig.js'))
-ace.config.setModuleUrl('ace/snippets/plain_text', require('file-loader!./src-noconflict/snippets/plain_text.js'))
-ace.config.setModuleUrl('ace/snippets/powershell', require('file-loader!./src-noconflict/snippets/powershell.js'))
-ace.config.setModuleUrl('ace/snippets/praat', require('file-loader!./src-noconflict/snippets/praat.js'))
-ace.config.setModuleUrl('ace/snippets/prolog', require('file-loader!./src-noconflict/snippets/prolog.js'))
-ace.config.setModuleUrl('ace/snippets/properties', require('file-loader!./src-noconflict/snippets/properties.js'))
-ace.config.setModuleUrl('ace/snippets/protobuf', require('file-loader!./src-noconflict/snippets/protobuf.js'))
-ace.config.setModuleUrl('ace/snippets/puppet', require('file-loader!./src-noconflict/snippets/puppet.js'))
-ace.config.setModuleUrl('ace/snippets/python', require('file-loader!./src-noconflict/snippets/python.js'))
-ace.config.setModuleUrl('ace/snippets/r', require('file-loader!./src-noconflict/snippets/r.js'))
-ace.config.setModuleUrl('ace/snippets/razor', require('file-loader!./src-noconflict/snippets/razor.js'))
-ace.config.setModuleUrl('ace/snippets/rdoc', require('file-loader!./src-noconflict/snippets/rdoc.js'))
-ace.config.setModuleUrl('ace/snippets/red', require('file-loader!./src-noconflict/snippets/red.js'))
-ace.config.setModuleUrl('ace/snippets/redshift', require('file-loader!./src-noconflict/snippets/redshift.js'))
-ace.config.setModuleUrl('ace/snippets/rhtml', require('file-loader!./src-noconflict/snippets/rhtml.js'))
-ace.config.setModuleUrl('ace/snippets/rst', require('file-loader!./src-noconflict/snippets/rst.js'))
-ace.config.setModuleUrl('ace/snippets/ruby', require('file-loader!./src-noconflict/snippets/ruby.js'))
-ace.config.setModuleUrl('ace/snippets/rust', require('file-loader!./src-noconflict/snippets/rust.js'))
-ace.config.setModuleUrl('ace/snippets/sass', require('file-loader!./src-noconflict/snippets/sass.js'))
-ace.config.setModuleUrl('ace/snippets/scad', require('file-loader!./src-noconflict/snippets/scad.js'))
-ace.config.setModuleUrl('ace/snippets/scala', require('file-loader!./src-noconflict/snippets/scala.js'))
-ace.config.setModuleUrl('ace/snippets/scheme', require('file-loader!./src-noconflict/snippets/scheme.js'))
-ace.config.setModuleUrl('ace/snippets/scss', require('file-loader!./src-noconflict/snippets/scss.js'))
-ace.config.setModuleUrl('ace/snippets/sh', require('file-loader!./src-noconflict/snippets/sh.js'))
-ace.config.setModuleUrl('ace/snippets/sjs', require('file-loader!./src-noconflict/snippets/sjs.js'))
-ace.config.setModuleUrl('ace/snippets/slim', require('file-loader!./src-noconflict/snippets/slim.js'))
-ace.config.setModuleUrl('ace/snippets/smarty', require('file-loader!./src-noconflict/snippets/smarty.js'))
-ace.config.setModuleUrl('ace/snippets/snippets', require('file-loader!./src-noconflict/snippets/snippets.js'))
-ace.config.setModuleUrl('ace/snippets/soy_template', require('file-loader!./src-noconflict/snippets/soy_template.js'))
-ace.config.setModuleUrl('ace/snippets/space', require('file-loader!./src-noconflict/snippets/space.js'))
-ace.config.setModuleUrl('ace/snippets/sparql', require('file-loader!./src-noconflict/snippets/sparql.js'))
-ace.config.setModuleUrl('ace/snippets/sql', require('file-loader!./src-noconflict/snippets/sql.js'))
-ace.config.setModuleUrl('ace/snippets/sqlserver', require('file-loader!./src-noconflict/snippets/sqlserver.js'))
-ace.config.setModuleUrl('ace/snippets/stylus', require('file-loader!./src-noconflict/snippets/stylus.js'))
-ace.config.setModuleUrl('ace/snippets/svg', require('file-loader!./src-noconflict/snippets/svg.js'))
-ace.config.setModuleUrl('ace/snippets/swift', require('file-loader!./src-noconflict/snippets/swift.js'))
-ace.config.setModuleUrl('ace/snippets/tcl', require('file-loader!./src-noconflict/snippets/tcl.js'))
-ace.config.setModuleUrl('ace/snippets/terraform', require('file-loader!./src-noconflict/snippets/terraform.js'))
-ace.config.setModuleUrl('ace/snippets/tex', require('file-loader!./src-noconflict/snippets/tex.js'))
-ace.config.setModuleUrl('ace/snippets/text', require('file-loader!./src-noconflict/snippets/text.js'))
-ace.config.setModuleUrl('ace/snippets/textile', require('file-loader!./src-noconflict/snippets/textile.js'))
-ace.config.setModuleUrl('ace/snippets/toml', require('file-loader!./src-noconflict/snippets/toml.js'))
-ace.config.setModuleUrl('ace/snippets/tsx', require('file-loader!./src-noconflict/snippets/tsx.js'))
-ace.config.setModuleUrl('ace/snippets/turtle', require('file-loader!./src-noconflict/snippets/turtle.js'))
-ace.config.setModuleUrl('ace/snippets/twig', require('file-loader!./src-noconflict/snippets/twig.js'))
-ace.config.setModuleUrl('ace/snippets/typescript', require('file-loader!./src-noconflict/snippets/typescript.js'))
-ace.config.setModuleUrl('ace/snippets/vala', require('file-loader!./src-noconflict/snippets/vala.js'))
-ace.config.setModuleUrl('ace/snippets/vbscript', require('file-loader!./src-noconflict/snippets/vbscript.js'))
-ace.config.setModuleUrl('ace/snippets/velocity', require('file-loader!./src-noconflict/snippets/velocity.js'))
-ace.config.setModuleUrl('ace/snippets/verilog', require('file-loader!./src-noconflict/snippets/verilog.js'))
-ace.config.setModuleUrl('ace/snippets/vhdl', require('file-loader!./src-noconflict/snippets/vhdl.js'))
-ace.config.setModuleUrl('ace/snippets/visualforce', require('file-loader!./src-noconflict/snippets/visualforce.js'))
-ace.config.setModuleUrl('ace/snippets/wollok', require('file-loader!./src-noconflict/snippets/wollok.js'))
-ace.config.setModuleUrl('ace/snippets/xml', require('file-loader!./src-noconflict/snippets/xml.js'))
-ace.config.setModuleUrl('ace/snippets/xquery', require('file-loader!./src-noconflict/snippets/xquery.js'))
-ace.config.setModuleUrl('ace/snippets/yaml', require('file-loader!./src-noconflict/snippets/yaml.js'))
-ace.config.setModuleUrl('ace/snippets/zeek', require('file-loader!./src-noconflict/snippets/zeek.js'))
\ No newline at end of file
+ace.config.setModuleUrl('ace/theme/ambiance', require('file-loader?esModule=false!./src-noconflict/theme-ambiance.js'))
+ace.config.setModuleUrl('ace/theme/chaos', require('file-loader?esModule=false!./src-noconflict/theme-chaos.js'))
+ace.config.setModuleUrl('ace/theme/chrome', require('file-loader?esModule=false!./src-noconflict/theme-chrome.js'))
+ace.config.setModuleUrl('ace/theme/clouds', require('file-loader?esModule=false!./src-noconflict/theme-clouds.js'))
+ace.config.setModuleUrl('ace/theme/clouds_midnight', require('file-loader?esModule=false!./src-noconflict/theme-clouds_midnight.js'))
+ace.config.setModuleUrl('ace/theme/cobalt', require('file-loader?esModule=false!./src-noconflict/theme-cobalt.js'))
+ace.config.setModuleUrl('ace/theme/crimson_editor', require('file-loader?esModule=false!./src-noconflict/theme-crimson_editor.js'))
+ace.config.setModuleUrl('ace/theme/dawn', require('file-loader?esModule=false!./src-noconflict/theme-dawn.js'))
+ace.config.setModuleUrl('ace/theme/dracula', require('file-loader?esModule=false!./src-noconflict/theme-dracula.js'))
+ace.config.setModuleUrl('ace/theme/dreamweaver', require('file-loader?esModule=false!./src-noconflict/theme-dreamweaver.js'))
+ace.config.setModuleUrl('ace/theme/eclipse', require('file-loader?esModule=false!./src-noconflict/theme-eclipse.js'))
+ace.config.setModuleUrl('ace/theme/github', require('file-loader?esModule=false!./src-noconflict/theme-github.js'))
+ace.config.setModuleUrl('ace/theme/gob', require('file-loader?esModule=false!./src-noconflict/theme-gob.js'))
+ace.config.setModuleUrl('ace/theme/gruvbox', require('file-loader?esModule=false!./src-noconflict/theme-gruvbox.js'))
+ace.config.setModuleUrl('ace/theme/idle_fingers', require('file-loader?esModule=false!./src-noconflict/theme-idle_fingers.js'))
+ace.config.setModuleUrl('ace/theme/iplastic', require('file-loader?esModule=false!./src-noconflict/theme-iplastic.js'))
+ace.config.setModuleUrl('ace/theme/katzenmilch', require('file-loader?esModule=false!./src-noconflict/theme-katzenmilch.js'))
+ace.config.setModuleUrl('ace/theme/kr_theme', require('file-loader?esModule=false!./src-noconflict/theme-kr_theme.js'))
+ace.config.setModuleUrl('ace/theme/kuroir', require('file-loader?esModule=false!./src-noconflict/theme-kuroir.js'))
+ace.config.setModuleUrl('ace/theme/merbivore', require('file-loader?esModule=false!./src-noconflict/theme-merbivore.js'))
+ace.config.setModuleUrl('ace/theme/merbivore_soft', require('file-loader?esModule=false!./src-noconflict/theme-merbivore_soft.js'))
+ace.config.setModuleUrl('ace/theme/monokai', require('file-loader?esModule=false!./src-noconflict/theme-monokai.js'))
+ace.config.setModuleUrl('ace/theme/mono_industrial', require('file-loader?esModule=false!./src-noconflict/theme-mono_industrial.js'))
+ace.config.setModuleUrl('ace/theme/pastel_on_dark', require('file-loader?esModule=false!./src-noconflict/theme-pastel_on_dark.js'))
+ace.config.setModuleUrl('ace/theme/solarized_dark', require('file-loader?esModule=false!./src-noconflict/theme-solarized_dark.js'))
+ace.config.setModuleUrl('ace/theme/solarized_light', require('file-loader?esModule=false!./src-noconflict/theme-solarized_light.js'))
+ace.config.setModuleUrl('ace/theme/sqlserver', require('file-loader?esModule=false!./src-noconflict/theme-sqlserver.js'))
+ace.config.setModuleUrl('ace/theme/terminal', require('file-loader?esModule=false!./src-noconflict/theme-terminal.js'))
+ace.config.setModuleUrl('ace/theme/textmate', require('file-loader?esModule=false!./src-noconflict/theme-textmate.js'))
+ace.config.setModuleUrl('ace/theme/tomorrow', require('file-loader?esModule=false!./src-noconflict/theme-tomorrow.js'))
+ace.config.setModuleUrl('ace/theme/tomorrow_night', require('file-loader?esModule=false!./src-noconflict/theme-tomorrow_night.js'))
+ace.config.setModuleUrl('ace/theme/tomorrow_night_blue', require('file-loader?esModule=false!./src-noconflict/theme-tomorrow_night_blue.js'))
+ace.config.setModuleUrl('ace/theme/tomorrow_night_bright', require('file-loader?esModule=false!./src-noconflict/theme-tomorrow_night_bright.js'))
+ace.config.setModuleUrl('ace/theme/tomorrow_night_eighties', require('file-loader?esModule=false!./src-noconflict/theme-tomorrow_night_eighties.js'))
+ace.config.setModuleUrl('ace/theme/twilight', require('file-loader?esModule=false!./src-noconflict/theme-twilight.js'))
+ace.config.setModuleUrl('ace/theme/vibrant_ink', require('file-loader?esModule=false!./src-noconflict/theme-vibrant_ink.js'))
+ace.config.setModuleUrl('ace/theme/xcode', require('file-loader?esModule=false!./src-noconflict/theme-xcode.js'))
+ace.config.setModuleUrl('ace/mode/coffee_worker', require('file-loader?esModule=false!./src-noconflict/worker-coffee.js'))
+ace.config.setModuleUrl('ace/mode/css_worker', require('file-loader?esModule=false!./src-noconflict/worker-css.js'))
+ace.config.setModuleUrl('ace/mode/html_worker', require('file-loader?esModule=false!./src-noconflict/worker-html.js'))
+ace.config.setModuleUrl('ace/mode/javascript_worker', require('file-loader?esModule=false!./src-noconflict/worker-javascript.js'))
+ace.config.setModuleUrl('ace/mode/json_worker', require('file-loader?esModule=false!./src-noconflict/worker-json.js'))
+ace.config.setModuleUrl('ace/mode/lua_worker', require('file-loader?esModule=false!./src-noconflict/worker-lua.js'))
+ace.config.setModuleUrl('ace/mode/php_worker', require('file-loader?esModule=false!./src-noconflict/worker-php.js'))
+ace.config.setModuleUrl('ace/mode/xml_worker', require('file-loader?esModule=false!./src-noconflict/worker-xml.js'))
+ace.config.setModuleUrl('ace/mode/xquery_worker', require('file-loader?esModule=false!./src-noconflict/worker-xquery.js'))
+ace.config.setModuleUrl('ace/snippets/abap', require('file-loader?esModule=false!./src-noconflict/snippets/abap.js'))
+ace.config.setModuleUrl('ace/snippets/abc', require('file-loader?esModule=false!./src-noconflict/snippets/abc.js'))
+ace.config.setModuleUrl('ace/snippets/actionscript', require('file-loader?esModule=false!./src-noconflict/snippets/actionscript.js'))
+ace.config.setModuleUrl('ace/snippets/ada', require('file-loader?esModule=false!./src-noconflict/snippets/ada.js'))
+ace.config.setModuleUrl('ace/snippets/apache_conf', require('file-loader?esModule=false!./src-noconflict/snippets/apache_conf.js'))
+ace.config.setModuleUrl('ace/snippets/apex', require('file-loader?esModule=false!./src-noconflict/snippets/apex.js'))
+ace.config.setModuleUrl('ace/snippets/applescript', require('file-loader?esModule=false!./src-noconflict/snippets/applescript.js'))
+ace.config.setModuleUrl('ace/snippets/aql', require('file-loader?esModule=false!./src-noconflict/snippets/aql.js'))
+ace.config.setModuleUrl('ace/snippets/asciidoc', require('file-loader?esModule=false!./src-noconflict/snippets/asciidoc.js'))
+ace.config.setModuleUrl('ace/snippets/asl', require('file-loader?esModule=false!./src-noconflict/snippets/asl.js'))
+ace.config.setModuleUrl('ace/snippets/assembly_x86', require('file-loader?esModule=false!./src-noconflict/snippets/assembly_x86.js'))
+ace.config.setModuleUrl('ace/snippets/autohotkey', require('file-loader?esModule=false!./src-noconflict/snippets/autohotkey.js'))
+ace.config.setModuleUrl('ace/snippets/batchfile', require('file-loader?esModule=false!./src-noconflict/snippets/batchfile.js'))
+ace.config.setModuleUrl('ace/snippets/bro', require('file-loader?esModule=false!./src-noconflict/snippets/bro.js'))
+ace.config.setModuleUrl('ace/snippets/c9search', require('file-loader?esModule=false!./src-noconflict/snippets/c9search.js'))
+ace.config.setModuleUrl('ace/snippets/cirru', require('file-loader?esModule=false!./src-noconflict/snippets/cirru.js'))
+ace.config.setModuleUrl('ace/snippets/clojure', require('file-loader?esModule=false!./src-noconflict/snippets/clojure.js'))
+ace.config.setModuleUrl('ace/snippets/cobol', require('file-loader?esModule=false!./src-noconflict/snippets/cobol.js'))
+ace.config.setModuleUrl('ace/snippets/coffee', require('file-loader?esModule=false!./src-noconflict/snippets/coffee.js'))
+ace.config.setModuleUrl('ace/snippets/coldfusion', require('file-loader?esModule=false!./src-noconflict/snippets/coldfusion.js'))
+ace.config.setModuleUrl('ace/snippets/crystal', require('file-loader?esModule=false!./src-noconflict/snippets/crystal.js'))
+ace.config.setModuleUrl('ace/snippets/csharp', require('file-loader?esModule=false!./src-noconflict/snippets/csharp.js'))
+ace.config.setModuleUrl('ace/snippets/csound_document', require('file-loader?esModule=false!./src-noconflict/snippets/csound_document.js'))
+ace.config.setModuleUrl('ace/snippets/csound_orchestra', require('file-loader?esModule=false!./src-noconflict/snippets/csound_orchestra.js'))
+ace.config.setModuleUrl('ace/snippets/csound_score', require('file-loader?esModule=false!./src-noconflict/snippets/csound_score.js'))
+ace.config.setModuleUrl('ace/snippets/csp', require('file-loader?esModule=false!./src-noconflict/snippets/csp.js'))
+ace.config.setModuleUrl('ace/snippets/css', require('file-loader?esModule=false!./src-noconflict/snippets/css.js'))
+ace.config.setModuleUrl('ace/snippets/curly', require('file-loader?esModule=false!./src-noconflict/snippets/curly.js'))
+ace.config.setModuleUrl('ace/snippets/c_cpp', require('file-loader?esModule=false!./src-noconflict/snippets/c_cpp.js'))
+ace.config.setModuleUrl('ace/snippets/d', require('file-loader?esModule=false!./src-noconflict/snippets/d.js'))
+ace.config.setModuleUrl('ace/snippets/dart', require('file-loader?esModule=false!./src-noconflict/snippets/dart.js'))
+ace.config.setModuleUrl('ace/snippets/diff', require('file-loader?esModule=false!./src-noconflict/snippets/diff.js'))
+ace.config.setModuleUrl('ace/snippets/django', require('file-loader?esModule=false!./src-noconflict/snippets/django.js'))
+ace.config.setModuleUrl('ace/snippets/dockerfile', require('file-loader?esModule=false!./src-noconflict/snippets/dockerfile.js'))
+ace.config.setModuleUrl('ace/snippets/dot', require('file-loader?esModule=false!./src-noconflict/snippets/dot.js'))
+ace.config.setModuleUrl('ace/snippets/drools', require('file-loader?esModule=false!./src-noconflict/snippets/drools.js'))
+ace.config.setModuleUrl('ace/snippets/edifact', require('file-loader?esModule=false!./src-noconflict/snippets/edifact.js'))
+ace.config.setModuleUrl('ace/snippets/eiffel', require('file-loader?esModule=false!./src-noconflict/snippets/eiffel.js'))
+ace.config.setModuleUrl('ace/snippets/ejs', require('file-loader?esModule=false!./src-noconflict/snippets/ejs.js'))
+ace.config.setModuleUrl('ace/snippets/elixir', require('file-loader?esModule=false!./src-noconflict/snippets/elixir.js'))
+ace.config.setModuleUrl('ace/snippets/elm', require('file-loader?esModule=false!./src-noconflict/snippets/elm.js'))
+ace.config.setModuleUrl('ace/snippets/erlang', require('file-loader?esModule=false!./src-noconflict/snippets/erlang.js'))
+ace.config.setModuleUrl('ace/snippets/forth', require('file-loader?esModule=false!./src-noconflict/snippets/forth.js'))
+ace.config.setModuleUrl('ace/snippets/fortran', require('file-loader?esModule=false!./src-noconflict/snippets/fortran.js'))
+ace.config.setModuleUrl('ace/snippets/fsharp', require('file-loader?esModule=false!./src-noconflict/snippets/fsharp.js'))
+ace.config.setModuleUrl('ace/snippets/fsl', require('file-loader?esModule=false!./src-noconflict/snippets/fsl.js'))
+ace.config.setModuleUrl('ace/snippets/ftl', require('file-loader?esModule=false!./src-noconflict/snippets/ftl.js'))
+ace.config.setModuleUrl('ace/snippets/gcode', require('file-loader?esModule=false!./src-noconflict/snippets/gcode.js'))
+ace.config.setModuleUrl('ace/snippets/gherkin', require('file-loader?esModule=false!./src-noconflict/snippets/gherkin.js'))
+ace.config.setModuleUrl('ace/snippets/gitignore', require('file-loader?esModule=false!./src-noconflict/snippets/gitignore.js'))
+ace.config.setModuleUrl('ace/snippets/glsl', require('file-loader?esModule=false!./src-noconflict/snippets/glsl.js'))
+ace.config.setModuleUrl('ace/snippets/gobstones', require('file-loader?esModule=false!./src-noconflict/snippets/gobstones.js'))
+ace.config.setModuleUrl('ace/snippets/golang', require('file-loader?esModule=false!./src-noconflict/snippets/golang.js'))
+ace.config.setModuleUrl('ace/snippets/graphqlschema', require('file-loader?esModule=false!./src-noconflict/snippets/graphqlschema.js'))
+ace.config.setModuleUrl('ace/snippets/groovy', require('file-loader?esModule=false!./src-noconflict/snippets/groovy.js'))
+ace.config.setModuleUrl('ace/snippets/haml', require('file-loader?esModule=false!./src-noconflict/snippets/haml.js'))
+ace.config.setModuleUrl('ace/snippets/handlebars', require('file-loader?esModule=false!./src-noconflict/snippets/handlebars.js'))
+ace.config.setModuleUrl('ace/snippets/haskell', require('file-loader?esModule=false!./src-noconflict/snippets/haskell.js'))
+ace.config.setModuleUrl('ace/snippets/haskell_cabal', require('file-loader?esModule=false!./src-noconflict/snippets/haskell_cabal.js'))
+ace.config.setModuleUrl('ace/snippets/haxe', require('file-loader?esModule=false!./src-noconflict/snippets/haxe.js'))
+ace.config.setModuleUrl('ace/snippets/hjson', require('file-loader?esModule=false!./src-noconflict/snippets/hjson.js'))
+ace.config.setModuleUrl('ace/snippets/html', require('file-loader?esModule=false!./src-noconflict/snippets/html.js'))
+ace.config.setModuleUrl('ace/snippets/html_elixir', require('file-loader?esModule=false!./src-noconflict/snippets/html_elixir.js'))
+ace.config.setModuleUrl('ace/snippets/html_ruby', require('file-loader?esModule=false!./src-noconflict/snippets/html_ruby.js'))
+ace.config.setModuleUrl('ace/snippets/ini', require('file-loader?esModule=false!./src-noconflict/snippets/ini.js'))
+ace.config.setModuleUrl('ace/snippets/io', require('file-loader?esModule=false!./src-noconflict/snippets/io.js'))
+ace.config.setModuleUrl('ace/snippets/jack', require('file-loader?esModule=false!./src-noconflict/snippets/jack.js'))
+ace.config.setModuleUrl('ace/snippets/jade', require('file-loader?esModule=false!./src-noconflict/snippets/jade.js'))
+ace.config.setModuleUrl('ace/snippets/java', require('file-loader?esModule=false!./src-noconflict/snippets/java.js'))
+ace.config.setModuleUrl('ace/snippets/javascript', require('file-loader?esModule=false!./src-noconflict/snippets/javascript.js'))
+ace.config.setModuleUrl('ace/snippets/json', require('file-loader?esModule=false!./src-noconflict/snippets/json.js'))
+ace.config.setModuleUrl('ace/snippets/jsoniq', require('file-loader?esModule=false!./src-noconflict/snippets/jsoniq.js'))
+ace.config.setModuleUrl('ace/snippets/jsp', require('file-loader?esModule=false!./src-noconflict/snippets/jsp.js'))
+ace.config.setModuleUrl('ace/snippets/jssm', require('file-loader?esModule=false!./src-noconflict/snippets/jssm.js'))
+ace.config.setModuleUrl('ace/snippets/jsx', require('file-loader?esModule=false!./src-noconflict/snippets/jsx.js'))
+ace.config.setModuleUrl('ace/snippets/julia', require('file-loader?esModule=false!./src-noconflict/snippets/julia.js'))
+ace.config.setModuleUrl('ace/snippets/kotlin', require('file-loader?esModule=false!./src-noconflict/snippets/kotlin.js'))
+ace.config.setModuleUrl('ace/snippets/latex', require('file-loader?esModule=false!./src-noconflict/snippets/latex.js'))
+ace.config.setModuleUrl('ace/snippets/less', require('file-loader?esModule=false!./src-noconflict/snippets/less.js'))
+ace.config.setModuleUrl('ace/snippets/liquid', require('file-loader?esModule=false!./src-noconflict/snippets/liquid.js'))
+ace.config.setModuleUrl('ace/snippets/lisp', require('file-loader?esModule=false!./src-noconflict/snippets/lisp.js'))
+ace.config.setModuleUrl('ace/snippets/livescript', require('file-loader?esModule=false!./src-noconflict/snippets/livescript.js'))
+ace.config.setModuleUrl('ace/snippets/logiql', require('file-loader?esModule=false!./src-noconflict/snippets/logiql.js'))
+ace.config.setModuleUrl('ace/snippets/logtalk', require('file-loader?esModule=false!./src-noconflict/snippets/logtalk.js'))
+ace.config.setModuleUrl('ace/snippets/lsl', require('file-loader?esModule=false!./src-noconflict/snippets/lsl.js'))
+ace.config.setModuleUrl('ace/snippets/lua', require('file-loader?esModule=false!./src-noconflict/snippets/lua.js'))
+ace.config.setModuleUrl('ace/snippets/luapage', require('file-loader?esModule=false!./src-noconflict/snippets/luapage.js'))
+ace.config.setModuleUrl('ace/snippets/lucene', require('file-loader?esModule=false!./src-noconflict/snippets/lucene.js'))
+ace.config.setModuleUrl('ace/snippets/makefile', require('file-loader?esModule=false!./src-noconflict/snippets/makefile.js'))
+ace.config.setModuleUrl('ace/snippets/markdown', require('file-loader?esModule=false!./src-noconflict/snippets/markdown.js'))
+ace.config.setModuleUrl('ace/snippets/mask', require('file-loader?esModule=false!./src-noconflict/snippets/mask.js'))
+ace.config.setModuleUrl('ace/snippets/matlab', require('file-loader?esModule=false!./src-noconflict/snippets/matlab.js'))
+ace.config.setModuleUrl('ace/snippets/maze', require('file-loader?esModule=false!./src-noconflict/snippets/maze.js'))
+ace.config.setModuleUrl('ace/snippets/mel', require('file-loader?esModule=false!./src-noconflict/snippets/mel.js'))
+ace.config.setModuleUrl('ace/snippets/mixal', require('file-loader?esModule=false!./src-noconflict/snippets/mixal.js'))
+ace.config.setModuleUrl('ace/snippets/mushcode', require('file-loader?esModule=false!./src-noconflict/snippets/mushcode.js'))
+ace.config.setModuleUrl('ace/snippets/mysql', require('file-loader?esModule=false!./src-noconflict/snippets/mysql.js'))
+ace.config.setModuleUrl('ace/snippets/nginx', require('file-loader?esModule=false!./src-noconflict/snippets/nginx.js'))
+ace.config.setModuleUrl('ace/snippets/nim', require('file-loader?esModule=false!./src-noconflict/snippets/nim.js'))
+ace.config.setModuleUrl('ace/snippets/nix', require('file-loader?esModule=false!./src-noconflict/snippets/nix.js'))
+ace.config.setModuleUrl('ace/snippets/nsis', require('file-loader?esModule=false!./src-noconflict/snippets/nsis.js'))
+ace.config.setModuleUrl('ace/snippets/objectivec', require('file-loader?esModule=false!./src-noconflict/snippets/objectivec.js'))
+ace.config.setModuleUrl('ace/snippets/ocaml', require('file-loader?esModule=false!./src-noconflict/snippets/ocaml.js'))
+ace.config.setModuleUrl('ace/snippets/pascal', require('file-loader?esModule=false!./src-noconflict/snippets/pascal.js'))
+ace.config.setModuleUrl('ace/snippets/perl', require('file-loader?esModule=false!./src-noconflict/snippets/perl.js'))
+ace.config.setModuleUrl('ace/snippets/perl6', require('file-loader?esModule=false!./src-noconflict/snippets/perl6.js'))
+ace.config.setModuleUrl('ace/snippets/pgsql', require('file-loader?esModule=false!./src-noconflict/snippets/pgsql.js'))
+ace.config.setModuleUrl('ace/snippets/php', require('file-loader?esModule=false!./src-noconflict/snippets/php.js'))
+ace.config.setModuleUrl('ace/snippets/php_laravel_blade', require('file-loader?esModule=false!./src-noconflict/snippets/php_laravel_blade.js'))
+ace.config.setModuleUrl('ace/snippets/pig', require('file-loader?esModule=false!./src-noconflict/snippets/pig.js'))
+ace.config.setModuleUrl('ace/snippets/plain_text', require('file-loader?esModule=false!./src-noconflict/snippets/plain_text.js'))
+ace.config.setModuleUrl('ace/snippets/powershell', require('file-loader?esModule=false!./src-noconflict/snippets/powershell.js'))
+ace.config.setModuleUrl('ace/snippets/praat', require('file-loader?esModule=false!./src-noconflict/snippets/praat.js'))
+ace.config.setModuleUrl('ace/snippets/prolog', require('file-loader?esModule=false!./src-noconflict/snippets/prolog.js'))
+ace.config.setModuleUrl('ace/snippets/properties', require('file-loader?esModule=false!./src-noconflict/snippets/properties.js'))
+ace.config.setModuleUrl('ace/snippets/protobuf', require('file-loader?esModule=false!./src-noconflict/snippets/protobuf.js'))
+ace.config.setModuleUrl('ace/snippets/puppet', require('file-loader?esModule=false!./src-noconflict/snippets/puppet.js'))
+ace.config.setModuleUrl('ace/snippets/python', require('file-loader?esModule=false!./src-noconflict/snippets/python.js'))
+ace.config.setModuleUrl('ace/snippets/r', require('file-loader?esModule=false!./src-noconflict/snippets/r.js'))
+ace.config.setModuleUrl('ace/snippets/razor', require('file-loader?esModule=false!./src-noconflict/snippets/razor.js'))
+ace.config.setModuleUrl('ace/snippets/rdoc', require('file-loader?esModule=false!./src-noconflict/snippets/rdoc.js'))
+ace.config.setModuleUrl('ace/snippets/red', require('file-loader?esModule=false!./src-noconflict/snippets/red.js'))
+ace.config.setModuleUrl('ace/snippets/redshift', require('file-loader?esModule=false!./src-noconflict/snippets/redshift.js'))
+ace.config.setModuleUrl('ace/snippets/rhtml', require('file-loader?esModule=false!./src-noconflict/snippets/rhtml.js'))
+ace.config.setModuleUrl('ace/snippets/rst', require('file-loader?esModule=false!./src-noconflict/snippets/rst.js'))
+ace.config.setModuleUrl('ace/snippets/ruby', require('file-loader?esModule=false!./src-noconflict/snippets/ruby.js'))
+ace.config.setModuleUrl('ace/snippets/rust', require('file-loader?esModule=false!./src-noconflict/snippets/rust.js'))
+ace.config.setModuleUrl('ace/snippets/sass', require('file-loader?esModule=false!./src-noconflict/snippets/sass.js'))
+ace.config.setModuleUrl('ace/snippets/scad', require('file-loader?esModule=false!./src-noconflict/snippets/scad.js'))
+ace.config.setModuleUrl('ace/snippets/scala', require('file-loader?esModule=false!./src-noconflict/snippets/scala.js'))
+ace.config.setModuleUrl('ace/snippets/scheme', require('file-loader?esModule=false!./src-noconflict/snippets/scheme.js'))
+ace.config.setModuleUrl('ace/snippets/scss', require('file-loader?esModule=false!./src-noconflict/snippets/scss.js'))
+ace.config.setModuleUrl('ace/snippets/sh', require('file-loader?esModule=false!./src-noconflict/snippets/sh.js'))
+ace.config.setModuleUrl('ace/snippets/sjs', require('file-loader?esModule=false!./src-noconflict/snippets/sjs.js'))
+ace.config.setModuleUrl('ace/snippets/slim', require('file-loader?esModule=false!./src-noconflict/snippets/slim.js'))
+ace.config.setModuleUrl('ace/snippets/smarty', require('file-loader?esModule=false!./src-noconflict/snippets/smarty.js'))
+ace.config.setModuleUrl('ace/snippets/snippets', require('file-loader?esModule=false!./src-noconflict/snippets/snippets.js'))
+ace.config.setModuleUrl('ace/snippets/soy_template', require('file-loader?esModule=false!./src-noconflict/snippets/soy_template.js'))
+ace.config.setModuleUrl('ace/snippets/space', require('file-loader?esModule=false!./src-noconflict/snippets/space.js'))
+ace.config.setModuleUrl('ace/snippets/sparql', require('file-loader?esModule=false!./src-noconflict/snippets/sparql.js'))
+ace.config.setModuleUrl('ace/snippets/sql', require('file-loader?esModule=false!./src-noconflict/snippets/sql.js'))
+ace.config.setModuleUrl('ace/snippets/sqlserver', require('file-loader?esModule=false!./src-noconflict/snippets/sqlserver.js'))
+ace.config.setModuleUrl('ace/snippets/stylus', require('file-loader?esModule=false!./src-noconflict/snippets/stylus.js'))
+ace.config.setModuleUrl('ace/snippets/svg', require('file-loader?esModule=false!./src-noconflict/snippets/svg.js'))
+ace.config.setModuleUrl('ace/snippets/swift', require('file-loader?esModule=false!./src-noconflict/snippets/swift.js'))
+ace.config.setModuleUrl('ace/snippets/tcl', require('file-loader?esModule=false!./src-noconflict/snippets/tcl.js'))
+ace.config.setModuleUrl('ace/snippets/terraform', require('file-loader?esModule=false!./src-noconflict/snippets/terraform.js'))
+ace.config.setModuleUrl('ace/snippets/tex', require('file-loader?esModule=false!./src-noconflict/snippets/tex.js'))
+ace.config.setModuleUrl('ace/snippets/text', require('file-loader?esModule=false!./src-noconflict/snippets/text.js'))
+ace.config.setModuleUrl('ace/snippets/textile', require('file-loader?esModule=false!./src-noconflict/snippets/textile.js'))
+ace.config.setModuleUrl('ace/snippets/toml', require('file-loader?esModule=false!./src-noconflict/snippets/toml.js'))
+ace.config.setModuleUrl('ace/snippets/tsx', require('file-loader?esModule=false!./src-noconflict/snippets/tsx.js'))
+ace.config.setModuleUrl('ace/snippets/turtle', require('file-loader?esModule=false!./src-noconflict/snippets/turtle.js'))
+ace.config.setModuleUrl('ace/snippets/twig', require('file-loader?esModule=false!./src-noconflict/snippets/twig.js'))
+ace.config.setModuleUrl('ace/snippets/typescript', require('file-loader?esModule=false!./src-noconflict/snippets/typescript.js'))
+ace.config.setModuleUrl('ace/snippets/vala', require('file-loader?esModule=false!./src-noconflict/snippets/vala.js'))
+ace.config.setModuleUrl('ace/snippets/vbscript', require('file-loader?esModule=false!./src-noconflict/snippets/vbscript.js'))
+ace.config.setModuleUrl('ace/snippets/velocity', require('file-loader?esModule=false!./src-noconflict/snippets/velocity.js'))
+ace.config.setModuleUrl('ace/snippets/verilog', require('file-loader?esModule=false!./src-noconflict/snippets/verilog.js'))
+ace.config.setModuleUrl('ace/snippets/vhdl', require('file-loader?esModule=false!./src-noconflict/snippets/vhdl.js'))
+ace.config.setModuleUrl('ace/snippets/visualforce', require('file-loader?esModule=false!./src-noconflict/snippets/visualforce.js'))
+ace.config.setModuleUrl('ace/snippets/wollok', require('file-loader?esModule=false!./src-noconflict/snippets/wollok.js'))
+ace.config.setModuleUrl('ace/snippets/xml', require('file-loader?esModule=false!./src-noconflict/snippets/xml.js'))
+ace.config.setModuleUrl('ace/snippets/xquery', require('file-loader?esModule=false!./src-noconflict/snippets/xquery.js'))
+ace.config.setModuleUrl('ace/snippets/yaml', require('file-loader?esModule=false!./src-noconflict/snippets/yaml.js'))
+ace.config.setModuleUrl('ace/snippets/zeek', require('file-loader?esModule=false!./src-noconflict/snippets/zeek.js'))
\ No newline at end of file
diff --git a/htdocs/includes/evalmath/README.md b/htdocs/includes/evalmath/README.md
deleted file mode 100755
index 6011e3fb676..00000000000
--- a/htdocs/includes/evalmath/README.md
+++ /dev/null
@@ -1,11 +0,0 @@
-evalmath.class.php
-==================
-
-Version 1.0
-
-Taken from http://www.phpclasses.org/browse/file/11680.html, cred to Miles Kaufmann
-
-This repository is cloned for two reasons:
-
-1. To allow downloading the code without signing in to phpclasses.org.
-2. To add very small improvements to the code.
diff --git a/htdocs/includes/evalmath/evalmath.class.php b/htdocs/includes/evalmath/evalmath.class.php
deleted file mode 100644
index 9d970aed789..00000000000
--- a/htdocs/includes/evalmath/evalmath.class.php
+++ /dev/null
@@ -1,398 +0,0 @@
-
-
-================================================================================
-
-NAME
- EvalMath - safely evaluate math expressions
-
-SYNOPSIS
- include('evalmath.class.php');
- $m = new EvalMath;
- // basic evaluation:
- $result = $m->evaluate('2+2');
- // supports: order of operation; parentheses; negation; built-in functions
- $result = $m->evaluate('-8(5/2)^2*(1-sqrt(4))-8');
- // create your own variables
- $m->evaluate('a = e^(ln(pi))');
- // or functions
- $m->evaluate('f(x,y) = x^2 + y^2 - 2x*y + 1');
- // and then use them
- $result = $m->evaluate('3*f(42,a)');
-
-DESCRIPTION
- Use the EvalMath class when you want to evaluate mathematical expressions
- from untrusted sources. You can define your own variables and functions,
- which are stored in the object. Try it, it's fun!
-
-METHODS
- $m->evalute($expr)
- Evaluates the expression and returns the result. If an error occurs,
- prints a warning and returns false. If $expr is a function assignment,
- returns true on success.
-
- $m->e($expr)
- A synonym for $m->evaluate().
-
- $m->vars()
- Returns an associative array of all user-defined variables and values.
-
- $m->funcs()
- Returns an array of all user-defined functions.
-
-PARAMETERS
- $m->suppress_errors
- Set to true to turn off warnings when evaluating expressions
-
- $m->last_error
- If the last evaluation failed, contains a string describing the error.
- (Useful when suppress_errors is on).
-
- $m->last_error_code
- If the last evaluation failed, 2 element array with numeric code and extra info
-
-AUTHOR INFORMATION
- Copyright 2005, Miles Kaufmann.
-
-LICENSE
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- 1 Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-class EvalMath
-{
- var $suppress_errors = false;
- var $last_error = null;
- var $last_error_code = null;
-
- var $v = array('e'=>2.71,'pi'=>3.14159); // variables (and constants)
- var $f = array(); // user-defined functions
- var $vb = array('e', 'pi'); // constants
- var $fb = array( // built-in functions
- 'sin','sinh','arcsin','asin','arcsinh','asinh',
- 'cos','cosh','arccos','acos','arccosh','acosh',
- 'tan','tanh','arctan','atan','arctanh','atanh',
- 'sqrt','abs','ln','log','intval');
-
- /**
- * Constructor
- */
- function __construct() {
- // make the variables a little more accurate
- $this->v['pi'] = pi();
- $this->v['e'] = exp(1);
- }
-
- function e($expr) {
- return $this->evaluate($expr);
- }
-
- function evaluate($expr) {
- $this->last_error = null;
- $this->last_error_code = null;
- $expr = trim($expr);
- if (substr($expr, -1, 1) == ';') $expr = substr($expr, 0, strlen($expr)-1); // strip semicolons at the end
- //===============
- // is it a variable assignment?
- if (preg_match('/^\s*([a-z]\w*)\s*=\s*(.+)$/', $expr, $matches)) {
- if (in_array($matches[1], $this->vb)) { // make sure we're not assigning to a constant
- return $this->trigger(1, "cannot assign to constant '$matches[1]'", $matches[1]);
- }
- if (($tmp = $this->pfx($this->nfx($matches[2]))) === false) return false; // get the result and make sure it's good
- $this->v[$matches[1]] = $tmp; // if so, stick it in the variable array
- return $this->v[$matches[1]]; // and return the resulting value
- //===============
- // is it a function assignment?
- } elseif (preg_match('/^\s*([a-z]\w*)\s*\(\s*([a-z]\w*(?:\s*,\s*[a-z]\w*)*)\s*\)\s*=\s*(.+)$/', $expr, $matches)) {
- $fnn = $matches[1]; // get the function name
- if (in_array($matches[1], $this->fb)) { // make sure it isn't built in
- return $this->trigger(2, "cannot redefine built-in function '$matches[1]()'", $matches[1]);
- }
- $args = explode(",", preg_replace("/\s+/", "", $matches[2])); // get the arguments
- if (($stack = $this->nfx($matches[3])) === false) return false; // see if it can be converted to postfix
- $nbstack = count($stack);
- for ($i = 0; $i < $nbstack; $i++) { // freeze the state of the non-argument variables
- $token = $stack[$i];
- if (preg_match('/^[a-z]\w*$/', $token) and !in_array($token, $args)) {
- if (array_key_exists($token, $this->v)) {
- $stack[$i] = $this->v[$token];
- } else {
- return $this->trigger(3, "undefined variable '$token' in function definition", $token);
- }
- }
- }
- $this->f[$fnn] = array('args'=>$args, 'func'=>$stack);
- return true;
- //===============
- } else {
- return $this->pfx($this->nfx($expr)); // straight up evaluation, woo
- }
- }
-
- function vars() {
- $output = $this->v;
- unset($output['pi']);
- unset($output['e']);
- return $output;
- }
-
- function funcs() {
- $output = array();
- foreach ($this->f as $fnn=>$dat)
- $output[] = $fnn . '(' . implode(',', $dat['args']) . ')';
- return $output;
- }
-
- //===================== HERE BE INTERNAL METHODS ====================\\
-
- // Convert infix to postfix notation
- function nfx($expr) {
-
- $index = 0;
- $stack = new EvalMathStack();
- $output = array(); // postfix form of expression, to be passed to pfx()
- $expr = trim(strtolower($expr));
-
- $ops = array('+', '-', '*', '/', '^', '_');
- $ops_r = array('+'=>0,'-'=>0,'*'=>0,'/'=>0,'^'=>1); // right-associative operator?
- $ops_p = array('+'=>0,'-'=>0,'*'=>1,'/'=>1,'_'=>1,'^'=>2); // operator precedence
-
- $expecting_op = false; // we use this in syntax-checking the expression
- // and determining when a - is a negation
-
- if (preg_match("/[^\w\s+*^\/()\.,-]/", $expr, $matches)) { // make sure the characters are all good
- return $this->trigger(4, "illegal character '{$matches[0]}'", $matches[0]);
- }
-
- while(1) { // 1 Infinite Loop ;)
- $op = substr($expr, $index, 1); // get the first character at the current index
- // find out if we're currently at the beginning of a number/variable/function/parenthesis/operand
- $ex = preg_match('/^([a-z]\w*\(?|\d+(?:\.\d*)?|\.\d+|\()/', substr($expr, $index), $match);
- //===============
- if ($op == '-' and !$expecting_op) { // is it a negation instead of a minus?
- $stack->push('_'); // put a negation on the stack
- $index++;
- } elseif ($op == '_') { // we have to explicitly deny this, because it's legal on the stack
- return $this->trigger(4, "illegal character '_'", "_"); // but not in the input expression
- //===============
- } elseif ((in_array($op, $ops) or $ex) and $expecting_op) { // are we putting an operator on the stack?
- if ($ex) { // are we expecting an operator but have a number/variable/function/opening parethesis?
- $op = '*'; $index--; // it's an implicit multiplication
- }
- // heart of the algorithm:
- while($stack->count > 0 and ($o2 = $stack->last()) and in_array($o2, $ops) and ($ops_r[$op] ? $ops_p[$op] < $ops_p[$o2] : $ops_p[$op] <= $ops_p[$o2])) {
- $output[] = $stack->pop(); // pop stuff off the stack into the output
- }
- // many thanks: http://en.wikipedia.org/wiki/Reverse_Polish_notation#The_algorithm_in_detail
- $stack->push($op); // finally put OUR operator onto the stack
- $index++;
- $expecting_op = false;
- //===============
- } elseif ($op == ')' and $expecting_op) { // ready to close a parenthesis?
- while (($o2 = $stack->pop()) != '(') { // pop off the stack back to the last (
- if (is_null($o2)) return $this->trigger(5, "unexpected ')'", ")");
- else $output[] = $o2;
- }
- if (preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches)) { // did we just close a function?
- $fnn = $matches[1]; // get the function name
- $arg_count = $stack->pop(); // see how many arguments there were (cleverly stored on the stack, thank you)
- $output[] = $stack->pop(); // pop the function and push onto the output
- if (in_array($fnn, $this->fb)) { // check the argument count
- if($arg_count > 1)
- return $this->trigger(6, "wrong number of arguments ($arg_count given, 1 expected)", array($arg_count, 1));
- } elseif (array_key_exists($fnn, $this->f)) {
- if ($arg_count != count($this->f[$fnn]['args']))
- return $this->trigger(6, "wrong number of arguments ($arg_count given, " . count($this->f[$fnn]['args']) . " expected)", array($arg_count, count($this->f[$fnn]['args'])));
- } else { // did we somehow push a non-function on the stack? this should never happen
- return $this->trigger(7, "internal error");
- }
- }
- $index++;
- //===============
- } elseif ($op == ',' and $expecting_op) { // did we just finish a function argument?
- while (($o2 = $stack->pop()) != '(') {
- if (is_null($o2)) return $this->trigger(5, "unexpected ','", ","); // oops, never had a (
- else $output[] = $o2; // pop the argument expression stuff and push onto the output
- }
- // make sure there was a function
- if (!preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches))
- return $this->trigger(5, "unexpected ','", ",");
- $stack->push($stack->pop()+1); // increment the argument count
- $stack->push('('); // put the ( back on, we'll need to pop back to it again
- $index++;
- $expecting_op = false;
- //===============
- } elseif ($op == '(' and !$expecting_op) {
- $stack->push('('); // that was easy
- $index++;
- $allow_neg = true;
- //===============
- } elseif ($ex and !$expecting_op) { // do we now have a function/variable/number?
- $expecting_op = true;
- $val = $match[1];
- if (preg_match("/^([a-z]\w*)\($/", $val, $matches)) { // may be func, or variable w/ implicit multiplication against parentheses...
- if (in_array($matches[1], $this->fb) or array_key_exists($matches[1], $this->f)) { // it's a func
- $stack->push($val);
- $stack->push(1);
- $stack->push('(');
- $expecting_op = false;
- } else { // it's a var w/ implicit multiplication
- $val = $matches[1];
- $output[] = $val;
- }
- } else { // it's a plain old var or num
- $output[] = $val;
- }
- $index += strlen($val);
- //===============
- } elseif ($op == ')') { // miscellaneous error checking
- return $this->trigger(5, "unexpected ')'", ")");
- } elseif (in_array($op, $ops) and !$expecting_op) {
- return $this->trigger(8, "unexpected operator '$op'", $op);
- } else { // I don't even want to know what you did to get here
- return $this->trigger(9, "an unexpected error occured");
- }
- if ($index == strlen($expr)) {
- if (in_array($op, $ops)) { // did we end with an operator? bad.
- return $this->trigger(10, "operator '$op' lacks operand", $op);
- } else {
- break;
- }
- }
- while (substr($expr, $index, 1) == ' ') { // step the index past whitespace (pretty much turns whitespace
- $index++; // into implicit multiplication if no operator is there)
- }
-
- }
- while (!is_null($op = $stack->pop())) { // pop everything off the stack and push onto output
- if ($op == '(') return $this->trigger(11, "expecting ')'", ")"); // if there are (s on the stack, ()s were unbalanced
- $output[] = $op;
- }
- return $output;
- }
-
- // evaluate postfix notation
- function pfx($tokens, $vars = array()) {
-
- if ($tokens == false) return false;
-
- $stack = new EvalMathStack();
-
- foreach ($tokens as $token) { // nice and easy
- // if the token is a binary operator, pop two values off the stack, do the operation, and push the result back on
- if (in_array($token, array('+', '-', '*', '/', '^'))) {
- if (is_null($op2 = $stack->pop())) return $this->trigger(12, "internal error");
- if (is_null($op1 = $stack->pop())) return $this->trigger(13, "internal error");
- switch ($token) {
- case '+':
- $stack->push($op1+$op2); break;
- case '-':
- $stack->push($op1-$op2); break;
- case '*':
- $stack->push($op1*$op2); break;
- case '/':
- if ($op2 == 0) return $this->trigger(14, "division by zero");
- $stack->push($op1/$op2); break;
- case '^':
- $stack->push(pow($op1, $op2)); break;
- }
- // if the token is a unary operator, pop one value off the stack, do the operation, and push it back on
- } elseif ($token == "_") {
- $stack->push(-1*$stack->pop());
- // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on
- } elseif (preg_match("/^([a-z]\w*)\($/", $token, $matches)) { // it's a function!
- $fnn = $matches[1];
- if (in_array($fnn, $this->fb)) { // built-in function:
- if (is_null($op1 = $stack->pop())) return $this->trigger(15, "internal error");
- $fnn = preg_replace("/^arc/", "a", $fnn); // for the 'arc' trig synonyms
- if ($fnn == 'ln') $fnn = 'log';
- eval('$stack->push(' . $fnn . '($op1));'); // perfectly safe eval()
- } elseif (array_key_exists($fnn, $this->f)) { // user function
- // get args
- $args = array();
- for ($i = count($this->f[$fnn]['args'])-1; $i >= 0; $i--) {
- if (is_null($args[$this->f[$fnn]['args'][$i]] = $stack->pop())) return $this->trigger(16, "internal error");
- }
- $stack->push($this->pfx($this->f[$fnn]['func'], $args)); // yay... recursion!!!!
- }
- // if the token is a number or variable, push it on the stack
- } else {
- if (is_numeric($token)) {
- $stack->push($token);
- } elseif (array_key_exists($token, $this->v)) {
- $stack->push($this->v[$token]);
- } elseif (array_key_exists($token, $vars)) {
- $stack->push($vars[$token]);
- } else {
- return $this->trigger(17, "undefined variable '$token'", $token);
- }
- }
- }
- // when we're out of tokens, the stack should have a single element, the final result
- if ($stack->count != 1) return $this->trigger(18, "internal error");
- return $stack->pop();
- }
-
- // trigger an error, but nicely, if need be
- function trigger($code, $msg, $info = null) {
- $this->last_error = $msg;
- $this->last_error_code = array($code, $info);
- if (!$this->suppress_errors) trigger_error($msg, E_USER_WARNING);
- return false;
- }
-}
-
-/**
- * Class for internal use
- */
-class EvalMathStack
-{
- var $stack = array();
- var $count = 0;
-
- function push($val) {
- $this->stack[$this->count] = $val;
- $this->count++;
- }
-
- function pop() {
- if ($this->count > 0) {
- $this->count--;
- return $this->stack[$this->count];
- }
- return null;
- }
-
- function last($n=1) {
- if (isset($this->stack[$this->count-$n])) {
- return $this->stack[$this->count-$n];
- }
- return;
- }
-}
diff --git a/htdocs/includes/jquery/plugins/select2/.editorconfig b/htdocs/includes/jquery/plugins/select2/.editorconfig
new file mode 100644
index 00000000000..54f4d3beedb
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/.editorconfig
@@ -0,0 +1,6 @@
+[*]
+indent_style = space
+end_of_line = lf
+
+[*.js]
+indent_size = 2
diff --git a/htdocs/includes/jquery/plugins/select2/.gitignore b/htdocs/includes/jquery/plugins/select2/.gitignore
new file mode 100644
index 00000000000..aa970da6518
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/.gitignore
@@ -0,0 +1,3 @@
+node_modules
+dist/js/i18n/build.txt
+.sass-cache
diff --git a/htdocs/includes/jquery/plugins/select2/.jshintignore b/htdocs/includes/jquery/plugins/select2/.jshintignore
new file mode 100644
index 00000000000..ba5a30f8c38
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/.jshintignore
@@ -0,0 +1,4 @@
+src/js/banner.*.js
+src/js/wrapper.*.js
+tests/vendor/*.js
+tests/helpers.js
diff --git a/htdocs/includes/jquery/plugins/select2/.jshintrc b/htdocs/includes/jquery/plugins/select2/.jshintrc
new file mode 100644
index 00000000000..94299268771
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/.jshintrc
@@ -0,0 +1,25 @@
+{
+ "bitwise": true,
+ "camelcase": true,
+ "curly": true,
+ "es3": true,
+ "eqnull": true,
+ "freeze": true,
+ "globals": {
+ "console": false,
+ "define": false,
+ "document": false,
+ "MockContainer": false,
+ "module": false,
+ "QUnit": false,
+ "require": false,
+ "test": false,
+ "window": false
+ },
+ "indent": 2,
+ "maxlen": 80,
+ "noarg": true,
+ "nonew": true,
+ "quotmark": "single",
+ "undef": true
+}
diff --git a/htdocs/includes/jquery/plugins/select2/CHANGELOG.md b/htdocs/includes/jquery/plugins/select2/CHANGELOG.md
index 3ae60aff255..d6b2a7587dd 100644
--- a/htdocs/includes/jquery/plugins/select2/CHANGELOG.md
+++ b/htdocs/includes/jquery/plugins/select2/CHANGELOG.md
@@ -1,5 +1,178 @@
# Change Log
+## 4.0.13
+
+### New features / improvements
+
+* Trigger `input` event before `change` events (#4649)
+* Feed back the keypress code that was responsible for the 'close' event (#5513)
+* Only trigger `selection:update` once on DOM change events (#5734)
+
+### Bug fixes
+
+* Prevent opening of disabled elements (#5751)
+
+### Documentation
+
+* Fix "edit this page" links in docs (#5689)
+
+### Miscellaneous
+
+* Registered Select2 on Open Collective (#5700, #5721, #5741)
+
+## 4.0.12
+
+### Bug fixes
+
+* Fixes incorrect offset when using the Shadow DOM and styling the `` element (#5682)
+
+### Miscellaneous
+
+* Replace cdnjs with jsDelivr in the documentation (#5687)
+* Fix incorrect provider for the automated NPM deployment (#5686)
+
+## 4.0.11
+
+### Bug fixes
+
+* Fixes jQuery migrate error when getting offset when dropdownParent not in document (#5584)
+
+### Miscellaneous
+
+* Enable GitHub actions for CI (#5591)
+* Documentation has been moved into and is deployed from the code repository (#5638)
+* Remove Travis CI integration (#5665)
+
+## 4.0.10
+
+### New features / improvements
+
+* Support passing in a selector for `dropdownParent` option (#5622)
+
+### Bug fixes
+
+* Fix bug where dropdowns pointing upwards were incorrectly positioned (#5621)
+
+## 4.0.9
+
+### New features / improvements
+
+* Mirror disabled state through aria-disabled on selection (#5579)
+* Select2 now clears the internal ID when it is destroyed (#5587)
+* Set the main ARIA 1.1 roles and properties for comboboxes (#5582)
+* The `language` option now has a clearly defined fallback chain (#5602)
+
+### Bug fixes
+
+* Do not propagate click when search box is not empty (#5580)
+* Fix `maximumSelectionLength` being ignored by `closeOnSelect` (#5581)
+* Fix generated options not receiving result IDs (#5586)
+* Remove selection title attribute if text is empty (#5589)
+* Reposition dropdown whenever items are selected (#5590)
+* Fix dropdown positioning when displayed above with messages (#5592)
+* Fix search box expanding width of container (#5595)
+* `allowClear` no longer shifts selections to a new line (#5603)
+
+### Translations
+
+* Fix error in German translations (#5604)
+
+### Miscellaneous
+
+* Updated development grunt version so it no longer shows as vulnerable (#5597)
+* Remove unused variables (#5554)
+
+## 4.0.8
+
+### New features / improvements
+
+* Test against and fix compatibility with jQuery 3.4.1 (#5531)
+* Results respect disabled state of `` (#5560)
+* Add `computedstyle` option for calculating the width (#5559)
+
+### Bug fixes
+
+* Fix tag creation being broken in 4.0.7 (#5558)
+* Fix infinite scroll when the scrollbar is not visible (#5575)
+* Revert change to focusing behaviour in 4.0.6 (#5576)
+
+### Translations
+
+* Fix wording in French translations (#5521)
+
+### Miscellaneous
+
+* Update grunt-contrib-qunit to latest version (#5530)
+* Removed unused `.select2-selection__placeholder` CSS definitions for multiple selects (#5508)
+* Remove deprecated jQuery shorthand (#5564)
+
+## 4.0.7
+
+### New features/improvements
+- Do not close on select if Ctrl or Meta (Cmd) keys being held (#5222)
+
+### Bug fixes
+- Fixed issue where single select boxes would automatically reopen when they were closed (#5490, #5492)
+
+### Miscellaneous
+- Move almost and jquery-mousewheel to devDependencies (#5489)
+
+## 4.0.6
+
+### New features/improvements
+- Add style property to package.json (#5019)
+- Implement `clear` and `clearing` events (#5058)
+- Add `scrollAfterSelect` option (#5150)
+- Add missing diacritics (#4118, #4337, #5464)
+
+### Bug fixes
+- Fix up arrow error when there are no options in dropdown (#5127)
+- Add `;` before beginning of factory wrapper (#5089)
+- Fix IE11 issue with select losing focus after selecting an item (#4860)
+- Clear tooltip from `select2-selection__rendered` when selection is cleared (#4640, #4746)
+- Fix keyboard not closing when closing dropdown on iOS 10 (#4680)
+- User-defined types not normalized properly when passed in as data (#4632)
+- Perform deep merge for `Defaults.set()` (#4364)
+- Fix "the results could not be loaded" displaying during AJAX request (#4356)
+- Cache objects in `Utils.__cache` instead of using `$.data` (#4346, #5486)
+- Removing the double event binding registration of `selection:update` (#4306)
+
+#### Accessibility
+- Improve `.select2-hidden-accessible` (#4908)
+- Add role and aria-readonly attributes to single selection dropdown value (#4881)
+
+### Translations
+- Add Turkmen translations (`tk`) (#5125)
+- Fix error in French translations (#5122)
+- Add Albanian translation (`sq`) (#5199)
+- Add Georgian translation (`ka`) (#5179)
+- Add Nepali translation (`ne`) (#5295)
+- Add Bangla translation (`bn`) (#5248)
+- Add `removeAllItems` translation for clear "x" title (#5291)
+- Fix wording in Vietnamese translations (#5387)
+- Fix error in Russian translation (#5401)
+
+### Miscellaneous
+- Remove duplicate CSS selector in classic theme (#5115)
+
+## 4.0.5
+
+### Bug fixes
+- Replace `autocapitalize=off` with `autocapitalize=none` (#4994)
+
+### Translations
+- Vietnamese: remove an unnecessary quote mark (#5059)
+- Czech: Add missing commas and periods (#5052)
+- Spanish: Update the 'errorLoading' message (#5032)
+- Fix typo in Romanian (#5005)
+- Improve French translation (#4988)
+- Add Pashto translation (`ps`) (#4960)
+- Add translations for lower and upper Sorbian (`dsb` and `hsb`) (#4949)
+- Updates to Slovak (#4915)
+- Fixed Norwegian `inputTooShort` message (#4817, 4896)
+- Add Afrikaans translation (`af`) (#4850)
+- Add Bosnian translation (`bs`) (#4504)
+
## 4.0.4
### New features / Improvements
diff --git a/htdocs/includes/jquery/plugins/select2/Gruntfile.js b/htdocs/includes/jquery/plugins/select2/Gruntfile.js
index bf0f38d4303..23ef3d9cf50 100644
--- a/htdocs/includes/jquery/plugins/select2/Gruntfile.js
+++ b/htdocs/includes/jquery/plugins/select2/Gruntfile.js
@@ -1,3 +1,5 @@
+const sass = require('node-sass');
+
module.exports = function (grunt) {
// Full list of files that must be included by RequireJS
includes = [
@@ -62,10 +64,6 @@ module.exports = function (grunt) {
grunt.initConfig({
package: grunt.file.readJSON('package.json'),
- clean: {
- docs: ['docs/_site']
- },
-
concat: {
'dist': {
options: {
@@ -124,81 +122,10 @@ module.exports = function (grunt) {
}
},
- 'saucelabs-qunit': {
- all: {
- options: {
- build: testBuildNumber,
- tags: ['tests', 'qunit'],
- urls: testUrls,
- testname: 'QUnit test for Select2',
- browsers: [
- {
- browserName: 'internet explorer',
- version: '8'
- },
- {
- browserName: 'internet explorer',
- version: '9'
- },
- {
- browserName: 'internet explorer',
- version: '10'
- },
- {
- browserName: 'internet explorer',
- version: '11'
- },
-
- {
- browserName: 'firefox',
- platform: 'linux'
- },
-
- {
- browserName: 'chrome'
- },
-
- {
- browserName: 'opera',
- version: '12',
- platform: 'linux'
- }
- ]
- }
- }
- },
-
- 'gh-pages': {
- options: {
- base: 'docs',
- branch: 'master',
- clone: 'node_modules/grunt-gh-pages/repo',
- message: 'Updated docs with master',
- push: true,
- repo: 'git@github.com:select2/select2.github.io.git'
- },
- src: '**'
- },
-
- jekyll: {
- options: {
- src: 'docs',
- dest: 'docs/_site'
- },
- build: {
- d: null
- },
- serve: {
- options: {
- serve: true,
- watch: true
- }
- }
- },
-
jshint: {
options: {
- jshintrc: true
+ jshintrc: true,
+ reporterOutput: ''
},
code: {
src: ['src/js/**/*.js']
@@ -211,6 +138,7 @@ module.exports = function (grunt) {
sass: {
dist: {
options: {
+ implementation: sass,
outputStyle: 'compressed'
},
files: {
@@ -222,6 +150,7 @@ module.exports = function (grunt) {
},
dev: {
options: {
+ implementation: sass,
outputStyle: 'nested'
},
files: {
@@ -233,19 +162,6 @@ module.exports = function (grunt) {
}
},
- symlink: {
- docs: {
- cwd: 'dist',
- expand: true,
- overwrite: false,
- src: [
- '*'
- ],
- dest: 'docs/dist',
- filter: 'isDirectory'
- }
- },
-
requirejs: {
'dist': {
options: {
@@ -324,22 +240,17 @@ module.exports = function (grunt) {
}
});
- grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-requirejs');
- grunt.loadNpmTasks('grunt-contrib-symlink');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
- grunt.loadNpmTasks('grunt-gh-pages');
- grunt.loadNpmTasks('grunt-jekyll');
- grunt.loadNpmTasks('grunt-saucelabs');
grunt.loadNpmTasks('grunt-sass');
- grunt.registerTask('default', ['compile', 'test', 'minify']);
+ grunt.registerTask('default', ['compile', 'test', 'lint', 'minify']);
grunt.registerTask('compile', [
'requirejs:dist', 'requirejs:dist.full', 'requirejs:i18n',
@@ -347,24 +258,6 @@ module.exports = function (grunt) {
'sass:dev'
]);
grunt.registerTask('minify', ['uglify', 'sass:dist']);
- grunt.registerTask('test', ['connect:tests', 'qunit', 'jshint']);
-
- var ciTasks = [];
-
- ciTasks.push('compile');
- ciTasks.push('connect:tests');
-
- // Can't run Sauce Labs tests in pull requests
- if (process.env.TRAVIS_PULL_REQUEST == 'false') {
- ciTasks.push('saucelabs-qunit');
- }
-
- ciTasks.push('qunit');
- ciTasks.push('jshint');
-
- grunt.registerTask('ci', ciTasks);
-
- grunt.registerTask('docs', ['symlink:docs', 'jekyll:serve']);
-
- grunt.registerTask('docs-release', ['default', 'clean:docs', 'gh-pages']);
+ grunt.registerTask('lint', ['jshint']);
+ grunt.registerTask('test', ['connect:tests', 'qunit']);
};
diff --git a/htdocs/includes/jquery/plugins/select2/README.md b/htdocs/includes/jquery/plugins/select2/README.md
index 6ee975d6ee0..a27484fa40c 100644
--- a/htdocs/includes/jquery/plugins/select2/README.md
+++ b/htdocs/includes/jquery/plugins/select2/README.md
@@ -1,6 +1,8 @@
Select2
=======
-[![Build Status][travis-ci-image]][travis-ci-status]
+![Build Status][github-actions-image]
+[](https://opencollective.com/select2) [][cdnjs]
+[][jsdelivr]
Select2 is a jQuery-based replacement for select boxes. It supports searching,
remote data sets, and pagination of results.
@@ -31,14 +33,10 @@ Browser compatibility
* Safari 3+
* Opera 10.6+
-Select2 is automatically tested on the following browsers.
-
-[![Sauce Labs Test Status][saucelabs-matrix]][saucelabs-status]
-
Usage
-----
-You can source Select2 directly from a CDN like [JSDliver][jsdelivr] or
-[CDNJS][cdnjs], [download it from this GitHub repo][releases], or use one of
+You can source Select2 directly from a CDN like [jsDelivr][jsdelivr] or
+[cdnjs][cdnjs], [download it from this GitHub repo][releases], or use one of
the integrations below.
Integrations
@@ -51,14 +49,17 @@ Plugins
- [django-autocomplete-light]
- [django-easy-select2]
- [django-select2]
+* [Drupal] - [drupal-select2]
* [Meteor] - [meteor-select2]
* [Ruby on Rails][ruby-on-rails] - [select2-rails]
* [Wicket] - [wicketstuff-select2]
* [Yii 2][yii2] - [yii2-widget-select2]
+* [Angularjs][angularjs] - [mdr-angular-select2]
Themes
- [Bootstrap 3][bootstrap3] - [select2-bootstrap-theme]
+- [Bootstrap 4][bootstrap4] - [select2-bootstrap4-theme]
- [Flat UI][flat-ui] - [select2-flat-theme]
- [Metro UI][metro-ui] - [select2-metro]
@@ -76,8 +77,8 @@ make a pull request back to Select2 here on GitHub.
Documentation
-------------
The documentation for Select2 is available
-[through GitHub Pages][documentation] and is located within this repository
-in the [`docs` folder][documentation-folder].
+[online at the documentation website][documentation] and is located within the
+[`docs` directory of this repository][documentation-directory].
Community
---------
@@ -91,28 +92,31 @@ The license is available within the repository in the [LICENSE][license] file.
[cdnjs]: http://www.cdnjs.com/libraries/select2
[community]: https://select2.org/getting-help
[documentation]: https://select2.org
-[documentation-folder]: https://github.com/select2/select2/tree/master/docs
+[documentation-directory]: https://github.com/select2/select2/tree/develop/docs
[freenode]: https://freenode.net/
-[jsdelivr]: http://www.jsdelivr.com/#!select2
+[github-actions-image]: https://github.com/select2/select2/workflows/CI/badge.svg
+[jsdelivr]: https://www.jsdelivr.com/package/npm/select2
[license]: LICENSE.md
[releases]: https://github.com/select2/select2/releases
-[saucelabs-matrix]: https://saucelabs.com/browser-matrix/select2.svg
-[saucelabs-status]: https://saucelabs.com/u/select2
-[travis-ci-image]: https://img.shields.io/travis/select2/select2/master.svg
-[travis-ci-status]: https://travis-ci.org/select2/select2
+[angularjs]: https://angularjs.org/
[bootstrap3]: https://getbootstrap.com/
+[bootstrap4]: https://getbootstrap.com/
[django]: https://www.djangoproject.com/
[django-autocomplete-light]: https://github.com/yourlabs/django-autocomplete-light
[django-easy-select2]: https://github.com/asyncee/django-easy-select2
[django-select2]: https://github.com/applegrew/django-select2
+[drupal]: https://www.drupal.org/
+[drupal-select2]: https://www.drupal.org/project/select2
[flat-ui]: http://designmodo.github.io/Flat-UI/
+[mdr-angular-select2]: https://github.com/modulr/mdr-angular-select2
[meteor]: https://www.meteor.com/
[meteor-select2]: https://github.com/nate-strauser/meteor-select2
[metro-ui]: http://metroui.org.ua/
[select2-metro]: http://metroui.org.ua/select2.html
[ruby-on-rails]: http://rubyonrails.org/
[select2-bootstrap-theme]: https://github.com/select2/select2-bootstrap-theme
+[select2-bootstrap4-theme]: https://github.com/ttskch/select2-bootstrap4-theme
[select2-flat-theme]: https://github.com/techhysahil/select2-Flat_Theme
[select2-rails]: https://github.com/argerim/select2-rails
[vue.js]: http://vuejs.org/
@@ -121,3 +125,33 @@ The license is available within the repository in the [LICENSE][license] file.
[wicketstuff-select2]: https://github.com/wicketstuff/core/tree/master/select2-parent
[yii2]: http://www.yiiframework.com/
[yii2-widget-select2]: https://github.com/kartik-v/yii2-widget-select2
+
+## Contributors
+
+### Code Contributors
+
+This project exists thanks to all the people who contribute. [[Contribute](.github/CONTRIBUTING.md)].
+
+
+### Financial Contributors
+
+Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/select2/contribute)]
+
+#### Individuals
+
+
+
+#### Organizations
+
+Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/select2/contribute)]
+
+
+
+
+
+
+
+
+
+
+
diff --git a/htdocs/includes/jquery/plugins/select2/component.json b/htdocs/includes/jquery/plugins/select2/component.json
index 078338b59d3..a8e74c52499 100644
--- a/htdocs/includes/jquery/plugins/select2/component.json
+++ b/htdocs/includes/jquery/plugins/select2/component.json
@@ -2,7 +2,7 @@
"name": "select2",
"repo": "select/select2",
"description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.",
- "version": "4.0.4",
+ "version": "4.0.13",
"demo": "https://select2.org/",
"keywords": [
"jquery"
diff --git a/htdocs/includes/jquery/plugins/select2/composer.json b/htdocs/includes/jquery/plugins/select2/composer.json
index 141f4e14155..5ef2db2b1db 100644
--- a/htdocs/includes/jquery/plugins/select2/composer.json
+++ b/htdocs/includes/jquery/plugins/select2/composer.json
@@ -4,9 +4,6 @@
"type": "component",
"homepage": "https://select2.org/",
"license": "MIT",
- "require": {
- "robloach/component-installer": "*"
- },
"extra": {
"component": {
"scripts": [
diff --git a/htdocs/includes/jquery/plugins/select2/dist/css/select2.css b/htdocs/includes/jquery/plugins/select2/dist/css/select2.css
index 447b2b86cc0..750b3207aeb 100644
--- a/htdocs/includes/jquery/plugins/select2/dist/css/select2.css
+++ b/htdocs/includes/jquery/plugins/select2/dist/css/select2.css
@@ -118,12 +118,14 @@
.select2-hidden-accessible {
border: 0 !important;
clip: rect(0 0 0 0) !important;
+ -webkit-clip-path: inset(50%) !important;
+ clip-path: inset(50%) !important;
height: 1px !important;
- margin: -1px !important;
overflow: hidden !important;
padding: 0 !important;
position: absolute !important;
- width: 1px !important; }
+ width: 1px !important;
+ white-space: nowrap !important; }
.select2-container--default .select2-selection--single {
background-color: #fff;
@@ -186,16 +188,13 @@
width: 100%; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
list-style: none; }
- .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
- color: #999;
- margin-top: 5px;
- float: left; }
.select2-container--default .select2-selection--multiple .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-top: 5px;
- margin-right: 10px; }
+ margin-right: 10px;
+ padding: 1px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4;
border: 1px solid #aaa;
@@ -214,7 +213,7 @@
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #333; }
-.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
+.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
float: right; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
@@ -420,9 +419,7 @@
color: #555; }
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
- float: right; }
-
-.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
+ float: right;
margin-left: 5px;
margin-right: auto; }
diff --git a/htdocs/includes/jquery/plugins/select2/dist/css/select2.min.css b/htdocs/includes/jquery/plugins/select2/dist/css/select2.min.css
index 76de04d9233..7c18ad59dfc 100644
--- a/htdocs/includes/jquery/plugins/select2/dist/css/select2.min.css
+++ b/htdocs/includes/jquery/plugins/select2/dist/css/select2.min.css
@@ -1 +1 @@
-.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
+.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px;padding:1px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/af.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/af.js
new file mode 100644
index 00000000000..32e5ac7de89
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/af.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/af",[],function(){return{errorLoading:function(){return"Die resultate kon nie gelaai word nie."},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Verwyders asseblief "+n+" character";return 1!=n&&(r+="s"),r},inputTooShort:function(e){return"Voer asseblief "+(e.minimum-e.input.length)+" of meer karakters"},loadingMore:function(){return"Meer resultate word gelaai…"},maximumSelected:function(e){var n="Kies asseblief net "+e.maximum+" item";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"Geen resultate gevind"},searching:function(){return"Besig…"},removeAllItems:function(){return"Verwyder alle items"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ar.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ar.js
new file mode 100644
index 00000000000..64e1caad34d
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ar.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(n){return"الرجاء حذف "+(n.input.length-n.maximum)+" عناصر"},inputTooShort:function(n){return"الرجاء إضافة "+(n.minimum-n.input.length)+" عناصر"},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(n){return"تستطيع إختيار "+n.maximum+" بنود فقط"},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"},removeAllItems:function(){return"قم بإزالة كل العناصر"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/az.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/az.js
new file mode 100644
index 00000000000..1d52c260f29
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/az.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/az",[],function(){return{inputTooLong:function(n){return n.input.length-n.maximum+" simvol silin"},inputTooShort:function(n){return n.minimum-n.input.length+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(n){return"Sadəcə "+n.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"},removeAllItems:function(){return"Bütün elementləri sil"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/bg.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/bg.js
new file mode 100644
index 00000000000..73b730a705a
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/bg.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/bg",[],function(){return{inputTooLong:function(n){var e=n.input.length-n.maximum,u="Моля въведете с "+e+" по-малко символ";return e>1&&(u+="a"),u},inputTooShort:function(n){var e=n.minimum-n.input.length,u="Моля въведете още "+e+" символ";return e>1&&(u+="a"),u},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(n){var e="Можете да направите до "+n.maximum+" ";return n.maximum>1?e+="избора":e+="избор",e},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"},removeAllItems:function(){return"Премахнете всички елементи"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/bn.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/bn.js
new file mode 100644
index 00000000000..2d17b9d8e05
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/bn.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/bn",[],function(){return{errorLoading:function(){return"ফলাফলগুলি লোড করা যায়নি।"},inputTooLong:function(n){var e=n.input.length-n.maximum,u="অনুগ্রহ করে "+e+" টি অক্ষর মুছে দিন।";return 1!=e&&(u="অনুগ্রহ করে "+e+" টি অক্ষর মুছে দিন।"),u},inputTooShort:function(n){return n.minimum-n.input.length+" টি অক্ষর অথবা অধিক অক্ষর লিখুন।"},loadingMore:function(){return"আরো ফলাফল লোড হচ্ছে ..."},maximumSelected:function(n){var e=n.maximum+" টি আইটেম নির্বাচন করতে পারবেন।";return 1!=n.maximum&&(e=n.maximum+" টি আইটেম নির্বাচন করতে পারবেন।"),e},noResults:function(){return"কোন ফলাফল পাওয়া যায়নি।"},searching:function(){return"অনুসন্ধান করা হচ্ছে ..."}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/bs.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/bs.js
new file mode 100644
index 00000000000..46b084d7583
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/bs.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/bs",[],function(){function e(e,n,r,t){return e%10==1&&e%100!=11?n:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?r:t}return{errorLoading:function(){return"Preuzimanje nije uspijelo."},inputTooLong:function(n){var r=n.input.length-n.maximum,t="Obrišite "+r+" simbol";return t+=e(r,"","a","a")},inputTooShort:function(n){var r=n.minimum-n.input.length,t="Ukucajte bar još "+r+" simbol";return t+=e(r,"","a","a")},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(n){var r="Možete izabrati samo "+n.maximum+" stavk";return r+=e(n.maximum,"u","e","i")},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Uklonite sve stavke"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ca.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ca.js
new file mode 100644
index 00000000000..82dbbb7a212
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ca.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Si us plau, elimina "+n+" car";return r+=1==n?"àcter":"àcters"},inputTooShort:function(e){var n=e.minimum-e.input.length,r="Si us plau, introdueix "+n+" car";return r+=1==n?"àcter":"àcters"},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var n="Només es pot seleccionar "+e.maximum+" element";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"},removeAllItems:function(){return"Treu tots els elements"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/cs.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/cs.js
new file mode 100644
index 00000000000..7116d6c1dfd
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/cs.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/cs",[],function(){function e(e,n){switch(e){case 2:return n?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(n){var t=n.input.length-n.maximum;return 1==t?"Prosím, zadejte o jeden znak méně.":t<=4?"Prosím, zadejte o "+e(t,!0)+" znaky méně.":"Prosím, zadejte o "+t+" znaků méně."},inputTooShort:function(n){var t=n.minimum-n.input.length;return 1==t?"Prosím, zadejte ještě jeden znak.":t<=4?"Prosím, zadejte ještě další "+e(t,!0)+" znaky.":"Prosím, zadejte ještě dalších "+t+" znaků."},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(n){var t=n.maximum;return 1==t?"Můžete zvolit jen jednu položku.":t<=4?"Můžete zvolit maximálně "+e(t,!1)+" položky.":"Můžete zvolit maximálně "+t+" položek."},noResults:function(){return"Nenalezeny žádné položky."},searching:function(){return"Vyhledávání…"},removeAllItems:function(){return"Odstraňte všechny položky"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/da.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/da.js
new file mode 100644
index 00000000000..cda32c34aaa
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/da.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){return"Angiv venligst "+(e.input.length-e.maximum)+" tegn mindre"},inputTooShort:function(e){return"Angiv venligst "+(e.minimum-e.input.length)+" tegn mere"},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var n="Du kan kun vælge "+e.maximum+" emne";return 1!=e.maximum&&(n+="r"),n},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"},removeAllItems:function(){return"Fjern alle elementer"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/de.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/de.js
new file mode 100644
index 00000000000..c2e61e5800b
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/de.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/de",[],function(){return{errorLoading:function(){return"Die Ergebnisse konnten nicht geladen werden."},inputTooLong:function(e){return"Bitte "+(e.input.length-e.maximum)+" Zeichen weniger eingeben"},inputTooShort:function(e){return"Bitte "+(e.minimum-e.input.length)+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var n="Sie können nur "+e.maximum+" Element";return 1!=e.maximum&&(n+="e"),n+=" auswählen"},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"},removeAllItems:function(){return"Entferne alle Elemente"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/dsb.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/dsb.js
new file mode 100644
index 00000000000..02f283abada
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/dsb.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/dsb",[],function(){var n=["znamuško","znamušce","znamuška","znamuškow"],e=["zapisk","zapiska","zapiski","zapiskow"],u=function(n,e){return 1===n?e[0]:2===n?e[1]:n>2&&n<=4?e[2]:n>=5?e[3]:void 0};return{errorLoading:function(){return"Wuslědki njejsu se dali zacytaś."},inputTooLong:function(e){var a=e.input.length-e.maximum;return"Pšosym lašuj "+a+" "+u(a,n)},inputTooShort:function(e){var a=e.minimum-e.input.length;return"Pšosym zapódaj nanejmjenjej "+a+" "+u(a,n)},loadingMore:function(){return"Dalšne wuslědki se zacytaju…"},maximumSelected:function(n){return"Móžoš jano "+n.maximum+" "+u(n.maximum,e)+"wubraś."},noResults:function(){return"Žedne wuslědki namakane"},searching:function(){return"Pyta se…"},removeAllItems:function(){return"Remove all items"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/el.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/el.js
new file mode 100644
index 00000000000..d4922a1df5b
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/el.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(n){var e=n.input.length-n.maximum,u="Παρακαλώ διαγράψτε "+e+" χαρακτήρ";return 1==e&&(u+="α"),1!=e&&(u+="ες"),u},inputTooShort:function(n){return"Παρακαλώ συμπληρώστε "+(n.minimum-n.input.length)+" ή περισσότερους χαρακτήρες"},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(n){var e="Μπορείτε να επιλέξετε μόνο "+n.maximum+" επιλογ";return 1==n.maximum&&(e+="ή"),1!=n.maximum&&(e+="ές"),e},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"},removeAllItems:function(){return"Καταργήστε όλα τα στοιχεία"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/en.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/en.js
new file mode 100644
index 00000000000..3b192857342
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/en.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Please delete "+n+" character";return 1!=n&&(r+="s"),r},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var n="You can only select "+e.maximum+" item";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/es.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/es.js
new file mode 100644
index 00000000000..68afd6d2592
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/es.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"No se pudieron cargar los resultados"},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Por favor, elimine "+n+" car";return r+=1==n?"ácter":"acteres"},inputTooShort:function(e){var n=e.minimum-e.input.length,r="Por favor, introduzca "+n+" car";return r+=1==n?"ácter":"acteres"},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var n="Sólo puede seleccionar "+e.maximum+" elemento";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Eliminar todos los elementos"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/et.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/et.js
new file mode 100644
index 00000000000..070b61a26dd
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/et.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var n=e.input.length-e.maximum,t="Sisesta "+n+" täht";return 1!=n&&(t+="e"),t+=" vähem"},inputTooShort:function(e){var n=e.minimum-e.input.length,t="Sisesta "+n+" täht";return 1!=n&&(t+="e"),t+=" rohkem"},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var n="Saad vaid "+e.maximum+" tulemus";return 1==e.maximum?n+="e":n+="t",n+=" valida"},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"},removeAllItems:function(){return"Eemalda kõik esemed"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/eu.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/eu.js
new file mode 100644
index 00000000000..90d5e73f8a8
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/eu.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return n+=1==t?"karaktere bat":t+" karaktere",n+=" gutxiago"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return n+=1==t?"karaktere bat":t+" karaktere",n+=" gehiago"},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return 1===e.maximum?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"},removeAllItems:function(){return"Kendu elementu guztiak"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/fa.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/fa.js
new file mode 100644
index 00000000000..e1ffdbed0d8
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/fa.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(n){return"لطفاً "+(n.input.length-n.maximum)+" کاراکتر را حذف نمایید"},inputTooShort:function(n){return"لطفاً تعداد "+(n.minimum-n.input.length)+" کاراکتر یا بیشتر وارد نمایید"},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(n){return"شما تنها میتوانید "+n.maximum+" آیتم را انتخاب نمایید"},noResults:function(){return"هیچ نتیجهای یافت نشد"},searching:function(){return"در حال جستجو..."},removeAllItems:function(){return"همه موارد را حذف کنید"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/fi.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/fi.js
new file mode 100644
index 00000000000..ffed1247dd0
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/fi.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/fi",[],function(){return{errorLoading:function(){return"Tuloksia ei saatu ladattua."},inputTooLong:function(n){return"Ole hyvä ja anna "+(n.input.length-n.maximum)+" merkkiä vähemmän"},inputTooShort:function(n){return"Ole hyvä ja anna "+(n.minimum-n.input.length)+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(n){return"Voit valita ainoastaan "+n.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){return"Haetaan…"},removeAllItems:function(){return"Poista kaikki kohteet"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/fr.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/fr.js
new file mode 100644
index 00000000000..dd02f973ffa
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/fr.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var n=e.input.length-e.maximum;return"Supprimez "+n+" caractère"+(n>1?"s":"")},inputTooShort:function(e){var n=e.minimum-e.input.length;return"Saisissez au moins "+n+" caractère"+(n>1?"s":"")},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){return"Vous pouvez seulement sélectionner "+e.maximum+" élément"+(e.maximum>1?"s":"")},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"},removeAllItems:function(){return"Supprimer tous les éléments"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/gl.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/gl.js
new file mode 100644
index 00000000000..208a0057057
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/gl.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/gl",[],function(){return{errorLoading:function(){return"Non foi posíbel cargar os resultados."},inputTooLong:function(e){var n=e.input.length-e.maximum;return 1===n?"Elimine un carácter":"Elimine "+n+" caracteres"},inputTooShort:function(e){var n=e.minimum-e.input.length;return 1===n?"Engada un carácter":"Engada "+n+" caracteres"},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){return 1===e.maximum?"Só pode seleccionar un elemento":"Só pode seleccionar "+e.maximum+" elementos"},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Elimina todos os elementos"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/he.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/he.js
new file mode 100644
index 00000000000..25a8805aa02
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/he.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(n){var e=n.input.length-n.maximum,r="נא למחוק ";return r+=1===e?"תו אחד":e+" תווים"},inputTooShort:function(n){var e=n.minimum-n.input.length,r="נא להכניס ";return r+=1===e?"תו אחד":e+" תווים",r+=" או יותר"},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(n){var e="באפשרותך לבחור עד ";return 1===n.maximum?e+="פריט אחד":e+=n.maximum+" פריטים",e},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"},removeAllItems:function(){return"הסר את כל הפריטים"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hi.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hi.js
new file mode 100644
index 00000000000..f3ed798434b
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hi.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(n){var e=n.input.length-n.maximum,r=e+" अक्षर को हटा दें";return e>1&&(r=e+" अक्षरों को हटा दें "),r},inputTooShort:function(n){return"कृपया "+(n.minimum-n.input.length)+" या अधिक अक्षर दर्ज करें"},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(n){return"आप केवल "+n.maximum+" आइटम का चयन कर सकते हैं"},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."},removeAllItems:function(){return"सभी वस्तुओं को हटा दें"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hr.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hr.js
new file mode 100644
index 00000000000..cb3268db161
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hr.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hr",[],function(){function n(n){var e=" "+n+" znak";return n%10<5&&n%10>0&&(n%100<5||n%100>19)?n%10>1&&(e+="a"):e+="ova",e}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(e){return"Unesite "+n(e.input.length-e.maximum)},inputTooShort:function(e){return"Unesite još "+n(e.minimum-e.input.length)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(n){return"Maksimalan broj odabranih stavki je "+n.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Ukloni sve stavke"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hsb.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hsb.js
new file mode 100644
index 00000000000..3d5bf09dbd5
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hsb.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hsb",[],function(){var n=["znamješko","znamješce","znamješka","znamješkow"],e=["zapisk","zapiskaj","zapiski","zapiskow"],u=function(n,e){return 1===n?e[0]:2===n?e[1]:n>2&&n<=4?e[2]:n>=5?e[3]:void 0};return{errorLoading:function(){return"Wuslědki njedachu so začitać."},inputTooLong:function(e){var a=e.input.length-e.maximum;return"Prošu zhašej "+a+" "+u(a,n)},inputTooShort:function(e){var a=e.minimum-e.input.length;return"Prošu zapodaj znajmjeńša "+a+" "+u(a,n)},loadingMore:function(){return"Dalše wuslědki so začitaja…"},maximumSelected:function(n){return"Móžeš jenož "+n.maximum+" "+u(n.maximum,e)+"wubrać"},noResults:function(){return"Žane wuslědki namakane"},searching:function(){return"Pyta so…"},removeAllItems:function(){return"Remove all items"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hu.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hu.js
new file mode 100644
index 00000000000..4893aa2f70d
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hu.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/hu",[],function(){return{errorLoading:function(){return"Az eredmények betöltése nem sikerült."},inputTooLong:function(e){return"Túl hosszú. "+(e.input.length-e.maximum)+" karakterrel több, mint kellene."},inputTooShort:function(e){return"Túl rövid. Még "+(e.minimum-e.input.length)+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"},removeAllItems:function(){return"Távolítson el minden elemet"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hy.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hy.js
new file mode 100644
index 00000000000..8230007141a
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/hy.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hy",[],function(){return{errorLoading:function(){return"Արդյունքները հնարավոր չէ բեռնել։"},inputTooLong:function(n){return"Խնդրում ենք հեռացնել "+(n.input.length-n.maximum)+" նշան"},inputTooShort:function(n){return"Խնդրում ենք մուտքագրել "+(n.minimum-n.input.length)+" կամ ավել նշաններ"},loadingMore:function(){return"Բեռնվում են նոր արդյունքներ․․․"},maximumSelected:function(n){return"Դուք կարող եք ընտրել առավելագույնը "+n.maximum+" կետ"},noResults:function(){return"Արդյունքներ չեն գտնվել"},searching:function(){return"Որոնում․․․"},removeAllItems:function(){return"Հեռացնել բոլոր տարրերը"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/id.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/id.js
new file mode 100644
index 00000000000..4a0b3bf009d
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/id.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(n){return"Hapuskan "+(n.input.length-n.maximum)+" huruf"},inputTooShort:function(n){return"Masukkan "+(n.minimum-n.input.length)+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(n){return"Anda hanya dapat memilih "+n.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"},removeAllItems:function(){return"Hapus semua item"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/is.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/is.js
new file mode 100644
index 00000000000..cca5bbecf02
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/is.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/is",[],function(){return{inputTooLong:function(n){var t=n.input.length-n.maximum,e="Vinsamlegast styttið texta um "+t+" staf";return t<=1?e:e+"i"},inputTooShort:function(n){var t=n.minimum-n.input.length,e="Vinsamlegast skrifið "+t+" staf";return t>1&&(e+="i"),e+=" í viðbót"},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(n){return"Þú getur aðeins valið "+n.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"},removeAllItems:function(){return"Fjarlægðu öll atriði"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/it.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/it.js
new file mode 100644
index 00000000000..507c7d9f293
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/it.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var n=e.input.length-e.maximum,t="Per favore cancella "+n+" caratter";return t+=1!==n?"i":"e"},inputTooShort:function(e){return"Per favore inserisci "+(e.minimum-e.input.length)+" o più caratteri"},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var n="Puoi selezionare solo "+e.maximum+" element";return 1!==e.maximum?n+="i":n+="o",n},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"},removeAllItems:function(){return"Rimuovi tutti gli oggetti"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ja.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ja.js
new file mode 100644
index 00000000000..451025e2c7d
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ja.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(n){return n.input.length-n.maximum+" 文字を削除してください"},inputTooShort:function(n){return"少なくとも "+(n.minimum-n.input.length)+" 文字を入力してください"},loadingMore:function(){return"読み込み中…"},maximumSelected:function(n){return n.maximum+" 件しか選択できません"},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"},removeAllItems:function(){return"すべてのアイテムを削除"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ka.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ka.js
new file mode 100644
index 00000000000..60c593b705d
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ka.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ka",[],function(){return{errorLoading:function(){return"მონაცემების ჩატვირთვა შეუძლებელია."},inputTooLong:function(n){return"გთხოვთ აკრიფეთ "+(n.input.length-n.maximum)+" სიმბოლოთი ნაკლები"},inputTooShort:function(n){return"გთხოვთ აკრიფეთ "+(n.minimum-n.input.length)+" სიმბოლო ან მეტი"},loadingMore:function(){return"მონაცემების ჩატვირთვა…"},maximumSelected:function(n){return"თქვენ შეგიძლიათ აირჩიოთ არაუმეტეს "+n.maximum+" ელემენტი"},noResults:function(){return"რეზულტატი არ მოიძებნა"},searching:function(){return"ძიება…"},removeAllItems:function(){return"ამოიღე ყველა ელემენტი"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/km.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/km.js
new file mode 100644
index 00000000000..4dca94f414e
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/km.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(n){return"សូមលុបចេញ "+(n.input.length-n.maximum)+" អក្សរ"},inputTooShort:function(n){return"សូមបញ្ចូល"+(n.minimum-n.input.length)+" អក្សរ រឺ ច្រើនជាងនេះ"},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(n){return"អ្នកអាចជ្រើសរើសបានតែ "+n.maximum+" ជម្រើសប៉ុណ្ណោះ"},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."},removeAllItems:function(){return"លុបធាតុទាំងអស់"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ko.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ko.js
new file mode 100644
index 00000000000..f2880fb0043
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ko.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(n){return"너무 깁니다. "+(n.input.length-n.maximum)+" 글자 지워주세요."},inputTooShort:function(n){return"너무 짧습니다. "+(n.minimum-n.input.length)+" 글자 더 입력해주세요."},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(n){return"최대 "+n.maximum+"개까지만 선택 가능합니다."},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"},removeAllItems:function(){return"모든 항목 삭제"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/lt.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/lt.js
new file mode 100644
index 00000000000..f6a42155ad8
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/lt.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/lt",[],function(){function n(n,e,i,t){return n%10==1&&(n%100<11||n%100>19)?e:n%10>=2&&n%10<=9&&(n%100<11||n%100>19)?i:t}return{inputTooLong:function(e){var i=e.input.length-e.maximum,t="Pašalinkite "+i+" simbol";return t+=n(i,"į","ius","ių")},inputTooShort:function(e){var i=e.minimum-e.input.length,t="Įrašykite dar "+i+" simbol";return t+=n(i,"į","ius","ių")},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(e){var i="Jūs galite pasirinkti tik "+e.maximum+" element";return i+=n(e.maximum,"ą","us","ų")},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"},removeAllItems:function(){return"Pašalinti visus elementus"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/lv.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/lv.js
new file mode 100644
index 00000000000..806dc5c4339
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/lv.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/lv",[],function(){function e(e,n,u,i){return 11===e?n:e%10==1?u:i}return{inputTooLong:function(n){var u=n.input.length-n.maximum,i="Lūdzu ievadiet par "+u;return(i+=" simbol"+e(u,"iem","u","iem"))+" mazāk"},inputTooShort:function(n){var u=n.minimum-n.input.length,i="Lūdzu ievadiet vēl "+u;return i+=" simbol"+e(u,"us","u","us")},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(n){var u="Jūs varat izvēlēties ne vairāk kā "+n.maximum;return u+=" element"+e(n.maximum,"us","u","us")},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"},removeAllItems:function(){return"Noņemt visus vienumus"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/mk.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/mk.js
new file mode 100644
index 00000000000..cb7b84a2634
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/mk.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/mk",[],function(){return{inputTooLong:function(n){var e=(n.input.length,n.maximum,"Ве молиме внесете "+n.maximum+" помалку карактер");return 1!==n.maximum&&(e+="и"),e},inputTooShort:function(n){var e=(n.minimum,n.input.length,"Ве молиме внесете уште "+n.maximum+" карактер");return 1!==n.maximum&&(e+="и"),e},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(n){var e="Можете да изберете само "+n.maximum+" ставк";return 1===n.maximum?e+="а":e+="и",e},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"},removeAllItems:function(){return"Отстрани ги сите предмети"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ms.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ms.js
new file mode 100644
index 00000000000..6bd7eaa3e02
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ms.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(n){return"Sila hapuskan "+(n.input.length-n.maximum)+" aksara"},inputTooShort:function(n){return"Sila masukkan "+(n.minimum-n.input.length)+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(n){return"Anda hanya boleh memilih "+n.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"},removeAllItems:function(){return"Keluarkan semua item"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/nb.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/nb.js
new file mode 100644
index 00000000000..25d89c68704
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/nb.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/nb",[],function(){return{errorLoading:function(){return"Kunne ikke hente resultater."},inputTooLong:function(e){return"Vennligst fjern "+(e.input.length-e.maximum)+" tegn"},inputTooShort:function(e){return"Vennligst skriv inn "+(e.minimum-e.input.length)+" tegn til"},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"},removeAllItems:function(){return"Fjern alle elementer"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ne.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ne.js
new file mode 100644
index 00000000000..1c39f672103
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ne.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ne",[],function(){return{errorLoading:function(){return"नतिजाहरु देखाउन सकिएन।"},inputTooLong:function(n){var e=n.input.length-n.maximum,u="कृपया "+e+" अक्षर मेटाउनुहोस्।";return 1!=e&&(u+="कृपया "+e+" अक्षरहरु मेटाउनुहोस्।"),u},inputTooShort:function(n){return"कृपया बाँकी रहेका "+(n.minimum-n.input.length)+" वा अरु धेरै अक्षरहरु भर्नुहोस्।"},loadingMore:function(){return"अरु नतिजाहरु भरिँदैछन् …"},maximumSelected:function(n){var e="तँपाई "+n.maximum+" वस्तु मात्र छान्न पाउँनुहुन्छ।";return 1!=n.maximum&&(e="तँपाई "+n.maximum+" वस्तुहरु मात्र छान्न पाउँनुहुन्छ।"),e},noResults:function(){return"कुनै पनि नतिजा भेटिएन।"},searching:function(){return"खोजि हुँदैछ…"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/nl.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/nl.js
new file mode 100644
index 00000000000..2b74058d237
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/nl.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){return"Gelieve "+(e.input.length-e.maximum)+" karakters te verwijderen"},inputTooShort:function(e){return"Gelieve "+(e.minimum-e.input.length)+" of meer karakters in te voeren"},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var n=1==e.maximum?"kan":"kunnen",r="Er "+n+" maar "+e.maximum+" item";return 1!=e.maximum&&(r+="s"),r+=" worden geselecteerd"},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"},removeAllItems:function(){return"Verwijder alle items"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/pl.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/pl.js
new file mode 100644
index 00000000000..4ca5748c386
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/pl.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/pl",[],function(){var n=["znak","znaki","znaków"],e=["element","elementy","elementów"],r=function(n,e){return 1===n?e[0]:n>1&&n<=4?e[1]:n>=5?e[2]:void 0};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Usuń "+t+" "+r(t,n)},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Podaj przynajmniej "+t+" "+r(t,n)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(n){return"Możesz zaznaczyć tylko "+n.maximum+" "+r(n.maximum,e)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"},removeAllItems:function(){return"Usuń wszystkie przedmioty"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ps.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ps.js
new file mode 100644
index 00000000000..9b008e4c145
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ps.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ps",[],function(){return{errorLoading:function(){return"پايلي نه سي ترلاسه کېدای"},inputTooLong:function(n){var e=n.input.length-n.maximum,r="د مهربانۍ لمخي "+e+" توری ړنګ کړئ";return 1!=e&&(r=r.replace("توری","توري")),r},inputTooShort:function(n){return"لږ تر لږه "+(n.minimum-n.input.length)+" يا ډېر توري وليکئ"},loadingMore:function(){return"نوري پايلي ترلاسه کيږي..."},maximumSelected:function(n){var e="تاسو يوازي "+n.maximum+" قلم په نښه کولای سی";return 1!=n.maximum&&(e=e.replace("قلم","قلمونه")),e},noResults:function(){return"پايلي و نه موندل سوې"},searching:function(){return"لټول کيږي..."},removeAllItems:function(){return"ټول توکي لرې کړئ"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/pt-BR.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/pt-BR.js
new file mode 100644
index 00000000000..c991e2550ae
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/pt-BR.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Apague "+n+" caracter";return 1!=n&&(r+="es"),r},inputTooShort:function(e){return"Digite "+(e.minimum-e.input.length)+" ou mais caracteres"},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var n="Você só pode selecionar "+e.maximum+" ite";return 1==e.maximum?n+="m":n+="ns",n},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Remover todos os itens"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/pt.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/pt.js
new file mode 100644
index 00000000000..b5da1a6b496
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/pt.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var r=e.input.length-e.maximum,n="Por favor apague "+r+" ";return n+=1!=r?"caracteres":"caractere"},inputTooShort:function(e){return"Introduza "+(e.minimum-e.input.length)+" ou mais caracteres"},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var r="Apenas pode seleccionar "+e.maximum+" ";return r+=1!=e.maximum?"itens":"item"},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"},removeAllItems:function(){return"Remover todos os itens"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ro.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ro.js
new file mode 100644
index 00000000000..1ba7b40bef7
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ro.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/ro",[],function(){return{errorLoading:function(){return"Rezultatele nu au putut fi incărcate."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să ștergeți"+t+" caracter";return 1!==t&&(n+="e"),n},inputTooShort:function(e){return"Vă rugăm să introduceți "+(e.minimum-e.input.length)+" sau mai multe caractere"},loadingMore:function(){return"Se încarcă mai multe rezultate…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",1!==e.maximum&&(t+="e"),t},noResults:function(){return"Nu au fost găsite rezultate"},searching:function(){return"Căutare…"},removeAllItems:function(){return"Eliminați toate elementele"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ru.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ru.js
new file mode 100644
index 00000000000..63a7d66c3b4
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/ru.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ru",[],function(){function n(n,e,r,u){return n%10<5&&n%10>0&&n%100<5||n%100>20?n%10>1?r:e:u}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(e){var r=e.input.length-e.maximum,u="Пожалуйста, введите на "+r+" символ";return u+=n(r,"","a","ов"),u+=" меньше"},inputTooShort:function(e){var r=e.minimum-e.input.length,u="Пожалуйста, введите ещё хотя бы "+r+" символ";return u+=n(r,"","a","ов")},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(e){var r="Вы можете выбрать не более "+e.maximum+" элемент";return r+=n(e.maximum,"","a","ов")},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"},removeAllItems:function(){return"Удалить все элементы"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sk.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sk.js
new file mode 100644
index 00000000000..5049528ad0d
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sk.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{errorLoading:function(){return"Výsledky sa nepodarilo načítať."},inputTooLong:function(n){var t=n.input.length-n.maximum;return 1==t?"Prosím, zadajte o jeden znak menej":t>=2&&t<=4?"Prosím, zadajte o "+e[t](!0)+" znaky menej":"Prosím, zadajte o "+t+" znakov menej"},inputTooShort:function(n){var t=n.minimum-n.input.length;return 1==t?"Prosím, zadajte ešte jeden znak":t<=4?"Prosím, zadajte ešte ďalšie "+e[t](!0)+" znaky":"Prosím, zadajte ešte ďalších "+t+" znakov"},loadingMore:function(){return"Načítanie ďalších výsledkov…"},maximumSelected:function(n){return 1==n.maximum?"Môžete zvoliť len jednu položku":n.maximum>=2&&n.maximum<=4?"Môžete zvoliť najviac "+e[n.maximum](!1)+" položky":"Môžete zvoliť najviac "+n.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"},removeAllItems:function(){return"Odstráňte všetky položky"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sl.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sl.js
new file mode 100644
index 00000000000..4d0b7d3e345
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sl.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/sl",[],function(){return{errorLoading:function(){return"Zadetkov iskanja ni bilo mogoče naložiti."},inputTooLong:function(e){var n=e.input.length-e.maximum,t="Prosim zbrišite "+n+" znak";return 2==n?t+="a":1!=n&&(t+="e"),t},inputTooShort:function(e){var n=e.minimum-e.input.length,t="Prosim vpišite še "+n+" znak";return 2==n?t+="a":1!=n&&(t+="e"),t},loadingMore:function(){return"Nalagam več zadetkov…"},maximumSelected:function(e){var n="Označite lahko največ "+e.maximum+" predmet";return 2==e.maximum?n+="a":1!=e.maximum&&(n+="e"),n},noResults:function(){return"Ni zadetkov."},searching:function(){return"Iščem…"},removeAllItems:function(){return"Odstranite vse elemente"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sq.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sq.js
new file mode 100644
index 00000000000..59162024ed3
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sq.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/sq",[],function(){return{errorLoading:function(){return"Rezultatet nuk mund të ngarkoheshin."},inputTooLong:function(e){var n=e.input.length-e.maximum,t="Të lutem fshi "+n+" karakter";return 1!=n&&(t+="e"),t},inputTooShort:function(e){return"Të lutem shkruaj "+(e.minimum-e.input.length)+" ose më shumë karaktere"},loadingMore:function(){return"Duke ngarkuar më shumë rezultate…"},maximumSelected:function(e){var n="Mund të zgjedhësh vetëm "+e.maximum+" element";return 1!=e.maximum&&(n+="e"),n},noResults:function(){return"Nuk u gjet asnjë rezultat"},searching:function(){return"Duke kërkuar…"},removeAllItems:function(){return"Hiq të gjitha sendet"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sr-Cyrl.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sr-Cyrl.js
new file mode 100644
index 00000000000..ce13ce8f9a1
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sr-Cyrl.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/sr-Cyrl",[],function(){function n(n,e,r,u){return n%10==1&&n%100!=11?e:n%10>=2&&n%10<=4&&(n%100<12||n%100>14)?r:u}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(e){var r=e.input.length-e.maximum,u="Обришите "+r+" симбол";return u+=n(r,"","а","а")},inputTooShort:function(e){var r=e.minimum-e.input.length,u="Укуцајте бар још "+r+" симбол";return u+=n(r,"","а","а")},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(e){var r="Можете изабрати само "+e.maximum+" ставк";return r+=n(e.maximum,"у","е","и")},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"},removeAllItems:function(){return"Уклоните све ставке"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sr.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sr.js
new file mode 100644
index 00000000000..dd407a06dc4
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sr.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/sr",[],function(){function n(n,e,r,t){return n%10==1&&n%100!=11?e:n%10>=2&&n%10<=4&&(n%100<12||n%100>14)?r:t}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(e){var r=e.input.length-e.maximum,t="Obrišite "+r+" simbol";return t+=n(r,"","a","a")},inputTooShort:function(e){var r=e.minimum-e.input.length,t="Ukucajte bar još "+r+" simbol";return t+=n(r,"","a","a")},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(e){var r="Možete izabrati samo "+e.maximum+" stavk";return r+=n(e.maximum,"u","e","i")},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Уклоните све ставке"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sv.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sv.js
new file mode 100644
index 00000000000..1bc8724a79a
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/sv.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(n){return"Vänligen sudda ut "+(n.input.length-n.maximum)+" tecken"},inputTooShort:function(n){return"Vänligen skriv in "+(n.minimum-n.input.length)+" eller fler tecken"},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(n){return"Du kan max välja "+n.maximum+" element"},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"},removeAllItems:function(){return"Ta bort alla objekt"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/th.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/th.js
new file mode 100644
index 00000000000..63eab7114b0
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/th.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/th",[],function(){return{errorLoading:function(){return"ไม่สามารถค้นข้อมูลได้"},inputTooLong:function(n){return"โปรดลบออก "+(n.input.length-n.maximum)+" ตัวอักษร"},inputTooShort:function(n){return"โปรดพิมพ์เพิ่มอีก "+(n.minimum-n.input.length)+" ตัวอักษร"},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(n){return"คุณสามารถเลือกได้ไม่เกิน "+n.maximum+" รายการ"},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"},removeAllItems:function(){return"ลบรายการทั้งหมด"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/tk.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/tk.js
new file mode 100644
index 00000000000..30255ff3777
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/tk.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/tk",[],function(){return{errorLoading:function(){return"Netije ýüklenmedi."},inputTooLong:function(e){return e.input.length-e.maximum+" harp bozuň."},inputTooShort:function(e){return"Ýene-de iň az "+(e.minimum-e.input.length)+" harp ýazyň."},loadingMore:function(){return"Köpräk netije görkezilýär…"},maximumSelected:function(e){return"Diňe "+e.maximum+" sanysyny saýlaň."},noResults:function(){return"Netije tapylmady."},searching:function(){return"Gözlenýär…"},removeAllItems:function(){return"Remove all items"}}}),e.define,e.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/tr.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/tr.js
new file mode 100644
index 00000000000..fc4c0bf0512
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/tr.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/tr",[],function(){return{errorLoading:function(){return"Sonuç yüklenemedi"},inputTooLong:function(n){return n.input.length-n.maximum+" karakter daha girmelisiniz"},inputTooShort:function(n){return"En az "+(n.minimum-n.input.length)+" karakter daha girmelisiniz"},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(n){return"Sadece "+n.maximum+" seçim yapabilirsiniz"},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"},removeAllItems:function(){return"Tüm öğeleri kaldır"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/uk.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/uk.js
new file mode 100644
index 00000000000..63697e38849
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/uk.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/uk",[],function(){function n(n,e,u,r){return n%100>10&&n%100<15?r:n%10==1?e:n%10>1&&n%10<5?u:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(e){return"Будь ласка, видаліть "+(e.input.length-e.maximum)+" "+n(e.maximum,"літеру","літери","літер")},inputTooShort:function(n){return"Будь ласка, введіть "+(n.minimum-n.input.length)+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(e){return"Ви можете вибрати лише "+e.maximum+" "+n(e.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"},removeAllItems:function(){return"Видалити всі елементи"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/vi.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/vi.js
new file mode 100644
index 00000000000..24f3bc2d61a
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/vi.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/vi",[],function(){return{inputTooLong:function(n){return"Vui lòng xóa bớt "+(n.input.length-n.maximum)+" ký tự"},inputTooShort:function(n){return"Vui lòng nhập thêm từ "+(n.minimum-n.input.length)+" ký tự trở lên"},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(n){return"Chỉ có thể chọn được "+n.maximum+" lựa chọn"},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"},removeAllItems:function(){return"Xóa tất cả các mục"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/zh-CN.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/zh-CN.js
new file mode 100644
index 00000000000..2c5649d3108
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/zh-CN.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(n){return"请删除"+(n.input.length-n.maximum)+"个字符"},inputTooShort:function(n){return"请再输入至少"+(n.minimum-n.input.length)+"个字符"},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(n){return"最多只能选择"+n.maximum+"个项目"},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"},removeAllItems:function(){return"删除所有项目"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/i18n/zh-TW.js b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/zh-TW.js
new file mode 100644
index 00000000000..570a5669374
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/i18n/zh-TW.js
@@ -0,0 +1,3 @@
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+
+!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(n){return"請刪掉"+(n.input.length-n.maximum)+"個字元"},inputTooShort:function(n){return"請再輸入"+(n.minimum-n.input.length)+"個字元"},loadingMore:function(){return"載入中…"},maximumSelected:function(n){return"你只能選擇最多"+n.maximum+"項"},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"},removeAllItems:function(){return"刪除所有項目"}}}),n.define,n.require}();
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/select2.full.js b/htdocs/includes/jquery/plugins/select2/dist/js/select2.full.js
index 608642bf64e..358572a6576 100644
--- a/htdocs/includes/jquery/plugins/select2/dist/js/select2.full.js
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/select2.full.js
@@ -1,11 +1,11 @@
/*!
- * Select2 4.0.5
+ * Select2 4.0.13
* https://select2.github.io
*
* Released under the MIT license
* https://github.com/select2/select2/blob/master/LICENSE.md
*/
-(function (factory) {
+;(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
@@ -574,10 +574,10 @@ S2.define('select2/utils',[
DecoratedClass.prototype = new ctr();
for (var m = 0; m < superMethods.length; m++) {
- var superMethod = superMethods[m];
+ var superMethod = superMethods[m];
- DecoratedClass.prototype[superMethod] =
- SuperClass.prototype[superMethod];
+ DecoratedClass.prototype[superMethod] =
+ SuperClass.prototype[superMethod];
}
var calledMethod = function (methodName) {
@@ -772,6 +772,70 @@ S2.define('select2/utils',[
$element.append($nodes);
};
+ // Cache objects in Utils.__cache instead of $.data (see #4346)
+ Utils.__cache = {};
+
+ var id = 0;
+ Utils.GetUniqueElementId = function (element) {
+ // Get a unique element Id. If element has no id,
+ // creates a new unique number, stores it in the id
+ // attribute and returns the new id.
+ // If an id already exists, it simply returns it.
+
+ var select2Id = element.getAttribute('data-select2-id');
+ if (select2Id == null) {
+ // If element has id, use it.
+ if (element.id) {
+ select2Id = element.id;
+ element.setAttribute('data-select2-id', select2Id);
+ } else {
+ element.setAttribute('data-select2-id', ++id);
+ select2Id = id.toString();
+ }
+ }
+ return select2Id;
+ };
+
+ Utils.StoreData = function (element, name, value) {
+ // Stores an item in the cache for a specified element.
+ // name is the cache key.
+ var id = Utils.GetUniqueElementId(element);
+ if (!Utils.__cache[id]) {
+ Utils.__cache[id] = {};
+ }
+
+ Utils.__cache[id][name] = value;
+ };
+
+ Utils.GetData = function (element, name) {
+ // Retrieves a value from the cache by its key (name)
+ // name is optional. If no name specified, return
+ // all cache items for the specified element.
+ // and for a specified element.
+ var id = Utils.GetUniqueElementId(element);
+ if (name) {
+ if (Utils.__cache[id]) {
+ if (Utils.__cache[id][name] != null) {
+ return Utils.__cache[id][name];
+ }
+ return $(element).data(name); // Fallback to HTML5 data attribs.
+ }
+ return $(element).data(name); // Fallback to HTML5 data attribs.
+ } else {
+ return Utils.__cache[id];
+ }
+ };
+
+ Utils.RemoveData = function (element) {
+ // Removes all cached items for a specified element.
+ var id = Utils.GetUniqueElementId(element);
+ if (Utils.__cache[id] != null) {
+ delete Utils.__cache[id];
+ }
+
+ element.removeAttribute('data-select2-id');
+ };
+
return Utils;
});
@@ -791,7 +855,7 @@ S2.define('select2/results',[
Results.prototype.render = function () {
var $results = $(
- ''
+ ''
);
if (this.options.get('multiple')) {
@@ -814,7 +878,7 @@ S2.define('select2/results',[
this.hideLoading();
var $message = $(
- ' '
);
@@ -907,7 +971,7 @@ S2.define('select2/results',[
$options.each(function () {
var $option = $(this);
- var item = $.data(this, 'data');
+ var item = Utils.GetData(this, 'data');
// id needs to be converted to a string when comparing
var id = '' + item.id;
@@ -948,11 +1012,16 @@ S2.define('select2/results',[
option.className = 'select2-results__option';
var attrs = {
- 'role': 'treeitem',
+ 'role': 'option',
'aria-selected': 'false'
};
- if (data.disabled) {
+ var matches = window.Element.prototype.matches ||
+ window.Element.prototype.msMatchesSelector ||
+ window.Element.prototype.webkitMatchesSelector;
+
+ if ((data.element != null && matches.call(data.element, ':disabled')) ||
+ (data.element == null && data.disabled)) {
delete attrs['aria-selected'];
attrs['aria-disabled'] = 'true';
}
@@ -1012,7 +1081,7 @@ S2.define('select2/results',[
this.template(data, option);
}
- $.data(option, 'data', data);
+ Utils.StoreData(option, 'data', data);
return option;
};
@@ -1053,7 +1122,10 @@ S2.define('select2/results',[
}
self.setClasses();
- self.highlightFirstItem();
+
+ if (self.options.get('scrollAfterSelect')) {
+ self.highlightFirstItem();
+ }
});
container.on('unselect', function () {
@@ -1062,7 +1134,10 @@ S2.define('select2/results',[
}
self.setClasses();
- self.highlightFirstItem();
+
+ if (self.options.get('scrollAfterSelect')) {
+ self.highlightFirstItem();
+ }
});
container.on('open', function () {
@@ -1098,7 +1173,7 @@ S2.define('select2/results',[
return;
}
- var data = $highlighted.data('data');
+ var data = Utils.GetData($highlighted[0], 'data');
if ($highlighted.attr('aria-selected') == 'true') {
self.trigger('close', {});
@@ -1116,8 +1191,9 @@ S2.define('select2/results',[
var currentIndex = $options.index($highlighted);
- // If we are already at te top, don't move further
- if (currentIndex === 0) {
+ // If we are already at the top, don't move further
+ // If no options, currentIndex will be -1
+ if (currentIndex <= 0) {
return;
}
@@ -1210,7 +1286,7 @@ S2.define('select2/results',[
function (evt) {
var $this = $(this);
- var data = $this.data('data');
+ var data = Utils.GetData(this, 'data');
if ($this.attr('aria-selected') === 'true') {
if (self.options.get('multiple')) {
@@ -1233,7 +1309,7 @@ S2.define('select2/results',[
this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
function (evt) {
- var data = $(this).data('data');
+ var data = Utils.GetData(this, 'data');
self.getHighlightedResults()
.removeClass('select2-results__option--highlighted');
@@ -1348,14 +1424,15 @@ S2.define('select2/selection/base',[
this._tabindex = 0;
- if (this.$element.data('old-tabindex') != null) {
- this._tabindex = this.$element.data('old-tabindex');
+ if (Utils.GetData(this.$element[0], 'old-tabindex') != null) {
+ this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex');
} else if (this.$element.attr('tabindex') != null) {
this._tabindex = this.$element.attr('tabindex');
}
$selection.attr('title', this.$element.attr('title'));
$selection.attr('tabindex', this._tabindex);
+ $selection.attr('aria-disabled', 'false');
this.$selection = $selection;
@@ -1365,7 +1442,6 @@ S2.define('select2/selection/base',[
BaseSelection.prototype.bind = function (container, $container) {
var self = this;
- var id = container.id + '-container';
var resultsId = container.id + '-results';
this.container = container;
@@ -1408,17 +1484,19 @@ S2.define('select2/selection/base',[
self.$selection.removeAttr('aria-activedescendant');
self.$selection.removeAttr('aria-owns');
- self.$selection.focus();
+ self.$selection.trigger('focus');
self._detachCloseHandler(container);
});
container.on('enable', function () {
self.$selection.attr('tabindex', self._tabindex);
+ self.$selection.attr('aria-disabled', 'false');
});
container.on('disable', function () {
self.$selection.attr('tabindex', '-1');
+ self.$selection.attr('aria-disabled', 'true');
});
};
@@ -1441,7 +1519,6 @@ S2.define('select2/selection/base',[
};
BaseSelection.prototype._attachCloseHandler = function (container) {
- var self = this;
$(document.body).on('mousedown.select2.' + container.id, function (e) {
var $target = $(e.target);
@@ -1451,13 +1528,11 @@ S2.define('select2/selection/base',[
var $all = $('.select2.select2-container--open');
$all.each(function () {
- var $this = $(this);
-
if (this == $select[0]) {
return;
}
- var $element = $this.data('element');
+ var $element = Utils.GetData(this, 'element');
$element.select2('close');
});
@@ -1481,6 +1556,27 @@ S2.define('select2/selection/base',[
throw new Error('The `update` method must be defined in child classes.');
};
+ /**
+ * Helper method to abstract the "enabled" (not "disabled") state of this
+ * object.
+ *
+ * @return {true} if the instance is not disabled.
+ * @return {false} if the instance is disabled.
+ */
+ BaseSelection.prototype.isEnabled = function () {
+ return !this.isDisabled();
+ };
+
+ /**
+ * Helper method to abstract the "disabled" state of this object.
+ *
+ * @return {true} if the disabled option is true.
+ * @return {false} if the disabled option is false.
+ */
+ BaseSelection.prototype.isDisabled = function () {
+ return this.options.get('disabled');
+ };
+
return BaseSelection;
});
@@ -1518,7 +1614,10 @@ S2.define('select2/selection/single',[
var id = container.id + '-container';
- this.$selection.find('.select2-selection__rendered').attr('id', id);
+ this.$selection.find('.select2-selection__rendered')
+ .attr('id', id)
+ .attr('role', 'textbox')
+ .attr('aria-readonly', 'true');
this.$selection.attr('aria-labelledby', id);
this.$selection.on('mousedown', function (evt) {
@@ -1542,17 +1641,15 @@ S2.define('select2/selection/single',[
container.on('focus', function (evt) {
if (!container.isOpen()) {
- self.$selection.focus();
+ self.$selection.trigger('focus');
}
});
-
- container.on('selection:update', function (params) {
- self.update(params.data);
- });
};
SingleSelection.prototype.clear = function () {
- this.$selection.find('.select2-selection__rendered').empty();
+ var $rendered = this.$selection.find('.select2-selection__rendered');
+ $rendered.empty();
+ $rendered.removeAttr('title'); // clear tooltip on empty
};
SingleSelection.prototype.display = function (data, container) {
@@ -1578,7 +1675,14 @@ S2.define('select2/selection/single',[
var formatted = this.display(selection, $rendered);
$rendered.empty().append(formatted);
- $rendered.prop('title', selection.title || selection.text);
+
+ var title = selection.title || selection.text;
+
+ if (title) {
+ $rendered.attr('title', title);
+ } else {
+ $rendered.removeAttr('title');
+ }
};
return SingleSelection;
@@ -1623,14 +1727,14 @@ S2.define('select2/selection/multiple',[
'.select2-selection__choice__remove',
function (evt) {
// Ignore the event if it is disabled
- if (self.options.get('disabled')) {
+ if (self.isDisabled()) {
return;
}
var $remove = $(this);
var $selection = $remove.parent();
- var data = $selection.data('data');
+ var data = Utils.GetData($selection[0], 'data');
self.trigger('unselect', {
originalEvent: evt,
@@ -1641,7 +1745,9 @@ S2.define('select2/selection/multiple',[
};
MultipleSelection.prototype.clear = function () {
- this.$selection.find('.select2-selection__rendered').empty();
+ var $rendered = this.$selection.find('.select2-selection__rendered');
+ $rendered.empty();
+ $rendered.removeAttr('title');
};
MultipleSelection.prototype.display = function (data, container) {
@@ -1679,9 +1785,14 @@ S2.define('select2/selection/multiple',[
var formatted = this.display(selection, $selection);
$selection.append(formatted);
- $selection.prop('title', selection.title || selection.text);
- $selection.data('data', selection);
+ var title = selection.title || selection.text;
+
+ if (title) {
+ $selection.attr('title', title);
+ }
+
+ Utils.StoreData($selection[0], 'data', selection);
$selections.push($selection);
}
@@ -1746,8 +1857,9 @@ S2.define('select2/selection/placeholder',[
S2.define('select2/selection/allowClear',[
'jquery',
- '../keys'
-], function ($, KEYS) {
+ '../keys',
+ '../utils'
+], function ($, KEYS, Utils) {
function AllowClear () { }
AllowClear.prototype.bind = function (decorated, container, $container) {
@@ -1776,7 +1888,7 @@ S2.define('select2/selection/allowClear',[
AllowClear.prototype._handleClear = function (_, evt) {
// Ignore the event if it is disabled
- if (this.options.get('disabled')) {
+ if (this.isDisabled()) {
return;
}
@@ -1789,10 +1901,22 @@ S2.define('select2/selection/allowClear',[
evt.stopPropagation();
- var data = $clear.data('data');
+ var data = Utils.GetData($clear[0], 'data');
+
+ var previousVal = this.$element.val();
+ this.$element.val(this.placeholder.id);
+
+ var unselectData = {
+ data: data
+ };
+ this.trigger('clear', unselectData);
+ if (unselectData.prevented) {
+ this.$element.val(previousVal);
+ return;
+ }
for (var d = 0; d < data.length; d++) {
- var unselectData = {
+ unselectData = {
data: data[d]
};
@@ -1802,11 +1926,12 @@ S2.define('select2/selection/allowClear',[
// If the event was prevented, don't clear it out.
if (unselectData.prevented) {
+ this.$element.val(previousVal);
return;
}
}
- this.$element.val(this.placeholder.id).trigger('change');
+ this.$element.trigger('input').trigger('change');
this.trigger('toggle', {});
};
@@ -1829,12 +1954,14 @@ S2.define('select2/selection/allowClear',[
return;
}
+ var removeAll = this.options.get('translations').get('removeAllItems');
+
var $remove = $(
- '' +
+ '' +
'×' +
' '
);
- $remove.data('data', data);
+ Utils.StoreData($remove[0], 'data', data);
this.$selection.find('.select2-selection__rendered').prepend($remove);
};
@@ -1856,7 +1983,7 @@ S2.define('select2/selection/search',[
'' +
' ' +
+ ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' +
' '
);
@@ -1873,14 +2000,18 @@ S2.define('select2/selection/search',[
Search.prototype.bind = function (decorated, container, $container) {
var self = this;
+ var resultsId = container.id + '-results';
+
decorated.call(this, container, $container);
container.on('open', function () {
+ self.$search.attr('aria-controls', resultsId);
self.$search.trigger('focus');
});
container.on('close', function () {
self.$search.val('');
+ self.$search.removeAttr('aria-controls');
self.$search.removeAttr('aria-activedescendant');
self.$search.trigger('focus');
});
@@ -1900,7 +2031,11 @@ S2.define('select2/selection/search',[
});
container.on('results:focus', function (params) {
- self.$search.attr('aria-activedescendant', params.id);
+ if (params.data._resultId) {
+ self.$search.attr('aria-activedescendant', params.data._resultId);
+ } else {
+ self.$search.removeAttr('aria-activedescendant');
+ }
});
this.$selection.on('focusin', '.select2-search--inline', function (evt) {
@@ -1925,7 +2060,7 @@ S2.define('select2/selection/search',[
.prev('.select2-selection__choice');
if ($previousChoice.length > 0) {
- var item = $previousChoice.data('data');
+ var item = Utils.GetData($previousChoice[0], 'data');
self.searchRemoveChoice(item);
@@ -1934,6 +2069,12 @@ S2.define('select2/selection/search',[
}
});
+ this.$selection.on('click', '.select2-search--inline', function (evt) {
+ if (self.$search.val()) {
+ evt.stopPropagation();
+ }
+ });
+
// Try to detect the IE version should the `documentMode` property that
// is stored on the document. This is only implemented in IE and is
// slightly cleaner than doing a user agent check.
@@ -2019,7 +2160,7 @@ S2.define('select2/selection/search',[
this.resizeSearch();
if (searchHadFocus) {
- this.$search.focus();
+ this.$search.trigger('focus');
}
};
@@ -2052,7 +2193,7 @@ S2.define('select2/selection/search',[
var width = '';
if (this.$search.attr('placeholder') !== '') {
- width = this.$selection.find('.select2-selection__rendered').innerWidth();
+ width = this.$selection.find('.select2-selection__rendered').width();
} else {
var minimumWidth = this.$search.val().length + 1;
@@ -2076,10 +2217,13 @@ S2.define('select2/selection/eventRelay',[
'open', 'opening',
'close', 'closing',
'select', 'selecting',
- 'unselect', 'unselecting'
+ 'unselect', 'unselecting',
+ 'clear', 'clearing'
];
- var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
+ var preventableEvents = [
+ 'opening', 'closing', 'selecting', 'unselecting', 'clearing'
+ ];
decorated.call(this, container, $container);
@@ -2412,6 +2556,7 @@ S2.define('select2/diacritics',[
'\u019F': 'O',
'\uA74A': 'O',
'\uA74C': 'O',
+ '\u0152': 'OE',
'\u01A2': 'OI',
'\uA74E': 'OO',
'\u0222': 'OU',
@@ -2821,6 +2966,7 @@ S2.define('select2/diacritics',[
'\uA74B': 'o',
'\uA74D': 'o',
'\u0275': 'o',
+ '\u0153': 'oe',
'\u01A3': 'oi',
'\u0223': 'ou',
'\uA74F': 'oo',
@@ -2989,8 +3135,9 @@ S2.define('select2/diacritics',[
'\u03CD': '\u03C5',
'\u03CB': '\u03C5',
'\u03B0': '\u03C5',
- '\u03C9': '\u03C9',
- '\u03C2': '\u03C3'
+ '\u03CE': '\u03C9',
+ '\u03C2': '\u03C3',
+ '\u2019': '\''
};
return diacritics;
@@ -3075,7 +3222,7 @@ S2.define('select2/data/select',[
if ($(data.element).is('option')) {
data.element.selected = true;
- this.$element.trigger('change');
+ this.$element.trigger('input').trigger('change');
return;
}
@@ -3096,13 +3243,13 @@ S2.define('select2/data/select',[
}
self.$element.val(val);
- self.$element.trigger('change');
+ self.$element.trigger('input').trigger('change');
});
} else {
var val = data.id;
this.$element.val(val);
- this.$element.trigger('change');
+ this.$element.trigger('input').trigger('change');
}
};
@@ -3118,7 +3265,7 @@ S2.define('select2/data/select',[
if ($(data.element).is('option')) {
data.element.selected = false;
- this.$element.trigger('change');
+ this.$element.trigger('input').trigger('change');
return;
}
@@ -3136,7 +3283,7 @@ S2.define('select2/data/select',[
self.$element.val(val);
- self.$element.trigger('change');
+ self.$element.trigger('input').trigger('change');
});
};
@@ -3158,7 +3305,7 @@ S2.define('select2/data/select',[
// Remove anything added to child elements
this.$element.find('*').each(function () {
// Remove any custom data set by Select2
- $.removeData(this, 'data');
+ Utils.RemoveData(this);
});
};
@@ -3231,7 +3378,7 @@ S2.define('select2/data/select',[
normalizedData.element = option;
// Override the option's data with the combined data
- $.data(option, 'data', normalizedData);
+ Utils.StoreData(option, 'data', normalizedData);
return $option;
};
@@ -3239,7 +3386,7 @@ S2.define('select2/data/select',[
SelectAdapter.prototype.item = function ($option) {
var data = {};
- data = $.data($option[0], 'data');
+ data = Utils.GetData($option[0], 'data');
if (data != null) {
return data;
@@ -3277,13 +3424,13 @@ S2.define('select2/data/select',[
data = this._normalizeItem(data);
data.element = $option[0];
- $.data($option[0], 'data', data);
+ Utils.StoreData($option[0], 'data', data);
return data;
};
SelectAdapter.prototype._normalizeItem = function (item) {
- if (!$.isPlainObject(item)) {
+ if (item !== Object(item)) {
item = {
id: item,
text: item
@@ -3329,15 +3476,19 @@ S2.define('select2/data/array',[
'jquery'
], function (SelectAdapter, Utils, $) {
function ArrayAdapter ($element, options) {
- var data = options.get('data') || [];
+ this._dataToConvert = options.get('data') || [];
ArrayAdapter.__super__.constructor.call(this, $element, options);
-
- this.addOptions(this.convertToOptions(data));
}
Utils.Extend(ArrayAdapter, SelectAdapter);
+ ArrayAdapter.prototype.bind = function (container, $container) {
+ ArrayAdapter.__super__.bind.call(this, container, $container);
+
+ this.addOptions(this.convertToOptions(this._dataToConvert));
+ };
+
ArrayAdapter.prototype.select = function (data) {
var $option = this.$element.find('option').filter(function (i, elm) {
return elm.value == data.id.toString();
@@ -3487,7 +3638,8 @@ S2.define('select2/data/ajax',[
}, function () {
// Attempt to detect if a request was aborted
// Only works if the transport exposes a status property
- if ($request.status && $request.status === '0') {
+ if ('status' in $request &&
+ ($request.status === 0 || $request.status === '0')) {
return;
}
@@ -3626,8 +3778,6 @@ S2.define('select2/data/tags',[
};
Tags.prototype._removeOldTags = function (_) {
- var tag = this._lastTag;
-
var $options = this.$element.find('option[data-select2-tag]');
$options.each(function () {
@@ -3702,7 +3852,7 @@ S2.define('select2/data/tokenizer',[
// Replace the search term if we have the search box
if (this.$search.length) {
this.$search.val(tokenData.term);
- this.$search.focus();
+ this.$search.trigger('focus');
}
params.term = tokenData.term;
@@ -3831,10 +3981,30 @@ S2.define('select2/data/maximumSelectionLength',[
decorated.call(this, $e, options);
}
+ MaximumSelectionLength.prototype.bind =
+ function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ container.on('select', function () {
+ self._checkIfMaximumSelected();
+ });
+ };
+
MaximumSelectionLength.prototype.query =
function (decorated, params, callback) {
var self = this;
+ this._checkIfMaximumSelected(function () {
+ decorated.call(self, params, callback);
+ });
+ };
+
+ MaximumSelectionLength.prototype._checkIfMaximumSelected =
+ function (_, successCallback) {
+ var self = this;
+
this.current(function (currentData) {
var count = currentData != null ? currentData.length : 0;
if (self.maximumSelectionLength > 0 &&
@@ -3847,7 +4017,10 @@ S2.define('select2/data/maximumSelectionLength',[
});
return;
}
- decorated.call(self, params, callback);
+
+ if (successCallback) {
+ successCallback();
+ }
});
};
@@ -3886,7 +4059,7 @@ S2.define('select2/dropdown',[
};
Dropdown.prototype.position = function ($dropdown, $container) {
- // Should be implmented in subclasses
+ // Should be implemented in subclasses
};
Dropdown.prototype.destroy = function () {
@@ -3910,7 +4083,7 @@ S2.define('select2/dropdown/search',[
'' +
' ' +
+ ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' +
' '
);
@@ -3925,6 +4098,8 @@ S2.define('select2/dropdown/search',[
Search.prototype.bind = function (decorated, container, $container) {
var self = this;
+ var resultsId = container.id + '-results';
+
decorated.call(this, container, $container);
this.$search.on('keydown', function (evt) {
@@ -3947,23 +4122,27 @@ S2.define('select2/dropdown/search',[
container.on('open', function () {
self.$search.attr('tabindex', 0);
+ self.$search.attr('aria-controls', resultsId);
- self.$search.focus();
+ self.$search.trigger('focus');
window.setTimeout(function () {
- self.$search.focus();
+ self.$search.trigger('focus');
}, 0);
});
container.on('close', function () {
self.$search.attr('tabindex', -1);
+ self.$search.removeAttr('aria-controls');
+ self.$search.removeAttr('aria-activedescendant');
self.$search.val('');
+ self.$search.trigger('blur');
});
container.on('focus', function () {
if (!container.isOpen()) {
- self.$search.focus();
+ self.$search.trigger('focus');
}
});
@@ -3978,6 +4157,14 @@ S2.define('select2/dropdown/search',[
}
}
});
+
+ container.on('results:focus', function (params) {
+ if (params.data._resultId) {
+ self.$search.attr('aria-activedescendant', params.data._resultId);
+ } else {
+ self.$search.removeAttr('aria-activedescendant');
+ }
+ });
};
Search.prototype.handleSearch = function (evt) {
@@ -4062,6 +4249,7 @@ S2.define('select2/dropdown/infiniteScroll',[
if (this.showLoadingMore(data)) {
this.$results.append(this.$loadingMore);
+ this.loadMoreIfNeeded();
}
};
@@ -4080,25 +4268,27 @@ S2.define('select2/dropdown/infiniteScroll',[
self.loading = true;
});
- this.$results.on('scroll', function () {
- var isLoadMoreVisible = $.contains(
- document.documentElement,
- self.$loadingMore[0]
- );
+ this.$results.on('scroll', this.loadMoreIfNeeded.bind(this));
+ };
- if (self.loading || !isLoadMoreVisible) {
- return;
- }
+ InfiniteScroll.prototype.loadMoreIfNeeded = function () {
+ var isLoadMoreVisible = $.contains(
+ document.documentElement,
+ this.$loadingMore[0]
+ );
- var currentOffset = self.$results.offset().top +
- self.$results.outerHeight(false);
- var loadingMoreOffset = self.$loadingMore.offset().top +
- self.$loadingMore.outerHeight(false);
+ if (this.loading || !isLoadMoreVisible) {
+ return;
+ }
- if (currentOffset + 50 >= loadingMoreOffset) {
- self.loadMore();
- }
- });
+ var currentOffset = this.$results.offset().top +
+ this.$results.outerHeight(false);
+ var loadingMoreOffset = this.$loadingMore.offset().top +
+ this.$loadingMore.outerHeight(false);
+
+ if (currentOffset + 50 >= loadingMoreOffset) {
+ this.loadMore();
+ }
};
InfiniteScroll.prototype.loadMore = function () {
@@ -4119,7 +4309,7 @@ S2.define('select2/dropdown/infiniteScroll',[
var $option = $(
' '
+ 'role="option" aria-disabled="true">'
);
var message = this.options.get('translations').get('loadingMore');
@@ -4137,7 +4327,7 @@ S2.define('select2/dropdown/attachBody',[
'../utils'
], function ($, Utils) {
function AttachBody (decorated, $element, options) {
- this.$dropdownParent = options.get('dropdownParent') || $(document.body);
+ this.$dropdownParent = $(options.get('dropdownParent') || document.body);
decorated.call(this, $element, options);
}
@@ -4145,27 +4335,14 @@ S2.define('select2/dropdown/attachBody',[
AttachBody.prototype.bind = function (decorated, container, $container) {
var self = this;
- var setupResultsEvents = false;
-
decorated.call(this, container, $container);
container.on('open', function () {
self._showDropdown();
self._attachPositioningHandler(container);
- if (!setupResultsEvents) {
- setupResultsEvents = true;
-
- container.on('results:all', function () {
- self._positionDropdown();
- self._resizeDropdown();
- });
-
- container.on('results:append', function () {
- self._positionDropdown();
- self._resizeDropdown();
- });
- }
+ // Must bind after the results handlers to ensure correct sizing
+ self._bindContainerResultHandlers(container);
});
container.on('close', function () {
@@ -4214,6 +4391,44 @@ S2.define('select2/dropdown/attachBody',[
this.$dropdownContainer.detach();
};
+ AttachBody.prototype._bindContainerResultHandlers =
+ function (decorated, container) {
+
+ // These should only be bound once
+ if (this._containerResultsHandlersBound) {
+ return;
+ }
+
+ var self = this;
+
+ container.on('results:all', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+
+ container.on('results:append', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+
+ container.on('results:message', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+
+ container.on('select', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+
+ container.on('unselect', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+
+ this._containerResultsHandlersBound = true;
+ };
+
AttachBody.prototype._attachPositioningHandler =
function (decorated, container) {
var self = this;
@@ -4224,14 +4439,14 @@ S2.define('select2/dropdown/attachBody',[
var $watchers = this.$container.parents().filter(Utils.hasScroll);
$watchers.each(function () {
- $(this).data('select2-scroll-position', {
+ Utils.StoreData(this, 'select2-scroll-position', {
x: $(this).scrollLeft(),
y: $(this).scrollTop()
});
});
$watchers.on(scrollEvent, function (ev) {
- var position = $(this).data('select2-scroll-position');
+ var position = Utils.GetData(this, 'select2-scroll-position');
$(this).scrollTop(position.y);
});
@@ -4290,16 +4505,26 @@ S2.define('select2/dropdown/attachBody',[
top: container.bottom
};
- // Determine what the parent element is to use for calciulating the offset
+ // Determine what the parent element is to use for calculating the offset
var $offsetParent = this.$dropdownParent;
- // For statically positoned elements, we need to get the element
+ // For statically positioned elements, we need to get the element
// that is determining the offset
if ($offsetParent.css('position') === 'static') {
$offsetParent = $offsetParent.offsetParent();
}
- var parentOffset = $offsetParent.offset();
+ var parentOffset = {
+ top: 0,
+ left: 0
+ };
+
+ if (
+ $.contains(document.body, $offsetParent[0]) ||
+ $offsetParent[0].isConnected
+ ) {
+ parentOffset = $offsetParent.offset();
+ }
css.top -= parentOffset.top;
css.left -= parentOffset.left;
@@ -4396,8 +4621,8 @@ S2.define('select2/dropdown/minimumResultsForSearch',[
});
S2.define('select2/dropdown/selectOnClose',[
-
-], function () {
+ '../utils'
+], function (Utils) {
function SelectOnClose () { }
SelectOnClose.prototype.bind = function (decorated, container, $container) {
@@ -4428,7 +4653,7 @@ S2.define('select2/dropdown/selectOnClose',[
return;
}
- var data = $highlightedResults.data('data');
+ var data = Utils.GetData($highlightedResults[0], 'data');
// Don't re-select already selected resulte
if (
@@ -4469,7 +4694,7 @@ S2.define('select2/dropdown/closeOnSelect',[
var originalEvent = evt.originalEvent;
// Don't close if the control key is being held
- if (originalEvent && originalEvent.ctrlKey) {
+ if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) {
return;
}
@@ -4523,6 +4748,9 @@ S2.define('select2/i18n/en',[],function () {
},
searching: function () {
return 'Searching…';
+ },
+ removeAllItems: function () {
+ return 'Remove all items';
}
};
});
@@ -4761,66 +4989,29 @@ S2.define('select2/defaults',[
);
}
- if (typeof options.language === 'string') {
- // Check if the language is specified with a region
- if (options.language.indexOf('-') > 0) {
- // Extract the region information if it is included
- var languageParts = options.language.split('-');
- var baseLanguage = languageParts[0];
+ // If the defaults were not previously applied from an element, it is
+ // possible for the language option to have not been resolved
+ options.language = this._resolveLanguage(options.language);
- options.language = [options.language, baseLanguage];
- } else {
- options.language = [options.language];
+ // Always fall back to English since it will always be complete
+ options.language.push('en');
+
+ var uniqueLanguages = [];
+
+ for (var l = 0; l < options.language.length; l++) {
+ var language = options.language[l];
+
+ if (uniqueLanguages.indexOf(language) === -1) {
+ uniqueLanguages.push(language);
}
}
- if ($.isArray(options.language)) {
- var languages = new Translation();
- options.language.push('en');
+ options.language = uniqueLanguages;
- var languageNames = options.language;
-
- for (var l = 0; l < languageNames.length; l++) {
- var name = languageNames[l];
- var language = {};
-
- try {
- // Try to load it with the original name
- language = Translation.loadPath(name);
- } catch (e) {
- try {
- // If we couldn't load it, check if it wasn't the full path
- name = this.defaults.amdLanguageBase + name;
- language = Translation.loadPath(name);
- } catch (ex) {
- // The translation could not be loaded at all. Sometimes this is
- // because of a configuration problem, other times this can be
- // because of how Select2 helps load all possible translation files.
- if (options.debug && window.console && console.warn) {
- console.warn(
- 'Select2: The language file for "' + name + '" could not be ' +
- 'automatically loaded. A fallback will be used instead.'
- );
- }
-
- continue;
- }
- }
-
- languages.extend(language);
- }
-
- options.translations = languages;
- } else {
- var baseTranslation = Translation.loadPath(
- this.defaults.amdLanguageBase + 'en'
- );
- var customTranslation = new Translation(options.language);
-
- customTranslation.extend(baseTranslation);
-
- options.translations = customTranslation;
- }
+ options.translations = this._processTranslations(
+ options.language,
+ options.debug
+ );
return options;
};
@@ -4887,13 +5078,14 @@ S2.define('select2/defaults',[
debug: false,
dropdownAutoWidth: false,
escapeMarkup: Utils.escapeMarkup,
- language: EnglishTranslation,
+ language: {},
matcher: matcher,
minimumInputLength: 0,
maximumInputLength: 0,
maximumSelectionLength: 0,
minimumResultsForSearch: 0,
selectOnClose: false,
+ scrollAfterSelect: false,
sorter: function (data) {
return data;
},
@@ -4908,6 +5100,103 @@ S2.define('select2/defaults',[
};
};
+ Defaults.prototype.applyFromElement = function (options, $element) {
+ var optionLanguage = options.language;
+ var defaultLanguage = this.defaults.language;
+ var elementLanguage = $element.prop('lang');
+ var parentLanguage = $element.closest('[lang]').prop('lang');
+
+ var languages = Array.prototype.concat.call(
+ this._resolveLanguage(elementLanguage),
+ this._resolveLanguage(optionLanguage),
+ this._resolveLanguage(defaultLanguage),
+ this._resolveLanguage(parentLanguage)
+ );
+
+ options.language = languages;
+
+ return options;
+ };
+
+ Defaults.prototype._resolveLanguage = function (language) {
+ if (!language) {
+ return [];
+ }
+
+ if ($.isEmptyObject(language)) {
+ return [];
+ }
+
+ if ($.isPlainObject(language)) {
+ return [language];
+ }
+
+ var languages;
+
+ if (!$.isArray(language)) {
+ languages = [language];
+ } else {
+ languages = language;
+ }
+
+ var resolvedLanguages = [];
+
+ for (var l = 0; l < languages.length; l++) {
+ resolvedLanguages.push(languages[l]);
+
+ if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) {
+ // Extract the region information if it is included
+ var languageParts = languages[l].split('-');
+ var baseLanguage = languageParts[0];
+
+ resolvedLanguages.push(baseLanguage);
+ }
+ }
+
+ return resolvedLanguages;
+ };
+
+ Defaults.prototype._processTranslations = function (languages, debug) {
+ var translations = new Translation();
+
+ for (var l = 0; l < languages.length; l++) {
+ var languageData = new Translation();
+
+ var language = languages[l];
+
+ if (typeof language === 'string') {
+ try {
+ // Try to load it with the original name
+ languageData = Translation.loadPath(language);
+ } catch (e) {
+ try {
+ // If we couldn't load it, check if it wasn't the full path
+ language = this.defaults.amdLanguageBase + language;
+ languageData = Translation.loadPath(language);
+ } catch (ex) {
+ // The translation could not be loaded at all. Sometimes this is
+ // because of a configuration problem, other times this can be
+ // because of how Select2 helps load all possible translation files
+ if (debug && window.console && console.warn) {
+ console.warn(
+ 'Select2: The language file for "' + language + '" could ' +
+ 'not be automatically loaded. A fallback will be used instead.'
+ );
+ }
+ }
+ }
+ } else if ($.isPlainObject(language)) {
+ languageData = new Translation(language);
+ } else {
+ languageData = language;
+ }
+
+ translations.extend(languageData);
+ }
+
+ return translations;
+ };
+
Defaults.prototype.set = function (key, value) {
var camelKey = $.camelCase(key);
@@ -4916,7 +5205,7 @@ S2.define('select2/defaults',[
var convertedData = Utils._convertData(data);
- $.extend(this.defaults, convertedData);
+ $.extend(true, this.defaults, convertedData);
};
var defaults = new Defaults();
@@ -4937,6 +5226,10 @@ S2.define('select2/options',[
this.fromElement($element);
}
+ if ($element != null) {
+ this.options = Defaults.applyFromElement(this.options, $element);
+ }
+
this.options = Defaults.apply(this.options);
if ($element && $element.is('input')) {
@@ -4960,14 +5253,6 @@ S2.define('select2/options',[
this.options.disabled = $e.prop('disabled');
}
- if (this.options.language == null) {
- if ($e.prop('lang')) {
- this.options.language = $e.prop('lang').toLowerCase();
- } else if ($e.closest('[lang]').prop('lang')) {
- this.options.language = $e.closest('[lang]').prop('lang');
- }
- }
-
if (this.options.dir == null) {
if ($e.prop('dir')) {
this.options.dir = $e.prop('dir');
@@ -4981,7 +5266,7 @@ S2.define('select2/options',[
$e.prop('disabled', this.options.disabled);
$e.prop('multiple', this.options.multiple);
- if ($e.data('select2Tags')) {
+ if (Utils.GetData($e[0], 'select2Tags')) {
if (this.options.debug && window.console && console.warn) {
console.warn(
'Select2: The `data-select2-tags` attribute has been changed to ' +
@@ -4990,11 +5275,11 @@ S2.define('select2/options',[
);
}
- $e.data('data', $e.data('select2Tags'));
- $e.data('tags', true);
+ Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags'));
+ Utils.StoreData($e[0], 'tags', true);
}
- if ($e.data('ajaxUrl')) {
+ if (Utils.GetData($e[0], 'ajaxUrl')) {
if (this.options.debug && window.console && console.warn) {
console.warn(
'Select2: The `data-ajax-url` attribute has been changed to ' +
@@ -5003,21 +5288,45 @@ S2.define('select2/options',[
);
}
- $e.attr('ajax--url', $e.data('ajaxUrl'));
- $e.data('ajax--url', $e.data('ajaxUrl'));
+ $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl'));
+ Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl'));
}
var dataset = {};
+ function upperCaseLetter(_, letter) {
+ return letter.toUpperCase();
+ }
+
+ // Pre-load all of the attributes which are prefixed with `data-`
+ for (var attr = 0; attr < $e[0].attributes.length; attr++) {
+ var attributeName = $e[0].attributes[attr].name;
+ var prefix = 'data-';
+
+ if (attributeName.substr(0, prefix.length) == prefix) {
+ // Get the contents of the attribute after `data-`
+ var dataName = attributeName.substring(prefix.length);
+
+ // Get the data contents from the consistent source
+ // This is more than likely the jQuery data helper
+ var dataValue = Utils.GetData($e[0], dataName);
+
+ // camelCase the attribute name to match the spec
+ var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter);
+
+ // Store the data attribute contents into the dataset since
+ dataset[camelDataName] = dataValue;
+ }
+ }
+
// Prefer the element's `dataset` attribute if it exists
// jQuery 1.x does not correctly handle data attributes with multiple dashes
if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
- dataset = $.extend(true, {}, $e[0].dataset, $e.data());
- } else {
- dataset = $e.data();
+ dataset = $.extend(true, {}, $e[0].dataset, dataset);
}
- var data = $.extend(true, {}, dataset);
+ // Prefer our internal data cache if it exists
+ var data = $.extend(true, {}, Utils.GetData($e[0]), dataset);
data = Utils._convertData(data);
@@ -5054,8 +5363,8 @@ S2.define('select2/core',[
'./keys'
], function ($, Options, Utils, KEYS) {
var Select2 = function ($element, options) {
- if ($element.data('select2') != null) {
- $element.data('select2').destroy();
+ if (Utils.GetData($element[0], 'select2') != null) {
+ Utils.GetData($element[0], 'select2').destroy();
}
this.$element = $element;
@@ -5071,7 +5380,7 @@ S2.define('select2/core',[
// Set up the tabindex
var tabindex = $element.attr('tabindex') || 0;
- $element.data('old-tabindex', tabindex);
+ Utils.StoreData($element[0], 'old-tabindex', tabindex);
$element.attr('tabindex', '-1');
// Set up containers and adapters
@@ -5132,6 +5441,9 @@ S2.define('select2/core',[
// Synchronize any monitored attributes
this._syncAttributes();
+ Utils.StoreData($element[0], 'select2', this);
+
+ // Ensure backwards compatibility with $element.data('select2').
$element.data('select2', this);
};
@@ -5208,6 +5520,12 @@ S2.define('select2/core',[
return null;
}
+ if (method == 'computedstyle') {
+ var computedStyle = window.getComputedStyle($element[0]);
+
+ return computedStyle.width;
+ }
+
return method;
};
@@ -5248,8 +5566,8 @@ S2.define('select2/core',[
if (observer != null) {
this._observer = new observer(function (mutations) {
- $.each(mutations, self._syncA);
- $.each(mutations, self._syncS);
+ self._syncA();
+ self._syncS(null, mutations);
});
this._observer.observe(this.$element[0], {
attributes: true,
@@ -5371,7 +5689,7 @@ S2.define('select2/core',[
if (self.isOpen()) {
if (key === KEYS.ESC || key === KEYS.TAB ||
(key === KEYS.UP && evt.altKey)) {
- self.close();
+ self.close(evt);
evt.preventDefault();
} else if (key === KEYS.ENTER) {
@@ -5405,7 +5723,7 @@ S2.define('select2/core',[
Select2.prototype._syncAttributes = function () {
this.options.set('disabled', this.$element.prop('disabled'));
- if (this.options.get('disabled')) {
+ if (this.isDisabled()) {
if (this.isOpen()) {
this.close();
}
@@ -5416,7 +5734,7 @@ S2.define('select2/core',[
}
};
- Select2.prototype._syncSubtree = function (evt, mutations) {
+ Select2.prototype._isChangeMutation = function (evt, mutations) {
var changed = false;
var self = this;
@@ -5444,7 +5762,22 @@ S2.define('select2/core',[
}
} else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
changed = true;
+ } else if ($.isArray(mutations)) {
+ $.each(mutations, function(evt, mutation) {
+ if (self._isChangeMutation(evt, mutation)) {
+ // We've found a change mutation.
+ // Let's escape from the loop and continue
+ changed = true;
+ return false;
+ }
+ });
}
+ return changed;
+ };
+
+ Select2.prototype._syncSubtree = function (evt, mutations) {
+ var changed = this._isChangeMutation(evt, mutations);
+ var self = this;
// Only re-pull the data if we think there is a change
if (changed) {
@@ -5466,7 +5799,8 @@ S2.define('select2/core',[
'open': 'opening',
'close': 'closing',
'select': 'selecting',
- 'unselect': 'unselecting'
+ 'unselect': 'unselecting',
+ 'clear': 'clearing'
};
if (args === undefined) {
@@ -5494,7 +5828,7 @@ S2.define('select2/core',[
};
Select2.prototype.toggleDropdown = function () {
- if (this.options.get('disabled')) {
+ if (this.isDisabled()) {
return;
}
@@ -5510,15 +5844,40 @@ S2.define('select2/core',[
return;
}
+ if (this.isDisabled()) {
+ return;
+ }
+
this.trigger('query', {});
};
- Select2.prototype.close = function () {
+ Select2.prototype.close = function (evt) {
if (!this.isOpen()) {
return;
}
- this.trigger('close', {});
+ this.trigger('close', { originalEvent : evt });
+ };
+
+ /**
+ * Helper method to abstract the "enabled" (not "disabled") state of this
+ * object.
+ *
+ * @return {true} if the instance is not disabled.
+ * @return {false} if the instance is disabled.
+ */
+ Select2.prototype.isEnabled = function () {
+ return !this.isDisabled();
+ };
+
+ /**
+ * Helper method to abstract the "disabled" state of this object.
+ *
+ * @return {true} if the disabled option is true.
+ * @return {false} if the disabled option is false.
+ */
+ Select2.prototype.isDisabled = function () {
+ return this.options.get('disabled');
};
Select2.prototype.isOpen = function () {
@@ -5595,7 +5954,7 @@ S2.define('select2/core',[
});
}
- this.$element.val(newVal).trigger('change');
+ this.$element.val(newVal).trigger('input').trigger('change');
};
Select2.prototype.destroy = function () {
@@ -5621,10 +5980,12 @@ S2.define('select2/core',[
this._syncS = null;
this.$element.off('.select2');
- this.$element.attr('tabindex', this.$element.data('old-tabindex'));
+ this.$element.attr('tabindex',
+ Utils.GetData(this.$element[0], 'old-tabindex'));
this.$element.removeClass('select2-hidden-accessible');
this.$element.attr('aria-hidden', 'false');
+ Utils.RemoveData(this.$element[0]);
this.$element.removeData('select2');
this.dataAdapter.destroy();
@@ -5652,7 +6013,7 @@ S2.define('select2/core',[
this.$container.addClass('select2-container--' + this.options.get('theme'));
- $container.data('element', this.$element);
+ Utils.StoreData($container[0], 'element', this.$element);
return $container;
};
@@ -5862,8 +6223,9 @@ S2.define('select2/compat/initSelection',[
});
S2.define('select2/compat/inputData',[
- 'jquery'
-], function ($) {
+ 'jquery',
+ '../utils'
+], function ($, Utils) {
function InputData (decorated, $element, options) {
this._currentData = [];
this._valueSeparator = options.get('valueSeparator') || ',';
@@ -5927,13 +6289,13 @@ S2.define('select2/compat/inputData',[
});
this.$element.val(data.id);
- this.$element.trigger('change');
+ this.$element.trigger('input').trigger('change');
} else {
var value = this.$element.val();
value += this._valueSeparator + data.id;
this.$element.val(value);
- this.$element.trigger('change');
+ this.$element.trigger('input').trigger('change');
}
};
@@ -5956,7 +6318,7 @@ S2.define('select2/compat/inputData',[
}
self.$element.val(values.join(self._valueSeparator));
- self.$element.trigger('change');
+ self.$element.trigger('input').trigger('change');
});
};
@@ -5980,7 +6342,7 @@ S2.define('select2/compat/inputData',[
InputData.prototype.addOptions = function (_, $options) {
var options = $.map($options, function ($option) {
- return $.data($option[0], 'data');
+ return Utils.GetData($option[0], 'data');
});
this._currentData.push.apply(this._currentData, options);
@@ -6383,8 +6745,9 @@ S2.define('jquery.select2',[
'jquery-mousewheel',
'./select2/core',
- './select2/defaults'
-], function ($, _, Select2, Defaults) {
+ './select2/defaults',
+ './select2/utils'
+], function ($, _, Select2, Defaults, Utils) {
if ($.fn.select2 == null) {
// All methods that should return the element
var thisMethods = ['open', 'close', 'destroy'];
@@ -6405,7 +6768,7 @@ S2.define('jquery.select2',[
var args = Array.prototype.slice.call(arguments, 1);
this.each(function () {
- var instance = $(this).data('select2');
+ var instance = Utils.GetData(this, 'select2');
if (instance == null && window.console && console.error) {
console.error(
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/select2.full.min.js b/htdocs/includes/jquery/plugins/select2/dist/js/select2.full.min.js
index 96ba80cd81b..fa781916e8b 100644
--- a/htdocs/includes/jquery/plugins/select2/dist/js/select2.full.min.js
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/select2.full.min.js
@@ -1 +1,2 @@
-/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return v.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o=b&&b.split("/"),p=t.map,q=p&&p["*"]||{};if(a){for(a=a.split("/"),g=a.length-1,t.nodeIdCompat&&x.test(a[g])&&(a[g]=a[g].replace(x,"")),"."===a[0].charAt(0)&&o&&(n=o.slice(0,o.length-1),a=n.concat(a)),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}if((o||q)&&p){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),o)for(l=o.length;l>0;l-=1)if((e=p[o.slice(0,l).join("/")])&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=w.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),o.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){r[a]=b}}function j(a){if(e(s,a)){var c=s[a];delete s[a],u[a]=!0,n.apply(b,c)}if(!e(r,a)&&!e(u,a))throw new Error("No "+a);return r[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return a?k(a):[]}function m(a){return function(){return t&&t.config&&t.config[a]||{}}}var n,o,p,q,r={},s={},t={},u={},v=Object.prototype.hasOwnProperty,w=[].slice,x=/\.js$/;p=function(a,b){var c,d=k(a),e=d[0],g=b[1];return a=d[1],e&&(e=f(e,g),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(g)):f(a,g):(a=f(a,g),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},q={require:function(a){return g(a)},exports:function(a){var b=r[a];return void 0!==b?b:r[a]={}},module:function(a){return{id:a,uri:"",exports:r[a],config:m(a)}}},n=function(a,c,d,f){var h,k,m,n,o,t,v,w=[],x=typeof d;if(f=f||a,t=l(f),"undefined"===x||"function"===x){for(c=!c.length&&d.length?["require","exports","module"]:c,o=0;o0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a(' '),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()});b.$results.find(".select2-results__option[aria-selected]").each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j",{class:"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):h-g<0&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");if("true"===c.attr("aria-selected"))return void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{}));d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),c<=2?this.$results.scrollTop(0):(g>this.$results.outerHeight()||g<0)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a(' ');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id,a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2");a(".select2.select2-container--open").each(function(){var b=a(this);this!=d[0]&&b.data("element").select2("close")})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){b.find(".selection").append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html(' '),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},e.prototype.selectionContainer=function(){return a(" ")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html(''),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},d.prototype.selectionContainer=function(){return a('× ')},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d1||c)return a.call(this,b);this.clear();var d=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(d)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e0||0===c.length)){var d=a('× ');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a(' ');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){if(a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented(),a.which===c.BACKSPACE&&""===e.$search.val()){var b=e.$searchContainer.prev(".select2-selection__choice");if(b.length>0){var d=b.data("data");e.searchRemoveChoice(d),a.preventDefault()}}});var f=document.documentMode,g=f&&f<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){if(g)return void e.$selection.off("input.search input.searchcheck");e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{a=.75*(this.$search.val().length+1)+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"}}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),null!=c.id?d+="-"+c.id.toString():d+="-"+a.generateChars(4),d},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength)return void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;if(d.maximumSelectionLength>0&&f>=d.maximumSelectionLength)return void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}});a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a(' ');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a(' ');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()||e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){e.showSearch(a)?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){e.$results.offset().top+e.$results.outerHeight(!1)+50>=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1)&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a(' '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(" "),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id;this.$container.parents().filter(b.hasScroll).off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),null==l.tokenSeparators&&null==l.tokenizer||(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){null==c(d,e.children[g])&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var h=b(e.text).toUpperCase(),i=b(d.term).toUpperCase();return h.indexOf(i)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)},new D}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return e<=0?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;h=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=a&&0!==a.length||(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a(' ');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("select2/compat/utils",["jquery"],function(a){function b(b,c,d){var e,f,g=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0===this.indexOf("select2-")&&g.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&null!=(f=d(this))&&g.push(f)})),b.attr("class",g.join(" "))}return{syncCssClasses:b}}),b.define("select2/compat/containerCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("containerCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptContainerCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("containerCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/dropdownCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("dropdownCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptDropdownCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("dropdownCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/initSelection",["jquery"],function(a){function b(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=c.get("initSelection"),this._isInitialized=!1,a.call(this,b,c)}return b.prototype.current=function(b,c){var d=this;if(this._isInitialized)return void b.call(this,c);this.initSelection.call(null,this.$element,function(b){d._isInitialized=!0,a.isArray(b)||(b=[b]),c(b)})},b}),b.define("select2/compat/inputData",["jquery"],function(a){function b(a,b,c){this._currentData=[],this._valueSeparator=c.get("valueSeparator")||",","hidden"===b.prop("type")&&c.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `` element instead."),a.call(this,b,c)}return b.prototype.current=function(b,c){function d(b,c){var e=[];return b.selected||-1!==a.inArray(b.id,c)?(b.selected=!0,e.push(b)):b.selected=!1,b.children&&e.push.apply(e,d(b.children,c)),e}for(var e=[],f=0;f=0;f--){var g=d.children[f];b(c.term,g.text,g)||e.children.splice(f,1)}if(e.children.length>0)return e}return b(c.term,d.text,d)?e:null}return c}return b}),b.define("select2/compat/query",[],function(){function a(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `query` option has been deprecated in favor of a custom data adapter that overrides the `query` method. Support will be removed for the `query` option in future versions of Select2."),a.call(this,b,c)}return a.prototype.query=function(a,b,c){b.callback=c,this.options.get("query").call(null,b)},a}),b.define("select2/dropdown/attachContainer",[],function(){function a(a,b,c){a.call(this,b,c)}return a.prototype.position=function(a,b,c){c.find(".dropdown-wrapper").append(b),b.addClass("select2-dropdown--below"),c.addClass("select2-container--below")},a}),b.define("select2/dropdown/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$dropdown.on(d.join(" "),function(a){a.stopPropagation()})},a}),b.define("select2/selection/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$selection.on(d.join(" "),function(a){a.stopPropagation()})},a}),function(c){"function"==typeof b.define&&b.define.amd?b.define("jquery-mousewheel",["jquery"],c):"object"==typeof exports?module.exports=c:c(a)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||n=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120==0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if("object"==typeof(b=b||{}))return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
\ No newline at end of file
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(d){var e=function(){if(d&&d.fn&&d.fn.select2&&d.fn.select2.amd)var e=d.fn.select2.amd;var t,n,i,h,o,s,f,g,m,v,y,_,r,a,w,l;function b(e,t){return r.call(e,t)}function c(e,t){var n,i,r,o,s,a,l,c,u,d,p,h=t&&t.split("/"),f=y.map,g=f&&f["*"]||{};if(e){for(s=(e=e.split("/")).length-1,y.nodeIdCompat&&w.test(e[s])&&(e[s]=e[s].replace(w,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.length-1).concat(e)),u=0;u":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},r.appendMany=function(e,t){if("1.7"===o.fn.jquery.substr(0,3)){var n=o();o.map(t,function(e){n=n.add(e)}),t=n}e.append(t)},r.__cache={};var n=0;return r.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null==t&&(e.id?(t=e.id,e.setAttribute("data-select2-id",t)):(e.setAttribute("data-select2-id",++n),t=n.toString())),t},r.StoreData=function(e,t,n){var i=r.GetUniqueElementId(e);r.__cache[i]||(r.__cache[i]={}),r.__cache[i][t]=n},r.GetData=function(e,t){var n=r.GetUniqueElementId(e);return t?r.__cache[n]&&null!=r.__cache[n][t]?r.__cache[n][t]:o(e).data(t):r.__cache[n]},r.RemoveData=function(e){var t=r.GetUniqueElementId(e);null!=r.__cache[t]&&delete r.__cache[t],e.removeAttribute("data-select2-id")},r}),e.define("select2/results",["jquery","./utils"],function(h,f){function i(e,t,n){this.$element=e,this.data=n,this.options=t,i.__super__.constructor.call(this)}return f.Extend(i,f.Observable),i.prototype.render=function(){var e=h('');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},i.prototype.clear=function(){this.$results.empty()},i.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h(' '),i=this.options.get("translations").get(e.message);n.append(t(i(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},i.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},i.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n",{class:"select2-results__options select2-results__options--nested"});p.append(l),s.append(a),s.append(p)}else this.template(e,t);return f.StoreData(t,"data",e),t},i.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=f.GetData(e[0],"data");"true"==e.attr("aria-selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e);if(!(n<=0)){var i=n-1;0===e.length&&(i=0);var r=t.eq(i);r.trigger("mouseenter");var o=l.$results.offset().top,s=r.offset().top,a=l.$results.scrollTop()+(s-o);0===i?l.$results.scrollTop(0):s-o<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e)+1;if(!(n>=t.length)){var i=t.eq(n);i.trigger("mouseenter");var r=l.$results.offset().top+l.$results.outerHeight(!1),o=i.offset().top+i.outerHeight(!1),s=l.$results.scrollTop()+o-r;0===n?l.$results.scrollTop(0):rthis.$results.outerHeight()||o<0)&&this.$results.scrollTop(r)}},i.prototype.template=function(e,t){var n=this.options.get("templateResult"),i=this.options.get("escapeMarkup"),r=n(e,t);null==r?t.style.display="none":"string"==typeof r?t.innerHTML=i(r):h(t).append(r)},i}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(n,i,r){function o(e,t){this.$element=e,this.options=t,o.__super__.constructor.call(this)}return i.Extend(o,i.Observable),o.prototype.render=function(){var e=n(' ');return this._tabindex=0,null!=i.GetData(this.$element[0],"old-tabindex")?this._tabindex=i.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),e.attr("aria-disabled","false"),this.$selection=e},o.prototype.bind=function(e,t){var n=this,i=e.id+"-results";this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===r.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",i),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),n.$selection.trigger("focus"),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex),n.$selection.attr("aria-disabled","false")}),e.on("disable",function(){n.$selection.attr("tabindex","-1"),n.$selection.attr("aria-disabled","true")})},o.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||n.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},o.prototype._attachCloseHandler=function(e){n(document.body).on("mousedown.select2."+e.id,function(e){var t=n(e.target).closest(".select2");n(".select2.select2-container--open").each(function(){this!=t[0]&&i.GetData(this,"element").select2("close")})})},o.prototype._detachCloseHandler=function(e){n(document.body).off("mousedown.select2."+e.id)},o.prototype.position=function(e,t){t.find(".selection").append(e)},o.prototype.destroy=function(){this._detachCloseHandler(this.container)},o.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},o.prototype.isEnabled=function(){return!this.isDisabled()},o.prototype.isDisabled=function(){return this.options.get("disabled")},o}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,i){function r(){r.__super__.constructor.apply(this,arguments)}return n.Extend(r,t),r.prototype.render=function(){var e=r.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html(' '),e},r.prototype.bind=function(t,e){var n=this;r.__super__.bind.apply(this,arguments);var i=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",i).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",i),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.trigger("focus")})},r.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},r.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},r.prototype.selectionContainer=function(){return e(" ")},r.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),i=this.display(t,n);n.empty().append(i);var r=t.title||t.text;r?n.attr("title",r):n.removeAttr("title")}else this.clear()},r}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(r,e,l){function n(e,t){n.__super__.constructor.apply(this,arguments)}return l.Extend(n,e),n.prototype.render=function(){var e=n.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html(''),e},n.prototype.bind=function(e,t){var i=this;n.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){i.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!i.isDisabled()){var t=r(this).parent(),n=l.GetData(t[0],"data");i.trigger("unselect",{originalEvent:e,data:n})}})},n.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},n.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},n.prototype.selectionContainer=function(){return r('× ')},n.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n× ');a.StoreData(i[0],"data",t),this.$selection.find(".select2-selection__rendered").prepend(i)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(i,a,l){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=i(' ');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},e.prototype.bind=function(e,t,n){var i=this,r=t.id+"-results";e.call(this,t,n),t.on("open",function(){i.$search.attr("aria-controls",r),i.$search.trigger("focus")}),t.on("close",function(){i.$search.val(""),i.$search.removeAttr("aria-controls"),i.$search.removeAttr("aria-activedescendant"),i.$search.trigger("focus")}),t.on("enable",function(){i.$search.prop("disabled",!1),i._transferTabIndex()}),t.on("disable",function(){i.$search.prop("disabled",!0)}),t.on("focus",function(e){i.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?i.$search.attr("aria-activedescendant",e.data._resultId):i.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){i.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){i._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented(),e.which===l.BACKSPACE&&""===i.$search.val()){var t=i.$searchContainer.prev(".select2-selection__choice");if(0this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("select",function(){i._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var i=this;this._checkIfMaximumSelected(function(){e.call(i,t,n)})},e.prototype._checkIfMaximumSelected=function(e,n){var i=this;this.current(function(e){var t=null!=e?e.length:0;0=i.maximumSelectionLength?i.trigger("results:message",{message:"maximumSelected",args:{maximum:i.maximumSelectionLength}}):n&&n()})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t(' ');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(o,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=o(' ');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var i=this,r=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){i.handleSearch(e)}),t.on("open",function(){i.$search.attr("tabindex",0),i.$search.attr("aria-controls",r),i.$search.trigger("focus"),window.setTimeout(function(){i.$search.trigger("focus")},0)}),t.on("close",function(){i.$search.attr("tabindex",-1),i.$search.removeAttr("aria-controls"),i.$search.removeAttr("aria-activedescendant"),i.$search.val(""),i.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||i.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(i.showSearch(e)?i.$searchContainer.removeClass("select2-search--hide"):i.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?i.$search.attr("aria-activedescendant",e.data._resultId):i.$search.removeAttr("aria-activedescendant")})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,i){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,i)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),i=t.length-1;0<=i;i--){var r=t[i];this.placeholder.id===r.id&&n.splice(i,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,i){this.lastParams={},e.call(this,t,n,i),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("query",function(e){i.lastParams=e,i.loading=!0}),t.on("query:append",function(e){i.lastParams=e,i.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);if(!this.loading&&e){var t=this.$results.offset().top+this.$results.outerHeight(!1);this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=t+50&&this.loadMore()}},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n(' '),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=f(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("open",function(){i._showDropdown(),i._attachPositioningHandler(t),i._bindContainerResultHandlers(t)}),t.on("close",function(){i._hideDropdown(),i._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f(" "),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){if(!this._containerResultsHandlersBound){var n=this;t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0}},e.prototype._attachPositioningHandler=function(e,t){var n=this,i="scroll.select2."+t.id,r="resize.select2."+t.id,o="orientationchange.select2."+t.id,s=this.$container.parents().filter(a.hasScroll);s.each(function(){a.StoreData(this,"select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),s.on(i,function(e){var t=a.GetData(this,"select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(i+" "+r+" "+o,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,i="resize.select2."+t.id,r="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+i+" "+r)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),i=null,r=this.$container.offset();r.bottom=r.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=r.top,o.bottom=r.top+o.height;var s=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=ar.bottom+s,d={left:r.left,top:o.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h={top:0,left:0};(f.contains(document.body,p[0])||p[0].isConnected)&&(h=p.offset()),d.top-=h.top,d.left-=h.left,t||n||(i="below"),u||!c||t?!c&&u&&t&&(i="below"):i="above",("above"==i||t&&"below"!==i)&&(d.top=o.top-h.top-s),null!=i&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+i),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+i)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,i){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,i)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,i=0;i ');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),u.StoreData(e[0],"element",this.$element),e},d}),e.define("select2/compat/utils",["jquery"],function(s){return{syncCssClasses:function(e,t,n){var i,r,o=[];(i=s.trim(e.attr("class")))&&s((i=""+i).split(/\s+/)).each(function(){0===this.indexOf("select2-")&&o.push(this)}),(i=s.trim(t.attr("class")))&&s((i=""+i).split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&null!=(r=n(this))&&o.push(r)}),e.attr("class",o.join(" "))}}}),e.define("select2/compat/containerCss",["jquery","./utils"],function(s,a){function l(e){return null}function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("containerCssClass")||"";s.isFunction(n)&&(n=n(this.$element));var i=this.options.get("adaptContainerCssClass");if(i=i||l,-1!==n.indexOf(":all:")){n=n.replace(":all:","");var r=i;i=function(e){var t=r(e);return null!=t?t+" "+e:e}}var o=this.options.get("containerCss")||{};return s.isFunction(o)&&(o=o(this.$element)),a.syncCssClasses(t,this.$element,i),t.css(o),t.addClass(n),t},e}),e.define("select2/compat/dropdownCss",["jquery","./utils"],function(s,a){function l(e){return null}function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("dropdownCssClass")||"";s.isFunction(n)&&(n=n(this.$element));var i=this.options.get("adaptDropdownCssClass");if(i=i||l,-1!==n.indexOf(":all:")){n=n.replace(":all:","");var r=i;i=function(e){var t=r(e);return null!=t?t+" "+e:e}}var o=this.options.get("dropdownCss")||{};return s.isFunction(o)&&(o=o(this.$element)),a.syncCssClasses(t,this.$element,i),t.css(o),t.addClass(n),t},e}),e.define("select2/compat/initSelection",["jquery"],function(i){function e(e,t,n){n.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=n.get("initSelection"),this._isInitialized=!1,e.call(this,t,n)}return e.prototype.current=function(e,t){var n=this;this._isInitialized?e.call(this,t):this.initSelection.call(null,this.$element,function(e){n._isInitialized=!0,i.isArray(e)||(e=[e]),t(e)})},e}),e.define("select2/compat/inputData",["jquery","../utils"],function(s,i){function e(e,t,n){this._currentData=[],this._valueSeparator=n.get("valueSeparator")||",","hidden"===t.prop("type")&&n.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `` element instead."),e.call(this,t,n)}return e.prototype.current=function(e,t){function i(e,t){var n=[];return e.selected||-1!==s.inArray(e.id,t)?(e.selected=!0,n.push(e)):e.selected=!1,e.children&&n.push.apply(n,i(e.children,t)),n}for(var n=[],r=0;r'
+ ''
);
if (this.options.get('multiple')) {
@@ -814,7 +878,7 @@ S2.define('select2/results',[
this.hideLoading();
var $message = $(
- ' '
);
@@ -907,7 +971,7 @@ S2.define('select2/results',[
$options.each(function () {
var $option = $(this);
- var item = $.data(this, 'data');
+ var item = Utils.GetData(this, 'data');
// id needs to be converted to a string when comparing
var id = '' + item.id;
@@ -948,11 +1012,16 @@ S2.define('select2/results',[
option.className = 'select2-results__option';
var attrs = {
- 'role': 'treeitem',
+ 'role': 'option',
'aria-selected': 'false'
};
- if (data.disabled) {
+ var matches = window.Element.prototype.matches ||
+ window.Element.prototype.msMatchesSelector ||
+ window.Element.prototype.webkitMatchesSelector;
+
+ if ((data.element != null && matches.call(data.element, ':disabled')) ||
+ (data.element == null && data.disabled)) {
delete attrs['aria-selected'];
attrs['aria-disabled'] = 'true';
}
@@ -1012,7 +1081,7 @@ S2.define('select2/results',[
this.template(data, option);
}
- $.data(option, 'data', data);
+ Utils.StoreData(option, 'data', data);
return option;
};
@@ -1053,7 +1122,10 @@ S2.define('select2/results',[
}
self.setClasses();
- self.highlightFirstItem();
+
+ if (self.options.get('scrollAfterSelect')) {
+ self.highlightFirstItem();
+ }
});
container.on('unselect', function () {
@@ -1062,7 +1134,10 @@ S2.define('select2/results',[
}
self.setClasses();
- self.highlightFirstItem();
+
+ if (self.options.get('scrollAfterSelect')) {
+ self.highlightFirstItem();
+ }
});
container.on('open', function () {
@@ -1098,7 +1173,7 @@ S2.define('select2/results',[
return;
}
- var data = $highlighted.data('data');
+ var data = Utils.GetData($highlighted[0], 'data');
if ($highlighted.attr('aria-selected') == 'true') {
self.trigger('close', {});
@@ -1116,8 +1191,9 @@ S2.define('select2/results',[
var currentIndex = $options.index($highlighted);
- // If we are already at te top, don't move further
- if (currentIndex === 0) {
+ // If we are already at the top, don't move further
+ // If no options, currentIndex will be -1
+ if (currentIndex <= 0) {
return;
}
@@ -1210,7 +1286,7 @@ S2.define('select2/results',[
function (evt) {
var $this = $(this);
- var data = $this.data('data');
+ var data = Utils.GetData(this, 'data');
if ($this.attr('aria-selected') === 'true') {
if (self.options.get('multiple')) {
@@ -1233,7 +1309,7 @@ S2.define('select2/results',[
this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
function (evt) {
- var data = $(this).data('data');
+ var data = Utils.GetData(this, 'data');
self.getHighlightedResults()
.removeClass('select2-results__option--highlighted');
@@ -1348,14 +1424,15 @@ S2.define('select2/selection/base',[
this._tabindex = 0;
- if (this.$element.data('old-tabindex') != null) {
- this._tabindex = this.$element.data('old-tabindex');
+ if (Utils.GetData(this.$element[0], 'old-tabindex') != null) {
+ this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex');
} else if (this.$element.attr('tabindex') != null) {
this._tabindex = this.$element.attr('tabindex');
}
$selection.attr('title', this.$element.attr('title'));
$selection.attr('tabindex', this._tabindex);
+ $selection.attr('aria-disabled', 'false');
this.$selection = $selection;
@@ -1365,7 +1442,6 @@ S2.define('select2/selection/base',[
BaseSelection.prototype.bind = function (container, $container) {
var self = this;
- var id = container.id + '-container';
var resultsId = container.id + '-results';
this.container = container;
@@ -1408,17 +1484,19 @@ S2.define('select2/selection/base',[
self.$selection.removeAttr('aria-activedescendant');
self.$selection.removeAttr('aria-owns');
- self.$selection.focus();
+ self.$selection.trigger('focus');
self._detachCloseHandler(container);
});
container.on('enable', function () {
self.$selection.attr('tabindex', self._tabindex);
+ self.$selection.attr('aria-disabled', 'false');
});
container.on('disable', function () {
self.$selection.attr('tabindex', '-1');
+ self.$selection.attr('aria-disabled', 'true');
});
};
@@ -1441,7 +1519,6 @@ S2.define('select2/selection/base',[
};
BaseSelection.prototype._attachCloseHandler = function (container) {
- var self = this;
$(document.body).on('mousedown.select2.' + container.id, function (e) {
var $target = $(e.target);
@@ -1451,13 +1528,11 @@ S2.define('select2/selection/base',[
var $all = $('.select2.select2-container--open');
$all.each(function () {
- var $this = $(this);
-
if (this == $select[0]) {
return;
}
- var $element = $this.data('element');
+ var $element = Utils.GetData(this, 'element');
$element.select2('close');
});
@@ -1481,6 +1556,27 @@ S2.define('select2/selection/base',[
throw new Error('The `update` method must be defined in child classes.');
};
+ /**
+ * Helper method to abstract the "enabled" (not "disabled") state of this
+ * object.
+ *
+ * @return {true} if the instance is not disabled.
+ * @return {false} if the instance is disabled.
+ */
+ BaseSelection.prototype.isEnabled = function () {
+ return !this.isDisabled();
+ };
+
+ /**
+ * Helper method to abstract the "disabled" state of this object.
+ *
+ * @return {true} if the disabled option is true.
+ * @return {false} if the disabled option is false.
+ */
+ BaseSelection.prototype.isDisabled = function () {
+ return this.options.get('disabled');
+ };
+
return BaseSelection;
});
@@ -1518,7 +1614,10 @@ S2.define('select2/selection/single',[
var id = container.id + '-container';
- this.$selection.find('.select2-selection__rendered').attr('id', id);
+ this.$selection.find('.select2-selection__rendered')
+ .attr('id', id)
+ .attr('role', 'textbox')
+ .attr('aria-readonly', 'true');
this.$selection.attr('aria-labelledby', id);
this.$selection.on('mousedown', function (evt) {
@@ -1542,17 +1641,15 @@ S2.define('select2/selection/single',[
container.on('focus', function (evt) {
if (!container.isOpen()) {
- self.$selection.focus();
+ self.$selection.trigger('focus');
}
});
-
- container.on('selection:update', function (params) {
- self.update(params.data);
- });
};
SingleSelection.prototype.clear = function () {
- this.$selection.find('.select2-selection__rendered').empty();
+ var $rendered = this.$selection.find('.select2-selection__rendered');
+ $rendered.empty();
+ $rendered.removeAttr('title'); // clear tooltip on empty
};
SingleSelection.prototype.display = function (data, container) {
@@ -1578,7 +1675,14 @@ S2.define('select2/selection/single',[
var formatted = this.display(selection, $rendered);
$rendered.empty().append(formatted);
- $rendered.prop('title', selection.title || selection.text);
+
+ var title = selection.title || selection.text;
+
+ if (title) {
+ $rendered.attr('title', title);
+ } else {
+ $rendered.removeAttr('title');
+ }
};
return SingleSelection;
@@ -1623,14 +1727,14 @@ S2.define('select2/selection/multiple',[
'.select2-selection__choice__remove',
function (evt) {
// Ignore the event if it is disabled
- if (self.options.get('disabled')) {
+ if (self.isDisabled()) {
return;
}
var $remove = $(this);
var $selection = $remove.parent();
- var data = $selection.data('data');
+ var data = Utils.GetData($selection[0], 'data');
self.trigger('unselect', {
originalEvent: evt,
@@ -1641,7 +1745,9 @@ S2.define('select2/selection/multiple',[
};
MultipleSelection.prototype.clear = function () {
- this.$selection.find('.select2-selection__rendered').empty();
+ var $rendered = this.$selection.find('.select2-selection__rendered');
+ $rendered.empty();
+ $rendered.removeAttr('title');
};
MultipleSelection.prototype.display = function (data, container) {
@@ -1679,9 +1785,14 @@ S2.define('select2/selection/multiple',[
var formatted = this.display(selection, $selection);
$selection.append(formatted);
- $selection.prop('title', selection.title || selection.text);
- $selection.data('data', selection);
+ var title = selection.title || selection.text;
+
+ if (title) {
+ $selection.attr('title', title);
+ }
+
+ Utils.StoreData($selection[0], 'data', selection);
$selections.push($selection);
}
@@ -1746,8 +1857,9 @@ S2.define('select2/selection/placeholder',[
S2.define('select2/selection/allowClear',[
'jquery',
- '../keys'
-], function ($, KEYS) {
+ '../keys',
+ '../utils'
+], function ($, KEYS, Utils) {
function AllowClear () { }
AllowClear.prototype.bind = function (decorated, container, $container) {
@@ -1776,7 +1888,7 @@ S2.define('select2/selection/allowClear',[
AllowClear.prototype._handleClear = function (_, evt) {
// Ignore the event if it is disabled
- if (this.options.get('disabled')) {
+ if (this.isDisabled()) {
return;
}
@@ -1789,10 +1901,22 @@ S2.define('select2/selection/allowClear',[
evt.stopPropagation();
- var data = $clear.data('data');
+ var data = Utils.GetData($clear[0], 'data');
+
+ var previousVal = this.$element.val();
+ this.$element.val(this.placeholder.id);
+
+ var unselectData = {
+ data: data
+ };
+ this.trigger('clear', unselectData);
+ if (unselectData.prevented) {
+ this.$element.val(previousVal);
+ return;
+ }
for (var d = 0; d < data.length; d++) {
- var unselectData = {
+ unselectData = {
data: data[d]
};
@@ -1802,11 +1926,12 @@ S2.define('select2/selection/allowClear',[
// If the event was prevented, don't clear it out.
if (unselectData.prevented) {
+ this.$element.val(previousVal);
return;
}
}
- this.$element.val(this.placeholder.id).trigger('change');
+ this.$element.trigger('input').trigger('change');
this.trigger('toggle', {});
};
@@ -1829,12 +1954,14 @@ S2.define('select2/selection/allowClear',[
return;
}
+ var removeAll = this.options.get('translations').get('removeAllItems');
+
var $remove = $(
- '' +
+ '' +
'×' +
' '
);
- $remove.data('data', data);
+ Utils.StoreData($remove[0], 'data', data);
this.$selection.find('.select2-selection__rendered').prepend($remove);
};
@@ -1856,7 +1983,7 @@ S2.define('select2/selection/search',[
'' +
' ' +
+ ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' +
' '
);
@@ -1873,14 +2000,18 @@ S2.define('select2/selection/search',[
Search.prototype.bind = function (decorated, container, $container) {
var self = this;
+ var resultsId = container.id + '-results';
+
decorated.call(this, container, $container);
container.on('open', function () {
+ self.$search.attr('aria-controls', resultsId);
self.$search.trigger('focus');
});
container.on('close', function () {
self.$search.val('');
+ self.$search.removeAttr('aria-controls');
self.$search.removeAttr('aria-activedescendant');
self.$search.trigger('focus');
});
@@ -1900,7 +2031,11 @@ S2.define('select2/selection/search',[
});
container.on('results:focus', function (params) {
- self.$search.attr('aria-activedescendant', params.id);
+ if (params.data._resultId) {
+ self.$search.attr('aria-activedescendant', params.data._resultId);
+ } else {
+ self.$search.removeAttr('aria-activedescendant');
+ }
});
this.$selection.on('focusin', '.select2-search--inline', function (evt) {
@@ -1925,7 +2060,7 @@ S2.define('select2/selection/search',[
.prev('.select2-selection__choice');
if ($previousChoice.length > 0) {
- var item = $previousChoice.data('data');
+ var item = Utils.GetData($previousChoice[0], 'data');
self.searchRemoveChoice(item);
@@ -1934,6 +2069,12 @@ S2.define('select2/selection/search',[
}
});
+ this.$selection.on('click', '.select2-search--inline', function (evt) {
+ if (self.$search.val()) {
+ evt.stopPropagation();
+ }
+ });
+
// Try to detect the IE version should the `documentMode` property that
// is stored on the document. This is only implemented in IE and is
// slightly cleaner than doing a user agent check.
@@ -2019,7 +2160,7 @@ S2.define('select2/selection/search',[
this.resizeSearch();
if (searchHadFocus) {
- this.$search.focus();
+ this.$search.trigger('focus');
}
};
@@ -2052,7 +2193,7 @@ S2.define('select2/selection/search',[
var width = '';
if (this.$search.attr('placeholder') !== '') {
- width = this.$selection.find('.select2-selection__rendered').innerWidth();
+ width = this.$selection.find('.select2-selection__rendered').width();
} else {
var minimumWidth = this.$search.val().length + 1;
@@ -2076,10 +2217,13 @@ S2.define('select2/selection/eventRelay',[
'open', 'opening',
'close', 'closing',
'select', 'selecting',
- 'unselect', 'unselecting'
+ 'unselect', 'unselecting',
+ 'clear', 'clearing'
];
- var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
+ var preventableEvents = [
+ 'opening', 'closing', 'selecting', 'unselecting', 'clearing'
+ ];
decorated.call(this, container, $container);
@@ -2412,6 +2556,7 @@ S2.define('select2/diacritics',[
'\u019F': 'O',
'\uA74A': 'O',
'\uA74C': 'O',
+ '\u0152': 'OE',
'\u01A2': 'OI',
'\uA74E': 'OO',
'\u0222': 'OU',
@@ -2821,6 +2966,7 @@ S2.define('select2/diacritics',[
'\uA74B': 'o',
'\uA74D': 'o',
'\u0275': 'o',
+ '\u0153': 'oe',
'\u01A3': 'oi',
'\u0223': 'ou',
'\uA74F': 'oo',
@@ -2989,8 +3135,9 @@ S2.define('select2/diacritics',[
'\u03CD': '\u03C5',
'\u03CB': '\u03C5',
'\u03B0': '\u03C5',
- '\u03C9': '\u03C9',
- '\u03C2': '\u03C3'
+ '\u03CE': '\u03C9',
+ '\u03C2': '\u03C3',
+ '\u2019': '\''
};
return diacritics;
@@ -3075,7 +3222,7 @@ S2.define('select2/data/select',[
if ($(data.element).is('option')) {
data.element.selected = true;
- this.$element.trigger('change');
+ this.$element.trigger('input').trigger('change');
return;
}
@@ -3096,13 +3243,13 @@ S2.define('select2/data/select',[
}
self.$element.val(val);
- self.$element.trigger('change');
+ self.$element.trigger('input').trigger('change');
});
} else {
var val = data.id;
this.$element.val(val);
- this.$element.trigger('change');
+ this.$element.trigger('input').trigger('change');
}
};
@@ -3118,7 +3265,7 @@ S2.define('select2/data/select',[
if ($(data.element).is('option')) {
data.element.selected = false;
- this.$element.trigger('change');
+ this.$element.trigger('input').trigger('change');
return;
}
@@ -3136,7 +3283,7 @@ S2.define('select2/data/select',[
self.$element.val(val);
- self.$element.trigger('change');
+ self.$element.trigger('input').trigger('change');
});
};
@@ -3158,7 +3305,7 @@ S2.define('select2/data/select',[
// Remove anything added to child elements
this.$element.find('*').each(function () {
// Remove any custom data set by Select2
- $.removeData(this, 'data');
+ Utils.RemoveData(this);
});
};
@@ -3231,7 +3378,7 @@ S2.define('select2/data/select',[
normalizedData.element = option;
// Override the option's data with the combined data
- $.data(option, 'data', normalizedData);
+ Utils.StoreData(option, 'data', normalizedData);
return $option;
};
@@ -3239,7 +3386,7 @@ S2.define('select2/data/select',[
SelectAdapter.prototype.item = function ($option) {
var data = {};
- data = $.data($option[0], 'data');
+ data = Utils.GetData($option[0], 'data');
if (data != null) {
return data;
@@ -3277,13 +3424,13 @@ S2.define('select2/data/select',[
data = this._normalizeItem(data);
data.element = $option[0];
- $.data($option[0], 'data', data);
+ Utils.StoreData($option[0], 'data', data);
return data;
};
SelectAdapter.prototype._normalizeItem = function (item) {
- if (!$.isPlainObject(item)) {
+ if (item !== Object(item)) {
item = {
id: item,
text: item
@@ -3329,15 +3476,19 @@ S2.define('select2/data/array',[
'jquery'
], function (SelectAdapter, Utils, $) {
function ArrayAdapter ($element, options) {
- var data = options.get('data') || [];
+ this._dataToConvert = options.get('data') || [];
ArrayAdapter.__super__.constructor.call(this, $element, options);
-
- this.addOptions(this.convertToOptions(data));
}
Utils.Extend(ArrayAdapter, SelectAdapter);
+ ArrayAdapter.prototype.bind = function (container, $container) {
+ ArrayAdapter.__super__.bind.call(this, container, $container);
+
+ this.addOptions(this.convertToOptions(this._dataToConvert));
+ };
+
ArrayAdapter.prototype.select = function (data) {
var $option = this.$element.find('option').filter(function (i, elm) {
return elm.value == data.id.toString();
@@ -3487,7 +3638,8 @@ S2.define('select2/data/ajax',[
}, function () {
// Attempt to detect if a request was aborted
// Only works if the transport exposes a status property
- if ($request.status && $request.status === '0') {
+ if ('status' in $request &&
+ ($request.status === 0 || $request.status === '0')) {
return;
}
@@ -3626,8 +3778,6 @@ S2.define('select2/data/tags',[
};
Tags.prototype._removeOldTags = function (_) {
- var tag = this._lastTag;
-
var $options = this.$element.find('option[data-select2-tag]');
$options.each(function () {
@@ -3702,7 +3852,7 @@ S2.define('select2/data/tokenizer',[
// Replace the search term if we have the search box
if (this.$search.length) {
this.$search.val(tokenData.term);
- this.$search.focus();
+ this.$search.trigger('focus');
}
params.term = tokenData.term;
@@ -3831,10 +3981,30 @@ S2.define('select2/data/maximumSelectionLength',[
decorated.call(this, $e, options);
}
+ MaximumSelectionLength.prototype.bind =
+ function (decorated, container, $container) {
+ var self = this;
+
+ decorated.call(this, container, $container);
+
+ container.on('select', function () {
+ self._checkIfMaximumSelected();
+ });
+ };
+
MaximumSelectionLength.prototype.query =
function (decorated, params, callback) {
var self = this;
+ this._checkIfMaximumSelected(function () {
+ decorated.call(self, params, callback);
+ });
+ };
+
+ MaximumSelectionLength.prototype._checkIfMaximumSelected =
+ function (_, successCallback) {
+ var self = this;
+
this.current(function (currentData) {
var count = currentData != null ? currentData.length : 0;
if (self.maximumSelectionLength > 0 &&
@@ -3847,7 +4017,10 @@ S2.define('select2/data/maximumSelectionLength',[
});
return;
}
- decorated.call(self, params, callback);
+
+ if (successCallback) {
+ successCallback();
+ }
});
};
@@ -3886,7 +4059,7 @@ S2.define('select2/dropdown',[
};
Dropdown.prototype.position = function ($dropdown, $container) {
- // Should be implmented in subclasses
+ // Should be implemented in subclasses
};
Dropdown.prototype.destroy = function () {
@@ -3910,7 +4083,7 @@ S2.define('select2/dropdown/search',[
'' +
' ' +
+ ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' +
' '
);
@@ -3925,6 +4098,8 @@ S2.define('select2/dropdown/search',[
Search.prototype.bind = function (decorated, container, $container) {
var self = this;
+ var resultsId = container.id + '-results';
+
decorated.call(this, container, $container);
this.$search.on('keydown', function (evt) {
@@ -3947,23 +4122,27 @@ S2.define('select2/dropdown/search',[
container.on('open', function () {
self.$search.attr('tabindex', 0);
+ self.$search.attr('aria-controls', resultsId);
- self.$search.focus();
+ self.$search.trigger('focus');
window.setTimeout(function () {
- self.$search.focus();
+ self.$search.trigger('focus');
}, 0);
});
container.on('close', function () {
self.$search.attr('tabindex', -1);
+ self.$search.removeAttr('aria-controls');
+ self.$search.removeAttr('aria-activedescendant');
self.$search.val('');
+ self.$search.trigger('blur');
});
container.on('focus', function () {
if (!container.isOpen()) {
- self.$search.focus();
+ self.$search.trigger('focus');
}
});
@@ -3978,6 +4157,14 @@ S2.define('select2/dropdown/search',[
}
}
});
+
+ container.on('results:focus', function (params) {
+ if (params.data._resultId) {
+ self.$search.attr('aria-activedescendant', params.data._resultId);
+ } else {
+ self.$search.removeAttr('aria-activedescendant');
+ }
+ });
};
Search.prototype.handleSearch = function (evt) {
@@ -4062,6 +4249,7 @@ S2.define('select2/dropdown/infiniteScroll',[
if (this.showLoadingMore(data)) {
this.$results.append(this.$loadingMore);
+ this.loadMoreIfNeeded();
}
};
@@ -4080,25 +4268,27 @@ S2.define('select2/dropdown/infiniteScroll',[
self.loading = true;
});
- this.$results.on('scroll', function () {
- var isLoadMoreVisible = $.contains(
- document.documentElement,
- self.$loadingMore[0]
- );
+ this.$results.on('scroll', this.loadMoreIfNeeded.bind(this));
+ };
- if (self.loading || !isLoadMoreVisible) {
- return;
- }
+ InfiniteScroll.prototype.loadMoreIfNeeded = function () {
+ var isLoadMoreVisible = $.contains(
+ document.documentElement,
+ this.$loadingMore[0]
+ );
- var currentOffset = self.$results.offset().top +
- self.$results.outerHeight(false);
- var loadingMoreOffset = self.$loadingMore.offset().top +
- self.$loadingMore.outerHeight(false);
+ if (this.loading || !isLoadMoreVisible) {
+ return;
+ }
- if (currentOffset + 50 >= loadingMoreOffset) {
- self.loadMore();
- }
- });
+ var currentOffset = this.$results.offset().top +
+ this.$results.outerHeight(false);
+ var loadingMoreOffset = this.$loadingMore.offset().top +
+ this.$loadingMore.outerHeight(false);
+
+ if (currentOffset + 50 >= loadingMoreOffset) {
+ this.loadMore();
+ }
};
InfiniteScroll.prototype.loadMore = function () {
@@ -4119,7 +4309,7 @@ S2.define('select2/dropdown/infiniteScroll',[
var $option = $(
' '
+ 'role="option" aria-disabled="true">'
);
var message = this.options.get('translations').get('loadingMore');
@@ -4137,7 +4327,7 @@ S2.define('select2/dropdown/attachBody',[
'../utils'
], function ($, Utils) {
function AttachBody (decorated, $element, options) {
- this.$dropdownParent = options.get('dropdownParent') || $(document.body);
+ this.$dropdownParent = $(options.get('dropdownParent') || document.body);
decorated.call(this, $element, options);
}
@@ -4145,27 +4335,14 @@ S2.define('select2/dropdown/attachBody',[
AttachBody.prototype.bind = function (decorated, container, $container) {
var self = this;
- var setupResultsEvents = false;
-
decorated.call(this, container, $container);
container.on('open', function () {
self._showDropdown();
self._attachPositioningHandler(container);
- if (!setupResultsEvents) {
- setupResultsEvents = true;
-
- container.on('results:all', function () {
- self._positionDropdown();
- self._resizeDropdown();
- });
-
- container.on('results:append', function () {
- self._positionDropdown();
- self._resizeDropdown();
- });
- }
+ // Must bind after the results handlers to ensure correct sizing
+ self._bindContainerResultHandlers(container);
});
container.on('close', function () {
@@ -4214,6 +4391,44 @@ S2.define('select2/dropdown/attachBody',[
this.$dropdownContainer.detach();
};
+ AttachBody.prototype._bindContainerResultHandlers =
+ function (decorated, container) {
+
+ // These should only be bound once
+ if (this._containerResultsHandlersBound) {
+ return;
+ }
+
+ var self = this;
+
+ container.on('results:all', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+
+ container.on('results:append', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+
+ container.on('results:message', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+
+ container.on('select', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+
+ container.on('unselect', function () {
+ self._positionDropdown();
+ self._resizeDropdown();
+ });
+
+ this._containerResultsHandlersBound = true;
+ };
+
AttachBody.prototype._attachPositioningHandler =
function (decorated, container) {
var self = this;
@@ -4224,14 +4439,14 @@ S2.define('select2/dropdown/attachBody',[
var $watchers = this.$container.parents().filter(Utils.hasScroll);
$watchers.each(function () {
- $(this).data('select2-scroll-position', {
+ Utils.StoreData(this, 'select2-scroll-position', {
x: $(this).scrollLeft(),
y: $(this).scrollTop()
});
});
$watchers.on(scrollEvent, function (ev) {
- var position = $(this).data('select2-scroll-position');
+ var position = Utils.GetData(this, 'select2-scroll-position');
$(this).scrollTop(position.y);
});
@@ -4290,16 +4505,26 @@ S2.define('select2/dropdown/attachBody',[
top: container.bottom
};
- // Determine what the parent element is to use for calciulating the offset
+ // Determine what the parent element is to use for calculating the offset
var $offsetParent = this.$dropdownParent;
- // For statically positoned elements, we need to get the element
+ // For statically positioned elements, we need to get the element
// that is determining the offset
if ($offsetParent.css('position') === 'static') {
$offsetParent = $offsetParent.offsetParent();
}
- var parentOffset = $offsetParent.offset();
+ var parentOffset = {
+ top: 0,
+ left: 0
+ };
+
+ if (
+ $.contains(document.body, $offsetParent[0]) ||
+ $offsetParent[0].isConnected
+ ) {
+ parentOffset = $offsetParent.offset();
+ }
css.top -= parentOffset.top;
css.left -= parentOffset.left;
@@ -4396,8 +4621,8 @@ S2.define('select2/dropdown/minimumResultsForSearch',[
});
S2.define('select2/dropdown/selectOnClose',[
-
-], function () {
+ '../utils'
+], function (Utils) {
function SelectOnClose () { }
SelectOnClose.prototype.bind = function (decorated, container, $container) {
@@ -4428,7 +4653,7 @@ S2.define('select2/dropdown/selectOnClose',[
return;
}
- var data = $highlightedResults.data('data');
+ var data = Utils.GetData($highlightedResults[0], 'data');
// Don't re-select already selected resulte
if (
@@ -4469,7 +4694,7 @@ S2.define('select2/dropdown/closeOnSelect',[
var originalEvent = evt.originalEvent;
// Don't close if the control key is being held
- if (originalEvent && originalEvent.ctrlKey) {
+ if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) {
return;
}
@@ -4523,6 +4748,9 @@ S2.define('select2/i18n/en',[],function () {
},
searching: function () {
return 'Searching…';
+ },
+ removeAllItems: function () {
+ return 'Remove all items';
}
};
});
@@ -4761,66 +4989,29 @@ S2.define('select2/defaults',[
);
}
- if (typeof options.language === 'string') {
- // Check if the language is specified with a region
- if (options.language.indexOf('-') > 0) {
- // Extract the region information if it is included
- var languageParts = options.language.split('-');
- var baseLanguage = languageParts[0];
+ // If the defaults were not previously applied from an element, it is
+ // possible for the language option to have not been resolved
+ options.language = this._resolveLanguage(options.language);
- options.language = [options.language, baseLanguage];
- } else {
- options.language = [options.language];
+ // Always fall back to English since it will always be complete
+ options.language.push('en');
+
+ var uniqueLanguages = [];
+
+ for (var l = 0; l < options.language.length; l++) {
+ var language = options.language[l];
+
+ if (uniqueLanguages.indexOf(language) === -1) {
+ uniqueLanguages.push(language);
}
}
- if ($.isArray(options.language)) {
- var languages = new Translation();
- options.language.push('en');
+ options.language = uniqueLanguages;
- var languageNames = options.language;
-
- for (var l = 0; l < languageNames.length; l++) {
- var name = languageNames[l];
- var language = {};
-
- try {
- // Try to load it with the original name
- language = Translation.loadPath(name);
- } catch (e) {
- try {
- // If we couldn't load it, check if it wasn't the full path
- name = this.defaults.amdLanguageBase + name;
- language = Translation.loadPath(name);
- } catch (ex) {
- // The translation could not be loaded at all. Sometimes this is
- // because of a configuration problem, other times this can be
- // because of how Select2 helps load all possible translation files.
- if (options.debug && window.console && console.warn) {
- console.warn(
- 'Select2: The language file for "' + name + '" could not be ' +
- 'automatically loaded. A fallback will be used instead.'
- );
- }
-
- continue;
- }
- }
-
- languages.extend(language);
- }
-
- options.translations = languages;
- } else {
- var baseTranslation = Translation.loadPath(
- this.defaults.amdLanguageBase + 'en'
- );
- var customTranslation = new Translation(options.language);
-
- customTranslation.extend(baseTranslation);
-
- options.translations = customTranslation;
- }
+ options.translations = this._processTranslations(
+ options.language,
+ options.debug
+ );
return options;
};
@@ -4887,13 +5078,14 @@ S2.define('select2/defaults',[
debug: false,
dropdownAutoWidth: false,
escapeMarkup: Utils.escapeMarkup,
- language: EnglishTranslation,
+ language: {},
matcher: matcher,
minimumInputLength: 0,
maximumInputLength: 0,
maximumSelectionLength: 0,
minimumResultsForSearch: 0,
selectOnClose: false,
+ scrollAfterSelect: false,
sorter: function (data) {
return data;
},
@@ -4908,6 +5100,103 @@ S2.define('select2/defaults',[
};
};
+ Defaults.prototype.applyFromElement = function (options, $element) {
+ var optionLanguage = options.language;
+ var defaultLanguage = this.defaults.language;
+ var elementLanguage = $element.prop('lang');
+ var parentLanguage = $element.closest('[lang]').prop('lang');
+
+ var languages = Array.prototype.concat.call(
+ this._resolveLanguage(elementLanguage),
+ this._resolveLanguage(optionLanguage),
+ this._resolveLanguage(defaultLanguage),
+ this._resolveLanguage(parentLanguage)
+ );
+
+ options.language = languages;
+
+ return options;
+ };
+
+ Defaults.prototype._resolveLanguage = function (language) {
+ if (!language) {
+ return [];
+ }
+
+ if ($.isEmptyObject(language)) {
+ return [];
+ }
+
+ if ($.isPlainObject(language)) {
+ return [language];
+ }
+
+ var languages;
+
+ if (!$.isArray(language)) {
+ languages = [language];
+ } else {
+ languages = language;
+ }
+
+ var resolvedLanguages = [];
+
+ for (var l = 0; l < languages.length; l++) {
+ resolvedLanguages.push(languages[l]);
+
+ if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) {
+ // Extract the region information if it is included
+ var languageParts = languages[l].split('-');
+ var baseLanguage = languageParts[0];
+
+ resolvedLanguages.push(baseLanguage);
+ }
+ }
+
+ return resolvedLanguages;
+ };
+
+ Defaults.prototype._processTranslations = function (languages, debug) {
+ var translations = new Translation();
+
+ for (var l = 0; l < languages.length; l++) {
+ var languageData = new Translation();
+
+ var language = languages[l];
+
+ if (typeof language === 'string') {
+ try {
+ // Try to load it with the original name
+ languageData = Translation.loadPath(language);
+ } catch (e) {
+ try {
+ // If we couldn't load it, check if it wasn't the full path
+ language = this.defaults.amdLanguageBase + language;
+ languageData = Translation.loadPath(language);
+ } catch (ex) {
+ // The translation could not be loaded at all. Sometimes this is
+ // because of a configuration problem, other times this can be
+ // because of how Select2 helps load all possible translation files
+ if (debug && window.console && console.warn) {
+ console.warn(
+ 'Select2: The language file for "' + language + '" could ' +
+ 'not be automatically loaded. A fallback will be used instead.'
+ );
+ }
+ }
+ }
+ } else if ($.isPlainObject(language)) {
+ languageData = new Translation(language);
+ } else {
+ languageData = language;
+ }
+
+ translations.extend(languageData);
+ }
+
+ return translations;
+ };
+
Defaults.prototype.set = function (key, value) {
var camelKey = $.camelCase(key);
@@ -4916,7 +5205,7 @@ S2.define('select2/defaults',[
var convertedData = Utils._convertData(data);
- $.extend(this.defaults, convertedData);
+ $.extend(true, this.defaults, convertedData);
};
var defaults = new Defaults();
@@ -4937,6 +5226,10 @@ S2.define('select2/options',[
this.fromElement($element);
}
+ if ($element != null) {
+ this.options = Defaults.applyFromElement(this.options, $element);
+ }
+
this.options = Defaults.apply(this.options);
if ($element && $element.is('input')) {
@@ -4960,14 +5253,6 @@ S2.define('select2/options',[
this.options.disabled = $e.prop('disabled');
}
- if (this.options.language == null) {
- if ($e.prop('lang')) {
- this.options.language = $e.prop('lang').toLowerCase();
- } else if ($e.closest('[lang]').prop('lang')) {
- this.options.language = $e.closest('[lang]').prop('lang');
- }
- }
-
if (this.options.dir == null) {
if ($e.prop('dir')) {
this.options.dir = $e.prop('dir');
@@ -4981,7 +5266,7 @@ S2.define('select2/options',[
$e.prop('disabled', this.options.disabled);
$e.prop('multiple', this.options.multiple);
- if ($e.data('select2Tags')) {
+ if (Utils.GetData($e[0], 'select2Tags')) {
if (this.options.debug && window.console && console.warn) {
console.warn(
'Select2: The `data-select2-tags` attribute has been changed to ' +
@@ -4990,11 +5275,11 @@ S2.define('select2/options',[
);
}
- $e.data('data', $e.data('select2Tags'));
- $e.data('tags', true);
+ Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags'));
+ Utils.StoreData($e[0], 'tags', true);
}
- if ($e.data('ajaxUrl')) {
+ if (Utils.GetData($e[0], 'ajaxUrl')) {
if (this.options.debug && window.console && console.warn) {
console.warn(
'Select2: The `data-ajax-url` attribute has been changed to ' +
@@ -5003,21 +5288,45 @@ S2.define('select2/options',[
);
}
- $e.attr('ajax--url', $e.data('ajaxUrl'));
- $e.data('ajax--url', $e.data('ajaxUrl'));
+ $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl'));
+ Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl'));
}
var dataset = {};
+ function upperCaseLetter(_, letter) {
+ return letter.toUpperCase();
+ }
+
+ // Pre-load all of the attributes which are prefixed with `data-`
+ for (var attr = 0; attr < $e[0].attributes.length; attr++) {
+ var attributeName = $e[0].attributes[attr].name;
+ var prefix = 'data-';
+
+ if (attributeName.substr(0, prefix.length) == prefix) {
+ // Get the contents of the attribute after `data-`
+ var dataName = attributeName.substring(prefix.length);
+
+ // Get the data contents from the consistent source
+ // This is more than likely the jQuery data helper
+ var dataValue = Utils.GetData($e[0], dataName);
+
+ // camelCase the attribute name to match the spec
+ var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter);
+
+ // Store the data attribute contents into the dataset since
+ dataset[camelDataName] = dataValue;
+ }
+ }
+
// Prefer the element's `dataset` attribute if it exists
// jQuery 1.x does not correctly handle data attributes with multiple dashes
if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
- dataset = $.extend(true, {}, $e[0].dataset, $e.data());
- } else {
- dataset = $e.data();
+ dataset = $.extend(true, {}, $e[0].dataset, dataset);
}
- var data = $.extend(true, {}, dataset);
+ // Prefer our internal data cache if it exists
+ var data = $.extend(true, {}, Utils.GetData($e[0]), dataset);
data = Utils._convertData(data);
@@ -5054,8 +5363,8 @@ S2.define('select2/core',[
'./keys'
], function ($, Options, Utils, KEYS) {
var Select2 = function ($element, options) {
- if ($element.data('select2') != null) {
- $element.data('select2').destroy();
+ if (Utils.GetData($element[0], 'select2') != null) {
+ Utils.GetData($element[0], 'select2').destroy();
}
this.$element = $element;
@@ -5071,7 +5380,7 @@ S2.define('select2/core',[
// Set up the tabindex
var tabindex = $element.attr('tabindex') || 0;
- $element.data('old-tabindex', tabindex);
+ Utils.StoreData($element[0], 'old-tabindex', tabindex);
$element.attr('tabindex', '-1');
// Set up containers and adapters
@@ -5132,6 +5441,9 @@ S2.define('select2/core',[
// Synchronize any monitored attributes
this._syncAttributes();
+ Utils.StoreData($element[0], 'select2', this);
+
+ // Ensure backwards compatibility with $element.data('select2').
$element.data('select2', this);
};
@@ -5208,6 +5520,12 @@ S2.define('select2/core',[
return null;
}
+ if (method == 'computedstyle') {
+ var computedStyle = window.getComputedStyle($element[0]);
+
+ return computedStyle.width;
+ }
+
return method;
};
@@ -5248,8 +5566,8 @@ S2.define('select2/core',[
if (observer != null) {
this._observer = new observer(function (mutations) {
- $.each(mutations, self._syncA);
- $.each(mutations, self._syncS);
+ self._syncA();
+ self._syncS(null, mutations);
});
this._observer.observe(this.$element[0], {
attributes: true,
@@ -5371,7 +5689,7 @@ S2.define('select2/core',[
if (self.isOpen()) {
if (key === KEYS.ESC || key === KEYS.TAB ||
(key === KEYS.UP && evt.altKey)) {
- self.close();
+ self.close(evt);
evt.preventDefault();
} else if (key === KEYS.ENTER) {
@@ -5405,7 +5723,7 @@ S2.define('select2/core',[
Select2.prototype._syncAttributes = function () {
this.options.set('disabled', this.$element.prop('disabled'));
- if (this.options.get('disabled')) {
+ if (this.isDisabled()) {
if (this.isOpen()) {
this.close();
}
@@ -5416,7 +5734,7 @@ S2.define('select2/core',[
}
};
- Select2.prototype._syncSubtree = function (evt, mutations) {
+ Select2.prototype._isChangeMutation = function (evt, mutations) {
var changed = false;
var self = this;
@@ -5444,7 +5762,22 @@ S2.define('select2/core',[
}
} else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
changed = true;
+ } else if ($.isArray(mutations)) {
+ $.each(mutations, function(evt, mutation) {
+ if (self._isChangeMutation(evt, mutation)) {
+ // We've found a change mutation.
+ // Let's escape from the loop and continue
+ changed = true;
+ return false;
+ }
+ });
}
+ return changed;
+ };
+
+ Select2.prototype._syncSubtree = function (evt, mutations) {
+ var changed = this._isChangeMutation(evt, mutations);
+ var self = this;
// Only re-pull the data if we think there is a change
if (changed) {
@@ -5466,7 +5799,8 @@ S2.define('select2/core',[
'open': 'opening',
'close': 'closing',
'select': 'selecting',
- 'unselect': 'unselecting'
+ 'unselect': 'unselecting',
+ 'clear': 'clearing'
};
if (args === undefined) {
@@ -5494,7 +5828,7 @@ S2.define('select2/core',[
};
Select2.prototype.toggleDropdown = function () {
- if (this.options.get('disabled')) {
+ if (this.isDisabled()) {
return;
}
@@ -5510,15 +5844,40 @@ S2.define('select2/core',[
return;
}
+ if (this.isDisabled()) {
+ return;
+ }
+
this.trigger('query', {});
};
- Select2.prototype.close = function () {
+ Select2.prototype.close = function (evt) {
if (!this.isOpen()) {
return;
}
- this.trigger('close', {});
+ this.trigger('close', { originalEvent : evt });
+ };
+
+ /**
+ * Helper method to abstract the "enabled" (not "disabled") state of this
+ * object.
+ *
+ * @return {true} if the instance is not disabled.
+ * @return {false} if the instance is disabled.
+ */
+ Select2.prototype.isEnabled = function () {
+ return !this.isDisabled();
+ };
+
+ /**
+ * Helper method to abstract the "disabled" state of this object.
+ *
+ * @return {true} if the disabled option is true.
+ * @return {false} if the disabled option is false.
+ */
+ Select2.prototype.isDisabled = function () {
+ return this.options.get('disabled');
};
Select2.prototype.isOpen = function () {
@@ -5595,7 +5954,7 @@ S2.define('select2/core',[
});
}
- this.$element.val(newVal).trigger('change');
+ this.$element.val(newVal).trigger('input').trigger('change');
};
Select2.prototype.destroy = function () {
@@ -5621,10 +5980,12 @@ S2.define('select2/core',[
this._syncS = null;
this.$element.off('.select2');
- this.$element.attr('tabindex', this.$element.data('old-tabindex'));
+ this.$element.attr('tabindex',
+ Utils.GetData(this.$element[0], 'old-tabindex'));
this.$element.removeClass('select2-hidden-accessible');
this.$element.attr('aria-hidden', 'false');
+ Utils.RemoveData(this.$element[0]);
this.$element.removeData('select2');
this.dataAdapter.destroy();
@@ -5652,7 +6013,7 @@ S2.define('select2/core',[
this.$container.addClass('select2-container--' + this.options.get('theme'));
- $container.data('element', this.$element);
+ Utils.StoreData($container[0], 'element', this.$element);
return $container;
};
@@ -5672,8 +6033,9 @@ S2.define('jquery.select2',[
'jquery-mousewheel',
'./select2/core',
- './select2/defaults'
-], function ($, _, Select2, Defaults) {
+ './select2/defaults',
+ './select2/utils'
+], function ($, _, Select2, Defaults, Utils) {
if ($.fn.select2 == null) {
// All methods that should return the element
var thisMethods = ['open', 'close', 'destroy'];
@@ -5694,7 +6056,7 @@ S2.define('jquery.select2',[
var args = Array.prototype.slice.call(arguments, 1);
this.each(function () {
- var instance = $(this).data('select2');
+ var instance = Utils.GetData(this, 'select2');
if (instance == null && window.console && console.error) {
console.error(
diff --git a/htdocs/includes/jquery/plugins/select2/dist/js/select2.min.js b/htdocs/includes/jquery/plugins/select2/dist/js/select2.min.js
index 7ef2fda809e..e4214264342 100644
--- a/htdocs/includes/jquery/plugins/select2/dist/js/select2.min.js
+++ b/htdocs/includes/jquery/plugins/select2/dist/js/select2.min.js
@@ -1 +1,2 @@
-/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return v.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o=b&&b.split("/"),p=t.map,q=p&&p["*"]||{};if(a){for(a=a.split("/"),g=a.length-1,t.nodeIdCompat&&x.test(a[g])&&(a[g]=a[g].replace(x,"")),"."===a[0].charAt(0)&&o&&(n=o.slice(0,o.length-1),a=n.concat(a)),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}if((o||q)&&p){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),o)for(l=o.length;l>0;l-=1)if((e=p[o.slice(0,l).join("/")])&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=w.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),o.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){r[a]=b}}function j(a){if(e(s,a)){var c=s[a];delete s[a],u[a]=!0,n.apply(b,c)}if(!e(r,a)&&!e(u,a))throw new Error("No "+a);return r[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return a?k(a):[]}function m(a){return function(){return t&&t.config&&t.config[a]||{}}}var n,o,p,q,r={},s={},t={},u={},v=Object.prototype.hasOwnProperty,w=[].slice,x=/\.js$/;p=function(a,b){var c,d=k(a),e=d[0],g=b[1];return a=d[1],e&&(e=f(e,g),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(g)):f(a,g):(a=f(a,g),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},q={require:function(a){return g(a)},exports:function(a){var b=r[a];return void 0!==b?b:r[a]={}},module:function(a){return{id:a,uri:"",exports:r[a],config:m(a)}}},n=function(a,c,d,f){var h,k,m,n,o,t,v,w=[],x=typeof d;if(f=f||a,t=l(f),"undefined"===x||"function"===x){for(c=!c.length&&d.length?["require","exports","module"]:c,o=0;o0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a(' '),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()});b.$results.find(".select2-results__option[aria-selected]").each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j",{class:"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):h-g<0&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");if("true"===c.attr("aria-selected"))return void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{}));d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),c<=2?this.$results.scrollTop(0):(g>this.$results.outerHeight()||g<0)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a(' ');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id,a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2");a(".select2.select2-container--open").each(function(){var b=a(this);this!=d[0]&&b.data("element").select2("close")})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){b.find(".selection").append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html(' '),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},e.prototype.selectionContainer=function(){return a(" ")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html(''),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},d.prototype.selectionContainer=function(){return a('× ')},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d1||c)return a.call(this,b);this.clear();var d=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(d)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e0||0===c.length)){var d=a('× ');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a(' ');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){if(a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented(),a.which===c.BACKSPACE&&""===e.$search.val()){var b=e.$searchContainer.prev(".select2-selection__choice");if(b.length>0){var d=b.data("data");e.searchRemoveChoice(d),a.preventDefault()}}});var f=document.documentMode,g=f&&f<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){if(g)return void e.$selection.off("input.search input.searchcheck");e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{a=.75*(this.$search.val().length+1)+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"}}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),null!=c.id?d+="-"+c.id.toString():d+="-"+a.generateChars(4),d},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength)return void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;if(d.maximumSelectionLength>0&&f>=d.maximumSelectionLength)return void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}});a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a(' ');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a(' ');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()||e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){e.showSearch(a)?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){e.$results.offset().top+e.$results.outerHeight(!1)+50>=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1)&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a(' '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(" "),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id;this.$container.parents().filter(b.hasScroll).off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),null==l.tokenSeparators&&null==l.tokenizer||(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){null==c(d,e.children[g])&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var h=b(e.text).toUpperCase(),i=b(d.term).toUpperCase();return h.indexOf(i)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)},new D}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return e<=0?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;h=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=a&&0!==a.length||(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a(' ');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if("object"==typeof(b=b||{}))return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
\ No newline at end of file
+/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
+!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(u){var e=function(){if(u&&u.fn&&u.fn.select2&&u.fn.select2.amd)var e=u.fn.select2.amd;var t,n,r,h,o,s,f,g,m,v,y,_,i,a,b;function w(e,t){return i.call(e,t)}function l(e,t){var n,r,i,o,s,a,l,c,u,d,p,h=t&&t.split("/"),f=y.map,g=f&&f["*"]||{};if(e){for(s=(e=e.split("/")).length-1,y.nodeIdCompat&&b.test(e[s])&&(e[s]=e[s].replace(b,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.length-1).concat(e)),u=0;u":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},i.appendMany=function(e,t){if("1.7"===o.fn.jquery.substr(0,3)){var n=o();o.map(t,function(e){n=n.add(e)}),t=n}e.append(t)},i.__cache={};var n=0;return i.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null==t&&(e.id?(t=e.id,e.setAttribute("data-select2-id",t)):(e.setAttribute("data-select2-id",++n),t=n.toString())),t},i.StoreData=function(e,t,n){var r=i.GetUniqueElementId(e);i.__cache[r]||(i.__cache[r]={}),i.__cache[r][t]=n},i.GetData=function(e,t){var n=i.GetUniqueElementId(e);return t?i.__cache[n]&&null!=i.__cache[n][t]?i.__cache[n][t]:o(e).data(t):i.__cache[n]},i.RemoveData=function(e){var t=i.GetUniqueElementId(e);null!=i.__cache[t]&&delete i.__cache[t],e.removeAttribute("data-select2-id")},i}),e.define("select2/results",["jquery","./utils"],function(h,f){function r(e,t,n){this.$element=e,this.data=n,this.options=t,r.__super__.constructor.call(this)}return f.Extend(r,f.Observable),r.prototype.render=function(){var e=h('');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},r.prototype.clear=function(){this.$results.empty()},r.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h(' '),r=this.options.get("translations").get(e.message);n.append(t(r(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},r.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},r.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n",{class:"select2-results__options select2-results__options--nested"});p.append(l),s.append(a),s.append(p)}else this.template(e,t);return f.StoreData(t,"data",e),t},r.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=f.GetData(e[0],"data");"true"==e.attr("aria-selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e);if(!(n<=0)){var r=n-1;0===e.length&&(r=0);var i=t.eq(r);i.trigger("mouseenter");var o=l.$results.offset().top,s=i.offset().top,a=l.$results.scrollTop()+(s-o);0===r?l.$results.scrollTop(0):s-o<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e)+1;if(!(n>=t.length)){var r=t.eq(n);r.trigger("mouseenter");var i=l.$results.offset().top+l.$results.outerHeight(!1),o=r.offset().top+r.outerHeight(!1),s=l.$results.scrollTop()+o-i;0===n?l.$results.scrollTop(0):ithis.$results.outerHeight()||o<0)&&this.$results.scrollTop(i)}},r.prototype.template=function(e,t){var n=this.options.get("templateResult"),r=this.options.get("escapeMarkup"),i=n(e,t);null==i?t.style.display="none":"string"==typeof i?t.innerHTML=r(i):h(t).append(i)},r}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(n,r,i){function o(e,t){this.$element=e,this.options=t,o.__super__.constructor.call(this)}return r.Extend(o,r.Observable),o.prototype.render=function(){var e=n(' ');return this._tabindex=0,null!=r.GetData(this.$element[0],"old-tabindex")?this._tabindex=r.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),e.attr("aria-disabled","false"),this.$selection=e},o.prototype.bind=function(e,t){var n=this,r=e.id+"-results";this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===i.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",r),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),n.$selection.trigger("focus"),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex),n.$selection.attr("aria-disabled","false")}),e.on("disable",function(){n.$selection.attr("tabindex","-1"),n.$selection.attr("aria-disabled","true")})},o.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||n.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},o.prototype._attachCloseHandler=function(e){n(document.body).on("mousedown.select2."+e.id,function(e){var t=n(e.target).closest(".select2");n(".select2.select2-container--open").each(function(){this!=t[0]&&r.GetData(this,"element").select2("close")})})},o.prototype._detachCloseHandler=function(e){n(document.body).off("mousedown.select2."+e.id)},o.prototype.position=function(e,t){t.find(".selection").append(e)},o.prototype.destroy=function(){this._detachCloseHandler(this.container)},o.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},o.prototype.isEnabled=function(){return!this.isDisabled()},o.prototype.isDisabled=function(){return this.options.get("disabled")},o}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,r){function i(){i.__super__.constructor.apply(this,arguments)}return n.Extend(i,t),i.prototype.render=function(){var e=i.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html(' '),e},i.prototype.bind=function(t,e){var n=this;i.__super__.bind.apply(this,arguments);var r=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",r).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",r),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.trigger("focus")})},i.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},i.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},i.prototype.selectionContainer=function(){return e(" ")},i.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),r=this.display(t,n);n.empty().append(r);var i=t.title||t.text;i?n.attr("title",i):n.removeAttr("title")}else this.clear()},i}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,l){function n(e,t){n.__super__.constructor.apply(this,arguments)}return l.Extend(n,e),n.prototype.render=function(){var e=n.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html(''),e},n.prototype.bind=function(e,t){var r=this;n.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){r.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!r.isDisabled()){var t=i(this).parent(),n=l.GetData(t[0],"data");r.trigger("unselect",{originalEvent:e,data:n})}})},n.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},n.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},n.prototype.selectionContainer=function(){return i('× ')},n.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n× ');a.StoreData(r[0],"data",t),this.$selection.find(".select2-selection__rendered").prepend(r)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(r,a,l){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=r(' ');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},e.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),t.on("open",function(){r.$search.attr("aria-controls",i),r.$search.trigger("focus")}),t.on("close",function(){r.$search.val(""),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.trigger("focus")}),t.on("enable",function(){r.$search.prop("disabled",!1),r._transferTabIndex()}),t.on("disable",function(){r.$search.prop("disabled",!0)}),t.on("focus",function(e){r.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){r.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){r._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented(),e.which===l.BACKSPACE&&""===r.$search.val()){var t=r.$searchContainer.prev(".select2-selection__choice");if(0this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(){r._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var r=this;this._checkIfMaximumSelected(function(){e.call(r,t,n)})},e.prototype._checkIfMaximumSelected=function(e,n){var r=this;this.current(function(e){var t=null!=e?e.length:0;0=r.maximumSelectionLength?r.trigger("results:message",{message:"maximumSelected",args:{maximum:r.maximumSelectionLength}}):n&&n()})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t(' ');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(o,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=o(' ');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){r.handleSearch(e)}),t.on("open",function(){r.$search.attr("tabindex",0),r.$search.attr("aria-controls",i),r.$search.trigger("focus"),window.setTimeout(function(){r.$search.trigger("focus")},0)}),t.on("close",function(){r.$search.attr("tabindex",-1),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.val(""),r.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||r.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(r.showSearch(e)?r.$searchContainer.removeClass("select2-search--hide"):r.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,r){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,r)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),r=t.length-1;0<=r;r--){var i=t[r];this.placeholder.id===i.id&&n.splice(r,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,r){this.lastParams={},e.call(this,t,n,r),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("query",function(e){r.lastParams=e,r.loading=!0}),t.on("query:append",function(e){r.lastParams=e,r.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);if(!this.loading&&e){var t=this.$results.offset().top+this.$results.outerHeight(!1);this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=t+50&&this.loadMore()}},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n(' '),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=f(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("open",function(){r._showDropdown(),r._attachPositioningHandler(t),r._bindContainerResultHandlers(t)}),t.on("close",function(){r._hideDropdown(),r._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f(" "),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){if(!this._containerResultsHandlersBound){var n=this;t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0}},e.prototype._attachPositioningHandler=function(e,t){var n=this,r="scroll.select2."+t.id,i="resize.select2."+t.id,o="orientationchange.select2."+t.id,s=this.$container.parents().filter(a.hasScroll);s.each(function(){a.StoreData(this,"select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),s.on(r,function(e){var t=a.GetData(this,"select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(r+" "+i+" "+o,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,r="resize.select2."+t.id,i="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+r+" "+i)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),r=null,i=this.$container.offset();i.bottom=i.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=i.top,o.bottom=i.top+o.height;var s=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=ai.bottom+s,d={left:i.left,top:o.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h={top:0,left:0};(f.contains(document.body,p[0])||p[0].isConnected)&&(h=p.offset()),d.top-=h.top,d.left-=h.left,t||n||(r="below"),u||!c||t?!c&&u&&t&&(r="below"):r="above",("above"==r||t&&"below"!==r)&&(d.top=o.top-h.top-s),null!=r&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+r),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+r)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,r){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,r)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,r=0;r ');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),u.StoreData(e[0],"element",this.$element),e},d}),e.define("jquery-mousewheel",["jquery"],function(e){return e}),e.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(i,e,o,t,s){if(null==i.fn.select2){var a=["open","close","destroy"];i.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=i.extend(!0,{},t);new o(i(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,r=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=s.GetData(this,"select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,r)}),-1
* Original author: Victor Stanciu
*
- * @version 2.8.33
+ * @version 2.8.34
*/
class Mobile_Detect
{
@@ -61,7 +61,7 @@ class Mobile_Detect
/**
* Stores the version number of the current release.
*/
- const VERSION = '2.8.33';
+ const VERSION = '2.8.34';
/**
* A type for the version() method indicating a string return value.
@@ -164,14 +164,14 @@ class Mobile_Detect
*/
protected static $phoneDevices = array(
'iPhone' => '\biPhone\b|\biPod\b', // |\biTunes
- 'BlackBerry' => 'BlackBerry|\bBB10\b|rim[0-9]+',
+ 'BlackBerry' => 'BlackBerry|\bBB10\b|rim[0-9]+|\b(BBA100|BBB100|BBD100|BBE100|BBF100|STH100)\b-[0-9]+',
'HTC' => 'HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6400L|ADR6425|001HT|Inspire 4G|Android.*\bEVO\b|T-Mobile G1|Z520m|Android [0-9.]+; Pixel',
'Nexus' => 'Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile|Nexus 4|Nexus 5|Nexus 6',
// @todo: Is 'Dell Streak' a tablet or a phone? ;)
'Dell' => 'Dell[;]? (Streak|Aero|Venue|Venue Pro|Flash|Smoke|Mini 3iX)|XCD28|XCD35|\b001DL\b|\b101DL\b|\bGS01\b',
'Motorola' => 'Motorola|DROIDX|DROID BIONIC|\bDroid\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925|XT1021|\bMoto E\b|XT1068|XT1092|XT1052',
'Samsung' => '\bSamsung\b|SM-G950F|SM-G955F|SM-G9250|GT-19300|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E|GT-I8750|SM-G9006V|SM-G9008V|SM-G9009D|SM-G900A|SM-G900D|SM-G900F|SM-G900H|SM-G900I|SM-G900J|SM-G900K|SM-G900L|SM-G900M|SM-G900P|SM-G900R4|SM-G900S|SM-G900T|SM-G900V|SM-G900W8|SHV-E160K|SCH-P709|SCH-P729|SM-T2558|GT-I9205|SM-G9350|SM-J120F|SM-G920F|SM-G920V|SM-G930F|SM-N910C|SM-A310F|GT-I9190|SM-J500FN|SM-G903F|SM-J330F',
- 'LG' => '\bLG\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS740|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802|MS323|M257)',
+ 'LG' => '\bLG\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS740|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802|MS323|M257)|LM-G710',
'Sony' => 'SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i|C5303|C6902|C6903|C6906|C6943|D2533',
'Asus' => 'Asus.*Galaxy|PadFone.*Mobile',
'NokiaLumia' => 'Lumia [0-9]{3,4}',
@@ -201,6 +201,7 @@ class Mobile_Detect
'Amoi' => 'Amoi',
// http://en.wikipedia.org/wiki/INQ
'INQ' => 'INQ',
+ 'OnePlus' => 'ONEPLUS',
// @Tapatalk is a mobile app; http://support.tapatalk.com/threads/smf-2-0-2-os-and-browser-detection-plugin-and-tapatalk.15565/#post-79039
'GenericPhone' => 'Tapatalk|PDA;|SAGEM|\bmmp\b|pocket|\bpsp\b|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|\bwap\b|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser',
);
@@ -219,7 +220,7 @@ class Mobile_Detect
'NexusTablet' => 'Android.*Nexus[\s]+(7|9|10)',
// https://en.wikipedia.org/wiki/Pixel_C
'GoogleTablet' => 'Android.*Pixel C',
- 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A|SM-T707A|SM-T807A|SM-T237|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-T116BU|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T815|SM-T360|SM-T533|SM-T113|SM-T335|SM-T715|SM-T560|SM-T670|SM-T677|SM-T377|SM-T567|SM-T357T|SM-T555|SM-T561|SM-T713|SM-T719|SM-T813|SM-T819|SM-T580|SM-T355Y?|SM-T280|SM-T817A|SM-T820|SM-W700|SM-P580|SM-T587|SM-P350|SM-P555M|SM-P355M|SM-T113NU|SM-T815Y|SM-T585|SM-T285|SM-T825|SM-W708|SM-T835', // SCH-P709|SCH-P729|SM-T2558|GT-I9205 - Samsung Mega - treat them like a regular phone.
+ 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A|SM-T707A|SM-T807A|SM-T237|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-T116BU|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T815|SM-T360|SM-T533|SM-T113|SM-T335|SM-T715|SM-T560|SM-T670|SM-T677|SM-T377|SM-T567|SM-T357T|SM-T555|SM-T561|SM-T713|SM-T719|SM-T813|SM-T819|SM-T580|SM-T355Y?|SM-T280|SM-T817A|SM-T820|SM-W700|SM-P580|SM-T587|SM-P350|SM-P555M|SM-P355M|SM-T113NU|SM-T815Y|SM-T585|SM-T285|SM-T825|SM-W708|SM-T835|SM-T830|SM-T837V|SM-T720|SM-T510|SM-T387V', // SCH-P709|SCH-P729|SM-T2558|GT-I9205 - Samsung Mega - treat them like a regular phone.
// http://docs.aws.amazon.com/silk/latest/developerguide/user-agent.html
'Kindle' => 'Kindle|Silk.*Accelerated|Android.*\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE|KFSAWA|KFSAWI|KFASWI|KFARWI|KFFOWI|KFGIWI|KFMEWI)\b|Android.*Silk/[0-9.]+ like Chrome/[0-9.]+ (?!Mobile)',
// Only the Surface tablets with Windows RT are considered mobile.
@@ -251,7 +252,7 @@ class Mobile_Detect
// Prestigio Tablets http://www.prestigio.com/support
'PrestigioTablet' => 'PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD|PMP812E|PMP812E3G|PMP812F|PMP810E|PMP880TD|PMT3017|PMT3037|PMT3047|PMT3057|PMT7008|PMT5887|PMT5001|PMT5002',
// http://support.lenovo.com/en_GB/downloads/default.page?#
- 'LenovoTablet' => 'Lenovo TAB|Idea(Tab|Pad)( A1|A10| K1|)|ThinkPad([ ]+)?Tablet|YT3-850M|YT3-X90L|YT3-X90F|YT3-X90X|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A3500|A1000|A2107|A2109|A1107|A5500|A7600|B6000|B8000|B8080)(-|)(FL|F|HV|H|)|TB-X103F|TB-X304F|TB-X304L|TB-8703F|Tab2A7-10F|TB2-X30L',
+ 'LenovoTablet' => 'Lenovo TAB|Idea(Tab|Pad)( A1|A10| K1|)|ThinkPad([ ]+)?Tablet|YT3-850M|YT3-X90L|YT3-X90F|YT3-X90X|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A3500|A1000|A2107|A2109|A1107|A5500|A7600|B6000|B8000|B8080)(-|)(FL|F|HV|H|)|TB-X103F|TB-X304X|TB-X304F|TB-X304L|TB-X505F|TB-X505L|TB-X505X|TB-X605F|TB-X605L|TB-8703F|TB-8703X|TB-8703N|TB-8704N|TB-8704F|TB-8704X|TB-8704V|TB-7304F|TB-7304I|TB-7304X|Tab2A7-10F|Tab2A7-20F|TB2-X30L|YT3-X50L|YT3-X50F|YT3-X50M|YT-X705F|YT-X703F|YT-X703L|YT-X705L|YT-X705X|TB2-X30F|TB2-X30L|TB2-X30M|A2107A-F|A2107A-H|TB3-730F|TB3-730M|TB3-730X|TB-7504F|TB-7504X',
// http://www.dell.com/support/home/us/en/04/Products/tab_mob/tablets
'DellTablet' => 'Venue 11|Venue 8|Venue 7|Dell Streak 10|Dell Streak 7',
// http://www.yarvik.com/en/matrix/tablets/
@@ -301,10 +302,10 @@ class Mobile_Detect
// http://www.fly-phone.com/devices/tablets/ ; http://www.fly-phone.com/service/
'FlyTablet' => 'IQ310|Fly Vision',
// http://www.bqreaders.com/gb/tablets-prices-sale.html
- 'bqTablet' => 'Android.*(bq)?.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant|Aquaris ([E|M]10|M8))|Maxwell.*Lite|Maxwell.*Plus',
+ 'bqTablet' => 'Android.*(bq)?.*\b(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant|Aquaris ([E|M]10|M8))\b|Maxwell.*Lite|Maxwell.*Plus',
// http://www.huaweidevice.com/worldwide/productFamily.do?method=index&directoryId=5011&treeId=3290
// http://www.huaweidevice.com/worldwide/downloadCenter.do?method=index&directoryId=3372&treeId=0&tb=1&type=software (including legacy tablets)
- 'HuaweiTablet' => 'MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim|M2-A01L|BAH-L09|BAH-W09',
+ 'HuaweiTablet' => 'MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim|M2-A01L|BAH-L09|BAH-W09|AGS-L09|CMR-AL19',
// Nec or Medias Tab
'NecTablet' => '\bN-06D|\bN-08D',
// Pantech Tablets: http://www.pantechusa.com/phones/
@@ -314,7 +315,7 @@ class Mobile_Detect
// http://versusuk.com/support.html
'VersusTablet' => 'TOUCHPAD.*[78910]|\bTOUCHTAB\b',
// http://www.zync.in/index.php/our-products/tablet-phablets
- 'ZyncTablet' => 'z1000|Z99 2G|z99|z930|z999|z990|z909|Z919|z900',
+ 'ZyncTablet' => 'z1000|Z99 2G|z930|z990|z909|Z919|z900', // Removed "z999" because of https://github.com/serbanghita/Mobile-Detect/issues/717
// http://www.positivoinformatica.com.br/www/pessoal/tablet-ypy/
'PositivoTablet' => 'TB07STA|TB10STA|TB07FTA|TB10FTA',
// https://www.nabitablet.com/
@@ -377,7 +378,7 @@ class Mobile_Detect
'GoCleverTablet' => 'GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042',
// Modecom Tablets - http://www.modecom.eu/tablets/portal/
'ModecomTablet' => 'FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003',
- // Vonino Tablets - http://www.vonino.eu/tablets
+ // Vonino Tablets
'VoninoTablet' => '\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\bQ8\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\b',
// ECS Tablets - http://www.ecs.com.tw/ECSWebSite/Product/Product_Tablet_List.aspx?CategoryID=14&MenuID=107&childid=M_107&LanID=0
'ECSTablet' => 'V07OT2|TM105A|S10OT1|TR10CS1',
@@ -385,7 +386,7 @@ class Mobile_Detect
// @note: no need to add all the tablet codes since they are guided by the first regex.
'StorexTablet' => 'eZee[_\']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab',
// Generic Vodafone tablets.
- 'VodafoneTablet' => 'SmartTab([ ]+)?[0-9]+|SmartTabII10|SmartTabII7|VF-1497',
+ 'VodafoneTablet' => 'SmartTab([ ]+)?[0-9]+|SmartTabII10|SmartTabII7|VF-1497|VFD 1400',
// French tablets - Essentiel B http://www.boulanger.fr/tablette_tactile_e-book/tablette_tactile_essentiel_b/cl_68908.htm?multiChoiceToDelete=brand&mc_brand=essentielb
// Aka: http://www.essentielb.fr/
'EssentielBTablet' => 'Smart[ \']?TAB[ ]+?[0-9]+|Family[ \']?TAB2',
@@ -484,7 +485,7 @@ class Mobile_Detect
'PalmOS' => 'PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino',
'SymbianOS' => 'Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\bS60\b',
// @reference: http://en.wikipedia.org/wiki/Windows_Mobile
- 'WindowsMobileOS' => 'Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window Mobile|Windows Phone [0-9.]+|WCE;',
+ 'WindowsMobileOS' => 'Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Windows Mobile|Windows Phone [0-9.]+|WCE;',
// @reference: http://en.wikipedia.org/wiki/Windows_Phone
// http://wifeng.cn/?r=blog&a=view&id=106
// http://nicksnettravels.builttoroam.com/post/2011/01/10/Bogus-Windows-Phone-7-User-Agent-String.aspx
@@ -492,6 +493,8 @@ class Mobile_Detect
// https://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx
'WindowsPhoneOS' => 'Windows Phone 10.0|Windows Phone 8.1|Windows Phone 8.0|Windows Phone OS|XBLWP7|ZuneWP7|Windows NT 6.[23]; ARM;',
'iOS' => '\biPhone.*Mobile|\biPod|\biPad|AppleCoreMedia',
+ // https://en.wikipedia.org/wiki/IPadOS
+ 'iPadOS' => 'CPU OS 13',
// http://en.wikipedia.org/wiki/MeeGo
// @todo: research MeeGo in UAs
'MeeGoOS' => 'MeeGo',
@@ -539,7 +542,8 @@ class Mobile_Detect
// https://github.com/serbanghita/Mobile-Detect/issues/7
'DiigoBrowser' => 'DiigoBrowser',
// http://www.puffinbrowser.com/index.php
- 'Puffin' => 'Puffin',
+ // https://github.com/serbanghita/Mobile-Detect/issues/752
+ // 'Puffin' => 'Puffin',
// http://mercury-browser.com/index.html
'Mercury' => '\bMercury\b',
// http://en.wikipedia.org/wiki/Obigo_Browser
@@ -563,7 +567,7 @@ class Mobile_Detect
// http://scottcate.com/technology/windows-phone-8-ie10-desktop-or-mobile/
// https://github.com/serbanghita/Mobile-Detect/issues/57#issuecomment-15024011
// https://developers.facebook.com/docs/sharing/best-practices
- 'Bot' => 'Googlebot|facebookexternalhit|AdsBot-Google|Google Keyword Suggestion|Facebot|YandexBot|YandexMobileBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|Exabot|MJ12bot|YandexImages|TurnitinBot|Pingdom',
+ 'Bot' => 'Googlebot|facebookexternalhit|Google-AMPHTML|s~amp-validator|AdsBot-Google|Google Keyword Suggestion|Facebot|YandexBot|YandexMobileBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|Exabot|MJ12bot|YandexImages|TurnitinBot|Pingdom|contentkingapp',
'MobileBot' => 'Googlebot-Mobile|AdsBot-Google-Mobile|YahooSeeker/M1A1-R2D2',
'DesktopMode' => 'WPDesktop',
'TV' => 'SonyDTV|HbbTV', // experimental
diff --git a/htdocs/includes/mobiledetect/mobiledetectlib/README.md b/htdocs/includes/mobiledetect/mobiledetectlib/README.md
index 310d9f3661d..d73757b728f 100644
--- a/htdocs/includes/mobiledetect/mobiledetectlib/README.md
+++ b/htdocs/includes/mobiledetect/mobiledetectlib/README.md
@@ -68,13 +68,13 @@ or include the dependency in the `composer.json` file:
#### Demo
-* [:iphone: Live demo!](http://is.gd/mobiletest)
+* [:iphone: Live demo!](http://demo.mobiledetect.net)
* [Code examples](../../wiki/Code-examples)
#### Contribute
*Submit a PR*
-> Submit a pull request but before make sure you read [how to contribute](../../docs/CONTRIBUTING.md) guide.
+> Submit a pull request but before make sure you read [how to contribute](docs/CONTRIBUTING.md) guide.
*Donate*
@@ -92,7 +92,7 @@ Special thanks to the community :+1: for donations, JetBrains team for the conti
> [Submit new module, plugin, port](../../issues/new?title=New%203rd%20party%20module&body=Name,%20Link%20and%20Description%20of%20the%20module.)
:point_right: Keep `Mobile_Detect.php` class in a separate `module` and do NOT include it in your script core because of the high frequency of updates.
-:point_right: When including the class into you `web application` or `module` always use `include_once '../path/to/Mobile_Detect.php` to prevent conflicts.
+:point_right: When including the class into your `web application` or `module` always use `include_once '../path/to/Mobile_Detect.php` to prevent conflicts.
**JavaScript**
diff --git a/htdocs/includes/mobiledetect/mobiledetectlib/composer.json b/htdocs/includes/mobiledetect/mobiledetectlib/composer.json
index 25cd99a375f..738f8f8831f 100644
--- a/htdocs/includes/mobiledetect/mobiledetectlib/composer.json
+++ b/htdocs/includes/mobiledetect/mobiledetectlib/composer.json
@@ -1,31 +1,42 @@
{
- "name": "mobiledetect/mobiledetectlib",
- "type": "library",
- "description": "Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.",
- "keywords": ["mobile", "mobile detect", "mobile detector", "php mobile detect", "detect mobile devices"],
- "homepage": "https://github.com/serbanghita/Mobile-Detect",
- "license": "MIT",
- "authors": [
- {
- "name": "Serban Ghita",
- "email": "serbanghita@gmail.com",
- "homepage": "http://mobiledetect.net",
- "role": "Developer"
- }
- ],
- "require": {
- "php": ">=5.0.0"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.8.35||~5.7"
- },
- "autoload": {
- "classmap": ["Mobile_Detect.php"],
- "psr-0": {
- "Detection": "namespaced/"
- }
- },
- "archive": {
- "exclude": ["docs", "examples", "export"]
- }
-}
+ "name" : "mobiledetect/mobiledetectlib",
+ "type" : "library",
+ "description" : "Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.",
+ "keywords" : [
+ "mobile",
+ "mobile detect",
+ "mobile detector",
+ "php mobile detect",
+ "detect mobile devices"
+ ],
+ "homepage" : "https://github.com/serbanghita/Mobile-Detect",
+ "license" : "MIT",
+ "authors" : [{
+ "name" : "Serban Ghita",
+ "email" : "serbanghita@gmail.com",
+ "homepage" : "http://mobiledetect.net",
+ "role" : "Developer"
+ }
+ ],
+ "require" : {
+ "php" : ">=5.0.0"
+ },
+ "require-dev" : {
+ "phpunit/phpunit" : "~4.8.35||~5.7"
+ },
+ "autoload" : {
+ "classmap" : [
+ "Mobile_Detect.php"
+ ],
+ "psr-0" : {
+ "Detection" : "namespaced/"
+ }
+ },
+ "archive" : {
+ "exclude" : [
+ "docs",
+ "examples",
+ "export"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/htdocs/includes/mobiledetect/mobiledetectlib/docker-compose.yml b/htdocs/includes/mobiledetect/mobiledetectlib/docker-compose.yml
new file mode 100644
index 00000000000..58ce75e879c
--- /dev/null
+++ b/htdocs/includes/mobiledetect/mobiledetectlib/docker-compose.yml
@@ -0,0 +1,16 @@
+app:
+ restart: 'on-failure'
+ image: php:7
+ working_dir: /app
+ command: vendor/bin/phpunit -v -c tests/phpunit.xml --coverage-text --strict-coverage --stop-on-risky
+ ports:
+ - "8000:8000"
+ volumes:
+ - .:/app
+
+composer:
+ restart: 'no'
+ image: composer/composer:php7
+ command: install
+ volumes:
+ - .:/app
\ No newline at end of file
diff --git a/htdocs/includes/mobiledetect/mobiledetectlib/docs/KNOWN_LIMITATIONS.md b/htdocs/includes/mobiledetect/mobiledetectlib/docs/KNOWN_LIMITATIONS.md
index 8b5d461fe38..5887092f1f8 100644
--- a/htdocs/includes/mobiledetect/mobiledetectlib/docs/KNOWN_LIMITATIONS.md
+++ b/htdocs/includes/mobiledetect/mobiledetectlib/docs/KNOWN_LIMITATIONS.md
@@ -3,7 +3,8 @@
* Mobile Detect script was designed to detect `mobile` devices. Implicitly other devices are considered to be `desktop`.
* User-Agent and HTTP headers sniffing is a non reliable method of detecting a mobile device.
* If the mobile browser is set on `Desktop mode`, the Mobile Detect script has no way of knowing that the device is `mobile`.
-* Some touchscreen devices (eg. Microsoft Surface) are tough to detect as mobile since they can be used in a laptop mode.
+* Some touchscreen devices (eg. Microsoft Surface) are tough to detect as mobile since they can be used in a laptop mode. See: [#32](https://github.com/serbanghita/Mobile-Detect/issues/32), [#461](https://github.com/serbanghita/Mobile-Detect/issues/461), [#667](https://github.com/serbanghita/Mobile-Detect/issues/667)
+* Some mobile devices (eg. IPadOS, Google Pixel Slate). See: [#795](https://github.com/serbanghita/Mobile-Detect/issues/795), [#788](https://github.com/serbanghita/Mobile-Detect/issues/788)
* Detecting the device brand (eg. Apple, Samsung, HTC) is not 100% reliable.
* We don't monitor the quality of the 3rd party tools based on Mobile Detect script.
We cannot guarantee that they are using the class properly or if they provide the latest version.
diff --git a/htdocs/includes/nnnick/chartjs/.codeclimate.yml b/htdocs/includes/nnnick/chartjs/.codeclimate.yml
new file mode 100644
index 00000000000..0b8340feb58
--- /dev/null
+++ b/htdocs/includes/nnnick/chartjs/.codeclimate.yml
@@ -0,0 +1,19 @@
+version: "2"
+plugins:
+ duplication:
+ enabled: true
+ config:
+ languages:
+ - javascript
+ fixme:
+ enabled: true
+exclude_patterns:
+ - "dist/"
+ - "docs/"
+ - "samples/"
+ - "scripts/"
+ - "test/"
+ - "*.js"
+ - "*.json"
+ - "*.md"
+ - ".*"
diff --git a/htdocs/includes/nnnick/chartjs/.editorconfig b/htdocs/includes/nnnick/chartjs/.editorconfig
new file mode 100644
index 00000000000..922810ad734
--- /dev/null
+++ b/htdocs/includes/nnnick/chartjs/.editorconfig
@@ -0,0 +1,18 @@
+# https://editorconfig.org
+root = true
+
+[*]
+indent_style = tab
+indent_size = 4
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[gulpfile.js]
+indent_style = space
+indent_size = 2
+
+[*.yml]
+indent_style = space
+indent_size = 2
diff --git a/htdocs/includes/nnnick/chartjs/.eslintignore b/htdocs/includes/nnnick/chartjs/.eslintignore
new file mode 100644
index 00000000000..96212a3593b
--- /dev/null
+++ b/htdocs/includes/nnnick/chartjs/.eslintignore
@@ -0,0 +1 @@
+**/*{.,-}min.js
diff --git a/htdocs/includes/nnnick/chartjs/.eslintrc.yml b/htdocs/includes/nnnick/chartjs/.eslintrc.yml
new file mode 100644
index 00000000000..b0d9d5695a9
--- /dev/null
+++ b/htdocs/includes/nnnick/chartjs/.eslintrc.yml
@@ -0,0 +1,7 @@
+extends: chartjs
+
+env:
+ browser: true
+ node: true
+
+plugins: ['html']
diff --git a/htdocs/includes/nnnick/chartjs/.gitignore b/htdocs/includes/nnnick/chartjs/.gitignore
new file mode 100644
index 00000000000..c4998047b01
--- /dev/null
+++ b/htdocs/includes/nnnick/chartjs/.gitignore
@@ -0,0 +1,16 @@
+/_book
+/coverage
+/custom
+/docs/index.md
+/gh-pages
+/jsdoc
+/node_modules
+.DS_Store
+.idea
+.project
+.settings
+.vscode
+bower.json
+*.log
+*.swp
+*.stackdump
diff --git a/htdocs/includes/nnnick/chartjs/.htmllintrc b/htdocs/includes/nnnick/chartjs/.htmllintrc
new file mode 100644
index 00000000000..1ab933490de
--- /dev/null
+++ b/htdocs/includes/nnnick/chartjs/.htmllintrc
@@ -0,0 +1,19 @@
+{
+ "indent-style": "tabs",
+ "line-end-style": false,
+ "attr-quote-style": "double",
+ "spec-char-escape": false,
+ "attr-bans": [
+ "align",
+ "background",
+ "bgcolor",
+ "border",
+ "frameborder",
+ "longdesc",
+ "marginwidth",
+ "marginheight",
+ "scrolling"
+ ],
+ "tag-bans": [ "b", "i" ],
+ "id-class-style": false
+}
diff --git a/htdocs/includes/nnnick/chartjs/.travis.yml b/htdocs/includes/nnnick/chartjs/.travis.yml
new file mode 100644
index 00000000000..beb8789b46b
--- /dev/null
+++ b/htdocs/includes/nnnick/chartjs/.travis.yml
@@ -0,0 +1,55 @@
+language: node_js
+node_js:
+ - lts/*
+
+before_install:
+ - "export CHROME_BIN=/usr/bin/google-chrome"
+ - "export DISPLAY=:99.0"
+ - "sh -e /etc/init.d/xvfb start"
+
+script:
+ - gulp build
+ - gulp test --coverage
+ - gulp docs
+ - gulp package
+ - gulp bower
+ - cat ./coverage/lcov.info | ./node_modules/.bin/coveralls || true
+
+sudo: required
+dist: trusty
+
+addons:
+ chrome: stable
+ firefox: latest
+
+# IMPORTANT: scripts require GITHUB_AUTH_TOKEN and GITHUB_AUTH_EMAIL environment variables
+# IMPORTANT: scripts has to be set executables in the Git repository (error 127)
+# https://github.com/travis-ci/travis-ci/issues/5538#issuecomment-225025939
+
+deploy:
+- provider: script
+ script: ./scripts/deploy.sh
+ skip_cleanup: true
+ on:
+ all_branches: true
+- provider: script
+ script: ./scripts/release.sh
+ skip_cleanup: true
+ on:
+ branch: release
+- provider: releases
+ api_key: $GITHUB_AUTH_TOKEN
+ skip_cleanup: true
+ file_glob: true
+ file:
+ - ./dist/*.css
+ - ./dist/*.js
+ - ./dist/*.zip
+ on:
+ tags: true
+- provider: npm
+ email: $NPM_AUTH_EMAIL
+ api_key: $NPM_AUTH_TOKEN
+ skip_cleanup: true
+ on:
+ tags: true
diff --git a/htdocs/includes/nnnick/chartjs/LICENSE.md b/htdocs/includes/nnnick/chartjs/LICENSE.md
new file mode 100644
index 00000000000..29c941dcccf
--- /dev/null
+++ b/htdocs/includes/nnnick/chartjs/LICENSE.md
@@ -0,0 +1,9 @@
+The MIT License (MIT)
+
+Copyright (c) 2018 Chart.js Contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/htdocs/includes/nnnick/chartjs/MAINTAINING.md b/htdocs/includes/nnnick/chartjs/MAINTAINING.md
new file mode 100644
index 00000000000..288b03945ff
--- /dev/null
+++ b/htdocs/includes/nnnick/chartjs/MAINTAINING.md
@@ -0,0 +1,36 @@
+# Maintaining
+## Release Process
+Chart.js relies on [Travis CI](https://travis-ci.org/) to automate the library [releases](https://github.com/chartjs/Chart.js/releases).
+
+### Releasing a New Version
+
+1. draft release notes on [GitHub](https://github.com/chartjs/Chart.js/releases/new) for the upcoming tag
+1. update `master` `package.json` version using [semver](https://semver.org/) semantic
+1. merge `master` into the `release` branch
+1. follow the build process on [Travis CI](https://travis-ci.org/chartjs/Chart.js)
+
+> **Note:** if `master` is merged in `release` with a `package.json` version that already exists, the tag
+creation fails and the release process is aborted.
+
+### Automated Tasks
+Merging into the `release` branch kicks off the automated release process:
+
+* build of the `dist/*.js` files
+* `bower.json` is generated from `package.json`
+* `dist/*.js` and `bower.json` are added to a detached branch
+* a tag is created from the `package.json` version
+* tag (with dist files) is pushed to GitHub
+
+Creation of this tag triggers a new build:
+
+* `Chart.js.zip` package is generated, containing dist files and examples
+* `dist/*.js` and `Chart.js.zip` are attached to the GitHub release (downloads)
+* a new npm package is published on [npmjs](https://www.npmjs.com/package/chart.js)
+
+Finally, [cdnjs](https://cdnjs.com/libraries/Chart.js) is automatically updated from the npm release.
+
+### Further Reading
+
+* [Travis GitHub releases](https://github.com/chartjs/Chart.js/pull/2555)
+* [Bower support and dist/* files](https://github.com/chartjs/Chart.js/issues/3033)
+* [cdnjs npm auto update](https://github.com/cdnjs/cdnjs/pull/8401)
diff --git a/htdocs/includes/nnnick/chartjs/README.md b/htdocs/includes/nnnick/chartjs/README.md
new file mode 100644
index 00000000000..5a522a5e915
--- /dev/null
+++ b/htdocs/includes/nnnick/chartjs/README.md
@@ -0,0 +1,32 @@
+
+
+ Simple yet flexible JavaScript charting for designers & developers
+
+
+
+
+
+
+
+
+
+
+## Documentation
+
+- [Introduction](https://www.chartjs.org/docs/latest/)
+- [Getting Started](https://www.chartjs.org/docs/latest/getting-started/)
+- [General](https://www.chartjs.org/docs/latest/general/)
+- [Configuration](https://www.chartjs.org/docs/latest/configuration/)
+- [Charts](https://www.chartjs.org/docs/latest/charts/)
+- [Axes](https://www.chartjs.org/docs/latest/axes/)
+- [Developers](https://www.chartjs.org/docs/latest/developers/)
+- [Popular Extensions](https://github.com/chartjs/awesome)
+- [Samples](https://www.chartjs.org/samples/)
+
+## Contributing
+
+Instructions on building and testing Chart.js can be found in [the documentation](https://github.com/chartjs/Chart.js/blob/master/docs/developers/contributing.md#building-and-testing). Before submitting an issue or a pull request, please take a moment to look over the [contributing guidelines](https://github.com/chartjs/Chart.js/blob/master/docs/developers/contributing.md) first. For support, please post questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/chartjs) with the `chartjs` tag.
+
+## License
+
+Chart.js is available under the [MIT license](https://opensource.org/licenses/MIT).
diff --git a/htdocs/includes/nnnick/chartjs/book.json b/htdocs/includes/nnnick/chartjs/book.json
new file mode 100644
index 00000000000..22acbde968c
--- /dev/null
+++ b/htdocs/includes/nnnick/chartjs/book.json
@@ -0,0 +1,32 @@
+{
+ "root": "./docs",
+ "title": "Chart.js documentation",
+ "author": "chartjs",
+ "gitbook": "3.2.2",
+ "plugins": [
+ "-lunr",
+ "-search",
+ "search-plus",
+ "anchorjs",
+ "chartjs",
+ "ga",
+ "redirect"
+ ],
+ "pluginsConfig": {
+ "anchorjs": {
+ "icon": "#",
+ "placement": "left",
+ "visible": "always"
+ },
+ "ga": {
+ "token": "UA-28909194-3",
+ "configuration": "auto"
+ },
+ "theme-default": {
+ "showLevel": false,
+ "styles": {
+ "website": "style.css"
+ }
+ }
+ }
+}
diff --git a/htdocs/includes/nnnick/chartjs/composer.json b/htdocs/includes/nnnick/chartjs/composer.json
new file mode 100644
index 00000000000..b332bb0f595
--- /dev/null
+++ b/htdocs/includes/nnnick/chartjs/composer.json
@@ -0,0 +1,26 @@
+{
+ "name": "nnnick/chartjs",
+ "type": "library",
+ "description": "Simple HTML5 charts using the canvas element.",
+ "keywords": [
+ "chart",
+ "js"
+ ],
+ "homepage": "https://www.chartjs.org/",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "NICK DOWNIE",
+ "email": "hello@nickdownie.com"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "minimum-stability": "stable",
+ "extra": {
+ "branch-alias": {
+ "release/2.0": "v2.0-dev"
+ }
+ }
+}
diff --git a/htdocs/includes/nnnick/chartjs/dist/Chart.bundle.js b/htdocs/includes/nnnick/chartjs/dist/Chart.bundle.js
new file mode 100644
index 00000000000..204156a8fc7
--- /dev/null
+++ b/htdocs/includes/nnnick/chartjs/dist/Chart.bundle.js
@@ -0,0 +1,20755 @@
+/*!
+ * Chart.js v2.9.3
+ * https://www.chartjs.org
+ * (c) 2019 Chart.js Contributors
+ * Released under the MIT License
+ */
+(function (global, factory) {
+typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+typeof define === 'function' && define.amd ? define(factory) :
+(global = global || self, global.Chart = factory());
+}(this, (function () { 'use strict';
+
+var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
+
+function commonjsRequire () {
+ throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
+}
+
+function createCommonjsModule(fn, module) {
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
+}
+
+function getCjsExportFromNamespace (n) {
+ return n && n['default'] || n;
+}
+
+var colorName = {
+ "aliceblue": [240, 248, 255],
+ "antiquewhite": [250, 235, 215],
+ "aqua": [0, 255, 255],
+ "aquamarine": [127, 255, 212],
+ "azure": [240, 255, 255],
+ "beige": [245, 245, 220],
+ "bisque": [255, 228, 196],
+ "black": [0, 0, 0],
+ "blanchedalmond": [255, 235, 205],
+ "blue": [0, 0, 255],
+ "blueviolet": [138, 43, 226],
+ "brown": [165, 42, 42],
+ "burlywood": [222, 184, 135],
+ "cadetblue": [95, 158, 160],
+ "chartreuse": [127, 255, 0],
+ "chocolate": [210, 105, 30],
+ "coral": [255, 127, 80],
+ "cornflowerblue": [100, 149, 237],
+ "cornsilk": [255, 248, 220],
+ "crimson": [220, 20, 60],
+ "cyan": [0, 255, 255],
+ "darkblue": [0, 0, 139],
+ "darkcyan": [0, 139, 139],
+ "darkgoldenrod": [184, 134, 11],
+ "darkgray": [169, 169, 169],
+ "darkgreen": [0, 100, 0],
+ "darkgrey": [169, 169, 169],
+ "darkkhaki": [189, 183, 107],
+ "darkmagenta": [139, 0, 139],
+ "darkolivegreen": [85, 107, 47],
+ "darkorange": [255, 140, 0],
+ "darkorchid": [153, 50, 204],
+ "darkred": [139, 0, 0],
+ "darksalmon": [233, 150, 122],
+ "darkseagreen": [143, 188, 143],
+ "darkslateblue": [72, 61, 139],
+ "darkslategray": [47, 79, 79],
+ "darkslategrey": [47, 79, 79],
+ "darkturquoise": [0, 206, 209],
+ "darkviolet": [148, 0, 211],
+ "deeppink": [255, 20, 147],
+ "deepskyblue": [0, 191, 255],
+ "dimgray": [105, 105, 105],
+ "dimgrey": [105, 105, 105],
+ "dodgerblue": [30, 144, 255],
+ "firebrick": [178, 34, 34],
+ "floralwhite": [255, 250, 240],
+ "forestgreen": [34, 139, 34],
+ "fuchsia": [255, 0, 255],
+ "gainsboro": [220, 220, 220],
+ "ghostwhite": [248, 248, 255],
+ "gold": [255, 215, 0],
+ "goldenrod": [218, 165, 32],
+ "gray": [128, 128, 128],
+ "green": [0, 128, 0],
+ "greenyellow": [173, 255, 47],
+ "grey": [128, 128, 128],
+ "honeydew": [240, 255, 240],
+ "hotpink": [255, 105, 180],
+ "indianred": [205, 92, 92],
+ "indigo": [75, 0, 130],
+ "ivory": [255, 255, 240],
+ "khaki": [240, 230, 140],
+ "lavender": [230, 230, 250],
+ "lavenderblush": [255, 240, 245],
+ "lawngreen": [124, 252, 0],
+ "lemonchiffon": [255, 250, 205],
+ "lightblue": [173, 216, 230],
+ "lightcoral": [240, 128, 128],
+ "lightcyan": [224, 255, 255],
+ "lightgoldenrodyellow": [250, 250, 210],
+ "lightgray": [211, 211, 211],
+ "lightgreen": [144, 238, 144],
+ "lightgrey": [211, 211, 211],
+ "lightpink": [255, 182, 193],
+ "lightsalmon": [255, 160, 122],
+ "lightseagreen": [32, 178, 170],
+ "lightskyblue": [135, 206, 250],
+ "lightslategray": [119, 136, 153],
+ "lightslategrey": [119, 136, 153],
+ "lightsteelblue": [176, 196, 222],
+ "lightyellow": [255, 255, 224],
+ "lime": [0, 255, 0],
+ "limegreen": [50, 205, 50],
+ "linen": [250, 240, 230],
+ "magenta": [255, 0, 255],
+ "maroon": [128, 0, 0],
+ "mediumaquamarine": [102, 205, 170],
+ "mediumblue": [0, 0, 205],
+ "mediumorchid": [186, 85, 211],
+ "mediumpurple": [147, 112, 219],
+ "mediumseagreen": [60, 179, 113],
+ "mediumslateblue": [123, 104, 238],
+ "mediumspringgreen": [0, 250, 154],
+ "mediumturquoise": [72, 209, 204],
+ "mediumvioletred": [199, 21, 133],
+ "midnightblue": [25, 25, 112],
+ "mintcream": [245, 255, 250],
+ "mistyrose": [255, 228, 225],
+ "moccasin": [255, 228, 181],
+ "navajowhite": [255, 222, 173],
+ "navy": [0, 0, 128],
+ "oldlace": [253, 245, 230],
+ "olive": [128, 128, 0],
+ "olivedrab": [107, 142, 35],
+ "orange": [255, 165, 0],
+ "orangered": [255, 69, 0],
+ "orchid": [218, 112, 214],
+ "palegoldenrod": [238, 232, 170],
+ "palegreen": [152, 251, 152],
+ "paleturquoise": [175, 238, 238],
+ "palevioletred": [219, 112, 147],
+ "papayawhip": [255, 239, 213],
+ "peachpuff": [255, 218, 185],
+ "peru": [205, 133, 63],
+ "pink": [255, 192, 203],
+ "plum": [221, 160, 221],
+ "powderblue": [176, 224, 230],
+ "purple": [128, 0, 128],
+ "rebeccapurple": [102, 51, 153],
+ "red": [255, 0, 0],
+ "rosybrown": [188, 143, 143],
+ "royalblue": [65, 105, 225],
+ "saddlebrown": [139, 69, 19],
+ "salmon": [250, 128, 114],
+ "sandybrown": [244, 164, 96],
+ "seagreen": [46, 139, 87],
+ "seashell": [255, 245, 238],
+ "sienna": [160, 82, 45],
+ "silver": [192, 192, 192],
+ "skyblue": [135, 206, 235],
+ "slateblue": [106, 90, 205],
+ "slategray": [112, 128, 144],
+ "slategrey": [112, 128, 144],
+ "snow": [255, 250, 250],
+ "springgreen": [0, 255, 127],
+ "steelblue": [70, 130, 180],
+ "tan": [210, 180, 140],
+ "teal": [0, 128, 128],
+ "thistle": [216, 191, 216],
+ "tomato": [255, 99, 71],
+ "turquoise": [64, 224, 208],
+ "violet": [238, 130, 238],
+ "wheat": [245, 222, 179],
+ "white": [255, 255, 255],
+ "whitesmoke": [245, 245, 245],
+ "yellow": [255, 255, 0],
+ "yellowgreen": [154, 205, 50]
+};
+
+var conversions = createCommonjsModule(function (module) {
+/* MIT license */
+
+
+// NOTE: conversions should only return primitive values (i.e. arrays, or
+// values that give correct `typeof` results).
+// do not use box values types (i.e. Number(), String(), etc.)
+
+var reverseKeywords = {};
+for (var key in colorName) {
+ if (colorName.hasOwnProperty(key)) {
+ reverseKeywords[colorName[key]] = key;
+ }
+}
+
+var convert = module.exports = {
+ rgb: {channels: 3, labels: 'rgb'},
+ hsl: {channels: 3, labels: 'hsl'},
+ hsv: {channels: 3, labels: 'hsv'},
+ hwb: {channels: 3, labels: 'hwb'},
+ cmyk: {channels: 4, labels: 'cmyk'},
+ xyz: {channels: 3, labels: 'xyz'},
+ lab: {channels: 3, labels: 'lab'},
+ lch: {channels: 3, labels: 'lch'},
+ hex: {channels: 1, labels: ['hex']},
+ keyword: {channels: 1, labels: ['keyword']},
+ ansi16: {channels: 1, labels: ['ansi16']},
+ ansi256: {channels: 1, labels: ['ansi256']},
+ hcg: {channels: 3, labels: ['h', 'c', 'g']},
+ apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
+ gray: {channels: 1, labels: ['gray']}
+};
+
+// hide .channels and .labels properties
+for (var model in convert) {
+ if (convert.hasOwnProperty(model)) {
+ if (!('channels' in convert[model])) {
+ throw new Error('missing channels property: ' + model);
+ }
+
+ if (!('labels' in convert[model])) {
+ throw new Error('missing channel labels property: ' + model);
+ }
+
+ if (convert[model].labels.length !== convert[model].channels) {
+ throw new Error('channel and label counts mismatch: ' + model);
+ }
+
+ var channels = convert[model].channels;
+ var labels = convert[model].labels;
+ delete convert[model].channels;
+ delete convert[model].labels;
+ Object.defineProperty(convert[model], 'channels', {value: channels});
+ Object.defineProperty(convert[model], 'labels', {value: labels});
+ }
+}
+
+convert.rgb.hsl = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var min = Math.min(r, g, b);
+ var max = Math.max(r, g, b);
+ var delta = max - min;
+ var h;
+ var s;
+ var l;
+
+ if (max === min) {
+ h = 0;
+ } else if (r === max) {
+ h = (g - b) / delta;
+ } else if (g === max) {
+ h = 2 + (b - r) / delta;
+ } else if (b === max) {
+ h = 4 + (r - g) / delta;
+ }
+
+ h = Math.min(h * 60, 360);
+
+ if (h < 0) {
+ h += 360;
+ }
+
+ l = (min + max) / 2;
+
+ if (max === min) {
+ s = 0;
+ } else if (l <= 0.5) {
+ s = delta / (max + min);
+ } else {
+ s = delta / (2 - max - min);
+ }
+
+ return [h, s * 100, l * 100];
+};
+
+convert.rgb.hsv = function (rgb) {
+ var rdif;
+ var gdif;
+ var bdif;
+ var h;
+ var s;
+
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var v = Math.max(r, g, b);
+ var diff = v - Math.min(r, g, b);
+ var diffc = function (c) {
+ return (v - c) / 6 / diff + 1 / 2;
+ };
+
+ if (diff === 0) {
+ h = s = 0;
+ } else {
+ s = diff / v;
+ rdif = diffc(r);
+ gdif = diffc(g);
+ bdif = diffc(b);
+
+ if (r === v) {
+ h = bdif - gdif;
+ } else if (g === v) {
+ h = (1 / 3) + rdif - bdif;
+ } else if (b === v) {
+ h = (2 / 3) + gdif - rdif;
+ }
+ if (h < 0) {
+ h += 1;
+ } else if (h > 1) {
+ h -= 1;
+ }
+ }
+
+ return [
+ h * 360,
+ s * 100,
+ v * 100
+ ];
+};
+
+convert.rgb.hwb = function (rgb) {
+ var r = rgb[0];
+ var g = rgb[1];
+ var b = rgb[2];
+ var h = convert.rgb.hsl(rgb)[0];
+ var w = 1 / 255 * Math.min(r, Math.min(g, b));
+
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
+
+ return [h, w * 100, b * 100];
+};
+
+convert.rgb.cmyk = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var c;
+ var m;
+ var y;
+ var k;
+
+ k = Math.min(1 - r, 1 - g, 1 - b);
+ c = (1 - r - k) / (1 - k) || 0;
+ m = (1 - g - k) / (1 - k) || 0;
+ y = (1 - b - k) / (1 - k) || 0;
+
+ return [c * 100, m * 100, y * 100, k * 100];
+};
+
+/**
+ * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
+ * */
+function comparativeDistance(x, y) {
+ return (
+ Math.pow(x[0] - y[0], 2) +
+ Math.pow(x[1] - y[1], 2) +
+ Math.pow(x[2] - y[2], 2)
+ );
+}
+
+convert.rgb.keyword = function (rgb) {
+ var reversed = reverseKeywords[rgb];
+ if (reversed) {
+ return reversed;
+ }
+
+ var currentClosestDistance = Infinity;
+ var currentClosestKeyword;
+
+ for (var keyword in colorName) {
+ if (colorName.hasOwnProperty(keyword)) {
+ var value = colorName[keyword];
+
+ // Compute comparative distance
+ var distance = comparativeDistance(rgb, value);
+
+ // Check if its less, if so set as closest
+ if (distance < currentClosestDistance) {
+ currentClosestDistance = distance;
+ currentClosestKeyword = keyword;
+ }
+ }
+ }
+
+ return currentClosestKeyword;
+};
+
+convert.keyword.rgb = function (keyword) {
+ return colorName[keyword];
+};
+
+convert.rgb.xyz = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+
+ // assume sRGB
+ r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
+ g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
+ b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
+
+ var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
+ var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
+ var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
+
+ return [x * 100, y * 100, z * 100];
+};
+
+convert.rgb.lab = function (rgb) {
+ var xyz = convert.rgb.xyz(rgb);
+ var x = xyz[0];
+ var y = xyz[1];
+ var z = xyz[2];
+ var l;
+ var a;
+ var b;
+
+ x /= 95.047;
+ y /= 100;
+ z /= 108.883;
+
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
+
+ l = (116 * y) - 16;
+ a = 500 * (x - y);
+ b = 200 * (y - z);
+
+ return [l, a, b];
+};
+
+convert.hsl.rgb = function (hsl) {
+ var h = hsl[0] / 360;
+ var s = hsl[1] / 100;
+ var l = hsl[2] / 100;
+ var t1;
+ var t2;
+ var t3;
+ var rgb;
+ var val;
+
+ if (s === 0) {
+ val = l * 255;
+ return [val, val, val];
+ }
+
+ if (l < 0.5) {
+ t2 = l * (1 + s);
+ } else {
+ t2 = l + s - l * s;
+ }
+
+ t1 = 2 * l - t2;
+
+ rgb = [0, 0, 0];
+ for (var i = 0; i < 3; i++) {
+ t3 = h + 1 / 3 * -(i - 1);
+ if (t3 < 0) {
+ t3++;
+ }
+ if (t3 > 1) {
+ t3--;
+ }
+
+ if (6 * t3 < 1) {
+ val = t1 + (t2 - t1) * 6 * t3;
+ } else if (2 * t3 < 1) {
+ val = t2;
+ } else if (3 * t3 < 2) {
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
+ } else {
+ val = t1;
+ }
+
+ rgb[i] = val * 255;
+ }
+
+ return rgb;
+};
+
+convert.hsl.hsv = function (hsl) {
+ var h = hsl[0];
+ var s = hsl[1] / 100;
+ var l = hsl[2] / 100;
+ var smin = s;
+ var lmin = Math.max(l, 0.01);
+ var sv;
+ var v;
+
+ l *= 2;
+ s *= (l <= 1) ? l : 2 - l;
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
+ v = (l + s) / 2;
+ sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
+
+ return [h, sv * 100, v * 100];
+};
+
+convert.hsv.rgb = function (hsv) {
+ var h = hsv[0] / 60;
+ var s = hsv[1] / 100;
+ var v = hsv[2] / 100;
+ var hi = Math.floor(h) % 6;
+
+ var f = h - Math.floor(h);
+ var p = 255 * v * (1 - s);
+ var q = 255 * v * (1 - (s * f));
+ var t = 255 * v * (1 - (s * (1 - f)));
+ v *= 255;
+
+ switch (hi) {
+ case 0:
+ return [v, t, p];
+ case 1:
+ return [q, v, p];
+ case 2:
+ return [p, v, t];
+ case 3:
+ return [p, q, v];
+ case 4:
+ return [t, p, v];
+ case 5:
+ return [v, p, q];
+ }
+};
+
+convert.hsv.hsl = function (hsv) {
+ var h = hsv[0];
+ var s = hsv[1] / 100;
+ var v = hsv[2] / 100;
+ var vmin = Math.max(v, 0.01);
+ var lmin;
+ var sl;
+ var l;
+
+ l = (2 - s) * v;
+ lmin = (2 - s) * vmin;
+ sl = s * vmin;
+ sl /= (lmin <= 1) ? lmin : 2 - lmin;
+ sl = sl || 0;
+ l /= 2;
+
+ return [h, sl * 100, l * 100];
+};
+
+// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
+convert.hwb.rgb = function (hwb) {
+ var h = hwb[0] / 360;
+ var wh = hwb[1] / 100;
+ var bl = hwb[2] / 100;
+ var ratio = wh + bl;
+ var i;
+ var v;
+ var f;
+ var n;
+
+ // wh + bl cant be > 1
+ if (ratio > 1) {
+ wh /= ratio;
+ bl /= ratio;
+ }
+
+ i = Math.floor(6 * h);
+ v = 1 - bl;
+ f = 6 * h - i;
+
+ if ((i & 0x01) !== 0) {
+ f = 1 - f;
+ }
+
+ n = wh + f * (v - wh); // linear interpolation
+
+ var r;
+ var g;
+ var b;
+ switch (i) {
+ default:
+ case 6:
+ case 0: r = v; g = n; b = wh; break;
+ case 1: r = n; g = v; b = wh; break;
+ case 2: r = wh; g = v; b = n; break;
+ case 3: r = wh; g = n; b = v; break;
+ case 4: r = n; g = wh; b = v; break;
+ case 5: r = v; g = wh; b = n; break;
+ }
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.cmyk.rgb = function (cmyk) {
+ var c = cmyk[0] / 100;
+ var m = cmyk[1] / 100;
+ var y = cmyk[2] / 100;
+ var k = cmyk[3] / 100;
+ var r;
+ var g;
+ var b;
+
+ r = 1 - Math.min(1, c * (1 - k) + k);
+ g = 1 - Math.min(1, m * (1 - k) + k);
+ b = 1 - Math.min(1, y * (1 - k) + k);
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.xyz.rgb = function (xyz) {
+ var x = xyz[0] / 100;
+ var y = xyz[1] / 100;
+ var z = xyz[2] / 100;
+ var r;
+ var g;
+ var b;
+
+ r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
+ g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
+ b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
+
+ // assume sRGB
+ r = r > 0.0031308
+ ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
+ : r * 12.92;
+
+ g = g > 0.0031308
+ ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
+ : g * 12.92;
+
+ b = b > 0.0031308
+ ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
+ : b * 12.92;
+
+ r = Math.min(Math.max(0, r), 1);
+ g = Math.min(Math.max(0, g), 1);
+ b = Math.min(Math.max(0, b), 1);
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.xyz.lab = function (xyz) {
+ var x = xyz[0];
+ var y = xyz[1];
+ var z = xyz[2];
+ var l;
+ var a;
+ var b;
+
+ x /= 95.047;
+ y /= 100;
+ z /= 108.883;
+
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
+
+ l = (116 * y) - 16;
+ a = 500 * (x - y);
+ b = 200 * (y - z);
+
+ return [l, a, b];
+};
+
+convert.lab.xyz = function (lab) {
+ var l = lab[0];
+ var a = lab[1];
+ var b = lab[2];
+ var x;
+ var y;
+ var z;
+
+ y = (l + 16) / 116;
+ x = a / 500 + y;
+ z = y - b / 200;
+
+ var y2 = Math.pow(y, 3);
+ var x2 = Math.pow(x, 3);
+ var z2 = Math.pow(z, 3);
+ y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
+ x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
+ z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
+
+ x *= 95.047;
+ y *= 100;
+ z *= 108.883;
+
+ return [x, y, z];
+};
+
+convert.lab.lch = function (lab) {
+ var l = lab[0];
+ var a = lab[1];
+ var b = lab[2];
+ var hr;
+ var h;
+ var c;
+
+ hr = Math.atan2(b, a);
+ h = hr * 360 / 2 / Math.PI;
+
+ if (h < 0) {
+ h += 360;
+ }
+
+ c = Math.sqrt(a * a + b * b);
+
+ return [l, c, h];
+};
+
+convert.lch.lab = function (lch) {
+ var l = lch[0];
+ var c = lch[1];
+ var h = lch[2];
+ var a;
+ var b;
+ var hr;
+
+ hr = h / 360 * 2 * Math.PI;
+ a = c * Math.cos(hr);
+ b = c * Math.sin(hr);
+
+ return [l, a, b];
+};
+
+convert.rgb.ansi16 = function (args) {
+ var r = args[0];
+ var g = args[1];
+ var b = args[2];
+ var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
+
+ value = Math.round(value / 50);
+
+ if (value === 0) {
+ return 30;
+ }
+
+ var ansi = 30
+ + ((Math.round(b / 255) << 2)
+ | (Math.round(g / 255) << 1)
+ | Math.round(r / 255));
+
+ if (value === 2) {
+ ansi += 60;
+ }
+
+ return ansi;
+};
+
+convert.hsv.ansi16 = function (args) {
+ // optimization here; we already know the value and don't need to get
+ // it converted for us.
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
+};
+
+convert.rgb.ansi256 = function (args) {
+ var r = args[0];
+ var g = args[1];
+ var b = args[2];
+
+ // we use the extended greyscale palette here, with the exception of
+ // black and white. normal palette only has 4 greyscale shades.
+ if (r === g && g === b) {
+ if (r < 8) {
+ return 16;
+ }
+
+ if (r > 248) {
+ return 231;
+ }
+
+ return Math.round(((r - 8) / 247) * 24) + 232;
+ }
+
+ var ansi = 16
+ + (36 * Math.round(r / 255 * 5))
+ + (6 * Math.round(g / 255 * 5))
+ + Math.round(b / 255 * 5);
+
+ return ansi;
+};
+
+convert.ansi16.rgb = function (args) {
+ var color = args % 10;
+
+ // handle greyscale
+ if (color === 0 || color === 7) {
+ if (args > 50) {
+ color += 3.5;
+ }
+
+ color = color / 10.5 * 255;
+
+ return [color, color, color];
+ }
+
+ var mult = (~~(args > 50) + 1) * 0.5;
+ var r = ((color & 1) * mult) * 255;
+ var g = (((color >> 1) & 1) * mult) * 255;
+ var b = (((color >> 2) & 1) * mult) * 255;
+
+ return [r, g, b];
+};
+
+convert.ansi256.rgb = function (args) {
+ // handle greyscale
+ if (args >= 232) {
+ var c = (args - 232) * 10 + 8;
+ return [c, c, c];
+ }
+
+ args -= 16;
+
+ var rem;
+ var r = Math.floor(args / 36) / 5 * 255;
+ var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
+ var b = (rem % 6) / 5 * 255;
+
+ return [r, g, b];
+};
+
+convert.rgb.hex = function (args) {
+ var integer = ((Math.round(args[0]) & 0xFF) << 16)
+ + ((Math.round(args[1]) & 0xFF) << 8)
+ + (Math.round(args[2]) & 0xFF);
+
+ var string = integer.toString(16).toUpperCase();
+ return '000000'.substring(string.length) + string;
+};
+
+convert.hex.rgb = function (args) {
+ var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
+ if (!match) {
+ return [0, 0, 0];
+ }
+
+ var colorString = match[0];
+
+ if (match[0].length === 3) {
+ colorString = colorString.split('').map(function (char) {
+ return char + char;
+ }).join('');
+ }
+
+ var integer = parseInt(colorString, 16);
+ var r = (integer >> 16) & 0xFF;
+ var g = (integer >> 8) & 0xFF;
+ var b = integer & 0xFF;
+
+ return [r, g, b];
+};
+
+convert.rgb.hcg = function (rgb) {
+ var r = rgb[0] / 255;
+ var g = rgb[1] / 255;
+ var b = rgb[2] / 255;
+ var max = Math.max(Math.max(r, g), b);
+ var min = Math.min(Math.min(r, g), b);
+ var chroma = (max - min);
+ var grayscale;
+ var hue;
+
+ if (chroma < 1) {
+ grayscale = min / (1 - chroma);
+ } else {
+ grayscale = 0;
+ }
+
+ if (chroma <= 0) {
+ hue = 0;
+ } else
+ if (max === r) {
+ hue = ((g - b) / chroma) % 6;
+ } else
+ if (max === g) {
+ hue = 2 + (b - r) / chroma;
+ } else {
+ hue = 4 + (r - g) / chroma + 4;
+ }
+
+ hue /= 6;
+ hue %= 1;
+
+ return [hue * 360, chroma * 100, grayscale * 100];
+};
+
+convert.hsl.hcg = function (hsl) {
+ var s = hsl[1] / 100;
+ var l = hsl[2] / 100;
+ var c = 1;
+ var f = 0;
+
+ if (l < 0.5) {
+ c = 2.0 * s * l;
+ } else {
+ c = 2.0 * s * (1.0 - l);
+ }
+
+ if (c < 1.0) {
+ f = (l - 0.5 * c) / (1.0 - c);
+ }
+
+ return [hsl[0], c * 100, f * 100];
+};
+
+convert.hsv.hcg = function (hsv) {
+ var s = hsv[1] / 100;
+ var v = hsv[2] / 100;
+
+ var c = s * v;
+ var f = 0;
+
+ if (c < 1.0) {
+ f = (v - c) / (1 - c);
+ }
+
+ return [hsv[0], c * 100, f * 100];
+};
+
+convert.hcg.rgb = function (hcg) {
+ var h = hcg[0] / 360;
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+
+ if (c === 0.0) {
+ return [g * 255, g * 255, g * 255];
+ }
+
+ var pure = [0, 0, 0];
+ var hi = (h % 1) * 6;
+ var v = hi % 1;
+ var w = 1 - v;
+ var mg = 0;
+
+ switch (Math.floor(hi)) {
+ case 0:
+ pure[0] = 1; pure[1] = v; pure[2] = 0; break;
+ case 1:
+ pure[0] = w; pure[1] = 1; pure[2] = 0; break;
+ case 2:
+ pure[0] = 0; pure[1] = 1; pure[2] = v; break;
+ case 3:
+ pure[0] = 0; pure[1] = w; pure[2] = 1; break;
+ case 4:
+ pure[0] = v; pure[1] = 0; pure[2] = 1; break;
+ default:
+ pure[0] = 1; pure[1] = 0; pure[2] = w;
+ }
+
+ mg = (1.0 - c) * g;
+
+ return [
+ (c * pure[0] + mg) * 255,
+ (c * pure[1] + mg) * 255,
+ (c * pure[2] + mg) * 255
+ ];
+};
+
+convert.hcg.hsv = function (hcg) {
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+
+ var v = c + g * (1.0 - c);
+ var f = 0;
+
+ if (v > 0.0) {
+ f = c / v;
+ }
+
+ return [hcg[0], f * 100, v * 100];
+};
+
+convert.hcg.hsl = function (hcg) {
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+
+ var l = g * (1.0 - c) + 0.5 * c;
+ var s = 0;
+
+ if (l > 0.0 && l < 0.5) {
+ s = c / (2 * l);
+ } else
+ if (l >= 0.5 && l < 1.0) {
+ s = c / (2 * (1 - l));
+ }
+
+ return [hcg[0], s * 100, l * 100];
+};
+
+convert.hcg.hwb = function (hcg) {
+ var c = hcg[1] / 100;
+ var g = hcg[2] / 100;
+ var v = c + g * (1.0 - c);
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
+};
+
+convert.hwb.hcg = function (hwb) {
+ var w = hwb[1] / 100;
+ var b = hwb[2] / 100;
+ var v = 1 - b;
+ var c = v - w;
+ var g = 0;
+
+ if (c < 1) {
+ g = (v - c) / (1 - c);
+ }
+
+ return [hwb[0], c * 100, g * 100];
+};
+
+convert.apple.rgb = function (apple) {
+ return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
+};
+
+convert.rgb.apple = function (rgb) {
+ return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
+};
+
+convert.gray.rgb = function (args) {
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
+};
+
+convert.gray.hsl = convert.gray.hsv = function (args) {
+ return [0, 0, args[0]];
+};
+
+convert.gray.hwb = function (gray) {
+ return [0, 100, gray[0]];
+};
+
+convert.gray.cmyk = function (gray) {
+ return [0, 0, 0, gray[0]];
+};
+
+convert.gray.lab = function (gray) {
+ return [gray[0], 0, 0];
+};
+
+convert.gray.hex = function (gray) {
+ var val = Math.round(gray[0] / 100 * 255) & 0xFF;
+ var integer = (val << 16) + (val << 8) + val;
+
+ var string = integer.toString(16).toUpperCase();
+ return '000000'.substring(string.length) + string;
+};
+
+convert.rgb.gray = function (rgb) {
+ var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
+ return [val / 255 * 100];
+};
+});
+var conversions_1 = conversions.rgb;
+var conversions_2 = conversions.hsl;
+var conversions_3 = conversions.hsv;
+var conversions_4 = conversions.hwb;
+var conversions_5 = conversions.cmyk;
+var conversions_6 = conversions.xyz;
+var conversions_7 = conversions.lab;
+var conversions_8 = conversions.lch;
+var conversions_9 = conversions.hex;
+var conversions_10 = conversions.keyword;
+var conversions_11 = conversions.ansi16;
+var conversions_12 = conversions.ansi256;
+var conversions_13 = conversions.hcg;
+var conversions_14 = conversions.apple;
+var conversions_15 = conversions.gray;
+
+/*
+ this function routes a model to all other models.
+
+ all functions that are routed have a property `.conversion` attached
+ to the returned synthetic function. This property is an array
+ of strings, each with the steps in between the 'from' and 'to'
+ color models (inclusive).
+
+ conversions that are not possible simply are not included.
+*/
+
+function buildGraph() {
+ var graph = {};
+ // https://jsperf.com/object-keys-vs-for-in-with-closure/3
+ var models = Object.keys(conversions);
+
+ for (var len = models.length, i = 0; i < len; i++) {
+ graph[models[i]] = {
+ // http://jsperf.com/1-vs-infinity
+ // micro-opt, but this is simple.
+ distance: -1,
+ parent: null
+ };
+ }
+
+ return graph;
+}
+
+// https://en.wikipedia.org/wiki/Breadth-first_search
+function deriveBFS(fromModel) {
+ var graph = buildGraph();
+ var queue = [fromModel]; // unshift -> queue -> pop
+
+ graph[fromModel].distance = 0;
+
+ while (queue.length) {
+ var current = queue.pop();
+ var adjacents = Object.keys(conversions[current]);
+
+ for (var len = adjacents.length, i = 0; i < len; i++) {
+ var adjacent = adjacents[i];
+ var node = graph[adjacent];
+
+ if (node.distance === -1) {
+ node.distance = graph[current].distance + 1;
+ node.parent = current;
+ queue.unshift(adjacent);
+ }
+ }
+ }
+
+ return graph;
+}
+
+function link(from, to) {
+ return function (args) {
+ return to(from(args));
+ };
+}
+
+function wrapConversion(toModel, graph) {
+ var path = [graph[toModel].parent, toModel];
+ var fn = conversions[graph[toModel].parent][toModel];
+
+ var cur = graph[toModel].parent;
+ while (graph[cur].parent) {
+ path.unshift(graph[cur].parent);
+ fn = link(conversions[graph[cur].parent][cur], fn);
+ cur = graph[cur].parent;
+ }
+
+ fn.conversion = path;
+ return fn;
+}
+
+var route = function (fromModel) {
+ var graph = deriveBFS(fromModel);
+ var conversion = {};
+
+ var models = Object.keys(graph);
+ for (var len = models.length, i = 0; i < len; i++) {
+ var toModel = models[i];
+ var node = graph[toModel];
+
+ if (node.parent === null) {
+ // no possible conversion, or this node is the source model.
+ continue;
+ }
+
+ conversion[toModel] = wrapConversion(toModel, graph);
+ }
+
+ return conversion;
+};
+
+var convert = {};
+
+var models = Object.keys(conversions);
+
+function wrapRaw(fn) {
+ var wrappedFn = function (args) {
+ if (args === undefined || args === null) {
+ return args;
+ }
+
+ if (arguments.length > 1) {
+ args = Array.prototype.slice.call(arguments);
+ }
+
+ return fn(args);
+ };
+
+ // preserve .conversion property if there is one
+ if ('conversion' in fn) {
+ wrappedFn.conversion = fn.conversion;
+ }
+
+ return wrappedFn;
+}
+
+function wrapRounded(fn) {
+ var wrappedFn = function (args) {
+ if (args === undefined || args === null) {
+ return args;
+ }
+
+ if (arguments.length > 1) {
+ args = Array.prototype.slice.call(arguments);
+ }
+
+ var result = fn(args);
+
+ // we're assuming the result is an array here.
+ // see notice in conversions.js; don't use box types
+ // in conversion functions.
+ if (typeof result === 'object') {
+ for (var len = result.length, i = 0; i < len; i++) {
+ result[i] = Math.round(result[i]);
+ }
+ }
+
+ return result;
+ };
+
+ // preserve .conversion property if there is one
+ if ('conversion' in fn) {
+ wrappedFn.conversion = fn.conversion;
+ }
+
+ return wrappedFn;
+}
+
+models.forEach(function (fromModel) {
+ convert[fromModel] = {};
+
+ Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
+ Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
+
+ var routes = route(fromModel);
+ var routeModels = Object.keys(routes);
+
+ routeModels.forEach(function (toModel) {
+ var fn = routes[toModel];
+
+ convert[fromModel][toModel] = wrapRounded(fn);
+ convert[fromModel][toModel].raw = wrapRaw(fn);
+ });
+});
+
+var colorConvert = convert;
+
+var colorName$1 = {
+ "aliceblue": [240, 248, 255],
+ "antiquewhite": [250, 235, 215],
+ "aqua": [0, 255, 255],
+ "aquamarine": [127, 255, 212],
+ "azure": [240, 255, 255],
+ "beige": [245, 245, 220],
+ "bisque": [255, 228, 196],
+ "black": [0, 0, 0],
+ "blanchedalmond": [255, 235, 205],
+ "blue": [0, 0, 255],
+ "blueviolet": [138, 43, 226],
+ "brown": [165, 42, 42],
+ "burlywood": [222, 184, 135],
+ "cadetblue": [95, 158, 160],
+ "chartreuse": [127, 255, 0],
+ "chocolate": [210, 105, 30],
+ "coral": [255, 127, 80],
+ "cornflowerblue": [100, 149, 237],
+ "cornsilk": [255, 248, 220],
+ "crimson": [220, 20, 60],
+ "cyan": [0, 255, 255],
+ "darkblue": [0, 0, 139],
+ "darkcyan": [0, 139, 139],
+ "darkgoldenrod": [184, 134, 11],
+ "darkgray": [169, 169, 169],
+ "darkgreen": [0, 100, 0],
+ "darkgrey": [169, 169, 169],
+ "darkkhaki": [189, 183, 107],
+ "darkmagenta": [139, 0, 139],
+ "darkolivegreen": [85, 107, 47],
+ "darkorange": [255, 140, 0],
+ "darkorchid": [153, 50, 204],
+ "darkred": [139, 0, 0],
+ "darksalmon": [233, 150, 122],
+ "darkseagreen": [143, 188, 143],
+ "darkslateblue": [72, 61, 139],
+ "darkslategray": [47, 79, 79],
+ "darkslategrey": [47, 79, 79],
+ "darkturquoise": [0, 206, 209],
+ "darkviolet": [148, 0, 211],
+ "deeppink": [255, 20, 147],
+ "deepskyblue": [0, 191, 255],
+ "dimgray": [105, 105, 105],
+ "dimgrey": [105, 105, 105],
+ "dodgerblue": [30, 144, 255],
+ "firebrick": [178, 34, 34],
+ "floralwhite": [255, 250, 240],
+ "forestgreen": [34, 139, 34],
+ "fuchsia": [255, 0, 255],
+ "gainsboro": [220, 220, 220],
+ "ghostwhite": [248, 248, 255],
+ "gold": [255, 215, 0],
+ "goldenrod": [218, 165, 32],
+ "gray": [128, 128, 128],
+ "green": [0, 128, 0],
+ "greenyellow": [173, 255, 47],
+ "grey": [128, 128, 128],
+ "honeydew": [240, 255, 240],
+ "hotpink": [255, 105, 180],
+ "indianred": [205, 92, 92],
+ "indigo": [75, 0, 130],
+ "ivory": [255, 255, 240],
+ "khaki": [240, 230, 140],
+ "lavender": [230, 230, 250],
+ "lavenderblush": [255, 240, 245],
+ "lawngreen": [124, 252, 0],
+ "lemonchiffon": [255, 250, 205],
+ "lightblue": [173, 216, 230],
+ "lightcoral": [240, 128, 128],
+ "lightcyan": [224, 255, 255],
+ "lightgoldenrodyellow": [250, 250, 210],
+ "lightgray": [211, 211, 211],
+ "lightgreen": [144, 238, 144],
+ "lightgrey": [211, 211, 211],
+ "lightpink": [255, 182, 193],
+ "lightsalmon": [255, 160, 122],
+ "lightseagreen": [32, 178, 170],
+ "lightskyblue": [135, 206, 250],
+ "lightslategray": [119, 136, 153],
+ "lightslategrey": [119, 136, 153],
+ "lightsteelblue": [176, 196, 222],
+ "lightyellow": [255, 255, 224],
+ "lime": [0, 255, 0],
+ "limegreen": [50, 205, 50],
+ "linen": [250, 240, 230],
+ "magenta": [255, 0, 255],
+ "maroon": [128, 0, 0],
+ "mediumaquamarine": [102, 205, 170],
+ "mediumblue": [0, 0, 205],
+ "mediumorchid": [186, 85, 211],
+ "mediumpurple": [147, 112, 219],
+ "mediumseagreen": [60, 179, 113],
+ "mediumslateblue": [123, 104, 238],
+ "mediumspringgreen": [0, 250, 154],
+ "mediumturquoise": [72, 209, 204],
+ "mediumvioletred": [199, 21, 133],
+ "midnightblue": [25, 25, 112],
+ "mintcream": [245, 255, 250],
+ "mistyrose": [255, 228, 225],
+ "moccasin": [255, 228, 181],
+ "navajowhite": [255, 222, 173],
+ "navy": [0, 0, 128],
+ "oldlace": [253, 245, 230],
+ "olive": [128, 128, 0],
+ "olivedrab": [107, 142, 35],
+ "orange": [255, 165, 0],
+ "orangered": [255, 69, 0],
+ "orchid": [218, 112, 214],
+ "palegoldenrod": [238, 232, 170],
+ "palegreen": [152, 251, 152],
+ "paleturquoise": [175, 238, 238],
+ "palevioletred": [219, 112, 147],
+ "papayawhip": [255, 239, 213],
+ "peachpuff": [255, 218, 185],
+ "peru": [205, 133, 63],
+ "pink": [255, 192, 203],
+ "plum": [221, 160, 221],
+ "powderblue": [176, 224, 230],
+ "purple": [128, 0, 128],
+ "rebeccapurple": [102, 51, 153],
+ "red": [255, 0, 0],
+ "rosybrown": [188, 143, 143],
+ "royalblue": [65, 105, 225],
+ "saddlebrown": [139, 69, 19],
+ "salmon": [250, 128, 114],
+ "sandybrown": [244, 164, 96],
+ "seagreen": [46, 139, 87],
+ "seashell": [255, 245, 238],
+ "sienna": [160, 82, 45],
+ "silver": [192, 192, 192],
+ "skyblue": [135, 206, 235],
+ "slateblue": [106, 90, 205],
+ "slategray": [112, 128, 144],
+ "slategrey": [112, 128, 144],
+ "snow": [255, 250, 250],
+ "springgreen": [0, 255, 127],
+ "steelblue": [70, 130, 180],
+ "tan": [210, 180, 140],
+ "teal": [0, 128, 128],
+ "thistle": [216, 191, 216],
+ "tomato": [255, 99, 71],
+ "turquoise": [64, 224, 208],
+ "violet": [238, 130, 238],
+ "wheat": [245, 222, 179],
+ "white": [255, 255, 255],
+ "whitesmoke": [245, 245, 245],
+ "yellow": [255, 255, 0],
+ "yellowgreen": [154, 205, 50]
+};
+
+/* MIT license */
+
+
+var colorString = {
+ getRgba: getRgba,
+ getHsla: getHsla,
+ getRgb: getRgb,
+ getHsl: getHsl,
+ getHwb: getHwb,
+ getAlpha: getAlpha,
+
+ hexString: hexString,
+ rgbString: rgbString,
+ rgbaString: rgbaString,
+ percentString: percentString,
+ percentaString: percentaString,
+ hslString: hslString,
+ hslaString: hslaString,
+ hwbString: hwbString,
+ keyword: keyword
+};
+
+function getRgba(string) {
+ if (!string) {
+ return;
+ }
+ var abbr = /^#([a-fA-F0-9]{3,4})$/i,
+ hex = /^#([a-fA-F0-9]{6}([a-fA-F0-9]{2})?)$/i,
+ rgba = /^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,
+ per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,
+ keyword = /(\w+)/;
+
+ var rgb = [0, 0, 0],
+ a = 1,
+ match = string.match(abbr),
+ hexAlpha = "";
+ if (match) {
+ match = match[1];
+ hexAlpha = match[3];
+ for (var i = 0; i < rgb.length; i++) {
+ rgb[i] = parseInt(match[i] + match[i], 16);
+ }
+ if (hexAlpha) {
+ a = Math.round((parseInt(hexAlpha + hexAlpha, 16) / 255) * 100) / 100;
+ }
+ }
+ else if (match = string.match(hex)) {
+ hexAlpha = match[2];
+ match = match[1];
+ for (var i = 0; i < rgb.length; i++) {
+ rgb[i] = parseInt(match.slice(i * 2, i * 2 + 2), 16);
+ }
+ if (hexAlpha) {
+ a = Math.round((parseInt(hexAlpha, 16) / 255) * 100) / 100;
+ }
+ }
+ else if (match = string.match(rgba)) {
+ for (var i = 0; i < rgb.length; i++) {
+ rgb[i] = parseInt(match[i + 1]);
+ }
+ a = parseFloat(match[4]);
+ }
+ else if (match = string.match(per)) {
+ for (var i = 0; i < rgb.length; i++) {
+ rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
+ }
+ a = parseFloat(match[4]);
+ }
+ else if (match = string.match(keyword)) {
+ if (match[1] == "transparent") {
+ return [0, 0, 0, 0];
+ }
+ rgb = colorName$1[match[1]];
+ if (!rgb) {
+ return;
+ }
+ }
+
+ for (var i = 0; i < rgb.length; i++) {
+ rgb[i] = scale(rgb[i], 0, 255);
+ }
+ if (!a && a != 0) {
+ a = 1;
+ }
+ else {
+ a = scale(a, 0, 1);
+ }
+ rgb[3] = a;
+ return rgb;
+}
+
+function getHsla(string) {
+ if (!string) {
+ return;
+ }
+ var hsl = /^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/;
+ var match = string.match(hsl);
+ if (match) {
+ var alpha = parseFloat(match[4]);
+ var h = scale(parseInt(match[1]), 0, 360),
+ s = scale(parseFloat(match[2]), 0, 100),
+ l = scale(parseFloat(match[3]), 0, 100),
+ a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);
+ return [h, s, l, a];
+ }
+}
+
+function getHwb(string) {
+ if (!string) {
+ return;
+ }
+ var hwb = /^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/;
+ var match = string.match(hwb);
+ if (match) {
+ var alpha = parseFloat(match[4]);
+ var h = scale(parseInt(match[1]), 0, 360),
+ w = scale(parseFloat(match[2]), 0, 100),
+ b = scale(parseFloat(match[3]), 0, 100),
+ a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);
+ return [h, w, b, a];
+ }
+}
+
+function getRgb(string) {
+ var rgba = getRgba(string);
+ return rgba && rgba.slice(0, 3);
+}
+
+function getHsl(string) {
+ var hsla = getHsla(string);
+ return hsla && hsla.slice(0, 3);
+}
+
+function getAlpha(string) {
+ var vals = getRgba(string);
+ if (vals) {
+ return vals[3];
+ }
+ else if (vals = getHsla(string)) {
+ return vals[3];
+ }
+ else if (vals = getHwb(string)) {
+ return vals[3];
+ }
+}
+
+// generators
+function hexString(rgba, a) {
+ var a = (a !== undefined && rgba.length === 3) ? a : rgba[3];
+ return "#" + hexDouble(rgba[0])
+ + hexDouble(rgba[1])
+ + hexDouble(rgba[2])
+ + (
+ (a >= 0 && a < 1)
+ ? hexDouble(Math.round(a * 255))
+ : ""
+ );
+}
+
+function rgbString(rgba, alpha) {
+ if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {
+ return rgbaString(rgba, alpha);
+ }
+ return "rgb(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2] + ")";
+}
+
+function rgbaString(rgba, alpha) {
+ if (alpha === undefined) {
+ alpha = (rgba[3] !== undefined ? rgba[3] : 1);
+ }
+ return "rgba(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2]
+ + ", " + alpha + ")";
+}
+
+function percentString(rgba, alpha) {
+ if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {
+ return percentaString(rgba, alpha);
+ }
+ var r = Math.round(rgba[0]/255 * 100),
+ g = Math.round(rgba[1]/255 * 100),
+ b = Math.round(rgba[2]/255 * 100);
+
+ return "rgb(" + r + "%, " + g + "%, " + b + "%)";
+}
+
+function percentaString(rgba, alpha) {
+ var r = Math.round(rgba[0]/255 * 100),
+ g = Math.round(rgba[1]/255 * 100),
+ b = Math.round(rgba[2]/255 * 100);
+ return "rgba(" + r + "%, " + g + "%, " + b + "%, " + (alpha || rgba[3] || 1) + ")";
+}
+
+function hslString(hsla, alpha) {
+ if (alpha < 1 || (hsla[3] && hsla[3] < 1)) {
+ return hslaString(hsla, alpha);
+ }
+ return "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)";
+}
+
+function hslaString(hsla, alpha) {
+ if (alpha === undefined) {
+ alpha = (hsla[3] !== undefined ? hsla[3] : 1);
+ }
+ return "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, "
+ + alpha + ")";
+}
+
+// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
+// (hwb have alpha optional & 1 is default value)
+function hwbString(hwb, alpha) {
+ if (alpha === undefined) {
+ alpha = (hwb[3] !== undefined ? hwb[3] : 1);
+ }
+ return "hwb(" + hwb[0] + ", " + hwb[1] + "%, " + hwb[2] + "%"
+ + (alpha !== undefined && alpha !== 1 ? ", " + alpha : "") + ")";
+}
+
+function keyword(rgb) {
+ return reverseNames[rgb.slice(0, 3)];
+}
+
+// helpers
+function scale(num, min, max) {
+ return Math.min(Math.max(min, num), max);
+}
+
+function hexDouble(num) {
+ var str = num.toString(16).toUpperCase();
+ return (str.length < 2) ? "0" + str : str;
+}
+
+
+//create a list of reverse color names
+var reverseNames = {};
+for (var name in colorName$1) {
+ reverseNames[colorName$1[name]] = name;
+}
+
+/* MIT license */
+
+
+
+var Color = function (obj) {
+ if (obj instanceof Color) {
+ return obj;
+ }
+ if (!(this instanceof Color)) {
+ return new Color(obj);
+ }
+
+ this.valid = false;
+ this.values = {
+ rgb: [0, 0, 0],
+ hsl: [0, 0, 0],
+ hsv: [0, 0, 0],
+ hwb: [0, 0, 0],
+ cmyk: [0, 0, 0, 0],
+ alpha: 1
+ };
+
+ // parse Color() argument
+ var vals;
+ if (typeof obj === 'string') {
+ vals = colorString.getRgba(obj);
+ if (vals) {
+ this.setValues('rgb', vals);
+ } else if (vals = colorString.getHsla(obj)) {
+ this.setValues('hsl', vals);
+ } else if (vals = colorString.getHwb(obj)) {
+ this.setValues('hwb', vals);
+ }
+ } else if (typeof obj === 'object') {
+ vals = obj;
+ if (vals.r !== undefined || vals.red !== undefined) {
+ this.setValues('rgb', vals);
+ } else if (vals.l !== undefined || vals.lightness !== undefined) {
+ this.setValues('hsl', vals);
+ } else if (vals.v !== undefined || vals.value !== undefined) {
+ this.setValues('hsv', vals);
+ } else if (vals.w !== undefined || vals.whiteness !== undefined) {
+ this.setValues('hwb', vals);
+ } else if (vals.c !== undefined || vals.cyan !== undefined) {
+ this.setValues('cmyk', vals);
+ }
+ }
+};
+
+Color.prototype = {
+ isValid: function () {
+ return this.valid;
+ },
+ rgb: function () {
+ return this.setSpace('rgb', arguments);
+ },
+ hsl: function () {
+ return this.setSpace('hsl', arguments);
+ },
+ hsv: function () {
+ return this.setSpace('hsv', arguments);
+ },
+ hwb: function () {
+ return this.setSpace('hwb', arguments);
+ },
+ cmyk: function () {
+ return this.setSpace('cmyk', arguments);
+ },
+
+ rgbArray: function () {
+ return this.values.rgb;
+ },
+ hslArray: function () {
+ return this.values.hsl;
+ },
+ hsvArray: function () {
+ return this.values.hsv;
+ },
+ hwbArray: function () {
+ var values = this.values;
+ if (values.alpha !== 1) {
+ return values.hwb.concat([values.alpha]);
+ }
+ return values.hwb;
+ },
+ cmykArray: function () {
+ return this.values.cmyk;
+ },
+ rgbaArray: function () {
+ var values = this.values;
+ return values.rgb.concat([values.alpha]);
+ },
+ hslaArray: function () {
+ var values = this.values;
+ return values.hsl.concat([values.alpha]);
+ },
+ alpha: function (val) {
+ if (val === undefined) {
+ return this.values.alpha;
+ }
+ this.setValues('alpha', val);
+ return this;
+ },
+
+ red: function (val) {
+ return this.setChannel('rgb', 0, val);
+ },
+ green: function (val) {
+ return this.setChannel('rgb', 1, val);
+ },
+ blue: function (val) {
+ return this.setChannel('rgb', 2, val);
+ },
+ hue: function (val) {
+ if (val) {
+ val %= 360;
+ val = val < 0 ? 360 + val : val;
+ }
+ return this.setChannel('hsl', 0, val);
+ },
+ saturation: function (val) {
+ return this.setChannel('hsl', 1, val);
+ },
+ lightness: function (val) {
+ return this.setChannel('hsl', 2, val);
+ },
+ saturationv: function (val) {
+ return this.setChannel('hsv', 1, val);
+ },
+ whiteness: function (val) {
+ return this.setChannel('hwb', 1, val);
+ },
+ blackness: function (val) {
+ return this.setChannel('hwb', 2, val);
+ },
+ value: function (val) {
+ return this.setChannel('hsv', 2, val);
+ },
+ cyan: function (val) {
+ return this.setChannel('cmyk', 0, val);
+ },
+ magenta: function (val) {
+ return this.setChannel('cmyk', 1, val);
+ },
+ yellow: function (val) {
+ return this.setChannel('cmyk', 2, val);
+ },
+ black: function (val) {
+ return this.setChannel('cmyk', 3, val);
+ },
+
+ hexString: function () {
+ return colorString.hexString(this.values.rgb);
+ },
+ rgbString: function () {
+ return colorString.rgbString(this.values.rgb, this.values.alpha);
+ },
+ rgbaString: function () {
+ return colorString.rgbaString(this.values.rgb, this.values.alpha);
+ },
+ percentString: function () {
+ return colorString.percentString(this.values.rgb, this.values.alpha);
+ },
+ hslString: function () {
+ return colorString.hslString(this.values.hsl, this.values.alpha);
+ },
+ hslaString: function () {
+ return colorString.hslaString(this.values.hsl, this.values.alpha);
+ },
+ hwbString: function () {
+ return colorString.hwbString(this.values.hwb, this.values.alpha);
+ },
+ keyword: function () {
+ return colorString.keyword(this.values.rgb, this.values.alpha);
+ },
+
+ rgbNumber: function () {
+ var rgb = this.values.rgb;
+ return (rgb[0] << 16) | (rgb[1] << 8) | rgb[2];
+ },
+
+ luminosity: function () {
+ // http://www.w3.org/TR/WCAG20/#relativeluminancedef
+ var rgb = this.values.rgb;
+ var lum = [];
+ for (var i = 0; i < rgb.length; i++) {
+ var chan = rgb[i] / 255;
+ lum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4);
+ }
+ return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
+ },
+
+ contrast: function (color2) {
+ // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
+ var lum1 = this.luminosity();
+ var lum2 = color2.luminosity();
+ if (lum1 > lum2) {
+ return (lum1 + 0.05) / (lum2 + 0.05);
+ }
+ return (lum2 + 0.05) / (lum1 + 0.05);
+ },
+
+ level: function (color2) {
+ var contrastRatio = this.contrast(color2);
+ if (contrastRatio >= 7.1) {
+ return 'AAA';
+ }
+
+ return (contrastRatio >= 4.5) ? 'AA' : '';
+ },
+
+ dark: function () {
+ // YIQ equation from http://24ways.org/2010/calculating-color-contrast
+ var rgb = this.values.rgb;
+ var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;
+ return yiq < 128;
+ },
+
+ light: function () {
+ return !this.dark();
+ },
+
+ negate: function () {
+ var rgb = [];
+ for (var i = 0; i < 3; i++) {
+ rgb[i] = 255 - this.values.rgb[i];
+ }
+ this.setValues('rgb', rgb);
+ return this;
+ },
+
+ lighten: function (ratio) {
+ var hsl = this.values.hsl;
+ hsl[2] += hsl[2] * ratio;
+ this.setValues('hsl', hsl);
+ return this;
+ },
+
+ darken: function (ratio) {
+ var hsl = this.values.hsl;
+ hsl[2] -= hsl[2] * ratio;
+ this.setValues('hsl', hsl);
+ return this;
+ },
+
+ saturate: function (ratio) {
+ var hsl = this.values.hsl;
+ hsl[1] += hsl[1] * ratio;
+ this.setValues('hsl', hsl);
+ return this;
+ },
+
+ desaturate: function (ratio) {
+ var hsl = this.values.hsl;
+ hsl[1] -= hsl[1] * ratio;
+ this.setValues('hsl', hsl);
+ return this;
+ },
+
+ whiten: function (ratio) {
+ var hwb = this.values.hwb;
+ hwb[1] += hwb[1] * ratio;
+ this.setValues('hwb', hwb);
+ return this;
+ },
+
+ blacken: function (ratio) {
+ var hwb = this.values.hwb;
+ hwb[2] += hwb[2] * ratio;
+ this.setValues('hwb', hwb);
+ return this;
+ },
+
+ greyscale: function () {
+ var rgb = this.values.rgb;
+ // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
+ var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
+ this.setValues('rgb', [val, val, val]);
+ return this;
+ },
+
+ clearer: function (ratio) {
+ var alpha = this.values.alpha;
+ this.setValues('alpha', alpha - (alpha * ratio));
+ return this;
+ },
+
+ opaquer: function (ratio) {
+ var alpha = this.values.alpha;
+ this.setValues('alpha', alpha + (alpha * ratio));
+ return this;
+ },
+
+ rotate: function (degrees) {
+ var hsl = this.values.hsl;
+ var hue = (hsl[0] + degrees) % 360;
+ hsl[0] = hue < 0 ? 360 + hue : hue;
+ this.setValues('hsl', hsl);
+ return this;
+ },
+
+ /**
+ * Ported from sass implementation in C
+ * https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
+ */
+ mix: function (mixinColor, weight) {
+ var color1 = this;
+ var color2 = mixinColor;
+ var p = weight === undefined ? 0.5 : weight;
+
+ var w = 2 * p - 1;
+ var a = color1.alpha() - color2.alpha();
+
+ var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
+ var w2 = 1 - w1;
+
+ return this
+ .rgb(
+ w1 * color1.red() + w2 * color2.red(),
+ w1 * color1.green() + w2 * color2.green(),
+ w1 * color1.blue() + w2 * color2.blue()
+ )
+ .alpha(color1.alpha() * p + color2.alpha() * (1 - p));
+ },
+
+ toJSON: function () {
+ return this.rgb();
+ },
+
+ clone: function () {
+ // NOTE(SB): using node-clone creates a dependency to Buffer when using browserify,
+ // making the final build way to big to embed in Chart.js. So let's do it manually,
+ // assuming that values to clone are 1 dimension arrays containing only numbers,
+ // except 'alpha' which is a number.
+ var result = new Color();
+ var source = this.values;
+ var target = result.values;
+ var value, type;
+
+ for (var prop in source) {
+ if (source.hasOwnProperty(prop)) {
+ value = source[prop];
+ type = ({}).toString.call(value);
+ if (type === '[object Array]') {
+ target[prop] = value.slice(0);
+ } else if (type === '[object Number]') {
+ target[prop] = value;
+ } else {
+ console.error('unexpected color value:', value);
+ }
+ }
+ }
+
+ return result;
+ }
+};
+
+Color.prototype.spaces = {
+ rgb: ['red', 'green', 'blue'],
+ hsl: ['hue', 'saturation', 'lightness'],
+ hsv: ['hue', 'saturation', 'value'],
+ hwb: ['hue', 'whiteness', 'blackness'],
+ cmyk: ['cyan', 'magenta', 'yellow', 'black']
+};
+
+Color.prototype.maxes = {
+ rgb: [255, 255, 255],
+ hsl: [360, 100, 100],
+ hsv: [360, 100, 100],
+ hwb: [360, 100, 100],
+ cmyk: [100, 100, 100, 100]
+};
+
+Color.prototype.getValues = function (space) {
+ var values = this.values;
+ var vals = {};
+
+ for (var i = 0; i < space.length; i++) {
+ vals[space.charAt(i)] = values[space][i];
+ }
+
+ if (values.alpha !== 1) {
+ vals.a = values.alpha;
+ }
+
+ // {r: 255, g: 255, b: 255, a: 0.4}
+ return vals;
+};
+
+Color.prototype.setValues = function (space, vals) {
+ var values = this.values;
+ var spaces = this.spaces;
+ var maxes = this.maxes;
+ var alpha = 1;
+ var i;
+
+ this.valid = true;
+
+ if (space === 'alpha') {
+ alpha = vals;
+ } else if (vals.length) {
+ // [10, 10, 10]
+ values[space] = vals.slice(0, space.length);
+ alpha = vals[space.length];
+ } else if (vals[space.charAt(0)] !== undefined) {
+ // {r: 10, g: 10, b: 10}
+ for (i = 0; i < space.length; i++) {
+ values[space][i] = vals[space.charAt(i)];
+ }
+
+ alpha = vals.a;
+ } else if (vals[spaces[space][0]] !== undefined) {
+ // {red: 10, green: 10, blue: 10}
+ var chans = spaces[space];
+
+ for (i = 0; i < space.length; i++) {
+ values[space][i] = vals[chans[i]];
+ }
+
+ alpha = vals.alpha;
+ }
+
+ values.alpha = Math.max(0, Math.min(1, (alpha === undefined ? values.alpha : alpha)));
+
+ if (space === 'alpha') {
+ return false;
+ }
+
+ var capped;
+
+ // cap values of the space prior converting all values
+ for (i = 0; i < space.length; i++) {
+ capped = Math.max(0, Math.min(maxes[space][i], values[space][i]));
+ values[space][i] = Math.round(capped);
+ }
+
+ // convert to all the other color spaces
+ for (var sname in spaces) {
+ if (sname !== space) {
+ values[sname] = colorConvert[space][sname](values[space]);
+ }
+ }
+
+ return true;
+};
+
+Color.prototype.setSpace = function (space, args) {
+ var vals = args[0];
+
+ if (vals === undefined) {
+ // color.rgb()
+ return this.getValues(space);
+ }
+
+ // color.rgb(10, 10, 10)
+ if (typeof vals === 'number') {
+ vals = Array.prototype.slice.call(args);
+ }
+
+ this.setValues(space, vals);
+ return this;
+};
+
+Color.prototype.setChannel = function (space, index, val) {
+ var svalues = this.values[space];
+ if (val === undefined) {
+ // color.red()
+ return svalues[index];
+ } else if (val === svalues[index]) {
+ // color.red(color.red())
+ return this;
+ }
+
+ // color.red(100)
+ svalues[index] = val;
+ this.setValues(space, svalues);
+
+ return this;
+};
+
+if (typeof window !== 'undefined') {
+ window.Color = Color;
+}
+
+var chartjsColor = Color;
+
+/**
+ * @namespace Chart.helpers
+ */
+var helpers = {
+ /**
+ * An empty function that can be used, for example, for optional callback.
+ */
+ noop: function() {},
+
+ /**
+ * Returns a unique id, sequentially generated from a global variable.
+ * @returns {number}
+ * @function
+ */
+ uid: (function() {
+ var id = 0;
+ return function() {
+ return id++;
+ };
+ }()),
+
+ /**
+ * Returns true if `value` is neither null nor undefined, else returns false.
+ * @param {*} value - The value to test.
+ * @returns {boolean}
+ * @since 2.7.0
+ */
+ isNullOrUndef: function(value) {
+ return value === null || typeof value === 'undefined';
+ },
+
+ /**
+ * Returns true if `value` is an array (including typed arrays), else returns false.
+ * @param {*} value - The value to test.
+ * @returns {boolean}
+ * @function
+ */
+ isArray: function(value) {
+ if (Array.isArray && Array.isArray(value)) {
+ return true;
+ }
+ var type = Object.prototype.toString.call(value);
+ if (type.substr(0, 7) === '[object' && type.substr(-6) === 'Array]') {
+ return true;
+ }
+ return false;
+ },
+
+ /**
+ * Returns true if `value` is an object (excluding null), else returns false.
+ * @param {*} value - The value to test.
+ * @returns {boolean}
+ * @since 2.7.0
+ */
+ isObject: function(value) {
+ return value !== null && Object.prototype.toString.call(value) === '[object Object]';
+ },
+
+ /**
+ * Returns true if `value` is a finite number, else returns false
+ * @param {*} value - The value to test.
+ * @returns {boolean}
+ */
+ isFinite: function(value) {
+ return (typeof value === 'number' || value instanceof Number) && isFinite(value);
+ },
+
+ /**
+ * Returns `value` if defined, else returns `defaultValue`.
+ * @param {*} value - The value to return if defined.
+ * @param {*} defaultValue - The value to return if `value` is undefined.
+ * @returns {*}
+ */
+ valueOrDefault: function(value, defaultValue) {
+ return typeof value === 'undefined' ? defaultValue : value;
+ },
+
+ /**
+ * Returns value at the given `index` in array if defined, else returns `defaultValue`.
+ * @param {Array} value - The array to lookup for value at `index`.
+ * @param {number} index - The index in `value` to lookup for value.
+ * @param {*} defaultValue - The value to return if `value[index]` is undefined.
+ * @returns {*}
+ */
+ valueAtIndexOrDefault: function(value, index, defaultValue) {
+ return helpers.valueOrDefault(helpers.isArray(value) ? value[index] : value, defaultValue);
+ },
+
+ /**
+ * Calls `fn` with the given `args` in the scope defined by `thisArg` and returns the
+ * value returned by `fn`. If `fn` is not a function, this method returns undefined.
+ * @param {function} fn - The function to call.
+ * @param {Array|undefined|null} args - The arguments with which `fn` should be called.
+ * @param {object} [thisArg] - The value of `this` provided for the call to `fn`.
+ * @returns {*}
+ */
+ callback: function(fn, args, thisArg) {
+ if (fn && typeof fn.call === 'function') {
+ return fn.apply(thisArg, args);
+ }
+ },
+
+ /**
+ * Note(SB) for performance sake, this method should only be used when loopable type
+ * is unknown or in none intensive code (not called often and small loopable). Else
+ * it's preferable to use a regular for() loop and save extra function calls.
+ * @param {object|Array} loopable - The object or array to be iterated.
+ * @param {function} fn - The function to call for each item.
+ * @param {object} [thisArg] - The value of `this` provided for the call to `fn`.
+ * @param {boolean} [reverse] - If true, iterates backward on the loopable.
+ */
+ each: function(loopable, fn, thisArg, reverse) {
+ var i, len, keys;
+ if (helpers.isArray(loopable)) {
+ len = loopable.length;
+ if (reverse) {
+ for (i = len - 1; i >= 0; i--) {
+ fn.call(thisArg, loopable[i], i);
+ }
+ } else {
+ for (i = 0; i < len; i++) {
+ fn.call(thisArg, loopable[i], i);
+ }
+ }
+ } else if (helpers.isObject(loopable)) {
+ keys = Object.keys(loopable);
+ len = keys.length;
+ for (i = 0; i < len; i++) {
+ fn.call(thisArg, loopable[keys[i]], keys[i]);
+ }
+ }
+ },
+
+ /**
+ * Returns true if the `a0` and `a1` arrays have the same content, else returns false.
+ * @see https://stackoverflow.com/a/14853974
+ * @param {Array} a0 - The array to compare
+ * @param {Array} a1 - The array to compare
+ * @returns {boolean}
+ */
+ arrayEquals: function(a0, a1) {
+ var i, ilen, v0, v1;
+
+ if (!a0 || !a1 || a0.length !== a1.length) {
+ return false;
+ }
+
+ for (i = 0, ilen = a0.length; i < ilen; ++i) {
+ v0 = a0[i];
+ v1 = a1[i];
+
+ if (v0 instanceof Array && v1 instanceof Array) {
+ if (!helpers.arrayEquals(v0, v1)) {
+ return false;
+ }
+ } else if (v0 !== v1) {
+ // NOTE: two different object instances will never be equal: {x:20} != {x:20}
+ return false;
+ }
+ }
+
+ return true;
+ },
+
+ /**
+ * Returns a deep copy of `source` without keeping references on objects and arrays.
+ * @param {*} source - The value to clone.
+ * @returns {*}
+ */
+ clone: function(source) {
+ if (helpers.isArray(source)) {
+ return source.map(helpers.clone);
+ }
+
+ if (helpers.isObject(source)) {
+ var target = {};
+ var keys = Object.keys(source);
+ var klen = keys.length;
+ var k = 0;
+
+ for (; k < klen; ++k) {
+ target[keys[k]] = helpers.clone(source[keys[k]]);
+ }
+
+ return target;
+ }
+
+ return source;
+ },
+
+ /**
+ * The default merger when Chart.helpers.merge is called without merger option.
+ * Note(SB): also used by mergeConfig and mergeScaleConfig as fallback.
+ * @private
+ */
+ _merger: function(key, target, source, options) {
+ var tval = target[key];
+ var sval = source[key];
+
+ if (helpers.isObject(tval) && helpers.isObject(sval)) {
+ helpers.merge(tval, sval, options);
+ } else {
+ target[key] = helpers.clone(sval);
+ }
+ },
+
+ /**
+ * Merges source[key] in target[key] only if target[key] is undefined.
+ * @private
+ */
+ _mergerIf: function(key, target, source) {
+ var tval = target[key];
+ var sval = source[key];
+
+ if (helpers.isObject(tval) && helpers.isObject(sval)) {
+ helpers.mergeIf(tval, sval);
+ } else if (!target.hasOwnProperty(key)) {
+ target[key] = helpers.clone(sval);
+ }
+ },
+
+ /**
+ * Recursively deep copies `source` properties into `target` with the given `options`.
+ * IMPORTANT: `target` is not cloned and will be updated with `source` properties.
+ * @param {object} target - The target object in which all sources are merged into.
+ * @param {object|object[]} source - Object(s) to merge into `target`.
+ * @param {object} [options] - Merging options:
+ * @param {function} [options.merger] - The merge method (key, target, source, options)
+ * @returns {object} The `target` object.
+ */
+ merge: function(target, source, options) {
+ var sources = helpers.isArray(source) ? source : [source];
+ var ilen = sources.length;
+ var merge, i, keys, klen, k;
+
+ if (!helpers.isObject(target)) {
+ return target;
+ }
+
+ options = options || {};
+ merge = options.merger || helpers._merger;
+
+ for (i = 0; i < ilen; ++i) {
+ source = sources[i];
+ if (!helpers.isObject(source)) {
+ continue;
+ }
+
+ keys = Object.keys(source);
+ for (k = 0, klen = keys.length; k < klen; ++k) {
+ merge(keys[k], target, source, options);
+ }
+ }
+
+ return target;
+ },
+
+ /**
+ * Recursively deep copies `source` properties into `target` *only* if not defined in target.
+ * IMPORTANT: `target` is not cloned and will be updated with `source` properties.
+ * @param {object} target - The target object in which all sources are merged into.
+ * @param {object|object[]} source - Object(s) to merge into `target`.
+ * @returns {object} The `target` object.
+ */
+ mergeIf: function(target, source) {
+ return helpers.merge(target, source, {merger: helpers._mergerIf});
+ },
+
+ /**
+ * Applies the contents of two or more objects together into the first object.
+ * @param {object} target - The target object in which all objects are merged into.
+ * @param {object} arg1 - Object containing additional properties to merge in target.
+ * @param {object} argN - Additional objects containing properties to merge in target.
+ * @returns {object} The `target` object.
+ */
+ extend: Object.assign || function(target) {
+ return helpers.merge(target, [].slice.call(arguments, 1), {
+ merger: function(key, dst, src) {
+ dst[key] = src[key];
+ }
+ });
+ },
+
+ /**
+ * Basic javascript inheritance based on the model created in Backbone.js
+ */
+ inherits: function(extensions) {
+ var me = this;
+ var ChartElement = (extensions && extensions.hasOwnProperty('constructor')) ? extensions.constructor : function() {
+ return me.apply(this, arguments);
+ };
+
+ var Surrogate = function() {
+ this.constructor = ChartElement;
+ };
+
+ Surrogate.prototype = me.prototype;
+ ChartElement.prototype = new Surrogate();
+ ChartElement.extend = helpers.inherits;
+
+ if (extensions) {
+ helpers.extend(ChartElement.prototype, extensions);
+ }
+
+ ChartElement.__super__ = me.prototype;
+ return ChartElement;
+ },
+
+ _deprecated: function(scope, value, previous, current) {
+ if (value !== undefined) {
+ console.warn(scope + ': "' + previous +
+ '" is deprecated. Please use "' + current + '" instead');
+ }
+ }
+};
+
+var helpers_core = helpers;
+
+// DEPRECATIONS
+
+/**
+ * Provided for backward compatibility, use Chart.helpers.callback instead.
+ * @function Chart.helpers.callCallback
+ * @deprecated since version 2.6.0
+ * @todo remove at version 3
+ * @private
+ */
+helpers.callCallback = helpers.callback;
+
+/**
+ * Provided for backward compatibility, use Array.prototype.indexOf instead.
+ * Array.prototype.indexOf compatibility: Chrome, Opera, Safari, FF1.5+, IE9+
+ * @function Chart.helpers.indexOf
+ * @deprecated since version 2.7.0
+ * @todo remove at version 3
+ * @private
+ */
+helpers.indexOf = function(array, item, fromIndex) {
+ return Array.prototype.indexOf.call(array, item, fromIndex);
+};
+
+/**
+ * Provided for backward compatibility, use Chart.helpers.valueOrDefault instead.
+ * @function Chart.helpers.getValueOrDefault
+ * @deprecated since version 2.7.0
+ * @todo remove at version 3
+ * @private
+ */
+helpers.getValueOrDefault = helpers.valueOrDefault;
+
+/**
+ * Provided for backward compatibility, use Chart.helpers.valueAtIndexOrDefault instead.
+ * @function Chart.helpers.getValueAtIndexOrDefault
+ * @deprecated since version 2.7.0
+ * @todo remove at version 3
+ * @private
+ */
+helpers.getValueAtIndexOrDefault = helpers.valueAtIndexOrDefault;
+
+/**
+ * Easing functions adapted from Robert Penner's easing equations.
+ * @namespace Chart.helpers.easingEffects
+ * @see http://www.robertpenner.com/easing/
+ */
+var effects = {
+ linear: function(t) {
+ return t;
+ },
+
+ easeInQuad: function(t) {
+ return t * t;
+ },
+
+ easeOutQuad: function(t) {
+ return -t * (t - 2);
+ },
+
+ easeInOutQuad: function(t) {
+ if ((t /= 0.5) < 1) {
+ return 0.5 * t * t;
+ }
+ return -0.5 * ((--t) * (t - 2) - 1);
+ },
+
+ easeInCubic: function(t) {
+ return t * t * t;
+ },
+
+ easeOutCubic: function(t) {
+ return (t = t - 1) * t * t + 1;
+ },
+
+ easeInOutCubic: function(t) {
+ if ((t /= 0.5) < 1) {
+ return 0.5 * t * t * t;
+ }
+ return 0.5 * ((t -= 2) * t * t + 2);
+ },
+
+ easeInQuart: function(t) {
+ return t * t * t * t;
+ },
+
+ easeOutQuart: function(t) {
+ return -((t = t - 1) * t * t * t - 1);
+ },
+
+ easeInOutQuart: function(t) {
+ if ((t /= 0.5) < 1) {
+ return 0.5 * t * t * t * t;
+ }
+ return -0.5 * ((t -= 2) * t * t * t - 2);
+ },
+
+ easeInQuint: function(t) {
+ return t * t * t * t * t;
+ },
+
+ easeOutQuint: function(t) {
+ return (t = t - 1) * t * t * t * t + 1;
+ },
+
+ easeInOutQuint: function(t) {
+ if ((t /= 0.5) < 1) {
+ return 0.5 * t * t * t * t * t;
+ }
+ return 0.5 * ((t -= 2) * t * t * t * t + 2);
+ },
+
+ easeInSine: function(t) {
+ return -Math.cos(t * (Math.PI / 2)) + 1;
+ },
+
+ easeOutSine: function(t) {
+ return Math.sin(t * (Math.PI / 2));
+ },
+
+ easeInOutSine: function(t) {
+ return -0.5 * (Math.cos(Math.PI * t) - 1);
+ },
+
+ easeInExpo: function(t) {
+ return (t === 0) ? 0 : Math.pow(2, 10 * (t - 1));
+ },
+
+ easeOutExpo: function(t) {
+ return (t === 1) ? 1 : -Math.pow(2, -10 * t) + 1;
+ },
+
+ easeInOutExpo: function(t) {
+ if (t === 0) {
+ return 0;
+ }
+ if (t === 1) {
+ return 1;
+ }
+ if ((t /= 0.5) < 1) {
+ return 0.5 * Math.pow(2, 10 * (t - 1));
+ }
+ return 0.5 * (-Math.pow(2, -10 * --t) + 2);
+ },
+
+ easeInCirc: function(t) {
+ if (t >= 1) {
+ return t;
+ }
+ return -(Math.sqrt(1 - t * t) - 1);
+ },
+
+ easeOutCirc: function(t) {
+ return Math.sqrt(1 - (t = t - 1) * t);
+ },
+
+ easeInOutCirc: function(t) {
+ if ((t /= 0.5) < 1) {
+ return -0.5 * (Math.sqrt(1 - t * t) - 1);
+ }
+ return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
+ },
+
+ easeInElastic: function(t) {
+ var s = 1.70158;
+ var p = 0;
+ var a = 1;
+ if (t === 0) {
+ return 0;
+ }
+ if (t === 1) {
+ return 1;
+ }
+ if (!p) {
+ p = 0.3;
+ }
+ if (a < 1) {
+ a = 1;
+ s = p / 4;
+ } else {
+ s = p / (2 * Math.PI) * Math.asin(1 / a);
+ }
+ return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));
+ },
+
+ easeOutElastic: function(t) {
+ var s = 1.70158;
+ var p = 0;
+ var a = 1;
+ if (t === 0) {
+ return 0;
+ }
+ if (t === 1) {
+ return 1;
+ }
+ if (!p) {
+ p = 0.3;
+ }
+ if (a < 1) {
+ a = 1;
+ s = p / 4;
+ } else {
+ s = p / (2 * Math.PI) * Math.asin(1 / a);
+ }
+ return a * Math.pow(2, -10 * t) * Math.sin((t - s) * (2 * Math.PI) / p) + 1;
+ },
+
+ easeInOutElastic: function(t) {
+ var s = 1.70158;
+ var p = 0;
+ var a = 1;
+ if (t === 0) {
+ return 0;
+ }
+ if ((t /= 0.5) === 2) {
+ return 1;
+ }
+ if (!p) {
+ p = 0.45;
+ }
+ if (a < 1) {
+ a = 1;
+ s = p / 4;
+ } else {
+ s = p / (2 * Math.PI) * Math.asin(1 / a);
+ }
+ if (t < 1) {
+ return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));
+ }
+ return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p) * 0.5 + 1;
+ },
+ easeInBack: function(t) {
+ var s = 1.70158;
+ return t * t * ((s + 1) * t - s);
+ },
+
+ easeOutBack: function(t) {
+ var s = 1.70158;
+ return (t = t - 1) * t * ((s + 1) * t + s) + 1;
+ },
+
+ easeInOutBack: function(t) {
+ var s = 1.70158;
+ if ((t /= 0.5) < 1) {
+ return 0.5 * (t * t * (((s *= (1.525)) + 1) * t - s));
+ }
+ return 0.5 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2);
+ },
+
+ easeInBounce: function(t) {
+ return 1 - effects.easeOutBounce(1 - t);
+ },
+
+ easeOutBounce: function(t) {
+ if (t < (1 / 2.75)) {
+ return 7.5625 * t * t;
+ }
+ if (t < (2 / 2.75)) {
+ return 7.5625 * (t -= (1.5 / 2.75)) * t + 0.75;
+ }
+ if (t < (2.5 / 2.75)) {
+ return 7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375;
+ }
+ return 7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375;
+ },
+
+ easeInOutBounce: function(t) {
+ if (t < 0.5) {
+ return effects.easeInBounce(t * 2) * 0.5;
+ }
+ return effects.easeOutBounce(t * 2 - 1) * 0.5 + 0.5;
+ }
+};
+
+var helpers_easing = {
+ effects: effects
+};
+
+// DEPRECATIONS
+
+/**
+ * Provided for backward compatibility, use Chart.helpers.easing.effects instead.
+ * @function Chart.helpers.easingEffects
+ * @deprecated since version 2.7.0
+ * @todo remove at version 3
+ * @private
+ */
+helpers_core.easingEffects = effects;
+
+var PI = Math.PI;
+var RAD_PER_DEG = PI / 180;
+var DOUBLE_PI = PI * 2;
+var HALF_PI = PI / 2;
+var QUARTER_PI = PI / 4;
+var TWO_THIRDS_PI = PI * 2 / 3;
+
+/**
+ * @namespace Chart.helpers.canvas
+ */
+var exports$1 = {
+ /**
+ * Clears the entire canvas associated to the given `chart`.
+ * @param {Chart} chart - The chart for which to clear the canvas.
+ */
+ clear: function(chart) {
+ chart.ctx.clearRect(0, 0, chart.width, chart.height);
+ },
+
+ /**
+ * Creates a "path" for a rectangle with rounded corners at position (x, y) with a
+ * given size (width, height) and the same `radius` for all corners.
+ * @param {CanvasRenderingContext2D} ctx - The canvas 2D Context.
+ * @param {number} x - The x axis of the coordinate for the rectangle starting point.
+ * @param {number} y - The y axis of the coordinate for the rectangle starting point.
+ * @param {number} width - The rectangle's width.
+ * @param {number} height - The rectangle's height.
+ * @param {number} radius - The rounded amount (in pixels) for the four corners.
+ * @todo handle `radius` as top-left, top-right, bottom-right, bottom-left array/object?
+ */
+ roundedRect: function(ctx, x, y, width, height, radius) {
+ if (radius) {
+ var r = Math.min(radius, height / 2, width / 2);
+ var left = x + r;
+ var top = y + r;
+ var right = x + width - r;
+ var bottom = y + height - r;
+
+ ctx.moveTo(x, top);
+ if (left < right && top < bottom) {
+ ctx.arc(left, top, r, -PI, -HALF_PI);
+ ctx.arc(right, top, r, -HALF_PI, 0);
+ ctx.arc(right, bottom, r, 0, HALF_PI);
+ ctx.arc(left, bottom, r, HALF_PI, PI);
+ } else if (left < right) {
+ ctx.moveTo(left, y);
+ ctx.arc(right, top, r, -HALF_PI, HALF_PI);
+ ctx.arc(left, top, r, HALF_PI, PI + HALF_PI);
+ } else if (top < bottom) {
+ ctx.arc(left, top, r, -PI, 0);
+ ctx.arc(left, bottom, r, 0, PI);
+ } else {
+ ctx.arc(left, top, r, -PI, PI);
+ }
+ ctx.closePath();
+ ctx.moveTo(x, y);
+ } else {
+ ctx.rect(x, y, width, height);
+ }
+ },
+
+ drawPoint: function(ctx, style, radius, x, y, rotation) {
+ var type, xOffset, yOffset, size, cornerRadius;
+ var rad = (rotation || 0) * RAD_PER_DEG;
+
+ if (style && typeof style === 'object') {
+ type = style.toString();
+ if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') {
+ ctx.save();
+ ctx.translate(x, y);
+ ctx.rotate(rad);
+ ctx.drawImage(style, -style.width / 2, -style.height / 2, style.width, style.height);
+ ctx.restore();
+ return;
+ }
+ }
+
+ if (isNaN(radius) || radius <= 0) {
+ return;
+ }
+
+ ctx.beginPath();
+
+ switch (style) {
+ // Default includes circle
+ default:
+ ctx.arc(x, y, radius, 0, DOUBLE_PI);
+ ctx.closePath();
+ break;
+ case 'triangle':
+ ctx.moveTo(x + Math.sin(rad) * radius, y - Math.cos(rad) * radius);
+ rad += TWO_THIRDS_PI;
+ ctx.lineTo(x + Math.sin(rad) * radius, y - Math.cos(rad) * radius);
+ rad += TWO_THIRDS_PI;
+ ctx.lineTo(x + Math.sin(rad) * radius, y - Math.cos(rad) * radius);
+ ctx.closePath();
+ break;
+ case 'rectRounded':
+ // NOTE: the rounded rect implementation changed to use `arc` instead of
+ // `quadraticCurveTo` since it generates better results when rect is
+ // almost a circle. 0.516 (instead of 0.5) produces results with visually
+ // closer proportion to the previous impl and it is inscribed in the
+ // circle with `radius`. For more details, see the following PRs:
+ // https://github.com/chartjs/Chart.js/issues/5597
+ // https://github.com/chartjs/Chart.js/issues/5858
+ cornerRadius = radius * 0.516;
+ size = radius - cornerRadius;
+ xOffset = Math.cos(rad + QUARTER_PI) * size;
+ yOffset = Math.sin(rad + QUARTER_PI) * size;
+ ctx.arc(x - xOffset, y - yOffset, cornerRadius, rad - PI, rad - HALF_PI);
+ ctx.arc(x + yOffset, y - xOffset, cornerRadius, rad - HALF_PI, rad);
+ ctx.arc(x + xOffset, y + yOffset, cornerRadius, rad, rad + HALF_PI);
+ ctx.arc(x - yOffset, y + xOffset, cornerRadius, rad + HALF_PI, rad + PI);
+ ctx.closePath();
+ break;
+ case 'rect':
+ if (!rotation) {
+ size = Math.SQRT1_2 * radius;
+ ctx.rect(x - size, y - size, 2 * size, 2 * size);
+ break;
+ }
+ rad += QUARTER_PI;
+ /* falls through */
+ case 'rectRot':
+ xOffset = Math.cos(rad) * radius;
+ yOffset = Math.sin(rad) * radius;
+ ctx.moveTo(x - xOffset, y - yOffset);
+ ctx.lineTo(x + yOffset, y - xOffset);
+ ctx.lineTo(x + xOffset, y + yOffset);
+ ctx.lineTo(x - yOffset, y + xOffset);
+ ctx.closePath();
+ break;
+ case 'crossRot':
+ rad += QUARTER_PI;
+ /* falls through */
+ case 'cross':
+ xOffset = Math.cos(rad) * radius;
+ yOffset = Math.sin(rad) * radius;
+ ctx.moveTo(x - xOffset, y - yOffset);
+ ctx.lineTo(x + xOffset, y + yOffset);
+ ctx.moveTo(x + yOffset, y - xOffset);
+ ctx.lineTo(x - yOffset, y + xOffset);
+ break;
+ case 'star':
+ xOffset = Math.cos(rad) * radius;
+ yOffset = Math.sin(rad) * radius;
+ ctx.moveTo(x - xOffset, y - yOffset);
+ ctx.lineTo(x + xOffset, y + yOffset);
+ ctx.moveTo(x + yOffset, y - xOffset);
+ ctx.lineTo(x - yOffset, y + xOffset);
+ rad += QUARTER_PI;
+ xOffset = Math.cos(rad) * radius;
+ yOffset = Math.sin(rad) * radius;
+ ctx.moveTo(x - xOffset, y - yOffset);
+ ctx.lineTo(x + xOffset, y + yOffset);
+ ctx.moveTo(x + yOffset, y - xOffset);
+ ctx.lineTo(x - yOffset, y + xOffset);
+ break;
+ case 'line':
+ xOffset = Math.cos(rad) * radius;
+ yOffset = Math.sin(rad) * radius;
+ ctx.moveTo(x - xOffset, y - yOffset);
+ ctx.lineTo(x + xOffset, y + yOffset);
+ break;
+ case 'dash':
+ ctx.moveTo(x, y);
+ ctx.lineTo(x + Math.cos(rad) * radius, y + Math.sin(rad) * radius);
+ break;
+ }
+
+ ctx.fill();
+ ctx.stroke();
+ },
+
+ /**
+ * Returns true if the point is inside the rectangle
+ * @param {object} point - The point to test
+ * @param {object} area - The rectangle
+ * @returns {boolean}
+ * @private
+ */
+ _isPointInArea: function(point, area) {
+ var epsilon = 1e-6; // 1e-6 is margin in pixels for accumulated error.
+
+ return point.x > area.left - epsilon && point.x < area.right + epsilon &&
+ point.y > area.top - epsilon && point.y < area.bottom + epsilon;
+ },
+
+ clipArea: function(ctx, area) {
+ ctx.save();
+ ctx.beginPath();
+ ctx.rect(area.left, area.top, area.right - area.left, area.bottom - area.top);
+ ctx.clip();
+ },
+
+ unclipArea: function(ctx) {
+ ctx.restore();
+ },
+
+ lineTo: function(ctx, previous, target, flip) {
+ var stepped = target.steppedLine;
+ if (stepped) {
+ if (stepped === 'middle') {
+ var midpoint = (previous.x + target.x) / 2.0;
+ ctx.lineTo(midpoint, flip ? target.y : previous.y);
+ ctx.lineTo(midpoint, flip ? previous.y : target.y);
+ } else if ((stepped === 'after' && !flip) || (stepped !== 'after' && flip)) {
+ ctx.lineTo(previous.x, target.y);
+ } else {
+ ctx.lineTo(target.x, previous.y);
+ }
+ ctx.lineTo(target.x, target.y);
+ return;
+ }
+
+ if (!target.tension) {
+ ctx.lineTo(target.x, target.y);
+ return;
+ }
+
+ ctx.bezierCurveTo(
+ flip ? previous.controlPointPreviousX : previous.controlPointNextX,
+ flip ? previous.controlPointPreviousY : previous.controlPointNextY,
+ flip ? target.controlPointNextX : target.controlPointPreviousX,
+ flip ? target.controlPointNextY : target.controlPointPreviousY,
+ target.x,
+ target.y);
+ }
+};
+
+var helpers_canvas = exports$1;
+
+// DEPRECATIONS
+
+/**
+ * Provided for backward compatibility, use Chart.helpers.canvas.clear instead.
+ * @namespace Chart.helpers.clear
+ * @deprecated since version 2.7.0
+ * @todo remove at version 3
+ * @private
+ */
+helpers_core.clear = exports$1.clear;
+
+/**
+ * Provided for backward compatibility, use Chart.helpers.canvas.roundedRect instead.
+ * @namespace Chart.helpers.drawRoundedRectangle
+ * @deprecated since version 2.7.0
+ * @todo remove at version 3
+ * @private
+ */
+helpers_core.drawRoundedRectangle = function(ctx) {
+ ctx.beginPath();
+ exports$1.roundedRect.apply(exports$1, arguments);
+};
+
+var defaults = {
+ /**
+ * @private
+ */
+ _set: function(scope, values) {
+ return helpers_core.merge(this[scope] || (this[scope] = {}), values);
+ }
+};
+
+// TODO(v3): remove 'global' from namespace. all default are global and
+// there's inconsistency around which options are under 'global'
+defaults._set('global', {
+ defaultColor: 'rgba(0,0,0,0.1)',
+ defaultFontColor: '#666',
+ defaultFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
+ defaultFontSize: 12,
+ defaultFontStyle: 'normal',
+ defaultLineHeight: 1.2,
+ showLines: true
+});
+
+var core_defaults = defaults;
+
+var valueOrDefault = helpers_core.valueOrDefault;
+
+/**
+ * Converts the given font object into a CSS font string.
+ * @param {object} font - A font object.
+ * @return {string} The CSS font string. See https://developer.mozilla.org/en-US/docs/Web/CSS/font
+ * @private
+ */
+function toFontString(font) {
+ if (!font || helpers_core.isNullOrUndef(font.size) || helpers_core.isNullOrUndef(font.family)) {
+ return null;
+ }
+
+ return (font.style ? font.style + ' ' : '')
+ + (font.weight ? font.weight + ' ' : '')
+ + font.size + 'px '
+ + font.family;
+}
+
+/**
+ * @alias Chart.helpers.options
+ * @namespace
+ */
+var helpers_options = {
+ /**
+ * Converts the given line height `value` in pixels for a specific font `size`.
+ * @param {number|string} value - The lineHeight to parse (eg. 1.6, '14px', '75%', '1.6em').
+ * @param {number} size - The font size (in pixels) used to resolve relative `value`.
+ * @returns {number} The effective line height in pixels (size * 1.2 if value is invalid).
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
+ * @since 2.7.0
+ */
+ toLineHeight: function(value, size) {
+ var matches = ('' + value).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);
+ if (!matches || matches[1] === 'normal') {
+ return size * 1.2;
+ }
+
+ value = +matches[2];
+
+ switch (matches[3]) {
+ case 'px':
+ return value;
+ case '%':
+ value /= 100;
+ break;
+ }
+
+ return size * value;
+ },
+
+ /**
+ * Converts the given value into a padding object with pre-computed width/height.
+ * @param {number|object} value - If a number, set the value to all TRBL component,
+ * else, if and object, use defined properties and sets undefined ones to 0.
+ * @returns {object} The padding values (top, right, bottom, left, width, height)
+ * @since 2.7.0
+ */
+ toPadding: function(value) {
+ var t, r, b, l;
+
+ if (helpers_core.isObject(value)) {
+ t = +value.top || 0;
+ r = +value.right || 0;
+ b = +value.bottom || 0;
+ l = +value.left || 0;
+ } else {
+ t = r = b = l = +value || 0;
+ }
+
+ return {
+ top: t,
+ right: r,
+ bottom: b,
+ left: l,
+ height: t + b,
+ width: l + r
+ };
+ },
+
+ /**
+ * Parses font options and returns the font object.
+ * @param {object} options - A object that contains font options to be parsed.
+ * @return {object} The font object.
+ * @todo Support font.* options and renamed to toFont().
+ * @private
+ */
+ _parseFont: function(options) {
+ var globalDefaults = core_defaults.global;
+ var size = valueOrDefault(options.fontSize, globalDefaults.defaultFontSize);
+ var font = {
+ family: valueOrDefault(options.fontFamily, globalDefaults.defaultFontFamily),
+ lineHeight: helpers_core.options.toLineHeight(valueOrDefault(options.lineHeight, globalDefaults.defaultLineHeight), size),
+ size: size,
+ style: valueOrDefault(options.fontStyle, globalDefaults.defaultFontStyle),
+ weight: null,
+ string: ''
+ };
+
+ font.string = toFontString(font);
+ return font;
+ },
+
+ /**
+ * Evaluates the given `inputs` sequentially and returns the first defined value.
+ * @param {Array} inputs - An array of values, falling back to the last value.
+ * @param {object} [context] - If defined and the current value is a function, the value
+ * is called with `context` as first argument and the result becomes the new input.
+ * @param {number} [index] - If defined and the current value is an array, the value
+ * at `index` become the new input.
+ * @param {object} [info] - object to return information about resolution in
+ * @param {boolean} [info.cacheable] - Will be set to `false` if option is not cacheable.
+ * @since 2.7.0
+ */
+ resolve: function(inputs, context, index, info) {
+ var cacheable = true;
+ var i, ilen, value;
+
+ for (i = 0, ilen = inputs.length; i < ilen; ++i) {
+ value = inputs[i];
+ if (value === undefined) {
+ continue;
+ }
+ if (context !== undefined && typeof value === 'function') {
+ value = value(context);
+ cacheable = false;
+ }
+ if (index !== undefined && helpers_core.isArray(value)) {
+ value = value[index];
+ cacheable = false;
+ }
+ if (value !== undefined) {
+ if (info && !cacheable) {
+ info.cacheable = false;
+ }
+ return value;
+ }
+ }
+ }
+};
+
+/**
+ * @alias Chart.helpers.math
+ * @namespace
+ */
+var exports$2 = {
+ /**
+ * Returns an array of factors sorted from 1 to sqrt(value)
+ * @private
+ */
+ _factorize: function(value) {
+ var result = [];
+ var sqrt = Math.sqrt(value);
+ var i;
+
+ for (i = 1; i < sqrt; i++) {
+ if (value % i === 0) {
+ result.push(i);
+ result.push(value / i);
+ }
+ }
+ if (sqrt === (sqrt | 0)) { // if value is a square number
+ result.push(sqrt);
+ }
+
+ result.sort(function(a, b) {
+ return a - b;
+ }).pop();
+ return result;
+ },
+
+ log10: Math.log10 || function(x) {
+ var exponent = Math.log(x) * Math.LOG10E; // Math.LOG10E = 1 / Math.LN10.
+ // Check for whole powers of 10,
+ // which due to floating point rounding error should be corrected.
+ var powerOf10 = Math.round(exponent);
+ var isPowerOf10 = x === Math.pow(10, powerOf10);
+
+ return isPowerOf10 ? powerOf10 : exponent;
+ }
+};
+
+var helpers_math = exports$2;
+
+// DEPRECATIONS
+
+/**
+ * Provided for backward compatibility, use Chart.helpers.math.log10 instead.
+ * @namespace Chart.helpers.log10
+ * @deprecated since version 2.9.0
+ * @todo remove at version 3
+ * @private
+ */
+helpers_core.log10 = exports$2.log10;
+
+var getRtlAdapter = function(rectX, width) {
+ return {
+ x: function(x) {
+ return rectX + rectX + width - x;
+ },
+ setWidth: function(w) {
+ width = w;
+ },
+ textAlign: function(align) {
+ if (align === 'center') {
+ return align;
+ }
+ return align === 'right' ? 'left' : 'right';
+ },
+ xPlus: function(x, value) {
+ return x - value;
+ },
+ leftForLtr: function(x, itemWidth) {
+ return x - itemWidth;
+ },
+ };
+};
+
+var getLtrAdapter = function() {
+ return {
+ x: function(x) {
+ return x;
+ },
+ setWidth: function(w) { // eslint-disable-line no-unused-vars
+ },
+ textAlign: function(align) {
+ return align;
+ },
+ xPlus: function(x, value) {
+ return x + value;
+ },
+ leftForLtr: function(x, _itemWidth) { // eslint-disable-line no-unused-vars
+ return x;
+ },
+ };
+};
+
+var getAdapter = function(rtl, rectX, width) {
+ return rtl ? getRtlAdapter(rectX, width) : getLtrAdapter();
+};
+
+var overrideTextDirection = function(ctx, direction) {
+ var style, original;
+ if (direction === 'ltr' || direction === 'rtl') {
+ style = ctx.canvas.style;
+ original = [
+ style.getPropertyValue('direction'),
+ style.getPropertyPriority('direction'),
+ ];
+
+ style.setProperty('direction', direction, 'important');
+ ctx.prevTextDirection = original;
+ }
+};
+
+var restoreTextDirection = function(ctx) {
+ var original = ctx.prevTextDirection;
+ if (original !== undefined) {
+ delete ctx.prevTextDirection;
+ ctx.canvas.style.setProperty('direction', original[0], original[1]);
+ }
+};
+
+var helpers_rtl = {
+ getRtlAdapter: getAdapter,
+ overrideTextDirection: overrideTextDirection,
+ restoreTextDirection: restoreTextDirection,
+};
+
+var helpers$1 = helpers_core;
+var easing = helpers_easing;
+var canvas = helpers_canvas;
+var options = helpers_options;
+var math = helpers_math;
+var rtl = helpers_rtl;
+helpers$1.easing = easing;
+helpers$1.canvas = canvas;
+helpers$1.options = options;
+helpers$1.math = math;
+helpers$1.rtl = rtl;
+
+function interpolate(start, view, model, ease) {
+ var keys = Object.keys(model);
+ var i, ilen, key, actual, origin, target, type, c0, c1;
+
+ for (i = 0, ilen = keys.length; i < ilen; ++i) {
+ key = keys[i];
+
+ target = model[key];
+
+ // if a value is added to the model after pivot() has been called, the view
+ // doesn't contain it, so let's initialize the view to the target value.
+ if (!view.hasOwnProperty(key)) {
+ view[key] = target;
+ }
+
+ actual = view[key];
+
+ if (actual === target || key[0] === '_') {
+ continue;
+ }
+
+ if (!start.hasOwnProperty(key)) {
+ start[key] = actual;
+ }
+
+ origin = start[key];
+
+ type = typeof target;
+
+ if (type === typeof origin) {
+ if (type === 'string') {
+ c0 = chartjsColor(origin);
+ if (c0.valid) {
+ c1 = chartjsColor(target);
+ if (c1.valid) {
+ view[key] = c1.mix(c0, ease).rgbString();
+ continue;
+ }
+ }
+ } else if (helpers$1.isFinite(origin) && helpers$1.isFinite(target)) {
+ view[key] = origin + (target - origin) * ease;
+ continue;
+ }
+ }
+
+ view[key] = target;
+ }
+}
+
+var Element = function(configuration) {
+ helpers$1.extend(this, configuration);
+ this.initialize.apply(this, arguments);
+};
+
+helpers$1.extend(Element.prototype, {
+ _type: undefined,
+
+ initialize: function() {
+ this.hidden = false;
+ },
+
+ pivot: function() {
+ var me = this;
+ if (!me._view) {
+ me._view = helpers$1.extend({}, me._model);
+ }
+ me._start = {};
+ return me;
+ },
+
+ transition: function(ease) {
+ var me = this;
+ var model = me._model;
+ var start = me._start;
+ var view = me._view;
+
+ // No animation -> No Transition
+ if (!model || ease === 1) {
+ me._view = helpers$1.extend({}, model);
+ me._start = null;
+ return me;
+ }
+
+ if (!view) {
+ view = me._view = {};
+ }
+
+ if (!start) {
+ start = me._start = {};
+ }
+
+ interpolate(start, view, model, ease);
+
+ return me;
+ },
+
+ tooltipPosition: function() {
+ return {
+ x: this._model.x,
+ y: this._model.y
+ };
+ },
+
+ hasValue: function() {
+ return helpers$1.isNumber(this._model.x) && helpers$1.isNumber(this._model.y);
+ }
+});
+
+Element.extend = helpers$1.inherits;
+
+var core_element = Element;
+
+var exports$3 = core_element.extend({
+ chart: null, // the animation associated chart instance
+ currentStep: 0, // the current animation step
+ numSteps: 60, // default number of steps
+ easing: '', // the easing to use for this animation
+ render: null, // render function used by the animation service
+
+ onAnimationProgress: null, // user specified callback to fire on each step of the animation
+ onAnimationComplete: null, // user specified callback to fire when the animation finishes
+});
+
+var core_animation = exports$3;
+
+// DEPRECATIONS
+
+/**
+ * Provided for backward compatibility, use Chart.Animation instead
+ * @prop Chart.Animation#animationObject
+ * @deprecated since version 2.6.0
+ * @todo remove at version 3
+ */
+Object.defineProperty(exports$3.prototype, 'animationObject', {
+ get: function() {
+ return this;
+ }
+});
+
+/**
+ * Provided for backward compatibility, use Chart.Animation#chart instead
+ * @prop Chart.Animation#chartInstance
+ * @deprecated since version 2.6.0
+ * @todo remove at version 3
+ */
+Object.defineProperty(exports$3.prototype, 'chartInstance', {
+ get: function() {
+ return this.chart;
+ },
+ set: function(value) {
+ this.chart = value;
+ }
+});
+
+core_defaults._set('global', {
+ animation: {
+ duration: 1000,
+ easing: 'easeOutQuart',
+ onProgress: helpers$1.noop,
+ onComplete: helpers$1.noop
+ }
+});
+
+var core_animations = {
+ animations: [],
+ request: null,
+
+ /**
+ * @param {Chart} chart - The chart to animate.
+ * @param {Chart.Animation} animation - The animation that we will animate.
+ * @param {number} duration - The animation duration in ms.
+ * @param {boolean} lazy - if true, the chart is not marked as animating to enable more responsive interactions
+ */
+ addAnimation: function(chart, animation, duration, lazy) {
+ var animations = this.animations;
+ var i, ilen;
+
+ animation.chart = chart;
+ animation.startTime = Date.now();
+ animation.duration = duration;
+
+ if (!lazy) {
+ chart.animating = true;
+ }
+
+ for (i = 0, ilen = animations.length; i < ilen; ++i) {
+ if (animations[i].chart === chart) {
+ animations[i] = animation;
+ return;
+ }
+ }
+
+ animations.push(animation);
+
+ // If there are no animations queued, manually kickstart a digest, for lack of a better word
+ if (animations.length === 1) {
+ this.requestAnimationFrame();
+ }
+ },
+
+ cancelAnimation: function(chart) {
+ var index = helpers$1.findIndex(this.animations, function(animation) {
+ return animation.chart === chart;
+ });
+
+ if (index !== -1) {
+ this.animations.splice(index, 1);
+ chart.animating = false;
+ }
+ },
+
+ requestAnimationFrame: function() {
+ var me = this;
+ if (me.request === null) {
+ // Skip animation frame requests until the active one is executed.
+ // This can happen when processing mouse events, e.g. 'mousemove'
+ // and 'mouseout' events will trigger multiple renders.
+ me.request = helpers$1.requestAnimFrame.call(window, function() {
+ me.request = null;
+ me.startDigest();
+ });
+ }
+ },
+
+ /**
+ * @private
+ */
+ startDigest: function() {
+ var me = this;
+
+ me.advance();
+
+ // Do we have more stuff to animate?
+ if (me.animations.length > 0) {
+ me.requestAnimationFrame();
+ }
+ },
+
+ /**
+ * @private
+ */
+ advance: function() {
+ var animations = this.animations;
+ var animation, chart, numSteps, nextStep;
+ var i = 0;
+
+ // 1 animation per chart, so we are looping charts here
+ while (i < animations.length) {
+ animation = animations[i];
+ chart = animation.chart;
+ numSteps = animation.numSteps;
+
+ // Make sure that currentStep starts at 1
+ // https://github.com/chartjs/Chart.js/issues/6104
+ nextStep = Math.floor((Date.now() - animation.startTime) / animation.duration * numSteps) + 1;
+ animation.currentStep = Math.min(nextStep, numSteps);
+
+ helpers$1.callback(animation.render, [chart, animation], chart);
+ helpers$1.callback(animation.onAnimationProgress, [animation], chart);
+
+ if (animation.currentStep >= numSteps) {
+ helpers$1.callback(animation.onAnimationComplete, [animation], chart);
+ chart.animating = false;
+ animations.splice(i, 1);
+ } else {
+ ++i;
+ }
+ }
+ }
+};
+
+var resolve = helpers$1.options.resolve;
+
+var arrayEvents = ['push', 'pop', 'shift', 'splice', 'unshift'];
+
+/**
+ * Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice',
+ * 'unshift') and notify the listener AFTER the array has been altered. Listeners are
+ * called on the 'onData*' callbacks (e.g. onDataPush, etc.) with same arguments.
+ */
+function listenArrayEvents(array, listener) {
+ if (array._chartjs) {
+ array._chartjs.listeners.push(listener);
+ return;
+ }
+
+ Object.defineProperty(array, '_chartjs', {
+ configurable: true,
+ enumerable: false,
+ value: {
+ listeners: [listener]
+ }
+ });
+
+ arrayEvents.forEach(function(key) {
+ var method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);
+ var base = array[key];
+
+ Object.defineProperty(array, key, {
+ configurable: true,
+ enumerable: false,
+ value: function() {
+ var args = Array.prototype.slice.call(arguments);
+ var res = base.apply(this, args);
+
+ helpers$1.each(array._chartjs.listeners, function(object) {
+ if (typeof object[method] === 'function') {
+ object[method].apply(object, args);
+ }
+ });
+
+ return res;
+ }
+ });
+ });
+}
+
+/**
+ * Removes the given array event listener and cleanup extra attached properties (such as
+ * the _chartjs stub and overridden methods) if array doesn't have any more listeners.
+ */
+function unlistenArrayEvents(array, listener) {
+ var stub = array._chartjs;
+ if (!stub) {
+ return;
+ }
+
+ var listeners = stub.listeners;
+ var index = listeners.indexOf(listener);
+ if (index !== -1) {
+ listeners.splice(index, 1);
+ }
+
+ if (listeners.length > 0) {
+ return;
+ }
+
+ arrayEvents.forEach(function(key) {
+ delete array[key];
+ });
+
+ delete array._chartjs;
+}
+
+// Base class for all dataset controllers (line, bar, etc)
+var DatasetController = function(chart, datasetIndex) {
+ this.initialize(chart, datasetIndex);
+};
+
+helpers$1.extend(DatasetController.prototype, {
+
+ /**
+ * Element type used to generate a meta dataset (e.g. Chart.element.Line).
+ * @type {Chart.core.element}
+ */
+ datasetElementType: null,
+
+ /**
+ * Element type used to generate a meta data (e.g. Chart.element.Point).
+ * @type {Chart.core.element}
+ */
+ dataElementType: null,
+
+ /**
+ * Dataset element option keys to be resolved in _resolveDatasetElementOptions.
+ * A derived controller may override this to resolve controller-specific options.
+ * The keys defined here are for backward compatibility for legend styles.
+ * @private
+ */
+ _datasetElementOptions: [
+ 'backgroundColor',
+ 'borderCapStyle',
+ 'borderColor',
+ 'borderDash',
+ 'borderDashOffset',
+ 'borderJoinStyle',
+ 'borderWidth'
+ ],
+
+ /**
+ * Data element option keys to be resolved in _resolveDataElementOptions.
+ * A derived controller may override this to resolve controller-specific options.
+ * The keys defined here are for backward compatibility for legend styles.
+ * @private
+ */
+ _dataElementOptions: [
+ 'backgroundColor',
+ 'borderColor',
+ 'borderWidth',
+ 'pointStyle'
+ ],
+
+ initialize: function(chart, datasetIndex) {
+ var me = this;
+ me.chart = chart;
+ me.index = datasetIndex;
+ me.linkScales();
+ me.addElements();
+ me._type = me.getMeta().type;
+ },
+
+ updateIndex: function(datasetIndex) {
+ this.index = datasetIndex;
+ },
+
+ linkScales: function() {
+ var me = this;
+ var meta = me.getMeta();
+ var chart = me.chart;
+ var scales = chart.scales;
+ var dataset = me.getDataset();
+ var scalesOpts = chart.options.scales;
+
+ if (meta.xAxisID === null || !(meta.xAxisID in scales) || dataset.xAxisID) {
+ meta.xAxisID = dataset.xAxisID || scalesOpts.xAxes[0].id;
+ }
+ if (meta.yAxisID === null || !(meta.yAxisID in scales) || dataset.yAxisID) {
+ meta.yAxisID = dataset.yAxisID || scalesOpts.yAxes[0].id;
+ }
+ },
+
+ getDataset: function() {
+ return this.chart.data.datasets[this.index];
+ },
+
+ getMeta: function() {
+ return this.chart.getDatasetMeta(this.index);
+ },
+
+ getScaleForId: function(scaleID) {
+ return this.chart.scales[scaleID];
+ },
+
+ /**
+ * @private
+ */
+ _getValueScaleId: function() {
+ return this.getMeta().yAxisID;
+ },
+
+ /**
+ * @private
+ */
+ _getIndexScaleId: function() {
+ return this.getMeta().xAxisID;
+ },
+
+ /**
+ * @private
+ */
+ _getValueScale: function() {
+ return this.getScaleForId(this._getValueScaleId());
+ },
+
+ /**
+ * @private
+ */
+ _getIndexScale: function() {
+ return this.getScaleForId(this._getIndexScaleId());
+ },
+
+ reset: function() {
+ this._update(true);
+ },
+
+ /**
+ * @private
+ */
+ destroy: function() {
+ if (this._data) {
+ unlistenArrayEvents(this._data, this);
+ }
+ },
+
+ createMetaDataset: function() {
+ var me = this;
+ var type = me.datasetElementType;
+ return type && new type({
+ _chart: me.chart,
+ _datasetIndex: me.index
+ });
+ },
+
+ createMetaData: function(index) {
+ var me = this;
+ var type = me.dataElementType;
+ return type && new type({
+ _chart: me.chart,
+ _datasetIndex: me.index,
+ _index: index
+ });
+ },
+
+ addElements: function() {
+ var me = this;
+ var meta = me.getMeta();
+ var data = me.getDataset().data || [];
+ var metaData = meta.data;
+ var i, ilen;
+
+ for (i = 0, ilen = data.length; i < ilen; ++i) {
+ metaData[i] = metaData[i] || me.createMetaData(i);
+ }
+
+ meta.dataset = meta.dataset || me.createMetaDataset();
+ },
+
+ addElementAndReset: function(index) {
+ var element = this.createMetaData(index);
+ this.getMeta().data.splice(index, 0, element);
+ this.updateElement(element, index, true);
+ },
+
+ buildOrUpdateElements: function() {
+ var me = this;
+ var dataset = me.getDataset();
+ var data = dataset.data || (dataset.data = []);
+
+ // In order to correctly handle data addition/deletion animation (an thus simulate
+ // real-time charts), we need to monitor these data modifications and synchronize
+ // the internal meta data accordingly.
+ if (me._data !== data) {
+ if (me._data) {
+ // This case happens when the user replaced the data array instance.
+ unlistenArrayEvents(me._data, me);
+ }
+
+ if (data && Object.isExtensible(data)) {
+ listenArrayEvents(data, me);
+ }
+ me._data = data;
+ }
+
+ // Re-sync meta data in case the user replaced the data array or if we missed
+ // any updates and so make sure that we handle number of datapoints changing.
+ me.resyncElements();
+ },
+
+ /**
+ * Returns the merged user-supplied and default dataset-level options
+ * @private
+ */
+ _configure: function() {
+ var me = this;
+ me._config = helpers$1.merge({}, [
+ me.chart.options.datasets[me._type],
+ me.getDataset(),
+ ], {
+ merger: function(key, target, source) {
+ if (key !== '_meta' && key !== 'data') {
+ helpers$1._merger(key, target, source);
+ }
+ }
+ });
+ },
+
+ _update: function(reset) {
+ var me = this;
+ me._configure();
+ me._cachedDataOpts = null;
+ me.update(reset);
+ },
+
+ update: helpers$1.noop,
+
+ transition: function(easingValue) {
+ var meta = this.getMeta();
+ var elements = meta.data || [];
+ var ilen = elements.length;
+ var i = 0;
+
+ for (; i < ilen; ++i) {
+ elements[i].transition(easingValue);
+ }
+
+ if (meta.dataset) {
+ meta.dataset.transition(easingValue);
+ }
+ },
+
+ draw: function() {
+ var meta = this.getMeta();
+ var elements = meta.data || [];
+ var ilen = elements.length;
+ var i = 0;
+
+ if (meta.dataset) {
+ meta.dataset.draw();
+ }
+
+ for (; i < ilen; ++i) {
+ elements[i].draw();
+ }
+ },
+
+ /**
+ * Returns a set of predefined style properties that should be used to represent the dataset
+ * or the data if the index is specified
+ * @param {number} index - data index
+ * @return {IStyleInterface} style object
+ */
+ getStyle: function(index) {
+ var me = this;
+ var meta = me.getMeta();
+ var dataset = meta.dataset;
+ var style;
+
+ me._configure();
+ if (dataset && index === undefined) {
+ style = me._resolveDatasetElementOptions(dataset || {});
+ } else {
+ index = index || 0;
+ style = me._resolveDataElementOptions(meta.data[index] || {}, index);
+ }
+
+ if (style.fill === false || style.fill === null) {
+ style.backgroundColor = style.borderColor;
+ }
+
+ return style;
+ },
+
+ /**
+ * @private
+ */
+ _resolveDatasetElementOptions: function(element, hover) {
+ var me = this;
+ var chart = me.chart;
+ var datasetOpts = me._config;
+ var custom = element.custom || {};
+ var options = chart.options.elements[me.datasetElementType.prototype._type] || {};
+ var elementOptions = me._datasetElementOptions;
+ var values = {};
+ var i, ilen, key, readKey;
+
+ // Scriptable options
+ var context = {
+ chart: chart,
+ dataset: me.getDataset(),
+ datasetIndex: me.index,
+ hover: hover
+ };
+
+ for (i = 0, ilen = elementOptions.length; i < ilen; ++i) {
+ key = elementOptions[i];
+ readKey = hover ? 'hover' + key.charAt(0).toUpperCase() + key.slice(1) : key;
+ values[key] = resolve([
+ custom[readKey],
+ datasetOpts[readKey],
+ options[readKey]
+ ], context);
+ }
+
+ return values;
+ },
+
+ /**
+ * @private
+ */
+ _resolveDataElementOptions: function(element, index) {
+ var me = this;
+ var custom = element && element.custom;
+ var cached = me._cachedDataOpts;
+ if (cached && !custom) {
+ return cached;
+ }
+ var chart = me.chart;
+ var datasetOpts = me._config;
+ var options = chart.options.elements[me.dataElementType.prototype._type] || {};
+ var elementOptions = me._dataElementOptions;
+ var values = {};
+
+ // Scriptable options
+ var context = {
+ chart: chart,
+ dataIndex: index,
+ dataset: me.getDataset(),
+ datasetIndex: me.index
+ };
+
+ // `resolve` sets cacheable to `false` if any option is indexed or scripted
+ var info = {cacheable: !custom};
+
+ var keys, i, ilen, key;
+
+ custom = custom || {};
+
+ if (helpers$1.isArray(elementOptions)) {
+ for (i = 0, ilen = elementOptions.length; i < ilen; ++i) {
+ key = elementOptions[i];
+ values[key] = resolve([
+ custom[key],
+ datasetOpts[key],
+ options[key]
+ ], context, index, info);
+ }
+ } else {
+ keys = Object.keys(elementOptions);
+ for (i = 0, ilen = keys.length; i < ilen; ++i) {
+ key = keys[i];
+ values[key] = resolve([
+ custom[key],
+ datasetOpts[elementOptions[key]],
+ datasetOpts[key],
+ options[key]
+ ], context, index, info);
+ }
+ }
+
+ if (info.cacheable) {
+ me._cachedDataOpts = Object.freeze(values);
+ }
+
+ return values;
+ },
+
+ removeHoverStyle: function(element) {
+ helpers$1.merge(element._model, element.$previousStyle || {});
+ delete element.$previousStyle;
+ },
+
+ setHoverStyle: function(element) {
+ var dataset = this.chart.data.datasets[element._datasetIndex];
+ var index = element._index;
+ var custom = element.custom || {};
+ var model = element._model;
+ var getHoverColor = helpers$1.getHoverColor;
+
+ element.$previousStyle = {
+ backgroundColor: model.backgroundColor,
+ borderColor: model.borderColor,
+ borderWidth: model.borderWidth
+ };
+
+ model.backgroundColor = resolve([custom.hoverBackgroundColor, dataset.hoverBackgroundColor, getHoverColor(model.backgroundColor)], undefined, index);
+ model.borderColor = resolve([custom.hoverBorderColor, dataset.hoverBorderColor, getHoverColor(model.borderColor)], undefined, index);
+ model.borderWidth = resolve([custom.hoverBorderWidth, dataset.hoverBorderWidth, model.borderWidth], undefined, index);
+ },
+
+ /**
+ * @private
+ */
+ _removeDatasetHoverStyle: function() {
+ var element = this.getMeta().dataset;
+
+ if (element) {
+ this.removeHoverStyle(element);
+ }
+ },
+
+ /**
+ * @private
+ */
+ _setDatasetHoverStyle: function() {
+ var element = this.getMeta().dataset;
+ var prev = {};
+ var i, ilen, key, keys, hoverOptions, model;
+
+ if (!element) {
+ return;
+ }
+
+ model = element._model;
+ hoverOptions = this._resolveDatasetElementOptions(element, true);
+
+ keys = Object.keys(hoverOptions);
+ for (i = 0, ilen = keys.length; i < ilen; ++i) {
+ key = keys[i];
+ prev[key] = model[key];
+ model[key] = hoverOptions[key];
+ }
+
+ element.$previousStyle = prev;
+ },
+
+ /**
+ * @private
+ */
+ resyncElements: function() {
+ var me = this;
+ var meta = me.getMeta();
+ var data = me.getDataset().data;
+ var numMeta = meta.data.length;
+ var numData = data.length;
+
+ if (numData < numMeta) {
+ meta.data.splice(numData, numMeta - numData);
+ } else if (numData > numMeta) {
+ me.insertElements(numMeta, numData - numMeta);
+ }
+ },
+
+ /**
+ * @private
+ */
+ insertElements: function(start, count) {
+ for (var i = 0; i < count; ++i) {
+ this.addElementAndReset(start + i);
+ }
+ },
+
+ /**
+ * @private
+ */
+ onDataPush: function() {
+ var count = arguments.length;
+ this.insertElements(this.getDataset().data.length - count, count);
+ },
+
+ /**
+ * @private
+ */
+ onDataPop: function() {
+ this.getMeta().data.pop();
+ },
+
+ /**
+ * @private
+ */
+ onDataShift: function() {
+ this.getMeta().data.shift();
+ },
+
+ /**
+ * @private
+ */
+ onDataSplice: function(start, count) {
+ this.getMeta().data.splice(start, count);
+ this.insertElements(start, arguments.length - 2);
+ },
+
+ /**
+ * @private
+ */
+ onDataUnshift: function() {
+ this.insertElements(0, arguments.length);
+ }
+});
+
+DatasetController.extend = helpers$1.inherits;
+
+var core_datasetController = DatasetController;
+
+var TAU = Math.PI * 2;
+
+core_defaults._set('global', {
+ elements: {
+ arc: {
+ backgroundColor: core_defaults.global.defaultColor,
+ borderColor: '#fff',
+ borderWidth: 2,
+ borderAlign: 'center'
+ }
+ }
+});
+
+function clipArc(ctx, arc) {
+ var startAngle = arc.startAngle;
+ var endAngle = arc.endAngle;
+ var pixelMargin = arc.pixelMargin;
+ var angleMargin = pixelMargin / arc.outerRadius;
+ var x = arc.x;
+ var y = arc.y;
+
+ // Draw an inner border by cliping the arc and drawing a double-width border
+ // Enlarge the clipping arc by 0.33 pixels to eliminate glitches between borders
+ ctx.beginPath();
+ ctx.arc(x, y, arc.outerRadius, startAngle - angleMargin, endAngle + angleMargin);
+ if (arc.innerRadius > pixelMargin) {
+ angleMargin = pixelMargin / arc.innerRadius;
+ ctx.arc(x, y, arc.innerRadius - pixelMargin, endAngle + angleMargin, startAngle - angleMargin, true);
+ } else {
+ ctx.arc(x, y, pixelMargin, endAngle + Math.PI / 2, startAngle - Math.PI / 2);
+ }
+ ctx.closePath();
+ ctx.clip();
+}
+
+function drawFullCircleBorders(ctx, vm, arc, inner) {
+ var endAngle = arc.endAngle;
+ var i;
+
+ if (inner) {
+ arc.endAngle = arc.startAngle + TAU;
+ clipArc(ctx, arc);
+ arc.endAngle = endAngle;
+ if (arc.endAngle === arc.startAngle && arc.fullCircles) {
+ arc.endAngle += TAU;
+ arc.fullCircles--;
+ }
+ }
+
+ ctx.beginPath();
+ ctx.arc(arc.x, arc.y, arc.innerRadius, arc.startAngle + TAU, arc.startAngle, true);
+ for (i = 0; i < arc.fullCircles; ++i) {
+ ctx.stroke();
+ }
+
+ ctx.beginPath();
+ ctx.arc(arc.x, arc.y, vm.outerRadius, arc.startAngle, arc.startAngle + TAU);
+ for (i = 0; i < arc.fullCircles; ++i) {
+ ctx.stroke();
+ }
+}
+
+function drawBorder(ctx, vm, arc) {
+ var inner = vm.borderAlign === 'inner';
+
+ if (inner) {
+ ctx.lineWidth = vm.borderWidth * 2;
+ ctx.lineJoin = 'round';
+ } else {
+ ctx.lineWidth = vm.borderWidth;
+ ctx.lineJoin = 'bevel';
+ }
+
+ if (arc.fullCircles) {
+ drawFullCircleBorders(ctx, vm, arc, inner);
+ }
+
+ if (inner) {
+ clipArc(ctx, arc);
+ }
+
+ ctx.beginPath();
+ ctx.arc(arc.x, arc.y, vm.outerRadius, arc.startAngle, arc.endAngle);
+ ctx.arc(arc.x, arc.y, arc.innerRadius, arc.endAngle, arc.startAngle, true);
+ ctx.closePath();
+ ctx.stroke();
+}
+
+var element_arc = core_element.extend({
+ _type: 'arc',
+
+ inLabelRange: function(mouseX) {
+ var vm = this._view;
+
+ if (vm) {
+ return (Math.pow(mouseX - vm.x, 2) < Math.pow(vm.radius + vm.hoverRadius, 2));
+ }
+ return false;
+ },
+
+ inRange: function(chartX, chartY) {
+ var vm = this._view;
+
+ if (vm) {
+ var pointRelativePosition = helpers$1.getAngleFromPoint(vm, {x: chartX, y: chartY});
+ var angle = pointRelativePosition.angle;
+ var distance = pointRelativePosition.distance;
+
+ // Sanitise angle range
+ var startAngle = vm.startAngle;
+ var endAngle = vm.endAngle;
+ while (endAngle < startAngle) {
+ endAngle += TAU;
+ }
+ while (angle > endAngle) {
+ angle -= TAU;
+ }
+ while (angle < startAngle) {
+ angle += TAU;
+ }
+
+ // Check if within the range of the open/close angle
+ var betweenAngles = (angle >= startAngle && angle <= endAngle);
+ var withinRadius = (distance >= vm.innerRadius && distance <= vm.outerRadius);
+
+ return (betweenAngles && withinRadius);
+ }
+ return false;
+ },
+
+ getCenterPoint: function() {
+ var vm = this._view;
+ var halfAngle = (vm.startAngle + vm.endAngle) / 2;
+ var halfRadius = (vm.innerRadius + vm.outerRadius) / 2;
+ return {
+ x: vm.x + Math.cos(halfAngle) * halfRadius,
+ y: vm.y + Math.sin(halfAngle) * halfRadius
+ };
+ },
+
+ getArea: function() {
+ var vm = this._view;
+ return Math.PI * ((vm.endAngle - vm.startAngle) / (2 * Math.PI)) * (Math.pow(vm.outerRadius, 2) - Math.pow(vm.innerRadius, 2));
+ },
+
+ tooltipPosition: function() {
+ var vm = this._view;
+ var centreAngle = vm.startAngle + ((vm.endAngle - vm.startAngle) / 2);
+ var rangeFromCentre = (vm.outerRadius - vm.innerRadius) / 2 + vm.innerRadius;
+
+ return {
+ x: vm.x + (Math.cos(centreAngle) * rangeFromCentre),
+ y: vm.y + (Math.sin(centreAngle) * rangeFromCentre)
+ };
+ },
+
+ draw: function() {
+ var ctx = this._chart.ctx;
+ var vm = this._view;
+ var pixelMargin = (vm.borderAlign === 'inner') ? 0.33 : 0;
+ var arc = {
+ x: vm.x,
+ y: vm.y,
+ innerRadius: vm.innerRadius,
+ outerRadius: Math.max(vm.outerRadius - pixelMargin, 0),
+ pixelMargin: pixelMargin,
+ startAngle: vm.startAngle,
+ endAngle: vm.endAngle,
+ fullCircles: Math.floor(vm.circumference / TAU)
+ };
+ var i;
+
+ ctx.save();
+
+ ctx.fillStyle = vm.backgroundColor;
+ ctx.strokeStyle = vm.borderColor;
+
+ if (arc.fullCircles) {
+ arc.endAngle = arc.startAngle + TAU;
+ ctx.beginPath();
+ ctx.arc(arc.x, arc.y, arc.outerRadius, arc.startAngle, arc.endAngle);
+ ctx.arc(arc.x, arc.y, arc.innerRadius, arc.endAngle, arc.startAngle, true);
+ ctx.closePath();
+ for (i = 0; i < arc.fullCircles; ++i) {
+ ctx.fill();
+ }
+ arc.endAngle = arc.startAngle + vm.circumference % TAU;
+ }
+
+ ctx.beginPath();
+ ctx.arc(arc.x, arc.y, arc.outerRadius, arc.startAngle, arc.endAngle);
+ ctx.arc(arc.x, arc.y, arc.innerRadius, arc.endAngle, arc.startAngle, true);
+ ctx.closePath();
+ ctx.fill();
+
+ if (vm.borderWidth) {
+ drawBorder(ctx, vm, arc);
+ }
+
+ ctx.restore();
+ }
+});
+
+var valueOrDefault$1 = helpers$1.valueOrDefault;
+
+var defaultColor = core_defaults.global.defaultColor;
+
+core_defaults._set('global', {
+ elements: {
+ line: {
+ tension: 0.4,
+ backgroundColor: defaultColor,
+ borderWidth: 3,
+ borderColor: defaultColor,
+ borderCapStyle: 'butt',
+ borderDash: [],
+ borderDashOffset: 0.0,
+ borderJoinStyle: 'miter',
+ capBezierPoints: true,
+ fill: true, // do we fill in the area between the line and its base axis
+ }
+ }
+});
+
+var element_line = core_element.extend({
+ _type: 'line',
+
+ draw: function() {
+ var me = this;
+ var vm = me._view;
+ var ctx = me._chart.ctx;
+ var spanGaps = vm.spanGaps;
+ var points = me._children.slice(); // clone array
+ var globalDefaults = core_defaults.global;
+ var globalOptionLineElements = globalDefaults.elements.line;
+ var lastDrawnIndex = -1;
+ var closePath = me._loop;
+ var index, previous, currentVM;
+
+ if (!points.length) {
+ return;
+ }
+
+ if (me._loop) {
+ for (index = 0; index < points.length; ++index) {
+ previous = helpers$1.previousItem(points, index);
+ // If the line has an open path, shift the point array
+ if (!points[index]._view.skip && previous._view.skip) {
+ points = points.slice(index).concat(points.slice(0, index));
+ closePath = spanGaps;
+ break;
+ }
+ }
+ // If the line has a close path, add the first point again
+ if (closePath) {
+ points.push(points[0]);
+ }
+ }
+
+ ctx.save();
+
+ // Stroke Line Options
+ ctx.lineCap = vm.borderCapStyle || globalOptionLineElements.borderCapStyle;
+
+ // IE 9 and 10 do not support line dash
+ if (ctx.setLineDash) {
+ ctx.setLineDash(vm.borderDash || globalOptionLineElements.borderDash);
+ }
+
+ ctx.lineDashOffset = valueOrDefault$1(vm.borderDashOffset, globalOptionLineElements.borderDashOffset);
+ ctx.lineJoin = vm.borderJoinStyle || globalOptionLineElements.borderJoinStyle;
+ ctx.lineWidth = valueOrDefault$1(vm.borderWidth, globalOptionLineElements.borderWidth);
+ ctx.strokeStyle = vm.borderColor || globalDefaults.defaultColor;
+
+ // Stroke Line
+ ctx.beginPath();
+
+ // First point moves to it's starting position no matter what
+ currentVM = points[0]._view;
+ if (!currentVM.skip) {
+ ctx.moveTo(currentVM.x, currentVM.y);
+ lastDrawnIndex = 0;
+ }
+
+ for (index = 1; index < points.length; ++index) {
+ currentVM = points[index]._view;
+ previous = lastDrawnIndex === -1 ? helpers$1.previousItem(points, index) : points[lastDrawnIndex];
+
+ if (!currentVM.skip) {
+ if ((lastDrawnIndex !== (index - 1) && !spanGaps) || lastDrawnIndex === -1) {
+ // There was a gap and this is the first point after the gap
+ ctx.moveTo(currentVM.x, currentVM.y);
+ } else {
+ // Line to next point
+ helpers$1.canvas.lineTo(ctx, previous._view, currentVM);
+ }
+ lastDrawnIndex = index;
+ }
+ }
+
+ if (closePath) {
+ ctx.closePath();
+ }
+
+ ctx.stroke();
+ ctx.restore();
+ }
+});
+
+var valueOrDefault$2 = helpers$1.valueOrDefault;
+
+var defaultColor$1 = core_defaults.global.defaultColor;
+
+core_defaults._set('global', {
+ elements: {
+ point: {
+ radius: 3,
+ pointStyle: 'circle',
+ backgroundColor: defaultColor$1,
+ borderColor: defaultColor$1,
+ borderWidth: 1,
+ // Hover
+ hitRadius: 1,
+ hoverRadius: 4,
+ hoverBorderWidth: 1
+ }
+ }
+});
+
+function xRange(mouseX) {
+ var vm = this._view;
+ return vm ? (Math.abs(mouseX - vm.x) < vm.radius + vm.hitRadius) : false;
+}
+
+function yRange(mouseY) {
+ var vm = this._view;
+ return vm ? (Math.abs(mouseY - vm.y) < vm.radius + vm.hitRadius) : false;
+}
+
+var element_point = core_element.extend({
+ _type: 'point',
+
+ inRange: function(mouseX, mouseY) {
+ var vm = this._view;
+ return vm ? ((Math.pow(mouseX - vm.x, 2) + Math.pow(mouseY - vm.y, 2)) < Math.pow(vm.hitRadius + vm.radius, 2)) : false;
+ },
+
+ inLabelRange: xRange,
+ inXRange: xRange,
+ inYRange: yRange,
+
+ getCenterPoint: function() {
+ var vm = this._view;
+ return {
+ x: vm.x,
+ y: vm.y
+ };
+ },
+
+ getArea: function() {
+ return Math.PI * Math.pow(this._view.radius, 2);
+ },
+
+ tooltipPosition: function() {
+ var vm = this._view;
+ return {
+ x: vm.x,
+ y: vm.y,
+ padding: vm.radius + vm.borderWidth
+ };
+ },
+
+ draw: function(chartArea) {
+ var vm = this._view;
+ var ctx = this._chart.ctx;
+ var pointStyle = vm.pointStyle;
+ var rotation = vm.rotation;
+ var radius = vm.radius;
+ var x = vm.x;
+ var y = vm.y;
+ var globalDefaults = core_defaults.global;
+ var defaultColor = globalDefaults.defaultColor; // eslint-disable-line no-shadow
+
+ if (vm.skip) {
+ return;
+ }
+
+ // Clipping for Points.
+ if (chartArea === undefined || helpers$1.canvas._isPointInArea(vm, chartArea)) {
+ ctx.strokeStyle = vm.borderColor || defaultColor;
+ ctx.lineWidth = valueOrDefault$2(vm.borderWidth, globalDefaults.elements.point.borderWidth);
+ ctx.fillStyle = vm.backgroundColor || defaultColor;
+ helpers$1.canvas.drawPoint(ctx, pointStyle, radius, x, y, rotation);
+ }
+ }
+});
+
+var defaultColor$2 = core_defaults.global.defaultColor;
+
+core_defaults._set('global', {
+ elements: {
+ rectangle: {
+ backgroundColor: defaultColor$2,
+ borderColor: defaultColor$2,
+ borderSkipped: 'bottom',
+ borderWidth: 0
+ }
+ }
+});
+
+function isVertical(vm) {
+ return vm && vm.width !== undefined;
+}
+
+/**
+ * Helper function to get the bounds of the bar regardless of the orientation
+ * @param bar {Chart.Element.Rectangle} the bar
+ * @return {Bounds} bounds of the bar
+ * @private
+ */
+function getBarBounds(vm) {
+ var x1, x2, y1, y2, half;
+
+ if (isVertical(vm)) {
+ half = vm.width / 2;
+ x1 = vm.x - half;
+ x2 = vm.x + half;
+ y1 = Math.min(vm.y, vm.base);
+ y2 = Math.max(vm.y, vm.base);
+ } else {
+ half = vm.height / 2;
+ x1 = Math.min(vm.x, vm.base);
+ x2 = Math.max(vm.x, vm.base);
+ y1 = vm.y - half;
+ y2 = vm.y + half;
+ }
+
+ return {
+ left: x1,
+ top: y1,
+ right: x2,
+ bottom: y2
+ };
+}
+
+function swap(orig, v1, v2) {
+ return orig === v1 ? v2 : orig === v2 ? v1 : orig;
+}
+
+function parseBorderSkipped(vm) {
+ var edge = vm.borderSkipped;
+ var res = {};
+
+ if (!edge) {
+ return res;
+ }
+
+ if (vm.horizontal) {
+ if (vm.base > vm.x) {
+ edge = swap(edge, 'left', 'right');
+ }
+ } else if (vm.base < vm.y) {
+ edge = swap(edge, 'bottom', 'top');
+ }
+
+ res[edge] = true;
+ return res;
+}
+
+function parseBorderWidth(vm, maxW, maxH) {
+ var value = vm.borderWidth;
+ var skip = parseBorderSkipped(vm);
+ var t, r, b, l;
+
+ if (helpers$1.isObject(value)) {
+ t = +value.top || 0;
+ r = +value.right || 0;
+ b = +value.bottom || 0;
+ l = +value.left || 0;
+ } else {
+ t = r = b = l = +value || 0;
+ }
+
+ return {
+ t: skip.top || (t < 0) ? 0 : t > maxH ? maxH : t,
+ r: skip.right || (r < 0) ? 0 : r > maxW ? maxW : r,
+ b: skip.bottom || (b < 0) ? 0 : b > maxH ? maxH : b,
+ l: skip.left || (l < 0) ? 0 : l > maxW ? maxW : l
+ };
+}
+
+function boundingRects(vm) {
+ var bounds = getBarBounds(vm);
+ var width = bounds.right - bounds.left;
+ var height = bounds.bottom - bounds.top;
+ var border = parseBorderWidth(vm, width / 2, height / 2);
+
+ return {
+ outer: {
+ x: bounds.left,
+ y: bounds.top,
+ w: width,
+ h: height
+ },
+ inner: {
+ x: bounds.left + border.l,
+ y: bounds.top + border.t,
+ w: width - border.l - border.r,
+ h: height - border.t - border.b
+ }
+ };
+}
+
+function inRange(vm, x, y) {
+ var skipX = x === null;
+ var skipY = y === null;
+ var bounds = !vm || (skipX && skipY) ? false : getBarBounds(vm);
+
+ return bounds
+ && (skipX || x >= bounds.left && x <= bounds.right)
+ && (skipY || y >= bounds.top && y <= bounds.bottom);
+}
+
+var element_rectangle = core_element.extend({
+ _type: 'rectangle',
+
+ draw: function() {
+ var ctx = this._chart.ctx;
+ var vm = this._view;
+ var rects = boundingRects(vm);
+ var outer = rects.outer;
+ var inner = rects.inner;
+
+ ctx.fillStyle = vm.backgroundColor;
+ ctx.fillRect(outer.x, outer.y, outer.w, outer.h);
+
+ if (outer.w === inner.w && outer.h === inner.h) {
+ return;
+ }
+
+ ctx.save();
+ ctx.beginPath();
+ ctx.rect(outer.x, outer.y, outer.w, outer.h);
+ ctx.clip();
+ ctx.fillStyle = vm.borderColor;
+ ctx.rect(inner.x, inner.y, inner.w, inner.h);
+ ctx.fill('evenodd');
+ ctx.restore();
+ },
+
+ height: function() {
+ var vm = this._view;
+ return vm.base - vm.y;
+ },
+
+ inRange: function(mouseX, mouseY) {
+ return inRange(this._view, mouseX, mouseY);
+ },
+
+ inLabelRange: function(mouseX, mouseY) {
+ var vm = this._view;
+ return isVertical(vm)
+ ? inRange(vm, mouseX, null)
+ : inRange(vm, null, mouseY);
+ },
+
+ inXRange: function(mouseX) {
+ return inRange(this._view, mouseX, null);
+ },
+
+ inYRange: function(mouseY) {
+ return inRange(this._view, null, mouseY);
+ },
+
+ getCenterPoint: function() {
+ var vm = this._view;
+ var x, y;
+ if (isVertical(vm)) {
+ x = vm.x;
+ y = (vm.y + vm.base) / 2;
+ } else {
+ x = (vm.x + vm.base) / 2;
+ y = vm.y;
+ }
+
+ return {x: x, y: y};
+ },
+
+ getArea: function() {
+ var vm = this._view;
+
+ return isVertical(vm)
+ ? vm.width * Math.abs(vm.y - vm.base)
+ : vm.height * Math.abs(vm.x - vm.base);
+ },
+
+ tooltipPosition: function() {
+ var vm = this._view;
+ return {
+ x: vm.x,
+ y: vm.y
+ };
+ }
+});
+
+var elements = {};
+var Arc = element_arc;
+var Line = element_line;
+var Point = element_point;
+var Rectangle = element_rectangle;
+elements.Arc = Arc;
+elements.Line = Line;
+elements.Point = Point;
+elements.Rectangle = Rectangle;
+
+var deprecated = helpers$1._deprecated;
+var valueOrDefault$3 = helpers$1.valueOrDefault;
+
+core_defaults._set('bar', {
+ hover: {
+ mode: 'label'
+ },
+
+ scales: {
+ xAxes: [{
+ type: 'category',
+ offset: true,
+ gridLines: {
+ offsetGridLines: true
+ }
+ }],
+
+ yAxes: [{
+ type: 'linear'
+ }]
+ }
+});
+
+core_defaults._set('global', {
+ datasets: {
+ bar: {
+ categoryPercentage: 0.8,
+ barPercentage: 0.9
+ }
+ }
+});
+
+/**
+ * Computes the "optimal" sample size to maintain bars equally sized while preventing overlap.
+ * @private
+ */
+function computeMinSampleSize(scale, pixels) {
+ var min = scale._length;
+ var prev, curr, i, ilen;
+
+ for (i = 1, ilen = pixels.length; i < ilen; ++i) {
+ min = Math.min(min, Math.abs(pixels[i] - pixels[i - 1]));
+ }
+
+ for (i = 0, ilen = scale.getTicks().length; i < ilen; ++i) {
+ curr = scale.getPixelForTick(i);
+ min = i > 0 ? Math.min(min, Math.abs(curr - prev)) : min;
+ prev = curr;
+ }
+
+ return min;
+}
+
+/**
+ * Computes an "ideal" category based on the absolute bar thickness or, if undefined or null,
+ * uses the smallest interval (see computeMinSampleSize) that prevents bar overlapping. This
+ * mode currently always generates bars equally sized (until we introduce scriptable options?).
+ * @private
+ */
+function computeFitCategoryTraits(index, ruler, options) {
+ var thickness = options.barThickness;
+ var count = ruler.stackCount;
+ var curr = ruler.pixels[index];
+ var min = helpers$1.isNullOrUndef(thickness)
+ ? computeMinSampleSize(ruler.scale, ruler.pixels)
+ : -1;
+ var size, ratio;
+
+ if (helpers$1.isNullOrUndef(thickness)) {
+ size = min * options.categoryPercentage;
+ ratio = options.barPercentage;
+ } else {
+ // When bar thickness is enforced, category and bar percentages are ignored.
+ // Note(SB): we could add support for relative bar thickness (e.g. barThickness: '50%')
+ // and deprecate barPercentage since this value is ignored when thickness is absolute.
+ size = thickness * count;
+ ratio = 1;
+ }
+
+ return {
+ chunk: size / count,
+ ratio: ratio,
+ start: curr - (size / 2)
+ };
+}
+
+/**
+ * Computes an "optimal" category that globally arranges bars side by side (no gap when
+ * percentage options are 1), based on the previous and following categories. This mode
+ * generates bars with different widths when data are not evenly spaced.
+ * @private
+ */
+function computeFlexCategoryTraits(index, ruler, options) {
+ var pixels = ruler.pixels;
+ var curr = pixels[index];
+ var prev = index > 0 ? pixels[index - 1] : null;
+ var next = index < pixels.length - 1 ? pixels[index + 1] : null;
+ var percent = options.categoryPercentage;
+ var start, size;
+
+ if (prev === null) {
+ // first data: its size is double based on the next point or,
+ // if it's also the last data, we use the scale size.
+ prev = curr - (next === null ? ruler.end - ruler.start : next - curr);
+ }
+
+ if (next === null) {
+ // last data: its size is also double based on the previous point.
+ next = curr + curr - prev;
+ }
+
+ start = curr - (curr - Math.min(prev, next)) / 2 * percent;
+ size = Math.abs(next - prev) / 2 * percent;
+
+ return {
+ chunk: size / ruler.stackCount,
+ ratio: options.barPercentage,
+ start: start
+ };
+}
+
+var controller_bar = core_datasetController.extend({
+
+ dataElementType: elements.Rectangle,
+
+ /**
+ * @private
+ */
+ _dataElementOptions: [
+ 'backgroundColor',
+ 'borderColor',
+ 'borderSkipped',
+ 'borderWidth',
+ 'barPercentage',
+ 'barThickness',
+ 'categoryPercentage',
+ 'maxBarThickness',
+ 'minBarLength'
+ ],
+
+ initialize: function() {
+ var me = this;
+ var meta, scaleOpts;
+
+ core_datasetController.prototype.initialize.apply(me, arguments);
+
+ meta = me.getMeta();
+ meta.stack = me.getDataset().stack;
+ meta.bar = true;
+
+ scaleOpts = me._getIndexScale().options;
+ deprecated('bar chart', scaleOpts.barPercentage, 'scales.[x/y]Axes.barPercentage', 'dataset.barPercentage');
+ deprecated('bar chart', scaleOpts.barThickness, 'scales.[x/y]Axes.barThickness', 'dataset.barThickness');
+ deprecated('bar chart', scaleOpts.categoryPercentage, 'scales.[x/y]Axes.categoryPercentage', 'dataset.categoryPercentage');
+ deprecated('bar chart', me._getValueScale().options.minBarLength, 'scales.[x/y]Axes.minBarLength', 'dataset.minBarLength');
+ deprecated('bar chart', scaleOpts.maxBarThickness, 'scales.[x/y]Axes.maxBarThickness', 'dataset.maxBarThickness');
+ },
+
+ update: function(reset) {
+ var me = this;
+ var rects = me.getMeta().data;
+ var i, ilen;
+
+ me._ruler = me.getRuler();
+
+ for (i = 0, ilen = rects.length; i < ilen; ++i) {
+ me.updateElement(rects[i], i, reset);
+ }
+ },
+
+ updateElement: function(rectangle, index, reset) {
+ var me = this;
+ var meta = me.getMeta();
+ var dataset = me.getDataset();
+ var options = me._resolveDataElementOptions(rectangle, index);
+
+ rectangle._xScale = me.getScaleForId(meta.xAxisID);
+ rectangle._yScale = me.getScaleForId(meta.yAxisID);
+ rectangle._datasetIndex = me.index;
+ rectangle._index = index;
+ rectangle._model = {
+ backgroundColor: options.backgroundColor,
+ borderColor: options.borderColor,
+ borderSkipped: options.borderSkipped,
+ borderWidth: options.borderWidth,
+ datasetLabel: dataset.label,
+ label: me.chart.data.labels[index]
+ };
+
+ if (helpers$1.isArray(dataset.data[index])) {
+ rectangle._model.borderSkipped = null;
+ }
+
+ me._updateElementGeometry(rectangle, index, reset, options);
+
+ rectangle.pivot();
+ },
+
+ /**
+ * @private
+ */
+ _updateElementGeometry: function(rectangle, index, reset, options) {
+ var me = this;
+ var model = rectangle._model;
+ var vscale = me._getValueScale();
+ var base = vscale.getBasePixel();
+ var horizontal = vscale.isHorizontal();
+ var ruler = me._ruler || me.getRuler();
+ var vpixels = me.calculateBarValuePixels(me.index, index, options);
+ var ipixels = me.calculateBarIndexPixels(me.index, index, ruler, options);
+
+ model.horizontal = horizontal;
+ model.base = reset ? base : vpixels.base;
+ model.x = horizontal ? reset ? base : vpixels.head : ipixels.center;
+ model.y = horizontal ? ipixels.center : reset ? base : vpixels.head;
+ model.height = horizontal ? ipixels.size : undefined;
+ model.width = horizontal ? undefined : ipixels.size;
+ },
+
+ /**
+ * Returns the stacks based on groups and bar visibility.
+ * @param {number} [last] - The dataset index
+ * @returns {string[]} The list of stack IDs
+ * @private
+ */
+ _getStacks: function(last) {
+ var me = this;
+ var scale = me._getIndexScale();
+ var metasets = scale._getMatchingVisibleMetas(me._type);
+ var stacked = scale.options.stacked;
+ var ilen = metasets.length;
+ var stacks = [];
+ var i, meta;
+
+ for (i = 0; i < ilen; ++i) {
+ meta = metasets[i];
+ // stacked | meta.stack
+ // | found | not found | undefined
+ // false | x | x | x
+ // true | | x |
+ // undefined | | x | x
+ if (stacked === false || stacks.indexOf(meta.stack) === -1 ||
+ (stacked === undefined && meta.stack === undefined)) {
+ stacks.push(meta.stack);
+ }
+ if (meta.index === last) {
+ break;
+ }
+ }
+
+ return stacks;
+ },
+
+ /**
+ * Returns the effective number of stacks based on groups and bar visibility.
+ * @private
+ */
+ getStackCount: function() {
+ return this._getStacks().length;
+ },
+
+ /**
+ * Returns the stack index for the given dataset based on groups and bar visibility.
+ * @param {number} [datasetIndex] - The dataset index
+ * @param {string} [name] - The stack name to find
+ * @returns {number} The stack index
+ * @private
+ */
+ getStackIndex: function(datasetIndex, name) {
+ var stacks = this._getStacks(datasetIndex);
+ var index = (name !== undefined)
+ ? stacks.indexOf(name)
+ : -1; // indexOf returns -1 if element is not present
+
+ return (index === -1)
+ ? stacks.length - 1
+ : index;
+ },
+
+ /**
+ * @private
+ */
+ getRuler: function() {
+ var me = this;
+ var scale = me._getIndexScale();
+ var pixels = [];
+ var i, ilen;
+
+ for (i = 0, ilen = me.getMeta().data.length; i < ilen; ++i) {
+ pixels.push(scale.getPixelForValue(null, i, me.index));
+ }
+
+ return {
+ pixels: pixels,
+ start: scale._startPixel,
+ end: scale._endPixel,
+ stackCount: me.getStackCount(),
+ scale: scale
+ };
+ },
+
+ /**
+ * Note: pixel values are not clamped to the scale area.
+ * @private
+ */
+ calculateBarValuePixels: function(datasetIndex, index, options) {
+ var me = this;
+ var chart = me.chart;
+ var scale = me._getValueScale();
+ var isHorizontal = scale.isHorizontal();
+ var datasets = chart.data.datasets;
+ var metasets = scale._getMatchingVisibleMetas(me._type);
+ var value = scale._parseValue(datasets[datasetIndex].data[index]);
+ var minBarLength = options.minBarLength;
+ var stacked = scale.options.stacked;
+ var stack = me.getMeta().stack;
+ var start = value.start === undefined ? 0 : value.max >= 0 && value.min >= 0 ? value.min : value.max;
+ var length = value.start === undefined ? value.end : value.max >= 0 && value.min >= 0 ? value.max - value.min : value.min - value.max;
+ var ilen = metasets.length;
+ var i, imeta, ivalue, base, head, size, stackLength;
+
+ if (stacked || (stacked === undefined && stack !== undefined)) {
+ for (i = 0; i < ilen; ++i) {
+ imeta = metasets[i];
+
+ if (imeta.index === datasetIndex) {
+ break;
+ }
+
+ if (imeta.stack === stack) {
+ stackLength = scale._parseValue(datasets[imeta.index].data[index]);
+ ivalue = stackLength.start === undefined ? stackLength.end : stackLength.min >= 0 && stackLength.max >= 0 ? stackLength.max : stackLength.min;
+
+ if ((value.min < 0 && ivalue < 0) || (value.max >= 0 && ivalue > 0)) {
+ start += ivalue;
+ }
+ }
+ }
+ }
+
+ base = scale.getPixelForValue(start);
+ head = scale.getPixelForValue(start + length);
+ size = head - base;
+
+ if (minBarLength !== undefined && Math.abs(size) < minBarLength) {
+ size = minBarLength;
+ if (length >= 0 && !isHorizontal || length < 0 && isHorizontal) {
+ head = base - minBarLength;
+ } else {
+ head = base + minBarLength;
+ }
+ }
+
+ return {
+ size: size,
+ base: base,
+ head: head,
+ center: head + size / 2
+ };
+ },
+
+ /**
+ * @private
+ */
+ calculateBarIndexPixels: function(datasetIndex, index, ruler, options) {
+ var me = this;
+ var range = options.barThickness === 'flex'
+ ? computeFlexCategoryTraits(index, ruler, options)
+ : computeFitCategoryTraits(index, ruler, options);
+
+ var stackIndex = me.getStackIndex(datasetIndex, me.getMeta().stack);
+ var center = range.start + (range.chunk * stackIndex) + (range.chunk / 2);
+ var size = Math.min(
+ valueOrDefault$3(options.maxBarThickness, Infinity),
+ range.chunk * range.ratio);
+
+ return {
+ base: center - size / 2,
+ head: center + size / 2,
+ center: center,
+ size: size
+ };
+ },
+
+ draw: function() {
+ var me = this;
+ var chart = me.chart;
+ var scale = me._getValueScale();
+ var rects = me.getMeta().data;
+ var dataset = me.getDataset();
+ var ilen = rects.length;
+ var i = 0;
+
+ helpers$1.canvas.clipArea(chart.ctx, chart.chartArea);
+
+ for (; i < ilen; ++i) {
+ var val = scale._parseValue(dataset.data[i]);
+ if (!isNaN(val.min) && !isNaN(val.max)) {
+ rects[i].draw();
+ }
+ }
+
+ helpers$1.canvas.unclipArea(chart.ctx);
+ },
+
+ /**
+ * @private
+ */
+ _resolveDataElementOptions: function() {
+ var me = this;
+ var values = helpers$1.extend({}, core_datasetController.prototype._resolveDataElementOptions.apply(me, arguments));
+ var indexOpts = me._getIndexScale().options;
+ var valueOpts = me._getValueScale().options;
+
+ values.barPercentage = valueOrDefault$3(indexOpts.barPercentage, values.barPercentage);
+ values.barThickness = valueOrDefault$3(indexOpts.barThickness, values.barThickness);
+ values.categoryPercentage = valueOrDefault$3(indexOpts.categoryPercentage, values.categoryPercentage);
+ values.maxBarThickness = valueOrDefault$3(indexOpts.maxBarThickness, values.maxBarThickness);
+ values.minBarLength = valueOrDefault$3(valueOpts.minBarLength, values.minBarLength);
+
+ return values;
+ }
+
+});
+
+var valueOrDefault$4 = helpers$1.valueOrDefault;
+var resolve$1 = helpers$1.options.resolve;
+
+core_defaults._set('bubble', {
+ hover: {
+ mode: 'single'
+ },
+
+ scales: {
+ xAxes: [{
+ type: 'linear', // bubble should probably use a linear scale by default
+ position: 'bottom',
+ id: 'x-axis-0' // need an ID so datasets can reference the scale
+ }],
+ yAxes: [{
+ type: 'linear',
+ position: 'left',
+ id: 'y-axis-0'
+ }]
+ },
+
+ tooltips: {
+ callbacks: {
+ title: function() {
+ // Title doesn't make sense for scatter since we format the data as a point
+ return '';
+ },
+ label: function(item, data) {
+ var datasetLabel = data.datasets[item.datasetIndex].label || '';
+ var dataPoint = data.datasets[item.datasetIndex].data[item.index];
+ return datasetLabel + ': (' + item.xLabel + ', ' + item.yLabel + ', ' + dataPoint.r + ')';
+ }
+ }
+ }
+});
+
+var controller_bubble = core_datasetController.extend({
+ /**
+ * @protected
+ */
+ dataElementType: elements.Point,
+
+ /**
+ * @private
+ */
+ _dataElementOptions: [
+ 'backgroundColor',
+ 'borderColor',
+ 'borderWidth',
+ 'hoverBackgroundColor',
+ 'hoverBorderColor',
+ 'hoverBorderWidth',
+ 'hoverRadius',
+ 'hitRadius',
+ 'pointStyle',
+ 'rotation'
+ ],
+
+ /**
+ * @protected
+ */
+ update: function(reset) {
+ var me = this;
+ var meta = me.getMeta();
+ var points = meta.data;
+
+ // Update Points
+ helpers$1.each(points, function(point, index) {
+ me.updateElement(point, index, reset);
+ });
+ },
+
+ /**
+ * @protected
+ */
+ updateElement: function(point, index, reset) {
+ var me = this;
+ var meta = me.getMeta();
+ var custom = point.custom || {};
+ var xScale = me.getScaleForId(meta.xAxisID);
+ var yScale = me.getScaleForId(meta.yAxisID);
+ var options = me._resolveDataElementOptions(point, index);
+ var data = me.getDataset().data[index];
+ var dsIndex = me.index;
+
+ var x = reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(typeof data === 'object' ? data : NaN, index, dsIndex);
+ var y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(data, index, dsIndex);
+
+ point._xScale = xScale;
+ point._yScale = yScale;
+ point._options = options;
+ point._datasetIndex = dsIndex;
+ point._index = index;
+ point._model = {
+ backgroundColor: options.backgroundColor,
+ borderColor: options.borderColor,
+ borderWidth: options.borderWidth,
+ hitRadius: options.hitRadius,
+ pointStyle: options.pointStyle,
+ rotation: options.rotation,
+ radius: reset ? 0 : options.radius,
+ skip: custom.skip || isNaN(x) || isNaN(y),
+ x: x,
+ y: y,
+ };
+
+ point.pivot();
+ },
+
+ /**
+ * @protected
+ */
+ setHoverStyle: function(point) {
+ var model = point._model;
+ var options = point._options;
+ var getHoverColor = helpers$1.getHoverColor;
+
+ point.$previousStyle = {
+ backgroundColor: model.backgroundColor,
+ borderColor: model.borderColor,
+ borderWidth: model.borderWidth,
+ radius: model.radius
+ };
+
+ model.backgroundColor = valueOrDefault$4(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));
+ model.borderColor = valueOrDefault$4(options.hoverBorderColor, getHoverColor(options.borderColor));
+ model.borderWidth = valueOrDefault$4(options.hoverBorderWidth, options.borderWidth);
+ model.radius = options.radius + options.hoverRadius;
+ },
+
+ /**
+ * @private
+ */
+ _resolveDataElementOptions: function(point, index) {
+ var me = this;
+ var chart = me.chart;
+ var dataset = me.getDataset();
+ var custom = point.custom || {};
+ var data = dataset.data[index] || {};
+ var values = core_datasetController.prototype._resolveDataElementOptions.apply(me, arguments);
+
+ // Scriptable options
+ var context = {
+ chart: chart,
+ dataIndex: index,
+ dataset: dataset,
+ datasetIndex: me.index
+ };
+
+ // In case values were cached (and thus frozen), we need to clone the values
+ if (me._cachedDataOpts === values) {
+ values = helpers$1.extend({}, values);
+ }
+
+ // Custom radius resolution
+ values.radius = resolve$1([
+ custom.radius,
+ data.r,
+ me._config.radius,
+ chart.options.elements.point.radius
+ ], context, index);
+
+ return values;
+ }
+});
+
+var valueOrDefault$5 = helpers$1.valueOrDefault;
+
+var PI$1 = Math.PI;
+var DOUBLE_PI$1 = PI$1 * 2;
+var HALF_PI$1 = PI$1 / 2;
+
+core_defaults._set('doughnut', {
+ animation: {
+ // Boolean - Whether we animate the rotation of the Doughnut
+ animateRotate: true,
+ // Boolean - Whether we animate scaling the Doughnut from the centre
+ animateScale: false
+ },
+ hover: {
+ mode: 'single'
+ },
+ legendCallback: function(chart) {
+ var list = document.createElement('ul');
+ var data = chart.data;
+ var datasets = data.datasets;
+ var labels = data.labels;
+ var i, ilen, listItem, listItemSpan;
+
+ list.setAttribute('class', chart.id + '-legend');
+ if (datasets.length) {
+ for (i = 0, ilen = datasets[0].data.length; i < ilen; ++i) {
+ listItem = list.appendChild(document.createElement('li'));
+ listItemSpan = listItem.appendChild(document.createElement('span'));
+ listItemSpan.style.backgroundColor = datasets[0].backgroundColor[i];
+ if (labels[i]) {
+ listItem.appendChild(document.createTextNode(labels[i]));
+ }
+ }
+ }
+
+ return list.outerHTML;
+ },
+ legend: {
+ labels: {
+ generateLabels: function(chart) {
+ var data = chart.data;
+ if (data.labels.length && data.datasets.length) {
+ return data.labels.map(function(label, i) {
+ var meta = chart.getDatasetMeta(0);
+ var style = meta.controller.getStyle(i);
+
+ return {
+ text: label,
+ fillStyle: style.backgroundColor,
+ strokeStyle: style.borderColor,
+ lineWidth: style.borderWidth,
+ hidden: isNaN(data.datasets[0].data[i]) || meta.data[i].hidden,
+
+ // Extra data used for toggling the correct item
+ index: i
+ };
+ });
+ }
+ return [];
+ }
+ },
+
+ onClick: function(e, legendItem) {
+ var index = legendItem.index;
+ var chart = this.chart;
+ var i, ilen, meta;
+
+ for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {
+ meta = chart.getDatasetMeta(i);
+ // toggle visibility of index if exists
+ if (meta.data[index]) {
+ meta.data[index].hidden = !meta.data[index].hidden;
+ }
+ }
+
+ chart.update();
+ }
+ },
+
+ // The percentage of the chart that we cut out of the middle.
+ cutoutPercentage: 50,
+
+ // The rotation of the chart, where the first data arc begins.
+ rotation: -HALF_PI$1,
+
+ // The total circumference of the chart.
+ circumference: DOUBLE_PI$1,
+
+ // Need to override these to give a nice default
+ tooltips: {
+ callbacks: {
+ title: function() {
+ return '';
+ },
+ label: function(tooltipItem, data) {
+ var dataLabel = data.labels[tooltipItem.index];
+ var value = ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];
+
+ if (helpers$1.isArray(dataLabel)) {
+ // show value on first line of multiline label
+ // need to clone because we are changing the value
+ dataLabel = dataLabel.slice();
+ dataLabel[0] += value;
+ } else {
+ dataLabel += value;
+ }
+
+ return dataLabel;
+ }
+ }
+ }
+});
+
+var controller_doughnut = core_datasetController.extend({
+
+ dataElementType: elements.Arc,
+
+ linkScales: helpers$1.noop,
+
+ /**
+ * @private
+ */
+ _dataElementOptions: [
+ 'backgroundColor',
+ 'borderColor',
+ 'borderWidth',
+ 'borderAlign',
+ 'hoverBackgroundColor',
+ 'hoverBorderColor',
+ 'hoverBorderWidth',
+ ],
+
+ // Get index of the dataset in relation to the visible datasets. This allows determining the inner and outer radius correctly
+ getRingIndex: function(datasetIndex) {
+ var ringIndex = 0;
+
+ for (var j = 0; j < datasetIndex; ++j) {
+ if (this.chart.isDatasetVisible(j)) {
+ ++ringIndex;
+ }
+ }
+
+ return ringIndex;
+ },
+
+ update: function(reset) {
+ var me = this;
+ var chart = me.chart;
+ var chartArea = chart.chartArea;
+ var opts = chart.options;
+ var ratioX = 1;
+ var ratioY = 1;
+ var offsetX = 0;
+ var offsetY = 0;
+ var meta = me.getMeta();
+ var arcs = meta.data;
+ var cutout = opts.cutoutPercentage / 100 || 0;
+ var circumference = opts.circumference;
+ var chartWeight = me._getRingWeight(me.index);
+ var maxWidth, maxHeight, i, ilen;
+
+ // If the chart's circumference isn't a full circle, calculate size as a ratio of the width/height of the arc
+ if (circumference < DOUBLE_PI$1) {
+ var startAngle = opts.rotation % DOUBLE_PI$1;
+ startAngle += startAngle >= PI$1 ? -DOUBLE_PI$1 : startAngle < -PI$1 ? DOUBLE_PI$1 : 0;
+ var endAngle = startAngle + circumference;
+ var startX = Math.cos(startAngle);
+ var startY = Math.sin(startAngle);
+ var endX = Math.cos(endAngle);
+ var endY = Math.sin(endAngle);
+ var contains0 = (startAngle <= 0 && endAngle >= 0) || endAngle >= DOUBLE_PI$1;
+ var contains90 = (startAngle <= HALF_PI$1 && endAngle >= HALF_PI$1) || endAngle >= DOUBLE_PI$1 + HALF_PI$1;
+ var contains180 = startAngle === -PI$1 || endAngle >= PI$1;
+ var contains270 = (startAngle <= -HALF_PI$1 && endAngle >= -HALF_PI$1) || endAngle >= PI$1 + HALF_PI$1;
+ var minX = contains180 ? -1 : Math.min(startX, startX * cutout, endX, endX * cutout);
+ var minY = contains270 ? -1 : Math.min(startY, startY * cutout, endY, endY * cutout);
+ var maxX = contains0 ? 1 : Math.max(startX, startX * cutout, endX, endX * cutout);
+ var maxY = contains90 ? 1 : Math.max(startY, startY * cutout, endY, endY * cutout);
+ ratioX = (maxX - minX) / 2;
+ ratioY = (maxY - minY) / 2;
+ offsetX = -(maxX + minX) / 2;
+ offsetY = -(maxY + minY) / 2;
+ }
+
+ for (i = 0, ilen = arcs.length; i < ilen; ++i) {
+ arcs[i]._options = me._resolveDataElementOptions(arcs[i], i);
+ }
+
+ chart.borderWidth = me.getMaxBorderWidth();
+ maxWidth = (chartArea.right - chartArea.left - chart.borderWidth) / ratioX;
+ maxHeight = (chartArea.bottom - chartArea.top - chart.borderWidth) / ratioY;
+ chart.outerRadius = Math.max(Math.min(maxWidth, maxHeight) / 2, 0);
+ chart.innerRadius = Math.max(chart.outerRadius * cutout, 0);
+ chart.radiusLength = (chart.outerRadius - chart.innerRadius) / (me._getVisibleDatasetWeightTotal() || 1);
+ chart.offsetX = offsetX * chart.outerRadius;
+ chart.offsetY = offsetY * chart.outerRadius;
+
+ meta.total = me.calculateTotal();
+
+ me.outerRadius = chart.outerRadius - chart.radiusLength * me._getRingWeightOffset(me.index);
+ me.innerRadius = Math.max(me.outerRadius - chart.radiusLength * chartWeight, 0);
+
+ for (i = 0, ilen = arcs.length; i < ilen; ++i) {
+ me.updateElement(arcs[i], i, reset);
+ }
+ },
+
+ updateElement: function(arc, index, reset) {
+ var me = this;
+ var chart = me.chart;
+ var chartArea = chart.chartArea;
+ var opts = chart.options;
+ var animationOpts = opts.animation;
+ var centerX = (chartArea.left + chartArea.right) / 2;
+ var centerY = (chartArea.top + chartArea.bottom) / 2;
+ var startAngle = opts.rotation; // non reset case handled later
+ var endAngle = opts.rotation; // non reset case handled later
+ var dataset = me.getDataset();
+ var circumference = reset && animationOpts.animateRotate ? 0 : arc.hidden ? 0 : me.calculateCircumference(dataset.data[index]) * (opts.circumference / DOUBLE_PI$1);
+ var innerRadius = reset && animationOpts.animateScale ? 0 : me.innerRadius;
+ var outerRadius = reset && animationOpts.animateScale ? 0 : me.outerRadius;
+ var options = arc._options || {};
+
+ helpers$1.extend(arc, {
+ // Utility
+ _datasetIndex: me.index,
+ _index: index,
+
+ // Desired view properties
+ _model: {
+ backgroundColor: options.backgroundColor,
+ borderColor: options.borderColor,
+ borderWidth: options.borderWidth,
+ borderAlign: options.borderAlign,
+ x: centerX + chart.offsetX,
+ y: centerY + chart.offsetY,
+ startAngle: startAngle,
+ endAngle: endAngle,
+ circumference: circumference,
+ outerRadius: outerRadius,
+ innerRadius: innerRadius,
+ label: helpers$1.valueAtIndexOrDefault(dataset.label, index, chart.data.labels[index])
+ }
+ });
+
+ var model = arc._model;
+
+ // Set correct angles if not resetting
+ if (!reset || !animationOpts.animateRotate) {
+ if (index === 0) {
+ model.startAngle = opts.rotation;
+ } else {
+ model.startAngle = me.getMeta().data[index - 1]._model.endAngle;
+ }
+
+ model.endAngle = model.startAngle + model.circumference;
+ }
+
+ arc.pivot();
+ },
+
+ calculateTotal: function() {
+ var dataset = this.getDataset();
+ var meta = this.getMeta();
+ var total = 0;
+ var value;
+
+ helpers$1.each(meta.data, function(element, index) {
+ value = dataset.data[index];
+ if (!isNaN(value) && !element.hidden) {
+ total += Math.abs(value);
+ }
+ });
+
+ /* if (total === 0) {
+ total = NaN;
+ }*/
+
+ return total;
+ },
+
+ calculateCircumference: function(value) {
+ var total = this.getMeta().total;
+ if (total > 0 && !isNaN(value)) {
+ return DOUBLE_PI$1 * (Math.abs(value) / total);
+ }
+ return 0;
+ },
+
+ // gets the max border or hover width to properly scale pie charts
+ getMaxBorderWidth: function(arcs) {
+ var me = this;
+ var max = 0;
+ var chart = me.chart;
+ var i, ilen, meta, arc, controller, options, borderWidth, hoverWidth;
+
+ if (!arcs) {
+ // Find the outmost visible dataset
+ for (i = 0, ilen = chart.data.datasets.length; i < ilen; ++i) {
+ if (chart.isDatasetVisible(i)) {
+ meta = chart.getDatasetMeta(i);
+ arcs = meta.data;
+ if (i !== me.index) {
+ controller = meta.controller;
+ }
+ break;
+ }
+ }
+ }
+
+ if (!arcs) {
+ return 0;
+ }
+
+ for (i = 0, ilen = arcs.length; i < ilen; ++i) {
+ arc = arcs[i];
+ if (controller) {
+ controller._configure();
+ options = controller._resolveDataElementOptions(arc, i);
+ } else {
+ options = arc._options;
+ }
+ if (options.borderAlign !== 'inner') {
+ borderWidth = options.borderWidth;
+ hoverWidth = options.hoverBorderWidth;
+
+ max = borderWidth > max ? borderWidth : max;
+ max = hoverWidth > max ? hoverWidth : max;
+ }
+ }
+ return max;
+ },
+
+ /**
+ * @protected
+ */
+ setHoverStyle: function(arc) {
+ var model = arc._model;
+ var options = arc._options;
+ var getHoverColor = helpers$1.getHoverColor;
+
+ arc.$previousStyle = {
+ backgroundColor: model.backgroundColor,
+ borderColor: model.borderColor,
+ borderWidth: model.borderWidth,
+ };
+
+ model.backgroundColor = valueOrDefault$5(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));
+ model.borderColor = valueOrDefault$5(options.hoverBorderColor, getHoverColor(options.borderColor));
+ model.borderWidth = valueOrDefault$5(options.hoverBorderWidth, options.borderWidth);
+ },
+
+ /**
+ * Get radius length offset of the dataset in relation to the visible datasets weights. This allows determining the inner and outer radius correctly
+ * @private
+ */
+ _getRingWeightOffset: function(datasetIndex) {
+ var ringWeightOffset = 0;
+
+ for (var i = 0; i < datasetIndex; ++i) {
+ if (this.chart.isDatasetVisible(i)) {
+ ringWeightOffset += this._getRingWeight(i);
+ }
+ }
+
+ return ringWeightOffset;
+ },
+
+ /**
+ * @private
+ */
+ _getRingWeight: function(dataSetIndex) {
+ return Math.max(valueOrDefault$5(this.chart.data.datasets[dataSetIndex].weight, 1), 0);
+ },
+
+ /**
+ * Returns the sum of all visibile data set weights. This value can be 0.
+ * @private
+ */
+ _getVisibleDatasetWeightTotal: function() {
+ return this._getRingWeightOffset(this.chart.data.datasets.length);
+ }
+});
+
+core_defaults._set('horizontalBar', {
+ hover: {
+ mode: 'index',
+ axis: 'y'
+ },
+
+ scales: {
+ xAxes: [{
+ type: 'linear',
+ position: 'bottom'
+ }],
+
+ yAxes: [{
+ type: 'category',
+ position: 'left',
+ offset: true,
+ gridLines: {
+ offsetGridLines: true
+ }
+ }]
+ },
+
+ elements: {
+ rectangle: {
+ borderSkipped: 'left'
+ }
+ },
+
+ tooltips: {
+ mode: 'index',
+ axis: 'y'
+ }
+});
+
+core_defaults._set('global', {
+ datasets: {
+ horizontalBar: {
+ categoryPercentage: 0.8,
+ barPercentage: 0.9
+ }
+ }
+});
+
+var controller_horizontalBar = controller_bar.extend({
+ /**
+ * @private
+ */
+ _getValueScaleId: function() {
+ return this.getMeta().xAxisID;
+ },
+
+ /**
+ * @private
+ */
+ _getIndexScaleId: function() {
+ return this.getMeta().yAxisID;
+ }
+});
+
+var valueOrDefault$6 = helpers$1.valueOrDefault;
+var resolve$2 = helpers$1.options.resolve;
+var isPointInArea = helpers$1.canvas._isPointInArea;
+
+core_defaults._set('line', {
+ showLines: true,
+ spanGaps: false,
+
+ hover: {
+ mode: 'label'
+ },
+
+ scales: {
+ xAxes: [{
+ type: 'category',
+ id: 'x-axis-0'
+ }],
+ yAxes: [{
+ type: 'linear',
+ id: 'y-axis-0'
+ }]
+ }
+});
+
+function scaleClip(scale, halfBorderWidth) {
+ var tickOpts = scale && scale.options.ticks || {};
+ var reverse = tickOpts.reverse;
+ var min = tickOpts.min === undefined ? halfBorderWidth : 0;
+ var max = tickOpts.max === undefined ? halfBorderWidth : 0;
+ return {
+ start: reverse ? max : min,
+ end: reverse ? min : max
+ };
+}
+
+function defaultClip(xScale, yScale, borderWidth) {
+ var halfBorderWidth = borderWidth / 2;
+ var x = scaleClip(xScale, halfBorderWidth);
+ var y = scaleClip(yScale, halfBorderWidth);
+
+ return {
+ top: y.end,
+ right: x.end,
+ bottom: y.start,
+ left: x.start
+ };
+}
+
+function toClip(value) {
+ var t, r, b, l;
+
+ if (helpers$1.isObject(value)) {
+ t = value.top;
+ r = value.right;
+ b = value.bottom;
+ l = value.left;
+ } else {
+ t = r = b = l = value;
+ }
+
+ return {
+ top: t,
+ right: r,
+ bottom: b,
+ left: l
+ };
+}
+
+
+var controller_line = core_datasetController.extend({
+
+ datasetElementType: elements.Line,
+
+ dataElementType: elements.Point,
+
+ /**
+ * @private
+ */
+ _datasetElementOptions: [
+ 'backgroundColor',
+ 'borderCapStyle',
+ 'borderColor',
+ 'borderDash',
+ 'borderDashOffset',
+ 'borderJoinStyle',
+ 'borderWidth',
+ 'cubicInterpolationMode',
+ 'fill'
+ ],
+
+ /**
+ * @private
+ */
+ _dataElementOptions: {
+ backgroundColor: 'pointBackgroundColor',
+ borderColor: 'pointBorderColor',
+ borderWidth: 'pointBorderWidth',
+ hitRadius: 'pointHitRadius',
+ hoverBackgroundColor: 'pointHoverBackgroundColor',
+ hoverBorderColor: 'pointHoverBorderColor',
+ hoverBorderWidth: 'pointHoverBorderWidth',
+ hoverRadius: 'pointHoverRadius',
+ pointStyle: 'pointStyle',
+ radius: 'pointRadius',
+ rotation: 'pointRotation'
+ },
+
+ update: function(reset) {
+ var me = this;
+ var meta = me.getMeta();
+ var line = meta.dataset;
+ var points = meta.data || [];
+ var options = me.chart.options;
+ var config = me._config;
+ var showLine = me._showLine = valueOrDefault$6(config.showLine, options.showLines);
+ var i, ilen;
+
+ me._xScale = me.getScaleForId(meta.xAxisID);
+ me._yScale = me.getScaleForId(meta.yAxisID);
+
+ // Update Line
+ if (showLine) {
+ // Compatibility: If the properties are defined with only the old name, use those values
+ if (config.tension !== undefined && config.lineTension === undefined) {
+ config.lineTension = config.tension;
+ }
+
+ // Utility
+ line._scale = me._yScale;
+ line._datasetIndex = me.index;
+ // Data
+ line._children = points;
+ // Model
+ line._model = me._resolveDatasetElementOptions(line);
+
+ line.pivot();
+ }
+
+ // Update Points
+ for (i = 0, ilen = points.length; i < ilen; ++i) {
+ me.updateElement(points[i], i, reset);
+ }
+
+ if (showLine && line._model.tension !== 0) {
+ me.updateBezierControlPoints();
+ }
+
+ // Now pivot the point for animation
+ for (i = 0, ilen = points.length; i < ilen; ++i) {
+ points[i].pivot();
+ }
+ },
+
+ updateElement: function(point, index, reset) {
+ var me = this;
+ var meta = me.getMeta();
+ var custom = point.custom || {};
+ var dataset = me.getDataset();
+ var datasetIndex = me.index;
+ var value = dataset.data[index];
+ var xScale = me._xScale;
+ var yScale = me._yScale;
+ var lineModel = meta.dataset._model;
+ var x, y;
+
+ var options = me._resolveDataElementOptions(point, index);
+
+ x = xScale.getPixelForValue(typeof value === 'object' ? value : NaN, index, datasetIndex);
+ y = reset ? yScale.getBasePixel() : me.calculatePointY(value, index, datasetIndex);
+
+ // Utility
+ point._xScale = xScale;
+ point._yScale = yScale;
+ point._options = options;
+ point._datasetIndex = datasetIndex;
+ point._index = index;
+
+ // Desired view properties
+ point._model = {
+ x: x,
+ y: y,
+ skip: custom.skip || isNaN(x) || isNaN(y),
+ // Appearance
+ radius: options.radius,
+ pointStyle: options.pointStyle,
+ rotation: options.rotation,
+ backgroundColor: options.backgroundColor,
+ borderColor: options.borderColor,
+ borderWidth: options.borderWidth,
+ tension: valueOrDefault$6(custom.tension, lineModel ? lineModel.tension : 0),
+ steppedLine: lineModel ? lineModel.steppedLine : false,
+ // Tooltip
+ hitRadius: options.hitRadius
+ };
+ },
+
+ /**
+ * @private
+ */
+ _resolveDatasetElementOptions: function(element) {
+ var me = this;
+ var config = me._config;
+ var custom = element.custom || {};
+ var options = me.chart.options;
+ var lineOptions = options.elements.line;
+ var values = core_datasetController.prototype._resolveDatasetElementOptions.apply(me, arguments);
+
+ // The default behavior of lines is to break at null values, according
+ // to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158
+ // This option gives lines the ability to span gaps
+ values.spanGaps = valueOrDefault$6(config.spanGaps, options.spanGaps);
+ values.tension = valueOrDefault$6(config.lineTension, lineOptions.tension);
+ values.steppedLine = resolve$2([custom.steppedLine, config.steppedLine, lineOptions.stepped]);
+ values.clip = toClip(valueOrDefault$6(config.clip, defaultClip(me._xScale, me._yScale, values.borderWidth)));
+
+ return values;
+ },
+
+ calculatePointY: function(value, index, datasetIndex) {
+ var me = this;
+ var chart = me.chart;
+ var yScale = me._yScale;
+ var sumPos = 0;
+ var sumNeg = 0;
+ var i, ds, dsMeta, stackedRightValue, rightValue, metasets, ilen;
+
+ if (yScale.options.stacked) {
+ rightValue = +yScale.getRightValue(value);
+ metasets = chart._getSortedVisibleDatasetMetas();
+ ilen = metasets.length;
+
+ for (i = 0; i < ilen; ++i) {
+ dsMeta = metasets[i];
+ if (dsMeta.index === datasetIndex) {
+ break;
+ }
+
+ ds = chart.data.datasets[dsMeta.index];
+ if (dsMeta.type === 'line' && dsMeta.yAxisID === yScale.id) {
+ stackedRightValue = +yScale.getRightValue(ds.data[index]);
+ if (stackedRightValue < 0) {
+ sumNeg += stackedRightValue || 0;
+ } else {
+ sumPos += stackedRightValue || 0;
+ }
+ }
+ }
+
+ if (rightValue < 0) {
+ return yScale.getPixelForValue(sumNeg + rightValue);
+ }
+ return yScale.getPixelForValue(sumPos + rightValue);
+ }
+ return yScale.getPixelForValue(value);
+ },
+
+ updateBezierControlPoints: function() {
+ var me = this;
+ var chart = me.chart;
+ var meta = me.getMeta();
+ var lineModel = meta.dataset._model;
+ var area = chart.chartArea;
+ var points = meta.data || [];
+ var i, ilen, model, controlPoints;
+
+ // Only consider points that are drawn in case the spanGaps option is used
+ if (lineModel.spanGaps) {
+ points = points.filter(function(pt) {
+ return !pt._model.skip;
+ });
+ }
+
+ function capControlPoint(pt, min, max) {
+ return Math.max(Math.min(pt, max), min);
+ }
+
+ if (lineModel.cubicInterpolationMode === 'monotone') {
+ helpers$1.splineCurveMonotone(points);
+ } else {
+ for (i = 0, ilen = points.length; i < ilen; ++i) {
+ model = points[i]._model;
+ controlPoints = helpers$1.splineCurve(
+ helpers$1.previousItem(points, i)._model,
+ model,
+ helpers$1.nextItem(points, i)._model,
+ lineModel.tension
+ );
+ model.controlPointPreviousX = controlPoints.previous.x;
+ model.controlPointPreviousY = controlPoints.previous.y;
+ model.controlPointNextX = controlPoints.next.x;
+ model.controlPointNextY = controlPoints.next.y;
+ }
+ }
+
+ if (chart.options.elements.line.capBezierPoints) {
+ for (i = 0, ilen = points.length; i < ilen; ++i) {
+ model = points[i]._model;
+ if (isPointInArea(model, area)) {
+ if (i > 0 && isPointInArea(points[i - 1]._model, area)) {
+ model.controlPointPreviousX = capControlPoint(model.controlPointPreviousX, area.left, area.right);
+ model.controlPointPreviousY = capControlPoint(model.controlPointPreviousY, area.top, area.bottom);
+ }
+ if (i < points.length - 1 && isPointInArea(points[i + 1]._model, area)) {
+ model.controlPointNextX = capControlPoint(model.controlPointNextX, area.left, area.right);
+ model.controlPointNextY = capControlPoint(model.controlPointNextY, area.top, area.bottom);
+ }
+ }
+ }
+ }
+ },
+
+ draw: function() {
+ var me = this;
+ var chart = me.chart;
+ var meta = me.getMeta();
+ var points = meta.data || [];
+ var area = chart.chartArea;
+ var canvas = chart.canvas;
+ var i = 0;
+ var ilen = points.length;
+ var clip;
+
+ if (me._showLine) {
+ clip = meta.dataset._model.clip;
+
+ helpers$1.canvas.clipArea(chart.ctx, {
+ left: clip.left === false ? 0 : area.left - clip.left,
+ right: clip.right === false ? canvas.width : area.right + clip.right,
+ top: clip.top === false ? 0 : area.top - clip.top,
+ bottom: clip.bottom === false ? canvas.height : area.bottom + clip.bottom
+ });
+
+ meta.dataset.draw();
+
+ helpers$1.canvas.unclipArea(chart.ctx);
+ }
+
+ // Draw the points
+ for (; i < ilen; ++i) {
+ points[i].draw(area);
+ }
+ },
+
+ /**
+ * @protected
+ */
+ setHoverStyle: function(point) {
+ var model = point._model;
+ var options = point._options;
+ var getHoverColor = helpers$1.getHoverColor;
+
+ point.$previousStyle = {
+ backgroundColor: model.backgroundColor,
+ borderColor: model.borderColor,
+ borderWidth: model.borderWidth,
+ radius: model.radius
+ };
+
+ model.backgroundColor = valueOrDefault$6(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));
+ model.borderColor = valueOrDefault$6(options.hoverBorderColor, getHoverColor(options.borderColor));
+ model.borderWidth = valueOrDefault$6(options.hoverBorderWidth, options.borderWidth);
+ model.radius = valueOrDefault$6(options.hoverRadius, options.radius);
+ },
+});
+
+var resolve$3 = helpers$1.options.resolve;
+
+core_defaults._set('polarArea', {
+ scale: {
+ type: 'radialLinear',
+ angleLines: {
+ display: false
+ },
+ gridLines: {
+ circular: true
+ },
+ pointLabels: {
+ display: false
+ },
+ ticks: {
+ beginAtZero: true
+ }
+ },
+
+ // Boolean - Whether to animate the rotation of the chart
+ animation: {
+ animateRotate: true,
+ animateScale: true
+ },
+
+ startAngle: -0.5 * Math.PI,
+ legendCallback: function(chart) {
+ var list = document.createElement('ul');
+ var data = chart.data;
+ var datasets = data.datasets;
+ var labels = data.labels;
+ var i, ilen, listItem, listItemSpan;
+
+ list.setAttribute('class', chart.id + '-legend');
+ if (datasets.length) {
+ for (i = 0, ilen = datasets[0].data.length; i < ilen; ++i) {
+ listItem = list.appendChild(document.createElement('li'));
+ listItemSpan = listItem.appendChild(document.createElement('span'));
+ listItemSpan.style.backgroundColor = datasets[0].backgroundColor[i];
+ if (labels[i]) {
+ listItem.appendChild(document.createTextNode(labels[i]));
+ }
+ }
+ }
+
+ return list.outerHTML;
+ },
+ legend: {
+ labels: {
+ generateLabels: function(chart) {
+ var data = chart.data;
+ if (data.labels.length && data.datasets.length) {
+ return data.labels.map(function(label, i) {
+ var meta = chart.getDatasetMeta(0);
+ var style = meta.controller.getStyle(i);
+
+ return {
+ text: label,
+ fillStyle: style.backgroundColor,
+ strokeStyle: style.borderColor,
+ lineWidth: style.borderWidth,
+ hidden: isNaN(data.datasets[0].data[i]) || meta.data[i].hidden,
+
+ // Extra data used for toggling the correct item
+ index: i
+ };
+ });
+ }
+ return [];
+ }
+ },
+
+ onClick: function(e, legendItem) {
+ var index = legendItem.index;
+ var chart = this.chart;
+ var i, ilen, meta;
+
+ for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {
+ meta = chart.getDatasetMeta(i);
+ meta.data[index].hidden = !meta.data[index].hidden;
+ }
+
+ chart.update();
+ }
+ },
+
+ // Need to override these to give a nice default
+ tooltips: {
+ callbacks: {
+ title: function() {
+ return '';
+ },
+ label: function(item, data) {
+ return data.labels[item.index] + ': ' + item.yLabel;
+ }
+ }
+ }
+});
+
+var controller_polarArea = core_datasetController.extend({
+
+ dataElementType: elements.Arc,
+
+ linkScales: helpers$1.noop,
+
+ /**
+ * @private
+ */
+ _dataElementOptions: [
+ 'backgroundColor',
+ 'borderColor',
+ 'borderWidth',
+ 'borderAlign',
+ 'hoverBackgroundColor',
+ 'hoverBorderColor',
+ 'hoverBorderWidth',
+ ],
+
+ /**
+ * @private
+ */
+ _getIndexScaleId: function() {
+ return this.chart.scale.id;
+ },
+
+ /**
+ * @private
+ */
+ _getValueScaleId: function() {
+ return this.chart.scale.id;
+ },
+
+ update: function(reset) {
+ var me = this;
+ var dataset = me.getDataset();
+ var meta = me.getMeta();
+ var start = me.chart.options.startAngle || 0;
+ var starts = me._starts = [];
+ var angles = me._angles = [];
+ var arcs = meta.data;
+ var i, ilen, angle;
+
+ me._updateRadius();
+
+ meta.count = me.countVisibleElements();
+
+ for (i = 0, ilen = dataset.data.length; i < ilen; i++) {
+ starts[i] = start;
+ angle = me._computeAngle(i);
+ angles[i] = angle;
+ start += angle;
+ }
+
+ for (i = 0, ilen = arcs.length; i < ilen; ++i) {
+ arcs[i]._options = me._resolveDataElementOptions(arcs[i], i);
+ me.updateElement(arcs[i], i, reset);
+ }
+ },
+
+ /**
+ * @private
+ */
+ _updateRadius: function() {
+ var me = this;
+ var chart = me.chart;
+ var chartArea = chart.chartArea;
+ var opts = chart.options;
+ var minSize = Math.min(chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);
+
+ chart.outerRadius = Math.max(minSize / 2, 0);
+ chart.innerRadius = Math.max(opts.cutoutPercentage ? (chart.outerRadius / 100) * (opts.cutoutPercentage) : 1, 0);
+ chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount();
+
+ me.outerRadius = chart.outerRadius - (chart.radiusLength * me.index);
+ me.innerRadius = me.outerRadius - chart.radiusLength;
+ },
+
+ updateElement: function(arc, index, reset) {
+ var me = this;
+ var chart = me.chart;
+ var dataset = me.getDataset();
+ var opts = chart.options;
+ var animationOpts = opts.animation;
+ var scale = chart.scale;
+ var labels = chart.data.labels;
+
+ var centerX = scale.xCenter;
+ var centerY = scale.yCenter;
+
+ // var negHalfPI = -0.5 * Math.PI;
+ var datasetStartAngle = opts.startAngle;
+ var distance = arc.hidden ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]);
+ var startAngle = me._starts[index];
+ var endAngle = startAngle + (arc.hidden ? 0 : me._angles[index]);
+
+ var resetRadius = animationOpts.animateScale ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]);
+ var options = arc._options || {};
+
+ helpers$1.extend(arc, {
+ // Utility
+ _datasetIndex: me.index,
+ _index: index,
+ _scale: scale,
+
+ // Desired view properties
+ _model: {
+ backgroundColor: options.backgroundColor,
+ borderColor: options.borderColor,
+ borderWidth: options.borderWidth,
+ borderAlign: options.borderAlign,
+ x: centerX,
+ y: centerY,
+ innerRadius: 0,
+ outerRadius: reset ? resetRadius : distance,
+ startAngle: reset && animationOpts.animateRotate ? datasetStartAngle : startAngle,
+ endAngle: reset && animationOpts.animateRotate ? datasetStartAngle : endAngle,
+ label: helpers$1.valueAtIndexOrDefault(labels, index, labels[index])
+ }
+ });
+
+ arc.pivot();
+ },
+
+ countVisibleElements: function() {
+ var dataset = this.getDataset();
+ var meta = this.getMeta();
+ var count = 0;
+
+ helpers$1.each(meta.data, function(element, index) {
+ if (!isNaN(dataset.data[index]) && !element.hidden) {
+ count++;
+ }
+ });
+
+ return count;
+ },
+
+ /**
+ * @protected
+ */
+ setHoverStyle: function(arc) {
+ var model = arc._model;
+ var options = arc._options;
+ var getHoverColor = helpers$1.getHoverColor;
+ var valueOrDefault = helpers$1.valueOrDefault;
+
+ arc.$previousStyle = {
+ backgroundColor: model.backgroundColor,
+ borderColor: model.borderColor,
+ borderWidth: model.borderWidth,
+ };
+
+ model.backgroundColor = valueOrDefault(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));
+ model.borderColor = valueOrDefault(options.hoverBorderColor, getHoverColor(options.borderColor));
+ model.borderWidth = valueOrDefault(options.hoverBorderWidth, options.borderWidth);
+ },
+
+ /**
+ * @private
+ */
+ _computeAngle: function(index) {
+ var me = this;
+ var count = this.getMeta().count;
+ var dataset = me.getDataset();
+ var meta = me.getMeta();
+
+ if (isNaN(dataset.data[index]) || meta.data[index].hidden) {
+ return 0;
+ }
+
+ // Scriptable options
+ var context = {
+ chart: me.chart,
+ dataIndex: index,
+ dataset: dataset,
+ datasetIndex: me.index
+ };
+
+ return resolve$3([
+ me.chart.options.elements.arc.angle,
+ (2 * Math.PI) / count
+ ], context, index);
+ }
+});
+
+core_defaults._set('pie', helpers$1.clone(core_defaults.doughnut));
+core_defaults._set('pie', {
+ cutoutPercentage: 0
+});
+
+// Pie charts are Doughnut chart with different defaults
+var controller_pie = controller_doughnut;
+
+var valueOrDefault$7 = helpers$1.valueOrDefault;
+
+core_defaults._set('radar', {
+ spanGaps: false,
+ scale: {
+ type: 'radialLinear'
+ },
+ elements: {
+ line: {
+ fill: 'start',
+ tension: 0 // no bezier in radar
+ }
+ }
+});
+
+var controller_radar = core_datasetController.extend({
+ datasetElementType: elements.Line,
+
+ dataElementType: elements.Point,
+
+ linkScales: helpers$1.noop,
+
+ /**
+ * @private
+ */
+ _datasetElementOptions: [
+ 'backgroundColor',
+ 'borderWidth',
+ 'borderColor',
+ 'borderCapStyle',
+ 'borderDash',
+ 'borderDashOffset',
+ 'borderJoinStyle',
+ 'fill'
+ ],
+
+ /**
+ * @private
+ */
+ _dataElementOptions: {
+ backgroundColor: 'pointBackgroundColor',
+ borderColor: 'pointBorderColor',
+ borderWidth: 'pointBorderWidth',
+ hitRadius: 'pointHitRadius',
+ hoverBackgroundColor: 'pointHoverBackgroundColor',
+ hoverBorderColor: 'pointHoverBorderColor',
+ hoverBorderWidth: 'pointHoverBorderWidth',
+ hoverRadius: 'pointHoverRadius',
+ pointStyle: 'pointStyle',
+ radius: 'pointRadius',
+ rotation: 'pointRotation'
+ },
+
+ /**
+ * @private
+ */
+ _getIndexScaleId: function() {
+ return this.chart.scale.id;
+ },
+
+ /**
+ * @private
+ */
+ _getValueScaleId: function() {
+ return this.chart.scale.id;
+ },
+
+ update: function(reset) {
+ var me = this;
+ var meta = me.getMeta();
+ var line = meta.dataset;
+ var points = meta.data || [];
+ var scale = me.chart.scale;
+ var config = me._config;
+ var i, ilen;
+
+ // Compatibility: If the properties are defined with only the old name, use those values
+ if (config.tension !== undefined && config.lineTension === undefined) {
+ config.lineTension = config.tension;
+ }
+
+ // Utility
+ line._scale = scale;
+ line._datasetIndex = me.index;
+ // Data
+ line._children = points;
+ line._loop = true;
+ // Model
+ line._model = me._resolveDatasetElementOptions(line);
+
+ line.pivot();
+
+ // Update Points
+ for (i = 0, ilen = points.length; i < ilen; ++i) {
+ me.updateElement(points[i], i, reset);
+ }
+
+ // Update bezier control points
+ me.updateBezierControlPoints();
+
+ // Now pivot the point for animation
+ for (i = 0, ilen = points.length; i < ilen; ++i) {
+ points[i].pivot();
+ }
+ },
+
+ updateElement: function(point, index, reset) {
+ var me = this;
+ var custom = point.custom || {};
+ var dataset = me.getDataset();
+ var scale = me.chart.scale;
+ var pointPosition = scale.getPointPositionForValue(index, dataset.data[index]);
+ var options = me._resolveDataElementOptions(point, index);
+ var lineModel = me.getMeta().dataset._model;
+ var x = reset ? scale.xCenter : pointPosition.x;
+ var y = reset ? scale.yCenter : pointPosition.y;
+
+ // Utility
+ point._scale = scale;
+ point._options = options;
+ point._datasetIndex = me.index;
+ point._index = index;
+
+ // Desired view properties
+ point._model = {
+ x: x, // value not used in dataset scale, but we want a consistent API between scales
+ y: y,
+ skip: custom.skip || isNaN(x) || isNaN(y),
+ // Appearance
+ radius: options.radius,
+ pointStyle: options.pointStyle,
+ rotation: options.rotation,
+ backgroundColor: options.backgroundColor,
+ borderColor: options.borderColor,
+ borderWidth: options.borderWidth,
+ tension: valueOrDefault$7(custom.tension, lineModel ? lineModel.tension : 0),
+
+ // Tooltip
+ hitRadius: options.hitRadius
+ };
+ },
+
+ /**
+ * @private
+ */
+ _resolveDatasetElementOptions: function() {
+ var me = this;
+ var config = me._config;
+ var options = me.chart.options;
+ var values = core_datasetController.prototype._resolveDatasetElementOptions.apply(me, arguments);
+
+ values.spanGaps = valueOrDefault$7(config.spanGaps, options.spanGaps);
+ values.tension = valueOrDefault$7(config.lineTension, options.elements.line.tension);
+
+ return values;
+ },
+
+ updateBezierControlPoints: function() {
+ var me = this;
+ var meta = me.getMeta();
+ var area = me.chart.chartArea;
+ var points = meta.data || [];
+ var i, ilen, model, controlPoints;
+
+ // Only consider points that are drawn in case the spanGaps option is used
+ if (meta.dataset._model.spanGaps) {
+ points = points.filter(function(pt) {
+ return !pt._model.skip;
+ });
+ }
+
+ function capControlPoint(pt, min, max) {
+ return Math.max(Math.min(pt, max), min);
+ }
+
+ for (i = 0, ilen = points.length; i < ilen; ++i) {
+ model = points[i]._model;
+ controlPoints = helpers$1.splineCurve(
+ helpers$1.previousItem(points, i, true)._model,
+ model,
+ helpers$1.nextItem(points, i, true)._model,
+ model.tension
+ );
+
+ // Prevent the bezier going outside of the bounds of the graph
+ model.controlPointPreviousX = capControlPoint(controlPoints.previous.x, area.left, area.right);
+ model.controlPointPreviousY = capControlPoint(controlPoints.previous.y, area.top, area.bottom);
+ model.controlPointNextX = capControlPoint(controlPoints.next.x, area.left, area.right);
+ model.controlPointNextY = capControlPoint(controlPoints.next.y, area.top, area.bottom);
+ }
+ },
+
+ setHoverStyle: function(point) {
+ var model = point._model;
+ var options = point._options;
+ var getHoverColor = helpers$1.getHoverColor;
+
+ point.$previousStyle = {
+ backgroundColor: model.backgroundColor,
+ borderColor: model.borderColor,
+ borderWidth: model.borderWidth,
+ radius: model.radius
+ };
+
+ model.backgroundColor = valueOrDefault$7(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));
+ model.borderColor = valueOrDefault$7(options.hoverBorderColor, getHoverColor(options.borderColor));
+ model.borderWidth = valueOrDefault$7(options.hoverBorderWidth, options.borderWidth);
+ model.radius = valueOrDefault$7(options.hoverRadius, options.radius);
+ }
+});
+
+core_defaults._set('scatter', {
+ hover: {
+ mode: 'single'
+ },
+
+ scales: {
+ xAxes: [{
+ id: 'x-axis-1', // need an ID so datasets can reference the scale
+ type: 'linear', // scatter should not use a category axis
+ position: 'bottom'
+ }],
+ yAxes: [{
+ id: 'y-axis-1',
+ type: 'linear',
+ position: 'left'
+ }]
+ },
+
+ tooltips: {
+ callbacks: {
+ title: function() {
+ return ''; // doesn't make sense for scatter since data are formatted as a point
+ },
+ label: function(item) {
+ return '(' + item.xLabel + ', ' + item.yLabel + ')';
+ }
+ }
+ }
+});
+
+core_defaults._set('global', {
+ datasets: {
+ scatter: {
+ showLine: false
+ }
+ }
+});
+
+// Scatter charts use line controllers
+var controller_scatter = controller_line;
+
+// NOTE export a map in which the key represents the controller type, not
+// the class, and so must be CamelCase in order to be correctly retrieved
+// by the controller in core.controller.js (`controllers[meta.type]`).
+
+var controllers = {
+ bar: controller_bar,
+ bubble: controller_bubble,
+ doughnut: controller_doughnut,
+ horizontalBar: controller_horizontalBar,
+ line: controller_line,
+ polarArea: controller_polarArea,
+ pie: controller_pie,
+ radar: controller_radar,
+ scatter: controller_scatter
+};
+
+/**
+ * Helper function to get relative position for an event
+ * @param {Event|IEvent} event - The event to get the position for
+ * @param {Chart} chart - The chart
+ * @returns {object} the event position
+ */
+function getRelativePosition(e, chart) {
+ if (e.native) {
+ return {
+ x: e.x,
+ y: e.y
+ };
+ }
+
+ return helpers$1.getRelativePosition(e, chart);
+}
+
+/**
+ * Helper function to traverse all of the visible elements in the chart
+ * @param {Chart} chart - the chart
+ * @param {function} handler - the callback to execute for each visible item
+ */
+function parseVisibleItems(chart, handler) {
+ var metasets = chart._getSortedVisibleDatasetMetas();
+ var metadata, i, j, ilen, jlen, element;
+
+ for (i = 0, ilen = metasets.length; i < ilen; ++i) {
+ metadata = metasets[i].data;
+ for (j = 0, jlen = metadata.length; j < jlen; ++j) {
+ element = metadata[j];
+ if (!element._view.skip) {
+ handler(element);
+ }
+ }
+ }
+}
+
+/**
+ * Helper function to get the items that intersect the event position
+ * @param {ChartElement[]} items - elements to filter
+ * @param {object} position - the point to be nearest to
+ * @return {ChartElement[]} the nearest items
+ */
+function getIntersectItems(chart, position) {
+ var elements = [];
+
+ parseVisibleItems(chart, function(element) {
+ if (element.inRange(position.x, position.y)) {
+ elements.push(element);
+ }
+ });
+
+ return elements;
+}
+
+/**
+ * Helper function to get the items nearest to the event position considering all visible items in teh chart
+ * @param {Chart} chart - the chart to look at elements from
+ * @param {object} position - the point to be nearest to
+ * @param {boolean} intersect - if true, only consider items that intersect the position
+ * @param {function} distanceMetric - function to provide the distance between points
+ * @return {ChartElement[]} the nearest items
+ */
+function getNearestItems(chart, position, intersect, distanceMetric) {
+ var minDistance = Number.POSITIVE_INFINITY;
+ var nearestItems = [];
+
+ parseVisibleItems(chart, function(element) {
+ if (intersect && !element.inRange(position.x, position.y)) {
+ return;
+ }
+
+ var center = element.getCenterPoint();
+ var distance = distanceMetric(position, center);
+ if (distance < minDistance) {
+ nearestItems = [element];
+ minDistance = distance;
+ } else if (distance === minDistance) {
+ // Can have multiple items at the same distance in which case we sort by size
+ nearestItems.push(element);
+ }
+ });
+
+ return nearestItems;
+}
+
+/**
+ * Get a distance metric function for two points based on the
+ * axis mode setting
+ * @param {string} axis - the axis mode. x|y|xy
+ */
+function getDistanceMetricForAxis(axis) {
+ var useX = axis.indexOf('x') !== -1;
+ var useY = axis.indexOf('y') !== -1;
+
+ return function(pt1, pt2) {
+ var deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;
+ var deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;
+ return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
+ };
+}
+
+function indexMode(chart, e, options) {
+ var position = getRelativePosition(e, chart);
+ // Default axis for index mode is 'x' to match old behaviour
+ options.axis = options.axis || 'x';
+ var distanceMetric = getDistanceMetricForAxis(options.axis);
+ var items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric);
+ var elements = [];
+
+ if (!items.length) {
+ return [];
+ }
+
+ chart._getSortedVisibleDatasetMetas().forEach(function(meta) {
+ var element = meta.data[items[0]._index];
+
+ // don't count items that are skipped (null data)
+ if (element && !element._view.skip) {
+ elements.push(element);
+ }
+ });
+
+ return elements;
+}
+
+/**
+ * @interface IInteractionOptions
+ */
+/**
+ * If true, only consider items that intersect the point
+ * @name IInterfaceOptions#boolean
+ * @type Boolean
+ */
+
+/**
+ * Contains interaction related functions
+ * @namespace Chart.Interaction
+ */
+var core_interaction = {
+ // Helper function for different modes
+ modes: {
+ single: function(chart, e) {
+ var position = getRelativePosition(e, chart);
+ var elements = [];
+
+ parseVisibleItems(chart, function(element) {
+ if (element.inRange(position.x, position.y)) {
+ elements.push(element);
+ return elements;
+ }
+ });
+
+ return elements.slice(0, 1);
+ },
+
+ /**
+ * @function Chart.Interaction.modes.label
+ * @deprecated since version 2.4.0
+ * @todo remove at version 3
+ * @private
+ */
+ label: indexMode,
+
+ /**
+ * Returns items at the same index. If the options.intersect parameter is true, we only return items if we intersect something
+ * If the options.intersect mode is false, we find the nearest item and return the items at the same index as that item
+ * @function Chart.Interaction.modes.index
+ * @since v2.4.0
+ * @param {Chart} chart - the chart we are returning items from
+ * @param {Event} e - the event we are find things at
+ * @param {IInteractionOptions} options - options to use during interaction
+ * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
+ */
+ index: indexMode,
+
+ /**
+ * Returns items in the same dataset. If the options.intersect parameter is true, we only return items if we intersect something
+ * If the options.intersect is false, we find the nearest item and return the items in that dataset
+ * @function Chart.Interaction.modes.dataset
+ * @param {Chart} chart - the chart we are returning items from
+ * @param {Event} e - the event we are find things at
+ * @param {IInteractionOptions} options - options to use during interaction
+ * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
+ */
+ dataset: function(chart, e, options) {
+ var position = getRelativePosition(e, chart);
+ options.axis = options.axis || 'xy';
+ var distanceMetric = getDistanceMetricForAxis(options.axis);
+ var items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric);
+
+ if (items.length > 0) {
+ items = chart.getDatasetMeta(items[0]._datasetIndex).data;
+ }
+
+ return items;
+ },
+
+ /**
+ * @function Chart.Interaction.modes.x-axis
+ * @deprecated since version 2.4.0. Use index mode and intersect == true
+ * @todo remove at version 3
+ * @private
+ */
+ 'x-axis': function(chart, e) {
+ return indexMode(chart, e, {intersect: false});
+ },
+
+ /**
+ * Point mode returns all elements that hit test based on the event position
+ * of the event
+ * @function Chart.Interaction.modes.intersect
+ * @param {Chart} chart - the chart we are returning items from
+ * @param {Event} e - the event we are find things at
+ * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
+ */
+ point: function(chart, e) {
+ var position = getRelativePosition(e, chart);
+ return getIntersectItems(chart, position);
+ },
+
+ /**
+ * nearest mode returns the element closest to the point
+ * @function Chart.Interaction.modes.intersect
+ * @param {Chart} chart - the chart we are returning items from
+ * @param {Event} e - the event we are find things at
+ * @param {IInteractionOptions} options - options to use
+ * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
+ */
+ nearest: function(chart, e, options) {
+ var position = getRelativePosition(e, chart);
+ options.axis = options.axis || 'xy';
+ var distanceMetric = getDistanceMetricForAxis(options.axis);
+ return getNearestItems(chart, position, options.intersect, distanceMetric);
+ },
+
+ /**
+ * x mode returns the elements that hit-test at the current x coordinate
+ * @function Chart.Interaction.modes.x
+ * @param {Chart} chart - the chart we are returning items from
+ * @param {Event} e - the event we are find things at
+ * @param {IInteractionOptions} options - options to use
+ * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
+ */
+ x: function(chart, e, options) {
+ var position = getRelativePosition(e, chart);
+ var items = [];
+ var intersectsItem = false;
+
+ parseVisibleItems(chart, function(element) {
+ if (element.inXRange(position.x)) {
+ items.push(element);
+ }
+
+ if (element.inRange(position.x, position.y)) {
+ intersectsItem = true;
+ }
+ });
+
+ // If we want to trigger on an intersect and we don't have any items
+ // that intersect the position, return nothing
+ if (options.intersect && !intersectsItem) {
+ items = [];
+ }
+ return items;
+ },
+
+ /**
+ * y mode returns the elements that hit-test at the current y coordinate
+ * @function Chart.Interaction.modes.y
+ * @param {Chart} chart - the chart we are returning items from
+ * @param {Event} e - the event we are find things at
+ * @param {IInteractionOptions} options - options to use
+ * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
+ */
+ y: function(chart, e, options) {
+ var position = getRelativePosition(e, chart);
+ var items = [];
+ var intersectsItem = false;
+
+ parseVisibleItems(chart, function(element) {
+ if (element.inYRange(position.y)) {
+ items.push(element);
+ }
+
+ if (element.inRange(position.x, position.y)) {
+ intersectsItem = true;
+ }
+ });
+
+ // If we want to trigger on an intersect and we don't have any items
+ // that intersect the position, return nothing
+ if (options.intersect && !intersectsItem) {
+ items = [];
+ }
+ return items;
+ }
+ }
+};
+
+var extend = helpers$1.extend;
+
+function filterByPosition(array, position) {
+ return helpers$1.where(array, function(v) {
+ return v.pos === position;
+ });
+}
+
+function sortByWeight(array, reverse) {
+ return array.sort(function(a, b) {
+ var v0 = reverse ? b : a;
+ var v1 = reverse ? a : b;
+ return v0.weight === v1.weight ?
+ v0.index - v1.index :
+ v0.weight - v1.weight;
+ });
+}
+
+function wrapBoxes(boxes) {
+ var layoutBoxes = [];
+ var i, ilen, box;
+
+ for (i = 0, ilen = (boxes || []).length; i < ilen; ++i) {
+ box = boxes[i];
+ layoutBoxes.push({
+ index: i,
+ box: box,
+ pos: box.position,
+ horizontal: box.isHorizontal(),
+ weight: box.weight
+ });
+ }
+ return layoutBoxes;
+}
+
+function setLayoutDims(layouts, params) {
+ var i, ilen, layout;
+ for (i = 0, ilen = layouts.length; i < ilen; ++i) {
+ layout = layouts[i];
+ // store width used instead of chartArea.w in fitBoxes
+ layout.width = layout.horizontal
+ ? layout.box.fullWidth && params.availableWidth
+ : params.vBoxMaxWidth;
+ // store height used instead of chartArea.h in fitBoxes
+ layout.height = layout.horizontal && params.hBoxMaxHeight;
+ }
+}
+
+function buildLayoutBoxes(boxes) {
+ var layoutBoxes = wrapBoxes(boxes);
+ var left = sortByWeight(filterByPosition(layoutBoxes, 'left'), true);
+ var right = sortByWeight(filterByPosition(layoutBoxes, 'right'));
+ var top = sortByWeight(filterByPosition(layoutBoxes, 'top'), true);
+ var bottom = sortByWeight(filterByPosition(layoutBoxes, 'bottom'));
+
+ return {
+ leftAndTop: left.concat(top),
+ rightAndBottom: right.concat(bottom),
+ chartArea: filterByPosition(layoutBoxes, 'chartArea'),
+ vertical: left.concat(right),
+ horizontal: top.concat(bottom)
+ };
+}
+
+function getCombinedMax(maxPadding, chartArea, a, b) {
+ return Math.max(maxPadding[a], chartArea[a]) + Math.max(maxPadding[b], chartArea[b]);
+}
+
+function updateDims(chartArea, params, layout) {
+ var box = layout.box;
+ var maxPadding = chartArea.maxPadding;
+ var newWidth, newHeight;
+
+ if (layout.size) {
+ // this layout was already counted for, lets first reduce old size
+ chartArea[layout.pos] -= layout.size;
+ }
+ layout.size = layout.horizontal ? box.height : box.width;
+ chartArea[layout.pos] += layout.size;
+
+ if (box.getPadding) {
+ var boxPadding = box.getPadding();
+ maxPadding.top = Math.max(maxPadding.top, boxPadding.top);
+ maxPadding.left = Math.max(maxPadding.left, boxPadding.left);
+ maxPadding.bottom = Math.max(maxPadding.bottom, boxPadding.bottom);
+ maxPadding.right = Math.max(maxPadding.right, boxPadding.right);
+ }
+
+ newWidth = params.outerWidth - getCombinedMax(maxPadding, chartArea, 'left', 'right');
+ newHeight = params.outerHeight - getCombinedMax(maxPadding, chartArea, 'top', 'bottom');
+
+ if (newWidth !== chartArea.w || newHeight !== chartArea.h) {
+ chartArea.w = newWidth;
+ chartArea.h = newHeight;
+
+ // return true if chart area changed in layout's direction
+ return layout.horizontal ? newWidth !== chartArea.w : newHeight !== chartArea.h;
+ }
+}
+
+function handleMaxPadding(chartArea) {
+ var maxPadding = chartArea.maxPadding;
+
+ function updatePos(pos) {
+ var change = Math.max(maxPadding[pos] - chartArea[pos], 0);
+ chartArea[pos] += change;
+ return change;
+ }
+ chartArea.y += updatePos('top');
+ chartArea.x += updatePos('left');
+ updatePos('right');
+ updatePos('bottom');
+}
+
+function getMargins(horizontal, chartArea) {
+ var maxPadding = chartArea.maxPadding;
+
+ function marginForPositions(positions) {
+ var margin = {left: 0, top: 0, right: 0, bottom: 0};
+ positions.forEach(function(pos) {
+ margin[pos] = Math.max(chartArea[pos], maxPadding[pos]);
+ });
+ return margin;
+ }
+
+ return horizontal
+ ? marginForPositions(['left', 'right'])
+ : marginForPositions(['top', 'bottom']);
+}
+
+function fitBoxes(boxes, chartArea, params) {
+ var refitBoxes = [];
+ var i, ilen, layout, box, refit, changed;
+
+ for (i = 0, ilen = boxes.length; i < ilen; ++i) {
+ layout = boxes[i];
+ box = layout.box;
+
+ box.update(
+ layout.width || chartArea.w,
+ layout.height || chartArea.h,
+ getMargins(layout.horizontal, chartArea)
+ );
+ if (updateDims(chartArea, params, layout)) {
+ changed = true;
+ if (refitBoxes.length) {
+ // Dimensions changed and there were non full width boxes before this
+ // -> we have to refit those
+ refit = true;
+ }
+ }
+ if (!box.fullWidth) { // fullWidth boxes don't need to be re-fitted in any case
+ refitBoxes.push(layout);
+ }
+ }
+
+ return refit ? fitBoxes(refitBoxes, chartArea, params) || changed : changed;
+}
+
+function placeBoxes(boxes, chartArea, params) {
+ var userPadding = params.padding;
+ var x = chartArea.x;
+ var y = chartArea.y;
+ var i, ilen, layout, box;
+
+ for (i = 0, ilen = boxes.length; i < ilen; ++i) {
+ layout = boxes[i];
+ box = layout.box;
+ if (layout.horizontal) {
+ box.left = box.fullWidth ? userPadding.left : chartArea.left;
+ box.right = box.fullWidth ? params.outerWidth - userPadding.right : chartArea.left + chartArea.w;
+ box.top = y;
+ box.bottom = y + box.height;
+ box.width = box.right - box.left;
+ y = box.bottom;
+ } else {
+ box.left = x;
+ box.right = x + box.width;
+ box.top = chartArea.top;
+ box.bottom = chartArea.top + chartArea.h;
+ box.height = box.bottom - box.top;
+ x = box.right;
+ }
+ }
+
+ chartArea.x = x;
+ chartArea.y = y;
+}
+
+core_defaults._set('global', {
+ layout: {
+ padding: {
+ top: 0,
+ right: 0,
+ bottom: 0,
+ left: 0
+ }
+ }
+});
+
+/**
+ * @interface ILayoutItem
+ * @prop {string} position - The position of the item in the chart layout. Possible values are
+ * 'left', 'top', 'right', 'bottom', and 'chartArea'
+ * @prop {number} weight - The weight used to sort the item. Higher weights are further away from the chart area
+ * @prop {boolean} fullWidth - if true, and the item is horizontal, then push vertical boxes down
+ * @prop {function} isHorizontal - returns true if the layout item is horizontal (ie. top or bottom)
+ * @prop {function} update - Takes two parameters: width and height. Returns size of item
+ * @prop {function} getPadding - Returns an object with padding on the edges
+ * @prop {number} width - Width of item. Must be valid after update()
+ * @prop {number} height - Height of item. Must be valid after update()
+ * @prop {number} left - Left edge of the item. Set by layout system and cannot be used in update
+ * @prop {number} top - Top edge of the item. Set by layout system and cannot be used in update
+ * @prop {number} right - Right edge of the item. Set by layout system and cannot be used in update
+ * @prop {number} bottom - Bottom edge of the item. Set by layout system and cannot be used in update
+ */
+
+// The layout service is very self explanatory. It's responsible for the layout within a chart.
+// Scales, Legends and Plugins all rely on the layout service and can easily register to be placed anywhere they need
+// It is this service's responsibility of carrying out that layout.
+var core_layouts = {
+ defaults: {},
+
+ /**
+ * Register a box to a chart.
+ * A box is simply a reference to an object that requires layout. eg. Scales, Legend, Title.
+ * @param {Chart} chart - the chart to use
+ * @param {ILayoutItem} item - the item to add to be layed out
+ */
+ addBox: function(chart, item) {
+ if (!chart.boxes) {
+ chart.boxes = [];
+ }
+
+ // initialize item with default values
+ item.fullWidth = item.fullWidth || false;
+ item.position = item.position || 'top';
+ item.weight = item.weight || 0;
+ item._layers = item._layers || function() {
+ return [{
+ z: 0,
+ draw: function() {
+ item.draw.apply(item, arguments);
+ }
+ }];
+ };
+
+ chart.boxes.push(item);
+ },
+
+ /**
+ * Remove a layoutItem from a chart
+ * @param {Chart} chart - the chart to remove the box from
+ * @param {ILayoutItem} layoutItem - the item to remove from the layout
+ */
+ removeBox: function(chart, layoutItem) {
+ var index = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;
+ if (index !== -1) {
+ chart.boxes.splice(index, 1);
+ }
+ },
+
+ /**
+ * Sets (or updates) options on the given `item`.
+ * @param {Chart} chart - the chart in which the item lives (or will be added to)
+ * @param {ILayoutItem} item - the item to configure with the given options
+ * @param {object} options - the new item options.
+ */
+ configure: function(chart, item, options) {
+ var props = ['fullWidth', 'position', 'weight'];
+ var ilen = props.length;
+ var i = 0;
+ var prop;
+
+ for (; i < ilen; ++i) {
+ prop = props[i];
+ if (options.hasOwnProperty(prop)) {
+ item[prop] = options[prop];
+ }
+ }
+ },
+
+ /**
+ * Fits boxes of the given chart into the given size by having each box measure itself
+ * then running a fitting algorithm
+ * @param {Chart} chart - the chart
+ * @param {number} width - the width to fit into
+ * @param {number} height - the height to fit into
+ */
+ update: function(chart, width, height) {
+ if (!chart) {
+ return;
+ }
+
+ var layoutOptions = chart.options.layout || {};
+ var padding = helpers$1.options.toPadding(layoutOptions.padding);
+
+ var availableWidth = width - padding.width;
+ var availableHeight = height - padding.height;
+ var boxes = buildLayoutBoxes(chart.boxes);
+ var verticalBoxes = boxes.vertical;
+ var horizontalBoxes = boxes.horizontal;
+
+ // Essentially we now have any number of boxes on each of the 4 sides.
+ // Our canvas looks like the following.
+ // The areas L1 and L2 are the left axes. R1 is the right axis, T1 is the top axis and
+ // B1 is the bottom axis
+ // There are also 4 quadrant-like locations (left to right instead of clockwise) reserved for chart overlays
+ // These locations are single-box locations only, when trying to register a chartArea location that is already taken,
+ // an error will be thrown.
+ //
+ // |----------------------------------------------------|
+ // | T1 (Full Width) |
+ // |----------------------------------------------------|
+ // | | | T2 | |
+ // | |----|-------------------------------------|----|
+ // | | | C1 | | C2 | |
+ // | | |----| |----| |
+ // | | | | |
+ // | L1 | L2 | ChartArea (C0) | R1 |
+ // | | | | |
+ // | | |----| |----| |
+ // | | | C3 | | C4 | |
+ // | |----|-------------------------------------|----|
+ // | | | B1 | |
+ // |----------------------------------------------------|
+ // | B2 (Full Width) |
+ // |----------------------------------------------------|
+ //
+
+ var params = Object.freeze({
+ outerWidth: width,
+ outerHeight: height,
+ padding: padding,
+ availableWidth: availableWidth,
+ vBoxMaxWidth: availableWidth / 2 / verticalBoxes.length,
+ hBoxMaxHeight: availableHeight / 2
+ });
+ var chartArea = extend({
+ maxPadding: extend({}, padding),
+ w: availableWidth,
+ h: availableHeight,
+ x: padding.left,
+ y: padding.top
+ }, padding);
+
+ setLayoutDims(verticalBoxes.concat(horizontalBoxes), params);
+
+ // First fit vertical boxes
+ fitBoxes(verticalBoxes, chartArea, params);
+
+ // Then fit horizontal boxes
+ if (fitBoxes(horizontalBoxes, chartArea, params)) {
+ // if the area changed, re-fit vertical boxes
+ fitBoxes(verticalBoxes, chartArea, params);
+ }
+
+ handleMaxPadding(chartArea);
+
+ // Finally place the boxes to correct coordinates
+ placeBoxes(boxes.leftAndTop, chartArea, params);
+
+ // Move to opposite side of chart
+ chartArea.x += chartArea.w;
+ chartArea.y += chartArea.h;
+
+ placeBoxes(boxes.rightAndBottom, chartArea, params);
+
+ chart.chartArea = {
+ left: chartArea.left,
+ top: chartArea.top,
+ right: chartArea.left + chartArea.w,
+ bottom: chartArea.top + chartArea.h
+ };
+
+ // Finally update boxes in chartArea (radial scale for example)
+ helpers$1.each(boxes.chartArea, function(layout) {
+ var box = layout.box;
+ extend(box, chart.chartArea);
+ box.update(chartArea.w, chartArea.h);
+ });
+ }
+};
+
+/**
+ * Platform fallback implementation (minimal).
+ * @see https://github.com/chartjs/Chart.js/pull/4591#issuecomment-319575939
+ */
+
+var platform_basic = {
+ acquireContext: function(item) {
+ if (item && item.canvas) {
+ // Support for any object associated to a canvas (including a context2d)
+ item = item.canvas;
+ }
+
+ return item && item.getContext('2d') || null;
+ }
+};
+
+var platform_dom = "/*\n * DOM element rendering detection\n * https://davidwalsh.name/detect-node-insertion\n */\n@keyframes chartjs-render-animation {\n\tfrom { opacity: 0.99; }\n\tto { opacity: 1; }\n}\n\n.chartjs-render-monitor {\n\tanimation: chartjs-render-animation 0.001s;\n}\n\n/*\n * DOM element resizing detection\n * https://github.com/marcj/css-element-queries\n */\n.chartjs-size-monitor,\n.chartjs-size-monitor-expand,\n.chartjs-size-monitor-shrink {\n\tposition: absolute;\n\tdirection: ltr;\n\tleft: 0;\n\ttop: 0;\n\tright: 0;\n\tbottom: 0;\n\toverflow: hidden;\n\tpointer-events: none;\n\tvisibility: hidden;\n\tz-index: -1;\n}\n\n.chartjs-size-monitor-expand > div {\n\tposition: absolute;\n\twidth: 1000000px;\n\theight: 1000000px;\n\tleft: 0;\n\ttop: 0;\n}\n\n.chartjs-size-monitor-shrink > div {\n\tposition: absolute;\n\twidth: 200%;\n\theight: 200%;\n\tleft: 0;\n\ttop: 0;\n}\n";
+
+var platform_dom$1 = /*#__PURE__*/Object.freeze({
+__proto__: null,
+'default': platform_dom
+});
+
+var stylesheet = getCjsExportFromNamespace(platform_dom$1);
+
+var EXPANDO_KEY = '$chartjs';
+var CSS_PREFIX = 'chartjs-';
+var CSS_SIZE_MONITOR = CSS_PREFIX + 'size-monitor';
+var CSS_RENDER_MONITOR = CSS_PREFIX + 'render-monitor';
+var CSS_RENDER_ANIMATION = CSS_PREFIX + 'render-animation';
+var ANIMATION_START_EVENTS = ['animationstart', 'webkitAnimationStart'];
+
+/**
+ * DOM event types -> Chart.js event types.
+ * Note: only events with different types are mapped.
+ * @see https://developer.mozilla.org/en-US/docs/Web/Events
+ */
+var EVENT_TYPES = {
+ touchstart: 'mousedown',
+ touchmove: 'mousemove',
+ touchend: 'mouseup',
+ pointerenter: 'mouseenter',
+ pointerdown: 'mousedown',
+ pointermove: 'mousemove',
+ pointerup: 'mouseup',
+ pointerleave: 'mouseout',
+ pointerout: 'mouseout'
+};
+
+/**
+ * The "used" size is the final value of a dimension property after all calculations have
+ * been performed. This method uses the computed style of `element` but returns undefined
+ * if the computed style is not expressed in pixels. That can happen in some cases where
+ * `element` has a size relative to its parent and this last one is not yet displayed,
+ * for example because of `display: none` on a parent node.
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/used_value
+ * @returns {number} Size in pixels or undefined if unknown.
+ */
+function readUsedSize(element, property) {
+ var value = helpers$1.getStyle(element, property);
+ var matches = value && value.match(/^(\d+)(\.\d+)?px$/);
+ return matches ? Number(matches[1]) : undefined;
+}
+
+/**
+ * Initializes the canvas style and render size without modifying the canvas display size,
+ * since responsiveness is handled by the controller.resize() method. The config is used
+ * to determine the aspect ratio to apply in case no explicit height has been specified.
+ */
+function initCanvas(canvas, config) {
+ var style = canvas.style;
+
+ // NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it
+ // returns null or '' if no explicit value has been set to the canvas attribute.
+ var renderHeight = canvas.getAttribute('height');
+ var renderWidth = canvas.getAttribute('width');
+
+ // Chart.js modifies some canvas values that we want to restore on destroy
+ canvas[EXPANDO_KEY] = {
+ initial: {
+ height: renderHeight,
+ width: renderWidth,
+ style: {
+ display: style.display,
+ height: style.height,
+ width: style.width
+ }
+ }
+ };
+
+ // Force canvas to display as block to avoid extra space caused by inline
+ // elements, which would interfere with the responsive resize process.
+ // https://github.com/chartjs/Chart.js/issues/2538
+ style.display = style.display || 'block';
+
+ if (renderWidth === null || renderWidth === '') {
+ var displayWidth = readUsedSize(canvas, 'width');
+ if (displayWidth !== undefined) {
+ canvas.width = displayWidth;
+ }
+ }
+
+ if (renderHeight === null || renderHeight === '') {
+ if (canvas.style.height === '') {
+ // If no explicit render height and style height, let's apply the aspect ratio,
+ // which one can be specified by the user but also by charts as default option
+ // (i.e. options.aspectRatio). If not specified, use canvas aspect ratio of 2.
+ canvas.height = canvas.width / (config.options.aspectRatio || 2);
+ } else {
+ var displayHeight = readUsedSize(canvas, 'height');
+ if (displayWidth !== undefined) {
+ canvas.height = displayHeight;
+ }
+ }
+ }
+
+ return canvas;
+}
+
+/**
+ * Detects support for options object argument in addEventListener.
+ * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support
+ * @private
+ */
+var supportsEventListenerOptions = (function() {
+ var supports = false;
+ try {
+ var options = Object.defineProperty({}, 'passive', {
+ // eslint-disable-next-line getter-return
+ get: function() {
+ supports = true;
+ }
+ });
+ window.addEventListener('e', null, options);
+ } catch (e) {
+ // continue regardless of error
+ }
+ return supports;
+}());
+
+// Default passive to true as expected by Chrome for 'touchstart' and 'touchend' events.
+// https://github.com/chartjs/Chart.js/issues/4287
+var eventListenerOptions = supportsEventListenerOptions ? {passive: true} : false;
+
+function addListener(node, type, listener) {
+ node.addEventListener(type, listener, eventListenerOptions);
+}
+
+function removeListener(node, type, listener) {
+ node.removeEventListener(type, listener, eventListenerOptions);
+}
+
+function createEvent(type, chart, x, y, nativeEvent) {
+ return {
+ type: type,
+ chart: chart,
+ native: nativeEvent || null,
+ x: x !== undefined ? x : null,
+ y: y !== undefined ? y : null,
+ };
+}
+
+function fromNativeEvent(event, chart) {
+ var type = EVENT_TYPES[event.type] || event.type;
+ var pos = helpers$1.getRelativePosition(event, chart);
+ return createEvent(type, chart, pos.x, pos.y, event);
+}
+
+function throttled(fn, thisArg) {
+ var ticking = false;
+ var args = [];
+
+ return function() {
+ args = Array.prototype.slice.call(arguments);
+ thisArg = thisArg || this;
+
+ if (!ticking) {
+ ticking = true;
+ helpers$1.requestAnimFrame.call(window, function() {
+ ticking = false;
+ fn.apply(thisArg, args);
+ });
+ }
+ };
+}
+
+function createDiv(cls) {
+ var el = document.createElement('div');
+ el.className = cls || '';
+ return el;
+}
+
+// Implementation based on https://github.com/marcj/css-element-queries
+function createResizer(handler) {
+ var maxSize = 1000000;
+
+ // NOTE(SB) Don't use innerHTML because it could be considered unsafe.
+ // https://github.com/chartjs/Chart.js/issues/5902
+ var resizer = createDiv(CSS_SIZE_MONITOR);
+ var expand = createDiv(CSS_SIZE_MONITOR + '-expand');
+ var shrink = createDiv(CSS_SIZE_MONITOR + '-shrink');
+
+ expand.appendChild(createDiv());
+ shrink.appendChild(createDiv());
+
+ resizer.appendChild(expand);
+ resizer.appendChild(shrink);
+ resizer._reset = function() {
+ expand.scrollLeft = maxSize;
+ expand.scrollTop = maxSize;
+ shrink.scrollLeft = maxSize;
+ shrink.scrollTop = maxSize;
+ };
+
+ var onScroll = function() {
+ resizer._reset();
+ handler();
+ };
+
+ addListener(expand, 'scroll', onScroll.bind(expand, 'expand'));
+ addListener(shrink, 'scroll', onScroll.bind(shrink, 'shrink'));
+
+ return resizer;
+}
+
+// https://davidwalsh.name/detect-node-insertion
+function watchForRender(node, handler) {
+ var expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {});
+ var proxy = expando.renderProxy = function(e) {
+ if (e.animationName === CSS_RENDER_ANIMATION) {
+ handler();
+ }
+ };
+
+ helpers$1.each(ANIMATION_START_EVENTS, function(type) {
+ addListener(node, type, proxy);
+ });
+
+ // #4737: Chrome might skip the CSS animation when the CSS_RENDER_MONITOR class
+ // is removed then added back immediately (same animation frame?). Accessing the
+ // `offsetParent` property will force a reflow and re-evaluate the CSS animation.
+ // https://gist.github.com/paulirish/5d52fb081b3570c81e3a#box-metrics
+ // https://github.com/chartjs/Chart.js/issues/4737
+ expando.reflow = !!node.offsetParent;
+
+ node.classList.add(CSS_RENDER_MONITOR);
+}
+
+function unwatchForRender(node) {
+ var expando = node[EXPANDO_KEY] || {};
+ var proxy = expando.renderProxy;
+
+ if (proxy) {
+ helpers$1.each(ANIMATION_START_EVENTS, function(type) {
+ removeListener(node, type, proxy);
+ });
+
+ delete expando.renderProxy;
+ }
+
+ node.classList.remove(CSS_RENDER_MONITOR);
+}
+
+function addResizeListener(node, listener, chart) {
+ var expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {});
+
+ // Let's keep track of this added resizer and thus avoid DOM query when removing it.
+ var resizer = expando.resizer = createResizer(throttled(function() {
+ if (expando.resizer) {
+ var container = chart.options.maintainAspectRatio && node.parentNode;
+ var w = container ? container.clientWidth : 0;
+ listener(createEvent('resize', chart));
+ if (container && container.clientWidth < w && chart.canvas) {
+ // If the container size shrank during chart resize, let's assume
+ // scrollbar appeared. So we resize again with the scrollbar visible -
+ // effectively making chart smaller and the scrollbar hidden again.
+ // Because we are inside `throttled`, and currently `ticking`, scroll
+ // events are ignored during this whole 2 resize process.
+ // If we assumed wrong and something else happened, we are resizing
+ // twice in a frame (potential performance issue)
+ listener(createEvent('resize', chart));
+ }
+ }
+ }));
+
+ // The resizer needs to be attached to the node parent, so we first need to be
+ // sure that `node` is attached to the DOM before injecting the resizer element.
+ watchForRender(node, function() {
+ if (expando.resizer) {
+ var container = node.parentNode;
+ if (container && container !== resizer.parentNode) {
+ container.insertBefore(resizer, container.firstChild);
+ }
+
+ // The container size might have changed, let's reset the resizer state.
+ resizer._reset();
+ }
+ });
+}
+
+function removeResizeListener(node) {
+ var expando = node[EXPANDO_KEY] || {};
+ var resizer = expando.resizer;
+
+ delete expando.resizer;
+ unwatchForRender(node);
+
+ if (resizer && resizer.parentNode) {
+ resizer.parentNode.removeChild(resizer);
+ }
+}
+
+/**
+ * Injects CSS styles inline if the styles are not already present.
+ * @param {HTMLDocument|ShadowRoot} rootNode - the node to contain the