diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 9df1f82be5060..0f0f125f38d3b 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -19,7 +19,6 @@ There are other branches available which serve specific purposes. | Branch | Purpose | | ------ | ------- | -| staging | Current codebase. | +| staging | Current codebase. Branch for the next minor Joomla version. New backward compatible features go into this branch. | | master | Each commit made to staging gets tested if it passes unit tests and codestyle rules. It is then merged into master. This is done automatically. | -| 2.5.x | Branch for the Joomla 2.5.x series. Support for this version has ended, no patches are accepted here. | -| 3.6.x | Branch for the next minor Joomla version. New backward compatible features go into this branch. Commits to staging will be applied to this branch as well. | +| 4.0-dev | Branch for the next major Joomla version. New backward incompatible features go into this branch. Commits to staging will be applied to this branch as well. | diff --git a/.travis.yml b/.travis.yml index 183a163597d01..e5be82a2e6ddc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,6 @@ matrix: - redis-server env: INSTALL_APCU_BC_BETA="no" INSTALL_MEMCACHE="no" INSTALL_MEMCACHED="no" # Disabled items that currently do not work in travis-ci hhvm allow_failures: - - php: 7.1 - php: hhvm - node_js: 6.1 diff --git a/README.md b/README.md index d1f2bafc8ab75..1f1ee778ac0c7 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ What is this? What is Joomla? --------------------- * [Joomla!](https://www.joomla.org/about-joomla.html) is a **Content Management System** (CMS) which enables you to build websites and powerful online applications. -* It is a simple and powerful web server application which requires a server with PHP and either MySQL, PostgreSQL or SQL Server to run. You can find [full technical requirements here](https://www.joomla.org/about-joomla/technical-requirements.html). +* It is a simple and powerful web server application which requires a server with PHP and either MySQL, PostgreSQL or SQL Server to run. You can find [full technical requirements here](https://downloads.joomla.org/technical-requirements). * Joomla! is **free and Open Source software** distributed under the GNU General Public License version 2 or later. Is Joomla! for you? @@ -50,14 +50,14 @@ Is it easy to change the layout display? Ready to install Joomla? --------------------- -* Check the [minimum requirements](https://www.joomla.org/about-joomla/technical-requirements.html). +* Check the [minimum requirements](https://downloads.joomla.org/technical-requirements). * How do you [install Joomla](https://docs.joomla.org/J3.x:Installing_Joomla)? * You could start your Joomla! experience by [building your site on a local test server](https://docs.joomla.org/Installing_Joomla_locally). When ready, it can be moved to an online hosting account of your choice. Updates are free! --------------------- -* Always use the [latest version](https://www.joomla.org/download.html). +* Always use the [latest version](https://downloads.joomla.org/latest). Where can you get support and help? --------------------- diff --git a/README.txt b/README.txt index 467eeec1a24d0..163410ea2498f 100644 --- a/README.txt +++ b/README.txt @@ -8,7 +8,7 @@ * Joomla! is a Content Management System (CMS) which enables you to build Web sites and powerful online applications. * It's a free and Open Source software, distributed under the GNU General Public License version 2 or later. * This is a simple and powerful web server application and it requires a server with PHP and either MySQL, PostgreSQL or SQL Server to run. - You can find full technical requirements here: https://www.joomla.org/about-joomla/technical-requirements.html. + You can find full technical requirements here: https://downloads.joomla.org/technical-requirements. 3- Is Joomla! for you? * Joomla! is the right solution for most content web projects: https://docs.joomla.org/Portal:Learn_More @@ -35,14 +35,14 @@ * Check out the template management information: https://docs.joomla.org/Portal:Template_Management 8- Ready to install Joomla? - * Check the minimum requirements here: https://www.joomla.org/about-joomla/technical-requirements.html + * Check the minimum requirements here: https://downloads.joomla.org/technical-requirements * How do you install Joomla - https://docs.joomla.org/J3.x:Installing_Joomla * You could start your Joomla! experience building your site on a local test server. When ready it can be moved to an online hosting account of your choice. See the tutorial: https://docs.joomla.org/Installing_Joomla_locally 9- Updates are free! - * Always use the latest version: https://www.joomla.org/download.html + * Always use the latest version: https://downloads.joomla.org/latest 10- Where can you get support and help? * The Joomla! Documentation: https://docs.joomla.org/Main_Page diff --git a/administrator/components/com_admin/postinstall/joomla40checks.php b/administrator/components/com_admin/postinstall/joomla40checks.php new file mode 100644 index 0000000000000..9ddd31b98c859 --- /dev/null +++ b/administrator/components/com_admin/postinstall/joomla40checks.php @@ -0,0 +1,50 @@ +getServerType(); + $serverVersion = $db->getVersion(); + + if ($serverType == 'mssql') + { + // MS SQL support will be dropped + return true; + } + + if ($serverType == 'postgresql' && version_compare($serverVersion, '9.2', 'lt')) + { + // PostgreSQL minimum version is 9.2 + return true; + } + + + if ($serverType == 'mysql' && version_compare($serverVersion, '5.5.3', 'lt')) + { + // MySQL minimum version is 5.5.3 + return true; + } + + // PHP minimum version is 5.5 + return version_compare(PHP_VERSION, '5.5.9', 'lt'); +} diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index e27036715fb5d..5c4fc2a73a68d 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -242,6 +242,7 @@ protected function updateManifestCaches() array('component', 'com_contenthistory', '', 1), array('component', 'com_postinstall', '', 1), array('component', 'com_joomlaupdate', '', 1), + array('component', 'com_fields', '', 1), // Libraries array('library', 'phputf8', '', 0), @@ -349,6 +350,8 @@ protected function updateManifestCaches() array('plugin', 'phpversioncheck', 'quickicon', 0), array('plugin', 'menu', 'editors-xtd', 0), array('plugin', 'contact', 'editors-xtd', 0), + array('plugin', 'fields', 'system', 0), + array('plugin', 'gallery', 'fields', 0), // Templates array('template', 'beez3', '', 0), @@ -1449,7 +1452,7 @@ public function deleteUnexistingFiles() '/media/editors/tinymce/plugins/compat3x/editable_selects.js', '/media/editors/tinymce/plugins/compat3x/form_utils.js', '/media/editors/tinymce/plugins/compat3x/mctabs.js', - '/media/editors/tinymce/plugins/compat3x/tiny_mce_popup.js', + '/media/editors/tinymce/plugins/compat3x/tiny_mce_popup.js', '/media/editors/tinymce/plugins/compat3x/validate.js', '/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php', '/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php', @@ -1516,6 +1519,33 @@ public function deleteUnexistingFiles() '/administrator/components/com_redirect/views/links/tmpl/default_batch.php', '/administrator/components/com_tags/views/tags/tmpl/default_batch.php', '/administrator/components/com_users/views/users/tmpl/default_batch.php', + '/components/com_contact/metadata.xml', + '/components/com_contact/views/category/metadata.xml', + '/components/com_contact/views/contact/metadata.xml', + '/components/com_contact/views/featured/metadata.xml', + '/components/com_content/metadata.xml', + '/components/com_content/views/archive/metadata.xml', + '/components/com_content/views/article/metadata.xml', + '/components/com_content/views/categories/metadata.xml', + '/components/com_content/views/category/metadata.xml', + '/components/com_content/views/featured/metadata.xml', + '/components/com_content/views/form/metadata.xml', + '/components/com_finder/views/search/metadata.xml', + '/components/com_mailto/views/mailto/metadata.xml', + '/components/com_mailto/views/sent/metadata.xml', + '/components/com_newsfeeds/metadata.xml', + '/components/com_newsfeeds/views/category/metadata.xml', + '/components/com_newsfeeds/views/newsfeed/metadata.xml', + '/components/com_search/views/search/metadata.xml', + '/components/com_tags/metadata.xml', + '/components/com_tags/views/tag/metadata.xml', + '/components/com_users/metadata.xml', + '/components/com_users/views/login/metadata.xml', + '/components/com_users/views/profile/metadata.xml', + '/components/com_users/views/registration/metadata.xml', + '/components/com_users/views/remind/metadata.xml', + '/components/com_users/views/reset/metadata.xml', + '/components/com_wrapper/metadata.xml', ); // TODO There is an issue while deleting folders using the ftp mode @@ -1695,7 +1725,8 @@ public function updateAssets() 'com_tags', 'com_contenthistory', 'com_ajax', - 'com_postinstall' + 'com_postinstall', + 'com_fields', ); foreach ($newComponents as $component) diff --git a/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-08-29.sql b/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-08-29.sql new file mode 100644 index 0000000000000..bbe6de6f98aa3 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-08-29.sql @@ -0,0 +1,56 @@ +CREATE TABLE IF NOT EXISTS `#__fields` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `asset_id` int(10) NOT NULL DEFAULT 0, + `context` varchar(255) NOT NULL DEFAULT '', + `catid` int(10) NOT NULL DEFAULT 0, + `assigned_cat_ids` varchar(255) NOT NULL DEFAULT '', + `title` varchar(255) NOT NULL DEFAULT '', + `alias` varchar(255) NOT NULL DEFAULT '', + `label` varchar(255) NOT NULL DEFAULT '', + `default_value` text NOT NULL DEFAULT '', + `type` varchar(255) NOT NULL DEFAULT 'text', + `options` varchar(255) NOT NULL DEFAULT '', + `note` varchar(255) NOT NULL DEFAULT '', + `description` text NOT NULL, + `state` tinyint(1) NOT NULL DEFAULT '0', + `required` tinyint(1) NOT NULL DEFAULT '0', + `checked_out` int(11) NOT NULL DEFAULT '0', + `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `ordering` int(11) NOT NULL DEFAULT '0', + `params` text NOT NULL, + `fieldparams` text NOT NULL, + `attributes` text NOT NULL, + `language` char(7) NOT NULL DEFAULT '', + `created_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created_user_id` int(10) unsigned NOT NULL DEFAULT '0', + `created_by_alias` varchar(255) NOT NULL DEFAULT '', + `modified_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified_by` int(10) unsigned NOT NULL DEFAULT '0', + `publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `access` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_state` (`state`), + KEY `idx_created_user_id` (`created_user_id`), + KEY `idx_access` (`access`), + KEY `idx_context` (`context`), + KEY `idx_language` (`language`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `#__fields_values` ( + `field_id` int(10) unsigned NOT NULL, + `context` varchar(255) NOT NULL, + `item_id` varchar(255) NOT NULL COMMENT 'Allow references to items which have strings as ids, eg. none db systems.', + `value` text NOT NULL DEFAULT '', + KEY (`field_id`), + KEY (`context`), + KEY (`item_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES +(33, 'com_fields', 'component', 'com_fields', '', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0); +INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES +(461, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0); +INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES +(462, 'plg_fields_gallery', 'plugin', 'gallery', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0); diff --git a/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-09-29.sql b/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-09-29.sql new file mode 100644 index 0000000000000..6ee23ef7b0d3c --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-09-29.sql @@ -0,0 +1,3 @@ +INSERT INTO `#__postinstall_messages` (`extension_id`, `title_key`, `description_key`, `action_key`, `language_extension`, `language_client_id`, `type`, `action_file`, `action`, `condition_file`, `condition_method`, `version_introduced`, `enabled`) +VALUES +(700, 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_TITLE', 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/joomla40checks.php', 'admin_postinstall_joomla40checks_condition', '3.7.0', 1); diff --git a/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-11-04.sql b/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-11-04.sql new file mode 100644 index 0000000000000..0281c97232aaa --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-11-04.sql @@ -0,0 +1 @@ +ALTER TABLE `#__extensions` CHANGE `enabled` `enabled` TINYINT(3) NOT NULL DEFAULT '0'; \ No newline at end of file diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.7.0-2016-08-29.sql b/administrator/components/com_admin/sql/updates/postgresql/3.7.0-2016-08-29.sql new file mode 100644 index 0000000000000..cc13bcb67b178 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/3.7.0-2016-08-29.sql @@ -0,0 +1,61 @@ +-- +-- Table: #__fields +-- +CREATE TABLE "#__fields" ( + "id" serial NOT NULL, + "asset_id" bigint DEFAULT 0 NOT NULL, + "context" varchar(255) DEFAULT '' NOT NULL, + "catid" bigint DEFAULT 0 NOT NULL, + "assigned_cat_ids" varchar(255) DEFAULT '' NOT NULL, + "title" varchar(255) DEFAULT '' NOT NULL, + "alias" varchar(255) DEFAULT '' NOT NULL, + "label" varchar(255) DEFAULT '' NOT NULL, + "default_value" text DEFAULT '' NOT NULL, + "type" varchar(255) DEFAULT 'text' NOT NULL, + "options" varchar(255) DEFAULT '' NOT NULL, + "note" varchar(255) DEFAULT '' NOT NULL, + "description" text DEFAULT '' NOT NULL, + "state" smallint DEFAULT 0 NOT NULL, + "required" smallint DEFAULT 0 NOT NULL, + "checked_out" integer DEFAULT 0 NOT NULL, + "checked_out_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "ordering" bigint DEFAULT 0 NOT NULL, + "params" text DEFAULT '' NOT NULL, + "fieldparams" text DEFAULT '' NOT NULL, + "attributes" text DEFAULT '' NOT NULL, + "language" varchar(7) DEFAULT '' NOT NULL, + "created_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "created_user_id" bigint DEFAULT 0 NOT NULL, + "created_by_alias" varchar(255) DEFAULT '' NOT NULL, + "modified_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "modified_by" bigint DEFAULT 0 NOT NULL, + "publish_up" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "publish_down" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "access" bigint DEFAULT 0 NOT NULL, + PRIMARY KEY ("id") +); +CREATE INDEX "#__fields_idx_checked_out" ON "#__fields" ("checked_out"); +CREATE INDEX "#__fields_idx_state" ON "#__fields" ("state"); +CREATE INDEX "#__fields_idx_created_user_id" ON "#__fields" ("created_user_id"); +CREATE INDEX "#__fields_idx_access" ON "#__fields" ("access"); +CREATE INDEX "#__fields_idx_context" ON "#__fields" ("context"); +CREATE INDEX "#__fields_idx_language" ON "#__fields" ("language"); + +-- +-- Table: #__fields_values +-- +CREATE TABLE "#__fields_values" ( +"field_id" bigint DEFAULT 0 NOT NULL, +"item_id" varchar(255) DEFAULT '' NOT NULL, +"context" varchar(255) DEFAULT '' NOT NULL, +"value" text DEFAULT '' NOT NULL +); +CREATE INDEX "#__fields_values_idx_field_id" ON "#__fields_values" ("field_id"); +CREATE INDEX "#__fields_values_idx_context" ON "#__fields_values" ("context"); +CREATE INDEX "#__fields_values_idx_item_id" ON "#__fields_values" ("item_id"); + +INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES +(33, 'com_fields', 'component', 'com_fields', '', 1, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(461, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(462, 'plg_fields_gallery', 'plugin', 'gallery', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); + diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.7.0-2016-09-29.sql b/administrator/components/com_admin/sql/updates/postgresql/3.7.0-2016-09-29.sql new file mode 100644 index 0000000000000..4bfd02b6a7e36 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/3.7.0-2016-09-29.sql @@ -0,0 +1,3 @@ +INSERT INTO "#__postinstall_messages" ("extension_id", "title_key", "description_key", "action_key", "language_extension", "language_client_id", "type", "action_file", "action", "condition_file", "condition_method", "version_introduced", "enabled") +VALUES +(700, 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_TITLE', 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/joomla40checks.php', 'admin_postinstall_joomla40checks_condition', '3.7.0', 1); diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.7.0-2016-11-04.sql b/administrator/components/com_admin/sql/updates/postgresql/3.7.0-2016-11-04.sql new file mode 100644 index 0000000000000..f423add87448a --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/3.7.0-2016-11-04.sql @@ -0,0 +1 @@ +ALTER TABLE "#__extensions" ALTER COLUMN "enabled" SET DEFAULT 0; \ No newline at end of file diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.7.0-2016-09-29.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.7.0-2016-09-29.sql new file mode 100644 index 0000000000000..9da07dbbff1a8 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.7.0-2016-09-29.sql @@ -0,0 +1,6 @@ +SET IDENTITY_INSERT [#__postinstall_messages] ON; + +INSERT INTO [#__postinstall_messages] ([extension_id], [title_key], [description_key], [action_key], [language_extension], [language_client_id], [type], [action_file], [action], [condition_file], [condition_method], [version_introduced], [enabled]) +SELECT 700, 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_TITLE', 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/joomla40checks.php', 'admin_postinstall_joomla40checks_condition', '3.7.0', 1; + +SET IDENTITY_INSERT [#__postinstall_messages] OFF; \ No newline at end of file diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.7.0-2016-11-04.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.7.0-2016-11-04.sql new file mode 100644 index 0000000000000..9b77ec2d3520c --- /dev/null +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.7.0-2016-11-04.sql @@ -0,0 +1 @@ +ALTER TABLE [#__extensions] ALTER COLUMN [enabled] DEFAULT 0; \ No newline at end of file diff --git a/administrator/components/com_admin/views/help/view.html.php b/administrator/components/com_admin/views/help/view.html.php index c24445530c572..d379ad41f26f6 100644 --- a/administrator/components/com_admin/views/help/view.html.php +++ b/administrator/components/com_admin/views/help/view.html.php @@ -54,7 +54,7 @@ class AdminViewHelp extends JViewLegacy * @var string * @since 1.6 */ - protected $latest_version_check = 'https://www.joomla.org/download.html'; + protected $latest_version_check = 'https://downloads.joomla.org/latest'; /** * URL for the start here link diff --git a/administrator/components/com_banners/models/fields/bannerclient.php b/administrator/components/com_banners/models/fields/bannerclient.php index ec9281ed9a341..1351a2afa1827 100644 --- a/administrator/components/com_banners/models/fields/bannerclient.php +++ b/administrator/components/com_banners/models/fields/bannerclient.php @@ -9,8 +9,6 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); /** @@ -18,7 +16,7 @@ * * @since 1.6 */ -class JFormFieldBannerClient extends JFormFieldList +class JFormFieldBannerClient extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_banners/views/banner/tmpl/edit.php b/administrator/components/com_banners/views/banner/tmpl/edit.php index 6e9a81075794e..f3d9b3415517f 100644 --- a/administrator/components/com_banners/views/banner/tmpl/edit.php +++ b/administrator/components/com_banners/views/banner/tmpl/edit.php @@ -13,7 +13,8 @@ JHtml::_('jquery.framework'); JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select', null, array('disable_search_threshold' => 0 )); +JHtml::_('formbehavior.chosen', '#jform_catid', null, array('disable_search_threshold' => 0 )); +JHtml::_('formbehavior.chosen', 'select'); JFactory::getDocument()->addScriptDeclaration(' Joomla.submitbutton = function(task) diff --git a/administrator/components/com_categories/models/categories.php b/administrator/components/com_categories/models/categories.php index 12436c0824bb2..8a40d397e9c35 100644 --- a/administrator/components/com_categories/models/categories.php +++ b/administrator/components/com_categories/models/categories.php @@ -370,13 +370,19 @@ public function getItems() */ public function countItems(&$items, $extension) { - $parts = explode('.', $extension); + $parts = explode('.', $extension, 2); $component = $parts[0]; $section = null; if (count($parts) > 1) { $section = $parts[1]; + + // If the section ends with .fields, then the category belongs to com_fields + if (substr($section, -strlen('.fields')) === '.fields') + { + $component = 'com_fields'; + } } // Try to find the component helper. diff --git a/administrator/components/com_categories/models/category.php b/administrator/components/com_categories/models/category.php index 9be579027461c..31218a3f869ca 100644 --- a/administrator/components/com_categories/models/category.php +++ b/administrator/components/com_categories/models/category.php @@ -271,9 +271,11 @@ public function getForm($data = array(), $loadData = true) $data['extension'] = $extension; } - $user = JFactory::getUser(); + $categoryId = $jinput->get('id'); + $parts = explode('.', $extension); + $assetKey = $categoryId ? $extension . '.category.' . $categoryId : $parts[0]; - if (!$user->authorise('core.edit.state', $extension . '.category.' . $jinput->get('id'))) + if (!JFactory::getUser()->authorise('core.edit.state', $assetKey)) { // Disable fields for display. $form->setFieldAttribute('ordering', 'disabled', 'true'); @@ -425,28 +427,25 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $form->setFieldAttribute('rules', 'section', $name); // Association category items - $assoc = $this->getAssoc(); - - if ($assoc) + if ($this->getAssoc()) { - $languages = JLanguageHelper::getLanguages('lang_code'); - $addform = new SimpleXMLElement('
'); - $fields = $addform->addChild('fields'); - $fields->addAttribute('name', 'associations'); - $fieldset = $fields->addChild('fieldset'); - $fieldset->addAttribute('name', 'item_associations'); - $fieldset->addAttribute('description', 'COM_CATEGORIES_ITEM_ASSOCIATIONS_FIELDSET_DESC'); - $add = false; - - foreach ($languages as $tag => $language) + $languages = JLanguageHelper::getContentLanguages(false, true, null, 'ordering', 'asc'); + + if (count($languages) > 1) { - if (empty($data->language) || $tag != $data->language) + $addform = new SimpleXMLElement(''); + $fields = $addform->addChild('fields'); + $fields->addAttribute('name', 'associations'); + $fieldset = $fields->addChild('fieldset'); + $fieldset->addAttribute('name', 'item_associations'); + $fieldset->addAttribute('description', 'COM_CATEGORIES_ITEM_ASSOCIATIONS_FIELDSET_DESC'); + + foreach ($languages as $language) { - $add = true; $field = $fieldset->addChild('field'); - $field->addAttribute('name', $tag); + $field->addAttribute('name', $language->lang_code); $field->addAttribute('type', 'modal_category'); - $field->addAttribute('language', $tag); + $field->addAttribute('language', $language->lang_code); $field->addAttribute('label', $language->title); $field->addAttribute('translate_label', 'false'); $field->addAttribute('extension', $extension); @@ -455,10 +454,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $field->addAttribute('edit', 'true'); $field->addAttribute('clear', 'true'); } - } - if ($add) - { $form->load($addform, false); } } diff --git a/administrator/components/com_categories/models/fields/categoryedit.php b/administrator/components/com_categories/models/fields/categoryedit.php index 5b7fc7ce90dfb..8adbe0508ea3b 100644 --- a/administrator/components/com_categories/models/fields/categoryedit.php +++ b/administrator/components/com_categories/models/fields/categoryedit.php @@ -11,14 +11,12 @@ use Joomla\Utilities\ArrayHelper; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldCategoryEdit extends JFormFieldList +class JFormFieldCategoryEdit extends JFormAbstractlist { /** * To allow creation of new categories. diff --git a/administrator/components/com_categories/models/fields/categoryparent.php b/administrator/components/com_categories/models/fields/categoryparent.php index bbb4954f7e81a..67e36f0704bba 100644 --- a/administrator/components/com_categories/models/fields/categoryparent.php +++ b/administrator/components/com_categories/models/fields/categoryparent.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldCategoryParent extends JFormFieldList +class JFormFieldCategoryParent extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_categories/models/fields/modal/category.php b/administrator/components/com_categories/models/fields/modal/category.php index f1ae9a2d9d82f..fa5b311d3a779 100644 --- a/administrator/components/com_categories/models/fields/modal/category.php +++ b/administrator/components/com_categories/models/fields/modal/category.php @@ -58,7 +58,7 @@ protected function getInput() // Add the modal field script to the document head. JHtml::_('jquery.framework'); - JHtml::_('script', 'system/modal-fields.js', false, true); + JHtml::_('script', 'system/modal-fields.js', array('version' => 'auto', 'relative' => true)); // Script to proxy the select modal function to the modal-fields.js file. if ($allowSelect) @@ -265,4 +265,16 @@ function jSelectCategory_" . $this->id . "(id, title, object) { return $html; } + + /** + * Method to get the field label markup. + * + * @return string The field label markup. + * + * @since __DEPLOY_VERSION__ + */ + protected function getLabel() + { + return str_replace($this->id, $this->id . '_id', parent::getLabel()); + } } diff --git a/administrator/components/com_categories/views/categories/tmpl/default.php b/administrator/components/com_categories/views/categories/tmpl/default.php index aa388b7289bac..da9fec00f58da 100644 --- a/administrator/components/com_categories/views/categories/tmpl/default.php +++ b/administrator/components/com_categories/views/categories/tmpl/default.php @@ -25,7 +25,7 @@ $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc'); -$parts = explode('.', $extension); +$parts = explode('.', $extension, 2); $component = $parts[0]; $section = null; $columns = 7; @@ -40,6 +40,13 @@ { $section = $inflector->toPlural($section); } + + // If the section ends with .fields, then the category belongs to com_fields + if (substr($section, -strlen('.fields')) === '.fields') + { + $component = 'com_fields'; + $section = 'fields&context=' . str_replace('.fields', '', implode('.', $parts)); + } } if ($saveOrder) diff --git a/administrator/components/com_categories/views/categories/view.html.php b/administrator/components/com_categories/views/categories/view.html.php index 925cff302649b..6b2c516fa8de1 100644 --- a/administrator/components/com_categories/views/categories/view.html.php +++ b/administrator/components/com_categories/views/categories/view.html.php @@ -146,7 +146,6 @@ protected function addToolbar() $section = $this->state->get('filter.section'); $canDo = JHelperContent::getActions($component, 'category', $categoryId); $user = JFactory::getUser(); - $extension = JFactory::getApplication()->input->get('extension', '', 'word'); // Get the toolbar object instance $bar = JToolbar::getInstance('toolbar'); @@ -182,7 +181,7 @@ protected function addToolbar() } // Load specific css component - JHtml::_('stylesheet', $component . '/administrator/categories.css', array(), true); + JHtml::_('stylesheet', $component . '/administrator/categories.css', array('version' => 'auto', 'relative' => true)); // Prepare the toolbar. JToolbarHelper::title($title, 'folder categories ' . substr($component, 4) . ($section ? "-$section" : '') . '-categories'); @@ -210,9 +209,9 @@ protected function addToolbar() } // Add a batch button - if ($user->authorise('core.create', $extension) - && $user->authorise('core.edit', $extension) - && $user->authorise('core.edit.state', $extension)) + if ($canDo->get('core.create') + && $canDo->get('core.edit') + && $canDo->get('core.edit.state')) { $title = JText::_('JTOOLBAR_BATCH'); diff --git a/administrator/components/com_categories/views/category/view.html.php b/administrator/components/com_categories/views/category/view.html.php index 0885a62b96793..b96585e0aebc8 100644 --- a/administrator/components/com_categories/views/category/view.html.php +++ b/administrator/components/com_categories/views/category/view.html.php @@ -80,27 +80,18 @@ public function display($tpl = null) JFactory::getApplication()->input->set('hidemainmenu', true); - if ($this->getLayout() == 'modal') + // If we are forcing a language in modal (used for associations). + if ($this->getLayout() === 'modal' && $forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) { - // If we are forcing a language in modal (used for associations). - if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) - { - // Set the language field to the forcedLanguage and disable changing it. - $this->form->setValue('language', null, $forcedLanguage); - $this->form->setFieldAttribute('language', 'readonly', 'true'); + // Set the language field to the forcedLanguage and disable changing it. + $this->form->setValue('language', null, $forcedLanguage); + $this->form->setFieldAttribute('language', 'readonly', 'true'); - // Only allow to select categories with All language or with the forced language. - $this->form->setFieldAttribute('parent_id', 'language', '*,' . $forcedLanguage); + // Only allow to select categories with All language or with the forced language. + $this->form->setFieldAttribute('parent_id', 'language', '*,' . $forcedLanguage); - // Only allow to select tags with All language or with the forced language. - $this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage); - } - } - // If not in associations modal, block the language change if in edit modal, language not All, associations enabled and some association. - elseif ($this->item->id && $this->form->getValue('language', null, '*') != '*' && JLanguageAssociations::isEnabled() - && count($this->item->associations) > 0) - { - $this->form->setFieldAttribute('language', 'readonly', 'true'); + // Only allow to select tags with All language or with the forced language. + $this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage); } $this->addToolbar(); @@ -170,7 +161,7 @@ protected function addToolbar() } // Load specific css component - JHtml::_('stylesheet', $component . '/administrator/categories.css', array(), true); + JHtml::_('stylesheet', $component . '/administrator/categories.css', array('version' => 'auto', 'relative' => true)); // Prepare the toolbar. JToolbarHelper::title( diff --git a/administrator/components/com_config/model/application.php b/administrator/components/com_config/model/application.php index 4d39b71995bb2..cf25b55cba5d2 100644 --- a/administrator/components/com_config/model/application.php +++ b/administrator/components/com_config/model/application.php @@ -143,7 +143,7 @@ public function save($data) // If available in HTTPS check also the status code. if (!in_array($response->code, array(200, 503, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 401), true)) { - throw new RuntimeException('HTTPS version of the site returned an invalid HTTP status code.'); + throw new RuntimeException(JText::_('COM_CONFIG_ERROR_SSL_NOT_AVAILABLE_HTTP_CODE')); } } catch (RuntimeException $e) @@ -154,7 +154,7 @@ public function save($data) $app->setUserState('com_config.config.global.data.force_ssl', 0); // Inform the user - $app->enqueueMessage(JText::_('COM_CONFIG_ERROR_SSL_NOT_AVAILABLE'), 'warning'); + $app->enqueueMessage(JText::sprintf('COM_CONFIG_ERROR_SSL_NOT_AVAILABLE', $e->getMessage()), 'warning'); } } diff --git a/administrator/components/com_config/model/form/application.xml b/administrator/components/com_config/model/form/application.xml index 0e60be69d120b..d5387811c40d2 100644 --- a/administrator/components/com_config/model/form/application.xml +++ b/administrator/components/com_config/model/form/application.xml @@ -3,17 +3,7 @@
- - - - - + - - - - - - - - + /> + class="btn-group btn-group-yesno" + default="1" + showon="cache_handler:memcache" + filter="integer" + > @@ -66,12 +30,13 @@ + class="btn-group btn-group-yesno" + default="0" + showon="cache_handler:memcache" + filter="integer" + > @@ -79,32 +44,35 @@ + size="25" + /> + size="5" + /> + class="btn-group btn-group-yesno" + default="1" + showon="cache_handler:memcached" + filter="integer" + > @@ -112,12 +80,13 @@ + class="btn-group btn-group-yesno" + default="0" + showon="cache_handler:memcached" + filter="integer" + > @@ -125,32 +94,35 @@ + size="25" + /> + size="5" + /> + showon="cache_handler:redis" + > @@ -158,22 +130,24 @@ + showon="cache_handler:redis" + size="25" + /> + showon="cache_handler:redis" + size="5" + /> + size="30" + /> + + + + + + + + + + > + + + + +
- - - - - - + default="none" + filter="word" + /> + size="25" + /> + size="5" + /> + size="25" + /> + size="5" + /> + + + + + + + +
+
diff --git a/administrator/components/com_config/view/application/tmpl/default.php b/administrator/components/com_config/view/application/tmpl/default.php index 458a6c3bf2d74..a2c9a1d8fe6bf 100644 --- a/administrator/components/com_config/view/application/tmpl/default.php +++ b/administrator/components/com_config/view/application/tmpl/default.php @@ -60,11 +60,11 @@
  • -
  • ftp) : ?>
  • +
  • @@ -103,11 +103,6 @@
    -
    -
    - loadTemplate('permissions'); ?> -
    -
    loadTemplate('filters'); ?> @@ -118,6 +113,11 @@ loadTemplate('ftplogin'); ?>
    +
    +
    + loadTemplate('permissions'); ?> +
    +
    diff --git a/administrator/components/com_config/view/application/tmpl/default_mail.php b/administrator/components/com_config/view/application/tmpl/default_mail.php index 4ae388305e860..9a10a682631bb 100644 --- a/administrator/components/com_config/view/application/tmpl/default_mail.php +++ b/administrator/components/com_config/view/application/tmpl/default_mail.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -JHtml::script('system/sendtestmail.js', false, true); +JHtml::_('script', 'system/sendtestmail.js', array('version' => 'auto', 'relative' => true)); // Load JavaScript message titles JText::script('ERROR'); diff --git a/administrator/components/com_config/view/component/tmpl/default.php b/administrator/components/com_config/view/component/tmpl/default.php index 6f88644d048c1..279499e53fc5f 100644 --- a/administrator/components/com_config/view/component/tmpl/default.php +++ b/administrator/components/com_config/view/component/tmpl/default.php @@ -59,7 +59,7 @@ showon)) : ?> - + 'auto', 'relative' => true)); ?> showon) as $showonfield) : ?> @@ -88,7 +88,7 @@ getAttribute('showon')) : ?> - + 'auto', 'relative' => true)); ?> diff --git a/administrator/components/com_contact/access.xml b/administrator/components/com_contact/access.xml index bec45dc97d690..911c69072684b 100644 --- a/administrator/components/com_contact/access.xml +++ b/administrator/components/com_contact/access.xml @@ -9,6 +9,7 @@ +
    diff --git a/administrator/components/com_contact/config.xml b/administrator/components/com_contact/config.xml index 80c50d21a08da..2a663c17db7a5 100644 --- a/administrator/components/com_contact/config.xml +++ b/administrator/components/com_contact/config.xml @@ -96,8 +96,8 @@ default="1" class="btn-group btn-group-yesno" > - + JHIDE + + + + JNO + + + + +
    get('custom_fields_enable', '1')) + { + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELDS'), + 'index.php?option=com_fields&context=com_contact.contact', + $vName == 'fields.contact' + ); + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELD_GROUPS'), + 'index.php?option=com_categories&extension=com_contact.contact.fields', + $vName == 'categories.contact' + ); + } } /** @@ -132,7 +146,7 @@ public static function countTagItems(&$items, $extension) ->where('ct.type_alias =' . $db->q($extension)) ->join('LEFT', $join) ->group('published'); - + $db->setQuery($query); $contacts = $db->loadObjectList(); diff --git a/administrator/components/com_contact/models/contact.php b/administrator/components/com_contact/models/contact.php index 3f4496c61d1ec..7af8644a19c8d 100644 --- a/administrator/components/com_contact/models/contact.php +++ b/administrator/components/com_contact/models/contact.php @@ -535,29 +535,26 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $form->setFieldAttribute('catid', 'allowAdd', 'true'); } - // Association content items - $assoc = JLanguageAssociations::isEnabled(); - - if ($assoc) + // Association contact items + if (JLanguageAssociations::isEnabled()) { - $languages = JLanguageHelper::getLanguages('lang_code'); - $addform = new SimpleXMLElement(''); - $fields = $addform->addChild('fields'); - $fields->addAttribute('name', 'associations'); - $fieldset = $fields->addChild('fieldset'); - $fieldset->addAttribute('name', 'item_associations'); - $fieldset->addAttribute('description', 'COM_CONTACT_ITEM_ASSOCIATIONS_FIELDSET_DESC'); - $add = false; - - foreach ($languages as $tag => $language) + $languages = JLanguageHelper::getContentLanguages(false, true, null, 'ordering', 'asc'); + + if (count($languages) > 1) { - if (empty($data->language) || $tag != $data->language) + $addform = new SimpleXMLElement(''); + $fields = $addform->addChild('fields'); + $fields->addAttribute('name', 'associations'); + $fieldset = $fields->addChild('fieldset'); + $fieldset->addAttribute('name', 'item_associations'); + $fieldset->addAttribute('description', 'COM_CONTACT_ITEM_ASSOCIATIONS_FIELDSET_DESC'); + + foreach ($languages as $language) { - $add = true; $field = $fieldset->addChild('field'); - $field->addAttribute('name', $tag); + $field->addAttribute('name', $language->lang_code); $field->addAttribute('type', 'modal_contact'); - $field->addAttribute('language', $tag); + $field->addAttribute('language', $language->lang_code); $field->addAttribute('label', $language->title); $field->addAttribute('translate_label', 'false'); $field->addAttribute('select', 'true'); @@ -565,10 +562,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $field->addAttribute('edit', 'true'); $field->addAttribute('clear', 'true'); } - } - if ($add) - { $form->load($addform, false); } } diff --git a/administrator/components/com_contact/models/fields/modal/contact.php b/administrator/components/com_contact/models/fields/modal/contact.php index 5c1e1dcd77943..f58f287f0cf39 100644 --- a/administrator/components/com_contact/models/fields/modal/contact.php +++ b/administrator/components/com_contact/models/fields/modal/contact.php @@ -49,7 +49,7 @@ protected function getInput() // Add the modal field script to the document head. JHtml::_('jquery.framework'); - JHtml::_('script', 'system/modal-fields.js', false, true); + JHtml::_('script', 'system/modal-fields.js', array('version' => 'auto', 'relative' => true)); // Script to proxy the select modal function to the modal-fields.js file. if ($allowSelect) diff --git a/administrator/components/com_contact/models/forms/contact.xml b/administrator/components/com_contact/models/forms/contact.xml index ba12c81fe591c..c5ef8afd862b7 100644 --- a/administrator/components/com_contact/models/forms/contact.xml +++ b/administrator/components/com_contact/models/forms/contact.xml @@ -432,8 +432,8 @@ label="JGLOBAL_SHOW_CATEGORY_LABEL" description="COM_CONTACT_FIELD_SHOW_CATEGORY_DESC" class="chzn-color" + useglobal="true" > - @@ -445,8 +445,8 @@ label="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_LABEL" description="COM_CONTACT_FIELD_CONTACT_SHOW_LIST_DESC" class="chzn-color" + useglobal="true" > - @@ -456,8 +456,8 @@ type="list" label="COM_CONTACT_FIELD_PRESENTATION_LABEL" description="COM_CONTACT_FIELD_PRESENTATION_DESC" + useglobal="true" > - @@ -469,8 +469,8 @@ label="COM_CONTACT_FIELD_SHOW_TAGS_LABEL" description="COM_CONTACT_FIELD_SHOW_TAGS_DESC" class="chzn-color" + useglobal="true" > - @@ -481,8 +481,8 @@ label="COM_CONTACT_FIELD_SHOW_INFO_LABEL" description="COM_CONTACT_FIELD_SHOW_INFO_DESC" class="chzn-color" + useglobal="true" > - @@ -493,8 +493,8 @@ label="COM_CONTACT_FIELD_PARAMS_NAME_LABEL" description="COM_CONTACT_FIELD_PARAMS_NAME_DESC" class="chzn-color" + useglobal="true" > - @@ -505,8 +505,8 @@ label="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_LABEL" description="COM_CONTACT_FIELD_PARAMS_CONTACT_POSITION_DESC" class="chzn-color" + useglobal="true" > - @@ -517,8 +517,8 @@ label="JGLOBAL_EMAIL" description="COM_CONTACT_FIELD_PARAMS_CONTACT_E_MAIL_DESC" class="chzn-color" + useglobal="true" > - @@ -529,8 +529,8 @@ label="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_LABEL" description="COM_CONTACT_FIELD_PARAMS_STREET_ADDRESS_DESC" class="chzn-color" + useglobal="true" > - @@ -541,8 +541,8 @@ label="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_LABEL" description="COM_CONTACT_FIELD_PARAMS_TOWN-SUBURB_DESC" class="chzn-color" + useglobal="true" > - @@ -553,8 +553,8 @@ label="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_LABEL" description="COM_CONTACT_FIELD_PARAMS_STATE-COUNTY_DESC" class="chzn-color" + useglobal="true" > - @@ -565,8 +565,8 @@ label="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_LABEL" description="COM_CONTACT_FIELD_PARAMS_POST-ZIP_CODE_DESC" class="chzn-color" + useglobal="true" > - @@ -577,8 +577,8 @@ label="COM_CONTACT_FIELD_PARAMS_COUNTRY_LABEL" description="COM_CONTACT_FIELD_PARAMS_COUNTRY_DESC" class="chzn-color" + useglobal="true" > - @@ -589,8 +589,8 @@ label="COM_CONTACT_FIELD_PARAMS_TELEPHONE_LABEL" description="COM_CONTACT_FIELD_PARAMS_TELEPHONE_DESC" class="chzn-color" + useglobal="true" > - @@ -601,8 +601,8 @@ label="COM_CONTACT_FIELD_PARAMS_MOBILE_LABEL" description="COM_CONTACT_FIELD_PARAMS_MOBILE_DESC" class="chzn-color" + useglobal="true" > - @@ -613,8 +613,8 @@ label="COM_CONTACT_FIELD_PARAMS_FAX_LABEL" description="COM_CONTACT_FIELD_PARAMS_FAX_DESC" class="chzn-color" + useglobal="true" > - @@ -625,8 +625,8 @@ label="COM_CONTACT_FIELD_PARAMS_WEBPAGE_LABEL" description="COM_CONTACT_FIELD_PARAMS_WEBPAGE_DESC" class="chzn-color" + useglobal="true" > - @@ -637,8 +637,8 @@ label="COM_CONTACT_FIELD_PARAMS_SHOW_IMAGE_LABEL" description="COM_CONTACT_FIELD_PARAMS_SHOW_IMAGE_DESC" class="chzn-color" + useglobal="true" > - @@ -649,8 +649,8 @@ label="COM_CONTACT_FIELD_PARAMS_MISC_INFO_LABEL" description="COM_CONTACT_FIELD_PARAMS_MISC_INFO_DESC" class="chzn-color" + useglobal="true" > - @@ -661,8 +661,8 @@ label="COM_CONTACT_FIELD_PARAMS_VCARD_LABEL" description="COM_CONTACT_FIELD_PARAMS_VCARD_DESC" class="chzn-color" + useglobal="true" > - @@ -673,8 +673,8 @@ label="COM_CONTACT_FIELD_ARTICLES_SHOW_LABEL" description="COM_CONTACT_FIELD_ARTICLES_SHOW_DESC" class="chzn-color" + useglobal="true" > - @@ -685,8 +685,8 @@ label="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_LABEL" description="COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_DESC" default="" + useglobal="true" > - @@ -709,11 +709,22 @@ label="COM_CONTACT_FIELD_PROFILE_SHOW_LABEL" description="COM_CONTACT_FIELD_PROFILE_SHOW_DESC" class="chzn-color" + useglobal="true" > - + + + + - @@ -831,8 +842,8 @@ label="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_LABEL" description="COM_CONTACT_FIELD_EMAIL_SHOW_FORM_DESC" class="chzn-color" + useglobal="true" > - @@ -843,8 +854,8 @@ label="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_LABEL" description="COM_CONTACT_FIELD_EMAIL_EMAIL_COPY_DESC" class="chzn-color" + useglobal="true" > - @@ -882,8 +893,8 @@ label="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_LABEL" description="COM_CONTACT_FIELD_CONFIG_SESSION_CHECK_DESC" class="chzn-color" + useglobal="true" > - @@ -894,8 +905,8 @@ label="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_LABEL" description="COM_CONTACT_FIELD_CONFIG_CUSTOM_REPLY_DESC" class="chzn-color" + useglobal="true" > - diff --git a/administrator/components/com_contact/models/forms/filter_fields.xml b/administrator/components/com_contact/models/forms/filter_fields.xml new file mode 100644 index 0000000000000..af6340df1f011 --- /dev/null +++ b/administrator/components/com_contact/models/forms/filter_fields.xml @@ -0,0 +1,11 @@ + + + +
    + + + + +
    +
    + diff --git a/administrator/components/com_contact/views/contact/tmpl/edit.php b/administrator/components/com_contact/views/contact/tmpl/edit.php index 5831e37082b28..567cf8f3135d1 100644 --- a/administrator/components/com_contact/views/contact/tmpl/edit.php +++ b/administrator/components/com_contact/views/contact/tmpl/edit.php @@ -14,7 +14,8 @@ JHtml::_('behavior.formvalidator'); JHtml::_('behavior.keepalive'); -JHtml::_('formbehavior.chosen', 'select', null, array('disable_search_threshold' => 0 )); +JHtml::_('formbehavior.chosen', '#jform_catid', null, array('disable_search_threshold' => 0 )); +JHtml::_('formbehavior.chosen', 'select'); $app = JFactory::getApplication(); $input = $app->input; diff --git a/administrator/components/com_contact/views/contact/view.html.php b/administrator/components/com_contact/views/contact/view.html.php index e5d8f4b5d3f41..f44756b53e5f8 100644 --- a/administrator/components/com_contact/views/contact/view.html.php +++ b/administrator/components/com_contact/views/contact/view.html.php @@ -59,27 +59,18 @@ public function display($tpl = null) return false; } - if ($this->getLayout() == 'modal') + // If we are forcing a language in modal (used for associations). + if ($this->getLayout() === 'modal' && $forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) { - // If we are forcing a language in modal (used for associations). - if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) - { - // Set the language field to the forcedLanguage and disable changing it. - $this->form->setValue('language', null, $forcedLanguage); - $this->form->setFieldAttribute('language', 'readonly', 'true'); + // Set the language field to the forcedLanguage and disable changing it. + $this->form->setValue('language', null, $forcedLanguage); + $this->form->setFieldAttribute('language', 'readonly', 'true'); - // Only allow to select categories with All language or with the forced language. - $this->form->setFieldAttribute('catid', 'language', '*,' . $forcedLanguage); + // Only allow to select categories with All language or with the forced language. + $this->form->setFieldAttribute('catid', 'language', '*,' . $forcedLanguage); - // Only allow to select tags with All language or with the forced language. - $this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage); - } - } - // If not in associations modal, block the language change if in edit modal, language not All, associations enabled and some association. - elseif ($this->item->id && $this->form->getValue('language', null, '*') != '*' && JLanguageAssociations::isEnabled() - && count($this->item->associations) > 0) - { - $this->form->setFieldAttribute('language', 'readonly', 'true'); + // Only allow to select tags with All language or with the forced language. + $this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage); } $this->addToolbar(); diff --git a/administrator/components/com_contact/views/contacts/tmpl/modal.php b/administrator/components/com_contact/views/contacts/tmpl/modal.php index 5b2482c943cd2..969ec405a1ca3 100644 --- a/administrator/components/com_contact/views/contacts/tmpl/modal.php +++ b/administrator/components/com_contact/views/contacts/tmpl/modal.php @@ -9,6 +9,13 @@ defined('_JEXEC') or die; +$app = JFactory::getApplication(); + +if ($app->isSite()) +{ + JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN')); +} + JLoader::register('ContactHelperRoute', JPATH_ROOT . '/components/com_contact/helpers/route.php'); JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); @@ -21,15 +28,13 @@ $searchFilterDesc = $this->filterForm->getFieldAttribute('search', 'description', null, 'filter'); JHtml::_('bootstrap.tooltip', '#filter_search', array('title' => JText::_($searchFilterDesc), 'placement' => 'bottom')); -$app = JFactory::getApplication(); - $function = $app->input->getCmd('function', 'jSelectContact'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?>
    -
    + $this)); ?> diff --git a/administrator/components/com_contact/views/contacts/view.html.php b/administrator/components/com_contact/views/contacts/view.html.php index feef9cabef453..81d360f4f2320 100644 --- a/administrator/components/com_contact/views/contacts/view.html.php +++ b/administrator/components/com_contact/views/contacts/view.html.php @@ -156,9 +156,9 @@ protected function addToolbar() } // Add a batch button - if ($user->authorise('core.create', 'com_contacts') - && $user->authorise('core.edit', 'com_contacts') - && $user->authorise('core.edit.state', 'com_contacts')) + if ($user->authorise('core.create', 'com_contact') + && $user->authorise('core.edit', 'com_contact') + && $user->authorise('core.edit.state', 'com_contact')) { $title = JText::_('JTOOLBAR_BATCH'); diff --git a/administrator/components/com_content/access.xml b/administrator/components/com_content/access.xml index 49aa10819ead2..f43aaac7069af 100644 --- a/administrator/components/com_content/access.xml +++ b/administrator/components/com_content/access.xml @@ -9,6 +9,7 @@ +
    diff --git a/administrator/components/com_content/config.xml b/administrator/components/com_content/config.xml index 886a3954549c7..e18986bc822b7 100644 --- a/administrator/components/com_content/config.xml +++ b/administrator/components/com_content/config.xml @@ -1013,6 +1013,18 @@ + + + + +
    get('custom_fields_enable', '1')) + { + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELDS'), + 'index.php?option=com_fields&context=com_content.article', + $vName == 'fields.article' + ); + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELD_GROUPS'), + 'index.php?option=com_categories&extension=com_content.article.fields', + $vName == 'categories.article' + ); + } + JHtmlSidebar::addEntry( JText::_('COM_CONTENT_SUBMENU_FEATURED'), 'index.php?option=com_content&view=featured', diff --git a/administrator/components/com_content/models/article.php b/administrator/components/com_content/models/article.php index f01a92b011d7c..409c9de645d46 100644 --- a/administrator/components/com_content/models/article.php +++ b/administrator/components/com_content/models/article.php @@ -724,28 +724,25 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') } // Association content items - $assoc = JLanguageAssociations::isEnabled(); - - if ($assoc) + if (JLanguageAssociations::isEnabled()) { - $languages = JLanguageHelper::getLanguages('lang_code'); - $addform = new SimpleXMLElement(''); - $fields = $addform->addChild('fields'); - $fields->addAttribute('name', 'associations'); - $fieldset = $fields->addChild('fieldset'); - $fieldset->addAttribute('name', 'item_associations'); - $fieldset->addAttribute('description', 'COM_CONTENT_ITEM_ASSOCIATIONS_FIELDSET_DESC'); - $add = false; - - foreach ($languages as $tag => $language) + $languages = JLanguageHelper::getContentLanguages(false, true, null, 'ordering', 'asc'); + + if (count($languages) > 1) { - if (empty($data->language) || $tag != $data->language) + $addform = new SimpleXMLElement(''); + $fields = $addform->addChild('fields'); + $fields->addAttribute('name', 'associations'); + $fieldset = $fields->addChild('fieldset'); + $fieldset->addAttribute('name', 'item_associations'); + $fieldset->addAttribute('description', 'COM_CONTENT_ITEM_ASSOCIATIONS_FIELDSET_DESC'); + + foreach ($languages as $language) { - $add = true; $field = $fieldset->addChild('field'); - $field->addAttribute('name', $tag); + $field->addAttribute('name', $language->lang_code); $field->addAttribute('type', 'modal_article'); - $field->addAttribute('language', $tag); + $field->addAttribute('language', $language->lang_code); $field->addAttribute('label', $language->title); $field->addAttribute('translate_label', 'false'); $field->addAttribute('select', 'true'); @@ -753,10 +750,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $field->addAttribute('edit', 'true'); $field->addAttribute('clear', 'true'); } - } - if ($add) - { $form->load($addform, false); } } diff --git a/administrator/components/com_content/models/fields/modal/article.php b/administrator/components/com_content/models/fields/modal/article.php index b968b79eb4b30..8c4712078c4a2 100644 --- a/administrator/components/com_content/models/fields/modal/article.php +++ b/administrator/components/com_content/models/fields/modal/article.php @@ -14,7 +14,7 @@ * * @since 1.6 */ -class JFormFieldModal_Article extends JFormField +class JFormFieldModal_Article extends JFormField implements JFormDomfieldinterface { /** * The form field type. @@ -49,7 +49,7 @@ protected function getInput() // Add the modal field script to the document head. JHtml::_('jquery.framework'); - JHtml::_('script', 'system/modal-fields.js', false, true); + JHtml::_('script', 'system/modal-fields.js', array('version' => 'auto', 'relative' => true)); // Script to proxy the select modal function to the modal-fields.js file. if ($allowSelect) diff --git a/administrator/components/com_content/models/forms/article.xml b/administrator/components/com_content/models/forms/article.xml index c85e033b65b91..fb46c6da6378d 100644 --- a/administrator/components/com_content/models/forms/article.xml +++ b/administrator/components/com_content/models/forms/article.xml @@ -165,8 +165,9 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_TITLE_LABEL" - description="JGLOBAL_SHOW_TITLE_DESC"> - + description="JGLOBAL_SHOW_TITLE_DESC" + useglobal="true" + > @@ -176,8 +177,9 @@ type="list" class="chzn-color" label="JGLOBAL_LINKED_TITLES_LABEL" - description="JGLOBAL_LINKED_TITLES_DESC"> - + description="JGLOBAL_LINKED_TITLES_DESC" + useglobal="true" + > @@ -187,8 +189,8 @@ class="chzn-color" label="COM_CONTENT_FIELD_SHOW_TAGS_LABEL" description="COM_CONTENT_FIELD_SHOW_TAGS_DESC" - > - + useglobal="true" + > @@ -198,8 +200,8 @@ class="chzn-color" description="JGLOBAL_SHOW_INTRO_DESC" label="JGLOBAL_SHOW_INTRO_LABEL" + useglobal="true" > - @@ -208,8 +210,9 @@ type="list" default="" label="COM_CONTENT_FIELD_INFOBLOCK_POSITION_LABEL" - description="COM_CONTENT_FIELD_INFOBLOCK_POSITION_DESC"> - + description="COM_CONTENT_FIELD_INFOBLOCK_POSITION_DESC" + useglobal="true" + > @@ -220,8 +223,9 @@ type="list" class="chzn-color" label="COM_CONTENT_FIELD_INFOBLOCK_TITLE_LABEL" - description="COM_CONTENT_FIELD_INFOBLOCK_TITLE_DESC"> - + description="COM_CONTENT_FIELD_INFOBLOCK_TITLE_DESC" + useglobal="true" + > @@ -231,8 +235,9 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_CATEGORY_LABEL" - description="JGLOBAL_SHOW_CATEGORY_DESC"> - + description="JGLOBAL_SHOW_CATEGORY_DESC" + useglobal="true" + > @@ -242,8 +247,9 @@ type="list" class="chzn-color" label="JGLOBAL_LINK_CATEGORY_LABEL" - description="JGLOBAL_LINK_CATEGORY_DESC"> - + description="JGLOBAL_LINK_CATEGORY_DESC" + useglobal="true" + > @@ -253,8 +259,9 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL" - description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC"> - + description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC" + useglobal="true" + > @@ -264,8 +271,9 @@ type="list" class="chzn-color" label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL" - description="JGLOBAL_LINK_PARENT_CATEGORY_DESC"> - + description="JGLOBAL_LINK_PARENT_CATEGORY_DESC" + useglobal="true" + > @@ -275,8 +283,9 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_ASSOCIATIONS_LABEL" - description="JGLOBAL_SHOW_ASSOCIATIONS_DESC"> - + description="JGLOBAL_SHOW_ASSOCIATIONS_DESC" + useglobal="true" + > @@ -286,8 +295,9 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_AUTHOR_LABEL" - description="JGLOBAL_SHOW_AUTHOR_DESC"> - + description="JGLOBAL_SHOW_AUTHOR_DESC" + useglobal="true" + > @@ -297,8 +307,9 @@ type="list" class="chzn-color" label="JGLOBAL_LINK_AUTHOR_LABEL" - description="JGLOBAL_LINK_AUTHOR_DESC"> - + description="JGLOBAL_LINK_AUTHOR_DESC" + useglobal="true" + > @@ -308,8 +319,9 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_CREATE_DATE_LABEL" - description="JGLOBAL_SHOW_CREATE_DATE_DESC"> - + description="JGLOBAL_SHOW_CREATE_DATE_DESC" + useglobal="true" + > @@ -319,8 +331,9 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_MODIFY_DATE_LABEL" - description="JGLOBAL_SHOW_MODIFY_DATE_DESC"> - + description="JGLOBAL_SHOW_MODIFY_DATE_DESC" + useglobal="true" + > @@ -330,8 +343,9 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL" - description="JGLOBAL_SHOW_PUBLISH_DATE_DESC"> - + description="JGLOBAL_SHOW_PUBLISH_DATE_DESC" + useglobal="true" + > @@ -341,8 +355,9 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_NAVIGATION_LABEL" - description="JGLOBAL_SHOW_NAVIGATION_DESC"> - + description="JGLOBAL_SHOW_NAVIGATION_DESC" + useglobal="true" + > @@ -352,8 +367,9 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_ICONS_LABEL" - description="JGLOBAL_SHOW_ICONS_DESC"> - + description="JGLOBAL_SHOW_ICONS_DESC" + useglobal="true" + > @@ -363,8 +379,9 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_PRINT_ICON_LABEL" - description="JGLOBAL_SHOW_PRINT_ICON_DESC"> - + description="JGLOBAL_SHOW_PRINT_ICON_DESC" + useglobal="true" + > @@ -374,8 +391,9 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_EMAIL_ICON_LABEL" - description="JGLOBAL_SHOW_EMAIL_ICON_DESC"> - + description="JGLOBAL_SHOW_EMAIL_ICON_DESC" + useglobal="true" + > @@ -386,8 +404,8 @@ class="chzn-color" label="JGLOBAL_SHOW_VOTE_LABEL" description="JGLOBAL_SHOW_VOTE_DESC" - > - + useglobal="true" + > @@ -397,8 +415,9 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_HITS_LABEL" - description="JGLOBAL_SHOW_HITS_DESC"> - + description="JGLOBAL_SHOW_HITS_DESC" + useglobal="true" + > @@ -408,10 +427,11 @@ type="list" class="chzn-color" label="JGLOBAL_SHOW_UNAUTH_LINKS_LABEL" - description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC"> - - - + description="JGLOBAL_SHOW_UNAUTH_LINKS_DESC" + useglobal="true" + > + + - + description="COM_CONTENT_FIELD_URLSPOSITION_DESC" + useglobal="true" + > @@ -457,11 +478,10 @@ default="" label="COM_CONTENT_SHOW_PUBLISHING_OPTIONS_LABEL" description="COM_CONTENT_SHOW_PUBLISHING_OPTIONS_DESC" + useglobal="true" > - - - - + + - - - - + + - - - - + + - - - + +
    @@ -666,11 +684,12 @@ name="float_intro" type="list" label="COM_CONTENT_FLOAT_LABEL" - description="COM_CONTENT_FLOAT_DESC"> - - - - + description="COM_CONTENT_FLOAT_DESC" + useglobal="true" + > + + + - - - - + description="COM_CONTENT_FLOAT_DESC" + useglobal="true" + > + + + - @@ -766,12 +786,12 @@ description="COM_CONTENT_URL_FIELD_BROWSERNAV_DESC" default="" filter="options" + useglobal="true" > - - - - - + + + + - - - - - + + + + diff --git a/administrator/components/com_content/views/article/tmpl/edit.php b/administrator/components/com_content/views/article/tmpl/edit.php index 5b88d8dd4da7a..158fda0720020 100644 --- a/administrator/components/com_content/views/article/tmpl/edit.php +++ b/administrator/components/com_content/views/article/tmpl/edit.php @@ -14,7 +14,8 @@ JHtml::_('behavior.formvalidator'); JHtml::_('behavior.keepalive'); -JHtml::_('formbehavior.chosen', 'select', null, array('disable_search_threshold' => 0 )); +JHtml::_('formbehavior.chosen', '#jform_catid', null, array('disable_search_threshold' => 0 )); +JHtml::_('formbehavior.chosen', 'select'); $this->configFieldsets = array('editorConfig'); $this->hiddenFieldsets = array('basic-limited'); diff --git a/administrator/components/com_content/views/article/view.html.php b/administrator/components/com_content/views/article/view.html.php index ae87d3ae9b213..accbcc4ae9243 100644 --- a/administrator/components/com_content/views/article/view.html.php +++ b/administrator/components/com_content/views/article/view.html.php @@ -79,27 +79,18 @@ public function display($tpl = null) return false; } - if ($this->getLayout() == 'modal') + // If we are forcing a language in modal (used for associations). + if ($this->getLayout() === 'modal' && $forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) { - // If we are forcing a language in modal (used for associations). - if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) - { - // Set the language field to the forcedLanguage and disable changing it. - $this->form->setValue('language', null, $forcedLanguage); - $this->form->setFieldAttribute('language', 'readonly', 'true'); + // Set the language field to the forcedLanguage and disable changing it. + $this->form->setValue('language', null, $forcedLanguage); + $this->form->setFieldAttribute('language', 'readonly', 'true'); - // Only allow to select categories with All language or with the forced language. - $this->form->setFieldAttribute('catid', 'language', '*,' . $forcedLanguage); + // Only allow to select categories with All language or with the forced language. + $this->form->setFieldAttribute('catid', 'language', '*,' . $forcedLanguage); - // Only allow to select tags with All language or with the forced language. - $this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage); - } - } - // If not in associations modal, block the language change if in edit modal, language not All, associations enabled and some association. - elseif ($this->item->id && $this->form->getValue('language', null, '*') != '*' && JLanguageAssociations::isEnabled() - && count($this->item->associations) > 0) - { - $this->form->setFieldAttribute('language', 'readonly', 'true'); + // Only allow to select tags with All language or with the forced language. + $this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage); } $this->addToolbar(); diff --git a/administrator/components/com_content/views/featured/tmpl/default.php b/administrator/components/com_content/views/featured/tmpl/default.php index 173df3578e730..198844f1a5a8b 100644 --- a/administrator/components/com_content/views/featured/tmpl/default.php +++ b/administrator/components/com_content/views/featured/tmpl/default.php @@ -21,6 +21,7 @@ $listDirn = $this->escape($this->state->get('list.direction')); $canOrder = $user->authorise('core.edit.state', 'com_content.article'); $saveOrder = $listOrder == 'fp.ordering'; +$columns = 10; if ($saveOrder) { @@ -78,9 +79,11 @@ vote) : ?> + + @@ -92,7 +95,7 @@ - + pagination->getListFooter(); ?> diff --git a/administrator/components/com_contenthistory/helpers/contenthistory.php b/administrator/components/com_contenthistory/helpers/contenthistory.php index e35a8033d4591..166077b8d2842 100644 --- a/administrator/components/com_contenthistory/helpers/contenthistory.php +++ b/administrator/components/com_contenthistory/helpers/contenthistory.php @@ -120,7 +120,14 @@ public static function getFormValues($object, JTableContenttype $typesTable) if (isset($expandedObjectArray[$name])) { $optionFieldArray = $field->xpath('option[@value="' . $expandedObjectArray[$name] . '"]'); - $valueText = trim((string) $optionFieldArray[0]); + + $valueText = null; + + if (is_array($optionFieldArray) && count($optionFieldArray)) + { + $valueText = trim((string) $optionFieldArray[0]); + } + $values[(string) $field->attributes()->name] = JText::_($valueText); } } diff --git a/administrator/components/com_contenthistory/helpers/html/textdiff.php b/administrator/components/com_contenthistory/helpers/html/textdiff.php index be001bf16cf18..8e63c6de8d58c 100644 --- a/administrator/components/com_contenthistory/helpers/html/textdiff.php +++ b/administrator/components/com_contenthistory/helpers/html/textdiff.php @@ -41,9 +41,9 @@ public static function textdiff($containerId) // Depends on jQuery UI JHtml::_('bootstrap.framework'); - JHtml::_('script', 'com_contenthistory/diff_match_patch.js', false, true); - JHtml::_('script', 'com_contenthistory/jquery.pretty-text-diff.min.js', false, true); - JHtml::_('stylesheet', 'com_contenthistory/jquery.pretty-text-diff.css', false, true, false); + JHtml::_('script', 'com_contenthistory/diff_match_patch.js', array('version' => 'auto', 'relative' => true)); + JHtml::_('script', 'com_contenthistory/jquery.pretty-text-diff.min.js', array('version' => 'auto', 'relative' => true)); + JHtml::_('stylesheet', 'com_contenthistory/jquery.pretty-text-diff.css', array('version' => 'auto', 'relative' => true)); // Attach diff to document JFactory::getDocument()->addScriptDeclaration(" diff --git a/administrator/components/com_contenthistory/views/preview/view.html.php b/administrator/components/com_contenthistory/views/preview/view.html.php index 0e4af8b9badfd..6143e5af3f3e7 100644 --- a/administrator/components/com_contenthistory/views/preview/view.html.php +++ b/administrator/components/com_contenthistory/views/preview/view.html.php @@ -32,7 +32,16 @@ class ContenthistoryViewPreview extends JViewLegacy public function display($tpl = null) { $this->state = $this->get('State'); - $this->item = $this->get('Item'); + $this->item = $this->get('Item'); + + if (false === $this->item) + { + JFactory::getLanguage()->load('com_content', JPATH_SITE, null, true); + + JError::raiseError(404, JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND')); + + return false; + } // Check for errors. if (count($errors = $this->get('Errors'))) diff --git a/administrator/components/com_fields/access.xml b/administrator/components/com_fields/access.xml new file mode 100644 index 0000000000000..0a1ddce88d5ad --- /dev/null +++ b/administrator/components/com_fields/access.xml @@ -0,0 +1,19 @@ + + +
    + + + + + + +
    +
    + + + + + + +
    +
    diff --git a/administrator/components/com_fields/controller.php b/administrator/components/com_fields/controller.php new file mode 100644 index 0000000000000..4dd5041903367 --- /dev/null +++ b/administrator/components/com_fields/controller.php @@ -0,0 +1,98 @@ +context)) + { + $this->context = $this->input->get('context', 'com_content'); + } + } + + /** + * Typical view method for MVC based architecture + * + * This function is provide as a default implementation, in most cases + * you will need to override it in your own controllers. + * + * @param boolean $cachable If true, the view output will be cached + * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * + * @return JControllerLegacy A JControllerLegacy object to support chaining. + * + * @since __DEPLOY_VERSION__ + */ + public function display($cachable = false, $urlparams = false) + { + // Get the document object. + $document = JFactory::getDocument(); + + // Set the default view name and format from the Request. + $vName = $this->input->get('view', 'fields'); + $vFormat = $document->getType(); + $lName = $this->input->get('layout', 'default', 'string'); + $id = $this->input->getInt('id'); + + // Check for edit form. + if ($vName == 'field' && $lName == 'edit' && !$this->checkEditId('com_fields.edit.field', $id)) + { + // Somehow the person just went to the form - we don't allow that. + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setMessage($this->getError(), 'error'); + $this->setRedirect(JRoute::_('index.php?option=com_fields&view=fields&context=' . $this->context, false)); + + return false; + } + + // Get and render the view. + if ($view = $this->getView($vName, $vFormat)) + { + // Get the model for the view. + $model = $this->getModel( + $vName, 'FieldsModel', array( + 'name' => $vName . '.' . substr($this->context, 4) + ) + ); + + // Push the model into the view (as default). + $view->setModel($model, true); + $view->setLayout($lName); + + // Push document object into the view. + $view->document = $document; + + FieldsHelperInternal::addSubmenu($model->getState('filter.context')); + $view->display(); + } + + return $this; + } +} diff --git a/administrator/components/com_fields/controllers/field.php b/administrator/components/com_fields/controllers/field.php new file mode 100644 index 0000000000000..b65977738a089 --- /dev/null +++ b/administrator/components/com_fields/controllers/field.php @@ -0,0 +1,214 @@ +internalContext = $this->input->getCmd('context', 'com_content.article'); + $parts = FieldsHelper::extract($this->internalContext); + $this->component = $parts ? $parts[0] : null; + } + + /** + * Stores the form data into the user state. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function storeform() + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + $app = JFactory::getApplication(); + $data = $this->input->get($this->input->get('formcontrol', 'jform'), array(), 'array'); + + $parts = FieldsHelper::extract($this->input->getCmd('context')); + + if ($parts) + { + $app->setUserState($parts[0] . '.edit.' . $parts[1] . '.data', $data); + } + + if ($this->input->get('userstatevariable')) + { + $app->setUserState($this->input->get('userstatevariable'), $data); + } + + $app->redirect(base64_decode($this->input->get->getBase64('return'))); + $app->close(); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + protected function allowAdd($data = array()) + { + return JFactory::getUser()->authorise('core.create', $this->component); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'parent_id') + { + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + $user = JFactory::getUser(); + $userId = $user->get('id'); + + // Check general edit permission first. + if ($user->authorise('core.edit', $this->component)) + { + return true; + } + + // Check specific edit permission. + if ($user->authorise('core.edit', $this->internalContext . '.field.' . $recordId)) + { + return true; + } + + // Fallback on edit.own. + // First test if the permission is available. + if ($user->authorise('core.edit.own', $this->internalContext . '.field.' . $recordId) || $user->authorise('core.edit.own', $this->component)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_user_id']) ? $data['created_user_id'] : 0; + + if (empty($ownerId) && $recordId) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + + $ownerId = $record->created_user_id; + } + + // If the owner matches 'me' then do the test. + if ($ownerId == $userId) + { + return true; + } + } + + return false; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since __DEPLOY_VERSION__ + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Field'); + + // Preset the redirect + $this->setRedirect('index.php?option=com_fields&view=fields&context=' . $this->internalContext); + + return parent::batch($model); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since __DEPLOY_VERSION__ + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + return parent::getRedirectToItemAppend($recordId) . '&context=' . $this->internalContext; + } + + /** + * Gets the URL arguments to append to a list redirect. + * + * @return string The arguments to append to the redirect URL. + * + * @since __DEPLOY_VERSION__ + */ + protected function getRedirectToListAppend() + { + return parent::getRedirectToListAppend() . '&context=' . $this->internalContext; + } + + /** + * Function that allows child controller access to model data after the data has been saved. + * + * @param JModelLegacy $model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + $item = $model->getItem(); + + if (isset($item->params) && is_array($item->params)) + { + $registry = new Registry; + $registry->loadArray($item->params); + $item->params = (string) $registry; + } + + return; + } +} diff --git a/administrator/components/com_fields/controllers/fields.php b/administrator/components/com_fields/controllers/fields.php new file mode 100644 index 0000000000000..a7c7ca53d2880 --- /dev/null +++ b/administrator/components/com_fields/controllers/fields.php @@ -0,0 +1,93 @@ +setRedirect( + JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . + '&context=' . $this->input->getCmd('context', 'com_content.article'), false + ) + ); + + return $return; + } + + /** + * Removes an item + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function delete() + { + $return = parent::delete(); + + $this->setRedirect( + JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . + '&context=' . $this->input->getCmd('context', 'com_content.article'), false + ) + ); + + return $return; + } + + /** + * Method to publish a list of items + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function publish() + { + $return = parent::publish(); + + $this->setRedirect( + JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . + '&context=' . $this->input->getCmd('context', 'com_content.article'), false + ) + ); + + return $return; + } + + /** + * Proxy for getModel. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config The array of possible config values. Optional. + * + * @return JModel + * + * @since __DEPLOY_VERSION__ + */ + public function getModel($name = 'Field', $prefix = 'FieldsModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } +} diff --git a/administrator/components/com_fields/fields.php b/administrator/components/com_fields/fields.php new file mode 100644 index 0000000000000..13bb1ee6cc4a8 --- /dev/null +++ b/administrator/components/com_fields/fields.php @@ -0,0 +1,25 @@ +input; + +$parts = explode('.', $input->get('context')); +$component = $parts[0]; + +if (!JFactory::getUser()->authorise('core.manage', $component)) +{ + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); +} + +JLoader::import('components.com_fields.helpers.internal', JPATH_ADMINISTRATOR); + +$controller = JControllerLegacy::getInstance('Fields'); +$controller->execute($input->get('task')); +$controller->redirect(); diff --git a/administrator/components/com_fields/fields.xml b/administrator/components/com_fields/fields.xml new file mode 100644 index 0000000000000..3036577069a21 --- /dev/null +++ b/administrator/components/com_fields/fields.xml @@ -0,0 +1,38 @@ + + + com_fields + Joomla! Project + March 2016 + (C) 2005 - 2016 Open Source Matters. All rights reserved. + GNU General Public License version 2 or later; see LICENSE.txt + admin@joomla.org + www.joomla.org + __DEPLOY_VERSION__ + COM_FIELDS_XML_DESCRIPTION + + controller.php + fields.php + controllers + layouts + + + + access.xml + controller.php + fields.php + controllers + helpers + libraries + models + sql + tables + views + + + language/en-GB.com_fields.ini + language/en-GB.com_fields.sys.ini + + + + + diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php new file mode 100644 index 0000000000000..1246e4611e193 --- /dev/null +++ b/administrator/components/com_fields/helpers/fields.php @@ -0,0 +1,586 @@ + true) + ); + + self::$fieldsCache->setState('filter.published', 1); + self::$fieldsCache->setState('list.limit', 0); + } + + if (is_array($item)) + { + $item = (object) $item; + } + if (JLanguageMultilang::isEnabled() && isset($item->language) && $item->language !='*') + { + self::$fieldsCache->setState('filter.language', array('*', $item->language)); + } + self::$fieldsCache->setState('filter.context', $context); + + /* + * If item has assigned_cat_ids parameter display only fields which + * belong to the category + */ + if ($item && (isset($item->catid) || isset($item->fieldscatid))) + { + $assignedCatIds = isset($item->catid) ? $item->catid : $item->fieldscatid; + self::$fieldsCache->setState('filter.assigned_cat_ids', is_array($assignedCatIds) ? $assignedCatIds : explode(',', $assignedCatIds)); + } + + $fields = self::$fieldsCache->getItems(); + + if ($item && isset($item->id)) + { + if (self::$fieldCache === null) + { + self::$fieldCache = JModelLegacy::getInstance('Field', 'FieldsModel', array( + 'ignore_request' => true) + ); + } + + $new = array(); + + foreach ($fields as $key => $original) + { + /* + * Doing a clone, otherwise fields for different items will + * always reference to the same object + */ + $field = clone $original; + + if ($valuesToOverride && key_exists($field->alias, $valuesToOverride)) + { + $field->value = $valuesToOverride[$field->alias]; + } + elseif ($valuesToOverride && key_exists($field->id, $valuesToOverride)) + { + $field->value = $valuesToOverride[$field->id]; + } + else + { + $field->value = self::$fieldCache->getFieldValue($field->id, $field->context, $item->id); + } + + if (! $field->value) + { + $field->value = $field->default_value; + } + + $field->rawvalue = $field->value; + + if ($prepareValue) + { + $value = null; + + /* + * On before field prepare + * Event allow plugins to modfify the output of the field before it is prepared + */ + $dispatcher = JEventDispatcher::getInstance(); + $dispatcher->trigger('onFieldBeforePrepare', array($context, $item, &$field)); + + // Prepare the value from the type layout + $value = self::render($context, 'field.prepare.' . $field->type, array('field' => $field)); + + // If the value is empty, render the base layout + if (! $value) + { + $value = self::render($context, 'field.prepare.base', array('field' => $field)); + } + + /* + * On after field render + * Event allow plugins to modfify the output of the prepared field + */ + $dispatcher->trigger('onFieldAfterPrepare', array($context, $item, $field, &$value)); + $field->value = $value; + } + + $new[$key] = $field; + } + + $fields = $new; + } + + return $fields; + } + + /** + * Renders the layout file and data on the context and does a fall back to + * Fields afterwards. + * + * @param string $context The context of the content passed to the helper + * @param string $layoutFile layoutFile + * @param array $displayData displayData + * + * @return NULL|string + * + * @since __DEPLOY_VERSION__ + */ + public static function render($context, $layoutFile, $displayData) + { + $value = null; + + /* + * Because the layout refreshes the paths before the render function is + * called, so there is no way to load the layout overrides in the order + * template -> context -> fields. + * If there is no override in the context then we need to call the + * layout from Fields. + */ + if ($parts = self::extract($context)) + { + // Trying to render the layout on the component fom the context + $value = JLayoutHelper::render($layoutFile, $displayData, null, array('component' => $parts[0], 'client' => 0)); + } + + if (!$value) + { + // Trying to render the layout on Fields itself + $value = JLayoutHelper::render($layoutFile, $displayData, null, array('component' => 'com_fields','client' => 0)); + } + + if (!$value) + { + // Trying to render the layout of the plugins + foreach (JFolder::listFolderTree(JPATH_PLUGINS . '/fields', '.', 1) as $folder) + { + $value = JLayoutHelper::render($layoutFile, $displayData, $folder['fullname'] . '/layouts'); + } + } + + return $value; + } + + /** + * PrepareForm + * + * @param string $context The context of the content passed to the helper + * @param JForm $form form + * @param object $data data. + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public static function prepareForm($context, JForm $form, $data) + { + // Extracting the component and section + $parts = self::extract($context); + + if (! $parts) + { + return true; + } + + // When no fields available return here + $fields = self::getFields($parts[0] . '.' . $parts[1], new JObject); + + if (! $fields) + { + return true; + } + + $component = $parts[0]; + $section = $parts[1]; + + $assignedCatids = isset($data->catid) ? $data->catid : (isset($data->fieldscatid) ? $data->fieldscatid : null); + + if (!$assignedCatids && $form->getField('catid')) + { + // Choose the first category available + $xml = new DOMDocument; + $xml->loadHTML($form->getField('catid')->__get('input')); + $options = $xml->getElementsByTagName('option'); + + if ($firstChoice = $options->item(0)) + { + $assignedCatids = $firstChoice->getAttribute('value'); + $data->fieldscatid = $assignedCatids; + } + } + + /* + * If there is a catid field we need to reload the page when the catid + * is changed + */ + if ($form->getField('catid') && $parts[0] != 'com_fields') + { + // The uri to submit to + $uri = clone JUri::getInstance('index.php'); + + /* + * Removing the catid parameter from the actual url and set it as + * return + */ + $returnUri = clone JUri::getInstance(); + $returnUri->setVar('catid', null); + $uri->setVar('return', base64_encode($returnUri->toString())); + + // Setting the options + $uri->setVar('option', 'com_fields'); + $uri->setVar('task', 'field.storeform'); + $uri->setVar('context', $parts[0] . '.' . $parts[1]); + $uri->setVar('formcontrol', $form->getFormControl()); + $uri->setVar('view', null); + $uri->setVar('layout', null); + + /* + * Setting the onchange event to reload the page when the category + * has changed + */ + $form->setFieldAttribute('catid', 'onchange', "categoryHasChanged(this);"); + JFactory::getDocument()->addScriptDeclaration( + "function categoryHasChanged(element){ + var cat = jQuery(element); + if (cat.val() == '" . $assignedCatids . "')return; + jQuery('input[name=task]').val('field.storeform'); + element.form.action='" . $uri . "'; + element.form.submit(); + } + jQuery( document ).ready(function() { + var formControl = '#" . $form->getFormControl() . "_catid'; + if (!jQuery(formControl).val() != '" . $assignedCatids . "'){jQuery(formControl).val('" . $assignedCatids . "');} + });"); + } + + // Getting the fields + $fields = self::getFields($parts[0] . '.' . $parts[1], $data); + + if (!$fields) + { + return true; + } + + FieldsHelperInternal::loadPlugins(); + + // Creating the dom + $xml = new DOMDocument('1.0', 'UTF-8'); + $fieldsNode = $xml->appendChild(new DOMElement('form'))->appendChild(new DOMElement('fields')); + $fieldsNode->setAttribute('name', 'params'); + + // Organizing the fields according to their category + $fieldsPerCategory = array( + 0 => array() + ); + + foreach ($fields as $field) + { + if (! key_exists($field->catid, $fieldsPerCategory)) + { + $fieldsPerCategory[$field->catid] = array(); + } + + $fieldsPerCategory[$field->catid][] = $field; + } + + // On the front, sometimes the admin fields path is not included + JFormHelper::addFieldPath(JPATH_ADMINISTRATOR . '/components/' . $component . '/models/fields'); + + // Looping trough the categories + foreach ($fieldsPerCategory as $catid => $catFields) + { + if (! $catFields) + { + continue; + } + + // Defining the field set + $fieldset = $fieldsNode->appendChild(new DOMElement('fieldset')); + $fieldset->setAttribute('name', 'fields-' . $catid); + $fieldset->setAttribute('addfieldpath', '/administrator/components/' . $component . '/models/fields'); + $fieldset->setAttribute('addrulepath', '/administrator/components/' . $component . '/models/rules'); + + $label = ''; + $description = ''; + + if ($catid > 0) + { + /* + * JCategories can't handle com_content with a section, going + * directly to the table + */ + $category = JTable::getInstance('Category'); + $category->load($catid); + + if ($category->id) + { + $label = $category->title; + $description = $category->description; + } + } + + if (! $label || !$description) + { + $lang = JFactory::getLanguage(); + + if (!$label) + { + $key = strtoupper($component . '_FIELDS_' . $section . '_LABEL'); + + if (!$lang->hasKey($key)) + { + $key = 'JGLOBAL_FIELDS'; + } + + $label = JText::_($key); + } + + if (!$description) + { + $key = strtoupper($component . '_FIELDS_' . $section . '_DESC'); + + if ($lang->hasKey($key)) + { + $description = JText::_($key); + } + } + } + + $fieldset->setAttribute('label', $label); + $fieldset->setAttribute('description', strip_tags($description)); + + // Looping trough the fields for that context + foreach ($catFields as $field) + { + // Creating the XML form data + $type = JFormHelper::loadFieldType($field->type); + + if (!$type) + { + continue; + } + + try + { + // Rendering the type + $node = $type->appendXMLFieldTag($field, $fieldset, $form); + + if (!FieldsHelperInternal::canEditFieldValue($field)) + { + $node->setAttribute('disabled', 'true'); + } + + /* + *If the field belongs to a assigned_cat_ids but the + * assigned_cat_ids in the data is not known, set the + * required + * flag to false on any circumstance + */ + if (! $assignedCatids && $field->assigned_cat_ids) + { + $node->setAttribute('required', 'false'); + } + } + catch (Exception $e) + { + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); + } + } + } + + // Loading the XML fields string into the form + $form->load($xml->saveXML()); + + $model = JModelLegacy::getInstance('Field', 'FieldsModel', array( + 'ignore_request' => true) + ); + + if ((!isset($data->id) || !$data->id) && JFactory::getApplication()->input->getCmd('controller') == 'config.display.modules' + && JFactory::getApplication()->isSite()) + { + // Modules on front end editing don't have data and an id set + $data->id = $input->getInt('id'); + } + + // Looping trough the fields again to set the value + if (isset($data->id) && $data->id) + { + foreach ($fields as $field) + { + $value = $model->getFieldValue($field->id, $field->context, $data->id); + + if ($value === null) + { + continue; + } + + // Setting the value on the field + $form->setValue($field->alias, 'params', $value); + } + } + + return true; + } + + /** + * Return a boolean if the actual logged in user can edit the given field value. + * + * @param stdClass $field The field + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public static function canEditFieldValue($field) + { + return JFactory::getUser()->authorise('core.edit.value', $field->context . '.field.' . (int) $field->id); + } + + /** + * Adds Count Items for Category Manager. + * + * @param stdClass[] &$items The field category objects + * + * @return stdClass[] + * + * @since __DEPLOY_VERSION__ + */ + public static function countItems(&$items) + { + $db = JFactory::getDbo(); + + foreach ($items as $item) + { + $item->count_trashed = 0; + $item->count_archived = 0; + $item->count_unpublished = 0; + $item->count_published = 0; + + $query = $db->getQuery(true); + $query->select('state, count(*) AS count') + ->from($db->quoteName('#__fields')) + ->where('catid = ' . (int) $item->id) + ->group('state'); + $db->setQuery($query); + + $fields = $db->loadObjectList(); + + foreach ($fields as $article) + { + if ($article->state == 1) + { + $item->count_published = $article->count; + } + + if ($article->state == 0) + { + $item->count_unpublished = $article->count; + } + + if ($article->state == 2) + { + $item->count_archived = $article->count; + } + + if ($article->state == -2) + { + $item->count_trashed = $article->count; + } + } + } + + return $items; + } + + /** + * Gets the fields system plugin extension id. + * + * @return int The fields system plugin extension id. + * + * @since __DEPLOY_VERSION__ + */ + public static function getFieldsPluginId() + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('extension_id')) + ->from($db->quoteName('#__extensions')) + ->where($db->quoteName('folder') . ' = ' . $db->quote('system')) + ->where($db->quoteName('element') . ' = ' . $db->quote('fields')); + $db->setQuery($query); + + try + { + $result = (int) $db->loadResult(); + } + catch (RuntimeException $e) + { + JError::raiseWarning(500, $e->getMessage()); + } + + return $result; + } +} diff --git a/administrator/components/com_fields/helpers/internal.php b/administrator/components/com_fields/helpers/internal.php new file mode 100644 index 0000000000000..bb54b686eea68 --- /dev/null +++ b/administrator/components/com_fields/helpers/internal.php @@ -0,0 +1,116 @@ +load($component, JPATH_BASE, null, false, true) + || $lang->load($component, JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component), null, false, true); + + call_user_func(array($cName, 'addSubmenu'), 'fields' . (isset($section) ? '.' . $section : '')); + } + } + } + } + + /** + * Return a boolean if the actual logged in user can edit the given field value. + * + * @param stdClass $field The field + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public static function canEditFieldValue($field) + { + return JFactory::getUser()->authorise('core.edit.value', $field->context . '.field.' . (int) $field->id); + } + + /** + * Loads the fields plugins. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public static function loadPlugins() + { + jimport('joomla.filesystem.folder'); + + foreach (JFolder::listFolderTree(JPATH_PLUGINS . '/fields', '.', 1) as $folder) + { + if (!JPluginHelper::isEnabled('fields', $folder['name'])) + { + continue; + } + + JFactory::getLanguage()->load('plg_fields_' . strtolower($folder['name']), JPATH_ADMINISTRATOR); + JFactory::getLanguage()->load('plg_fields_' . strtolower($folder['name']), $folder['fullname']); + JFormHelper::addFieldPath($folder['fullname'] . '/fields'); + } + } +} diff --git a/administrator/components/com_fields/models/field.php b/administrator/components/com_fields/models/field.php new file mode 100644 index 0000000000000..237de3710615e --- /dev/null +++ b/administrator/components/com_fields/models/field.php @@ -0,0 +1,817 @@ +typeAlias = JFactory::getApplication()->input->getCmd('context', 'com_content.article') . '.field'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission for the component. + * + * @since __DEPLOY_VERSION__ + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->state != - 2) + { + return; + } + + return JFactory::getUser()->authorise('core.delete', $record->context . '.field.' . (int) $record->id); + } + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission for the component. + * + * @since __DEPLOY_VERSION__ + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + + // Check for existing field. + if (!empty($record->id)) + { + return $user->authorise('core.edit.state', $record->context . '.field.' . (int) $record->id); + } + else + { + return $user->authorise('core.edit.state', $record->context); + } + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success, False on error. + * + * @since __DEPLOY_VERSION__ + */ + public function save($data) + { + $field = null; + + if (isset($data['id']) && $data['id']) + { + $field = $this->getItem($data['id']); + } + + if (! isset($data['assigned_cat_ids'])) + { + $data['assigned_cat_ids'] = array(); + } + else + { + $cats = (array) $data['assigned_cat_ids']; + + foreach ($cats as $key => $c) + { + if (empty($c)) + { + unset($cats[$key]); + } + } + + $data['assigned_cat_ids'] = $cats; + } + + if (!isset($data['label']) && isset($data['params']['label'])) + { + $data['label'] = $data['params']['label']; + + unset($data['params']['label']); + } + + // Alter the title for save as copy + $input = JFactory::getApplication()->input; + + if ($input->get('task') == 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['title'] == $origTable->title) + { + list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']); + $data['title'] = $title; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['state'] = 0; + } + + JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php'); + + // Cast catid to integer for comparison + $catid = (int) $data['catid']; + + // Check if New Category exists + if ($catid > 0) + { + $catid = CategoriesHelper::validateCategoryId($data['catid'], $data['context'] . '.fields'); + } + + // Save New Category + if ($catid === 0 && is_string($data['catid']) && $data['catid'] != '') + { + $table = array(); + $table['title'] = $data['catid']; + $table['parent_id'] = 1; + $table['extension'] = $data['context'] . '.fields'; + $table['language'] = $data['language']; + $table['published'] = 1; + + // Create new category and get catid back + $data['catid'] = CategoriesHelper::createCategory($table); + } + + if ($data['catid'] === '') + { + $data['catid'] = '0'; + } + + $success = parent::save($data); + + // If the options have changed delete the values + if ($success && $field && isset($data['fieldparams']['options']) && isset($field->fieldparams['options'])) + { + $oldParams = json_decode($field->fieldparams['options']); + $newParams = json_decode($data['fieldparams']['options']); + + if (is_object($oldParams) && is_object($newParams) && $oldParams->name != $newParams->name) + { + $query = $this->_db->getQuery(true); + $query->delete('#__fields_values')->where('field_id = ' . (int) $field->id) + ->where("value not in ('" . implode("','", $newParams->name) . "')"); + $this->_db->setQuery($query); + $this->_db->execute(); + } + } + + return $success; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since __DEPLOY_VERSION__ + */ + public function delete(&$pks) + { + $success = parent::delete($pks); + + if ($success) + { + $pks = (array) $pks; + $pks = ArrayHelper::toInteger($pks); + $pks = array_filter($pks); + + if (!empty($pks)) + { + $query = $this->getDbo()->getQuery(true); + + $query ->delete($query->qn('#__fields_values')) + ->where($query->qn('field_id') . ' IN(' . implode(',', $pks) . ')'); + + $this->getDbo()->setQuery($query)->execute(); + } + } + + return $success; + } + + /** + * Method to get a table object, load it if necessary. + * + * @param string $name The table name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $options Configuration array for model. Optional. + * + * @return JTable A JTable object + * + * @since __DEPLOY_VERSION__ + * @throws Exception + */ + public function getTable ($name = 'Field', $prefix = 'FieldsTable', $options = array()) + { + if (strpos(JPATH_COMPONENT, 'com_fields') === false) + { + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_fields/tables'); + } + + return JTable::getInstance($name, $prefix, $options); + } + + /** + * Stock method to auto-populate the model state. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function populateState() + { + $app = JFactory::getApplication('administrator'); + + // Load the User state. + $pk = $app->input->getInt('id'); + $this->setState($this->getName() . '.id', $pk); + + $context = $app->input->get('context', 'com_content.article'); + $this->setState('field.context', $context); + $parts = FieldsHelper::extract($context); + + // Extract the component name + $this->setState('field.component', $parts[0]); + + // Extract the optional section name + $this->setState('field.section', (count($parts) > 1) ? $parts[1] : null); + + // Load the parameters. + $params = JComponentHelper::getParams('com_fields'); + $this->setState('params', $params); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since __DEPLOY_VERSION__ + */ + public function getItem($pk = null) + { + $result = parent::getItem($pk); + + if ($result) + { + // Prime required properties. + if (empty($result->id)) + { + $result->context = JFactory::getApplication()->input->getCmd('context', $this->getState('field.context')); + } + + if (property_exists($result, 'fieldparams')) + { + $registry = new Registry; + $registry->loadString($result->fieldparams); + $result->fieldparams = $registry->toArray(); + } + + if ($result->assigned_cat_ids) + { + $result->assigned_cat_ids = explode(',', $result->assigned_cat_ids); + } + + // Convert the created and modified dates to local user time for + // display in the form. + $tz = new DateTimeZone(JFactory::getApplication()->get('offset')); + + if ((int) $result->created_time) + { + $date = new JDate($result->created_time); + $date->setTimezone($tz); + + $result->created_time = $date->toSql(true); + } + else + { + $result->created_time = null; + } + + if ((int) $result->modified_time) + { + $date = new JDate($result->modified_time); + $date->setTimezone($tz); + + $result->modified_time = $date->toSql(true); + } + else + { + $result->modified_time = null; + } + } + + return $result; + } + + /** + * Abstract method for getting the form from the model. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return mixed A JForm object on success, false on failure + * + * @since __DEPLOY_VERSION__ + */ + public function getForm($data = array(), $loadData = true) + { + $context = $this->getState('field.context'); + $jinput = JFactory::getApplication()->input; + + // A workaround to get the context into the model for save requests. + if (empty($context) && isset($data['context'])) + { + $context = $data['context']; + $parts = explode('.', $context); + + $this->setState('field.context', $context); + $this->setState('field.component', $parts[0]); + $this->setState('field.section', isset($parts[1]) ? $parts[1] : ''); + } + + // Get the form. + $form = $this->loadForm( + 'com_fields.field' . $context, 'field', + array( + 'control' => 'jform', + 'load_data' => $loadData, + ) + ); + + if (empty($form)) + { + return false; + } + + // Modify the form based on Edit State access controls. + if (empty($data['context'])) + { + $data['context'] = $context; + } + + if (isset($data['type'])) + { + $parts = explode('.', $jinput->getCmd('context', $this->getState('field.context'))); + $component = $parts[0]; + $this->loadTypeForms($form, $data['type'], $component); + } + + $fieldId = $jinput->get('id'); + $parts = explode('.', $context); + $assetKey = $fieldId ? $context . '.field.' . $fieldId : $parts[0]; + + if (!JFactory::getUser()->authorise('core.edit.state', $assetKey)) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('state', 'disabled', 'true'); + + // Disable fields while saving. The controller has already verified this is a record you can edit. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('state', 'filter', 'unset'); + } + + return $form; + } + + /** + * A protected method to get a set of ordering conditions. + * + * @param JTable $table A JTable object. + * + * @return array An array of conditions to add to ordering queries. + * + * @since __DEPLOY_VERSION__ + */ + protected function getReorderConditions($table) + { + return 'context = ' . $this->_db->quote($table->context); + } + + /** + * Method to get the data that should be injected in the form. + * + * @return array The default data is an empty array. + * + * @since __DEPLOY_VERSION__ + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $app = JFactory::getApplication(); + $data = $app->getUserState('com_fields.edit.field.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + + // Pre-select some filters (Status, Language, Access) in edit form + // if those have been selected in Category Manager + if (!$data->id) + { + // Check for which context the Category Manager is used and + // get selected fields + $context = substr($app->getUserState('com_fields.fields.filter.context'), 4); + $component = FieldsHelper::extract($context); + $component = $component ? $component[0] : null; + + $filters = (array) $app->getUserState('com_fields.fields.' . $component . '.filter'); + + $data->set('published', $app->input->getInt('published', (! empty($filters['published']) ? $filters['published'] : null))); + $data->set('language', $app->input->getString('language', (! empty($filters['language']) ? $filters['language'] : null))); + $data->set( + 'access', + $app->input->getInt('access', (! empty($filters['access']) ? $filters['access'] : JFactory::getConfig()->get('access'))) + ); + + // Set the type if available from the request + $data->set('type', $app->input->getWord('type', $data->get('type'))); + } + + if ($data->label && !isset($data->params['label'])) + { + $data->params['label'] = $data->label; + } + } + + $this->preprocessData('com_fields.field', $data); + + return $data; + } + + /** + * Method to allow derived classes to preprocess the form. + * + * @param JForm $form A JForm object. + * @param mixed $data The data expected for the form. + * @param string $group The name of the plugin group to import (defaults to "content"). + * + * @return void + * + * @see JFormField + * @since __DEPLOY_VERSION__ + * @throws Exception if there is an error in the form event. + */ + protected function preprocessForm(JForm $form, $data, $group = 'content') + { + $parts = FieldsHelper::extract(JFactory::getApplication()->input->getCmd('context', $this->getState('field.context'))); + + if ($parts) + { + $component = $parts[0]; + + $dataObject = $data; + + if (is_array($dataObject)) + { + $dataObject = (object) $dataObject; + } + + if (isset($dataObject->type)) + { + $this->loadTypeForms($form, $dataObject->type, $component); + + $form->setFieldAttribute('type', 'component', $component); + + // Not alowed to change the type of an existing record + if ($dataObject->id) + { + $form->setFieldAttribute('type', 'readonly', 'true'); + } + } + + // Setting the context for the category field + $cat = JCategories::getInstance(str_replace('com_', '', $component)); + + if ($cat && $cat->get('root')->hasChildren()) + { + $form->setFieldAttribute('assigned_cat_ids', 'extension', $component); + } + else + { + $form->removeField('assigned_cat_ids'); + } + + $form->setFieldAttribute('type', 'component', $component); + $form->setFieldAttribute('catid', 'extension', $component . '.' . $parts[1] . '.fields'); + } + + // Trigger the default form events. + parent::preprocessForm($form, $data, $group); + } + + /** + * Returning the value for the given field id, context and item id. + * + * @param string $fieldId The field ID. + * @param string $context The context. + * @param string $itemId The ID of the item. + * + * @return NULL|string + * + * @since __DEPLOY_VERSION__ + */ + public function getFieldValue($fieldId, $context, $itemId) + { + $key = md5($fieldId . $context . $itemId); + + if (!key_exists($key, $this->valueCache)) + { + $this->valueCache[$key] = null; + + $query = $this->getDbo()->getQuery(true); + + $query->select($query->qn('value')) + ->from($query->qn('#__fields_values')) + ->where($query->qn('field_id') . ' = ' . (int) $fieldId) + ->where($query->qn('context') . ' = ' . $query->q($context)) + ->where($query->qn('item_id') . ' = ' . $query->q($itemId)); + + $rows = $this->getDbo()->setQuery($query)->loadObjectList(); + + if (count($rows) == 1) + { + $this->valueCache[$key] = array_shift($rows)->value; + } + elseif (count($rows) > 1) + { + $data = array(); + + foreach ($rows as $row) + { + $data[] = $row->value; + } + + $this->valueCache[$key] = $data; + } + } + + return $this->valueCache[$key]; + } + + /** + * Setting the value for the gven field id, context and item id. + * + * @param string $fieldId The field ID. + * @param string $context The context. + * @param string $itemId The ID of the item. + * @param string $value The value. + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function setFieldValue($fieldId, $context, $itemId, $value) + { + $field = $this->getItem($fieldId); + $params = $field->params; + + if (is_array($params)) + { + $params = new Registry($params); + } + + // Don't save the value when the field is disabled or the user is + // not authorized to change it + if (!$field || $params->get('disabled', 0) || ! FieldsHelperInternal::canEditFieldValue($field)) + { + return false; + } + + $needsDelete = false; + $needsInsert = false; + $needsUpdate = false; + + if ($field->default_value == $value) + { + $needsDelete = true; + } + else + { + $oldValue = $this->getFieldValue($fieldId, $context, $itemId); + $value = (array) $value; + + if ($oldValue === null) + { + // No records available, doing normal insert + $needsInsert = true; + } + elseif (count($value) == 1 && count((array) $oldValue) == 1) + { + // Only a single row value update can be done + $needsUpdate = true; + } + else + { + // Multiple values, we need to purge the data and do a new + // insert + $needsDelete = true; + $needsInsert = true; + } + } + + if ($needsDelete) + { + // Deleting the existing record as it is a reset + $query = $this->getDbo()->getQuery(true); + + $query ->delete($query->qn('#__fields_values')) + ->where($query->qn('field_id') . ' = ' . (int) $fieldId) + ->where($query->qn('context') . ' = ' . $query->q($context)) + ->where($query->qn('item_id') . ' = ' . $query->q($itemId)); + + $this->getDbo()->setQuery($query)->execute(); + } + + if ($needsInsert) + { + $newObj = new stdClass; + + $newObj->field_id = (int) $fieldId; + $newObj->context = $context; + $newObj->item_id = $itemId; + + foreach ($value as $v) + { + $newObj->value = $v; + + $this->getDbo()->insertObject('#__fields_values', $newObj); + } + } + + if ($needsUpdate) + { + $updateObj = new stdClass; + + $updateObj->field_id = (int) $fieldId; + $updateObj->context = $context; + $updateObj->item_id = $itemId; + $updateObj->value = reset($value); + + $this->getDbo()->updateObject('#__fields_values', $updateObj, array('field_id', 'context', 'item_id')); + } + + $this->valueCache = array(); + + return true; + } + + /** + * Cleaning up the values for the given item on the context. + * + * @param string $context The context. + * @param string $itemId The Item ID. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function cleanupValues($context, $itemId) + { + $query = $this->getDbo()->getQuery(true); + + $query->delete($query->qn('#__fields_values')) + ->where($query->qn('context') . ' = ' . $query->q($context)) + ->where($query->qn('item_id') . ' = ' . $query->q($itemId)); + + $this->getDbo()->setQuery($query)->execute(); + } + + /** + * Clean the cache + * + * @param string $group The cache group + * @param integer $client_id The ID of the client + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function cleanCache($group = null, $client_id = 0) + { + $context = JFactory::getApplication()->input->get('context'); + + switch ($context) + { + case 'com_content': + parent::cleanCache('com_content'); + parent::cleanCache('mod_articles_archive'); + parent::cleanCache('mod_articles_categories'); + parent::cleanCache('mod_articles_category'); + parent::cleanCache('mod_articles_latest'); + parent::cleanCache('mod_articles_news'); + parent::cleanCache('mod_articles_popular'); + break; + default: + parent::cleanCache($context); + break; + } + } + + /** + * Method to change the title & alias. + * + * @param integer $category_id The id of the category. + * @param string $alias The alias. + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + * @since __DEPLOY_VERSION__ + */ + protected function generateNewTitle($category_id, $alias, $title) + { + // Alter the title & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + $title = StringHelper::increment($title); + $alias = StringHelper::increment($alias, 'dash'); + } + + return array( + $title, + $alias, + ); + } + + /** + * Load the form declaration for the type. + * + * @param JForm &$form The form + * @param string $type The type + * @param string $component The component + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + private function loadTypeForms(JForm &$form, $type, $component) + { + FieldsHelperInternal::loadPlugins(); + + $type = JFormHelper::loadFieldType($type); + + // Load all children that's why we need to define the xpath + if (!($type instanceof JFormDomfieldinterface)) + { + return; + } + + $form->load($type->getFormParameters(), true, '/form/*'); + } +} diff --git a/administrator/components/com_fields/models/fields.php b/administrator/components/com_fields/models/fields.php new file mode 100644 index 0000000000000..1799e78fceb32 --- /dev/null +++ b/administrator/components/com_fields/models/fields.php @@ -0,0 +1,414 @@ +context; + + $context = $app->getUserStateFromRequest('com_fields.fields.filter.context', 'context', 'com_content.article', 'cmd'); + + $this->setState('filter.context', $context); + $parts = explode('.', $context); + + // Extract the component name + $this->setState('filter.component', $parts[0]); + + // Extract the optional section name + $this->setState('filter.section', (count($parts) > 1) ? $parts[1] : null); + + $search = $this->getUserStateFromRequest($context . '.search', 'filter_search'); + $this->setState('filter.search', $search); + + $level = $this->getUserStateFromRequest($context . '.filter.level', 'filter_level'); + $this->setState('filter.level', $level); + + $access = $this->getUserStateFromRequest($context . '.filter.access', 'filter_access'); + $this->setState('filter.access', $access); + + $published = $this->getUserStateFromRequest($context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id'); + $this->setState('filter.category_id', $categoryId); + + $language = $this->getUserStateFromRequest($context . '.filter.language', 'filter_language', ''); + $this->setState('filter.language', $language); + + // List state information. + parent::populateState('a.ordering', 'asc'); + + // Force a language + $forcedLanguage = $app->input->get('forcedLanguage'); + + if (! empty($forcedLanguage)) + { + $this->setState('filter.language', $forcedLanguage); + $this->setState('filter.forcedLanguage', $forcedLanguage); + } + } + + /** + * Method to get a store id based on the model configuration state. + * + * This is necessary because the model is used by the component and + * different modules that might need different sets of data or different + * ordering requirements. + * + * @param string $id An identifier string to generate the store id. + * + * @return string A store id. + * + * @since __DEPLOY_VERSION__ + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.context'); + $id .= ':' . serialize($this->getState('filter.assigned_cat_ids')); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.category_id'); + $id .= ':' . print_r($this->getState('filter.language'), true); + + return parent::getStoreId($id); + } + + /** + * Method to get a JDatabaseQuery object for retrieving the data set from a database. + * + * @return JDatabaseQuery A JDatabaseQuery object to retrieve the data set. + * + * @since __DEPLOY_VERSION__ + */ + protected function getListQuery() + { + // Create a new query object. + $db = $this->getDbo(); + $query = $db->getQuery(true); + $user = JFactory::getUser(); + + // Select the required fields from the table. + $query->select($this->getState('list.select', 'a.*')); + $query->from('#__fields AS a'); + + // Join over the language + $query->select('l.title AS language_title, l.image AS language_image') + ->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language'); + + // Join over the users for the checked out user. + $query->select('uc.name AS editor')->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); + + // Join over the asset groups. + $query->select('ag.title AS access_level')->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + + // Join over the users for the author. + $query->select('ua.name AS author_name')->join('LEFT', '#__users AS ua ON ua.id = a.created_user_id'); + + // Join over the categories. + $query->select('c.title as category_title, c.access, c.published')->join('LEFT', '#__categories AS c ON c.id = a.catid'); + + // Filter by context + if ($context = $this->getState('filter.context')) + { + $query->where('a.context = ' . $db->quote($context)); + } + + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + if (is_array($access)) + { + $access = ArrayHelper::toInteger($access); + $query->where('a.access in (' . implode(',', $access) . ')'); + } + else + { + $query->where('a.access = ' . (int) $access); + } + } + + if (($categories = $this->getState('filter.assigned_cat_ids')) && $context) + { + $categories = (array) $categories; + $condition = "a.assigned_cat_ids = '' or find_in_set(0, a.assigned_cat_ids) "; + $parts = FieldsHelper::extract($context); + + if ($parts) + { + // Get the category + $cat = JCategories::getInstance(str_replace('com_', '', $parts[0])); + + if ($cat) + { + foreach ($categories as $assignedCatIds) + { + // Check if we have the actual category + $parent = $cat->get($assignedCatIds); + + if ($parent) + { + $condition .= 'or find_in_set(' . (int) $parent->id . ',a.assigned_cat_ids) '; + + // Traverse the tree up to get all the fields which + // are attached to a parent + while ($parent->getParent() && $parent->getParent()->id != 'root') + { + $parent = $parent->getParent(); + $condition .= 'or find_in_set(' . (int) $parent->id . ',a.assigned_cat_ids) '; + } + } + } + } + } + + $query->where('(' . $condition . ')'); + } + + // Implement View Level Access + if (!$user->authorise('core.admin')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ') AND (c.id IS NULL OR c.access IN (' . $groups . '))'); + } + + // Filter by published state + $published = $this->getState('filter.published'); + + if (is_numeric($published)) + { + $query->where('a.state = ' . (int) $published); + + if (JFactory::getApplication()->isSite()) + { + $query->where('(c.id IS NULL OR c.published = ' . (int) $published . ')', 'AND'); + } + } + elseif ($published === '') + { + $query->where('a.state IN (0, 1)'); + + if (JFactory::getApplication()->isSite()) + { + $query->where('(c.id IS NULL OR c.published IN (0, 1)', 'AND'); + } + } + + // Filter by a single or group of categories. + $baselevel = 1; + $categoryId = $this->getState('filter.category_id'); + + if (is_numeric($categoryId)) + { + $cat_tbl = JTable::getInstance('Category', 'JTable'); + $cat_tbl->load($categoryId); + $rgt = $cat_tbl->rgt; + $lft = $cat_tbl->lft; + $baselevel = (int) $cat_tbl->level; + $query->where('c.lft >= ' . (int) $lft) + ->where('c.rgt <= ' . (int) $rgt); + } + elseif (is_array($categoryId)) + { + $categoryId = ArrayHelper::toInteger($categoryId); + $categoryId = implode(',', $categoryId); + $query->where('a.catid IN (' . $categoryId . ')'); + } + + // Filter by search in title + $search = $this->getState('filter.search'); + + if (! empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + elseif (stripos($search, 'author:') === 0) + { + $search = $db->quote('%' . $db->escape(substr($search, 7), true) . '%'); + $query->where('(ua.name LIKE ' . $search . ' OR ua.username LIKE ' . $search . ')'); + } + else + { + $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); + $query->where('(a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search . ' OR a.note LIKE ' . $search . ')'); + } + } + + // Filter on the language. + if ($language = $this->getState('filter.language')) + { + $language = (array) $language; + + foreach ($language as $key => $l) + { + $language[$key] = $db->quote($l); + } + + $query->where('a.language in (' . implode(',', $language) . ')'); + } + + // Add the list ordering clause + $listOrdering = $this->getState('list.ordering', 'a.ordering'); + $listDirn = $db->escape($this->getState('list.direction', 'ASC')); + + if ($listOrdering == 'a.access') + { + $query->order('a.access ' . $listDirn); + } + else + { + $query->order($db->escape($listOrdering) . ' ' . $listDirn); + } + + return $query; + } + + /** + * Gets an array of objects from the results of database query. + * + * @param string $query The query. + * @param integer $limitstart Offset. + * @param integer $limit The number of records. + * + * @return array An array of results. + * + * @since __DEPLOY_VERSION__ + * @throws RuntimeException + */ + protected function _getList($query, $limitstart = 0, $limit = 0) + { + $result = parent::_getList($query, $limitstart, $limit); + + if (is_array($result)) + { + foreach ($result as $field) + { + $field->fieldparams = new Registry($field->fieldparams); + $field->params = new Registry($field->params); + } + } + + return $result; + } + + /** + * Get the filter form + * + * @param array $data data + * @param boolean $loadData load current data + * + * @return JForm/false the JForm object or false + * + * @since __DEPLOY_VERSION__ + */ + public function getFilterForm($data = array(), $loadData = true) + { + $form = parent::getFilterForm($data, $loadData); + + if ($form) + { + $path = JPATH_ADMINISTRATOR . '/components/' . $this->getState('filter.component') . '/models/forms/filter_fields.xml'; + + if (file_exists($path)) + { + // Load all children that's why we need to define the xpath + if (!$form->loadFile($path, true, '/form/*')) + { + throw new Exception(JText::_('JERROR_LOADFILE_FAILED')); + } + } + + $context = JFactory::getApplication()->input->getCmd('context'); + + // If the context has multiple sections, this is the input field + // to display them + $form->setValue('section', 'custom', $context); + + $form->setFieldAttribute('category_id', 'extension', $context . '.fields', 'filter'); + } + + return $form; + } +} diff --git a/administrator/components/com_fields/models/fields/section.php b/administrator/components/com_fields/models/fields/section.php new file mode 100644 index 0000000000000..0ba0b68e0729a --- /dev/null +++ b/administrator/components/com_fields/models/fields/section.php @@ -0,0 +1,65 @@ +` tag for the form field object. + * @param mixed $value The form field value to validate. + * @param string $group The field name group control value. This acts as as an array container for the field. + * For example if the field has name="foo" and the group value is set to "bar" then the + * full field name would end up being "bar[foo]". + * + * @return boolean True on success. + * + * @since __DEPLOY_VERSION__ + */ + public function setup(SimpleXMLElement $element, $value, $group = null) + { + $return = parent::setup($element, $value, $group); + + // Onchange must always be the change context function + $this->onchange = 'fieldsChangeContext(jQuery(this).val());'; + + return $return; + } + + /** + * Method to get the field input markup for a generic list. + * Use the multiple attribute to enable multiselect. + * + * @return string The field input markup. + * + * @since __DEPLOY_VERSION__ + */ + protected function getInput () + { + // Add the change context function to the document + JFactory::getDocument()->addScriptDeclaration( + "function fieldsChangeContext(context) + { + var regex = new RegExp(\"([?;&])context[^&;]*[;&]?\"); + var url = window.location.href; + var query = url.replace(regex, \"$1\").replace(/&$/, ''); + window.location.href = (query.length > 2 ? query + \"&\" : \"?\") + (context ? \"context=\" + context : ''); + }"); + + return parent::getInput(); + } +} diff --git a/administrator/components/com_fields/models/fields/type.php b/administrator/components/com_fields/models/fields/type.php new file mode 100644 index 0000000000000..ff60851b3c356 --- /dev/null +++ b/administrator/components/com_fields/models/fields/type.php @@ -0,0 +1,191 @@ +` tag for the form field object. + * @param mixed $value The form field value to validate. + * @param string $group The field name group control value. This acts as as an array container for the field. + * For example if the field has name="foo" and the group value is set to "bar" then the + * full field name would end up being "bar[foo]". + * + * @return boolean True on success. + * + * @since __DEPLOY_VERSION__ + */ + public function setup(SimpleXMLElement $element, $value, $group = null) + { + $return = parent::setup($element, $value, $group); + + $this->onchange = "typeHasChanged(this);"; + + return $return; + } + + /** + * Method to get the field options. + * + * @return array The field option objects. + * + * @since __DEPLOY_VERSION__ + */ + protected function getOptions() + { + $options = parent::getOptions(); + + FieldsHelperInternal::loadPlugins(); + JFormHelper::addFieldPath(JPATH_LIBRARIES . '/cms/form/field'); + $paths = JFormHelper::addFieldPath(JPATH_ADMINISTRATOR . '/components/com_fields/models/fields'); + + $component = null; + + $parts = FieldsHelper::extract(JFactory::getApplication()->input->get('context')); + + if ($parts) + { + $component = $parts[0]; + $paths[] = JPATH_ADMINISTRATOR . '/components/' . $component . '/models/fields'; + JFactory::getLanguage()->load($component, JPATH_ADMINISTRATOR); + JFactory::getLanguage()->load($component, JPATH_ADMINISTRATOR . '/components/' . $component); + } + + foreach ($paths as $path) + { + if (!JFolder::exists($path)) + { + continue; + } + // Looping trough the types + foreach (JFolder::files($path, 'php', true, true) as $filePath) + { + $name = str_replace('.php', '', basename($filePath)); + + if (in_array(strtolower($name), self::$BLACKLIST)) + { + continue; + } + + $className = JFormHelper::loadFieldClass($name); + + if ($className === false) + { + continue; + } + + // Check if the field implements JFormField and JFormDomFieldInterface + if (!is_subclass_of($className, 'JFormField') || !is_subclass_of($className, 'JFormDomfieldinterface')) + { + continue; + } + + // Adjust the name + $name = strtolower(str_replace('JFormField', '', $className)); + + $label = StringHelper::ucfirst($name); + + if (JFactory::getLanguage()->hasKey('COM_FIELDS_TYPE_' . strtoupper($name))) + { + $label = 'COM_FIELDS_TYPE_' . strtoupper($name); + } + + if ($component && JFactory::getLanguage()->hasKey(strtoupper($component) . '_FIELDS_TYPE_' . strtoupper($name))) + { + $label = strtoupper($component) . '_FIELDS_TYPE_' . strtoupper($name); + } + + $options[] = JHtml::_('select.option', $name, JText::_($label)); + } + } + + // Sorting the fields based on the text which is displayed + usort( + $options, + function ($a, $b) + { + return strcmp($a->text, $b->text); + } + ); + + // Reload the page when the type changes + $uri = clone JUri::getInstance('index.php'); + + // Removing the catid parameter from the actual url and set it as + // return + $returnUri = clone JUri::getInstance(); + $returnUri->setVar('catid', null); + $uri->setVar('return', base64_encode($returnUri->toString())); + + // Setting the options + $uri->setVar('option', 'com_fields'); + $uri->setVar('task', 'field.storeform'); + $uri->setVar('context', 'com_fields.field'); + $uri->setVar('formcontrol', $this->form->getFormControl()); + $uri->setVar('userstatevariable', 'com_fields.edit.field.data'); + $uri->setVar('view', null); + $uri->setVar('layout', null); + + JFactory::getDocument()->addScriptDeclaration( + "function typeHasChanged(element){ + var cat = jQuery(element); + jQuery('input[name=task]').val('field.storeform'); + element.form.action='" . $uri . "'; + element.form.submit(); + }"); + + return $options; + } + + /** + * Parses the file with the given path. If it is a class starting with the + * name JFormField and implementing JFormDomfieldinterface, then the class name is returned. + * + * @param string $path The path. + * + * @return string|boolean + * + * @since __DEPLOY_VERSION__ + */ + private function getClassNameFromFile($path) + { + $tokens = token_get_all(JFile::read($path)); + $className = null; + + for ($i = 2; $i < count($tokens); $i ++) + { + if ($tokens[$i - 2][0] == T_CLASS && $tokens[$i - 1][0] == T_WHITESPACE && $tokens[$i][0] == T_STRING + && strpos($tokens[$i][1], 'JFormField') !== false) + { + $className = $tokens[$i][1]; + } + + if ($tokens[$i - 2][0] == T_IMPLEMENTS && $tokens[$i - 1][0] == T_WHITESPACE && $tokens[$i][1] == 'JFormDomfieldinterface') + { + return $className; + } + } + + return false; + } +} diff --git a/administrator/components/com_fields/models/forms/field.xml b/administrator/components/com_fields/models/forms/field.xml new file mode 100644 index 0000000000000..661ce4d8db896 --- /dev/null +++ b/administrator/components/com_fields/models/forms/field.xml @@ -0,0 +1,322 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + diff --git a/administrator/components/com_fields/models/forms/filter_fields.xml b/administrator/components/com_fields/models/forms/filter_fields.xml new file mode 100644 index 0000000000000..0a564a8ab5c08 --- /dev/null +++ b/administrator/components/com_fields/models/forms/filter_fields.xml @@ -0,0 +1,92 @@ + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/administrator/components/com_fields/tables/field.php b/administrator/components/com_fields/tables/field.php new file mode 100644 index 0000000000000..b3c7c80d7f073 --- /dev/null +++ b/administrator/components/com_fields/tables/field.php @@ -0,0 +1,251 @@ +setColumnAlias('published', 'state'); + } + + /** + * Method to bind an associative array or object to the JTable instance.This + * method only binds properties that are publicly accessible and optionally + * takes an array of properties to ignore when binding. + * + * @param mixed $src An associative array or object to bind to the JTable instance. + * @param mixed $ignore An optional array or space separated list of properties to ignore while binding. + * + * @return boolean True on success. + * + * @since __DEPLOY_VERSION__ + * @throws InvalidArgumentException + */ + public function bind($src, $ignore = '') + { + if (isset($src['params']) && is_array($src['params'])) + { + $registry = new Registry; + $registry->loadArray($src['params']); + $src['params'] = (string) $registry; + } + + if (isset($src['fieldparams']) && is_array($src['fieldparams'])) + { + $registry = new Registry; + $registry->loadArray($src['fieldparams']); + $src['fieldparams'] = (string) $registry; + } + + // Bind the rules. + if (isset($src['rules']) && is_array($src['rules'])) + { + $rules = new JAccessRules($src['rules']); + $this->setRules($rules); + } + + return parent::bind($src, $ignore); + } + + /** + * Method to perform sanity checks on the JTable instance properties to ensure + * they are safe to store in the database. Child classes should override this + * method to make sure the data they are storing in the database is safe and + * as expected before storage. + * + * @return boolean True if the instance is sane and able to be stored in the database. + * + * @link https://docs.joomla.org/JTable/check + * @since __DEPLOY_VERSION__ + */ + public function check() + { + // Check for valid name + if (trim($this->title) == '') + { + $this->setError(JText::_('COM_FIELDS_MUSTCONTAIN_A_TITLE_FIELD')); + + return false; + } + + if (empty($this->alias)) + { + $this->alias = $this->title; + } + + $this->alias = JApplicationHelper::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = Joomla\String\StringHelper::increment($alias, 'dash'); + } + + $this->alias = str_replace(',', '-', $this->alias); + + if (empty($this->type)) + { + $this->type = 'text'; + } + + if (is_array($this->assigned_cat_ids)) + { + $this->assigned_cat_ids = implode(',', $this->assigned_cat_ids); + } + + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified_time = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + if (! (int) $this->created_time) + { + $this->created_time = $date->toSql(); + } + + if (empty($this->created_user_id)) + { + $this->created_user_id = $user->get('id'); + } + } + + return true; + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form table_name.id + * where id is the value of the primary key of the table. + * + * @return string + * + * @since __DEPLOY_VERSION__ + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + + return $this->context . '.field.' . (int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. In + * tracking the assets a title is kept for each asset so that there is some + * context available in a unified access manager. Usually this would just + * return $this->title or $this->name or whatever is being used for the + * primary name of the row. If this method is not overridden, the asset name is used. + * + * @return string The string to use as the title in the asset table. + * + * @link https://docs.joomla.org/JTable/getAssetTitle + * @since __DEPLOY_VERSION__ + */ + protected function _getAssetTitle() + { + return $this->title; + } + + /** + * Method to get the parent asset under which to register this one. + * By default, all assets are registered to the ROOT node with ID, + * which will default to 1 if none exists. + * The extended class can define a table and id to lookup. If the + * asset does not exist it will be created. + * + * @param JTable $table A JTable object for the asset parent. + * @param integer $id Id to look up + * + * @return integer + * + * @since __DEPLOY_VERSION__ + */ + protected function _getAssetParentId(JTable $table = null, $id = null) + { + $parts = FieldsHelper::extract($this->context); + $component = $parts ? $parts[0] : null; + + if ($parts && $this->catid) + { + $assetId = $this->getAssetId($parts[0] . '.' . $parts[1] . '.fields.category.' . $this->catid); + + if ($assetId !== false) + { + return $assetId; + } + } + elseif ($component) + { + $assetId = $this->getAssetId($component); + + if ($assetId !== false) + { + return $assetId; + } + } + + return parent::_getAssetParentId($table, $id); + } + + /** + * Returns an asset id for the given name or false. + * + * @param string $name The asset name + * + * @return number|boolean + * + * @since __DEPLOY_VERSION__ + */ + private function getAssetId($name) + { + // Build the query to get the asset id for the name. + $query = $this->_db->getQuery(true) + ->select($this->_db->quoteName('id')) + ->from($this->_db->quoteName('#__assets')) + ->where($this->_db->quoteName('name') . ' = ' . $this->_db->quote($name)); + + // Get the asset id from the database. + $this->_db->setQuery($query); + + $assetId = null; + + if ($result = $this->_db->loadResult()) + { + $assetId = (int) $result; + + if ($assetId) + { + return $assetId; + } + } + + return false; + } +} diff --git a/administrator/components/com_fields/views/field/tmpl/edit.php b/administrator/components/com_fields/views/field/tmpl/edit.php new file mode 100644 index 0000000000000..32ccec3e22380 --- /dev/null +++ b/administrator/components/com_fields/views/field/tmpl/edit.php @@ -0,0 +1,106 @@ + 0 )); +JHtml::_('formbehavior.chosen', 'select'); + +$app = JFactory::getApplication(); +$input = $app->input; + +JFactory::getDocument()->addScriptDeclaration(' + Joomla.submitbutton = function(task) + { + if (task == "field.cancel" || document.formvalidator.isValid(document.getElementById("item-form"))) + { + Joomla.submitform(task, document.getElementById("item-form")); + } + }; + jQuery(document).ready(function() { + jQuery("#jform_title").data("dp-old-value", jQuery("#jform_title").val()); + jQuery("#jform_title").change(function(data, handler) { + if(jQuery("#jform_title").data("dp-old-value") == jQuery("#jform_label").val()) { + jQuery("#jform_label").val(jQuery("#jform_title").val()); + } + + jQuery("#jform_title").data("dp-old-value", jQuery("#jform_title").val()); + }); + }); +'); + +?> + +
    + +
    + 'general')); ?> + +
    +
    + form->renderField('type'); ?> + form->renderField('label'); ?> + form->renderField('description'); ?> + form->renderField('required'); ?> + form->renderField('default_value'); ?> + + form->getFieldsets('fieldparams') as $name => $fieldSet) : ?> + form->getFieldset($name) as $field) : ?> + renderField(); ?> + + + +
    +
    + set('fields', + array( + array( + 'published', + 'state', + 'enabled', + ), + 'catid', + 'assigned_cat_ids', + 'access', + 'language', + 'note', + ) + ); ?> + + set('fields', null); ?> +
    +
    + + +
    +
    + +
    +
    +
    +
    + + set('ignore_fieldsets', array('fieldparams')); ?> + + canDo->get('core.admin')) : ?> + + form->getInput('rules'); ?> + + + + form->getInput('context'); ?> + + +
    +
    diff --git a/administrator/components/com_fields/views/field/view.html.php b/administrator/components/com_fields/views/field/view.html.php new file mode 100644 index 0000000000000..3ab1fafa6cf41 --- /dev/null +++ b/administrator/components/com_fields/views/field/view.html.php @@ -0,0 +1,202 @@ +form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->state = $this->get('State'); + + $section = $this->state->get('field.section') ? $this->state->get('field.section') . '.' : ''; + $this->canDo = JHelperContent::getActions($this->state->get('field.component'), $section . 'field', $this->item->id); + + $input = JFactory::getApplication()->input; + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode("\n", $errors)); + + return false; + } + + $input->set('hidemainmenu', true); + + if ($this->getLayout() == 'modal') + { + $this->form->setFieldAttribute('language', 'readonly', 'true'); + $this->form->setFieldAttribute('parent_id', 'readonly', 'true'); + } + + $this->addToolbar(); + parent::display($tpl); + } + + /** + * Adds the toolbar. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function addToolbar() + { + $input = JFactory::getApplication()->input; + $context = $input->get('context'); + $user = JFactory::getUser(); + $userId = $user->get('id'); + + $isNew = ($this->item->id == 0); + $checkedOut = ! ($this->item->checked_out == 0 || $this->item->checked_out == $userId); + + // Check to see if the type exists + $ucmType = new JUcmType; + $this->typeId = $ucmType->getTypeId($context . '.field'); + + // Avoid nonsense situation. + if ($context == 'com_fields') + { + return; + } + + // The context can be in the form com_foo.section + $parts = explode('.', $context); + $component = $parts[0]; + $section = (count($parts) > 1) ? $parts[1] : null; + $componentParams = JComponentHelper::getParams($component); + + // Need to load the menu language file as mod_menu hasn't been loaded yet. + $lang = JFactory::getLanguage(); + $lang->load($component, JPATH_BASE, null, false, true) || + $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, true); + + // Load the field helper. + require_once JPATH_COMPONENT . '/helpers/fields.php'; + + // Get the results for each action. + $canDo = $this->canDo; + + // If a component fields title string is present, let's use it. + if ($lang->hasKey( + $component_title_key = $component . '_FIELDS_' . ($section ? $section : '') . '_FIELD_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE')) + { + $title = JText::_($component_title_key); + } + // Else if the component section string exits, let's use it + elseif ($lang->hasKey($component_section_key = $component . '_FIELDS_SECTION_' . ($section ? $section : ''))) + { + $title = JText::sprintf( + 'COM_FIELDS_VIEW_FIELD_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE', + $this->escape(JText::_($component_section_key)) + ); + } + // Else use the base title + else + { + $title = JText::_('COM_FIELDS_VIEW_FIELD_BASE_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE'); + } + + // Load specific component css + JHtml::_('stylesheet', $component . '/administrator/fields.css', array('version' => 'auto', 'relative' => true)); + + // Prepare the toolbar. + JToolbarHelper::title( + $title, + 'puzzle field-' . ($isNew ? 'add' : 'edit') . ' ' . substr($component, 4) . ($section ? "-$section" : '') . '-field-' . + ($isNew ? 'add' : 'edit') + ); + + // For new records, check the create permission. + if ($isNew) + { + JToolbarHelper::apply('field.apply'); + JToolbarHelper::save('field.save'); + JToolbarHelper::save2new('field.save2new'); + } + + // If not checked out, can save the item. + elseif (! $checkedOut && ($canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_user_id == $userId))) + { + JToolbarHelper::apply('field.apply'); + JToolbarHelper::save('field.save'); + + if ($canDo->get('core.create')) + { + JToolbarHelper::save2new('field.save2new'); + } + } + + // If an existing item, can save to a copy. + if (! $isNew && $canDo->get('core.create')) + { + JToolbarHelper::save2copy('field.save2copy'); + } + + if (empty($this->item->id)) + { + JToolbarHelper::cancel('field.cancel'); + } + else + { + JToolbarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE'); + } + + JToolbarHelper::divider(); + + // Compute the ref_key if it does exist in the component + if (! $lang->hasKey($ref_key = strtoupper($component . ($section ? "_$section" : '')) . '_FIELD_' . ($isNew ? 'ADD' : 'EDIT') . '_HELP_KEY')) + { + $ref_key = 'JHELP_COMPONENTS_' . strtoupper(substr($component, 4) . ($section ? "_$section" : '')) . '_FIELD_' . ($isNew ? 'ADD' : 'EDIT'); + } + + /* + * Get help for the field/section view for the component by + * -remotely searching in a language defined dedicated URL: + * *component*_HELP_URL + * -locally searching in a component help file if helpURL param exists + * in the component and is set to '' + * -remotely searching in a component URL if helpURL param exists in the + * component and is NOT set to '' + */ + if ($lang->hasKey($lang_help_url = strtoupper($component) . '_HELP_URL')) + { + $debug = $lang->setDebug(false); + $url = JText::_($lang_help_url); + $lang->setDebug($debug); + } + else + { + $url = null; + } + } +} diff --git a/administrator/components/com_fields/views/fields/tmpl/default.php b/administrator/components/com_fields/views/fields/tmpl/default.php new file mode 100644 index 0000000000000..b9113f3737482 --- /dev/null +++ b/administrator/components/com_fields/views/fields/tmpl/default.php @@ -0,0 +1,219 @@ +get('id'); +$context = $this->escape($this->state->get('filter.context')); +$listOrder = $this->escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); +$ordering = ($listOrder == 'a.ordering'); +$saveOrder = ($listOrder == 'a.ordering' && strtolower($listDirn) == 'asc'); + +if ($saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_fields&task=fields.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'fieldList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true); +} +?> + +
    +
    + sidebar; ?> +
    +
    +
    +
    + filterForm->getFieldsets('custom'); ?> + $fieldSet) : ?> + filterForm->getFieldset($name) as $field) : ?> + input; ?> + + +
      +
    + $this)); ?> + items)) : ?> +
    + +
    + + + + + + + + + + + + + + + + + + + + + + items as $i => $item) : ?> + + authorise('core.edit', $context . '.field.' . $item->id); ?> + authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; ?> + authorise('core.edit.own', $context . '.field.' . $item->id) && $item->created_user_id == $userId; ?> + authorise('core.edit.state', $context . '.field.' . $item->id) && $canCheckin; ?> + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + state->get('list.direction'), $this->state->get('list.ordering')); ?> + + +
    + pagination->getListFooter(); ?> +
    + + + + + + + + + + + + + + id); ?> + +
    + state, $i, 'fields.', $canChange, 'cb'); ?> + + + state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'fields'); ?> + state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'fields'); ?> + escape($item->title)); ?> + +
    +
    +
    + checked_out) : ?> + editor, $item->checked_out_time, 'fields.', $canCheckin); ?> + + + + escape($item->title); ?> + + escape($item->title); ?> + + + note)) : ?> + escape($item->alias)); ?> + + escape($item->alias), $this->escape($item->note)); ?> + + +
    + component)); ?> + + + assigned_cat_ids)); ?> + + + + + + + + get($cat); ?> + id == 'root') : ?> + + + title . ','; ?> + + + +
    +
    +
    + type); ?> + hasKey($label)) : ?> + type); ?> + + escape(JText::_($label)); ?> + + escape($item->category_title); ?> + + escape($item->access_level); ?> + + language == '*') : ?> + + + language_title ? JHtml::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, array('title' => $item->language_title), true) . ' ' . $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> + + + id; ?> +
    + + authorise('core.create', $this->component) + && $user->authorise('core.edit', $this->component) + && $user->authorise('core.edit.state', $this->component)) : ?> + JText::_('COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + + + + +
    +
    diff --git a/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php b/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php new file mode 100644 index 0000000000000..f54cf1e92e85c --- /dev/null +++ b/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php @@ -0,0 +1,35 @@ +state->get('filter.published'); +$context = $this->escape($this->state->get('filter.context')); +?> + +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +
    diff --git a/administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php b/administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php new file mode 100644 index 0000000000000..d7865e9ec4543 --- /dev/null +++ b/administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/administrator/components/com_fields/views/fields/view.html.php b/administrator/components/com_fields/views/fields/view.html.php new file mode 100644 index 0000000000000..68e5957b66930 --- /dev/null +++ b/administrator/components/com_fields/views/fields/view.html.php @@ -0,0 +1,232 @@ +state = $this->get('State'); + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->filterForm = $this->get('FilterForm'); + $this->activeFilters = $this->get('ActiveFilters'); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode("\n", $errors)); + + return false; + } + + // Display a warning if the fields system plugin is disabled + if (!JPluginHelper::isEnabled('system', 'fields')) + { + $link = JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . FieldsHelper::getFieldsPluginId()); + JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_FIELDS_SYSTEM_PLUGIN_NOT_ENABLED', $link), 'warning'); + } + + $this->context = JFactory::getApplication()->input->getCmd('context'); + $parts = FieldsHelper::extract($this->context); + + if (!$parts) + { + JError::raiseError(500, 'Invalid context!!'); + + return; + } + + $this->component = $parts[0]; + $this->section = $parts[1]; + + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + parent::display($tpl); + } + + /** + * Adds the toolbar. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function addToolbar() + { + $fieldId = $this->state->get('filter.field_id'); + $user = JFactory::getUser(); + $component = $this->component; + $section = $this->section; + $canDo = new JObject; + + if (JFile::exists(JPATH_ADMINISTRATOR . '/components/' . $component . '/access.xml')) + { + $canDo = JHelperContent::getActions($component, 'field', $fieldId); + } + + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + + // Avoid nonsense situation. + if ($component == 'com_fields') + { + return; + } + + // Need to load the menu language file as mod_menu hasn't been loaded yet. + $lang = JFactory::getLanguage(); + $lang->load($component, JPATH_BASE, null, false, true) || + $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, true); + + // If a component categories title string is present, let's use it. + if ($lang->hasKey($component_title_key = strtoupper($component . '_FIELDS_' . ($section ? $section : '')) . '_FIELDS_TITLE')) + { + $title = JText::_($component_title_key); + } + elseif ($lang->hasKey($component_section_key = strtoupper($component . '_FIELDS_SECTION_' . ($section ? $section : '')))) + { + // Else if the component section string exits, let's use it + $title = JText::sprintf('COM_FIELDS_VIEW_FIELDS_TITLE', $this->escape(JText::_($component_section_key))); + } + else + { + $title = JText::_('COM_FIELDS_VIEW_FIELDS_BASE_TITLE'); + } + + // Load specific component css + JHtml::_('stylesheet', $component . '/administrator/fields.css', array('version' => 'auto', 'relative' => true)); + + // Prepare the toolbar. + JToolbarHelper::title($title, 'puzzle fields ' . substr($component, 4) . ($section ? "-$section" : '') . '-fields'); + + if ($canDo->get('core.create')) + { + JToolbarHelper::addNew('field.add'); + } + + if ($canDo->get('core.edit') || $canDo->get('core.edit.own')) + { + JToolbarHelper::editList('field.edit'); + } + + if ($canDo->get('core.edit.state')) + { + JToolbarHelper::publish('fields.publish', 'JTOOLBAR_PUBLISH', true); + JToolbarHelper::unpublish('fields.unpublish', 'JTOOLBAR_UNPUBLISH', true); + JToolbarHelper::archiveList('fields.archive'); + } + + if (JFactory::getUser()->authorise('core.admin')) + { + JToolbarHelper::checkin('fields.checkin'); + } + + // Add a batch button + if ($canDo->get('core.create') && $canDo->get('core.edit') && $canDo->get('core.edit.state')) + { + $title = JText::_('JTOOLBAR_BATCH'); + + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + + $dhtml = $layout->render( + array( + 'title' => $title, + ) + ); + + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($canDo->get('core.admin') || $canDo->get('core.options')) + { + JToolbarHelper::preferences($component); + } + + if ($this->state->get('filter.published') == - 2 && $canDo->get('core.delete', $component)) + { + JToolbarHelper::deleteList('', 'fields.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($canDo->get('core.edit.state')) + { + JToolbarHelper::trash('fields.trash'); + } + + // Compute the ref_key if it does exist in the component + if (!$lang->hasKey($ref_key = strtoupper($component . ($section ? "_$section" : '')) . '_FIELDS_HELP_KEY')) + { + $ref_key = 'JHELP_COMPONENTS_' . strtoupper(substr($component, 4) . ($section ? "_$section" : '')) . '_FIELDS'; + } + + /* + * Get help for the fields view for the component by + * -remotely searching in a language defined dedicated URL: + * *component*_HELP_URL + * -locally searching in a component help file if helpURL param exists + * in the component and is set to '' + * -remotely searching in a component URL if helpURL param exists in the + * component and is NOT set to '' + */ + if ($lang->hasKey($lang_help_url = strtoupper($component) . '_HELP_URL')) + { + $debug = $lang->setDebug(false); + $url = JText::_($lang_help_url); + $lang->setDebug($debug); + } + else + { + $url = null; + } + + } + + /** + * Returns the sort fields. + * + * @return array + * + * @since __DEPLOY_VERSION__ + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.title' => JText::_('JGLOBAL_TITLE'), + 'a.type' => JText::_('COM_FIELDS_FIELD_TYPE_LABEL'), + 'a.access' => JText::_('JGRID_HEADING_ACCESS'), + 'language' => JText::_('JGRID_HEADING_LANGUAGE'), + 'a.id' => JText::_('JGRID_HEADING_ID'), + ); + } +} diff --git a/administrator/components/com_finder/controllers/indexer.json.php b/administrator/components/com_finder/controllers/indexer.json.php index c233fcc35dccd..0a1a31398414f 100644 --- a/administrator/components/com_finder/controllers/indexer.json.php +++ b/administrator/components/com_finder/controllers/indexer.json.php @@ -186,6 +186,9 @@ public function batch() // Swap the applications back. $app = $admin; + // Log batch completion and memory high-water mark. + JLog::add('Batch completed, peak memory usage: ' . number_format(memory_get_peak_usage(true)) . ' bytes', JLog::INFO); + // Send the response. $this->sendResponse($state); } diff --git a/administrator/components/com_finder/models/fields/branches.php b/administrator/components/com_finder/models/fields/branches.php index ae6f63e2d4ea0..1451cc358403e 100644 --- a/administrator/components/com_finder/models/fields/branches.php +++ b/administrator/components/com_finder/models/fields/branches.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die(); -JFormHelper::loadFieldClass('list'); - /** * Search Filter field for the Finder package. * * @since 3.5 */ -class JFormFieldBranches extends JFormFieldList +class JFormFieldBranches extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_finder/models/fields/contenttypes.php b/administrator/components/com_finder/models/fields/contenttypes.php index a14ebf5afc5b2..a8c37a2ea9e11 100644 --- a/administrator/components/com_finder/models/fields/contenttypes.php +++ b/administrator/components/com_finder/models/fields/contenttypes.php @@ -9,8 +9,6 @@ defined('JPATH_BASE') or die(); -JFormHelper::loadFieldClass('list'); - use Joomla\Utilities\ArrayHelper; JLoader::register('FinderHelperLanguage', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/language.php'); @@ -20,7 +18,7 @@ * * @since 3.6.0 */ -class JFormFieldContentTypes extends JFormFieldList +class JFormFieldContentTypes extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_finder/models/fields/directories.php b/administrator/components/com_finder/models/fields/directories.php index a65657b02d3f9..c9905536e98d5 100644 --- a/administrator/components/com_finder/models/fields/directories.php +++ b/administrator/components/com_finder/models/fields/directories.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - // Load the base adapter. JLoader::register('FinderIndexerAdapter', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/adapter.php'); @@ -19,7 +17,7 @@ * * @since 2.5 */ -class JFormFieldDirectories extends JFormFieldList +class JFormFieldDirectories extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_finder/models/fields/searchfilter.php b/administrator/components/com_finder/models/fields/searchfilter.php index 4e5a034213606..e56213efe101b 100644 --- a/administrator/components/com_finder/models/fields/searchfilter.php +++ b/administrator/components/com_finder/models/fields/searchfilter.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die(); -JFormHelper::loadFieldClass('list'); - /** * Search Filter field for the Finder package. * * @since 2.5 */ -class JFormFieldSearchFilter extends JFormFieldList +class JFormFieldSearchFilter extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_finder/views/indexer/tmpl/default.php b/administrator/components/com_finder/views/indexer/tmpl/default.php index f69c07bb19f1a..417cb6e7788b3 100644 --- a/administrator/components/com_finder/views/indexer/tmpl/default.php +++ b/administrator/components/com_finder/views/indexer/tmpl/default.php @@ -12,7 +12,7 @@ JHtml::_('behavior.keepalive'); JHtml::_('behavior.core'); JHtml::_('jquery.framework'); -JHtml::_('script', 'com_finder/indexer.js', false, true); +JHtml::_('script', 'com_finder/indexer.js', array('version' => 'auto', 'relative' => true)); JFactory::getDocument()->addScriptDeclaration('var msg = "' . JText::_('COM_FINDER_INDEXER_MESSAGE_COMPLETE') . '";'); ?> diff --git a/administrator/components/com_installer/models/fields/extensionstatus.php b/administrator/components/com_installer/models/fields/extensionstatus.php index 1a6ef20416835..425367cee0dab 100644 --- a/administrator/components/com_installer/models/fields/extensionstatus.php +++ b/administrator/components/com_installer/models/fields/extensionstatus.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldExtensionStatus extends JFormFieldList +class JFormFieldExtensionStatus extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_installer/models/fields/folder.php b/administrator/components/com_installer/models/fields/folder.php index 08dbfd35fd24a..48878e49d921c 100644 --- a/administrator/components/com_installer/models/fields/folder.php +++ b/administrator/components/com_installer/models/fields/folder.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldFolder extends JFormFieldList +class JFormFieldFolder extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_installer/models/fields/location.php b/administrator/components/com_installer/models/fields/location.php index a73177b668000..25c541add72f0 100644 --- a/administrator/components/com_installer/models/fields/location.php +++ b/administrator/components/com_installer/models/fields/location.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldLocation extends JFormFieldList +class JFormFieldLocation extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_installer/models/fields/type.php b/administrator/components/com_installer/models/fields/type.php index e3f01db143824..456f47c3f7c3e 100644 --- a/administrator/components/com_installer/models/fields/type.php +++ b/administrator/components/com_installer/models/fields/type.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldType extends JFormFieldList +class JFormFieldType extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_joomlaupdate/controllers/update.php b/administrator/components/com_joomlaupdate/controllers/update.php index e7c25d324e608..e00e29d5bce27 100644 --- a/administrator/components/com_joomlaupdate/controllers/update.php +++ b/administrator/components/com_joomlaupdate/controllers/update.php @@ -16,20 +16,34 @@ */ class JoomlaupdateControllerUpdate extends JControllerLegacy { + /** + * Performs the download of the reinstall package + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function reinstall() + { + $this->download(true); + } /** * Performs the download of the update package * + * @param boolean $reinstall If true, we check if there is a reinstall URL + * * @return void * * @since 2.5.4 */ - public function download() + public function download($reinstall = false) { JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; + $options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}'; $options['text_file'] = 'joomla_update.php'; JLog::addLogger($options, JLog::INFO, array('Update', 'databasequery', 'jerror')); + $user = JFactory::getUser(); JLog::add(JText::sprintf('COM_JOOMLAUPDATE_UPDATE_LOG_START', $user->id, $user->name, JVERSION), JLog::INFO, 'Update'); @@ -37,9 +51,9 @@ public function download() /** @var JoomlaupdateModelDefault $model */ $model = $this->getModel('Default'); - $file = $model->download(); + $file = $model->download($reinstall); - $message = null; + $message = null; $messageType = null; if ($file) diff --git a/administrator/components/com_joomlaupdate/models/default.php b/administrator/components/com_joomlaupdate/models/default.php index af91f0ee03fef..5ee21819ecd60 100644 --- a/administrator/components/com_joomlaupdate/models/default.php +++ b/administrator/components/com_joomlaupdate/models/default.php @@ -243,15 +243,39 @@ public function purge() /** * Downloads the update package to the site. * + * @param boolean $reinstall If true, we check if there is a reinstall URL + * * @return bool|string False on failure, basename of the file in any other case. * * @since 2.5.4 */ - public function download() + public function download($reinstall = false) { $updateInfo = $this->getUpdateInformation(); $packageURL = $updateInfo['object']->downloadurl->_data; - $basename = basename($packageURL); + + // Check if there is a special reinstall URL + if ($reinstall == true && empty($updateInfo['object']->reinstallurl->_data)) + { + $packageURL = $updateInfo['object']->reinstallurl->_data; + } + + $headers = get_headers($packageURL, 1); + + // Follow the Location headers until the actual download URL is known + while (isset($headers['Location'])) + { + $packageURL = $headers['Location']; + $headers = get_headers($packageURL, 1); + } + + // Remove protocol, path and query string from URL + $basename = basename($packageURL); + + if (strpos($basename, '?') !== false) + { + $basename = substr($basename, 0, strpos($basename, '?')); + } // Find the path to the temp directory and the local package. $config = JFactory::getConfig(); diff --git a/administrator/components/com_joomlaupdate/views/default/tmpl/default.php b/administrator/components/com_joomlaupdate/views/default/tmpl/default.php index 5ab8c9ed68536..f73631202d7f9 100644 --- a/administrator/components/com_joomlaupdate/views/default/tmpl/default.php +++ b/administrator/components/com_joomlaupdate/views/default/tmpl/default.php @@ -14,7 +14,7 @@ JHtml::_('jquery.framework'); JHtml::_('bootstrap.tooltip'); JHtml::_('formbehavior.chosen', 'select'); -JHtml::script('com_joomlaupdate/default.js', false, true, false); +JHtml::_('script', 'com_joomlaupdate/default.js', array('version' => 'auto', 'relative' => true)); JFactory::getDocument()->addScriptDeclaration(" jQuery(document).ready(function($) { @@ -32,12 +32,13 @@ ?>
    -
    - showUploadAndUpdate) : ?> - 'online-update')); ?> - - + showUploadAndUpdate) : ?> + 'online-update')); ?> + + + + selfUpdate) : ?> @@ -56,9 +57,7 @@ - -
    diff --git a/administrator/components/com_joomlaupdate/views/default/tmpl/default_reinstall.php b/administrator/components/com_joomlaupdate/views/default/tmpl/default_reinstall.php index 20a7cde85c92a..e6ad6f9d7c4c3 100644 --- a/administrator/components/com_joomlaupdate/views/default/tmpl/default_reinstall.php +++ b/administrator/components/com_joomlaupdate/views/default/tmpl/default_reinstall.php @@ -9,6 +9,14 @@ defined('_JEXEC') or die; +$reinstallUrl = $this->updateInfo['object']->downloadurl->_data; + +// Check if there is a special reinstall URL +if (isset($this->updateInfo['object']->reinstallurl->_data)) +{ + $reinstallUrl = $this->updateInfo['object']->reinstallurl->_data; +} + /** @var JoomlaupdateViewDefault $this */ ?>
    @@ -31,9 +39,7 @@ - - updateInfo['object']->downloadurl->_data; ?> - + updateInfo['object']->get('infourl')->_data) @@ -112,5 +118,6 @@ -
    + + \ No newline at end of file diff --git a/administrator/components/com_joomlaupdate/views/default/tmpl/default_update.php b/administrator/components/com_joomlaupdate/views/default/tmpl/default_update.php index 6b27b6b18ccc9..1eb6cb51b2e76 100644 --- a/administrator/components/com_joomlaupdate/views/default/tmpl/default_update.php +++ b/administrator/components/com_joomlaupdate/views/default/tmpl/default_update.php @@ -123,3 +123,5 @@ + + \ No newline at end of file diff --git a/administrator/components/com_joomlaupdate/views/default/tmpl/default_upload.php b/administrator/components/com_joomlaupdate/views/default/tmpl/default_upload.php index d084d20d0a3ee..1e5abac948729 100644 --- a/administrator/components/com_joomlaupdate/views/default/tmpl/default_upload.php +++ b/administrator/components/com_joomlaupdate/views/default/tmpl/default_upload.php @@ -62,7 +62,7 @@

    - +

    diff --git a/administrator/components/com_joomlaupdate/views/update/tmpl/default.php b/administrator/components/com_joomlaupdate/views/update/tmpl/default.php index 5b5676e6d10b5..f9853caeaf3ab 100644 --- a/administrator/components/com_joomlaupdate/views/update/tmpl/default.php +++ b/administrator/components/com_joomlaupdate/views/update/tmpl/default.php @@ -13,9 +13,9 @@ JHtml::_('jquery.framework'); // Load the scripts -JHtml::script('com_joomlaupdate/json2.js', false, true, false); -JHtml::script('com_joomlaupdate/encryption.js', false, true, false); -JHtml::script('com_joomlaupdate/update.js', false, true, false); +JHtml::_('script', 'com_joomlaupdate/json2.js', array('version' => 'auto', 'relative' => true)); +JHtml::_('script', 'com_joomlaupdate/encryption.js', array('version' => 'auto', 'relative' => true)); +JHtml::_('script', 'com_joomlaupdate/update.js', array('version' => 'auto', 'relative' => true)); $password = JFactory::getApplication()->getUserState('com_joomlaupdate.password', null); $filesize = JFactory::getApplication()->getUserState('com_joomlaupdate.filesize', null); diff --git a/administrator/components/com_languages/helpers/multilangstatus.php b/administrator/components/com_languages/helpers/multilangstatus.php index 71d7b54754257..9e8d18bfdcc3e 100644 --- a/administrator/components/com_languages/helpers/multilangstatus.php +++ b/administrator/components/com_languages/helpers/multilangstatus.php @@ -79,13 +79,13 @@ public static function getContentlangs() * * @return array of language extension objects. * - * @deprecated 4.0 Use JLanguageMultilang::getSiteLangs() instead. + * @deprecated 4.0 Use JLanguageHelper::getInstalledLanguages(0) instead. */ public static function getSitelangs() { - JLog::add(__METHOD__ . ' is deprecated, use JLanguageMultilang::getSiteLangs() instead.', JLog::WARNING, 'deprecated'); + JLog::add(__METHOD__ . ' is deprecated, use JLanguageHelper::getInstalledLanguages(0) instead.', JLog::WARNING, 'deprecated'); - return JLanguageMultilang::getSiteLangs(); + return JLanguageHelper::getInstalledLanguages(0); } /** diff --git a/administrator/components/com_languages/models/installed.php b/administrator/components/com_languages/models/installed.php index d7309732e8eff..7ce00c94cec6f 100644 --- a/administrator/components/com_languages/models/installed.php +++ b/administrator/components/com_languages/models/installed.php @@ -198,68 +198,39 @@ public function getData() { $this->data = array(); - // Get information. - $db = $this->getDbo(); - $query = $db->getQuery(true); - - // Select languages installed from the extensions table. - $query->select($db->quoteName(array('a.element', 'a.client_id', 'a.extension_id'))) - ->from($db->quoteName('#__extensions', 'a')) - ->where($db->quoteName('a.type') . ' = ' . $db->quote('language')) - ->where($db->quoteName('state') . ' = 0') - ->where($db->quoteName('enabled') . ' = 1'); - - // For client_id = 1 do we need to check language table also? - $db->setQuery($query); - $langlist = $db->loadObjectList(); + $isCurrentLanguageRtl = JFactory::getLanguage()->isRtl(); + $params = JComponentHelper::getParams('com_languages'); + $installedLanguages = JLanguageHelper::getInstalledLanguages(null, true, true, null, null, null); // Compute all the languages. - foreach ($langlist as $lang) + foreach ($installedLanguages as $clientId => $languages) { - $client = JApplicationHelper::getClientInfo($lang->client_id); - $clientPath = (int) $lang->client_id === 0 ? JPATH_SITE : JPATH_ADMINISTRATOR; - $metafilePath = $clientPath . '/language/' . $lang->element . '/' . $lang->element . '.xml'; - - $info = JApplicationHelper::parseXMLLangMetaFile($metafilePath); - if (!is_array($info)) - { - $app = JFactory::getApplication(); - $app->enqueueMessage(JText::sprintf('COM_LANGUAGES_ERROR_LANGUAGE_METAFILE_MISSING', $lang->element, $metafilePath), 'warning'); - - continue; - } - - $row = new stdClass; - - $row->language = $lang->element; - $row->client_id = (int) $lang->client_id; - $row->extension_id = (int) $lang->extension_id; - - foreach ($info as $key => $value) - { - $row->$key = $value; - } - - // Fix wrongly set parentheses in RTL languages - if (JFactory::getLanguage()->isRtl()) - { - $row->name = html_entity_decode($row->name . '‎', ENT_QUOTES, 'UTF-8'); - } + $defaultLanguage = $params->get(JApplicationHelper::getClientInfo($clientId)->name, 'en-GB'); - // If current than set published. - $params = JComponentHelper::getParams('com_languages'); - - if ($params->get($client->name, 'en-GB') == $row->language) - { - $row->published = 1; - } - else + foreach ($languages as $lang) { - $row->published = 0; + $row = new stdClass; + $row->language = $lang->element; + $row->name = $lang->metadata['name']; + $row->nativeName = isset($lang->metadata['nativeName']) ? $lang->metadata['nativeName'] : '-'; + $row->client_id = (int) $lang->client_id; + $row->extension_id = (int) $lang->extension_id; + $row->author = $lang->manifest['author']; + $row->creationDate = $lang->manifest['creationDate']; + $row->authorEmail = $lang->manifest['authorEmail']; + $row->version = $lang->manifest['version']; + $row->published = $defaultLanguage === $row->language ? 1 : 0; + $row->checked_out = 0; + + // Fix wrongly set parentheses in RTL languages + if ($isCurrentLanguageRtl) + { + $row->name = html_entity_decode($row->name . '‎', ENT_QUOTES, 'UTF-8'); + $row->nativeName = html_entity_decode($row->nativeName . '‎', ENT_QUOTES, 'UTF-8'); + } + + $this->data[] = $row; } - - $row->checked_out = 0; - $this->data[] = $row; } } @@ -280,10 +251,12 @@ public function getData() continue; } } + // Filter by search term. if (!empty($search)) { if (stripos($installedLanguage->name, $search) === false + && stripos($installedLanguage->nativeName, $search) === false && stripos($installedLanguage->language, $search) === false) { unset($installedLanguages[$key]); diff --git a/administrator/components/com_languages/models/override.php b/administrator/components/com_languages/models/override.php index 96aa1f8921803..a9dd46cc075ca 100644 --- a/administrator/components/com_languages/models/override.php +++ b/administrator/components/com_languages/models/override.php @@ -107,6 +107,11 @@ public function getItem($pk = null) $result->override = $strings[$pk]; } + $opposite_filename = constant('JPATH_' . strtoupper($this->getState('filter.client') == 'site' ? 'administrator' : 'site')) + . '/language/overrides/' . $this->getState('filter.language', 'en-GB') . '.override.ini'; + $opposite_strings = LanguagesHelper::parseFile($opposite_filename); + $result->both = isset($opposite_strings[$pk]) && ($opposite_strings[$pk] == $strings[$pk]); + return $result; } diff --git a/administrator/components/com_languages/views/installed/tmpl/default.php b/administrator/components/com_languages/views/installed/tmpl/default.php index 238718c4de60a..cd0f1ab9511d4 100644 --- a/administrator/components/com_languages/views/installed/tmpl/default.php +++ b/administrator/components/com_languages/views/installed/tmpl/default.php @@ -41,8 +41,11 @@   - - + + + + + @@ -69,7 +72,7 @@ - + pagination->getListFooter(); ?> @@ -92,6 +95,9 @@ escape($row->name); ?> + + escape($row->nativeName); ?> + escape($row->language); ?> diff --git a/administrator/components/com_languages/views/multilangstatus/view.html.php b/administrator/components/com_languages/views/multilangstatus/view.html.php index 1e33e60e97425..5cee40bbc2abb 100644 --- a/administrator/components/com_languages/views/multilangstatus/view.html.php +++ b/administrator/components/com_languages/views/multilangstatus/view.html.php @@ -32,7 +32,7 @@ public function display($tpl = null) $this->switchers = MultilangstatusHelper::getLangswitchers(); $this->listUsersError = MultilangstatusHelper::getContacts(); $this->contentlangs = MultilangstatusHelper::getContentlangs(); - $this->site_langs = JLanguageMultilang::getSiteLangs(); + $this->site_langs = JLanguageHelper::getInstalledLanguages(0); $this->statuses = MultilangstatusHelper::getStatus(); $this->homepages = JLanguageMultilang::getSiteHomePages(); diff --git a/administrator/components/com_languages/views/override/tmpl/edit.php b/administrator/components/com_languages/views/override/tmpl/edit.php index e247e929bdcfc..a564d22661f4c 100644 --- a/administrator/components/com_languages/views/override/tmpl/edit.php +++ b/administrator/components/com_languages/views/override/tmpl/edit.php @@ -17,11 +17,11 @@ $expired = ($this->state->get("cache_expired") == 1 ) ? '1' : ''; -JHtml::_('stylesheet', 'overrider/overrider.css', array(), true); +JHtml::_('stylesheet', 'overrider/overrider.css', array('version' => 'auto', 'relative' => true)); JHtml::_('behavior.core'); JHtml::_('jquery.framework'); -JHtml::_('script', 'overrider/overrider.min.js', false, true, false, true); +JHtml::_('script', 'overrider/overrider.min.js', array('version' => 'auto', 'relative' => true)); JFactory::getDocument()->addScriptDeclaration(' jQuery(document).ready(function($) { diff --git a/administrator/components/com_languages/views/overrides/tmpl/default.php b/administrator/components/com_languages/views/overrides/tmpl/default.php index 982a3ca094688..fc79e0a161502 100644 --- a/administrator/components/com_languages/views/overrides/tmpl/default.php +++ b/administrator/components/com_languages/views/overrides/tmpl/default.php @@ -16,7 +16,13 @@ $client = $this->state->get('filter.client') == '0' ? JText::_('JSITE') : JText::_('JADMINISTRATOR'); $language = $this->state->get('filter.language'); $listOrder = $this->escape($this->state->get('list.ordering')); -$listDirn = $this->escape($this->state->get('list.direction')); ?> +$listDirn = $this->escape($this->state->get('list.direction')); + +$opposite_client = $this->state->get('filter.client') == '1' ? JText::_('JSITE') : JText::_('JADMINISTRATOR'); +$opposite_filename = constant('JPATH_' . strtoupper(1 - $this->state->get('filter.client')? 'administrator' : 'site')) + . '/language/overrides/' . $this->state->get('filter.language', 'en-GB') . '.override.ini'; +$opposite_strings = LanguagesHelper::parseFile($opposite_filename); +?>
    sidebar)) : ?> @@ -94,7 +100,12 @@ - + diff --git a/administrator/components/com_media/views/images/tmpl/default.php b/administrator/components/com_media/views/images/tmpl/default.php index 05eb6cdd6b29b..87fe84a7af614 100644 --- a/administrator/components/com_media/views/images/tmpl/default.php +++ b/administrator/components/com_media/views/images/tmpl/default.php @@ -24,12 +24,12 @@ // Include jQuery JHtml::_('jquery.framework'); -JHtml::_('script', 'media/popup-imagemanager.min.js', false, true, false, false, true); -JHtml::_('stylesheet', 'media/popup-imagemanager.css', array(), true); +JHtml::_('script', 'media/popup-imagemanager.min.js', array('version' => 'auto', 'relative' => true)); +JHtml::_('stylesheet', 'media/popup-imagemanager.css', array('version' => 'auto', 'relative' => true)); if ($lang->isRtl()) { - JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', array(), true); + JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', array('version' => 'auto', 'relative' => true)); } JFactory::getDocument()->addScriptDeclaration( @@ -89,7 +89,7 @@
    -
    +
    @@ -115,7 +115,7 @@
    state->get('field.id')):?> -
    +
    @@ -133,7 +133,7 @@
    -
    +
    diff --git a/administrator/components/com_media/views/imageslist/tmpl/default.php b/administrator/components/com_media/views/imageslist/tmpl/default.php index 8bbe21a3c4c11..9b850963bdfe0 100644 --- a/administrator/components/com_media/views/imageslist/tmpl/default.php +++ b/administrator/components/com_media/views/imageslist/tmpl/default.php @@ -11,11 +11,11 @@ $lang = JFactory::getLanguage(); -JHtml::_('stylesheet', 'media/popup-imagelist.css', array(), true); +JHtml::_('stylesheet', 'media/popup-imagelist.css', array('version' => 'auto', 'relative' => true)); if ($lang->isRtl()) { - JHtml::_('stylesheet', 'media/popup-imagelist_rtl.css', array(), true); + JHtml::_('stylesheet', 'media/popup-imagelist_rtl.css', array('version' => 'auto', 'relative' => true)); } JFactory::getDocument()->addScriptDeclaration("var ImageManager = window.parent.ImageManager;"); diff --git a/administrator/components/com_media/views/media/tmpl/default.php b/administrator/components/com_media/views/media/tmpl/default.php index d7a0e60826968..8a08f8f8100be 100644 --- a/administrator/components/com_media/views/media/tmpl/default.php +++ b/administrator/components/com_media/views/media/tmpl/default.php @@ -32,14 +32,14 @@ JHtml::_('behavior.keepalive'); JHtml::_('bootstrap.framework'); -JHtml::_('script', 'media/mediamanager.min.js', false, true); -JHtml::_('script', 'media/mediaelement-and-player.js', false, true); -JHtml::_('stylesheet', 'media/mediaelementplayer.css', array(), true); -JHtml::_('stylesheet', 'system/mootree.css', array(), true); +JHtml::_('script', 'media/mediamanager.min.js', array('version' => 'auto', 'relative' => true)); +JHtml::_('script', 'media/mediaelement-and-player.js', array('version' => 'auto', 'relative' => true)); +JHtml::_('stylesheet', 'media/mediaelementplayer.css', array('version' => 'auto', 'relative' => true)); +JHtml::_('stylesheet', 'system/mootree.css', array('version' => 'auto', 'relative' => true)); if ($lang->isRtl()) { - JHtml::_('stylesheet', 'media/mootree_rtl.css', array(), true); + JHtml::_('stylesheet', 'system/mootree_rtl.css', array('version' => 'auto', 'relative' => true)); } ?>
    diff --git a/administrator/components/com_menus/controllers/item.php b/administrator/components/com_menus/controllers/item.php index a6ed2e49ef24a..36c95367c706c 100644 --- a/administrator/components/com_menus/controllers/item.php +++ b/administrator/components/com_menus/controllers/item.php @@ -482,6 +482,11 @@ public function setType() { $title = 'component'; } + else + { + // Set correct component id to ensure proper 404 messages with system links + $data['component_id'] = 0; + } $app->setUserState('com_menus.edit.item.type', $title); diff --git a/administrator/components/com_menus/helpers/html/menus.php b/administrator/components/com_menus/helpers/html/menus.php index 9a45416a7a65a..353ef838f325e 100644 --- a/administrator/components/com_menus/helpers/html/menus.php +++ b/administrator/components/com_menus/helpers/html/menus.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Registry\Registry; + JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'); /** @@ -225,4 +227,31 @@ public static function state($value, $i, $enabled = true, $checkbox = 'cb') return JHtml::_('jgrid.state', $states, $value, $i, 'items.', $enabled, true, $checkbox); } + + /** + * Returns a visibility state on a grid + * + * @param integer $params Params of item. + * + * @return string The Html code + * + * @since __DEPLOY_VERSION__ + */ + public static function visibility($params) + { + $registry = new Registry; + + try + { + $registry->loadString($params); + } + catch (Exception $e) + { + // Invalid JSON + } + + $show_menu = $registry->get('menu_show'); + + return ($show_menu === 0) ? '' . JText::_('COM_MENUS_LABEL_HIDDEN') . '' : ''; + } } diff --git a/administrator/components/com_menus/models/fields/menuordering.php b/administrator/components/com_menus/models/fields/menuordering.php index d78d8e19252e5..2e25df45651ae 100644 --- a/administrator/components/com_menus/models/fields/menuordering.php +++ b/administrator/components/com_menus/models/fields/menuordering.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldMenuOrdering extends JFormFieldList +class JFormFieldMenuOrdering extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_menus/models/fields/menuparent.php b/administrator/components/com_menus/models/fields/menuparent.php index cb665c34e41f6..fe25a5591b2b9 100644 --- a/administrator/components/com_menus/models/fields/menuparent.php +++ b/administrator/components/com_menus/models/fields/menuparent.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldMenuParent extends JFormFieldList +class JFormFieldMenuParent extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_menus/models/fields/menutype.php b/administrator/components/com_menus/models/fields/menutype.php index 68c7b4b82d78a..4bc104fc59485 100644 --- a/administrator/components/com_menus/models/fields/menutype.php +++ b/administrator/components/com_menus/models/fields/menutype.php @@ -11,14 +11,12 @@ use Joomla\Utilities\ArrayHelper; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldMenutype extends JFormFieldList +class JFormFieldMenutype extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_menus/models/fields/modal/menu.php b/administrator/components/com_menus/models/fields/modal/menu.php index bc316da8b6391..249c9f38a1641 100644 --- a/administrator/components/com_menus/models/fields/modal/menu.php +++ b/administrator/components/com_menus/models/fields/modal/menu.php @@ -50,7 +50,7 @@ protected function getInput() // Add the modal field script to the document head. JHtml::_('jquery.framework'); - JHtml::_('script', 'system/modal-fields.js', false, true); + JHtml::_('script', 'system/modal-fields.js', array('version' => 'auto', 'relative' => true)); // Script to proxy the select modal function to the modal-fields.js file. if ($allowSelect) diff --git a/administrator/components/com_menus/models/forms/item_component.xml b/administrator/components/com_menus/models/forms/item_component.xml index 101b3e87704ba..43198e4d391b1 100644 --- a/administrator/components/com_menus/models/forms/item_component.xml +++ b/administrator/components/com_menus/models/forms/item_component.xml @@ -55,8 +55,8 @@ label="COM_MENUS_ITEM_FIELD_SHOW_PAGE_HEADING_LABEL" description="COM_MENUS_ITEM_FIELD_SHOW_PAGE_HEADING_DESC" default="" - > - + useglobal="true" + > @@ -86,7 +86,7 @@ type="list" label="JFIELD_METADATA_ROBOTS_LABEL" description="JFIELD_METADATA_ROBOTS_DESC" - > + > diff --git a/administrator/components/com_menus/models/item.php b/administrator/components/com_menus/models/item.php index 119735acd2243..9c0482ff0843b 100644 --- a/administrator/components/com_menus/models/item.php +++ b/administrator/components/com_menus/models/item.php @@ -123,16 +123,10 @@ protected function canDelete($record) */ protected function canEditState($record) { - $user = JFactory::getUser(); - - $menuTypeId = 0; - - if (!empty($record->menutype)) - { - $menuTypeId = $this->getMenuTypeId($record->menutype); - } + $menuTypeId = !empty($record->menutype) ? $this->getMenuTypeId($record->menutype) : 0; + $assetKey = $menuTypeId ? 'com_menus.menu.' . (int) $menuTypeId : 'com_menus'; - return $user->authorise('core.edit.state', 'com_menus.menu.' . (int) $menuTypeId); + return JFactory::getUser()->authorise('core.edit.state', $assetKey); } /** @@ -1142,30 +1136,25 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') } // Association menu items - $app = JFactory::getApplication(); - $assoc = JLanguageAssociations::isEnabled(); - - if ($assoc) + if (JLanguageAssociations::isEnabled()) { - $languages = JLanguageHelper::getLanguages('lang_code'); + $languages = JLanguageHelper::getContentLanguages(false, true, null, 'ordering', 'asc'); - $addform = new SimpleXMLElement(''); - $fields = $addform->addChild('fields'); - $fields->addAttribute('name', 'associations'); - $fieldset = $fields->addChild('fieldset'); - $fieldset->addAttribute('name', 'item_associations'); - $fieldset->addAttribute('description', 'COM_MENUS_ITEM_ASSOCIATIONS_FIELDSET_DESC'); - $add = false; - - foreach ($languages as $tag => $language) + if (count($languages) > 1) { - if ($tag != $data['language']) + $addform = new SimpleXMLElement(''); + $fields = $addform->addChild('fields'); + $fields->addAttribute('name', 'associations'); + $fieldset = $fields->addChild('fieldset'); + $fieldset->addAttribute('name', 'item_associations'); + $fieldset->addAttribute('description', 'COM_MENUS_ITEM_ASSOCIATIONS_FIELDSET_DESC'); + + foreach ($languages as $language) { - $add = true; $field = $fieldset->addChild('field'); - $field->addAttribute('name', $tag); + $field->addAttribute('name', $language->lang_code); $field->addAttribute('type', 'modal_menu'); - $field->addAttribute('language', $tag); + $field->addAttribute('language', $language->lang_code); $field->addAttribute('label', $language->title); $field->addAttribute('translate_label', 'false'); $field->addAttribute('select', 'true'); @@ -1175,10 +1164,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $option = $field->addChild('option', 'COM_MENUS_ITEM_FIELD_ASSOCIATION_NO_VALUE'); $option->addAttribute('value', ''); } - } - if ($add) - { $form->load($addform, false); } } diff --git a/administrator/components/com_menus/models/items.php b/administrator/components/com_menus/models/items.php index 2b5c0e6190890..0e1fd13eb29ab 100644 --- a/administrator/components/com_menus/models/items.php +++ b/administrator/components/com_menus/models/items.php @@ -262,7 +262,7 @@ protected function getListQuery() ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Join over the menu types. - $query->select($db->quoteName('mt.title', 'menutype_title')) + $query->select($db->quoteName(array('mt.id', 'mt.title'), array('menutype_id', 'menutype_title'))) ->join('LEFT', $db->quoteName('#__menu_types', 'mt') . ' ON ' . $db->qn('mt.menutype') . ' = ' . $db->qn('a.menutype')); // Join over the associations. @@ -273,7 +273,7 @@ protected function getListQuery() $query->select('COUNT(asso2.id)>1 as association') ->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context=' . $db->quote('com_menus.item')) ->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key') - ->group('a.id, e.enabled, l.title, l.image, u.name, c.element, ag.title, e.name, mt.title'); + ->group('a.id, e.enabled, l.title, l.image, u.name, c.element, ag.title, e.name, mt.id, mt.title'); } // Join over the extensions @@ -350,7 +350,10 @@ protected function getListQuery() } } - $query->where('a.menutype IN(' . implode(',', $types) . ')'); + if (!empty($types)) + { + $query->where('a.menutype IN(' . implode(',', $types) . ')'); + } } // Default behavior => load all items from a specific menu elseif (strlen($menuType)) @@ -372,8 +375,12 @@ protected function getListQuery() // Implement View Level Access if (!$user->authorise('core.admin')) { - $groups = implode(',', $user->getAuthorisedViewLevels()); - $query->where('a.access IN (' . $groups . ')'); + $groups = $user->getAuthorisedViewLevels(); + + if (!empty($groups)) + { + $query->where('a.access IN (' . implode(',', $groups) . ')'); + } } // Filter on the level. diff --git a/administrator/components/com_menus/views/item/view.html.php b/administrator/components/com_menus/views/item/view.html.php index 073f10e094885..be336b582db18 100644 --- a/administrator/components/com_menus/views/item/view.html.php +++ b/administrator/components/com_menus/views/item/view.html.php @@ -71,24 +71,15 @@ public function display($tpl = null) return false; } - if ($this->getLayout() == 'modal') - { - // If we are forcing a language in modal (used for associations). - if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) - { - // Set the language field to the forcedLanguage and disable changing it. - $this->form->setValue('language', null, $forcedLanguage); - $this->form->setFieldAttribute('language', 'readonly', 'true'); - - // Only allow to select categories with All language or with the forced language. - $this->form->setFieldAttribute('parent_id', 'language', '*,' . $forcedLanguage); - } - } - // If not in associations modal, block the language change if in edit modal, language not All, associations enabled and some association. - elseif ($this->item->id && $this->form->getValue('language', null, '*') != '*' && JLanguageAssociations::isEnabled() - && count($this->item->associations) > 0) + // If we are forcing a language in modal (used for associations). + if ($this->getLayout() === 'modal' && $forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) { + // Set the language field to the forcedLanguage and disable changing it. + $this->form->setValue('language', null, $forcedLanguage); $this->form->setFieldAttribute('language', 'readonly', 'true'); + + // Only allow to select categories with All language or with the forced language. + $this->form->setFieldAttribute('parent_id', 'language', '*,' . $forcedLanguage); } parent::display($tpl); diff --git a/administrator/components/com_menus/views/items/tmpl/default.php b/administrator/components/com_menus/views/items/tmpl/default.php index 9b30ad234d5e3..09c5a7d2c481b 100644 --- a/administrator/components/com_menus/views/items/tmpl/default.php +++ b/administrator/components/com_menus/views/items/tmpl/default.php @@ -24,7 +24,6 @@ $ordering = ($listOrder == 'a.lft'); $canOrder = $user->authorise('core.edit.state', 'com_menus'); $saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc'); -$menuTypeId = (int) $this->state->get('menutypeid'); $menuType = (string) $app->getUserState('com_menus.items.menutype', '', 'string'); if ($saveOrder && $menuType) @@ -109,12 +108,13 @@ items as $i => $item) : $orderkey = array_search($item->id, $this->ordering[$item->parent_id]); - $canCreate = $user->authorise('core.create', 'com_menus.menu.' . $menuTypeId); - $canEdit = $user->authorise('core.edit', 'com_menus.menu.' . $menuTypeId); + $canCreate = $user->authorise('core.create', 'com_menus.menu.' . $item->menutype_id); + $canEdit = $user->authorise('core.edit', 'com_menus.menu.' . $item->menutype_id); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id')|| $item->checked_out == 0; - $canChange = $user->authorise('core.edit.state', 'com_menus.menu.' . $menuTypeId) && $canCheckin; + $canChange = $user->authorise('core.edit.state', 'com_menus.menu.' . $item->menutype_id) && $canCheckin; // Get the parents of item for sorting if ($item->level > 1) @@ -196,6 +196,7 @@ escape($item->note));?> + params); ?>
    diff --git a/administrator/components/com_menus/views/items/tmpl/modal.php b/administrator/components/com_menus/views/items/tmpl/modal.php index e55c3ec6e8029..029eff8e77e54 100644 --- a/administrator/components/com_menus/views/items/tmpl/modal.php +++ b/administrator/components/com_menus/views/items/tmpl/modal.php @@ -13,10 +13,10 @@ if ($app->isSite()) { - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN')); } -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +JHtml::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/helpers/html'); JHtml::_('behavior.core'); JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); @@ -43,7 +43,7 @@ ?>
    - + $this)); ?> diff --git a/administrator/components/com_menus/views/items/view.html.php b/administrator/components/com_menus/views/items/view.html.php index b33f9a19b1c5c..ee11e0d9f9cdd 100644 --- a/administrator/components/com_menus/views/items/view.html.php +++ b/administrator/components/com_menus/views/items/view.html.php @@ -55,7 +55,11 @@ public function display($tpl = null) $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); - MenusHelper::addSubmenu('items'); + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + MenusHelper::addSubmenu('items'); + } // Check for errors. if (count($errors = $this->get('Errors'))) diff --git a/administrator/components/com_messages/models/fields/messagestates.php b/administrator/components/com_messages/models/fields/messagestates.php index b505fe4550ad8..68d3f8863af53 100644 --- a/administrator/components/com_messages/models/fields/messagestates.php +++ b/administrator/components/com_messages/models/fields/messagestates.php @@ -9,8 +9,6 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('MessagesHelper', JPATH_ADMINISTRATOR . '/components/com_messages/helpers/messages.php'); /** @@ -18,7 +16,7 @@ * * @since 3.6.0 */ -class JFormFieldMessageStates extends JFormFieldList +class JFormFieldMessageStates extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_modules/models/fields/modulesmodule.php b/administrator/components/com_modules/models/fields/modulesmodule.php index 81c3586a416c1..eab6425da0651 100644 --- a/administrator/components/com_modules/models/fields/modulesmodule.php +++ b/administrator/components/com_modules/models/fields/modulesmodule.php @@ -9,16 +9,14 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('ModulesHelper', JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php'); /** - * ModulesPosition Field class for the Joomla Framework. + * ModulesModule Field class for the Joomla Framework. * * @since 3.4.2 */ -class JFormFieldModulesModule extends JFormFieldList +class JFormFieldModulesModule extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_modules/models/fields/modulesposition.php b/administrator/components/com_modules/models/fields/modulesposition.php index 8cda336e44462..fef92bce13f35 100644 --- a/administrator/components/com_modules/models/fields/modulesposition.php +++ b/administrator/components/com_modules/models/fields/modulesposition.php @@ -9,8 +9,6 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('ModulesHelper', JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php'); /** @@ -18,7 +16,7 @@ * * @since 3.4.2 */ -class JFormFieldModulesPosition extends JFormFieldList +class JFormFieldModulesPosition extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_modules/modules.php b/administrator/components/com_modules/modules.php index b30029920f7ed..5a0cd0caeb553 100644 --- a/administrator/components/com_modules/modules.php +++ b/administrator/components/com_modules/modules.php @@ -10,7 +10,11 @@ defined('_JEXEC') or die; JHtml::_('behavior.tabstate'); -if (!JFactory::getUser()->authorise('core.manage', 'com_modules')) +$user = JFactory::getUser(); +$input = JFactory::getApplication()->input; + +if (($input->get('layout') !== 'modal' && $input->get('view') !== 'modules') + && !$user->authorise('core.manage', 'com_modules')) { throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); } diff --git a/administrator/components/com_modules/views/module/tmpl/edit.php b/administrator/components/com_modules/views/module/tmpl/edit.php index 7f99529e3928b..a29aa1293b3e6 100644 --- a/administrator/components/com_modules/views/module/tmpl/edit.php +++ b/administrator/components/com_modules/views/module/tmpl/edit.php @@ -14,7 +14,8 @@ JHtml::_('behavior.formvalidator'); JHtml::_('behavior.combobox'); JHtml::_('behavior.keepalive'); -JHtml::_('formbehavior.chosen', 'select', null, array('disable_search_threshold' => 0)); +JHtml::_('formbehavior.chosen', '#jform_position', null, array('disable_search_threshold' => 0 )); +JHtml::_('formbehavior.chosen', 'select'); $hasContent = empty($this->item->module) || isset($this->item->xml->customContent); $hasContentFieldName = "content"; @@ -269,18 +270,18 @@ - canDo->get('core.admin')) : ?> - - form->getInput('rules'); ?> - - - fieldsets = array(); $this->ignore_fieldsets = array('basic', 'description'); echo JLayoutHelper::render('joomla.edit.params', $this); ?> + canDo->get('core.admin')) : ?> + + form->getInput('rules'); ?> + + + diff --git a/administrator/components/com_modules/views/module/tmpl/edit_assignment.php b/administrator/components/com_modules/views/module/tmpl/edit_assignment.php index 0e3d2c4d95d9e..ecc5b084cd3ea 100644 --- a/administrator/components/com_modules/views/module/tmpl/edit_assignment.php +++ b/administrator/components/com_modules/views/module/tmpl/edit_assignment.php @@ -13,7 +13,7 @@ JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'); $menuTypes = MenusHelper::getMenuLinks(); -JHtml::_('script', 'jui/treeselectmenu.jquery.min.js', false, true); +JHtml::_('script', 'jui/treeselectmenu.jquery.min.js', array('version' => 'auto', 'relative' => true)); $script = " jQuery(document).ready(function() diff --git a/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php b/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php index bebb52dac866c..904812fd67c53 100644 --- a/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php +++ b/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php @@ -49,7 +49,7 @@ protected function getInput() // Add the modal field script to the document head. JHtml::_('jquery.framework'); - JHtml::_('script', 'system/modal-fields.js', false, true); + JHtml::_('script', 'system/modal-fields.js', array('version' => 'auto', 'relative' => true)); // Script to proxy the select modal function to the modal-fields.js file. if ($allowSelect) diff --git a/administrator/components/com_newsfeeds/models/fields/newsfeeds.php b/administrator/components/com_newsfeeds/models/fields/newsfeeds.php index 53f65997dfedb..f6691c667137c 100644 --- a/administrator/components/com_newsfeeds/models/fields/newsfeeds.php +++ b/administrator/components/com_newsfeeds/models/fields/newsfeeds.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldNewsfeeds extends JFormFieldList +class JFormFieldNewsfeeds extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_newsfeeds/models/forms/newsfeed.xml b/administrator/components/com_newsfeeds/models/forms/newsfeed.xml index 49444229a3684..c589ebb48d250 100644 --- a/administrator/components/com_newsfeeds/models/forms/newsfeed.xml +++ b/administrator/components/com_newsfeeds/models/forms/newsfeed.xml @@ -283,8 +283,8 @@ type="list" label="COM_NEWSFEEDS_FLOAT_LABEL" description="COM_NEWSFEEDS_FLOAT_DESC" + useglobal="true" > - @@ -324,8 +324,8 @@ type="list" label="COM_NEWSFEEDS_FLOAT_LABEL" description="COM_NEWSFEEDS_FLOAT_DESC" + useglobal="true" > - @@ -391,8 +391,8 @@ type="list" label="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_LABEL" description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC" + useglobal="true" > - @@ -402,8 +402,8 @@ type="list" label="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_LABEL" description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC" + useglobal="true" > - @@ -413,8 +413,8 @@ type="list" label="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_LABEL" description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC" + useglobal="true" > - @@ -424,8 +424,8 @@ type="text" label="COM_NEWSFEEDS_FIELD_CHARACTERS_COUNT_LABEL" description="COM_NEWSFEEDS_FIELD_CHARACTERS_COUNT_DESC" - default="0" size="6" + useglobal="true" /> - diff --git a/administrator/components/com_newsfeeds/models/newsfeed.php b/administrator/components/com_newsfeeds/models/newsfeed.php index ec46dd6783652..ab0c9fec96a4e 100644 --- a/administrator/components/com_newsfeeds/models/newsfeed.php +++ b/administrator/components/com_newsfeeds/models/newsfeed.php @@ -508,28 +508,25 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') } // Association newsfeeds items - $assoc = JLanguageAssociations::isEnabled(); - - if ($assoc) + if (JLanguageAssociations::isEnabled()) { - $languages = JLanguageHelper::getLanguages('lang_code'); - $addform = new SimpleXMLElement(''); - $fields = $addform->addChild('fields'); - $fields->addAttribute('name', 'associations'); - $fieldset = $fields->addChild('fieldset'); - $fieldset->addAttribute('name', 'item_associations'); - $fieldset->addAttribute('description', 'COM_NEWSFEEDS_ITEM_ASSOCIATIONS_FIELDSET_DESC'); - $add = false; - - foreach ($languages as $tag => $language) + $languages = JLanguageHelper::getContentLanguages(false, true, null, 'ordering', 'asc'); + + if (count($languages) > 1) { - if (empty($data->language) || $tag != $data->language) + $addform = new SimpleXMLElement(''); + $fields = $addform->addChild('fields'); + $fields->addAttribute('name', 'associations'); + $fieldset = $fields->addChild('fieldset'); + $fieldset->addAttribute('name', 'item_associations'); + $fieldset->addAttribute('description', 'COM_NEWSFEEDS_ITEM_ASSOCIATIONS_FIELDSET_DESC'); + + foreach ($languages as $language) { - $add = true; $field = $fieldset->addChild('field'); - $field->addAttribute('name', $tag); + $field->addAttribute('name', $language->lang_code); $field->addAttribute('type', 'modal_newsfeed'); - $field->addAttribute('language', $tag); + $field->addAttribute('language', $language->lang_code); $field->addAttribute('label', $language->title); $field->addAttribute('translate_label', 'false'); $field->addAttribute('select', 'true'); @@ -537,10 +534,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $field->addAttribute('edit', 'true'); $field->addAttribute('clear', 'true'); } - } - if ($add) - { $form->load($addform, false); } } diff --git a/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit.php b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit.php index 78fd13d327ce6..1c9180df2820b 100644 --- a/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit.php +++ b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit.php @@ -14,7 +14,8 @@ JHtml::_('behavior.formvalidator'); JHtml::_('behavior.keepalive'); -JHtml::_('formbehavior.chosen', 'select', null, array('disable_search_threshold' => 0 )); +JHtml::_('formbehavior.chosen', '#jform_catid', null, array('disable_search_threshold' => 0 )); +JHtml::_('formbehavior.chosen', 'select'); $app = JFactory::getApplication(); $input = $app->input; diff --git a/administrator/components/com_newsfeeds/views/newsfeed/view.html.php b/administrator/components/com_newsfeeds/views/newsfeed/view.html.php index 9507878cc504e..5b9c5322d1515 100644 --- a/administrator/components/com_newsfeeds/views/newsfeed/view.html.php +++ b/administrator/components/com_newsfeeds/views/newsfeed/view.html.php @@ -63,27 +63,18 @@ public function display($tpl = null) return false; } - if ($this->getLayout() == 'modal') + // If we are forcing a language in modal (used for associations). + if ($this->getLayout() === 'modal' && $forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) { - // If we are forcing a language in modal (used for associations). - if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd')) - { - // Set the language field to the forcedLanguage and disable changing it. - $this->form->setValue('language', null, $forcedLanguage); - $this->form->setFieldAttribute('language', 'readonly', 'true'); + // Set the language field to the forcedLanguage and disable changing it. + $this->form->setValue('language', null, $forcedLanguage); + $this->form->setFieldAttribute('language', 'readonly', 'true'); - // Only allow to select categories with All language or with the forced language. - $this->form->setFieldAttribute('catid', 'language', '*,' . $forcedLanguage); + // Only allow to select categories with All language or with the forced language. + $this->form->setFieldAttribute('catid', 'language', '*,' . $forcedLanguage); - // Only allow to select tags with All language or with the forced language. - $this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage); - } - } - // If not in associations modal, block the language change if in edit modal, language not All, associations enabled and some association. - elseif ($this->item->id && $this->form->getValue('language', null, '*') != '*' && JLanguageAssociations::isEnabled() - && count($this->item->associations) > 0) - { - $this->form->setFieldAttribute('language', 'readonly', 'true'); + // Only allow to select tags with All language or with the forced language. + $this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage); } $this->addToolbar(); diff --git a/administrator/components/com_plugins/models/fields/plugintype.php b/administrator/components/com_plugins/models/fields/plugintype.php index 16e0ebd8dcee6..ec4cadf358080 100644 --- a/administrator/components/com_plugins/models/fields/plugintype.php +++ b/administrator/components/com_plugins/models/fields/plugintype.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('PluginsHelper', JPATH_ADMINISTRATOR . '/components/com_plugins/helpers/plugins.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldPluginType extends JFormFieldList +class JFormFieldPluginType extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_redirect/models/fields/redirect.php b/administrator/components/com_redirect/models/fields/redirect.php index 47a2296046e68..54dcf55378b1b 100644 --- a/administrator/components/com_redirect/models/fields/redirect.php +++ b/administrator/components/com_redirect/models/fields/redirect.php @@ -9,8 +9,6 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * A dropdown containing all valid HTTP 1.1 response codes. * @@ -18,7 +16,7 @@ * @subpackage com_redirect * @since 3.4 */ -class JFormFieldRedirect extends JFormFieldList +class JFormFieldRedirect extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_search/views/searches/tmpl/default.php b/administrator/components/com_search/views/searches/tmpl/default.php index 9ae486262c52c..d2e2a811d8a2d 100644 --- a/administrator/components/com_search/views/searches/tmpl/default.php +++ b/administrator/components/com_search/views/searches/tmpl/default.php @@ -68,8 +68,8 @@ state->get('show_results')) : ?> - " href="index.php?option=com_search&view=search&searchword=search_term); ?>"> - returns; ?> + " target="_blank" href="index.php?option=com_search&view=search&searchword=search_term); ?>"> + returns; ?> diff --git a/administrator/components/com_templates/models/fields/templatelocation.php b/administrator/components/com_templates/models/fields/templatelocation.php index a7fd6ab1736cc..74fd97ddfddbd 100644 --- a/administrator/components/com_templates/models/fields/templatelocation.php +++ b/administrator/components/com_templates/models/fields/templatelocation.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('TemplatesHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldTemplateLocation extends JFormFieldList +class JFormFieldTemplateLocation extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_templates/models/fields/templatename.php b/administrator/components/com_templates/models/fields/templatename.php index 954fc4f10f791..df238437ff893 100644 --- a/administrator/components/com_templates/models/fields/templatename.php +++ b/administrator/components/com_templates/models/fields/templatename.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('TemplatesHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldTemplateName extends JFormFieldList +class JFormFieldTemplateName extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_templates/views/style/tmpl/edit.php b/administrator/components/com_templates/views/style/tmpl/edit.php index f09d53d3d98da..c7bc7a17e687b 100644 --- a/administrator/components/com_templates/views/style/tmpl/edit.php +++ b/administrator/components/com_templates/views/style/tmpl/edit.php @@ -91,7 +91,7 @@ echo JLayoutHelper::render('joomla.edit.params', $this); ?> - authorise('core.edit', 'com_menu') && $this->item->client_id == 0 && $this->canDo->get('core.edit.state')) : ?> + authorise('core.edit', 'com_menus') && $this->item->client_id == 0 && $this->canDo->get('core.edit.state')) : ?> loadTemplate('assignment'); ?> diff --git a/administrator/components/com_templates/views/template/tmpl/default.php b/administrator/components/com_templates/views/template/tmpl/default.php index ad3577b887b88..a164b3b6ebd1f 100644 --- a/administrator/components/com_templates/views/template/tmpl/default.php +++ b/administrator/components/com_templates/views/template/tmpl/default.php @@ -28,8 +28,8 @@ if ($this->type == 'image') { - JHtml::_('script', 'system/jquery.Jcrop.min.js', false, true); - JHtml::_('stylesheet', 'system/jquery.Jcrop.min.css', array(), true); + JHtml::_('script', 'system/jquery.Jcrop.min.js', array('version' => 'auto', 'relative' => true)); + JHtml::_('stylesheet', 'system/jquery.Jcrop.min.css', array('version' => 'auto', 'relative' => true)); } JFactory::getDocument()->addScriptDeclaration(" diff --git a/administrator/components/com_users/access.xml b/administrator/components/com_users/access.xml index b10b8fe446277..591aeb52bbc75 100644 --- a/administrator/components/com_users/access.xml +++ b/administrator/components/com_users/access.xml @@ -8,6 +8,7 @@ +
    diff --git a/administrator/components/com_users/config.xml b/administrator/components/com_users/config.xml index 2fa3d94d9cfb3..0579569c52d72 100644 --- a/administrator/components/com_users/config.xml +++ b/administrator/components/com_users/config.xml @@ -253,6 +253,18 @@ + + + + +
    get('custom_fields_enable', '1')) + { + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELDS'), + 'index.php?option=com_fields&context=com_users.user', + $vName == 'fields.user' + ); + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELD_GROUPS'), + 'index.php?option=com_categories&extension=com_users.user.fields', + $vName == 'categories.user' + ); + } } /** diff --git a/administrator/components/com_users/models/fields/components.php b/administrator/components/com_users/models/fields/components.php index 80372bc387b57..ef606dd9cd62a 100644 --- a/administrator/components/com_users/models/fields/components.php +++ b/administrator/components/com_users/models/fields/components.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 3.6.0 */ -class JFormFieldComponents extends JFormFieldList +class JFormFieldComponents extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_users/models/fields/groupparent.php b/administrator/components/com_users/models/fields/groupparent.php index 1288dd5e7110a..60a92354175b9 100644 --- a/administrator/components/com_users/models/fields/groupparent.php +++ b/administrator/components/com_users/models/fields/groupparent.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldGroupParent extends JFormFieldList +class JFormFieldGroupParent extends JFormAbstractlist { /** * The form field type. @@ -37,21 +35,20 @@ protected function getOptions() { $options = JHelperUsergroups::getInstance()->getAll(); - $user = JFactory::getUser(); - // Prevent parenting to children of this item. if ($id = $this->form->getValue('id')) { unset($options[$id]); } - $options = array_values($options); + $options = array_values($options); + $isSuperAdmin = JFactory::getUser()->authorise('core.admin'); // Pad the option text with spaces using depth level as a multiplier. for ($i = 0, $n = count($options); $i < $n; $i++) { // Show groups only if user is super admin or group is not super admin - if ($user->authorise('core.admin') || (!JAccess::checkGroup($options[$i]->value, 'core.admin'))) + if ($isSuperAdmin || !JAccess::checkGroup($options[$i]->id, 'core.admin')) { $options[$i]->value = $options[$i]->id; $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->title; @@ -63,8 +60,6 @@ protected function getOptions() } // Merge any additional options in the XML definition. - $options = array_merge(parent::getOptions(), $options); - - return $options; + return array_merge(parent::getOptions(), $options); } } diff --git a/administrator/components/com_users/models/fields/levels.php b/administrator/components/com_users/models/fields/levels.php index a3b9a9bf10eb1..6ee98fd5cc228 100644 --- a/administrator/components/com_users/models/fields/levels.php +++ b/administrator/components/com_users/models/fields/levels.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 3.6.0 */ -class JFormFieldLevels extends JFormFieldList +class JFormFieldLevels extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/language/en-GB/en-GB.com_categories.ini b/administrator/language/en-GB/en-GB.com_categories.ini index 2d9d3ece8f95a..b7d66ef649b81 100644 --- a/administrator/language/en-GB/en-GB.com_categories.ini +++ b/administrator/language/en-GB/en-GB.com_categories.ini @@ -9,6 +9,7 @@ COM_CATEGORIES_ACCESS_CREATE_DESC="New setting for create actionsthis page for more information." COM_CPANEL_MSG_HTACCESS_TITLE=".htaccess & web.config Update" +COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_TITLE="Prepare for the next Major Release of Joomla" +COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_BODY="Beginning with Joomla! 4.0 we are raising the minimum server requirements. If you are seeing this message then your current configuration does not meet these new minimum requirements.
    The minimum requirements are the following:
    • PHP 5.5.9
    • MySQL 5.5.3
    • PostgreSQL 9.2
    • MS SQL will not be supported

    Please contact your hosting provider to ask how you can meet these raised server requirements - it is usually a very simple change. If you already meet these new requirements then this message will not be displayed." COM_CPANEL_MSG_LANGUAGEACCESS340_TITLE="You have possible issues with your multilingual settings" COM_CPANEL_MSG_LANGUAGEACCESS340_BODY="Since Joomla! 3.4.0 you may have issues with the System - Language Filter plugin on your website. To fix them please open the Language Manager and save each content language manually to make sure an Access level is saved." COM_CPANEL_MSG_PHPVERSION_BODY="Beginning with Joomla! 3.3, the version of PHP this site is using will no longer be supported. Joomla! 3.3 will require at least PHP version 5.3.10 in order to provide enhanced security features to its users." diff --git a/administrator/language/en-GB/en-GB.com_fields.ini b/administrator/language/en-GB/en-GB.com_fields.ini new file mode 100644 index 0000000000000..f21c06afb2b52 --- /dev/null +++ b/administrator/language/en-GB/en-GB.com_fields.ini @@ -0,0 +1,104 @@ +; Joomla! Project +; Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +COM_FIELDS="Fields" +COM_FIELDS_FIELD_CLASS_DESC="The class attributes of the field in the edit form. If different classes are needed, list them with spaces." +COM_FIELDS_FIELD_CLASS_LABEL="Class" +COM_FIELDS_FIELD_DEFAULT_VALUE_DESC="The default value of the field." +COM_FIELDS_FIELD_DEFAULT_VALUE_LABEL="Default Value" +COM_FIELDS_FIELD_DESCRIPTION_DESC="The description of the field." +COM_FIELDS_FIELD_DISABLED_DESC="Is the field disabled in the edit form." +COM_FIELDS_FIELD_DISABLED_LABEL="Disabled" +COM_FIELDS_FIELD_DISPLAY_AFTER_DISPLAY="After Display" +COM_FIELDS_FIELD_DISPLAY_AFTER_TITLE="After Title" +COM_FIELDS_FIELD_DISPLAY_BEFORE_DISPLAY="Before Display" +COM_FIELDS_FIELD_DISPLAY_DESC="Joomla offers some content events which are triggered during the content creation process. This is the place to define how the custom fields should be integrated into content." +COM_FIELDS_FIELD_DISPLAY_LABEL="Automatic Display" +COM_FIELDS_FIELD_GROUP_DESC="The group this field belongs to." +COM_FIELDS_FIELD_GROUP_LABEL="Field Group" +COM_FIELDS_FIELD_HINT_DESC="The hint of the field, also called placeholder." +COM_FIELDS_FIELD_HINT_LABEL="Hint" +COM_FIELDS_FIELD_IMAGE_ALT_DESC="The alternate text for the image." +COM_FIELDS_FIELD_IMAGE_ALT_LABEL="Image Alternate Text" +COM_FIELDS_FIELD_IMAGE_DESC="Image label." +COM_FIELDS_FIELD_IMAGE_LABEL="Image" +COM_FIELDS_FIELD_LABEL_DESC="The label of the field to display." +COM_FIELDS_FIELD_LABEL_LABEL="Label" +COM_FIELDS_FIELD_LANGUAGE_DESC="Assign a language to this field." +COM_FIELDS_FIELD_NOTE_DESC="An optional note for the field." +COM_FIELDS_FIELD_NOTE_LABEL="Note" +COM_FIELDS_FIELD_PERMISSION_CREATE_DESC="New setting for create actions in this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_PERMISSION_DELETE_DESC="New setting for delete actions on this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_PERMISSION_EDITOWN_DESC="New setting for edit own actions on this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_PERMISSION_EDITSTATE_DESC="New setting for edit state actions on this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_PERMISSION_EDITVALUE_DESC="Who can edit the field value in the form editor." +COM_FIELDS_FIELD_PERMISSION_EDIT_DESC="New setting for edit actions on this field and the calculated setting based on the parent extension and group permissions." +COM_FIELDS_FIELD_PERMISSION_EDIT_VALUE_LABEL="Edit Field Value" +COM_FIELDS_FIELD_READONLY_DESC="Is the field read-only in the edit form." +COM_FIELDS_FIELD_READONLY_LABEL="Read-Only" +COM_FIELDS_FIELD_RENDER_CLASS_DESC="The class attributes of the field when the field is rendered. If different classes are needed, list them with spaces." +COM_FIELDS_FIELD_RENDER_CLASS_LABEL="Render Class" +COM_FIELDS_FIELD_REQUIRED_DESC="Is this a mandatory field?" +COM_FIELDS_FIELD_REQUIRED_LABEL="Required" +COM_FIELDS_FIELD_SHOW_ON_ADMIN="Administrator" +COM_FIELDS_FIELD_SHOW_ON_BOTH="Both" +COM_FIELDS_FIELD_SHOW_ON_DESC="On which part of the site should the field be shown." +COM_FIELDS_FIELD_SHOW_ON_LABEL="Show On" +COM_FIELDS_FIELD_SHOW_ON_SITE="Site" +COM_FIELDS_MUSTCONTAIN_A_TITLE_FIELD="Field must have a title." +COM_FIELDS_FIELD_TYPE_DESC="The type of the field." +COM_FIELDS_FIELD_TYPE_LABEL="Type" +COM_FIELDS_N_ITEMS_ARCHIVED="%d fields successfully archived" +COM_FIELDS_N_ITEMS_ARCHIVED_1="%d field successfully archived" +COM_FIELDS_N_ITEMS_CHECKED_IN_0="No field successfully checked in" +COM_FIELDS_N_ITEMS_CHECKED_IN_1="%d field successfully checked in" +COM_FIELDS_N_ITEMS_CHECKED_IN_MORE="%d fields successfully checked in" +COM_FIELDS_N_ITEMS_CREATED="%d fields successfully created in calendar %s" +COM_FIELDS_N_ITEMS_DELETED="%d fields successfully deleted" +COM_FIELDS_N_ITEMS_DELETED_1="%d field successfully deleted" +COM_FIELDS_N_ITEMS_PUBLISHED="%d fields successfully published" +COM_FIELDS_N_ITEMS_PUBLISHED_1="%d field successfully published" +COM_FIELDS_N_ITEMS_TRASHED="%d fields successfully trashed" +COM_FIELDS_N_ITEMS_TRASHED_1="%d field successfully trashed" +COM_FIELDS_N_ITEMS_UNPUBLISHED="%d fields successfully unpublished" +COM_FIELDS_N_ITEMS_UNPUBLISHED_1="%d field successfully unpublished" +COM_FIELDS_N_ITEMS_UPDATED="%d fields successfully updated in calendar %s" +COM_FIELDS_SYSTEM_PLUGIN_NOT_ENABLED="The Fields System Plugin is disabled. The custom fields will not display if you do not enable this plugin." +COM_FIELDS_TYPE_CALENDAR="Calendar" +COM_FIELDS_TYPE_CAPTCHA="CAPTCHA" +COM_FIELDS_TYPE_CHECKBOXES="Checkboxes" +COM_FIELDS_TYPE_COLOR="Colour" +COM_FIELDS_TYPE_EDITOR="Editor" +COM_FIELDS_TYPE_EMAIL="Email" +COM_FIELDS_TYPE_IMAGELIST="Image" +COM_FIELDS_TYPE_INTEGER="Integer" +COM_FIELDS_TYPE_LIST="List" +COM_FIELDS_TYPE_MEDIA="Media" +COM_FIELDS_TYPE_RADIO="Radio" +COM_FIELDS_TYPE_SQL="SQL" +COM_FIELDS_TYPE_TEL="Telephone" +COM_FIELDS_TYPE_TEXT="Text" +COM_FIELDS_TYPE_TEXTAREA="Textarea" +COM_FIELDS_TYPE_TIMEZONE="Timezone" +COM_FIELDS_TYPE_URL="URL" +COM_FIELDS_TYPE_USER="User" +COM_FIELDS_TYPE_USERGROUPLIST="Usergroup" +COM_FIELDS_VIEW_FIELDS_BASE_TITLE="Fields" +COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS="Batch process the selected fields." +COM_FIELDS_VIEW_FIELDS_SELECT_GROUP="- Select Field Group -" +COM_FIELDS_VIEW_FIELDS_SORT_TYPE_ASC="Type ascending" +COM_FIELDS_VIEW_FIELDS_SORT_TYPE_DESC="Type descending" +COM_FIELDS_VIEW_FIELDS_TITLE="%s Fields" +COM_FIELDS_VIEW_FIELD_ADD_TITLE="%s Fields: New" +COM_FIELDS_VIEW_FIELD_BASE_ADD_TITLE="Fields: New" +COM_FIELDS_VIEW_FIELD_BASE_EDIT_TITLE="Fields: Edit" +COM_FIELDS_VIEW_FIELD_EDIT_TITLE="%s Fields: Edit" +COM_FIELDS_VIEW_FIELD_FIELDSET_GENERAL="General" +COM_FIELDS_VIEW_FIELD_FIELDSET_PUBLISHING="Publishing" +COM_FIELDS_VIEW_FIELD_FIELDSET_RULES="Permissions" +COM_FIELDS_XML_DESCRIPTION="Component to manage custom fields." +JGLOBAL_ADD_CUSTOM_CATEGORY="Add new Group " +JGLOBAL_TYPE_OR_SELECT_CATEGORY="Type or select a Group" +JLIB_HTML_BATCH_MENU_LABEL="To Move or Copy your selection please select a Group." diff --git a/administrator/language/en-GB/en-GB.com_fields.sys.ini b/administrator/language/en-GB/en-GB.com_fields.sys.ini new file mode 100644 index 0000000000000..078f1cf37c1d3 --- /dev/null +++ b/administrator/language/en-GB/en-GB.com_fields.sys.ini @@ -0,0 +1,7 @@ +; Joomla! Project +; Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +COM_FIELDS="Fields" +COM_FIELDS_XML_DESCRIPTION="Component to manage custom fields." diff --git a/administrator/language/en-GB/en-GB.com_finder.ini b/administrator/language/en-GB/en-GB.com_finder.ini index c04593602906a..35217113c4187 100644 --- a/administrator/language/en-GB/en-GB.com_finder.ini +++ b/administrator/language/en-GB/en-GB.com_finder.ini @@ -38,7 +38,7 @@ COM_FINDER_CONFIG_MEMORY_TABLE_LIMIT_LABEL="Memory Table Limit" COM_FINDER_CONFIG_META_MULTIPLIER_DESCRIPTION="The multiplier is used to control how much influence matching text has on the overall relevance score of a search result. A multiplier is considered in relationship to the other multipliers. The meta data comes from a number of sources including the meta keywords and meta description, author names, etc." COM_FINDER_CONFIG_META_MULTIPLIER_LABEL="Meta Data Weight Multiplier" COM_FINDER_CONFIG_MISC_MULTIPLIER_DESCRIPTION="The multiplier is used to control how much influence matching text has on the overall relevance score of a search result. A multiplier is considered in relationship to the other multipliers. The miscellaneous text comes from a number of sources including comments and other associated data." -COM_FINDER_CONFIG_MISC_MULTIPLIER_LABEL="Miscellaneous Text Weight Multiplier" +COM_FINDER_CONFIG_MISC_MULTIPLIER_LABEL="Misc. Text Weight Multiplier" COM_FINDER_CONFIG_PATH_MULTIPLIER_DESCRIPTION="The multiplier is used to control how much influence matching text has on the overall relevance score of a search result. A multiplier is considered in relationship to the other multipliers. The path text comes from the SEF URL of the content." COM_FINDER_CONFIG_PATH_MULTIPLIER_LABEL="Path Text Weight Multiplier" COM_FINDER_CONFIG_SHOW_ADVANCED_DESC="Toggle if users should be able to see advanced search options." diff --git a/administrator/language/en-GB/en-GB.com_joomlaupdate.ini b/administrator/language/en-GB/en-GB.com_joomlaupdate.ini index 363a809e7382d..ded8bf033633d 100644 --- a/administrator/language/en-GB/en-GB.com_joomlaupdate.ini +++ b/administrator/language/en-GB/en-GB.com_joomlaupdate.ini @@ -33,7 +33,7 @@ COM_JOOMLAUPDATE_VIEW_COMPLETE_HEADING="Joomla Version Update Status" COM_JOOMLAUPDATE_VIEW_COMPLETE_MESSAGE="Your site has been successfully updated. Your Joomla version is now %s." COM_JOOMLAUPDATE_VIEW_DEFAULT_DOWNLOAD_IN_PROGRESS="Downloading update file. Please wait ..." COM_JOOMLAUPDATE_VIEW_DEFAULT_NO_DOWNLOAD_URL="We can't find a download URL" -COM_JOOMLAUPDATE_VIEW_DEFAULT_NO_DOWNLOAD_URL_DESC="An update to Joomla %1$s was found, but it wasn't possible to fetch the download URL for that update. There are two possibilities why this happens:
    - Your host doesn't support the minimum requirements for Joomla %1$s and there is no alternative download for your configuration available.
    - There is a problem with the Joomla Update Server.

    Please try to download the update package from the official Joomla download page and use the Upload and Update tab." +COM_JOOMLAUPDATE_VIEW_DEFAULT_NO_DOWNLOAD_URL_DESC="An update to Joomla %1$s was found, but it wasn't possible to fetch the download URL for that update. There are two possibilities why this happens:
    - Your host doesn't support the minimum requirements for Joomla %1$s and there is no alternative download for your configuration available.
    - There is a problem with the Joomla Update Server.

    Please try to download the update package from the official Joomla download page and use the Upload and Update tab." COM_JOOMLAUPDATE_VIEW_DEFAULT_NO_LIVE_UPDATE="Live Update is not available" COM_JOOMLAUPDATE_VIEW_DEFAULT_NO_LIVE_UPDATE_DESC="There is a new version of the Joomla Update Component that needs to be installed first. Click here to update the component." COM_JOOMLAUPDATE_VIEW_DEFAULT_FTP_DIRECTORY="FTP Root" diff --git a/administrator/language/en-GB/en-GB.com_menus.ini b/administrator/language/en-GB/en-GB.com_menus.ini index bf93bd7e647f2..fd62d4f5a8373 100644 --- a/administrator/language/en-GB/en-GB.com_menus.ini +++ b/administrator/language/en-GB/en-GB.com_menus.ini @@ -31,7 +31,7 @@ COM_MENUS_FIELD_VALUE_IGNORE="Ignore" COM_MENUS_FIELD_VALUE_NEW_WITH_NAV="New Window With Navigation" COM_MENUS_FIELD_VALUE_NEW_WITHOUT_NAV="New Without Navigation" COM_MENUS_FIELD_VALUE_PARENT="Parent" -COM_MENUS_FIELDSET_RULES="Menu Permissions" +COM_MENUS_FIELDSET_RULES="Permissions" COM_MENUS_GRID_UNSET_LANGUAGE="Unset %s Default" COM_MENUS_HEADING_ASSIGN_MODULE="Module" COM_MENUS_HEADING_ASSOCIATION="Association" @@ -151,6 +151,7 @@ COM_MENUS_MENU_TYPE_NOT_ALLOWED="This is a reserved menutype." COM_MENUS_MENUS_FILTER_SEARCH_DESC="Search in title and menu type." COM_MENUS_MENUS_FILTER_SEARCH_LABEL="Search Menus" COM_MENUS_PAGE_OPTIONS_LABEL="Page Display" +COM_MENUS_LABEL_HIDDEN="Hidden" ; in the following string ; %1$s is for module title, %2$s is for access-title, %3$s is for position COM_MENUS_MODULE_ACCESS_POSITION="%1$s (%2$s in %3$s)" diff --git a/administrator/language/en-GB/en-GB.com_modules.ini b/administrator/language/en-GB/en-GB.com_modules.ini index ca8ec8179c06a..bade25e68913c 100644 --- a/administrator/language/en-GB/en-GB.com_modules.ini +++ b/administrator/language/en-GB/en-GB.com_modules.ini @@ -67,7 +67,7 @@ COM_MODULES_FIELD_HEADER_CLASS_LABEL="Header Class" COM_MODULES_FIELD_HEADER_CLASS_DESC="The CSS class for module header/title." COM_MODULES_FIELD_MODULE_STYLE_LABEL="Module Style" COM_MODULES_FIELD_MODULE_STYLE_DESC="Use this option to override the template style for it's position." -COM_MODULES_FIELDSET_RULES="Module Permissions" +COM_MODULES_FIELDSET_RULES="Permissions" COM_MODULES_FILTER_SEARCH_DESC="Filter by position name." COM_MODULES_GENERAL_FIELDSET_DESC="Configure module edit interface settings." COM_MODULES_HEADING_MODULE="Type" diff --git a/administrator/language/en-GB/en-GB.com_newsfeeds.ini b/administrator/language/en-GB/en-GB.com_newsfeeds.ini index 3012b23de7b58..adcc0aad9b756 100644 --- a/administrator/language/en-GB/en-GB.com_newsfeeds.ini +++ b/administrator/language/en-GB/en-GB.com_newsfeeds.ini @@ -25,9 +25,9 @@ COM_NEWSFEEDS_FIELD_CACHETIME_DESC="The number of minutes before the news feed c COM_NEWSFEEDS_FIELD_CACHETIME_LABEL="Cache Time" COM_NEWSFEEDS_FIELD_CATEGORIES_OPTIONS_LABEL="Feeds Categories Display Options" COM_NEWSFEEDS_FIELD_CATEGORY_DESC="The category that this feed is assigned to." -COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC="Number of characters to display per feed." +COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC="Number of characters to display per feed. 0 will show all the text." COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_LABEL="Characters Count" -COM_NEWSFEEDS_FIELD_CHARACTERS_COUNT_DESC="Number of characters to include in the feed." +COM_NEWSFEEDS_FIELD_CHARACTERS_COUNT_DESC="Number of characters to include in the feed. 0 will show all the text." COM_NEWSFEEDS_FIELD_CHARACTERS_COUNT_LABEL="Characters Count" COM_NEWSFEEDS_FIELD_CONFIG_CATEGORY_SETTINGS_DESC="These settings apply for News Feeds Category Options unless they are changed for a specific menu item." COM_NEWSFEEDS_FIELD_CONFIG_LIST_SETTINGS_DESC="These settings apply for List Layout Options unless they are changed for a specific menu item." diff --git a/administrator/language/en-GB/en-GB.com_users.ini b/administrator/language/en-GB/en-GB.com_users.ini index 35bf474d7da87..10f7af5696eac 100644 --- a/administrator/language/en-GB/en-GB.com_users.ini +++ b/administrator/language/en-GB/en-GB.com_users.ini @@ -100,12 +100,12 @@ COM_USERS_FIELD_LOGIN_REDIRECT_PLACEHOLDER="index.php?Itemid=999&lang=en-GB" COM_USERS_FIELD_LOGIN_REDIRECT_CHOICE_DESC="'Internal URL' lets you manually enter any internal url in the Redirect field. 'Menu Item' lets you directly select an existing menu item.
    For a multilingual site, it is recommended to use 'Menu Item'." COM_USERS_FIELD_LOGIN_REDIRECT_CHOICE_LABEL="Choose Login Redirect Type" COM_USERS_FIELD_LOGIN_REDIRECT_ERROR="Only one of the login redirect fields should have a value." -COM_USERS_FIELD_LOGIN_REDIRECTMENU_DESC="Select the page the user will be redirected to after a successful login. Select from all the pages listed in the dropdown menu. Choosing "Default" will return to the same page." +COM_USERS_FIELD_LOGIN_REDIRECTMENU_DESC="Select or create the page the user will be redirected to after a successful login. The default is to remain on the same page." COM_USERS_FIELD_LOGIN_REDIRECTMENU_LABEL="Menu Item Login Redirect" COM_USERS_FIELD_LOGIN_URL="Internal URL" COM_USERS_FIELD_LOGOUT_REDIRECT_CHOICE_LABEL="Choose Logout Redirect Type" COM_USERS_FIELD_LOGOUT_REDIRECT_ERROR="Only one of the logout redirect fields should have a value." -COM_USERS_FIELD_LOGOUT_REDIRECTMENU_DESC="Select the page the user will be redirected to after successfully ending their current session by logging out. Select from all the pages listed in the dropdown menu. Choosing "Default" will return to the same page." +COM_USERS_FIELD_LOGOUT_REDIRECTMENU_DESC="Select or create the page the user will be redirected to after successfully ending their current session by logging out. The default is to remain on the same page." COM_USERS_FIELD_LOGOUT_REDIRECTMENU_LABEL="Menu Item Logout Redirect" COM_USERS_FIELD_NOTEBODY_DESC="Note" COM_USERS_FIELD_NOTEBODY_LABEL="Note" @@ -115,6 +115,9 @@ COM_USERS_FIELD_STATE_DESC="Set publication status." COM_USERS_FIELD_SUBJECT_DESC="The subject line for the note." COM_USERS_FIELD_SUBJECT_LABEL="Subject" COM_USERS_FIELD_USER_ID_LABEL="User" +COM_USERS_FIELDS_USER_FIELDS_TITLE="Users: Fields" +COM_USERS_FIELDS_USER_FIELD_ADD_TITLE="Users: New Field" +COM_USERS_FIELDS_USER_FIELD_EDIT_TITLE="Users: Edit Field" COM_USERS_FILTER_ACTIVE="- Select Active State -" COM_USERS_FILTER_COMPONENT_LABEL="Component" COM_USERS_FILTER_COMPONENT_DESC="Component to debug." @@ -369,3 +372,8 @@ COM_USERS_VIEW_NOTES_TITLE="User Notes" COM_USERS_VIEW_USERS_TITLE="Users" COM_USERS_XML_DESCRIPTION="Component for managing users" JLIB_RULES_SETTING_NOTES="Changes apply to this component only.
    Inherited - a Global Configuration setting or higher level setting is applied.
    Denied always wins - whatever is set at the Global or higher level and applies to all child elements.
    Allowed will enable the action for this component unless it is overruled by a Global Configuration setting." + +; Fields overrides +COM_USERS_USER_CATEGORIES_TITLE="Users: Field Groups" +COM_USERS_USER_CATEGORY_ADD_TITLE="Users: New Field Group" +COM_USERS_USER_CATEGORY_EDIT_TITLE="Users: Edit Field Group" diff --git a/administrator/language/en-GB/en-GB.ini b/administrator/language/en-GB/en-GB.ini index 20c2eb37e65af..ce8ef1bf54915 100644 --- a/administrator/language/en-GB/en-GB.ini +++ b/administrator/language/en-GB/en-GB.ini @@ -85,6 +85,7 @@ JUNFEATURE="Unfeature" JHELP="Help" JHIDE="Hide" JINVALID_TOKEN="The most recent request was denied because it contained an invalid security token. Please refresh the page and try again." +JINVALID_TOKEN_NOTICE="The security token did not match. The request was aborted to prevent any security breach. Please try again." JLOGIN="Log in" JLOGOUT="Log out" JMODIFY="Modify" @@ -114,6 +115,7 @@ JSITE="Site" JSUBMIT="Submit" JTAG="Tags" JTAG_DESC="Assign tags to content items. You may select a tag from the pre-defined list or enter a new tag by typing the name in the field and pressing enter." +JTAG_FIELD_SELECT_DESC="Select the tag to use." JTRASH="Trash" JTRASHED="Trashed" JTRUE="True" @@ -138,6 +140,8 @@ JACTION_EDIT="Edit" JACTION_EDIT_COMPONENT_DESC="Allows users in the group to edit any content in this extension." JACTION_EDITOWN="Edit Own" JACTION_EDITOWN_COMPONENT_DESC="Allows users in the group to edit any content they submitted in this extension." +JACTION_EDITVALUE="Edit Value" +JACTION_EDITVALUE_COMPONENT_DESC="Allows users in the group to edit any value of the item they submitted in this extension." JACTION_EDITSTATE="Edit State" JACTION_EDITSTATE_COMPONENT_DESC="Allows users in the group to change the state of any content in this extension." JACTION_LOGIN_ADMIN="Administrator Login" @@ -204,7 +208,7 @@ JFIELD_LOGOUT_IMAGE_DESC="Select or upload an image to display on logout page." JFIELD_LOGOUT_IMAGE_LABEL="Logout Image" JFIELD_LOGOUT_REDIRECT_URL_DESC="If a URL is entered here, users will be redirected to it after logout.
    The URL must be internal (eg: index.php?Itemid=999)." JFIELD_LOGOUT_REDIRECT_URL_LABEL="Logout Redirect" -JFIELD_LOGOUT_REDIRECT_PAGE_DESC="Select the page the user will be redirected to after successfully ending their current session by logging out. Select from all the pages listed in the dropdown menu. Choosing "Default" will return to the default page." +JFIELD_LOGOUT_REDIRECT_PAGE_DESC="Select or create the page the user will be redirected to after successfully ending their current session by logging out. The default is to remain on the same page." JFIELD_LOGOUT_REDIRECT_PAGE_LABEL="Logout Redirection Page" JFIELD_META_DESCRIPTION_DESC="An optional paragraph to be used as the description of the page in the HTML output. This will generally display in the results of search engines." JFIELD_META_DESCRIPTION_LABEL="Meta Description" @@ -261,7 +265,8 @@ JGLOBAL_ARTICLE_MANAGER_ORDER="Ordering" JGLOBAL_ARTICLE_ORDER_DESC="The order that articles will show in." JGLOBAL_ARTICLE_ORDER_LABEL="Article Order" JGLOBAL_ARTICLES="Articles" -JGLOBAL_ASSOC_NOT_POSSIBLE="To define associations, please first save this item and make sure its language is not set to 'All'." +JGLOBAL_ASSOC_NOT_POSSIBLE="To define associations, please make sure the item language is not set to 'All'." +JGLOBAL_ASSOCIATIONS_RESET_WARNING="The language has been changed. If you save this item again it will reset the available associations. If this was not intended, just close the item." JGLOBAL_AUTH_ACCESS_DENIED="Access Denied" JGLOBAL_AUTH_ACCESS_GRANTED="Access Granted" JGLOBAL_AUTH_BIND_FAILED="Failed binding to LDAP server" @@ -326,10 +331,12 @@ JGLOBAL_FEED_SHOW_READMORE_DESC="Displays a "Read More" link in the ne JGLOBAL_FEED_SHOW_READMORE_LABEL="Show "Read More"" JGLOBAL_FEED_SUMMARY_DESC="If set to Intro Text, only the Intro Text of each article will show in the news feed. If set to Full Text, the whole article will show in the news feed." JGLOBAL_FEED_SUMMARY_LABEL="For each feed item show" +JGLOBAL_FIELDS="Fields" +JGLOBAL_FIELD_GROUPS="Field Groups" JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC="Categories that are within this category will be displayed." JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL="Select a Top Level Category" -JGLOBAL_FIELD_CATEGORIES_DESC_DESC="If you enter some text in this field, it will override the Top Level Category Description, if it has one." -JGLOBAL_FIELD_CATEGORIES_DESC_LABEL="Top Level Category Description" +JGLOBAL_FIELD_CATEGORIES_DESC_DESC="If you enter some text in this field, it will replace the Top Level Category Description, if it has one." +JGLOBAL_FIELD_CATEGORIES_DESC_LABEL="Alternative Description" JGLOBAL_FIELD_CREATED_BY_ALIAS_DESC="Uses another name than the author's for display." JGLOBAL_FIELD_CREATED_BY_ALIAS_LABEL="Author's Alias" JGLOBAL_FIELD_CREATED_BY_DESC="The user who created this." @@ -352,7 +359,7 @@ JGLOBAL_FIELD_PUBLISH_DOWN_DESC="An optional date to stop publishing." JGLOBAL_FIELD_PUBLISH_DOWN_LABEL="Finish Publishing" JGLOBAL_FIELD_PUBLISH_UP_DESC="An optional date to start publishing." JGLOBAL_FIELD_PUBLISH_UP_LABEL="Start Publishing" -JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC="Show description of the top level category or optionally override with the text from the description field found in menu item. If using Root as top level category, the description field has to be filled." +JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC="Show description of the top level category or alternatively replace with the text from the description field found in the menu item. If using Root as a top level category, the description field has to be filled." JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL="Top Level Category Description" JGLOBAL_FIELD_VERSION_NOTE_DESC="Enter an optional note for this version of the item." JGLOBAL_FIELD_VERSION_NOTE_LABEL="Version Note" @@ -490,6 +497,8 @@ JGLOBAL_SEF_ADVANCED_LEGACY="Legacy" JGLOBAL_SEF_ADVANCED_MODERN="Modern" JGLOBAL_SEF_NOIDS_DESC="Remove the IDs from the URLs of this component." JGLOBAL_SEF_NOIDS_LABEL="Remove IDs from URLs" +JGLOBAL_CUSTOM_FIELDS_ENABLE_DESC="Enable the creation of custom fields." +JGLOBAL_CUSTOM_FIELDS_ENABLE_LABEL="Create Custom Fields" JGLOBAL_SELECT_ALLOW_DENY_GROUP="Change %s permission for %s group." JGLOBAL_SELECT_AN_OPTION="Select an option" JGLOBAL_SELECT_NO_RESULTS_MATCH="No results match" @@ -585,6 +594,7 @@ JGLOBAL_TPL_CPANEL_LINK_TEXT="Return to Control Panel" JGLOBAL_TYPE_OR_SELECT_CATEGORY="Type or Select a Category" JGLOBAL_TYPE_OR_SELECT_SOME_OPTIONS="Type or select some options" JGLOBAL_USE_GLOBAL="Use Global" +JGLOBAL_USE_GLOBAL_VALUE="Use Global (%s)" JGLOBAL_USERNAME="Username" JGLOBAL_VALIDATION_FORM_FAILED="Invalid form" JGLOBAL_VIEW_SITE="View Site" diff --git a/administrator/language/en-GB/en-GB.lib_joomla.ini b/administrator/language/en-GB/en-GB.lib_joomla.ini index a10aeb29e6857..c279f8dfa9217 100644 --- a/administrator/language/en-GB/en-GB.lib_joomla.ini +++ b/administrator/language/en-GB/en-GB.lib_joomla.ini @@ -233,6 +233,7 @@ JLIB_DATABASE_QUERY_FAILED="Database query failed (error # %s): %s" JLIB_DOCUMENT_ERROR_UNABLE_LOAD_DOC_CLASS="Unable to load document class." JLIB_ENVIRONMENT_SESSION_EXPIRED="Your session has expired. Please log in again." JLIB_ENVIRONMENT_SESSION_INVALID="Invalid session cookie. Please check that you have cookies enabled in your web browser." +JLIB_ERROR_COMPONENTS_ACL_CONFIGURATION_FILE_MISSING_OR_IMPROPERLY_STRUCTURED="The %s component's ACL configuration file is either missing or improperly structured." JLIB_ERROR_INFINITE_LOOP="Infinite loop detected in JError." JLIB_EVENT_ERROR_DISPATCHER="JEventDispatcher: :register: Event handler not recognised. Handler: %s" JLIB_FILESYSTEM_BZIP_NOT_SUPPORTED="BZip2 Not Supported." @@ -306,6 +307,60 @@ JLIB_FORM_ERROR_NO_DATA="No data." JLIB_FORM_ERROR_VALIDATE_FIELD="Invalid xml field." JLIB_FORM_ERROR_XML_FILE_DID_NOT_LOAD="XML file did not load." JLIB_FORM_FIELD_INVALID="Invalid field: " +JLIB_FORM_FIELD_PARAM_CALENDAR_FORMAT_DESC="The date format to be used. This is in the format used by PHP to specify date string formats (see below). If no format argument is given, '%Y-%m-%d' is assumed (giving dates like '2008-04-16')." +JLIB_FORM_FIELD_PARAM_CALENDAR_FORMAT_LABEL="Format" +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_DESC="Allow multiple values to be selected." +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_LABEL="Multiple" +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_DESC="The options of the checkbox list" +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_NAME_LABEL="Text" +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_LABEL="Checkbox options" +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_VALUE_LABEL="Value" +JLIB_FORM_FIELD_PARAM_EDITOR_BUTTONS_HIDE_DESC="Hide the buttons in the comma separated list." +JLIB_FORM_FIELD_PARAM_EDITOR_BUTTONS_HIDE_LABEL="Hide Buttons" +JLIB_FORM_FIELD_PARAM_EDITOR_HEIGHT_DESC="Defines the height (in pixels) of the WYSIWYG editor and defaults to 250px." +JLIB_FORM_FIELD_PARAM_EDITOR_HEIGHT_LABEL="Height" +JLIB_FORM_FIELD_PARAM_EDITOR_SHOW_BUTTONS_DESC="Should the buttons being shown." +JLIB_FORM_FIELD_PARAM_EDITOR_SHOW_BUTTONS_LABEL="Show Buttons" +JLIB_FORM_FIELD_PARAM_EDITOR_WIDTH_DESC="Defines the width (in pixels) of the WYSIWYG editor and defaults to 100%." +JLIB_FORM_FIELD_PARAM_EDITOR_WIDTH_LABEL="Width" +JLIB_FORM_FIELD_PARAM_IMAGELIST_DIRECTORY_DESC="The filesystem path to the directory containing the image files to be listed." +JLIB_FORM_FIELD_PARAM_IMAGELIST_DIRECTORY_LABEL="Directory" +JLIB_FORM_FIELD_PARAM_INTEGER_FIRST_DESC="This value is the lowest on the list." +JLIB_FORM_FIELD_PARAM_INTEGER_FIRST_LABEL="First" +JLIB_FORM_FIELD_PARAM_INTEGER_LAST_DESC="This value is the highest on the list." +JLIB_FORM_FIELD_PARAM_INTEGER_LAST_LABEL="Last" +JLIB_FORM_FIELD_PARAM_INTEGER_STEP_DESC="Each option will be the previous option incremented by this integer, starting with the first value until the last value is reached." +JLIB_FORM_FIELD_PARAM_INTEGER_STEP_LABEL="Step" +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_DESC="Allow multiple values to be selected." +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_LABEL="Multiple" +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_DESC="The options of the list." +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_LABEL="List options" +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_VALUE_LABEL="Value" +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_NAME_LABEL="Text" +JLIB_FORM_FIELD_PARAM_MEDIA_IMAGE_CLASS_DESC="The class which is added to the image (src tag)." +JLIB_FORM_FIELD_PARAM_MEDIA_IMAGE_CLASS_LABEL="Image Class" +JLIB_FORM_FIELD_PARAM_MEDIA_PREVIEW_DESC="Shows or hides the preview of the selected image." +JLIB_FORM_FIELD_PARAM_MEDIA_PREVIEW_INLINE="Inline" +JLIB_FORM_FIELD_PARAM_MEDIA_PREVIEW_LABEL="Preview" +JLIB_FORM_FIELD_PARAM_MEDIA_PREVIEW_TOOLTIP="Tooltip" +JLIB_FORM_FIELD_PARAM_MEDIA_HOME_LABEL="Home Directory" +JLIB_FORM_FIELD_PARAM_MEDIA_HOME_DESC="Should the directory with the files point to a user directory." +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_DESC="Allow multiple values to be selected." +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_LABEL="Multiple" +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_DESC="The options of the radio list." +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_NAME_LABEL="Text" +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_LABEL="Radio options" +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_VALUE_LABEL="Value" +JLIB_FORM_FIELD_PARAM_SQL_QUERY_DESC="The SQL query which will provide the data for the drop-down list. The query must return two columns; one called 'value' which will hold the values of the list items; the other called 'text' containing the text in the drop-down list." +JLIB_FORM_FIELD_PARAM_SQL_QUERY_LABEL="Query" +JLIB_FORM_FIELD_PARAM_TEXTAREA_COLS_DESC="The number of columns of the field." +JLIB_FORM_FIELD_PARAM_TEXTAREA_COLS_LABEL="Columns" +JLIB_FORM_FIELD_PARAM_TEXTAREA_ROWS_DESC="The number of rows of the field." +JLIB_FORM_FIELD_PARAM_TEXTAREA_ROWS_LABEL="Rows" +JLIB_FORM_FIELD_PARAM_URL_RELATIVE_DESC="Are relative URLs allowed." +JLIB_FORM_FIELD_PARAM_URL_RELATIVE_LABEL="Relative" +JLIB_FORM_FIELD_PARAM_URL_SCHEMES_DESC="The allowed schemes." +JLIB_FORM_FIELD_PARAM_URL_SCHEMES_LABEL="Schemes" JLIB_FORM_INPUTMODE="latin" JLIB_FORM_INVALID_FORM_OBJECT="Invalid Form Object: :%s" JLIB_FORM_INVALID_FORM_RULE="Invalid Form Rule: :%s" diff --git a/administrator/language/en-GB/en-GB.mod_menu.ini b/administrator/language/en-GB/en-GB.mod_menu.ini index acfedd1af8d5c..3daab0d814d09 100644 --- a/administrator/language/en-GB/en-GB.mod_menu.ini +++ b/administrator/language/en-GB/en-GB.mod_menu.ini @@ -42,6 +42,8 @@ MOD_MENU_FIELD_SHOWHELP="Help Menu" MOD_MENU_FIELD_SHOWHELP_DESC="Show or hide the Help menu which includes links to various joomla.org sites useful to users." MOD_MENU_FIELD_SHOWNEW="Add New Shortcuts" MOD_MENU_FIELD_SHOWNEW_DESC="Show or hide various 'Add New ...' shortcuts against users, groups, access levels, articles and categories." +MOD_MENU_FIELDS="Fields" +MOD_MENU_FIELDS_GROUP="Field Groups" MOD_MENU_GLOBAL_CHECKIN="Global Check-in" MOD_MENU_HELP="Help" MOD_MENU_HELP_COMMUNITY="Community Portal" diff --git a/administrator/language/en-GB/en-GB.plg_fields_gallery.ini b/administrator/language/en-GB/en-GB.plg_fields_gallery.ini new file mode 100644 index 0000000000000..cd23998a6e6b1 --- /dev/null +++ b/administrator/language/en-GB/en-GB.plg_fields_gallery.ini @@ -0,0 +1,22 @@ +; Joomla! Project +; Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +COM_FIELDS_TYPE_GALLERY="Gallery" + +PLG_FIELDS_GALLERY="Fields - Gallery" +PLG_FIELDS_GALLERY_DIRECTORY_LABEL="Directory" +PLG_FIELDS_GALLERY_DIRECTORY_DESC="The filesystem path to the directory containing the image files to be listed." +PLG_FIELDS_GALLERY_IMAGE_ERROR="Error precessing the image %s: %s" +PLG_FIELDS_GALLERY_MAX_WIDTH_LABEL="Max Width" +PLG_FIELDS_GALLERY_MAX_WIDTH_DESC="The maximum width of the image. The image will be resized on the fly." +PLG_FIELDS_GALLERY_MAX_HEIGHT_LABEL="Max Height" +PLG_FIELDS_GALLERY_MAX_HEIGHT_DESC="The maximum height of the image. The image will be resized on the fly." +PLG_FIELDS_GALLERY_MULTIPLE_LABEL="Multiple" +PLG_FIELDS_GALLERY_MULTIPLE_DESC="Allow multiple values to be selected." +PLG_FIELDS_GALLERY_RECURSIVE_LABEL="Recursive" +PLG_FIELDS_GALLERY_RECURSIVE_DESC="Should the images from the subfolders also be included." +PLG_FIELDS_GALLERY_THUMBNAIL_WIDTH_LABEL="Thumbnail Width" +PLG_FIELDS_GALLERY_THUMBNAIL_WIDTH_DESC="The width of the thumbnails. The thumbnails will be resized on the fly." +PLG_FIELDS_GALLERY_XML_DESCRIPTION="The Gallery Fields plugin." diff --git a/administrator/language/en-GB/en-GB.plg_fields_gallery.sys.ini b/administrator/language/en-GB/en-GB.plg_fields_gallery.sys.ini new file mode 100644 index 0000000000000..714683dc737b4 --- /dev/null +++ b/administrator/language/en-GB/en-GB.plg_fields_gallery.sys.ini @@ -0,0 +1,7 @@ +; Joomla! Project +; Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +PLG_FIELDS_GALLERY="Fields - Gallery" +PLG_FIELDS_GALLERY_XML_DESCRIPTION="The Gallery Fields plugin." diff --git a/administrator/language/en-GB/en-GB.plg_system_fields.ini b/administrator/language/en-GB/en-GB.plg_system_fields.ini new file mode 100644 index 0000000000000..892771f41cbe4 --- /dev/null +++ b/administrator/language/en-GB/en-GB.plg_system_fields.ini @@ -0,0 +1,12 @@ +; Joomla! Project +; Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +PLG_SYSTEM_FIELDS="System - Fields" +PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_AFTER_DISPLAY="After Display" +PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_AFTER_TITLE="After Title" +PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_BEFORE_DISPLAY="Before Display" +PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_DESC="Joomla offers several content events which are triggered during the content creation process. Here you can define how the custom fields should be integrated into content." +PLG_SYSTEM_FIELDS_CONFIG_DISPLAY_LABEL="Automatic Display" +PLG_SYSTEM_FIELDS_XML_DESCRIPTION="The system fields plugin lets you display the custom fields." diff --git a/administrator/language/en-GB/en-GB.plg_system_fields.sys.ini b/administrator/language/en-GB/en-GB.plg_system_fields.sys.ini new file mode 100644 index 0000000000000..12dca887f3148 --- /dev/null +++ b/administrator/language/en-GB/en-GB.plg_system_fields.sys.ini @@ -0,0 +1,7 @@ +; Joomla! Project +; Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +PLG_SYSTEM_FIELDS="System - Fields" +PLG_SYSTEM_FIELDS_XML_DESCRIPTION="The system fields plugin lets you display the custom fields." diff --git a/administrator/language/en-GB/en-GB.plg_system_sef.ini b/administrator/language/en-GB/en-GB.plg_system_sef.ini index 3ebd7be2fdc94..2af8f4f1f81ea 100644 --- a/administrator/language/en-GB/en-GB.plg_system_sef.ini +++ b/administrator/language/en-GB/en-GB.plg_system_sef.ini @@ -6,4 +6,4 @@ PLG_SEF_XML_DESCRIPTION="Adds SEF support to links in the document. It operates directly on the HTML and does not require a special tag." PLG_SYSTEM_SEF="System - SEF" PLG_SEF_DOMAIN_LABEL="Site Domain" -PLG_SEF_DOMAIN_DESCRIPTION="If your site can be accessed through more than one domain enter the canonical one here." +PLG_SEF_DOMAIN_DESCRIPTION="If your site can be accessed through more than one domain enter the preferred (sometimes referred to as canonical) domain here.
    Note: https://example.com and https://www.example.com are different domains." \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.plg_twofactorauth_totp.ini b/administrator/language/en-GB/en-GB.plg_twofactorauth_totp.ini index c13b21b58a6cc..eda7cf20bae3b 100644 --- a/administrator/language/en-GB/en-GB.plg_twofactorauth_totp.ini +++ b/administrator/language/en-GB/en-GB.plg_twofactorauth_totp.ini @@ -5,7 +5,7 @@ PLG_TWOFACTORAUTH_TOTP="Two Factor Authentication - Google Authenticator" PLG_TWOFACTORAUTH_TOTP_ERR_VALIDATIONFAILED="You did not enter a valid security code. Please check your Google Authenticator setup and make sure that the time on your device matches the time on the site." -PLG_TWOFACTORAUTH_TOTP_INTRO="This feature allows you to use Google Authenticator, or a compatible application, for two factor authentication. In addition to your username and password you will also need to provide a six digit security code generated by Google Authenticator to be able to login to this site. The security code is rotated every 30 seconds. This provides extra protection against hackers logging in to your account even if they were able to get hold of your password." +PLG_TWOFACTORAUTH_TOTP_INTRO="This feature allows you to use Google Authenticator, or a compatible application such as FreeOTP, for two factor authentication. In addition to your username and password you will also need to provide a six digit security code to be able to login to this site. The security code is rotated every 30 seconds. This provides extra protection against hackers logging in to your account even if they were able to get hold of your password." PLG_TWOFACTORAUTH_TOTP_METHOD_TITLE="Google Authenticator" PLG_TWOFACTORAUTH_TOTP_POSTINSTALL_TITLE="Two Factor Authentication is Available" PLG_TWOFACTORAUTH_TOTP_POSTINSTALL_BODY="Joomla! comes with a built-in two factor authentication system. It secures your site login with a secondary secret code that's changing every 30 seconds. You can use your mobile device and the Google Authenticator app to produce that code.
    By selecting the button below:
    • Joomla! will enable the two factor authentication plugins
    • Two Factor Authentication is going to be available for all users.
    • Each user can configure Two Factor Authentication in User Details.
    • You can always disable Two Factor Authentication plugin, or configure it for Backend usage only.
    • You will be taken to your user profile page where you can find more information on two factor authentication and enable it for your user account.
    " @@ -22,7 +22,7 @@ PLG_TWOFACTORAUTH_TOTP_STEP1_ITEM1_LINK="https://support.google.com/accounts/bin PLG_TWOFACTORAUTH_TOTP_STEP1_ITEM2="Compatible clients for other devices and operating system (listed in Wikipedia)." ; Change and check this link if there is a translation in your language available. (current: German, Spanish, French, Japanese, Polish) PLG_TWOFACTORAUTH_TOTP_STEP1_ITEM2_LINK="https://en.wikipedia.org/wiki/Google_Authenticator#Implementation" -PLG_TWOFACTORAUTH_TOTP_STEP1_TEXT="Download and install Google Authenticator, or a compatible application, on your smartphone or desktop. Use one of the following:" +PLG_TWOFACTORAUTH_TOTP_STEP1_TEXT="Download and install Google Authenticator, or a compatible application such as FreeOTP, on your smartphone or desktop. Use one of the following:" PLG_TWOFACTORAUTH_TOTP_STEP1_WARN="Please remember to sync your device's clock with a time-server. Time drift in your device may cause an inability to log in to your site." PLG_TWOFACTORAUTH_TOTP_STEP2_ACCOUNT="Account" PLG_TWOFACTORAUTH_TOTP_STEP2_ALTTEXT="Alternatively, you can scan the following QR code in Google Authenticator." @@ -33,4 +33,4 @@ PLG_TWOFACTORAUTH_TOTP_STEP2_TEXT="You will need to enter the following informat PLG_TWOFACTORAUTH_TOTP_STEP3_HEAD="Step 3 - Activate Two Factor Authentication" PLG_TWOFACTORAUTH_TOTP_STEP3_SECURITYCODE="Security Code" PLG_TWOFACTORAUTH_TOTP_STEP3_TEXT="In order to verify that everything is set up properly, please enter the security code displayed in Google Authenticator in the field below and select the button. If the code is correct, the Two Factor Authentication feature will be enabled." -PLG_TWOFACTORAUTH_TOTP_XML_DESCRIPTION="Allows users on your site to use two factor authentication using Google Authenticator or other compatible time-based One Time Password generators. To use two factor authentication please edit the user profile and enable two factor authentication." +PLG_TWOFACTORAUTH_TOTP_XML_DESCRIPTION="Allows users on your site to use two factor authentication using Google Authenticator Google Authenticator or other compatible time-based One Time Password generators such as FreeOTP. To use two factor authentication please edit the user profile and enable two factor authentication." diff --git a/administrator/language/en-GB/en-GB.plg_twofactorauth_totp.sys.ini b/administrator/language/en-GB/en-GB.plg_twofactorauth_totp.sys.ini index 11c5186181b7d..2dd79dc4d1e57 100644 --- a/administrator/language/en-GB/en-GB.plg_twofactorauth_totp.sys.ini +++ b/administrator/language/en-GB/en-GB.plg_twofactorauth_totp.sys.ini @@ -4,4 +4,4 @@ ; Note : All ini files need to be saved as UTF-8 PLG_TWOFACTORAUTH_TOTP="Two Factor Authentication - Google Authenticator" -PLG_TWOFACTORAUTH_TOTP_XML_DESCRIPTION="Allows users on your site to use two factor authentication using Google Authenticator or other compatible time-based One Time Password generators. To use two factor authentication please edit the user profile and enable two factor authentication." +PLG_TWOFACTORAUTH_TOTP_XML_DESCRIPTION="Allows users on your site to use two factor authentication using Google Authenticator Google Authenticator or other compatible time-based One Time Password generators such as FreeOTP. To use two factor authentication please edit the user profile and enable two factor authentication." \ No newline at end of file diff --git a/administrator/modules/mod_menu/tmpl/default_enabled.php b/administrator/modules/mod_menu/tmpl/default_enabled.php index c1d8f7a5f3c4d..213c8f8800e38 100644 --- a/administrator/modules/mod_menu/tmpl/default_enabled.php +++ b/administrator/modules/mod_menu/tmpl/default_enabled.php @@ -112,6 +112,19 @@ $menu->getParent(); } + if (JComponentHelper::isEnabled('com_fields') && JComponentHelper::getParams('com_users')->get('custom_fields_enable', '1')) + { + $menu->addChild( + new JMenuNode( + JText::_('MOD_MENU_FIELDS'), 'index.php?option=com_fields&context=com_users.user', 'class:fields') + ); + + $menu->addChild( + new JMenuNode( + JText::_('MOD_MENU_FIELDS_GROUP'), 'index.php?option=com_categories&extension=com_users.user.fields', 'class:category') + ); + } + if (JFactory::getApplication()->get('massmailoff') != 1) { $menu->addSeparator(); @@ -232,6 +245,19 @@ $menu->getParent(); } + if (JComponentHelper::isEnabled('com_fields') && JComponentHelper::getParams('com_content')->get('custom_fields_enable', '1')) + { + $menu->addChild( + new JMenuNode( + JText::_('MOD_MENU_FIELDS'), 'index.php?option=com_fields&context=com_content.article', 'class:fields') + ); + + $menu->addChild( + new JMenuNode( + JText::_('MOD_MENU_FIELDS_GROUP'), 'index.php?option=com_categories&extension=com_content.article.fields', 'class:category') + ); + } + $menu->addChild(new JMenuNode(JText::_('MOD_MENU_COM_CONTENT_FEATURED'), 'index.php?option=com_content&view=featured', 'class:featured')); if ($user->authorise('core.manage', 'com_media')) diff --git a/administrator/templates/hathor/component.php b/administrator/templates/hathor/component.php index 5d9d4dea96da1..71f2ef6bec923 100644 --- a/administrator/templates/hathor/component.php +++ b/administrator/templates/hathor/component.php @@ -25,14 +25,20 @@ // jQuery needed by template.js JHtml::_('jquery.framework'); +// Add template js +JHtml::_('script', 'template.js', array('version' => 'auto', 'relative' => true)); + +// Add html5 shiv +JHtml::_('script', 'jui/html5.js', array('version' => 'auto', 'relative' => true, 'conditional' => 'lt IE 9')); + // Load optional RTL Bootstrap CSS JHtml::_('bootstrap.loadCss', false, $this->direction); // Load system style CSS -$this->addStyleSheet($this->baseurl . '/templates/system/css/system.css'); +JHtml::_('stylesheet', 'templates/system/css/system.css', array('version' => 'auto')); // Loadtemplate CSS -$this->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template.css'); +JHtml::_('stylesheet', 'template.css', array('version' => 'auto', 'relative' => true)); // Load additional CSS styles for colors if (!$this->params->get('colourChoice')) @@ -44,39 +50,30 @@ $colour = htmlspecialchars($this->params->get('colourChoice')); } -$this->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/colour_' . $colour . '.css'); - -// Load specific language related CSS -$file = 'language/' . $lang->getTag() . '/' . $lang->getTag() . '.css'; - -if (is_file($file)) -{ - $this->addStyleSheet($file); -} +JHtml::_('stylesheet', 'colour_' . $colour . '.css', array('version' => 'auto', 'relative' => true)); // Load additional CSS styles for rtl sites -if ($this->direction == 'rtl') +if ($this->direction === 'rtl') { - $this->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template_rtl.css'); - $this->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/colour_' . $colour . '_rtl.css'); -} - -// Load specific language related CSS -$file = 'language/' . $lang->getTag() . '/' . $lang->getTag().'.css'; - -if (JFile::exists($file)) -{ - $this->addStyleSheet($file); + JHtml::_('stylesheet', 'template_rtl.css', array('version' => 'auto', 'relative' => true)); + JHtml::_('stylesheet', 'colour_' . $colour . '_rtl.css', array('version' => 'auto', 'relative' => true)); } // Load additional CSS styles for bold Text if ($this->params->get('boldText')) { - $this->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/boldtext.css'); + JHtml::_('stylesheet', 'boldtext.css', array('version' => 'auto', 'relative' => true)); } -// Load template javascript -$this->addScriptVersion($this->baseurl . '/templates/' . $this->template . '/js/template.js'); +// Load specific language related CSS +JHtml::_('stylesheet', 'language/' . $lang->getTag() . '/' . $lang->getTag() . '.css', array('version' => 'auto', 'relative' => true)); + +// Load custom.css +JHtml::_('stylesheet', 'custom.css', array('version' => 'auto', 'relative' => true)); + +// IE specific +JHtml::_('stylesheet', 'ie8.css', array('version' => 'auto', 'relative' => true, 'conditional' => 'IE 8')); +JHtml::_('stylesheet', 'ie7.css', array('version' => 'auto', 'relative' => true, 'conditional' => 'IE 7')); // Logo file if ($this->params->get('logoFile')) @@ -93,7 +90,6 @@ - diff --git a/administrator/templates/hathor/cpanel.php b/administrator/templates/hathor/cpanel.php index c4657cc35aaf3..152f6b2c8b3d4 100644 --- a/administrator/templates/hathor/cpanel.php +++ b/administrator/templates/hathor/cpanel.php @@ -17,14 +17,20 @@ // Output as HTML5 $this->setHtml5(true); +// Add template js +JHtml::_('script', 'template.js', array('version' => 'auto', 'relative' => true)); + +// Add html5 shiv +JHtml::_('script', 'jui/html5.js', array('version' => 'auto', 'relative' => true, 'conditional' => 'lt IE 9')); + // Load optional RTL Bootstrap CSS JHtml::_('bootstrap.loadCss', false, $this->direction); // Load system style CSS -$this->addStyleSheet($this->baseurl . '/templates/system/css/system.css'); +JHtml::_('stylesheet', 'templates/system/css/system.css', array('version' => 'auto')); // Load template CSS -$this->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template.css'); +JHtml::_('stylesheet', 'template.css', array('version' => 'auto', 'relative' => true)); // Load additional CSS styles for colors if (!$this->params->get('colourChoice')) @@ -36,39 +42,30 @@ $colour = htmlspecialchars($this->params->get('colourChoice')); } -$this->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/colour_' . $colour . '.css'); - -// Load specific language related CSS -$file = 'language/' . $lang->getTag() . '/' . $lang->getTag() . '.css'; - -if (is_file($file)) -{ - $this->addStyleSheet($file); -} +JHtml::_('stylesheet', 'colour_' . $colour . '.css', array('version' => 'auto', 'relative' => true)); // Load additional CSS styles for rtl sites -if ($this->direction == 'rtl') +if ($this->direction === 'rtl') { - $this->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template_rtl.css'); - $this->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/colour_' . $colour . '_rtl.css'); -} - -// Load specific language related CSS -$file = 'language/' . $lang->getTag() . '/' . $lang->getTag() . '.css'; - -if (JFile::exists($file)) -{ - $this->addStyleSheet($file); + JHtml::_('stylesheet', 'template_rtl.css', array('version' => 'auto', 'relative' => true)); + JHtml::_('stylesheet', 'colour_' . $colour . '_rtl.css', array('version' => 'auto', 'relative' => true)); } // Load additional CSS styles for bold Text if ($this->params->get('boldText')) { - $this->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/boldtext.css'); + JHtml::_('stylesheet', 'boldtext.css', array('version' => 'auto', 'relative' => true)); } -// Load template javascript -$this->addScriptVersion($this->baseurl . '/templates/' . $this->template . '/js/template.js'); +// Load specific language related CSS +JHtml::_('stylesheet', 'language/' . $lang->getTag() . '/' . $lang->getTag() . '.css', array('version' => 'auto', 'relative' => true)); + +// Load custom.css +JHtml::_('stylesheet', 'custom.css', array('version' => 'auto', 'relative' => true)); + +// IE specific +JHtml::_('stylesheet', 'ie8.css', array('version' => 'auto', 'relative' => true, 'conditional' => 'IE 8')); +JHtml::_('stylesheet', 'ie7.css', array('version' => 'auto', 'relative' => true, 'conditional' => 'IE 7')); // Logo file if ($this->params->get('logoFile')) @@ -85,9 +82,6 @@ - - -
    diff --git a/administrator/templates/hathor/css/template.css b/administrator/templates/hathor/css/template.css index 3596ae65fd925..b8df04371aace 100644 --- a/administrator/templates/hathor/css/template.css +++ b/administrator/templates/hathor/css/template.css @@ -1667,7 +1667,7 @@ p.tab-description { float: left; } #form-login { - float: right; + float: left; padding: 1.1em; -moz-border-radius: 3px; -webkit-border-radius: 3px; @@ -3593,6 +3593,7 @@ div#database-sliders { fieldset.uploadform { margin-top: 10px; margin-bottom: 10px; + min-height: 200px; } #installer-database, #installer-discover, @@ -3937,3 +3938,6 @@ div.toggle-editor { .muted { color: #999; } +.popover-content { + min-height: 33px; +} diff --git a/administrator/templates/hathor/css/template_rtl.css b/administrator/templates/hathor/css/template_rtl.css index 0f379de028ea0..b3c5c60164a5a 100644 --- a/administrator/templates/hathor/css/template_rtl.css +++ b/administrator/templates/hathor/css/template_rtl.css @@ -1319,4 +1319,7 @@ div.toggle-editor { } .modal-footer button { float: left; +} +#form-login { + float: right; } \ No newline at end of file diff --git a/administrator/templates/hathor/html/com_config/application/default_mail.php b/administrator/templates/hathor/html/com_config/application/default_mail.php index 21163c5d35b61..369bf61d707cf 100644 --- a/administrator/templates/hathor/html/com_config/application/default_mail.php +++ b/administrator/templates/hathor/html/com_config/application/default_mail.php @@ -8,7 +8,9 @@ */ defined('_JEXEC') or die; -JHtml::script('system/sendtestmail.js', false, true); + +JHtml::_('script', 'system/sendtestmail.js', array('version' => 'auto', 'relative' => true)); + JFactory::getDocument()->addScriptDeclaration(' var sendtestmail_url = "' . addslashes(JUri::base()) . 'index.php?option=com_config&task=config.sendtestmail.application&format=json&' . JSession::getFormToken() . '=1"; '); diff --git a/administrator/templates/hathor/html/com_joomlaupdate/default/default.php b/administrator/templates/hathor/html/com_joomlaupdate/default/default.php index 3e4f93eeb11e1..14079827d275c 100644 --- a/administrator/templates/hathor/html/com_joomlaupdate/default/default.php +++ b/administrator/templates/hathor/html/com_joomlaupdate/default/default.php @@ -9,180 +9,71 @@ defined('_JEXEC') or die; -$ftpFieldsDisplay = $this->ftp['enabled'] ? '' : 'style = "display: none"'; -$params = JComponentHelper::getParams('com_joomlaupdate'); - -switch ($params->get('updatesource', 'default')) -{ - // "Minor & Patch Release for Current version AND Next Major Release". - case 'sts': - case 'next': - $langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_NEXT'; - $updateSourceKey = JText::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_NEXT'); - break; - - // "Testing" - case 'testing': - $langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_TESTING'; - $updateSourceKey = JText::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_TESTING'); - break; - - // "Custom" - case 'custom': - $langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_CUSTOM'; - $updateSourceKey = JText::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_CUSTOM'); - break; - - // "Minor & Patch Release for Current version (recommended and default)". - // The commented "case" below are for documenting where 'default' and legacy options falls - // case 'default': - // case 'lts': - // case 'nochange': - default: - $langKey = 'COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATES_INFO_DEFAULT'; - $updateSourceKey = JText::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT'); -} +/** @var JoomlaupdateViewDefault $this */ +JHtml::_('jquery.framework'); +JHtml::_('bootstrap.tooltip'); JHtml::_('formbehavior.chosen', 'select'); - +JHtml::script('com_joomlaupdate/default.js', false, true, false); + +JFactory::getDocument()->addScriptDeclaration(" +jQuery(document).ready(function($) { + $('#extraction_method').change(function(e){ + extractionMethodHandler('#extraction_method', 'row_ftp'); + }); + $('#upload_method').change(function(e){ + extractionMethodHandler('#upload_method', 'upload_ftp'); + }); + + $('button.submit').on('click', function() { + $('div.download_message').show(); + }); +});"); ?> - - -updateInfo['object'])) : ?> - -
    - - - -

    - -

    -

    - -

    -
    - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - > - - - - > - - - - > - - - - > - - - - - - - - - - -
    - - - updateInfo['installed']; ?> -
    - - - updateInfo['latest']; ?> -
    - - - - updateInfo['object']->downloadurl->_data; ?> - -
    - - - - updateInfo['object']->get('infourl')->title; ?> - -
    - - - methodSelect; ?> -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    -   - - -
    -
    - - - - - - - - -
    + +
    +
    + +
    +
    + items)) : ?> - params->get('show_no_articles', 1)) : ?>

    - - - - - params->get('show_headings')) : ?> - - +
    + + - params->get('list_show_date')) : ?> - params->get('list_show_author')) : ?> - params->get('list_show_hits')) : ?> - params->get('list_show_votes', 0)) && ($this->vote)) : ?> - params->get('list_show_ratings', 0)) && ($this->vote)) : ?> - - + - - + items as $i => $article) : ?> items[$i]->state == 0) : ?> @@ -144,7 +138,7 @@ - params->get('list_show_date')) : ?> - params->get('list_show_author', 1)) : ?> - params->get('list_show_hits', 1)) : ?> - params->get('list_show_votes', 0)) && ($this->vote)) : ?> - params->get('list_show_ratings', 0)) && ($this->vote)) : ?> - -
    category->title); ?>
    + + @@ -112,31 +107,30 @@ + + + +
    class="list-title"> + access, $this->user->getAuthorisedViewLevels())) : ?> escape($article->title); ?> @@ -203,7 +197,7 @@ class="list-date small"> + displayDate, @@ -212,7 +206,7 @@ class="list-author"> + author) || !empty($article->created_by_alias)) : ?> author ?> created_by_alias ? $article->created_by_alias : $author); ?> @@ -225,28 +219,28 @@ class="list-hits"> + hits); ?> class="list-votes"> + rating_count); ?> class="list-ratings"> + rating); ?> class="list-edit"> + params->get('access-edit')) : ?> diff --git a/components/com_content/views/featured/metadata.xml b/components/com_content/views/featured/metadata.xml deleted file mode 100644 index a7452a1434c62..0000000000000 --- a/components/com_content/views/featured/metadata.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/components/com_content/views/featured/tmpl/default.xml b/components/com_content/views/featured/tmpl/default.xml index 28e3d63937863..4657fcaf1a58a 100644 --- a/components/com_content/views/featured/tmpl/default.xml +++ b/components/com_content/views/featured/tmpl/default.xml @@ -35,32 +35,36 @@ - + useglobal="true" + > @@ -68,8 +72,8 @@ - + useglobal="true" + > @@ -79,8 +83,8 @@ - + useglobal="true" + > @@ -100,8 +104,8 @@ - + useglobal="true" + > @@ -110,8 +114,8 @@ - + useglobal="true" + > @@ -119,9 +123,9 @@ - - + description="JGLOBAL_PAGINATION_RESULTS_DESC" + useglobal="true" + > @@ -133,8 +137,8 @@ - + useglobal="true" + > @@ -143,8 +147,8 @@ - + useglobal="true" + > @@ -153,8 +157,8 @@ - + useglobal="true" + > @@ -165,8 +169,9 @@ type="list" default="" label="COM_CONTENT_FIELD_INFOBLOCK_POSITION_LABEL" - description="COM_CONTENT_FIELD_INFOBLOCK_POSITION_DESC"> - + description="COM_CONTENT_FIELD_INFOBLOCK_POSITION_DESC" + useglobal="true" + > @@ -178,8 +183,8 @@ type="list" label="COM_CONTENT_FIELD_INFOBLOCK_TITLE_LABEL" description="COM_CONTENT_FIELD_INFOBLOCK_TITLE_DESC" - > - + useglobal="true" + > @@ -188,8 +193,8 @@ - + useglobal="true" + > @@ -198,8 +203,8 @@ - + useglobal="true" + > @@ -208,8 +213,8 @@ - + useglobal="true" + > @@ -218,8 +223,8 @@ - + useglobal="true" + > @@ -230,8 +235,8 @@ type="list" label="JGLOBAL_SHOW_ASSOCIATIONS_LABEL" description="JGLOBAL_SHOW_ASSOCIATIONS_DESC" - > - + useglobal="true" + > @@ -239,8 +244,8 @@ - + useglobal="true" + > @@ -249,8 +254,8 @@ - + useglobal="true" + > @@ -259,8 +264,8 @@ - + useglobal="true" + > @@ -269,8 +274,8 @@ - + useglobal="true" + > @@ -279,8 +284,8 @@ - + useglobal="true" + > @@ -289,31 +294,31 @@ - + useglobal="true" + > - - - - - + name="show_vote" type="list" + label="JGLOBAL_SHOW_VOTE_LABEL" + description="JGLOBAL_SHOW_VOTE_DESC" + useglobal="true" + > + + + + - + useglobal="true" + > @@ -323,8 +328,8 @@ type="list" label="JGLOBAL_SHOW_READMORE_TITLE_LABEL" description="JGLOBAL_SHOW_READMORE_TITLE_DESC" - > - + useglobal="true" + > @@ -332,8 +337,8 @@ - + useglobal="true" + > @@ -342,8 +347,8 @@ - + useglobal="true" + > @@ -352,8 +357,8 @@ - + useglobal="true" + > @@ -362,8 +367,8 @@ - + useglobal="true" + > @@ -373,8 +378,8 @@ type="list" description="COM_CONTENT_FIELD_SHOW_TAGS_DESC" label="COM_CONTENT_FIELD_SHOW_TAGS_LABEL" - > - + useglobal="true" + > @@ -382,8 +387,8 @@ - + useglobal="true" + > @@ -395,8 +400,8 @@ - + useglobal="true" + > @@ -404,8 +409,8 @@ - + useglobal="true" + > diff --git a/components/com_content/views/form/metadata.xml b/components/com_content/views/form/metadata.xml deleted file mode 100644 index f468688edc55d..0000000000000 --- a/components/com_content/views/form/metadata.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/components/com_content/views/form/tmpl/edit.php b/components/com_content/views/form/tmpl/edit.php index 12439bef6c1f2..fc67e01253fd2 100644 --- a/components/com_content/views/form/tmpl/edit.php +++ b/components/com_content/views/form/tmpl/edit.php @@ -100,6 +100,9 @@ form->getFieldsets('params') as $name => $fieldSet) : ?> label)); ?> + description) && trim($fieldSet->description)): ?> + ' . $this->escape(JText::_($fieldSet->description)) . '

    '; ?> + form->getFieldset($name) as $field) : ?> renderField(); ?> diff --git a/components/com_fields/controller.php b/components/com_fields/controller.php new file mode 100644 index 0000000000000..e5632f402f6bd --- /dev/null +++ b/components/com_fields/controller.php @@ -0,0 +1,18 @@ +input->get($this->input->get('formcontrol', 'jform'), array(), 'array'); + $parts = FieldsHelper::extract($this->input->getCmd('context')); + + if ($parts) + { + $app->setUserState($parts[0] . '.edit.' . $parts[1] . '.data', $data); + } + + $app->redirect(base64_decode($this->input->get->getBase64('return'))); + $app->close(); + } +} diff --git a/components/com_fields/fields.php b/components/com_fields/fields.php new file mode 100644 index 0000000000000..9226ce51142f4 --- /dev/null +++ b/components/com_fields/fields.php @@ -0,0 +1,15 @@ +execute(JFactory::getApplication()->input->get('task')); +$controller->redirect(); diff --git a/components/com_fields/layouts/field/prepare/base.php b/components/com_fields/layouts/field/prepare/base.php new file mode 100644 index 0000000000000..6af8b844a2d0c --- /dev/null +++ b/components/com_fields/layouts/field/prepare/base.php @@ -0,0 +1,29 @@ +value; + +if (!$value) +{ + return; +} + +if (is_array($value)) +{ + $value = implode(', ', $value); +} + +echo htmlentities($value); diff --git a/components/com_fields/layouts/field/prepare/captcha.php b/components/com_fields/layouts/field/prepare/captcha.php new file mode 100644 index 0000000000000..331fb288d1e18 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/captcha.php @@ -0,0 +1,11 @@ +value; + +if (!$value) +{ + return; +} + +$value = (array) $value; +$texts = array(); +$options = JFormAbstractlist::getOptionsFromField($field); + +foreach ($options as $optionValue => $optionText) +{ + if (in_array($optionValue, $value)) + { + $texts[] = JText::_($optionText); + } +} + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/editor.php b/components/com_fields/layouts/field/prepare/editor.php new file mode 100644 index 0000000000000..5a68253c2a72c --- /dev/null +++ b/components/com_fields/layouts/field/prepare/editor.php @@ -0,0 +1,24 @@ +value; + +if (!$value) +{ + return; +} + +echo JHTML::_('content.prepare', $value); diff --git a/components/com_fields/layouts/field/prepare/imagelist.php b/components/com_fields/layouts/field/prepare/imagelist.php new file mode 100644 index 0000000000000..85dec1cd10c15 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/imagelist.php @@ -0,0 +1,38 @@ +value; + +if (!$value) +{ + return; +} + +$value = (array) $value; +$buffer = ''; + +foreach ($value as $path) +{ + if (!$path || $path == '-1') + { + continue; + } + + $buffer .= ''; +} + +echo $buffer; diff --git a/components/com_fields/layouts/field/prepare/list.php b/components/com_fields/layouts/field/prepare/list.php new file mode 100644 index 0000000000000..bf76d56e950a6 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/list.php @@ -0,0 +1,37 @@ +value; + +if (!$value) +{ + return; +} + +$value = (array) $value; +$texts = array(); +$options = JFormAbstractlist::getOptionsFromField($field); + +foreach ($options as $optionValue => $optionText) +{ + if (in_array($optionValue, $value)) + { + $texts[] = JText::_($optionText); + } +} + + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/media.php b/components/com_fields/layouts/field/prepare/media.php new file mode 100644 index 0000000000000..a758a21f653f2 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/media.php @@ -0,0 +1,37 @@ +value; + +if (!$value) +{ + return; +} + +$value = (array) $value; +$buffer = ''; + +foreach ($value as $path) +{ + if (!$path) + { + continue; + } + + $buffer .= ''; +} + +echo $buffer; diff --git a/components/com_fields/layouts/field/prepare/radio.php b/components/com_fields/layouts/field/prepare/radio.php new file mode 100644 index 0000000000000..bf76d56e950a6 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/radio.php @@ -0,0 +1,37 @@ +value; + +if (!$value) +{ + return; +} + +$value = (array) $value; +$texts = array(); +$options = JFormAbstractlist::getOptionsFromField($field); + +foreach ($options as $optionValue => $optionText) +{ + if (in_array($optionValue, $value)) + { + $texts[] = JText::_($optionText); + } +} + + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/sql.php b/components/com_fields/layouts/field/prepare/sql.php new file mode 100644 index 0000000000000..f53cc691937a8 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/sql.php @@ -0,0 +1,64 @@ +value; + +if (!$value) +{ + return; +} + +$db = JFactory::getDbo(); +$value = (array) $value; +$condition = ''; + +foreach ($value as $v) +{ + if (!$v) + { + continue; + } + + $condition .= ', ' . $db->q($v); +} + +$query = $field->fieldparams->get('query', 'select id as value, name as text from #__users'); + +// Run the query with a having condition because it supports aliases +$db->setQuery($query . ' having value in (' . trim($condition, ',') . ')'); + +try +{ + $items = $db->loadObjectlist(); +} +catch (Exception $e) +{ + // If the query failed, we fetch all elements + $db->setQuery($query); + $items = $db->loadObjectlist(); +} + +$texts = array(); + +foreach ($items as $item) +{ + if (in_array($item->value, $value)) + { + $texts[] = $item->text; + } +} + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/textarea.php b/components/com_fields/layouts/field/prepare/textarea.php new file mode 100644 index 0000000000000..5a68253c2a72c --- /dev/null +++ b/components/com_fields/layouts/field/prepare/textarea.php @@ -0,0 +1,24 @@ +value; + +if (!$value) +{ + return; +} + +echo JHTML::_('content.prepare', $value); diff --git a/components/com_fields/layouts/field/prepare/url.php b/components/com_fields/layouts/field/prepare/url.php new file mode 100644 index 0000000000000..32ab25cda21cf --- /dev/null +++ b/components/com_fields/layouts/field/prepare/url.php @@ -0,0 +1,31 @@ +value; + +if (!$value) +{ + return; +} + +$attributes = ''; + +if (!JUri::isInternal($value)) +{ + $attributes = 'rel="nofollow" target="_blank"'; +} + +echo '' . $value . ''; diff --git a/components/com_fields/layouts/field/prepare/user.php b/components/com_fields/layouts/field/prepare/user.php new file mode 100644 index 0000000000000..27047ee6f3f6b --- /dev/null +++ b/components/com_fields/layouts/field/prepare/user.php @@ -0,0 +1,47 @@ +value; + +if (!$value) +{ + return; +} + +$value = (array) $value; +$texts = array(); + +foreach ($value as $userId) +{ + if (!$userId) + { + continue; + } + + $user = JFactory::getUser($userId); + + if ($user) + { + // Use the Username + $texts[] = $user->name; + continue; + } + + // Fallback and add the User ID if we get no JUser Object + $texts[] = $userId; +} + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/usergrouplist.php b/components/com_fields/layouts/field/prepare/usergrouplist.php new file mode 100644 index 0000000000000..925343ba5066e --- /dev/null +++ b/components/com_fields/layouts/field/prepare/usergrouplist.php @@ -0,0 +1,38 @@ +value; + +if (!$value) +{ + return; +} + +JLoader::register('UsersHelper', JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php'); + +$value = (array) $value; +$texts = array(); +$groups = UsersHelper::getGroups(); + +foreach ($groups as $group) +{ + if (in_array($group->value, $value)) + { + $texts[] = htmlentities(trim($group->text, '- ')); + } +} + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/render.php b/components/com_fields/layouts/field/render.php new file mode 100644 index 0000000000000..960465532014e --- /dev/null +++ b/components/com_fields/layouts/field/render.php @@ -0,0 +1,31 @@ +label); +$value = $field->value; +$class = $field->params->get('render_class'); + +if (!$value) +{ + return; +} + +?> + +
    + : + +
    diff --git a/components/com_fields/layouts/fields/render.php b/components/com_fields/layouts/fields/render.php new file mode 100644 index 0000000000000..bd37bba14cbe8 --- /dev/null +++ b/components/com_fields/layouts/fields/render.php @@ -0,0 +1,83 @@ +fields ? $item->fields : FieldsHelper::getFields($context, $item, true); +} + +if (!$fields) +{ + return; +} + +// Load some output definitions +$container = 'dl'; + +if (key_exists('container', $displayData) && $displayData['container']) +{ + $container = $displayData['container']; +} + +$class = 'article-info muted'; + +if (key_exists('container-class', $displayData) && $displayData['container-class']) +{ + $class = $displayData['container-class']; +} + +// Print the container tag +echo '<' . $container . ' class="fields-container ' . $class . '">'; + +// Loop through the fields and print them +foreach ($fields as $field) +{ + // If the value is empty dp nothing + if (!isset($field->value) || !$field->value) + { + continue; + } + + echo FieldsHelper::render($context, 'field.render', array('field' => $field)); +} + +// Close the container +echo ''; diff --git a/components/com_finder/helpers/html/filter.php b/components/com_finder/helpers/html/filter.php index a2f24c8f73bc9..af578f5298050 100644 --- a/components/com_finder/helpers/html/filter.php +++ b/components/com_finder/helpers/html/filter.php @@ -437,7 +437,7 @@ public static function dates($idxQuery, $options) // Load the CSS/JS resources. if ($loadMedia) { - JHtml::stylesheet('com_finder/dates.css', false, true, false); + JHtml::_('stylesheet', 'com_finder/dates.css', array('version' => 'auto', 'relative' => true)); } // Open the widget. diff --git a/components/com_finder/views/search/metadata.xml b/components/com_finder/views/search/metadata.xml deleted file mode 100644 index 5c0525632b10a..0000000000000 --- a/components/com_finder/views/search/metadata.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/components/com_finder/views/search/tmpl/default.php b/components/com_finder/views/search/tmpl/default.php index 592636ee80d4d..77e1826ba0bbf 100644 --- a/components/com_finder/views/search/tmpl/default.php +++ b/components/com_finder/views/search/tmpl/default.php @@ -12,7 +12,7 @@ JHtml::_('behavior.core'); JHtml::_('formbehavior.chosen'); JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); -JHtml::stylesheet('com_finder/finder.css', false, true, false); +JHtml::_('stylesheet', 'com_finder/finder.css', array('version' => 'auto', 'relative' => true)); ?>
    diff --git a/components/com_finder/views/search/tmpl/default_form.php b/components/com_finder/views/search/tmpl/default_form.php index 7fea4faa4133c..56184a69e29ed 100644 --- a/components/com_finder/views/search/tmpl/default_form.php +++ b/components/com_finder/views/search/tmpl/default_form.php @@ -38,7 +38,7 @@ */ if ($this->params->get('show_autosuggest', 1)) { - JHtml::_('script', 'media/jui/js/jquery.autocomplete.min.js', false, false, false, false, true); + JHtml::_('script', 'jui/jquery.autocomplete.min.js', array('version' => 'auto', 'relative' => true)); $script .= " var suggest = jQuery('#q').autocomplete({ diff --git a/components/com_mailto/controller.php b/components/com_mailto/controller.php index 0be4ae9dd4b7a..cd136ce602cae 100644 --- a/components/com_mailto/controller.php +++ b/components/com_mailto/controller.php @@ -43,7 +43,7 @@ public function mailto() public function send() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + $this->checkToken(); $app = JFactory::getApplication(); $session = JFactory::getSession(); diff --git a/components/com_mailto/views/mailto/metadata.xml b/components/com_mailto/views/mailto/metadata.xml deleted file mode 100644 index 46e304a85394f..0000000000000 --- a/components/com_mailto/views/mailto/metadata.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/components/com_mailto/views/sent/metadata.xml b/components/com_mailto/views/sent/metadata.xml deleted file mode 100644 index cb62c415a622b..0000000000000 --- a/components/com_mailto/views/sent/metadata.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - Mailto - Andrew Eddie - 13 Mar 2006 - Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. - GNU General Public License version 2 or later; see LICENSE.txt - admin@joomla.org - www.joomla.org - COM_MAILTO_XML_DESCRIPTION - diff --git a/components/com_menus/controller.php b/components/com_menus/controller.php new file mode 100644 index 0000000000000..2a9d60630aea7 --- /dev/null +++ b/components/com_menus/controller.php @@ -0,0 +1,41 @@ +input = JFactory::getApplication()->input; + + // Menus frontpage Editor Menu proxying: + if ($this->input->get('view') === 'items' && $this->input->get('layout') === 'modal') + { + JHtml::_('stylesheet', 'system/adminlist.css', array(), true); + $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR; + } + + parent::__construct($config); + } +} diff --git a/components/com_menus/menus.php b/components/com_menus/menus.php new file mode 100644 index 0000000000000..c9d2ecd9c81a0 --- /dev/null +++ b/components/com_menus/menus.php @@ -0,0 +1,31 @@ +input->get('view') === 'items' && $app->input->get('layout') === 'modal') +{ + if (!JFactory::getUser()->authorise('core.create', 'com_menus')) + { + $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning'); + return; + } +} + +$lang->load('joomla', JPATH_ADMINISTRATOR); +$lang->load('com_menus', JPATH_ADMINISTRATOR); + +// Trigger the controller +$controller = JControllerLegacy::getInstance('Menus'); +$controller->execute($app->input->get('task')); +$controller->redirect(); diff --git a/components/com_menus/models/forms/filter_items.xml b/components/com_menus/models/forms/filter_items.xml new file mode 100644 index 0000000000000..f6179f04b9c9a --- /dev/null +++ b/components/com_menus/models/forms/filter_items.xml @@ -0,0 +1,95 @@ + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/com_modules/controller.php b/components/com_modules/controller.php index 8b19da7d10d81..c76faff8e7b80 100644 --- a/components/com_modules/controller.php +++ b/components/com_modules/controller.php @@ -32,7 +32,7 @@ public function __construct($config = array()) // Modules frontpage Editor Module proxying: if ($this->input->get('view') === 'modules' && $this->input->get('layout') === 'modal') { - JHtml::_('stylesheet', 'system/adminlist.css', array(), true); + JHtml::_('stylesheet', 'system/adminlist.css', array('version' => 'auto', 'relative' => true)); $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR; } diff --git a/components/com_newsfeeds/metadata.xml b/components/com_newsfeeds/metadata.xml deleted file mode 100644 index 9205b30529a2a..0000000000000 --- a/components/com_newsfeeds/metadata.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/components/com_newsfeeds/views/categories/tmpl/default.xml b/components/com_newsfeeds/views/categories/tmpl/default.xml index 2e19004c78bbd..0bc430b500a31 100644 --- a/components/com_newsfeeds/views/categories/tmpl/default.xml +++ b/components/com_newsfeeds/views/categories/tmpl/default.xml @@ -29,9 +29,8 @@ - @@ -45,9 +44,8 @@ - @@ -59,17 +57,17 @@ - - @@ -77,8 +75,8 @@ - @@ -92,8 +90,8 @@ - @@ -101,8 +99,8 @@ - @@ -110,8 +108,8 @@ - @@ -119,8 +117,8 @@ - @@ -133,8 +131,8 @@ - @@ -142,8 +140,8 @@ - @@ -153,8 +151,8 @@ type="list" label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL" description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC" + useglobal="true" > - @@ -172,8 +170,8 @@ default="" description="JGLOBAL_FILTER_FIELD_DESC" label="JGLOBAL_FILTER_FIELD_LABEL" + useglobal="true" > - @@ -182,8 +180,8 @@ type="list" label="JGLOBAL_DISPLAY_SELECT_LABEL" description="JGLOBAL_DISPLAY_SELECT_DESC" + useglobal="true" > - @@ -193,9 +191,9 @@ name="show_headings" type="list" label="JGLOBAL_SHOW_HEADINGS_LABEL" - description="JGLOBAL_SHOW_HEADINGS_DESC"> - - + description="JGLOBAL_SHOW_HEADINGS_DESC" + useglobal="true" + > @@ -205,9 +203,9 @@ name="show_articles" type="list" label="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_LABEL" - description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_DESC"> - - + description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_DESC" + useglobal="true" + > @@ -217,9 +215,9 @@ name="show_link" type="list" label="COM_NEWSFEEDS_FIELD_SHOW_LINKS_LABEL" - description="COM_NEWSFEEDS_FIELD_SHOW_LINKS_DESC"> - - + description="COM_NEWSFEEDS_FIELD_SHOW_LINKS_DESC" + useglobal="true" + > @@ -227,9 +225,9 @@ - - + description="JGLOBAL_PAGINATION_DESC" + useglobal="true" + > @@ -239,9 +237,9 @@ name="show_pagination_results" type="list" label="JGLOBAL_PAGINATION_RESULTS_LABEL" - description="JGLOBAL_PAGINATION_RESULTS_DESC"> - - + description="JGLOBAL_PAGINATION_RESULTS_DESC" + useglobal="true" + > @@ -253,8 +251,8 @@ - @@ -262,8 +260,8 @@ - @@ -271,17 +269,17 @@ -
    diff --git a/components/com_newsfeeds/views/category/metadata.xml b/components/com_newsfeeds/views/category/metadata.xml deleted file mode 100644 index 31a1eeadf570d..0000000000000 --- a/components/com_newsfeeds/views/category/metadata.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/components/com_newsfeeds/views/category/tmpl/default.xml b/components/com_newsfeeds/views/category/tmpl/default.xml index a1cee53f43edf..6783f2107cbf1 100644 --- a/components/com_newsfeeds/views/category/tmpl/default.xml +++ b/components/com_newsfeeds/views/category/tmpl/default.xml @@ -38,11 +38,11 @@ label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL" /> - - + useglobal="true" + > @@ -50,8 +50,8 @@ - @@ -59,8 +59,8 @@ - @@ -68,8 +68,8 @@ - @@ -82,8 +82,8 @@ - @@ -91,8 +91,8 @@ - @@ -102,8 +102,8 @@ type="list" label="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_LABEL" description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC" + useglobal="true" > - @@ -119,8 +119,8 @@ default="" description="JGLOBAL_FILTER_FIELD_DESC" label="JGLOBAL_FILTER_FIELD_LABEL" + useglobal="true" > - @@ -129,8 +129,8 @@ type="list" label="JGLOBAL_DISPLAY_SELECT_LABEL" description="JGLOBAL_DISPLAY_SELECT_DESC" + useglobal="true" > - @@ -140,9 +140,9 @@ name="show_headings" type="list" label="JGLOBAL_SHOW_HEADINGS_LABEL" - description="JGLOBAL_SHOW_HEADINGS_DESC"> - - + description="JGLOBAL_SHOW_HEADINGS_DESC" + useglobal="true" + > @@ -152,9 +152,9 @@ name="show_articles" type="list" label="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_LABEL" - description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_DESC"> - - + description="COM_NEWSFEEDS_FIELD_NUM_ARTICLES_COLUMN_DESC" + useglobal="true" + > @@ -164,9 +164,9 @@ name="show_link" type="list" label="COM_NEWSFEEDS_FIELD_SHOW_LINKS_LABEL" - description="COM_NEWSFEEDS_FIELD_SHOW_LINKS_DESC"> - - + description="COM_NEWSFEEDS_FIELD_SHOW_LINKS_DESC" + useglobal="true" + > @@ -174,9 +174,9 @@ - - + description="JGLOBAL_PAGINATION_DESC" + useglobal="true" + > @@ -186,9 +186,9 @@ name="show_pagination_results" type="list" label="JGLOBAL_PAGINATION_RESULTS_LABEL" - description="JGLOBAL_PAGINATION_RESULTS_DESC"> - - + description="JGLOBAL_PAGINATION_RESULTS_DESC" + useglobal="true" + > @@ -201,8 +201,8 @@ - @@ -210,8 +210,8 @@ - @@ -219,24 +219,24 @@ - - diff --git a/components/com_newsfeeds/views/newsfeed/metadata.xml b/components/com_newsfeeds/views/newsfeed/metadata.xml deleted file mode 100644 index ccc504b9a4854..0000000000000 --- a/components/com_newsfeeds/views/newsfeed/metadata.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/components/com_newsfeeds/views/newsfeed/tmpl/default.xml b/components/com_newsfeeds/views/newsfeed/tmpl/default.xml index 422010aaeb08d..148d57e25a370 100644 --- a/components/com_newsfeeds/views/newsfeed/tmpl/default.xml +++ b/components/com_newsfeeds/views/newsfeed/tmpl/default.xml @@ -35,8 +35,8 @@ - @@ -44,8 +44,8 @@ - @@ -53,8 +53,8 @@ - @@ -62,24 +62,24 @@ - - diff --git a/components/com_search/views/search/metadata.xml b/components/com_search/views/search/metadata.xml deleted file mode 100644 index 789b933a1dcac..0000000000000 --- a/components/com_search/views/search/metadata.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/components/com_search/views/search/tmpl/default.xml b/components/com_search/views/search/tmpl/default.xml index 5e29d5496f5a3..682fd539934d5 100644 --- a/components/com_search/views/search/tmpl/default.xml +++ b/components/com_search/views/search/tmpl/default.xml @@ -13,9 +13,11 @@
    -
    @@ -25,56 +27,67 @@
    - - + description="COM_SEARCH_FIELD_SEARCH_PHRASES_DESC" + useglobal="true" + > - - + description="COM_SEARCH_FIELD_SEARCH_AREAS_DESC" + useglobal="true" + > - - + description="COM_SEARCH_CONFIG_FIELD_CREATED_DATE_DESC" + useglobal="true" + > - - + description="COM_SEARCH_FOR_DESC" + default="0" + > - + description="COM_SEARCH_ORDERING_DESC" + default="newest" + > diff --git a/components/com_tags/metadata.xml b/components/com_tags/metadata.xml deleted file mode 100644 index 9205b30529a2a..0000000000000 --- a/components/com_tags/metadata.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/components/com_tags/views/tag/metadata.xml b/components/com_tags/views/tag/metadata.xml deleted file mode 100644 index 2b643b6396912..0000000000000 --- a/components/com_tags/views/tag/metadata.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/components/com_tags/views/tag/tmpl/default.xml b/components/com_tags/views/tag/tmpl/default.xml index 99c5ba81562ab..b35b71c7b5969 100644 --- a/components/com_tags/views/tag/tmpl/default.xml +++ b/components/com_tags/views/tag/tmpl/default.xml @@ -15,14 +15,14 @@ - + - + - - - + useglobal="true" + > + + - +
    @@ -55,8 +55,8 @@ type="list" label="COM_TAGS_SHOW_TAG_TITLE_LABEL" description="COM_TAGS_SHOW_TAG_TITLE_DESC" + useglobal="true" > -
    @@ -65,9 +65,9 @@ name="tag_list_show_tag_image" type="list" label="COM_TAGS_SHOW_TAG_IMAGE_LABEL" - description="COM_TAGS_SHOW_TAG_IMAGE_DESC" + description="COM_TAGS_SHOW_TAG_IMAGE_DESC" + useglobal="true" > -
    @@ -77,25 +77,25 @@ type="list" label="COM_TAGS_SHOW_TAG_DESCRIPTION_LABEL" description="COM_TAGS_SHOW_TAG_DESCRIPTION_DESC" + useglobal="true" > -
    - + - + - @@ -118,13 +118,13 @@ label="JGLOBAL_FIELD_FIELD_ORDERING_LABEL" description="JGLOBAL_FIELD_FIELD_ORDERING_DESC" default="" + useglobal="true" > - - - - - - + + + + + - @@ -141,21 +141,21 @@
    - + - + - @@ -165,18 +165,19 @@ type="list" label="COM_TAGS_TAG_LIST_SHOW_ITEM_DESCRIPTION_LABEL" description="COM_TAGS_TAG_LIST_SHOW_ITEM_DESCRIPTION_DESC" + useglobal="true" > - - + - @@ -194,13 +195,13 @@
    - - @@ -210,8 +211,8 @@ type="list" label="JGLOBAL_PAGINATION_LABEL" description="JGLOBAL_PAGINATION_DESC" + useglobal="true" > - @@ -221,50 +222,51 @@ name="show_pagination_results" type="list" label="JGLOBAL_PAGINATION_RESULTS_LABEL" - description="JGLOBAL_PAGINATION_RESULTS_DESC"> - - - + description="JGLOBAL_PAGINATION_RESULTS_DESC" + useglobal="true" + > + + - +
    - +
    - - - - + - - - + +
    - +
    - - - diff --git a/components/com_tags/views/tag/tmpl/list.xml b/components/com_tags/views/tag/tmpl/list.xml index 0023d86c39dc0..1564b32c617c0 100644 --- a/components/com_tags/views/tag/tmpl/list.xml +++ b/components/com_tags/views/tag/tmpl/list.xml @@ -37,10 +37,10 @@ label="COM_TAGS_FIELD_LANGUAGE_FILTER_LABEL" description="COM_TAGS_FIELD_LANGUAGE_FILTER_DESC" default="" + useglobal="true" > - - - + +
    @@ -54,8 +54,8 @@ type="list" label="COM_TAGS_SHOW_TAG_TITLE_LABEL" description="COM_TAGS_SHOW_TAG_TITLE_DESC" + useglobal="true" > -
    @@ -65,8 +65,8 @@ type="list" label="COM_TAGS_SHOW_TAG_IMAGE_LABEL" description="COM_TAGS_SHOW_TAG_IMAGE_DESC" + useglobal="true" > - @@ -76,8 +76,8 @@ type="list" label="COM_TAGS_SHOW_TAG_DESCRIPTION_LABEL" description="COM_TAGS_SHOW_TAG_DESCRIPTION_DESC" + useglobal="true" > - @@ -105,8 +105,8 @@ type="list" label="COM_TAGS_NUMBER_TAG_ITEMS_LABEL" description="COM_TAGS_NUMBER_TAG_ITEMS_DESC" + useglobal="true" > - @@ -117,8 +117,8 @@ label="JGLOBAL_FIELD_FIELD_ORDERING_LABEL" description="JGLOBAL_FIELD_FIELD_ORDERING_DESC" default="" + useglobal="true" > - @@ -131,8 +131,8 @@ type="list" label="JGLOBAL_ORDER_DIRECTION_LABEL" description="JGLOBAL_ORDER_DIRECTION_DESC" + useglobal="true" > - @@ -153,8 +153,8 @@ type="list" label="COM_TAGS_TAG_LIST_SHOW_ITEM_IMAGE_LABEL" description="COM_TAGS_TAG_LIST_SHOW_ITEM_IMAGE_DESC" + useglobal="true" > - @@ -164,8 +164,8 @@ type="list" label="COM_TAGS_TAG_LIST_SHOW_ITEM_DESCRIPTION_LABEL" description="COM_TAGS_TAG_LIST_SHOW_ITEM_DESCRIPTION_DESC" + useglobal="true" > - @@ -176,6 +176,7 @@ filter="integer" label="COM_TAGS_LIST_MAX_CHARACTERS_LABEL" description="COM_TAGS_LIST_MAX_CHARACTERS_DESC" + useglobal="true" /> - @@ -195,17 +196,17 @@ type="list" label="JGLOBAL_DISPLAY_SELECT_LABEL" description="JGLOBAL_DISPLAY_SELECT_DESC" + useglobal="true" > - + @@ -222,8 +223,8 @@ type="list" label="JGLOBAL_PAGINATION_LABEL" description="JGLOBAL_PAGINATION_DESC" + useglobal="true" > - @@ -233,10 +234,11 @@ name="show_pagination_results" type="list" label="JGLOBAL_PAGINATION_RESULTS_LABEL" - description="JGLOBAL_PAGINATION_RESULTS_DESC"> - - - + description="JGLOBAL_PAGINATION_RESULTS_DESC" + useglobal="true" + > + + - @@ -269,8 +271,8 @@ type="list" label="COM_TAGS_SEARCH_TYPE_LABEL" description="COM_TAGS_SEARCH_TYPE_DESC" + useglobal="true" > - @@ -281,8 +283,8 @@ label="COM_TAGS_INCLUDE_CHILDREN_LABEL" description="COM_TAGS_INCLUDE_CHILDREN_DESC" default="" + useglobal="true" > - @@ -296,8 +298,8 @@ type="list" label="JGLOBAL_SHOW_FEED_LINK_LABEL" description="JGLOBAL_SHOW_FEED_LINK_DESC" + useglobal="true" > - diff --git a/components/com_tags/views/tags/tmpl/default.xml b/components/com_tags/views/tags/tmpl/default.xml index 86d3b8817fff5..e11c0d4d64dc3 100644 --- a/components/com_tags/views/tags/tmpl/default.xml +++ b/components/com_tags/views/tags/tmpl/default.xml @@ -29,10 +29,10 @@ default="" label="COM_TAGS_FIELD_LANGUAGE_FILTER_LABEL" description="COM_TAGS_FIELD_LANGUAGE_FILTER_DESC" + useglobal="true" > - - - + +
    @@ -54,7 +54,7 @@ name="all_tags_description" type="textarea" label="COM_TAGS_SHOW_ALL_TAGS_DESCRIPTION_LABEL" - description="COM_TAGS_ALL_TAGS_DESCRIPTION_DESC" + description="COM_TAGS_ALL_TAGS_DESCRIPTION_DESC" class="inputbox" rows="3" cols="30" @@ -65,7 +65,7 @@ name="all_tags_show_description_image" type="list" label="COM_TAGS_SHOW_ALL_TAGS_IMAGE_LABEL" - description="COM_TAGS_SHOW_ALL_TAGS_IMAGE_DESC" + description="COM_TAGS_SHOW_ALL_TAGS_IMAGE_DESC" > @@ -84,13 +84,13 @@ type="list" label="JGLOBAL_FIELD_FIELD_ORDERING_LABEL" description="JGLOBAL_FIELD_FIELD_ORDERING_DESC" + useglobal="true" > - - - - - - + + + + + - @@ -109,8 +109,8 @@ type="list" label="COM_TAGS_SHOW_ITEM_IMAGE_LABEL" description="COM_TAGS_SHOW_ITEM_IMAGE_DESC" + useglobal="true" > - @@ -139,8 +139,8 @@ type="list" label="JGLOBAL_HITS" description="COM_TAGS_FIELD_CONFIG_HITS_DESC" + useglobal="true" > - @@ -164,8 +164,8 @@ default="" label="JGLOBAL_FILTER_FIELD_LABEL" description="JGLOBAL_FILTER_FIELD_DESC" + useglobal="true" > - @@ -176,8 +176,8 @@ type="list" label="JGLOBAL_DISPLAY_SELECT_LABEL" description="JGLOBAL_DISPLAY_SELECT_DESC" + useglobal="true" > - @@ -186,9 +186,9 @@ name="show_pagination" type="list" label="JGLOBAL_PAGINATION_LABEL" - description="JGLOBAL_PAGINATION_DESC" + description="JGLOBAL_PAGINATION_DESC" + useglobal="true" > - @@ -199,22 +199,21 @@ type="list" label="JGLOBAL_PAGINATION_RESULTS_LABEL" description="JGLOBAL_PAGINATION_RESULTS_DESC" + useglobal="true" > - - - + +
    - - - diff --git a/components/com_users/controllers/profile.php b/components/com_users/controllers/profile.php index a2fbdc594def3..5b13244b89ec2 100644 --- a/components/com_users/controllers/profile.php +++ b/components/com_users/controllers/profile.php @@ -90,7 +90,7 @@ public function edit() public function save() { // Check for request forgeries. - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + $this->checkToken(); $app = JFactory::getApplication(); $model = $this->getModel('Profile', 'UsersModel'); diff --git a/components/com_users/controllers/registration.php b/components/com_users/controllers/registration.php index d166b6590ec24..92eaccb3a1118 100644 --- a/components/com_users/controllers/registration.php +++ b/components/com_users/controllers/registration.php @@ -108,7 +108,7 @@ public function activate() public function register() { // Check for request forgeries. - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + $this->checkToken(); // If registration is disabled - Redirect to login page. if (JComponentHelper::getParams('com_users')->get('allowUserRegistration') == 0) diff --git a/components/com_users/controllers/remind.php b/components/com_users/controllers/remind.php index aa199efe08f5d..32c71fe8c7cba 100644 --- a/components/com_users/controllers/remind.php +++ b/components/com_users/controllers/remind.php @@ -28,7 +28,7 @@ class UsersControllerRemind extends UsersController public function remind() { // Check the request token. - JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN')); + $this->checkToken('post'); $model = $this->getModel('Remind', 'UsersModel'); $data = $this->input->post->get('jform', array(), 'array'); diff --git a/components/com_users/controllers/reset.php b/components/com_users/controllers/reset.php index 15a52d360ef49..68ea60f3ef11e 100644 --- a/components/com_users/controllers/reset.php +++ b/components/com_users/controllers/reset.php @@ -28,7 +28,7 @@ class UsersControllerReset extends UsersController public function request() { // Check the request token. - JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN')); + $this->checkToken('post'); $app = JFactory::getApplication(); $model = $this->getModel('Reset', 'UsersModel'); @@ -85,7 +85,7 @@ public function request() public function confirm() { // Check the request token. - JSession::checkToken('request') or jexit(JText::_('JINVALID_TOKEN')); + $this->checkToken('request'); $app = JFactory::getApplication(); $model = $this->getModel('Reset', 'UsersModel'); @@ -141,7 +141,7 @@ public function confirm() public function complete() { // Check for request forgeries - JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN')); + $this->checkToken('post'); $app = JFactory::getApplication(); $model = $this->getModel('Reset', 'UsersModel'); diff --git a/components/com_users/controllers/user.php b/components/com_users/controllers/user.php index 3a53bc73fc092..9aa27bd68e525 100644 --- a/components/com_users/controllers/user.php +++ b/components/com_users/controllers/user.php @@ -27,7 +27,7 @@ class UsersControllerUser extends UsersController */ public function login() { - JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN')); + $this->checkToken('post'); $app = JFactory::getApplication(); $input = $app->input; @@ -142,7 +142,7 @@ public function login() */ public function logout() { - JSession::checkToken('request') or jexit(JText::_('JINVALID_TOKEN')); + $this->checkToken('request'); $app = JFactory::getApplication(); @@ -284,7 +284,7 @@ public function menulogout() } /** - * Method to login a user. + * Method to request a username reminder. * * @return boolean * @@ -293,7 +293,7 @@ public function menulogout() public function remind() { // Check the request token. - JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN')); + $this->checkToken('post'); $app = JFactory::getApplication(); $model = $this->getModel('User', 'UsersModel'); @@ -350,7 +350,7 @@ public function remind() } /** - * Method to login a user. + * Method to resend a user. * * @return void * @@ -359,6 +359,6 @@ public function remind() public function resend() { // Check for request forgeries - JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN')); + // $this->checkToken('post'); } } diff --git a/components/com_users/metadata.xml b/components/com_users/metadata.xml deleted file mode 100644 index 9205b30529a2a..0000000000000 --- a/components/com_users/metadata.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/components/com_users/models/profile.php b/components/com_users/models/profile.php index 5e45ccae75284..d880d469170b8 100644 --- a/components/com_users/models/profile.php +++ b/components/com_users/models/profile.php @@ -192,6 +192,10 @@ public function getForm($data = array(), $loadData = true) return false; } + // For com_fields the context is com_users.user + JLoader::import('components.com_fields.helpers.fields', JPATH_ADMINISTRATOR); + FieldsHelper::prepareForm('com_users.user', $form, $data); + // Check for username compliance and parameter set $isUsernameCompliant = true; diff --git a/components/com_users/views/login/metadata.xml b/components/com_users/views/login/metadata.xml deleted file mode 100644 index a2b688144ca65..0000000000000 --- a/components/com_users/views/login/metadata.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/components/com_users/views/profile/metadata.xml b/components/com_users/views/profile/metadata.xml deleted file mode 100644 index 27d48370f6eb1..0000000000000 --- a/components/com_users/views/profile/metadata.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/components/com_users/views/profile/tmpl/default_custom.php b/components/com_users/views/profile/tmpl/default_custom.php index 5a93f6fbaf5df..8876039cd5ec0 100644 --- a/components/com_users/views/profile/tmpl/default_custom.php +++ b/components/com_users/views/profile/tmpl/default_custom.php @@ -23,6 +23,14 @@ { unset($fieldsets['params']); } + +$tmp = isset($this->data->fields) ? $this->data->fields : array(); +$customFields = array(); + +foreach ($tmp as $customField) +{ + $customFields[$customField->alias] = $customField; +} ?> $fieldset) : ?> form->getFieldset($group); ?> @@ -36,7 +44,9 @@ hidden && $field->type !== 'Spacer') : ?>
    title; ?>
    - id)) : ?> + fieldname, $customFields)) : ?> + fieldname]->value; ?> + id)) : ?> id, $field->value); ?> fieldname)) : ?> fieldname, $field->value); ?> diff --git a/components/com_users/views/profile/tmpl/edit.php b/components/com_users/views/profile/tmpl/edit.php index 668cbda9072c8..01e06f4ba0fe4 100644 --- a/components/com_users/views/profile/tmpl/edit.php +++ b/components/com_users/views/profile/tmpl/edit.php @@ -55,6 +55,9 @@ label); ?> + description) && trim($fieldset->description)): ?> + ' . $this->escape(JText::_($fieldset->description)) . '

    '; ?> + diff --git a/components/com_users/views/profile/view.html.php b/components/com_users/views/profile/view.html.php index 084347ff4cbf7..8b4e76512e053 100644 --- a/components/com_users/views/profile/view.html.php +++ b/components/com_users/views/profile/view.html.php @@ -43,9 +43,11 @@ class UsersViewProfile extends JViewLegacy */ public function display($tpl = null) { + $user = JFactory::getUser(); + // Get the view data. $this->data = $this->get('Data'); - $this->form = $this->get('Form'); + $this->form = $this->getModel()->getForm(new JObject(array('id' => $user->id))); $this->state = $this->get('State'); $this->params = $this->state->get('params'); $this->twofactorform = $this->get('Twofactorform'); @@ -62,7 +64,6 @@ public function display($tpl = null) } // View also takes responsibility for checking if the user logged in with remember me. - $user = JFactory::getUser(); $cookieLogin = $user->get('cookieLogin'); if (!empty($cookieLogin)) @@ -87,6 +88,11 @@ public function display($tpl = null) $this->data->tags = new JHelperTags; $this->data->tags->getItemTags('com_users.user.', $this->data->id); + JPluginHelper::importPlugin('content'); + $this->data->text = ''; + JEventDispatcher::getInstance()->trigger('onContentPrepare', array ('com_users.user', &$this->data, &$this->data->params, 0)); + unset($this->data->text); + // Check for layout override $active = JFactory::getApplication()->getMenu()->getActive(); diff --git a/components/com_users/views/registration/metadata.xml b/components/com_users/views/registration/metadata.xml deleted file mode 100644 index 413d796845c8c..0000000000000 --- a/components/com_users/views/registration/metadata.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/components/com_users/views/remind/metadata.xml b/components/com_users/views/remind/metadata.xml deleted file mode 100644 index 6d0f32112bc20..0000000000000 --- a/components/com_users/views/remind/metadata.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/components/com_users/views/reset/metadata.xml b/components/com_users/views/reset/metadata.xml deleted file mode 100644 index f266c03d566a9..0000000000000 --- a/components/com_users/views/reset/metadata.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/components/com_wrapper/metadata.xml b/components/com_wrapper/metadata.xml deleted file mode 100644 index 9205b30529a2a..0000000000000 --- a/components/com_wrapper/metadata.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/components/com_wrapper/views/wrapper/tmpl/default.php b/components/com_wrapper/views/wrapper/tmpl/default.php index 6bf79cbe27c61..252117a44d88f 100644 --- a/components/com_wrapper/views/wrapper/tmpl/default.php +++ b/components/com_wrapper/views/wrapper/tmpl/default.php @@ -8,7 +8,7 @@ */ defined('_JEXEC') or die; -JHtml::script('com_wrapper/iframe-height.min.js', false, true); +JHtml::_('script', 'com_wrapper/iframe-height.min.js', array('version' => 'auto', 'relative' => true)); ?>
    params->get('show_page_heading')) : ?> diff --git a/installation/INSTALL b/installation/INSTALL index dcfdfce71854a..82bbb0198d724 100644 --- a/installation/INSTALL +++ b/installation/INSTALL @@ -16,7 +16,7 @@ First you must have the base environment for Joomla. We have thoroughly tested Joomla! on: Linux, Free BSD, Mac OS X and Windows. Linux or one of the BSD's are recommended, but anything else that can run a supported PHP version, a supported database and a supported web server listed -in the Technical Requirements at https://www.joomla.org/about-joomla/technical-requirements.html +in the Technical Requirements at https://downloads.joomla.org/technical-requirements should do it. @@ -44,7 +44,7 @@ INSTALLATION 1. DOWNLOAD Joomla You can obtain the latest Joomla! release from: - https://www.joomla.org/download.html + https://downloads.joomla.org/latest Copy the tar.gz file into a working directory eg diff --git a/installation/application/framework.php b/installation/application/framework.php index a4388526f81ba..382485fb584fa 100644 --- a/installation/application/framework.php +++ b/installation/application/framework.php @@ -33,7 +33,7 @@ */ // Import the Joomla Platform. -require_once JPATH_LIBRARIES . '/import.php'; +require_once JPATH_LIBRARIES . '/import.legacy.php'; // Bootstrap the CMS libraries. require_once JPATH_LIBRARIES . '/cms.php'; diff --git a/installation/application/web.php b/installation/application/web.php index 8420f32908cff..c7fcd58daa7a2 100644 --- a/installation/application/web.php +++ b/installation/application/web.php @@ -294,52 +294,27 @@ public function getLocalise() */ public function getLocaliseAdmin($db = false) { - // Read the files in the admin area. - $path = JLanguage::getLanguagePath(JPATH_ADMINISTRATOR); - $langfiles['admin'] = JFolder::folders($path); - - // Read the files in the site area. - $path = JLanguage::getLanguagePath(JPATH_SITE); - $langfiles['site'] = JFolder::folders($path); + $langfiles = array(); + // If db connection, fetch them from the database. if ($db) { - $langfiles_disk = $langfiles; - $langfiles = array(); - $langfiles['admin'] = array(); - $langfiles['site'] = array(); - - $query = $db->getQuery(true) - ->select($db->quoteName(array('element','client_id'))) - ->from($db->quoteName('#__extensions')) - ->where($db->quoteName('type') . ' = ' . $db->quote('language')); - $db->setQuery($query); - $langs = $db->loadObjectList(); - - foreach ($langs as $lang) + foreach (JLanguageHelper::getInstalledLanguages() as $clientId => $language) { - switch ($lang->client_id) + $clientName = $clientId === 0 ? 'site' : 'admin'; + + foreach ($language as $languageCode => $lang) { - // Site. - case 0: - if (in_array($lang->element, $langfiles_disk['site'])) - { - $langfiles['site'][] = $lang->element; - } - - break; - - // Administrator. - case 1: - if (in_array($lang->element, $langfiles_disk['admin'])) - { - $langfiles['admin'][] = $lang->element; - } - - break; + $langfiles[$clientName][] = $lang->element; } } } + // Read the folder names in the site and admin area. + else + { + $langfiles['site'] = JFolder::folders(JLanguage::getLanguagePath(JPATH_SITE)); + $langfiles['admin'] = JFolder::folders(JLanguage::getLanguagePath(JPATH_ADMINISTRATOR)); + } return $langfiles; } @@ -465,15 +440,16 @@ public function loadDocument(JDocument $document = null) if ($document === null) { $lang = JFactory::getLanguage(); - $type = $this->input->get('format', 'html', 'word'); + $date = new JDate('now'); $attributes = array( - 'charset' => 'utf-8', - 'lineend' => 'unix', - 'tab' => ' ', - 'language' => $lang->getTag(), - 'direction' => $lang->isRtl() ? 'rtl' : 'ltr', + 'charset' => 'utf-8', + 'lineend' => 'unix', + 'tab' => "\t", + 'language' => $lang->getTag(), + 'direction' => $lang->isRtl() ? 'rtl' : 'ltr', + 'mediaversion' => md5($date->format('YmdHi')), ); $document = JDocument::getInstance($type, $attributes); diff --git a/installation/controller/install/email.php b/installation/controller/install/email.php index bf22c9b79661b..6c5c8eeac71e0 100644 --- a/installation/controller/install/email.php +++ b/installation/controller/install/email.php @@ -132,11 +132,14 @@ public function execute() try { - $mail->Send(); + if (!$mail->Send()) + { + $app->enqueueMessage(JText::_('INSTL_EMAIL_NOT_SENT'), 'error'); + } } catch (Exception $e) { - $app->enqueueMessage(JText::_('INSTL_EMAIL_NOT_SENT'), 'warning'); + $app->enqueueMessage(JText::_('INSTL_EMAIL_NOT_SENT'), 'error'); } $app->sendJsonResponse($r); diff --git a/installation/form/field/language.php b/installation/form/field/language.php index ad7935d21644e..6d98a7c1c4f84 100644 --- a/installation/form/field/language.php +++ b/installation/form/field/language.php @@ -8,14 +8,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Language Form Field class. * * @since 1.6 */ -class InstallationFormFieldLanguage extends JFormFieldList +class InstallationFormFieldLanguage extends JFormAbstractlist { /** * The form field type. diff --git a/installation/language/en-GB/en-GB.ini b/installation/language/en-GB/en-GB.ini index 8da8e14ed8939..ec72b464be54d 100644 --- a/installation/language/en-GB/en-GB.ini +++ b/installation/language/en-GB/en-GB.ini @@ -66,12 +66,12 @@ INSTL_FTP_PASSWORD_DESC="Warning! It is recommended to leave this blank and ente ;Site View INSTL_SITE="Main Configuration" -INSTL_ADMIN_EMAIL_LABEL="Administrator Email" +INSTL_ADMIN_EMAIL_LABEL="Email" INSTL_ADMIN_EMAIL_DESC="Enter an email address. This will be the email address of the website Super User." -INSTL_ADMIN_PASSWORD_LABEL="Administrator Password" +INSTL_ADMIN_PASSWORD_LABEL="Password" INSTL_ADMIN_PASSWORD_DESC="Set the password for your Super User account and confirm it in the field below." -INSTL_ADMIN_PASSWORD2_LABEL="Confirm Administrator Password" -INSTL_ADMIN_USER_LABEL="Administrator Username" +INSTL_ADMIN_PASSWORD2_LABEL="Confirm Password" +INSTL_ADMIN_USER_LABEL="Username" INSTL_ADMIN_USER_DESC="Set the username for your Super User account." INSTL_SITE_NAME_LABEL="Site Name" INSTL_SITE_NAME_DESC="Enter the name of your Joomla! site." @@ -93,6 +93,7 @@ INSTL_SAMPLE_BROCHURE_SET_DESC="Install Joomla with a few pages (a menu with pag INSTL_SAMPLE_DATA_SET_DESC="Install Joomla with one page (a menu with one link) and modules like Latest Article, Login Form." INSTL_SAMPLE_LEARN_SET_DESC="Install Joomla with example articles that describe how Joomla works." INSTL_SAMPLE_TESTING_SET_DESC="Install Joomla with all possible menu items to help with testing Joomla." +INSTL_SUPER_USER_TITLE="Super User Account Details" ;Summary view INSTL_FINALISATION="Finalisation" diff --git a/installation/language/ga-IE/ga-IE.ini b/installation/language/ga-IE/ga-IE.ini index ffd23b05b0a05..893c654c2809e 100644 --- a/installation/language/ga-IE/ga-IE.ini +++ b/installation/language/ga-IE/ga-IE.ini @@ -1,4 +1,4 @@ -; Joomla! Project +; Joomla! Project ; Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. ; License GNU General Public License version 2 or later; see LICENSE.txt ; Note : All ini files need to be saved as UTF-8 @@ -28,7 +28,8 @@ INSTL_PRECHECK_ACTUAL="Séard atá ann" ; Database view INSTL_DATABASE="Cumraíocht Bhunachair Sonraí" -INSTL_DATABASE_HOST_DESC=""localhost", de ghnáth." +INSTL_DATABASE_ERROR_POSTGRESQL_QUERY="Theip ar an iarratas PostgreSQL." +INSTL_DATABASE_HOST_DESC=""localhost", de ghnáth, nó ainm a sholáthair an t-óstach." INSTL_DATABASE_HOST_LABEL="Óstainm" INSTL_DATABASE_NAME_DESC="Ní cheadaíonn roinnt óstach agus bunachar sonraí amháin ar gach suíomh. Sa chás seo, is féidir réimír thábla a úsáid le haghaidh suíomhanna éagsúla Joomla!." INSTL_DATABASE_NAME_LABEL="Ainm an Bhunachair Sonraí" @@ -42,9 +43,10 @@ INSTL_DATABASE_PREFIX_LABEL="Réimír Thábla" INSTL_DATABASE_PREFIX_MSG="Ní mór litir a bheith ag tús na réimíre, ansin carachtair (roghnacha) alfa-uimhriúla, agus fostríoc ag an deireadh" INSTL_DATABASE_TYPE_DESC=""MySQLi" is dócha." INSTL_DATABASE_TYPE_LABEL="Cineál an Bhunachair Sonraí" -INSTL_DATABASE_USER_DESC="Is éard atá ann ná "root" nó ainm úsáideora ón óstach." +INSTL_DATABASE_USER_DESC="Is éard atá ann ná ainm úsáideora a chruthaigh tusa, nó ceann a sholáthair an t-óstach." INSTL_DATABASE_USER_LABEL="Ainm Úsáideora" + ;FTP view INSTL_AUTOFIND_FTP_PATH="Aimsigh an Cosán FTP go huathoibríoch" INSTL_FTP="Cumraíocht FTP" @@ -64,12 +66,12 @@ INSTL_FTP_PASSWORD_DESC="Rabhadh! Moltar duit an réimse seo a fhágáil folamh ;Site View INSTL_SITE="Príomhchumraíocht" -INSTL_ADMIN_EMAIL_LABEL="Seoladh R-Phoist an Riarthóra" +INSTL_ADMIN_EMAIL_LABEL="Ríomhphost" INSTL_ADMIN_EMAIL_DESC="Cuir isteach seoladh ríomhphoist. Is é seo an seoladh ríomhphoist atá ag Forúsáideoir an tSuímh." -INSTL_ADMIN_PASSWORD_LABEL="Focal Faire an Riarthóra" +INSTL_ADMIN_PASSWORD_LABEL="Focal faire" INSTL_ADMIN_PASSWORD_DESC="Tabhair focal faire an Fhorúsáideora, agus deimhnigh sa réimse thíos é." -INSTL_ADMIN_PASSWORD2_LABEL="Dearbhaigh Focal Faire an Riarthóra" -INSTL_ADMIN_USER_LABEL="Ainm Úsáideora an Riarthóra" +INSTL_ADMIN_PASSWORD2_LABEL="Dearbhaigh an Focal Faire" +INSTL_ADMIN_USER_LABEL="Ainm Úsáideora" INSTL_ADMIN_USER_DESC="Tabhair ainm chuntas an Fhorúsáideora." INSTL_SITE_NAME_LABEL="Ainm an tSuímh" INSTL_SITE_NAME_DESC="Cuir isteach ainm do shuímh Jooma!." @@ -91,6 +93,7 @@ INSTL_SAMPLE_BROCHURE_SET_DESC="Suiteáil Joomla le roinnt leathanach (roghchlá INSTL_SAMPLE_DATA_SET_DESC="Suiteáil Joomla le leathanach amháin (roghchlár le nasc amháin) agus modúil Alt Is Déanaí, Foirm Logála Isteach." INSTL_SAMPLE_LEARN_SET_DESC="Suiteáil Joomla le haltanna samplacha a dhéanann cur síos ar Joomla." INSTL_SAMPLE_TESTING_SET_DESC="Suiteáil Joomla le gach ar féidir de mhíreanna, chun tástáil a dhéanamh ar Joomla." +INSTL_SUPER_USER_TITLE="Sonraí Chuntas an Fhorúsáideora" ;Summary view INSTL_FINALISATION="Dlaoi Mullaigh" @@ -142,7 +145,7 @@ INSTL_LANGUAGES_DESC="Tá comhéadan Joomla ar fáil i roinnt teangacha éagsúl INSTL_LANGUAGES_MESSAGE_PLEASE_WAIT="Tógfaidh sé suas le 10 soicind chun gach teanga a chur i gcrích
    Fan nóiméad go dtí go mbeidh na teangacha íoslódáilte agus suiteáilte..." INSTL_LANGUAGES_MORE_LANGUAGES="Brúigh an cnaipe 'Roimhe Seo' más mian leat tuilleadh teangacha a shuiteáil." INSTL_LANGUAGES_NO_LANGUAGE_SELECTED="Níor roghnaigh tú aon teanga le suiteáil. Más mian leat níos mó teangacha a shuiteáil, brúigh an cnaipe 'Roimhe Seo' agus roghnaigh na teangacha ón liosta." -INSTL_LANGUAGES_WARNING_NO_INTERNET="Ní raibh Joomla! in ann ceangal a bhunú le freastalaí na dteangacha. Cuir an tsuiteáil i gcrích anois." +INSTL_LANGUAGES_WARNING_NO_INTERNET="Ní raibh Joomla in ann ceangal a bhunú le freastalaí na dteangacha. Cuir an tsuiteáil i gcrích anois." INSTL_LANGUAGES_WARNING_NO_INTERNET2="Beidh tú in ann teangacha a shuiteáil ar ball trí Riarthóir Joomla!" INSTL_LANGUAGES_WARNING_BACK_BUTTON="Fill ar an gcéim shuiteála roimhe seo" @@ -157,18 +160,19 @@ INSTL_DEFAULTLANGUAGE_ADMIN_SET_DEFAULT="Shocraigh Joomla %s mar an teanga réam INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_SELECT="Roghnaigh" INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_LANGUAGE="Teanga" INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_TAG="Clib" -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CONTENT_LANGUAGE="Níorbh fhéidir le Joomla an teanga ábhair %s a chruthú go huathoibríoch" -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU="Níorbh fhéidir le Joomla an roghchlár %s a chruthú go huathoibríoch" -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_ITEM="Níorbh fhéidir le Joomla an mhír %s sa roghchlár baile a chruthú go huathoibríoch" -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_MODULE="Níorbh fhéidir le Joomla an modúl roghchláir %s a chruthú go huathoibríoch" -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CATEGORY="Níorbh fhéidir le Joomla an chatagóir ábhair %s a chruthú go huathoibríoch" -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_ARTICLE="Níorbh fhéidir le Joomla an t-alt logánaithe %s a chruthú go huathoibríoch" -INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_MODULESWHITCHER_LANGUAGECODE="Níorbh fhéidir le Joomla an roghnóir teanga %s a chruthú go huathoibríoch" -INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGECODE="Níorbh fhéidir le Joomla an Breiseán Cóid Teanga %s a chruthú go huathoibríoch" -INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGEFILTER="Níorbh fhéidir le Joomla an Breiseán Scagaire Teanga %s a chruthú go huathoibríoch" +INSTL_DEFAULTLANGUAGE_COULD_NOT_ADD_ASSOCIATIONS="Níorbh fhéidir le Joomla na nascanna teanga a chruthú go huathoibríoch." +INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CONTENT_LANGUAGE="Níorbh fhéidir le Joomla an teanga ábhair %s a chruthú go huathoibríoch." +INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU="Níorbh fhéidir le Joomla an roghchlár %s a chruthú go huathoibríoch." +INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_ITEM="Níorbh fhéidir le Joomla an mhír %s sa roghchlár baile a chruthú go huathoibríoch." +INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_MODULE="Níorbh fhéidir le Joomla an modúl roghchláir %s a chruthú go huathoibríoch." +INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CATEGORY="Níorbh fhéidir le Joomla an chatagóir ábhair %s a chruthú go huathoibríoch." +INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_ARTICLE="Níorbh fhéidir le Joomla an t-alt logánaithe %s a chruthú go huathoibríoch." +INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_MODULESWHITCHER_LANGUAGECODE="Níorbh fhéidir le Joomla an roghnóir teanga a fhoilsiú go huathoibríoch." +INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGECODE="Níorbh fhéidir le Joomla an Breiseán Cóid Teanga a chumasú go huathoibríoch." +INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGEFILTER="Níorbh fhéidir le Joomla an Breiseán Scagaire Teanga a chruthú go huathoibríoch." INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_LANGUAGE="Níorbh fhéidir le Joomla teanga %s a shuiteáil." -INSTL_DEFAULTLANGUAGE_COULD_NOT_PUBLISH_MOD_MULTILANGSTATUS="Níorbh fhéidir le Joomla an modúl stádais teanga a fhoilsiú go huathoibríoch" -INSTL_DEFAULTLANGUAGE_COULD_NOT_UNPUBLISH_MOD_DEFAULTMENU="Níorbh fhéidir le Joomla an modúl roghchláir réamhshocraithe a dhífhoilsiú go huathoibríoch" +INSTL_DEFAULTLANGUAGE_COULD_NOT_PUBLISH_MOD_MULTILANGSTATUS="Níorbh fhéidir le Joomla an modúl stádais teanga a fhoilsiú go huathoibríoch." +INSTL_DEFAULTLANGUAGE_COULD_NOT_UNPUBLISH_MOD_DEFAULTMENU="Níorbh fhéidir le Joomla an modúl roghchláir réamhshocraithe a dhífhoilsiú go huathoibríoch." INSTL_DEFAULTLANGUAGE_DESC="Shuiteáil Joomla na teangacha seo a leanas. Roghnaigh teanga réamhshocraithe don Riarthóir Joomla." INSTL_DEFAULTLANGUAGE_DESC_FRONTEND="Shuiteáil Joomla na teangacha seo a leanas. Roghnaigh teanga réamhshocraithe don Chomhéadan Joomla." INSTL_DEFAULTLANGUAGE_FRONTEND="Teanga Réamhshocraithe an tSuímh" @@ -221,7 +225,7 @@ INSTL_ERROR_CONNECT_DB="Ní fhéadfaí ceangal leis an mbunachar sonraí. Fuarth INSTL_STD_OFFLINE_MSG="Tá an suíomh seo as líne le haghaidh cothabhála.
    Bain triail eile as go luath." ;FTP model -INSTL_FTP_INVALIDROOT="The specified FTP Folder is not the folder of this Joomla! installation" +INSTL_FTP_INVALIDROOT="Ní hé an fillteán FTP seo fillteán na suiteála Joomla! seo" INSTL_FTP_NOCONNECT="Ní fhéadfaí ceangal leis an bhfreastalaí FTP" INSTL_FTP_NODELE="Theip ar an bhfeidhm "DELE"." INSTL_FTP_NODIRECTORYLISTING="Níorbh fhéidir liostáil na bhfillteán a fháil ón bhfreastalaí FTP." @@ -238,7 +242,7 @@ INSTL_FTP_NOSYST="Theip ar an bhfeidhm "SYST"." INSTL_FTP_UNABLE_DETECT_ROOT_FOLDER="Níorbh fhéidir an fréamhfhillteán FTP a bhrath go huathoibríoch." ;others -INSTL_CONFPROBLEM="Your configuration file or folder is not writable or there was a problem creating the configuration file. You will have to upload the following code by hand. Select in the text area to highlight all of the code and then paste into a new text file. Name this file 'configuration.php' and upload it to your site root folder." +INSTL_CONFPROBLEM="Ní féidir scríobh sa chomhad nó san fhillteán cumraíochta, nó tharla earráid agus an comhad cumraíochta á chruthú. Ní mór duit an cód seo a leanas a uaslódáil de láimh. Roghnaigh an cód go léir sa limistéar téacs, greamaigh i dtéacschomhad nua é darb ainm 'configuration.php', agus uaslódáil go dtí fréamhfhillteán do shuímh é." INSTL_DATABASE_SUPPORT="Tacaíocht do Bhunachar Sonraí:" INSTL_DISPLAY_ERRORS="Taispeáin Earráidí" INSTL_ERROR_DB="Tharla earráidí agus an bunachar sonraí á líonadh: %s" @@ -274,7 +278,7 @@ JCHECK_AGAIN="Seiceáil Arís" JERROR="Earráid" JEMAIL="Ríomhphost" JGLOBAL_ISFREESOFTWARE="Is saorbhogearra é %s, ar fáil de réir an %s." -JGLOBAL_LANGUAGE_VERSION_NOT_PLATFORM="Ní mheaitseálann an pacáiste teanga an leagan seo de Joomla!. Seans go mbeidh roinnt teaghrán ar iarraidh." +JGLOBAL_LANGUAGE_VERSION_NOT_PLATFORM="Ní mheaitseálann an pacáiste teanga an leagan seo de Joomla!. Seans go mbeidh roinnt teaghrán ar iarraidh agus taispeánfar i mBéarla iad." JGLOBAL_SELECT_AN_OPTION="Roghnaigh rogha" JGLOBAL_SELECT_NO_RESULTS_MATCH="Toradh ar bith" JGLOBAL_SELECT_SOME_OPTIONS="Roghnaigh roinnt roghanna" @@ -323,3 +327,16 @@ POSTGRESQL="PostgreSQL" SQLAZURE="Microsoft SQL Azure" SQLITE="SQLite" SQLSRV="Microsoft SQL Server" + +; Javascript message titles +ERROR="Earráid" +MESSAGE="Teachtaireacht" +NOTICE="Fógra" +WARNING="Rabhadh" + +; Javascript ajax error messages +JLIB_JS_AJAX_ERROR_CONNECTION_ABORT="Thobscoir an ceangal agus na sonraí JSON á n-íoslódáil." +JLIB_JS_AJAX_ERROR_NO_CONTENT="Níor seoladh aon ábhar ar ais." +JLIB_JS_AJAX_ERROR_OTHER="Tharla earráid agus na sonraí JSON á n-íoslódáil: cód stádais HTTP %s." +JLIB_JS_AJAX_ERROR_PARSE="Tharla earráid pharsála agus na sonraí JSON seo a leanas á bpróiseáil:
    %s" +JLIB_JS_AJAX_ERROR_TIMEOUT="Chuaigh an ceangal thar am agus na sonraí JSON á n-íoslódáil." diff --git a/installation/language/ga-IE/ga-IE.xml b/installation/language/ga-IE/ga-IE.xml index 81c6a43039fa9..9c91321027a7a 100644 --- a/installation/language/ga-IE/ga-IE.xml +++ b/installation/language/ga-IE/ga-IE.xml @@ -1,11 +1,12 @@ - + Irish (ga-IE) - 3.6.0 - 2016-02-05 + 3.6.4.1 + 2016-11-08 Irish translation team Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt + Irish installation language ga-IE.ini Gaeilge (Éire) diff --git a/installation/model/database.php b/installation/model/database.php index 1aa1ce80129ee..6fbe39b0a2e3a 100644 --- a/installation/model/database.php +++ b/installation/model/database.php @@ -747,7 +747,7 @@ public function installSampleData($options) return false; } - $this->postInstallSampleData($db); + $this->postInstallSampleData($db, $options->sample_file); } return true; @@ -756,16 +756,23 @@ public function installSampleData($options) /** * Sample data tables and data post install process. * - * @param JDatabaseDriver $db Database connector object $db*. + * @param JDatabaseDriver $db Database connector object $db*. + * @param string $sampleFileName The sample dats filename. * * @return void * * @since 3.1 */ - protected function postInstallSampleData($db) + protected function postInstallSampleData($db, $sampleFileName = '') { // Update the sample data user ids. $this->updateUserIds($db); + + // If not joomla sample data for testing, update the sample data dates. + if ($sampleFileName !== 'sample_testing.sql') + { + $this->updateDates($db); + } } /** @@ -805,8 +812,11 @@ public function installCmsData($options) */ protected function postInstallCmsData($db) { - // Update the sample data user ids. + // Update the cms data user ids. $this->updateUserIds($db); + + // Update the cms data dates. + $this->updateDates($db); } /** @@ -823,22 +833,23 @@ protected function updateUserIds($db) // Create the ID for the root user. $userId = self::getUserId(); - // Update all created_by field of the tables with the random user id - // categories (created_user_id), contact_details, content, newsfeeds. - $updates_array = array( - 'categories' => 'created_user_id', - 'contact_details' => 'created_by', - 'content' => 'created_by', - 'newsfeeds' => 'created_by', - 'tags' => 'created_user_id', - 'ucm_content' => 'core_created_user_id', - 'ucm_history' => 'editor_user_id', + // Update all core tables created_by fields of the tables with the random user id. + $updatesArray = array( + '#__banners' => 'created_by', + '#__categories' => 'created_user_id', + '#__contact_details' => 'created_by', + '#__content' => 'created_by', + '#__newsfeeds' => 'created_by', + '#__tags' => 'created_user_id', + '#__ucm_content' => 'core_created_user_id', + '#__ucm_history' => 'editor_user_id', + '#__user_notes' => 'created_user_id', ); - foreach ($updates_array as $table => $field) + foreach ($updatesArray as $table => $field) { $query = $db->getQuery(true) - ->update($db->quoteName('#__' . $table)) + ->update($db->quoteName($table)) ->set($db->quoteName($field) . ' = ' . $db->quote($userId)); $db->setQuery($query); @@ -854,6 +865,65 @@ protected function updateUserIds($db) } } + /** + * Method to update the dates of sql data content to the current date. + * + * @param JDatabaseDriver $db Database connector object $db*. + * + * @return boolean True on success. + * + * @since __DEPLOY_VERSION__ + */ + protected function updateDates($db) + { + // Get the current date. + $currentDate = JFactory::getDate()->toSql(); + $nullDate = $db->getNullDate(); + + // Update all core tables date fields of the tables with the current date. + $updatesArray = array( + '#__banners' => array('publish_up', 'publish_down', 'reset', 'created', 'modified'), + '#__banner_tracks' => array('track_date'), + '#__categories' => array('created_time', 'modified_time'), + '#__contact_details' => array('publish_up', 'publish_down', 'created', 'modified'), + '#__content' => array('publish_up', 'publish_down', 'created', 'modified'), + '#__contentitem_tag_map' => array('tag_date'), + '#__finder_filters' => array('created', 'modified'), + '#__finder_links' => array('indexdate', 'publish_start_date', 'publish_end_date', 'start_date', 'end_date'), + '#__messages' => array('date_time'), + '#__modules' => array('publish_up', 'publish_down'), + '#__newsfeeds' => array('publish_up', 'publish_down', 'created', 'modified'), + '#__redirect_links' => array('created_date', 'modified_date'), + '#__tags' => array('publish_up', 'publish_down', 'created_time', 'modified_time'), + '#__ucm_content' => array('core_created_time', 'core_modified_time', 'core_publish_up', 'core_publish_down'), + '#__ucm_history' => array('save_date'), + '#__users' => array('registerDate', 'lastvisitDate', 'lastResetTime'), + '#__user_notes' => array('publish_up', 'publish_down', 'created_time', 'modified_time'), + ); + + foreach ($updatesArray as $table => $fields) + { + foreach ($fields as $field) + { + $query = $db->getQuery(true) + ->update($db->quoteName($table)) + ->set($db->quoteName($field) . ' = ' . $db->quote($currentDate)) + ->where($db->quoteName($field) . ' != ' . $db->quote($nullDate)); + + $db->setQuery($query); + + try + { + $db->execute(); + } + catch (RuntimeException $e) + { + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); + } + } + } + } + /** * Method to backup all tables in a database with a given prefix. * diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index e9ac270eff6d6..672d6f48d5bee 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -33,55 +33,55 @@ CREATE TABLE IF NOT EXISTS `#__assets` ( INSERT INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name`, `title`, `rules`) VALUES (1, 0, 0, 103, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.offline":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (2, 1, 1, 2, 1, 'com_admin', 'com_admin', '{}'), -(3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), (4, 1, 7, 8, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (5, 1, 9, 10, 1, 'com_checkin', 'com_checkin', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (6, 1, 11, 12, 1, 'com_config', 'com_config', '{}'), -(7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(8, 1, 17, 20, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}'), +(7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(8, 1, 17, 20, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}'), (9, 1, 21, 22, 1, 'com_cpanel', 'com_cpanel', '{}'), -(10, 1, 23, 24, 1, 'com_installer', 'com_installer', '{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), -(11, 1, 25, 26, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(10, 1, 23, 24, 1, 'com_installer', 'com_installer', '{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), +(11, 1, 25, 26, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1}}'), (12, 1, 27, 28, 1, 'com_login', 'com_login', '{}'), (13, 1, 29, 30, 1, 'com_mailto', 'com_mailto', '{}'), (14, 1, 31, 32, 1, 'com_massmail', 'com_massmail', '{}'), (15, 1, 33, 34, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}'), -(16, 1, 35, 38, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(16, 1, 35, 38, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1}}'), (17, 1, 39, 40, 1, 'com_messages', 'com_messages', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), -(18, 1, 41, 72, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(19, 1, 73, 76, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(20, 1, 77, 78, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1},"core.manage":[],"core.edit":[],"core.edit.state":[]}'), -(21, 1, 79, 80, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1},"core.manage":[]}'), +(18, 1, 41, 72, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1}}'), +(19, 1, 73, 76, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(20, 1, 77, 78, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1}}'), +(21, 1, 79, 80, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1}}'), (22, 1, 81, 82, 1, 'com_search', 'com_search', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(23, 1, 83, 84, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(24, 1, 85, 88, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(23, 1, 83, 84, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1}}'), +(24, 1, 85, 88, 1, 'com_users', 'com_users', '{"core.admin":{"7":1}}'), (26, 1, 89, 90, 1, 'com_wrapper', 'com_wrapper', '{}'), -(27, 8, 18, 19, 2, 'com_content.category.2', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(30, 19, 74, 75, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(32, 24, 86, 87, 1, 'com_users.category.7', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(27, 8, 18, 19, 2, 'com_content.category.2', 'Uncategorised', '{}'), +(28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{}'), +(29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{}'), +(30, 19, 74, 75, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{}'), +(32, 24, 86, 87, 2, 'com_users.category.7', 'Uncategorised', '{}'), (33, 1, 91, 92, 1, 'com_finder', 'com_finder', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(34, 1, 93, 94, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), -(35, 1, 95, 96, 1, 'com_tags', 'com_tags', '{"core.admin":[],"core.manage":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), +(34, 1, 93, 94, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{}'), +(35, 1, 95, 96, 1, 'com_tags', 'com_tags', '{}'), (36, 1, 97, 98, 1, 'com_contenthistory', 'com_contenthistory', '{}'), (37, 1, 99, 100, 1, 'com_ajax', 'com_ajax', '{}'), (38, 1, 101, 102, 1, 'com_postinstall', 'com_postinstall', '{}'), -(39, 18, 42, 43, 2, 'com_modules.module.1', 'Main Menu', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(40, 18, 44, 45, 2, 'com_modules.module.2', 'Login', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(41, 18, 46, 47, 2, 'com_modules.module.3', 'Popular Articles', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(42, 18, 48, 49, 2, 'com_modules.module.4', 'Recently Added Articles', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(43, 18, 50, 51, 2, 'com_modules.module.8', 'Toolbar', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(44, 18, 52, 53, 2, 'com_modules.module.9', 'Quick Icons', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(45, 18, 54, 55, 2, 'com_modules.module.10', 'Logged-in Users', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(46, 18, 56, 57, 2, 'com_modules.module.12', 'Admin Menu', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(47, 18, 58, 59, 2, 'com_modules.module.13', 'Admin Submenu', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(48, 18, 60, 61, 2, 'com_modules.module.14', 'User Status', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(49, 18, 62, 63, 2, 'com_modules.module.15', 'Title', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(50, 18, 64, 65, 2, 'com_modules.module.16', 'Login Form', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(51, 18, 66, 67, 2, 'com_modules.module.17', 'Breadcrumbs', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(52, 18, 68, 69, 2, 'com_modules.module.79', 'Multilanguage status', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(53, 18, 70, 71, 2, 'com_modules.module.86', 'Joomla Version', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(39, 18, 42, 43, 2, 'com_modules.module.1', 'Main Menu', '{}'), +(40, 18, 44, 45, 2, 'com_modules.module.2', 'Login', '{}'), +(41, 18, 46, 47, 2, 'com_modules.module.3', 'Popular Articles', '{}'), +(42, 18, 48, 49, 2, 'com_modules.module.4', 'Recently Added Articles', '{}'), +(43, 18, 50, 51, 2, 'com_modules.module.8', 'Toolbar', '{}'), +(44, 18, 52, 53, 2, 'com_modules.module.9', 'Quick Icons', '{}'), +(45, 18, 54, 55, 2, 'com_modules.module.10', 'Logged-in Users', '{}'), +(46, 18, 56, 57, 2, 'com_modules.module.12', 'Admin Menu', '{}'), +(47, 18, 58, 59, 2, 'com_modules.module.13', 'Admin Submenu', '{}'), +(48, 18, 60, 61, 2, 'com_modules.module.14', 'User Status', '{}'), +(49, 18, 62, 63, 2, 'com_modules.module.15', 'Title', '{}'), +(50, 18, 64, 65, 2, 'com_modules.module.16', 'Login Form', '{}'), +(51, 18, 66, 67, 2, 'com_modules.module.17', 'Breadcrumbs', '{}'), +(52, 18, 68, 69, 2, 'com_modules.module.79', 'Multilanguage status', '{}'), +(53, 18, 70, 71, 2, 'com_modules.module.86', 'Joomla Version', '{}'), (54, 16, 36, 37, 2, 'com_menus.menu.1', 'Main Menu', '{}'); -- -------------------------------------------------------- @@ -462,7 +462,7 @@ CREATE TABLE IF NOT EXISTS `#__extensions` ( `element` varchar(100) NOT NULL, `folder` varchar(100) NOT NULL, `client_id` tinyint(3) NOT NULL, - `enabled` tinyint(3) NOT NULL DEFAULT 1, + `enabled` tinyint(3) NOT NULL DEFAULT 0, `access` int(10) unsigned NOT NULL DEFAULT 1, `protected` tinyint(3) NOT NULL DEFAULT 0, `manifest_cache` text NOT NULL, @@ -503,17 +503,18 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (17, 'com_newsfeeds', 'component', 'com_newsfeeds', '', 1, 1, 1, 0, '', '{"newsfeed_layout":"_:default","save_history":"1","history_limit":5,"show_feed_image":"1","show_feed_description":"1","show_item_description":"1","feed_character_count":"0","feed_display_order":"des","float_first":"right","float_second":"right","show_tags":"1","category_layout":"_:default","show_category_title":"1","show_description":"1","show_description_image":"1","maxLevel":"-1","show_empty_categories":"0","show_subcat_desc":"1","show_cat_items":"1","show_cat_tags":"1","show_base_description":"1","maxLevelcat":"-1","show_empty_categories_cat":"0","show_subcat_desc_cat":"1","show_cat_items_cat":"1","filter_field":"1","show_pagination_limit":"1","show_headings":"1","show_articles":"0","show_link":"1","show_pagination":"1","show_pagination_results":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (18, 'com_plugins', 'component', 'com_plugins', '', 1, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (19, 'com_search', 'component', 'com_search', '', 1, 1, 1, 0, '', '{"enabled":"0","show_date":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), -(20, 'com_templates', 'component', 'com_templates', '', 1, 1, 1, 1, '', '{"template_positions_display":"0","upload_limit":"10","image_formats":"gif,bmp,jpg,jpeg,png","source_formats":"txt,less,ini,xml,js,php,css","font_formats":"woff,ttf,otf","compressed_formats":"zip"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(20, 'com_templates', 'component', 'com_templates', '', 1, 1, 1, 1, '', '{"template_positions_display":"0","upload_limit":"10","image_formats":"gif,bmp,jpg,jpeg,png","source_formats":"txt,less,ini,xml,js,php,css,scss,sass","font_formats":"woff,ttf,otf","compressed_formats":"zip"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (22, 'com_content', 'component', 'com_content', '', 1, 1, 0, 1, '', '{"article_layout":"_:default","show_title":"1","link_titles":"1","show_intro":"1","show_category":"1","link_category":"1","show_parent_category":"0","link_parent_category":"0","show_author":"1","link_author":"0","show_create_date":"0","show_modify_date":"0","show_publish_date":"1","show_item_navigation":"1","show_vote":"0","show_readmore":"1","show_readmore_title":"1","readmore_limit":"100","show_icons":"1","show_print_icon":"1","show_email_icon":"1","show_hits":"1","show_noauth":"0","show_publishing_options":"1","show_article_options":"1","save_history":"1","history_limit":10,"show_urls_images_frontend":"0","show_urls_images_backend":"1","targeta":0,"targetb":0,"targetc":0,"float_intro":"left","float_fulltext":"left","category_layout":"_:blog","show_category_title":"0","show_description":"0","show_description_image":"0","maxLevel":"1","show_empty_categories":"0","show_no_articles":"1","show_subcat_desc":"1","show_cat_num_articles":"0","show_base_description":"1","maxLevelcat":"-1","show_empty_categories_cat":"0","show_subcat_desc_cat":"1","show_cat_num_articles_cat":"1","num_leading_articles":"1","num_intro_articles":"4","num_columns":"2","num_links":"4","multi_column_order":"0","show_subcategory_content":"0","show_pagination_limit":"1","filter_field":"hide","show_headings":"1","list_show_date":"0","date_format":"","list_show_hits":"1","list_show_author":"1","orderby_pri":"order","orderby_sec":"rdate","order_date":"published","show_pagination":"2","show_pagination_results":"1","show_feed_link":"1","feed_summary":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (23, 'com_config', 'component', 'com_config', '', 1, 1, 0, 1, '', '{"filters":{"1":{"filter_type":"NH","filter_tags":"","filter_attributes":""},"6":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"7":{"filter_type":"NONE","filter_tags":"","filter_attributes":""},"2":{"filter_type":"NH","filter_tags":"","filter_attributes":""},"3":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"4":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"5":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"10":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"12":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"8":{"filter_type":"NONE","filter_tags":"","filter_attributes":""}}}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (24, 'com_redirect', 'component', 'com_redirect', '', 1, 1, 0, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), -(25, 'com_users', 'component', 'com_users', '', 1, 1, 0, 1, '', '{"allowUserRegistration":"0","new_usertype":"2","guest_usergroup":"9","sendpassword":"1","useractivation":"1","mail_to_admin":"0","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","minimum_length":"4","minimum_integers":"0","minimum_symbols":"0","minimum_uppercase":"0","save_history":"1","history_limit":5,"mailSubjectPrefix":"","mailBodySuffix":""}', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(25, 'com_users', 'component', 'com_users', '', 1, 1, 0, 1, '', '{"allowUserRegistration":"0","new_usertype":"2","guest_usergroup":"9","sendpassword":"1","useractivation":"2","mail_to_admin":"1","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","minimum_length":"4","minimum_integers":"0","minimum_symbols":"0","minimum_uppercase":"0","save_history":"1","history_limit":5,"mailSubjectPrefix":"","mailBodySuffix":""}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (27, 'com_finder', 'component', 'com_finder', '', 1, 1, 0, 0, '', '{"show_description":"1","description_length":255,"allow_empty_query":"0","show_url":"1","show_advanced":"1","expand_advanced":"0","show_date_filters":"0","highlight_terms":"1","opensearch_name":"","opensearch_description":"","batch_size":"50","memory_table_limit":30000,"title_multiplier":"1.7","text_multiplier":"0.7","meta_multiplier":"1.2","path_multiplier":"2.0","misc_multiplier":"0.3","stemmer":"snowball"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (28, 'com_joomlaupdate', 'component', 'com_joomlaupdate', '', 1, 1, 0, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (29, 'com_tags', 'component', 'com_tags', '', 1, 1, 1, 1, '', '{"tag_layout":"_:default","save_history":"1","history_limit":5,"show_tag_title":"0","tag_list_show_tag_image":"0","tag_list_show_tag_description":"0","tag_list_image":"","show_tag_num_items":"0","tag_list_orderby":"title","tag_list_orderby_direction":"ASC","show_headings":"0","tag_list_show_date":"0","tag_list_show_item_image":"0","tag_list_show_item_description":"0","tag_list_item_maximum_characters":0,"return_any_or_all":"1","include_children":"0","maximum":200,"tag_list_language_filter":"all","tags_layout":"_:default","all_tags_orderby":"title","all_tags_orderby_direction":"ASC","all_tags_show_tag_image":"0","all_tags_show_tag_descripion":"0","all_tags_tag_maximum_characters":20,"all_tags_show_tag_hits":"0","filter_field":"1","show_pagination_limit":"1","show_pagination":"2","show_pagination_results":"1","tag_field_ajax_mode":"1","show_feed_link":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (30, 'com_contenthistory', 'component', 'com_contenthistory', '', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (31, 'com_ajax', 'component', 'com_ajax', '', 1, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (32, 'com_postinstall', 'component', 'com_postinstall', '', 1, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(33, 'com_fields', 'component', 'com_fields', '', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (102, 'phputf8', 'library', 'phputf8', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (103, 'Joomla! Platform', 'library', 'joomla', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (104, 'IDNA Convert', 'library', 'idna_convert', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), @@ -617,6 +618,8 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (458, 'plg_quickicon_phpversioncheck', 'plugin', 'phpversioncheck', 'quickicon', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (459, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (460, 'plg_editors-xtd_contact', 'plugin', 'contact', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(461, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(462, 'plg_fields_gallery', 'plugin', 'gallery', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (503, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (504, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (506, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), @@ -628,6 +631,68 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` -- -------------------------------------------------------- +-- +-- Table structure for table `#__fields` +-- + +CREATE TABLE IF NOT EXISTS `#__fields` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `asset_id` int(10) NOT NULL DEFAULT 0, + `context` varchar(255) NOT NULL DEFAULT '', + `catid` int(10) NOT NULL DEFAULT 0, + `assigned_cat_ids` varchar(255) NOT NULL DEFAULT '', + `title` varchar(255) NOT NULL DEFAULT '', + `alias` varchar(255) NOT NULL DEFAULT '', + `label` varchar(255) NOT NULL DEFAULT '', + `default_value` text NOT NULL DEFAULT '', + `type` varchar(255) NOT NULL DEFAULT 'text', + `options` varchar(255) NOT NULL DEFAULT '', + `note` varchar(255) NOT NULL DEFAULT '', + `description` text NOT NULL, + `state` tinyint(1) NOT NULL DEFAULT '0', + `required` tinyint(1) NOT NULL DEFAULT '0', + `checked_out` int(11) NOT NULL DEFAULT '0', + `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `ordering` int(11) NOT NULL DEFAULT '0', + `params` text NOT NULL, + `fieldparams` text NOT NULL, + `attributes` text NOT NULL, + `language` char(7) NOT NULL DEFAULT '', + `created_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created_user_id` int(10) unsigned NOT NULL DEFAULT '0', + `created_by_alias` varchar(255) NOT NULL DEFAULT '', + `modified_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified_by` int(10) unsigned NOT NULL DEFAULT '0', + `publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `access` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_state` (`state`), + KEY `idx_created_user_id` (`created_user_id`), + KEY `idx_access` (`access`), + KEY `idx_context` (`context`), + KEY `idx_language` (`language`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `#__fields_values` +-- + +CREATE TABLE IF NOT EXISTS `#__fields_values` ( + `field_id` int(10) unsigned NOT NULL, + `context` varchar(255) NOT NULL, + `item_id` varchar(255) NOT NULL COMMENT 'Allow references to items which have strings as ids, eg. none db systems.', + `value` text NOT NULL DEFAULT '', + KEY (`field_id`), + KEY (`context`), + KEY (`item_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +-- -------------------------------------------------------- + -- -- Table structure for table `#__finder_filters` -- @@ -1518,7 +1583,8 @@ INSERT INTO `#__postinstall_messages` (`extension_id`, `title_key`, `description (700, 'PLG_TWOFACTORAUTH_TOTP_POSTINSTALL_TITLE', 'PLG_TWOFACTORAUTH_TOTP_POSTINSTALL_BODY', 'PLG_TWOFACTORAUTH_TOTP_POSTINSTALL_ACTION', 'plg_twofactorauth_totp', 1, 'action', 'site://plugins/twofactorauth/totp/postinstall/actions.php', 'twofactorauth_postinstall_action', 'site://plugins/twofactorauth/totp/postinstall/actions.php', 'twofactorauth_postinstall_condition', '3.2.0', 1), (700, 'COM_CPANEL_WELCOME_BEGINNERS_TITLE', 'COM_CPANEL_WELCOME_BEGINNERS_MESSAGE', '', 'com_cpanel', 1, 'message', '', '', '', '', '3.2.0', 1), (700, 'COM_CPANEL_MSG_STATS_COLLECTION_TITLE', 'COM_CPANEL_MSG_STATS_COLLECTION_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/statscollection.php', 'admin_postinstall_statscollection_condition', '3.5.0', 1), -(700, 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_BODY', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_ACTION', 'plg_system_updatenotification', 1, 'action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_condition', '3.6.3', 1); +(700, 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_BODY', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_ACTION', 'plg_system_updatenotification', 1, 'action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_condition', '3.6.3', 1), +(700, 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_TITLE', 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/joomla40checks.php', 'admin_postinstall_joomla40checks_condition', '3.7.0', 1); -- -------------------------------------------------------- diff --git a/installation/sql/mysql/sample_blog.sql b/installation/sql/mysql/sample_blog.sql index 11e245311a5e7..4c4e72c117448 100644 --- a/installation/sql/mysql/sample_blog.sql +++ b/installation/sql/mysql/sample_blog.sql @@ -15,43 +15,43 @@ TRUNCATE `#__modules_menu`; INSERT IGNORE INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name`, `title`, `rules`) VALUES (1, 0, 0, 87, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.offline":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (2, 1, 1, 2, 1, 'com_admin', 'com_admin', '{}'), -(3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), (4, 1, 7, 8, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (5, 1, 9, 10, 1, 'com_checkin', 'com_checkin', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (6, 1, 11, 12, 1, 'com_config', 'com_config', '{}'), -(7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(8, 1, 17, 34, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}'), +(7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(8, 1, 17, 34, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}'), (9, 1, 35, 36, 1, 'com_cpanel', 'com_cpanel', '{}'), -(10, 1, 37, 38, 1, 'com_installer', 'com_installer', '{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), -(11, 1, 39, 40, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(10, 1, 37, 38, 1, 'com_installer', 'com_installer', '{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), +(11, 1, 39, 40, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1}}'), (12, 1, 41, 42, 1, 'com_login', 'com_login', '{}'), (13, 1, 43, 44, 1, 'com_mailto', 'com_mailto', '{}'), (14, 1, 45, 46, 1, 'com_massmail', 'com_massmail', '{}'), (15, 1, 47, 48, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}'), -(16, 1, 49, 50, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(16, 1, 49, 50, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1}}'), (17, 1, 51, 52, 1, 'com_messages', 'com_messages', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), -(18, 1, 53, 54, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(19, 1, 55, 58, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(20, 1, 59, 60, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1},"core.manage":[],"core.edit":[],"core.edit.state":[]}'), -(21, 1, 61, 62, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1},"core.manage":[]}'), +(18, 1, 53, 54, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1}}'), +(19, 1, 55, 58, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(20, 1, 59, 60, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1}}'), +(21, 1, 61, 62, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1}}'), (22, 1, 63, 64, 1, 'com_search', 'com_search', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(23, 1, 65, 66, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(24, 1, 67, 70, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.own":{"6":1},"core.edit.state":[]}'), +(23, 1, 65, 66, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1}}'), +(24, 1, 67, 70, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.edit.own":{"6":1}}'), (26, 1, 71, 72, 1, 'com_wrapper', 'com_wrapper', '{}'), -(27, 8, 18, 23, 2, 'com_content.category.2', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(30, 19, 56, 57, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(32, 24, 68, 69, 1, 'com_users.category.7', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(27, 8, 18, 23, 2, 'com_content.category.2', 'Uncategorised', '{}'), +(28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{}'), +(29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{}'), +(30, 19, 56, 57, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{}'), +(32, 24, 68, 69, 2, 'com_users.category.7', 'Uncategorised', '{}'), (33, 1, 73, 74, 1, 'com_finder', 'com_finder', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(35, 8, 24, 33, 2, 'com_content.category.9', 'Blog', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(36, 27, 19, 20, 3, 'com_content.article.1', 'About', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(37, 27, 21, 22, 3, 'com_content.article.2', 'Working on Your Site', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(38, 35, 25, 26, 3, 'com_content.article.3', 'Welcome to your blog', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(39, 35, 27, 28, 3, 'com_content.article.4', 'About your home page', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(40, 35, 29, 30, 3, 'com_content.article.5', 'Your Modules', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(41, 1, 75, 76, 1, 'com_users.category.10', 'Uncategorised', ''), -(42, 1, 77, 78, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), +(35, 8, 24, 33, 2, 'com_content.category.9', 'Blog', '{}'), +(36, 27, 19, 20, 3, 'com_content.article.1', 'About', '{}'), +(37, 27, 21, 22, 3, 'com_content.article.2', 'Working on Your Site', '{}'), +(38, 35, 25, 26, 3, 'com_content.article.3', 'Welcome to your blog', '{}'), +(39, 35, 27, 28, 3, 'com_content.article.4', 'About your home page', '{}'), +(40, 35, 29, 30, 3, 'com_content.article.5', 'Your Modules', '{}'), +(41, 1, 75, 76, 1, 'com_users.category.10', 'Uncategorised', '{}'), +(42, 1, 77, 78, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{}'), (43, 35, 31, 32, 3, 'com_content.article.6', 'Your Template', '{"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (44, 1, 79, 80, 1, 'com_tags', 'com_tags', '{"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (45, 1, 81, 82, 1, 'com_contenthistory', 'com_contenthistory', '{}'), diff --git a/installation/sql/mysql/sample_brochure.sql b/installation/sql/mysql/sample_brochure.sql index 45da246c21e08..d73dae32c1c27 100644 --- a/installation/sql/mysql/sample_brochure.sql +++ b/installation/sql/mysql/sample_brochure.sql @@ -17,40 +17,40 @@ TRUNCATE `#__template_styles`; INSERT IGNORE INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name`, `title`, `rules`) VALUES (1, 0, 0, 91, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.offline":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (2, 1, 1, 2, 1, 'com_admin', 'com_admin', '{}'), -(3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), (4, 1, 7, 8, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (5, 1, 9, 10, 1, 'com_checkin', 'com_checkin', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (6, 1, 11, 12, 1, 'com_config', 'com_config', '{}'), -(7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(8, 1, 17, 28, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}'), +(7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(8, 1, 17, 28, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}'), (9, 1, 29, 30, 1, 'com_cpanel', 'com_cpanel', '{}'), -(10, 1, 31, 32, 1, 'com_installer', 'com_installer', '{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), -(11, 1, 33, 34, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(10, 1, 31, 32, 1, 'com_installer', 'com_installer', '{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), +(11, 1, 33, 34, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1}}'), (12, 1, 35, 36, 1, 'com_login', 'com_login', '{}'), (13, 1, 37, 38, 1, 'com_mailto', 'com_mailto', '{}'), (14, 1, 39, 40, 1, 'com_massmail', 'com_massmail', '{}'), (15, 1, 41, 42, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}'), -(16, 1, 43, 44, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(16, 1, 43, 44, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1}}'), (17, 1, 45, 46, 1, 'com_messages', 'com_messages', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), -(18, 1, 47, 60, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(19, 1, 61, 64, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(20, 1, 65, 66, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1},"core.manage":[],"core.edit":[],"core.edit.state":[]}'), -(21, 1, 67, 68, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1},"core.manage":[]}'), +(18, 1, 47, 60, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1}}'), +(19, 1, 61, 64, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(20, 1, 65, 66, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1}}'), +(21, 1, 67, 68, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1}}'), (22, 1, 69, 70, 1, 'com_search', 'com_search', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(23, 1, 71, 72, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(24, 1, 73, 76, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"6":1}}'), +(23, 1, 71, 72, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1}}'), +(24, 1, 73, 76, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.edit.own":{"6":1}}'), (26, 1, 77, 78, 1, 'com_wrapper', 'com_wrapper', '{}'), -(27, 8, 18, 23, 2, 'com_content.category.2', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(30, 19, 62, 63, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(32, 24, 74, 75, 1, 'com_users.category.7', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(27, 8, 18, 23, 2, 'com_content.category.2', 'Uncategorised', '{}'), +(28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{}'), +(29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{}'), +(30, 19, 62, 63, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{}'), +(32, 24, 74, 75, 2, 'com_users.category.7', 'Uncategorised', '{}'), (33, 1, 79, 80, 1, 'com_finder', 'com_finder', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(35, 27, 19, 20, 3, 'com_content.article.2', 'About Us', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(36, 8, 24, 27, 2, 'com_content.category.8', 'News', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(37, 36, 25, 26, 3, 'com_content.article.3', 'Article 1 Title', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(40, 27, 21, 22, 3, 'com_content.article.6', 'Creating Your Site', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(41, 1, 81, 82, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), +(35, 27, 19, 20, 3, 'com_content.article.2', 'About Us', '{}'), +(36, 8, 24, 27, 2, 'com_content.category.8', 'News', '{}'), +(37, 36, 25, 26, 3, 'com_content.article.3', 'Article 1 Title', '{}'), +(40, 27, 21, 22, 3, 'com_content.article.6', 'Creating Your Site', '{}'), +(41, 1, 81, 82, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{}'), (42, 1, 83, 84, 1, 'com_tags', 'com_tags', '{"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (43, 1, 85, 86, 1, 'com_contenthistory', 'com_contenthistory', '{}'), (44, 1, 87, 88, 1, 'com_ajax', 'com_ajax', '{}'), @@ -69,7 +69,7 @@ INSERT IGNORE INTO `#__categories` (`id`, `asset_id`, `parent_id`, `lft`, `rgt`, (4, 29, 1, 5, 6, 1, 'uncategorised', 'com_contact', 'Uncategorised', 'uncategorised', '', '', 1, 0, '0000-00-00 00:00:00', 1, '{"target":"","image":""}', '', '', '{"page_title":"","author":"","robots":""}', 42, '2011-01-01 00:00:01', 0, '0000-00-00 00:00:00', 0, '*', 1), (5, 30, 1, 7, 8, 1, 'uncategorised', 'com_newsfeeds', 'Uncategorised', 'uncategorised', '', '', 1, 0, '0000-00-00 00:00:00', 1, '{"target":"","image":""}', '', '', '{"page_title":"","author":"","robots":""}', 42, '2011-01-01 00:00:01', 0, '0000-00-00 00:00:00', 0, '*', 1), (7, 32, 1, 9, 10, 1, 'uncategorised', 'com_users', 'Uncategorised', 'uncategorised', '', '', 1, 0, '0000-00-00 00:00:00', 1, '{"target":"","image":""}', '', '', '{"page_title":"","author":"","robots":""}', 42, '2011-01-01 00:00:01', 0, '0000-00-00 00:00:00', 0, '*', 1), -(8, 36, 1, 11, 12, 1, 'news', 'com_content', 'News', 'news', '', '

    This is the latest new from us.

    You can edit this description in the Content Category Manager.

    This will show the most recent article. You can easily change it to show more if you wish.

    The module on the left shows a list of older articles.

    ', 1, 0, '0000-00-00 00:00:00', 1, '{"category_layout":"","image":""}', '', '', '{"author":"","robots":""}', 42, '2011-01-01 00:00:01', 0, '0000-00-00 00:00:00', 0, '*', 1); +(8, 36, 1, 11, 12, 1, 'news', 'com_content', 'News', 'news', '', '

    This is the latest news from us.

    You can edit this description in the Content Category Manager.

    This will show the most recent article. You can easily change it to show more if you wish.

    The module on the left shows a list of older articles.

    ', 1, 0, '0000-00-00 00:00:00', 1, '{"category_layout":"","image":""}', '', '', '{"author":"","robots":""}', 42, '2011-01-01 00:00:01', 0, '0000-00-00 00:00:00', 0, '*', 1); INSERT IGNORE INTO `#__contact_details` (`id`, `name`, `alias`, `con_position`, `address`, `suburb`, `state`, `country`, `postcode`, `telephone`, `fax`, `misc`, `image`, `email_to`, `default_con`, `published`, `checked_out`, `checked_out_time`, `ordering`, `params`, `user_id`, `catid`, `access`, `mobile`, `webpage`, `sortname1`, `sortname2`, `sortname3`, `language`, `created`, `created_by`, `created_by_alias`, `modified`, `modified_by`, `metakey`, `metadesc`, `metadata`, `featured`, `xreference`, `publish_up`, `publish_down`, `version`, `hits`) VALUES (1, 'Your Name', 'your-name', '', 'This is a contact form which you can edit in the contact manager. Put your address or other information here. This can be a good place to put things like business hours too.Don''t forget to put a real email address.You also may want to enable Captcha in the global configurationto prevent spam submissions of contact forms. ', '', '', '', '', '', '', '', '', 'email@example.com', 0, 1, 0, '0000-00-00 00:00:00', 1, '{"show_contact_category":"","show_contact_list":"","presentation_style":"","show_name":"","show_position":"","show_email":"","show_street_address":"","show_suburb":"","show_state":"","show_postcode":"","show_country":"","show_telephone":"","show_mobile":"","show_fax":"","show_webpage":"","show_misc":"","show_image":"","allow_vcard":"","show_articles":"","show_profile":"","show_links":"","linka_name":"","linka":"","linkb_name":"","linkb":"","linkc_name":"","linkc":"","linkd_name":"","linkd":"","linke_name":"","linke":"","contact_layout":"","show_email_form":"","show_email_copy":"","banned_email":"","banned_subject":"","banned_text":"","validate_session":"","custom_reply":"","redirect":""}', 0, 4, 1, '', '', '', '', '', '*', '2011-01-01 00:00:01', 42, 'Joomla', '0000-00-00 00:00:00', 0, '', '', '{"robots":"","rights":""}', 0, '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 0); diff --git a/installation/sql/mysql/sample_data.sql b/installation/sql/mysql/sample_data.sql index 80f1af5750bd9..17cca118a0ee1 100644 --- a/installation/sql/mysql/sample_data.sql +++ b/installation/sql/mysql/sample_data.sql @@ -16,55 +16,55 @@ TRUNCATE `#__tags`; INSERT IGNORE INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name`, `title`, `rules`) VALUES (1, 0, 0, 119, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.offline":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (2, 1, 1, 2, 1, 'com_admin', 'com_admin', '{}'), -(3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), (4, 1, 7, 8, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (5, 1, 9, 10, 1, 'com_checkin', 'com_checkin', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (6, 1, 11, 12, 1, 'com_config', 'com_config', '{}'), -(7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(8, 1, 17, 22, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}'), +(7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(8, 1, 17, 22, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}'), (9, 1, 23, 24, 1, 'com_cpanel', 'com_cpanel', '{}'), -(10, 1, 25, 26, 1, 'com_installer', 'com_installer', '{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), -(11, 1, 27, 28, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(10, 1, 25, 26, 1, 'com_installer', 'com_installer', '{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), +(11, 1, 27, 28, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1}}'), (12, 1, 29, 30, 1, 'com_login', 'com_login', '{}'), (13, 1, 31, 32, 1, 'com_mailto', 'com_mailto', '{}'), (14, 1, 33, 34, 1, 'com_massmail', 'com_massmail', '{}'), (15, 1, 35, 36, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}'), -(16, 1, 37, 38, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(16, 1, 37, 38, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1}}'), (17, 1, 39, 40, 1, 'com_messages', 'com_messages', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), -(18, 1, 41, 86, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(19, 1, 87, 90, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(20, 1, 91, 92, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1},"core.manage":[],"core.edit":[],"core.edit.state":[]}'), -(21, 1, 93, 94, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1},"core.manage":[]}'), +(18, 1, 41, 86, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1}}'), +(19, 1, 87, 90, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(20, 1, 91, 92, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1}}'), +(21, 1, 93, 94, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1}}'), (22, 1, 95, 96, 1, 'com_search', 'com_search', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(23, 1, 97, 98, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(24, 1, 99, 102, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(23, 1, 97, 98, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1}}'), +(24, 1, 99, 102, 1, 'com_users', 'com_users', '{"core.admin":{"7":1}}'), (26, 1, 103, 104, 1, 'com_wrapper', 'com_wrapper', '{}'), -(27, 8, 18, 21, 2, 'com_content.category.2', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(30, 19, 88, 89, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(32, 24, 100, 101, 1, 'com_users.category.7', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(27, 8, 18, 21, 2, 'com_content.category.2', 'Uncategorised', '{}'), +(28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{}'), +(29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{}'), +(30, 19, 88, 89, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{}'), +(32, 24, 100, 101, 2, 'com_users.category.7', 'Uncategorised', '{}'), (33, 1, 105, 106, 1, 'com_finder', 'com_finder', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(34, 1, 107, 108, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), -(35, 1, 109, 110, 1, 'com_tags', 'com_tags', '{"core.admin":[],"core.manage":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), +(34, 1, 107, 108, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{}'), +(35, 1, 109, 110, 1, 'com_tags', 'com_tags', '{}'), (36, 1, 111, 112, 1, 'com_contenthistory', 'com_contenthistory', '{}'), (37, 1, 113, 114, 1, 'com_ajax', 'com_ajax', '{}'), (38, 1, 115, 116, 1, 'com_postinstall', 'com_postinstall', '{}'), -(39, 18, 42, 43, 2, 'com_modules.module.1', 'Main Menu', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(40, 18, 44, 45, 2, 'com_modules.module.2', 'Login', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(41, 18, 46, 47, 2, 'com_modules.module.3', 'Popular Articles', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(42, 18, 48, 49, 2, 'com_modules.module.4', 'Recently Added Articles', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(43, 18, 50, 51, 2, 'com_modules.module.8', 'Toolbar', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(44, 18, 52, 53, 2, 'com_modules.module.9', 'Quick Icons', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(45, 18, 54, 55, 2, 'com_modules.module.10', 'Logged-in Users', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(46, 18, 56, 57, 2, 'com_modules.module.12', 'Admin Menu', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(47, 18, 58, 59, 2, 'com_modules.module.13', 'Admin Submenu', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(48, 18, 60, 61, 2, 'com_modules.module.14', 'User Status', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(49, 18, 62, 63, 2, 'com_modules.module.15', 'Title', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(50, 18, 64, 65, 2, 'com_modules.module.16', 'Login Form', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(51, 18, 66, 67, 2, 'com_modules.module.17', 'Breadcrumbs', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(52, 18, 68, 69, 2, 'com_modules.module.79', 'Multilanguage status', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(53, 18, 70, 71, 2, 'com_modules.module.86', 'Joomla Version', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(39, 18, 42, 43, 2, 'com_modules.module.1', 'Main Menu', '{}'), +(40, 18, 44, 45, 2, 'com_modules.module.2', 'Login', '{}'), +(41, 18, 46, 47, 2, 'com_modules.module.3', 'Popular Articles', '{}'), +(42, 18, 48, 49, 2, 'com_modules.module.4', 'Recently Added Articles', '{}'), +(43, 18, 50, 51, 2, 'com_modules.module.8', 'Toolbar', '{}'), +(44, 18, 52, 53, 2, 'com_modules.module.9', 'Quick Icons', '{}'), +(45, 18, 54, 55, 2, 'com_modules.module.10', 'Logged-in Users', '{}'), +(46, 18, 56, 57, 2, 'com_modules.module.12', 'Admin Menu', '{}'), +(47, 18, 58, 59, 2, 'com_modules.module.13', 'Admin Submenu', '{}'), +(48, 18, 60, 61, 2, 'com_modules.module.14', 'User Status', '{}'), +(49, 18, 62, 63, 2, 'com_modules.module.15', 'Title', '{}'), +(50, 18, 64, 65, 2, 'com_modules.module.16', 'Login Form', '{}'), +(51, 18, 66, 67, 2, 'com_modules.module.17', 'Breadcrumbs', '{}'), +(52, 18, 68, 69, 2, 'com_modules.module.79', 'Multilanguage status', '{}'), +(53, 18, 70, 71, 2, 'com_modules.module.86', 'Joomla Version', '{}'), (54, 18, 72, 73, 2, 'com_modules.module.87', 'Popular Tags', '{"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (55, 18, 74, 75, 2, 'com_modules.module.88', 'Site Information', '{"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (56, 18, 76, 77, 2, 'com_modules.module.89', 'Release News', '{"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), @@ -73,7 +73,7 @@ INSERT IGNORE INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name` (59, 18, 82, 83, 2, 'com_modules.module.92', 'Image Module', '{"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (60, 18, 84, 85, 2, 'com_modules.module.93', 'Search', '{"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (61, 27, 19, 20, 3, 'com_content.article.1', 'Getting Started', '{"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), -(62, 1, 117, 118, 1, '#__ucm_content.1', '#__ucm_content.1', '[]'); +(62, 1, 117, 118, 1, '#__ucm_content.1', '#__ucm_content.1', '{}'); INSERT IGNORE INTO `#__content` (`id`, `asset_id`, `title`, `alias`, `introtext`, `fulltext`, `state`, `catid`, `created`, `created_by`, `created_by_alias`, `modified`, `modified_by`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `images`, `urls`, `attribs`, `version`, `ordering`, `metakey`, `metadesc`, `access`, `hits`, `metadata`, `featured`, `language`, `xreference`) VALUES (1, 61, 'Getting Started', 'getting-started', '

    It''s easy to get started creating your website. Knowing some of the basics will help.

    What is a Content Management System?

    A content management system is software that allows you to create and manage webpages easily by separating the creation of your content from the mechanics required to present it on the web.

    In this site, the content is stored in a database. The look and feel are created by a template. Joomla! brings together the template and your content to create web pages.

    Logging in

    To login to your site use the user name and password that were created as part of the installation process. Once logged-in you will be able to create and edit articles and modify some settings.

    Creating an article

    Once you are logged-in, a new menu will be visible. To create a new article, click on the "Submit Article" link on that menu.

    The new article interface gives you a lot of options, but all you need to do is add a title and put something in the content area. To make it easy to find, set the state to published.

    You can edit an existing article by clicking on the edit icon (this only displays to users who have the right to edit).

    Template, site settings, and modules

    The look and feel of your site is controlled by a template. You can change the site name, background colour, highlights colour and more by editing the template settings. Click the "Template Settings" in the user menu.

    The boxes around the main content of the site are called modules. You can modify modules on the current page by moving your cursor to the module and clicking the edit link. Always be sure to save and close any module you edit.

    You can change some site settings such as the site name and description by clicking on the "Site Settings" link.

    More advanced options for templates, site settings, modules, and more are available in the site administrator.

    Site and Administrator

    Your site actually has two separate sites. The site (also called the front end) is what visitors to your site will see. The administrator (also called the back end) is only used by people managing your site. You can access the administrator by clicking the "Site Administrator" link on the "User Menu" menu (visible once you login) or by adding /administrator to the end of your domain name. The same user name and password are used for both sites.

    Learn more

    There is much more to learn about how to use Joomla! to create the website you envision. You can learn much more at the Joomla! documentation site and on the Joomla! forums.

    ', '', 1, 2, '2013-11-16 00:00:00', 849, '', '0000-00-00 00:00:00', 0, 0, '0000-00-00 00:00:00', '2013-11-16 00:00:00', '0000-00-00 00:00:00', '{"image_intro":"","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}', '{"urla":false,"urlatext":"","targeta":"","urlb":false,"urlbtext":"","targetb":"","urlc":false,"urlctext":"","targetc":""}', '{"show_title":"","link_titles":"","show_tags":"","show_intro":"","info_block_position":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","link_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_icons":"","show_print_icon":"","show_email_icon":"","show_vote":"","show_hits":"","show_noauth":"","urls_position":"","alternative_readmore":"","article_layout":"","show_publishing_options":"","show_article_options":"","show_urls_images_backend":"","show_urls_images_frontend":""}', 1, 0, '', '', 1, 0, '{"robots":"","author":"","rights":"","xreference":""}', 0, '*', ''); diff --git a/installation/sql/mysql/sample_learn.sql b/installation/sql/mysql/sample_learn.sql index c7f2502cc0dd8..01d7d358750f5 100644 --- a/installation/sql/mysql/sample_learn.sql +++ b/installation/sql/mysql/sample_learn.sql @@ -19,161 +19,161 @@ TRUNCATE `#__viewlevels`; -- Dumping data for table `#__assets` -- INSERT INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name`, `title`, `rules`) VALUES -(1, 0, 1, 430, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.offline":[],"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), +(1, 0, 1, 430, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (2, 1, 2, 3, 1, 'com_admin', 'com_admin', '{}'), -(3, 1, 4, 11, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(3, 1, 4, 11, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), (4, 1, 12, 13, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (5, 1, 14, 15, 1, 'com_checkin', 'com_checkin', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (6, 1, 16, 17, 1, 'com_config', 'com_config', '{}'), -(7, 1, 18, 87, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(8, 1, 88, 297, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}'), +(7, 1, 18, 87, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(8, 1, 88, 297, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}'), (9, 1, 298, 299, 1, 'com_cpanel', 'com_cpanel', '{}'), -(10, 1, 300, 301, 1, 'com_installer', 'com_installer', '{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), -(11, 1, 302, 303, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(10, 1, 300, 301, 1, 'com_installer', 'com_installer', '{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), +(11, 1, 302, 303, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1}}'), (12, 1, 304, 305, 1, 'com_login', 'com_login', '{}'), (13, 1, 306, 307, 1, 'com_mailto', 'com_mailto', '{}'), (14, 1, 308, 309, 1, 'com_massmail', 'com_massmail', '{}'), -(15, 1, 310, 311, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1},"core.edit":[],"core.edit.state":[]}'), -(16, 1, 312, 313, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(15, 1, 310, 311, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}'), +(16, 1, 312, 313, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1}}'), (17, 1, 37, 38, 1, 'com_messages', 'com_messages', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), -(18, 1, 316, 317, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(19, 1, 318, 325, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(20, 1, 326, 327, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(21, 1, 328, 329, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1},"core.manage":[]}'), +(18, 1, 316, 317, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1}}'), +(19, 1, 318, 325, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(20, 1, 326, 327, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1}}'), +(21, 1, 328, 329, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1}}'), (22, 1, 330, 331, 1, 'com_search', 'com_search', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(23, 1, 332, 333, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(24, 1, 334, 337, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(23, 1, 332, 333, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1}}'), +(24, 1, 334, 337, 1, 'com_users', 'com_users', '{"core.admin":{"7":1}}'), (26, 1, 338, 339, 1, 'com_wrapper', 'com_wrapper', '{}'), (33, 1, 418, 419, 1, 'com_finder', 'com_finder', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(34, 8, 105, 108, 2, 'com_content.category.9', 'Uncategorised', '{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(35, 3, 7, 8, 2, 'com_banners.category.10', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(36, 7, 23, 24, 2, 'com_contact.category.11', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(37, 19, 321, 322, 2, 'com_newsfeeds.category.12', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(39, 8, 109, 296, 2, 'com_content.category.14', 'Sample Data-Articles', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(40, 3, 9, 10, 2, 'com_banners.category.15', 'Sample Data-Banners', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(41, 7, 25, 86, 2, 'com_contact.category.16', 'Sample Data-Contact', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(42, 19, 323, 324, 2, 'com_newsfeeds.category.17', 'Sample Data-Newsfeeds', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(44, 39, 110, 245, 3, 'com_content.category.19', 'Joomla!', '{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(45, 44, 111, 222, 4, 'com_content.category.20', 'Extensions', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(46, 45, 112, 127, 5, 'com_content.category.21', 'Components', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(47, 45, 128, 189, 5, 'com_content.category.22', 'Modules', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(48, 45, 190, 199, 5, 'com_content.category.23', 'Templates', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(49, 45, 200, 201, 5, 'com_content.category.24', 'Languages', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(50, 45, 202, 221, 5, 'com_content.category.25', 'Plugins', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(51, 39, 246, 277, 3, 'com_content.category.26', 'Park Site', '{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(52, 51, 247, 252, 4, 'com_content.category.27', 'Park Blog', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(53, 51, 253, 274, 4, 'com_content.category.28', 'Photo Gallery', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(54, 39, 278, 291, 3, 'com_content.category.29', 'Fruit Shop Site', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(55, 54, 279, 284, 4, 'com_content.category.30', 'Growers', '{"core.create":{"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"10":1}}'), -(59, 41, 26, 27, 3, 'com_contact.category.34', 'Park Site', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(60, 41, 28, 85, 3, 'com_contact.category.35', 'Shop Site', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(61, 60, 29, 30, 4, 'com_contact.category.36', 'Staff', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(62, 60, 31, 84, 4, 'com_contact.category.37', 'Fruit Encyclopedia', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(63, 62, 32, 33, 5, 'com_contact.category.38', 'A', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(64, 62, 34, 35, 5, 'com_contact.category.39', 'B', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(65, 62, 36, 37, 5, 'com_contact.category.40', 'C', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(66, 62, 38, 39, 5, 'com_contact.category.41', 'D', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(67, 62, 40, 41, 5, 'com_contact.category.42', 'E', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(68, 62, 42, 43, 5, 'com_contact.category.43', 'F', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(69, 62, 44, 45, 5, 'com_contact.category.44', 'G', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(70, 62, 46, 47, 5, 'com_contact.category.45', 'H', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(71, 62, 48, 49, 5, 'com_contact.category.46', 'I', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(72, 62, 50, 51, 5, 'com_contact.category.47', 'J', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(73, 62, 52, 53, 5, 'com_contact.category.48', 'K', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(74, 62, 54, 55, 5, 'com_contact.category.49', 'L', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(75, 62, 56, 57, 5, 'com_contact.category.50', 'M', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(76, 62, 58, 59, 5, 'com_contact.category.51', 'N', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(77, 62, 60, 61, 5, 'com_contact.category.52', 'O', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(78, 62, 62, 63, 5, 'com_contact.category.53', 'P', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(79, 62, 64, 65, 5, 'com_contact.category.54', 'Q', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(80, 62, 66, 67, 5, 'com_contact.category.55', 'R', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(81, 62, 68, 69, 5, 'com_contact.category.56', 'S', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(82, 62, 70, 71, 5, 'com_contact.category.57', 'T', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(83, 62, 72, 73, 5, 'com_contact.category.58', 'U', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(84, 62, 74, 75, 5, 'com_contact.category.59', 'V', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(85, 62, 76, 77, 5, 'com_contact.category.60', 'W', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(86, 62, 78, 79, 5, 'com_contact.category.61', 'X', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(87, 62, 80, 81, 5, 'com_contact.category.62', 'Y', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(88, 62, 82, 83, 5, 'com_contact.category.63', 'Z', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(89, 46, 113, 114, 6, 'com_content.article.1', 'Administrator Components', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(90, 93, 130, 131, 7, 'com_content.article.2', 'Archive Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(91, 93, 132, 133, 7, 'com_content.article.3', 'Article Categories Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(92, 93, 134, 135, 7, 'com_content.article.4', 'Articles Category Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(93, 47, 129, 144, 6, 'com_content.category.64', 'Content Modules', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(94, 47, 145, 152, 6, 'com_content.category.65', 'User Modules', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(95, 47, 153, 166, 6, 'com_content.category.66', 'Display Modules', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(96, 47, 167, 180, 6, 'com_content.category.67', 'Utility Modules', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(98, 48, 191, 192, 6, 'com_content.category.69', 'Beez3', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(100, 48, 193, 194, 6, 'com_content.category.71', 'Milky Way', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(101, 50, 203, 204, 6, 'com_content.article.5', 'Authentication', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(102, 51, 275, 276, 4, 'com_content.article.6', 'Australian Parks ', '{"core.delete":[],"core.edit":{"2":1},"core.edit.state":[]}'), -(103, 95, 154, 155, 7, 'com_content.article.7', 'Banner Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(104, 44, 223, 224, 4, 'com_content.article.8', 'Beginners', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(105, 46, 115, 116, 6, 'com_content.article.9', 'Contact', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(106, 46, 117, 118, 6, 'com_content.article.10', 'Content', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(107, 109, 265, 266, 6, 'com_content.article.11', 'Cradle Mountain', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(108, 53, 254, 263, 5, 'com_content.category.72', 'Animals', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(109, 53, 264, 273, 5, 'com_content.category.73', 'Scenery', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(110, 95, 156, 157, 7, 'com_content.article.12', 'Custom Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(111, 54, 285, 286, 4, 'com_content.article.13', 'Directions', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(112, 50, 205, 206, 6, 'com_content.article.14', 'Editors', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(113, 50, 207, 208, 6, 'com_content.article.15', 'Editors-xtd', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(114, 95, 158, 159, 7, 'com_content.article.16', 'Feed Display', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(115, 52, 248, 249, 5, 'com_content.article.17', 'First Blog Post', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(116, 52, 250, 251, 5, 'com_content.article.18', 'Second Blog Post', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(117, 95, 160, 161, 7, 'com_content.article.19', 'Footer Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(118, 54, 287, 288, 4, 'com_content.article.20', 'Fruit Shop', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(119, 44, 225, 226, 4, 'com_content.article.21', 'Getting Help', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(120, 44, 227, 228, 4, 'com_content.article.22', 'Getting Started', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(121, 55, 280, 281, 5, 'com_content.article.23', 'Happy Orange Orchard', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(122, 44, 229, 230, 4, 'com_content.article.24', 'Joomla!', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(123, 108, 255, 256, 6, 'com_content.article.25', 'Koala', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(124, 96, 168, 169, 7, 'com_content.article.26', 'Language Switcher', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(125, 93, 136, 137, 7, 'com_content.article.27', 'Latest Articles Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(126, 94, 146, 147, 7, 'com_content.article.28', 'Login Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(127, 166, 184, 185, 7, 'com_content.article.29', 'Menu Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(128, 93, 138, 139, 7, 'com_content.article.30', 'Most Read Content', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(129, 93, 140, 141, 7, 'com_content.article.31', 'News Flash', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(130, 44, 231, 232, 4, 'com_content.article.32', 'Parameters', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(131, 108, 257, 258, 6, 'com_content.article.33', 'Phyllopteryx', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(132, 109, 267, 268, 6, 'com_content.article.34', 'Pinnacles', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(133, 44, 233, 234, 4, 'com_content.article.35', 'Professionals', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(134, 95, 162, 163, 7, 'com_content.article.36', 'Random Image Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(135, 93, 142, 143, 7, 'com_content.article.37', 'Related Items Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(136, 44, 235, 236, 4, 'com_content.article.38', 'Sample Sites', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(137, 46, 119, 120, 6, 'com_content.article.39', 'Search', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(138, 96, 170, 171, 7, 'com_content.article.40', 'Search Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(139, 50, 209, 210, 6, 'com_content.article.41', 'Search ', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(140, 39, 292, 293, 3, 'com_content.article.42', 'Site Map', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(141, 108, 259, 260, 6, 'com_content.article.43', 'Spotted Quoll', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(142, 96, 172, 173, 7, 'com_content.article.44', 'Statistics Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(143, 96, 174, 175, 7, 'com_content.article.45', 'Syndicate Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(144, 50, 211, 212, 6, 'com_content.article.46', 'System', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(145, 44, 237, 238, 4, 'com_content.article.47', 'The Joomla! Community', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(146, 44, 239, 240, 4, 'com_content.article.48', 'The Joomla! Project', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(147, 48, 195, 196, 6, 'com_content.article.49', 'Typography', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(148, 44, 241, 242, 4, 'com_content.article.50', 'Upgraders', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(149, 50, 213, 214, 6, 'com_content.article.51', 'User', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(150, 46, 121, 122, 6, 'com_content.article.52', 'Users', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(151, 44, 243, 244, 4, 'com_content.article.53', 'Using Joomla!', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(154, 94, 148, 149, 7, 'com_content.article.56', 'Who''s Online', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(155, 108, 261, 262, 6, 'com_content.article.57', 'Wobbegone', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(156, 55, 282, 283, 5, 'com_content.article.58', 'Wonderful Watermelon', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(157, 96, 176, 177, 7, 'com_content.article.59', 'Wrapper Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(158, 46, 125, 126, 6, 'com_content.article.60', 'News Feeds', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(159, 166, 186, 187, 7, 'com_content.article.61', 'Breadcrumbs Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(160, 50, 215, 216, 6, 'com_content.article.62', 'Content', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(162, 109, 269, 270, 6, 'com_content.article.64', 'Blue Mountain Rain Forest', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(163, 109, 271, 272, 6, 'com_content.article.65', 'Ormiston Pound', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(165, 94, 150, 151, 7, 'com_content.article.66', 'Latest Users Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(166, 47, 183, 188, 6, 'com_content.category.75', 'Navigation Modules', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(167, 54, 289, 290, 4, 'com_content.category.76', 'Recipes', '{"core.create":{"12":1,"10":1},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"12":1,"10":1}}'), -(168, 34, 106, 107, 3, 'com_content.article.67', 'What''s New in 1.5?', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(169, 24, 335, 336, 2, 'com_users.category.77', 'Uncategorised', ''), -(170, 50, 217, 218, 6, 'com_content.article.68', 'Captcha', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(171, 50, 219, 220, 6, 'com_content.article.69', 'Quick Icons', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(172, 96, 178, 179, 7, 'com_content.article.70', 'Smart Search', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(173, 1, 420, 421, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), +(34, 8, 105, 108, 2, 'com_content.category.9', 'Uncategorised', '{"core.create":{"10":0,"12":0}}'), +(35, 3, 7, 8, 2, 'com_banners.category.10', 'Uncategorised', '{}'), +(36, 7, 23, 24, 2, 'com_contact.category.11', 'Uncategorised', '{}'), +(37, 19, 321, 322, 2, 'com_newsfeeds.category.12', 'Uncategorised', '{}'), +(39, 8, 109, 296, 2, 'com_content.category.14', 'Sample Data-Articles', '{}'), +(40, 3, 9, 10, 2, 'com_banners.category.15', 'Sample Data-Banners', '{}'), +(41, 7, 25, 86, 2, 'com_contact.category.16', 'Sample Data-Contact', '{}'), +(42, 19, 323, 324, 2, 'com_newsfeeds.category.17', 'Sample Data-Newsfeeds', '{}'), +(44, 39, 110, 245, 3, 'com_content.category.19', 'Joomla!', '{"core.create":{"10":0,"12":0}}'), +(45, 44, 111, 222, 4, 'com_content.category.20', 'Extensions', '{}'), +(46, 45, 112, 127, 5, 'com_content.category.21', 'Components', '{}'), +(47, 45, 128, 189, 5, 'com_content.category.22', 'Modules', '{}'), +(48, 45, 190, 199, 5, 'com_content.category.23', 'Templates', '{}'), +(49, 45, 200, 201, 5, 'com_content.category.24', 'Languages', '{}'), +(50, 45, 202, 221, 5, 'com_content.category.25', 'Plugins', '{}'), +(51, 39, 246, 277, 3, 'com_content.category.26', 'Park Site', '{"core.create":{"10":0,"12":0}}'), +(52, 51, 247, 252, 4, 'com_content.category.27', 'Park Blog', '{}'), +(53, 51, 253, 274, 4, 'com_content.category.28', 'Photo Gallery', '{}'), +(54, 39, 278, 291, 3, 'com_content.category.29', 'Fruit Shop Site', '{}'), +(55, 54, 279, 284, 4, 'com_content.category.30', 'Growers', '{"core.create":{"12":0},"core.edit.own":{"10":1}}'), +(59, 41, 26, 27, 3, 'com_contact.category.34', 'Park Site', '{}'), +(60, 41, 28, 85, 3, 'com_contact.category.35', 'Shop Site', '{}'), +(61, 60, 29, 30, 4, 'com_contact.category.36', 'Staff', '{}'), +(62, 60, 31, 84, 4, 'com_contact.category.37', 'Fruit Encyclopedia', '{}'), +(63, 62, 32, 33, 5, 'com_contact.category.38', 'A', '{}'), +(64, 62, 34, 35, 5, 'com_contact.category.39', 'B', '{}'), +(65, 62, 36, 37, 5, 'com_contact.category.40', 'C', '{}'), +(66, 62, 38, 39, 5, 'com_contact.category.41', 'D', '{}'), +(67, 62, 40, 41, 5, 'com_contact.category.42', 'E', '{}'), +(68, 62, 42, 43, 5, 'com_contact.category.43', 'F', '{}'), +(69, 62, 44, 45, 5, 'com_contact.category.44', 'G', '{}'), +(70, 62, 46, 47, 5, 'com_contact.category.45', 'H', '{}'), +(71, 62, 48, 49, 5, 'com_contact.category.46', 'I', '{}'), +(72, 62, 50, 51, 5, 'com_contact.category.47', 'J', '{}'), +(73, 62, 52, 53, 5, 'com_contact.category.48', 'K', '{}'), +(74, 62, 54, 55, 5, 'com_contact.category.49', 'L', '{}'), +(75, 62, 56, 57, 5, 'com_contact.category.50', 'M', '{}'), +(76, 62, 58, 59, 5, 'com_contact.category.51', 'N', '{}'), +(77, 62, 60, 61, 5, 'com_contact.category.52', 'O', '{}'), +(78, 62, 62, 63, 5, 'com_contact.category.53', 'P', '{}'), +(79, 62, 64, 65, 5, 'com_contact.category.54', 'Q', '{}'), +(80, 62, 66, 67, 5, 'com_contact.category.55', 'R', '{}'), +(81, 62, 68, 69, 5, 'com_contact.category.56', 'S', '{}'), +(82, 62, 70, 71, 5, 'com_contact.category.57', 'T', '{}'), +(83, 62, 72, 73, 5, 'com_contact.category.58', 'U', '{}'), +(84, 62, 74, 75, 5, 'com_contact.category.59', 'V', '{}'), +(85, 62, 76, 77, 5, 'com_contact.category.60', 'W', '{}'), +(86, 62, 78, 79, 5, 'com_contact.category.61', 'X', '{}'), +(87, 62, 80, 81, 5, 'com_contact.category.62', 'Y', '{}'), +(88, 62, 82, 83, 5, 'com_contact.category.63', 'Z', '{}'), +(89, 46, 113, 114, 6, 'com_content.article.1', 'Administrator Components', '{}'), +(90, 93, 130, 131, 7, 'com_content.article.2', 'Archive Module', '{}'), +(91, 93, 132, 133, 7, 'com_content.article.3', 'Article Categories Module', '{}'), +(92, 93, 134, 135, 7, 'com_content.article.4', 'Articles Category Module', '{}'), +(93, 47, 129, 144, 6, 'com_content.category.64', 'Content Modules', '{}'), +(94, 47, 145, 152, 6, 'com_content.category.65', 'User Modules', '{}'), +(95, 47, 153, 166, 6, 'com_content.category.66', 'Display Modules', '{}'), +(96, 47, 167, 180, 6, 'com_content.category.67', 'Utility Modules', '{}'), +(98, 48, 191, 192, 6, 'com_content.category.69', 'Beez3', '{}'), +(100, 48, 193, 194, 6, 'com_content.category.71', 'Milky Way', '{}'), +(101, 50, 203, 204, 6, 'com_content.article.5', 'Authentication', '{}'), +(102, 51, 275, 276, 4, 'com_content.article.6', 'Australian Parks ', '{"core.edit":{"2":1}}'), +(103, 95, 154, 155, 7, 'com_content.article.7', 'Banner Module', '{}'), +(104, 44, 223, 224, 4, 'com_content.article.8', 'Beginners', '{}'), +(105, 46, 115, 116, 6, 'com_content.article.9', 'Contact', '{}'), +(106, 46, 117, 118, 6, 'com_content.article.10', 'Content', '{}'), +(107, 109, 265, 266, 6, 'com_content.article.11', 'Cradle Mountain', '{}'), +(108, 53, 254, 263, 5, 'com_content.category.72', 'Animals', '{}'), +(109, 53, 264, 273, 5, 'com_content.category.73', 'Scenery', '{}'), +(110, 95, 156, 157, 7, 'com_content.article.12', 'Custom Module', '{}'), +(111, 54, 285, 286, 4, 'com_content.article.13', 'Directions', '{}'), +(112, 50, 205, 206, 6, 'com_content.article.14', 'Editors', '{}'), +(113, 50, 207, 208, 6, 'com_content.article.15', 'Editors-xtd', '{}'), +(114, 95, 158, 159, 7, 'com_content.article.16', 'Feed Display', '{}'), +(115, 52, 248, 249, 5, 'com_content.article.17', 'First Blog Post', '{}'), +(116, 52, 250, 251, 5, 'com_content.article.18', 'Second Blog Post', '{}'), +(117, 95, 160, 161, 7, 'com_content.article.19', 'Footer Module', '{}'), +(118, 54, 287, 288, 4, 'com_content.article.20', 'Fruit Shop', '{}'), +(119, 44, 225, 226, 4, 'com_content.article.21', 'Getting Help', '{}'), +(120, 44, 227, 228, 4, 'com_content.article.22', 'Getting Started', '{}'), +(121, 55, 280, 281, 5, 'com_content.article.23', 'Happy Orange Orchard', '{}'), +(122, 44, 229, 230, 4, 'com_content.article.24', 'Joomla!', '{}'), +(123, 108, 255, 256, 6, 'com_content.article.25', 'Koala', '{}'), +(124, 96, 168, 169, 7, 'com_content.article.26', 'Language Switcher', '{}'), +(125, 93, 136, 137, 7, 'com_content.article.27', 'Latest Articles Module', '{}'), +(126, 94, 146, 147, 7, 'com_content.article.28', 'Login Module', '{}'), +(127, 166, 184, 185, 7, 'com_content.article.29', 'Menu Module', '{}'), +(128, 93, 138, 139, 7, 'com_content.article.30', 'Most Read Content', '{}'), +(129, 93, 140, 141, 7, 'com_content.article.31', 'News Flash', '{}'), +(130, 44, 231, 232, 4, 'com_content.article.32', 'Parameters', '{}'), +(131, 108, 257, 258, 6, 'com_content.article.33', 'Phyllopteryx', '{}'), +(132, 109, 267, 268, 6, 'com_content.article.34', 'Pinnacles', '{}'), +(133, 44, 233, 234, 4, 'com_content.article.35', 'Professionals', '{}'), +(134, 95, 162, 163, 7, 'com_content.article.36', 'Random Image Module', '{}'), +(135, 93, 142, 143, 7, 'com_content.article.37', 'Related Items Module', '{}'), +(136, 44, 235, 236, 4, 'com_content.article.38', 'Sample Sites', '{}'), +(137, 46, 119, 120, 6, 'com_content.article.39', 'Search', '{}'), +(138, 96, 170, 171, 7, 'com_content.article.40', 'Search Module', '{}'), +(139, 50, 209, 210, 6, 'com_content.article.41', 'Search ', '{}'), +(140, 39, 292, 293, 3, 'com_content.article.42', 'Site Map', '{}'), +(141, 108, 259, 260, 6, 'com_content.article.43', 'Spotted Quoll', '{}'), +(142, 96, 172, 173, 7, 'com_content.article.44', 'Statistics Module', '{}'), +(143, 96, 174, 175, 7, 'com_content.article.45', 'Syndicate Module', '{}'), +(144, 50, 211, 212, 6, 'com_content.article.46', 'System', '{}'), +(145, 44, 237, 238, 4, 'com_content.article.47', 'The Joomla! Community', '{}'), +(146, 44, 239, 240, 4, 'com_content.article.48', 'The Joomla! Project', '{}'), +(147, 48, 195, 196, 6, 'com_content.article.49', 'Typography', '{}'), +(148, 44, 241, 242, 4, 'com_content.article.50', 'Upgraders', '{}'), +(149, 50, 213, 214, 6, 'com_content.article.51', 'User', '{}'), +(150, 46, 121, 122, 6, 'com_content.article.52', 'Users', '{}'), +(151, 44, 243, 244, 4, 'com_content.article.53', 'Using Joomla!', '{}'), +(154, 94, 148, 149, 7, 'com_content.article.56', 'Who''s Online', '{}'), +(155, 108, 261, 262, 6, 'com_content.article.57', 'Wobbegone', '{}'), +(156, 55, 282, 283, 5, 'com_content.article.58', 'Wonderful Watermelon', '{}'), +(157, 96, 176, 177, 7, 'com_content.article.59', 'Wrapper Module', '{}'), +(158, 46, 125, 126, 6, 'com_content.article.60', 'News Feeds', '{}'), +(159, 166, 186, 187, 7, 'com_content.article.61', 'Breadcrumbs Module', '{}'), +(160, 50, 215, 216, 6, 'com_content.article.62', 'Content', '{}'), +(162, 109, 269, 270, 6, 'com_content.article.64', 'Blue Mountain Rain Forest', '{}'), +(163, 109, 271, 272, 6, 'com_content.article.65', 'Ormiston Pound', '{}'), +(165, 94, 150, 151, 7, 'com_content.article.66', 'Latest Users Module', '{}'), +(166, 47, 183, 188, 6, 'com_content.category.75', 'Navigation Modules', '{}'), +(167, 54, 289, 290, 4, 'com_content.category.76', 'Recipes', '{"core.create":{"12":1,"10":1},"core.edit.own":{"12":1,"10":1}}'), +(168, 34, 106, 107, 3, 'com_content.article.67', 'What''s New in 1.5?', '{}'), +(169, 24, 335, 336, 2, 'com_users.category.77', 'Uncategorised', '{}'), +(170, 50, 217, 218, 6, 'com_content.article.68', 'Captcha', '{}'), +(171, 50, 219, 220, 6, 'com_content.article.69', 'Quick Icons', '{}'), +(172, 96, 178, 179, 7, 'com_content.article.70', 'Smart Search', '{}'), +(173, 1, 420, 421, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{}'), (174, 48, 197, 198, 6, 'com_content.category.78', 'Protostar', '{"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (175, 1, 422, 423, 1, 'com_tags', 'com_tags', '{"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (176, 1, 424, 425, 1, 'com_contenthistory', 'com_contenthistory', '{}'), @@ -368,7 +368,7 @@ INSERT IGNORE INTO `#__menu` (`id`, `menutype`, `title`, `alias`, `note`, `path` (243, 'parks', 'Parks Home', 'parks-home', '', 'parks-home', 'index.php?option=com_content&view=article&id=6', 'component', 1, 1, 1, 22, 0, '0000-00-00 00:00:00', 0, 1, '', 114, '{"show_noauth":"","show_title":"0","link_titles":"","show_intro":"","show_category":"0","link_category":"0","show_parent_category":"","link_parent_category":"","show_author":"0","link_author":"","show_create_date":"0","show_modify_date":"0","show_publish_date":"0","show_item_navigation":"0","show_icons":"","show_print_icon":"0","show_email_icon":"0","show_hits":"0","robots":"","rights":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","secure":0}', 233, 234, 0, 'en-GB', 0), (244, 'parks', 'Image Gallery', 'image-gallery', '', 'image-gallery', 'index.php?option=com_content&view=categories&id=28', 'component', 1, 1, 1, 22, 0, '0000-00-00 00:00:00', 0, 1, '', 114, '{"show_base_description":"1","categories_description":"","maxLevelcat":"","show_empty_categories_cat":"","show_subcat_desc_cat":"","show_cat_num_articles_cat":"","drill_down_layout":"1","show_category_title":"","show_description":"1","show_description_image":"1","maxLevel":"-1","show_empty_categories":"","show_subcat_desc":"","show_cat_num_articles":"","num_leading_articles":"1","num_intro_articles":"4","num_columns":"2","num_links":"4","multi_column_order":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_pagination_results":"","show_pagination_limit":"","filter_field":"","show_headings":"","list_show_date":"","date_format":"","list_show_hits":"","list_show_author":"","show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","link_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_readmore":"","show_icons":"","show_print_icon":"","show_email_icon":"","show_hits":"","show_noauth":"","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","page_title":"","show_page_heading":0,"page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 239, 244, 0, 'en-GB', 0), (251, 'aboutjoomla', 'Contact Categories', 'contact-categories', '', 'using-joomla/extensions/components/contact-component/contact-categories', 'index.php?option=com_contact&view=categories&id=16', 'component', 1, 270, 5, 8, 0, '0000-00-00 00:00:00', 0, 1, '', 0, '{"show_base_description":"","categories_description":"","maxLevel":"-1","show_empty_categories":"","show_description":"","show_description_image":"","show_cat_num_articles":"","display_num":"","show_headings":"","filter_field":"","show_pagination":"","show_noauth":"","presentation_style":"sliders","show_name":"","show_position":"","show_email":"","show_street_address":"","show_suburb":"","show_state":"","show_postcode":"","show_country":"","show_telephone":"","show_mobile":"","show_fax":"","show_webpage":"","show_misc":"","show_image":"","allow_vcard":"","show_articles":"","show_links":"1","linka_name":"","linkb_name":"","linkc_name":"","linkd_name":"","linke_name":"","show_email_form":"","show_email_copy":"","banned_email":"","banned_subject":"","banned_text":"","validate_session":"","custom_reply":"","redirect":"","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 75, 76, 0, '*', 0), -(252, 'aboutjoomla', 'News Feed Categories', 'new-feed-categories', '', 'using-joomla/extensions/components/news-feeds-component/new-feed-categories', 'index.php?option=com_newsfeeds&view=categories&id=0', 'component', 1, 267, 5, 17, 0, '0000-00-00 00:00:00', 0, 1, '', 0, '{"show_base_description":"1","categories_description":"Because this links to the root category the "uncategorised" category is displayed. ","maxLevel":"-1","show_empty_categories":"1","show_description":"1","show_description_image":"1","show_cat_num_articles":"1","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 93, 94, 0, '*', 0), +(252, 'aboutjoomla', 'News Feed Categories', 'new-feed-categories', '', 'using-joomla/extensions/components/news-feeds-component/new-feed-categories', 'index.php?option=com_newsfeeds&view=categories&id=0', 'component', 1, 267, 5, 17, 0, '0000-00-00 00:00:00', 0, 1, '', 0, '{"show_base_description":"1","categories_description":"Because this links to the root category the \\"uncategorised\\" category is displayed. ","maxLevel":"-1","show_empty_categories":"1","show_description":"1","show_description_image":"1","show_cat_num_articles":"1","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 93, 94, 0, '*', 0), (253, 'aboutjoomla', 'News Feed Category', 'news-feed-category', '', 'using-joomla/extensions/components/news-feeds-component/news-feed-category', 'index.php?option=com_newsfeeds&view=category&id=17', 'component', 1, 267, 5, 17, 0, '0000-00-00 00:00:00', 0, 1, '', 0, '{"maxLevel":"-1","show_empty_categories":"","show_description":"","show_description_image":"","show_cat_num_articles":"","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 97, 98, 0, '*', 0), (254, 'aboutjoomla', 'Single News Feed', 'single-news-feed', '', 'using-joomla/extensions/components/news-feeds-component/single-news-feed', 'index.php?option=com_newsfeeds&view=newsfeed&id=4', 'component', 1, 267, 5, 17, 0, '0000-00-00 00:00:00', 0, 1, '', 0, '{"show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 95, 96, 0, '*', 0), (255, 'aboutjoomla', 'Search', 'search', '', 'using-joomla/extensions/components/search-component/search', 'index.php?option=com_search&view=search', 'component', 1, 276, 5, 19, 0, '0000-00-00 00:00:00', 0, 1, '', 0, '{"search_areas":"1","show_date":"1","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 115, 116, 0, '*', 0), diff --git a/installation/sql/mysql/sample_testing.sql b/installation/sql/mysql/sample_testing.sql index 38bda5bfea0ed..b6eefa5bcfb8c 100644 --- a/installation/sql/mysql/sample_testing.sql +++ b/installation/sql/mysql/sample_testing.sql @@ -21,167 +21,167 @@ TRUNCATE `#__viewlevels`; INSERT IGNORE INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name`, `title`, `rules`) VALUES (1, 0, 1, 437, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (2, 1, 2, 3, 1, 'com_admin', 'com_admin', '{}'), -(3, 1, 4, 11, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(3, 1, 4, 11, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), (4, 1, 12, 13, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (5, 1, 14, 15, 1, 'com_checkin', 'com_checkin', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (6, 1, 16, 17, 1, 'com_config', 'com_config', '{}'), -(7, 1, 18, 87, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(8, 1, 88, 303, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}'), +(7, 1, 18, 87, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(8, 1, 88, 303, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}'), (9, 1, 304, 305, 1, 'com_cpanel', 'com_cpanel', '{}'), -(10, 1, 306, 307, 1, 'com_installer', 'com_installer', '{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), -(11, 1, 308, 309, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(10, 1, 306, 307, 1, 'com_installer', 'com_installer', '{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), +(11, 1, 308, 309, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1}}'), (12, 1, 310, 311, 1, 'com_login', 'com_login', '{}'), (13, 1, 312, 313, 1, 'com_mailto', 'com_mailto', '{}'), (14, 1, 314, 315, 1, 'com_massmail', 'com_massmail', '{}'), -(15, 1, 316, 317, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1},"core.edit":[],"core.edit.state":[]}'), -(16, 1, 318, 319, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(15, 1, 316, 317, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}'), +(16, 1, 318, 319, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1}}'), (17, 1, 37, 38, 1, 'com_messages', 'com_messages', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), -(18, 1, 322, 323, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(19, 1, 324, 331, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(20, 1, 332, 333, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(21, 1, 334, 335, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1},"core.manage":[]}'), +(18, 1, 322, 323, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1}}'), +(19, 1, 324, 331, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(20, 1, 332, 333, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1}}'), +(21, 1, 334, 335, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1}}'), (22, 1, 336, 337, 1, 'com_search', 'com_search', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(23, 1, 338, 339, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(24, 1, 340, 343, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(23, 1, 338, 339, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1}}'), +(24, 1, 340, 343, 1, 'com_users', 'com_users', '{"core.admin":{"7":1}}'), (26, 1, 362, 363, 1, 'com_wrapper', 'com_wrapper', '{}'), (33, 1, 424, 425, 1, 'com_finder', 'com_finder', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(34, 8, 105, 108, 2, 'com_content.category.9', 'Uncategorised', '{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(35, 3, 7, 8, 2, 'com_banners.category.10', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(36, 7, 23, 24, 2, 'com_contact.category.11', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(37, 19, 327, 328, 2, 'com_newsfeeds.category.12', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(39, 8, 109, 302, 2, 'com_content.category.14', 'Sample Data-Articles', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(40, 3, 9, 10, 2, 'com_banners.category.15', 'Sample Data-Banners', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(41, 7, 25, 86, 2, 'com_contact.category.16', 'Sample Data-Contact', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(42, 19, 329, 330, 2, 'com_newsfeeds.category.17', 'Sample Data-Newsfeeds', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(44, 39, 110, 251, 3, 'com_content.category.19', 'Joomla!', '{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(45, 44, 111, 228, 4, 'com_content.category.20', 'Extensions', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(46, 45, 112, 127, 5, 'com_content.category.21', 'Components', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(47, 45, 128, 193, 5, 'com_content.category.22', 'Modules', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(48, 45, 194, 205, 5, 'com_content.category.23', 'Templates', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(49, 45, 206, 207, 5, 'com_content.category.24', 'Languages', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(50, 45, 208, 227, 5, 'com_content.category.25', 'Plugins', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(51, 39, 252, 283, 3, 'com_content.category.26', 'Park Site', '{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(52, 51, 253, 258, 4, 'com_content.category.27', 'Park Blog', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(53, 51, 259, 280, 4, 'com_content.category.28', 'Photo Gallery', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(54, 39, 284, 297, 3, 'com_content.category.29', 'Fruit Shop Site', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(55, 54, 285, 290, 4, 'com_content.category.30', 'Growers', '{"core.create":{"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"10":1}}'), -(59, 41, 26, 27, 3, 'com_contact.category.34', 'Park Site', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(60, 41, 28, 85, 3, 'com_contact.category.35', 'Shop Site', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(61, 60, 29, 30, 4, 'com_contact.category.36', 'Staff', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(62, 60, 31, 84, 4, 'com_contact.category.37', 'Fruit Encyclopedia', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(63, 62, 32, 33, 5, 'com_contact.category.38', 'A', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(64, 62, 34, 35, 5, 'com_contact.category.39', 'B', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(65, 62, 36, 37, 5, 'com_contact.category.40', 'C', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(66, 62, 38, 39, 5, 'com_contact.category.41', 'D', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(67, 62, 40, 41, 5, 'com_contact.category.42', 'E', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(68, 62, 42, 43, 5, 'com_contact.category.43', 'F', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(69, 62, 44, 45, 5, 'com_contact.category.44', 'G', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(70, 62, 46, 47, 5, 'com_contact.category.45', 'H', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(71, 62, 48, 49, 5, 'com_contact.category.46', 'I', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(72, 62, 50, 51, 5, 'com_contact.category.47', 'J', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(73, 62, 52, 53, 5, 'com_contact.category.48', 'K', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(74, 62, 54, 55, 5, 'com_contact.category.49', 'L', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(75, 62, 56, 57, 5, 'com_contact.category.50', 'M', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(76, 62, 58, 59, 5, 'com_contact.category.51', 'N', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(77, 62, 60, 61, 5, 'com_contact.category.52', 'O', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(78, 62, 62, 63, 5, 'com_contact.category.53', 'P', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(79, 62, 64, 65, 5, 'com_contact.category.54', 'Q', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(80, 62, 66, 67, 5, 'com_contact.category.55', 'R', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(81, 62, 68, 69, 5, 'com_contact.category.56', 'S', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(82, 62, 70, 71, 5, 'com_contact.category.57', 'T', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(83, 62, 72, 73, 5, 'com_contact.category.58', 'U', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(84, 62, 74, 75, 5, 'com_contact.category.59', 'V', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(85, 62, 76, 77, 5, 'com_contact.category.60', 'W', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(86, 62, 78, 79, 5, 'com_contact.category.61', 'X', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(87, 62, 80, 81, 5, 'com_contact.category.62', 'Y', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(88, 62, 82, 83, 5, 'com_contact.category.63', 'Z', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(89, 46, 113, 114, 6, 'com_content.article.1', 'Administrator Components', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(90, 93, 130, 131, 7, 'com_content.article.2', 'Archive Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(91, 93, 132, 133, 7, 'com_content.article.3', 'Article Categories Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(92, 93, 134, 135, 7, 'com_content.article.4', 'Articles Category Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(93, 47, 129, 148, 6, 'com_content.category.64', 'Content Modules', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(94, 47, 149, 156, 6, 'com_content.category.65', 'User Modules', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(95, 47, 157, 170, 6, 'com_content.category.66', 'Display Modules', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(96, 47, 171, 184, 6, 'com_content.category.67', 'Utility Modules', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(97, 48, 195, 196, 6, 'com_content.category.68', 'Atomic', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(98, 48, 197, 198, 6, 'com_content.category.69', 'Beez 20', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(99, 48, 199, 200, 6, 'com_content.category.70', 'Beez5', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(100, 48, 201, 202, 6, 'com_content.category.71', 'Milky Way', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(101, 50, 209, 210, 6, 'com_content.article.5', 'Authentication', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(102, 51, 281, 282, 4, 'com_content.article.6', 'Australian Parks ', '{"core.delete":[],"core.edit":{"2":1},"core.edit.state":[]}'), -(103, 95, 158, 159, 7, 'com_content.article.7', 'Banner Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(104, 44, 229, 230, 4, 'com_content.article.8', 'Beginners', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(105, 46, 115, 116, 6, 'com_content.article.9', 'Contact', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(106, 46, 117, 118, 6, 'com_content.article.10', 'Content', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(107, 109, 271, 272, 6, 'com_content.article.11', 'Cradle Mountain', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(108, 53, 260, 269, 5, 'com_content.category.72', 'Animals', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(109, 53, 270, 279, 5, 'com_content.category.73', 'Scenery', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(110, 95, 160, 161, 7, 'com_content.article.12', 'Custom Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(111, 54, 291, 292, 4, 'com_content.article.13', 'Directions', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(112, 50, 211, 212, 6, 'com_content.article.14', 'Editors', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(113, 50, 213, 214, 6, 'com_content.article.15', 'Editors-xtd', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(114, 95, 162, 163, 7, 'com_content.article.16', 'Feed Display', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(115, 52, 254, 255, 5, 'com_content.article.17', 'First Blog Post', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(116, 52, 256, 257, 5, 'com_content.article.18', 'Second Blog Post', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(117, 95, 164, 165, 7, 'com_content.article.19', 'Footer Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(118, 54, 293, 294, 4, 'com_content.article.20', 'Fruit Shop', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(119, 44, 231, 232, 4, 'com_content.article.21', 'Getting Help', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(120, 44, 233, 234, 4, 'com_content.article.22', 'Getting Started', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(121, 55, 286, 287, 5, 'com_content.article.23', 'Happy Orange Orchard', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(122, 44, 235, 236, 4, 'com_content.article.24', 'Joomla! Testing', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(123, 108, 261, 262, 6, 'com_content.article.25', 'Koala', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(124, 96, 172, 173, 7, 'com_content.article.26', 'Language Switcher', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(125, 93, 136, 137, 7, 'com_content.article.27', 'Latest Articles Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(126, 94, 150, 151, 7, 'com_content.article.28', 'Login Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(127, 166, 188, 189, 7, 'com_content.article.29', 'Menu Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(128, 93, 138, 139, 7, 'com_content.article.30', 'Most Read Content', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(129, 93, 140, 141, 7, 'com_content.article.31', 'News Flash', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(130, 44, 237, 238, 4, 'com_content.article.32', 'Parameters', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(131, 108, 263, 264, 6, 'com_content.article.33', 'Phyllopteryx', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(132, 109, 273, 274, 6, 'com_content.article.34', 'Pinnacles', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(133, 44, 239, 240, 4, 'com_content.article.35', 'Professionals', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(134, 95, 166, 167, 7, 'com_content.article.36', 'Random Image Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(135, 93, 142, 143, 7, 'com_content.article.37', 'Related Items Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(136, 44, 241, 242, 4, 'com_content.article.38', 'Sample Sites', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(137, 46, 119, 120, 6, 'com_content.article.39', 'Search', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(138, 96, 174, 175, 7, 'com_content.article.40', 'Search Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(139, 50, 215, 216, 6, 'com_content.article.41', 'Search ', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(140, 39, 298, 299, 3, 'com_content.article.42', 'Site Map', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(141, 108, 265, 266, 6, 'com_content.article.43', 'Spotted Quoll', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(142, 96, 176, 177, 7, 'com_content.article.44', 'Statistics Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(143, 96, 178, 179, 7, 'com_content.article.45', 'Syndicate Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(144, 50, 217, 218, 6, 'com_content.article.46', 'System', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(145, 44, 243, 244, 4, 'com_content.article.47', 'The Joomla! Community', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(146, 44, 245, 246, 4, 'com_content.article.48', 'The Joomla! Project', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(147, 48, 203, 204, 6, 'com_content.article.49', 'Typography', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(148, 44, 247, 248, 4, 'com_content.article.50', 'Upgraders', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(149, 50, 219, 220, 6, 'com_content.article.51', 'User', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(150, 46, 121, 122, 6, 'com_content.article.52', 'Users', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(151, 44, 249, 250, 4, 'com_content.article.53', 'Using Joomla!', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(154, 94, 152, 153, 7, 'com_content.article.56', 'Who''s Online', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(155, 108, 267, 268, 6, 'com_content.article.57', 'Wobbegone', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(156, 55, 288, 289, 5, 'com_content.article.58', 'Wonderful Watermelon', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(157, 96, 180, 181, 7, 'com_content.article.59', 'Wrapper Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(158, 46, 125, 126, 6, 'com_content.article.60', 'News Feeds', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(159, 166, 190, 191, 7, 'com_content.article.61', 'Breadcrumbs Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(160, 50, 221, 222, 6, 'com_content.article.62', 'Content', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(162, 109, 275, 276, 6, 'com_content.article.64', 'Blue Mountain Rain Forest', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(163, 109, 277, 278, 6, 'com_content.article.65', 'Ormiston Pound', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(165, 94, 154, 155, 7, 'com_content.article.66', 'Latest Users Module', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(166, 47, 187, 192, 6, 'com_content.category.75', 'Navigation Modules', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(167, 54, 295, 296, 4, 'com_content.category.76', 'Recipes', '{"core.create":{"12":1,"10":1},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"12":1,"10":1}}'), -(168, 34, 106, 107, 3, 'com_content.article.67', 'What''s New in 1.5?', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(169, 24, 341, 342, 2, 'com_users.category.77', 'Uncategorised', ''), -(170, 50, 223, 224, 6, 'com_content.article.68', 'Captcha', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(171, 50, 225, 226, 6, 'com_content.article.69', 'Quick Icons', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(172, 96, 182, 183, 7, 'com_content.article.70', 'Smart Search', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(173, 1, 426, 427, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), +(34, 8, 105, 108, 2, 'com_content.category.9', 'Uncategorised', '{"core.create":{"10":0,"12":0}}'), +(35, 3, 7, 8, 2, 'com_banners.category.10', 'Uncategorised', '{}'), +(36, 7, 23, 24, 2, 'com_contact.category.11', 'Uncategorised', '{}'), +(37, 19, 327, 328, 2, 'com_newsfeeds.category.12', 'Uncategorised', '{}'), +(39, 8, 109, 302, 2, 'com_content.category.14', 'Sample Data-Articles', '{}'), +(40, 3, 9, 10, 2, 'com_banners.category.15', 'Sample Data-Banners', '{}'), +(41, 7, 25, 86, 2, 'com_contact.category.16', 'Sample Data-Contact', '{}'), +(42, 19, 329, 330, 2, 'com_newsfeeds.category.17', 'Sample Data-Newsfeeds', '{}'), +(44, 39, 110, 251, 3, 'com_content.category.19', 'Joomla!', '{"core.create":{"10":0,"12":0}}'), +(45, 44, 111, 228, 4, 'com_content.category.20', 'Extensions', '{}'), +(46, 45, 112, 127, 5, 'com_content.category.21', 'Components', '{}'), +(47, 45, 128, 193, 5, 'com_content.category.22', 'Modules', '{}'), +(48, 45, 194, 205, 5, 'com_content.category.23', 'Templates', '{}'), +(49, 45, 206, 207, 5, 'com_content.category.24', 'Languages', '{}'), +(50, 45, 208, 227, 5, 'com_content.category.25', 'Plugins', '{}'), +(51, 39, 252, 283, 3, 'com_content.category.26', 'Park Site', '{"core.create":{"10":0,"12":0}}'), +(52, 51, 253, 258, 4, 'com_content.category.27', 'Park Blog', '{}'), +(53, 51, 259, 280, 4, 'com_content.category.28', 'Photo Gallery', '{}'), +(54, 39, 284, 297, 3, 'com_content.category.29', 'Fruit Shop Site', '{}'), +(55, 54, 285, 290, 4, 'com_content.category.30', 'Growers', '{"core.create":{"12":0},"core.edit.own":{"10":1}}'), +(59, 41, 26, 27, 3, 'com_contact.category.34', 'Park Site', '{}'), +(60, 41, 28, 85, 3, 'com_contact.category.35', 'Shop Site', '{}'), +(61, 60, 29, 30, 4, 'com_contact.category.36', 'Staff', '{}'), +(62, 60, 31, 84, 4, 'com_contact.category.37', 'Fruit Encyclopedia', '{}'), +(63, 62, 32, 33, 5, 'com_contact.category.38', 'A', '{}'), +(64, 62, 34, 35, 5, 'com_contact.category.39', 'B', '{}'), +(65, 62, 36, 37, 5, 'com_contact.category.40', 'C', '{}'), +(66, 62, 38, 39, 5, 'com_contact.category.41', 'D', '{}'), +(67, 62, 40, 41, 5, 'com_contact.category.42', 'E', '{}'), +(68, 62, 42, 43, 5, 'com_contact.category.43', 'F', '{}'), +(69, 62, 44, 45, 5, 'com_contact.category.44', 'G', '{}'), +(70, 62, 46, 47, 5, 'com_contact.category.45', 'H', '{}'), +(71, 62, 48, 49, 5, 'com_contact.category.46', 'I', '{}'), +(72, 62, 50, 51, 5, 'com_contact.category.47', 'J', '{}'), +(73, 62, 52, 53, 5, 'com_contact.category.48', 'K', '{}'), +(74, 62, 54, 55, 5, 'com_contact.category.49', 'L', '{}'), +(75, 62, 56, 57, 5, 'com_contact.category.50', 'M', '{}'), +(76, 62, 58, 59, 5, 'com_contact.category.51', 'N', '{}'), +(77, 62, 60, 61, 5, 'com_contact.category.52', 'O', '{}'), +(78, 62, 62, 63, 5, 'com_contact.category.53', 'P', '{}'), +(79, 62, 64, 65, 5, 'com_contact.category.54', 'Q', '{}'), +(80, 62, 66, 67, 5, 'com_contact.category.55', 'R', '{}'), +(81, 62, 68, 69, 5, 'com_contact.category.56', 'S', '{}'), +(82, 62, 70, 71, 5, 'com_contact.category.57', 'T', '{}'), +(83, 62, 72, 73, 5, 'com_contact.category.58', 'U', '{}'), +(84, 62, 74, 75, 5, 'com_contact.category.59', 'V', '{}'), +(85, 62, 76, 77, 5, 'com_contact.category.60', 'W', '{}'), +(86, 62, 78, 79, 5, 'com_contact.category.61', 'X', '{}'), +(87, 62, 80, 81, 5, 'com_contact.category.62', 'Y', '{}'), +(88, 62, 82, 83, 5, 'com_contact.category.63', 'Z', '{}'), +(89, 46, 113, 114, 6, 'com_content.article.1', 'Administrator Components', '{}'), +(90, 93, 130, 131, 7, 'com_content.article.2', 'Archive Module', '{}'), +(91, 93, 132, 133, 7, 'com_content.article.3', 'Article Categories Module', '{}'), +(92, 93, 134, 135, 7, 'com_content.article.4', 'Articles Category Module', '{}'), +(93, 47, 129, 148, 6, 'com_content.category.64', 'Content Modules', '{}'), +(94, 47, 149, 156, 6, 'com_content.category.65', 'User Modules', '{}'), +(95, 47, 157, 170, 6, 'com_content.category.66', 'Display Modules', '{}'), +(96, 47, 171, 184, 6, 'com_content.category.67', 'Utility Modules', '{}'), +(97, 48, 195, 196, 6, 'com_content.category.68', 'Atomic', '{}'), +(98, 48, 197, 198, 6, 'com_content.category.69', 'Beez 20', '{}'), +(99, 48, 199, 200, 6, 'com_content.category.70', 'Beez5', '{}'), +(100, 48, 201, 202, 6, 'com_content.category.71', 'Milky Way', '{}'), +(101, 50, 209, 210, 6, 'com_content.article.5', 'Authentication', '{}'), +(102, 51, 281, 282, 4, 'com_content.article.6', 'Australian Parks ', '{"core.edit":{"2":1}}'), +(103, 95, 158, 159, 7, 'com_content.article.7', 'Banner Module', '{}'), +(104, 44, 229, 230, 4, 'com_content.article.8', 'Beginners', '{}'), +(105, 46, 115, 116, 6, 'com_content.article.9', 'Contact', '{}'), +(106, 46, 117, 118, 6, 'com_content.article.10', 'Content', '{}'), +(107, 109, 271, 272, 6, 'com_content.article.11', 'Cradle Mountain', '{}'), +(108, 53, 260, 269, 5, 'com_content.category.72', 'Animals', '{}'), +(109, 53, 270, 279, 5, 'com_content.category.73', 'Scenery', '{}'), +(110, 95, 160, 161, 7, 'com_content.article.12', 'Custom Module', '{}'), +(111, 54, 291, 292, 4, 'com_content.article.13', 'Directions', '{}'), +(112, 50, 211, 212, 6, 'com_content.article.14', 'Editors', '{}'), +(113, 50, 213, 214, 6, 'com_content.article.15', 'Editors-xtd', '{}'), +(114, 95, 162, 163, 7, 'com_content.article.16', 'Feed Display', '{}'), +(115, 52, 254, 255, 5, 'com_content.article.17', 'First Blog Post', '{}'), +(116, 52, 256, 257, 5, 'com_content.article.18', 'Second Blog Post', '{}'), +(117, 95, 164, 165, 7, 'com_content.article.19', 'Footer Module', '{}'), +(118, 54, 293, 294, 4, 'com_content.article.20', 'Fruit Shop', '{}'), +(119, 44, 231, 232, 4, 'com_content.article.21', 'Getting Help', '{}'), +(120, 44, 233, 234, 4, 'com_content.article.22', 'Getting Started', '{}'), +(121, 55, 286, 287, 5, 'com_content.article.23', 'Happy Orange Orchard', '{}'), +(122, 44, 235, 236, 4, 'com_content.article.24', 'Joomla! Testing', '{}'), +(123, 108, 261, 262, 6, 'com_content.article.25', 'Koala', '{}'), +(124, 96, 172, 173, 7, 'com_content.article.26', 'Language Switcher', '{}'), +(125, 93, 136, 137, 7, 'com_content.article.27', 'Latest Articles Module', '{}'), +(126, 94, 150, 151, 7, 'com_content.article.28', 'Login Module', '{}'), +(127, 166, 188, 189, 7, 'com_content.article.29', 'Menu Module', '{}'), +(128, 93, 138, 139, 7, 'com_content.article.30', 'Most Read Content', '{}'), +(129, 93, 140, 141, 7, 'com_content.article.31', 'News Flash', '{}'), +(130, 44, 237, 238, 4, 'com_content.article.32', 'Parameters', '{}'), +(131, 108, 263, 264, 6, 'com_content.article.33', 'Phyllopteryx', '{}'), +(132, 109, 273, 274, 6, 'com_content.article.34', 'Pinnacles', '{}'), +(133, 44, 239, 240, 4, 'com_content.article.35', 'Professionals', '{}'), +(134, 95, 166, 167, 7, 'com_content.article.36', 'Random Image Module', '{}'), +(135, 93, 142, 143, 7, 'com_content.article.37', 'Related Items Module', '{}'), +(136, 44, 241, 242, 4, 'com_content.article.38', 'Sample Sites', '{}'), +(137, 46, 119, 120, 6, 'com_content.article.39', 'Search', '{}'), +(138, 96, 174, 175, 7, 'com_content.article.40', 'Search Module', '{}'), +(139, 50, 215, 216, 6, 'com_content.article.41', 'Search ', '{}'), +(140, 39, 298, 299, 3, 'com_content.article.42', 'Site Map', '{}'), +(141, 108, 265, 266, 6, 'com_content.article.43', 'Spotted Quoll', '{}'), +(142, 96, 176, 177, 7, 'com_content.article.44', 'Statistics Module', '{}'), +(143, 96, 178, 179, 7, 'com_content.article.45', 'Syndicate Module', '{}'), +(144, 50, 217, 218, 6, 'com_content.article.46', 'System', '{}'), +(145, 44, 243, 244, 4, 'com_content.article.47', 'The Joomla! Community', '{}'), +(146, 44, 245, 246, 4, 'com_content.article.48', 'The Joomla! Project', '{}'), +(147, 48, 203, 204, 6, 'com_content.article.49', 'Typography', '{}'), +(148, 44, 247, 248, 4, 'com_content.article.50', 'Upgraders', '{}'), +(149, 50, 219, 220, 6, 'com_content.article.51', 'User', '{}'), +(150, 46, 121, 122, 6, 'com_content.article.52', 'Users', '{}'), +(151, 44, 249, 250, 4, 'com_content.article.53', 'Using Joomla!', '{}'), +(154, 94, 152, 153, 7, 'com_content.article.56', 'Who''s Online', '{}'), +(155, 108, 267, 268, 6, 'com_content.article.57', 'Wobbegone', '{}'), +(156, 55, 288, 289, 5, 'com_content.article.58', 'Wonderful Watermelon', '{}'), +(157, 96, 180, 181, 7, 'com_content.article.59', 'Wrapper Module', '{}'), +(158, 46, 125, 126, 6, 'com_content.article.60', 'News Feeds', '{}'), +(159, 166, 190, 191, 7, 'com_content.article.61', 'Breadcrumbs Module', '{}'), +(160, 50, 221, 222, 6, 'com_content.article.62', 'Content', '{}'), +(162, 109, 275, 276, 6, 'com_content.article.64', 'Blue Mountain Rain Forest', '{}'), +(163, 109, 277, 278, 6, 'com_content.article.65', 'Ormiston Pound', '{}'), +(165, 94, 154, 155, 7, 'com_content.article.66', 'Latest Users Module', '{}'), +(166, 47, 187, 192, 6, 'com_content.category.75', 'Navigation Modules', '{}'), +(167, 54, 295, 296, 4, 'com_content.category.76', 'Recipes', '{"core.create":{"12":1,"10":1},"core.edit.own":{"12":1,"10":1}}'), +(168, 34, 106, 107, 3, 'com_content.article.67', 'What''s New in 1.5?', '{}'), +(169, 24, 341, 342, 2, 'com_users.category.77', 'Uncategorised', '{}'), +(170, 50, 223, 224, 6, 'com_content.article.68', 'Captcha', '{}'), +(171, 50, 225, 226, 6, 'com_content.article.69', 'Quick Icons', '{}'), +(172, 96, 182, 183, 7, 'com_content.article.70', 'Smart Search', '{}'), +(173, 1, 426, 427, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{}'), (174, 1, 428, 429, 1, 'com_tags', 'com_tags', '{"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (175, 1, 430, 431, 1, 'com_contenthistory', 'com_contenthistory', '{}'), (176, 1, 432, 433, 1, 'com_ajax', 'com_ajax', '{}'), (177, 1, 433, 434, 1, 'com_postinstall', 'com_postinstall', '{}'), (178, 93, 144, 145, 7, 'com_content.article.71', 'Similar Tags', '{"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), -(179, 1, 435, 436, 1, '#__ucm_content.3', '#__ucm_content.3', '[]'), +(179, 1, 435, 436, 1, '#__ucm_content.3', '#__ucm_content.3', '{}'), (180, 93, 146, 147, 7, 'com_content.article.72', 'Popular Tags', '{"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'); INSERT IGNORE INTO `#__banners` (`id`, `cid`, `type`, `name`, `alias`, `imptotal`, `impmade`, `clicks`, `clickurl`, `state`, `catid`, `description`, `custombannercode`, `sticky`, `ordering`, `metakey`, `params`, `own_prefix`, `metakey_prefix`, `purchase_type`, `track_clicks`, `track_impressions`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `reset`, `created`, `language`, `created_by`, `created_by_alias`, `modified`, `modified_by`, `version`) VALUES @@ -388,7 +388,7 @@ INSERT IGNORE INTO `#__menu` (`id`, `menutype`, `title`, `alias`, `note`, `path` (243, 'parks', 'Parks Home', 'parks-home', '', 'parks-home', 'index.php?option=com_content&view=article&id=6', 'component', 1, 1, 1, 22, 0, '0000-00-00 00:00:00', 0, 1, '', 114, '{"show_noauth":"","show_title":"0","link_titles":"","show_intro":"","show_category":"0","link_category":"0","show_parent_category":"","link_parent_category":"","show_author":"0","link_author":"","show_create_date":"0","show_modify_date":"0","show_publish_date":"0","show_item_navigation":"0","show_icons":"","show_print_icon":"0","show_email_icon":"0","show_hits":"0","robots":"","rights":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","secure":0}', 97, 98, 0, 'en-GB', 0), (244, 'parks', 'Image Gallery', 'image-gallery', '', 'image-gallery', 'index.php?option=com_content&view=categories&id=28', 'component', 1, 1, 1, 22, 0, '0000-00-00 00:00:00', 0, 1, '', 114, '{"show_base_description":"1","categories_description":"","maxLevelcat":"","show_empty_categories_cat":"","show_subcat_desc_cat":"","show_cat_num_articles_cat":"","drill_down_layout":"1","show_category_title":"","show_description":"1","show_description_image":"1","maxLevel":"-1","show_empty_categories":"","show_subcat_desc":"","show_cat_num_articles":"","num_leading_articles":"1","num_intro_articles":"4","num_columns":"2","num_links":"4","multi_column_order":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_pagination_results":"","show_pagination_limit":"","filter_field":"","show_headings":"","list_show_date":"","date_format":"","list_show_hits":"","list_show_author":"","show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","link_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_readmore":"","show_icons":"","show_print_icon":"","show_email_icon":"","show_hits":"","show_noauth":"","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","page_title":"","show_page_heading":0,"page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 103, 108, 0, 'en-GB', 0), (251, 'frontendviews', 'Contact Categories', 'contact-categories', '', 'contact-categories', 'index.php?option=com_contact&view=categories&id=16', 'component', 1, 1, 1, 8, 0, '0000-00-00 00:00:00', 0, 1, '', 0, '{"show_base_description":"","categories_description":"","maxLevel":"-1","show_empty_categories":"","show_description":"","show_description_image":"","show_cat_num_articles":"","display_num":"","show_headings":"","filter_field":"","show_pagination":"","show_noauth":"","presentation_style":"sliders","show_name":"","show_position":"","show_email":"","show_street_address":"","show_suburb":"","show_state":"","show_postcode":"","show_country":"","show_telephone":"","show_mobile":"","show_fax":"","show_webpage":"","show_misc":"","show_image":"","allow_vcard":"","show_articles":"","show_links":"1","linka_name":"","linkb_name":"","linkc_name":"","linkd_name":"","linke_name":"","show_email_form":"","show_email_copy":"","banned_email":"","banned_subject":"","banned_text":"","validate_session":"","custom_reply":"","redirect":"","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 157, 158, 0, '*', 0), -(252, 'frontendviews', 'News Feed Categories', 'new-feed-categories', '', 'new-feed-categories', 'index.php?option=com_newsfeeds&view=categories&id=0', 'component', 1, 1, 1, 17, 0, '0000-00-00 00:00:00', 0, 1, '', 0, '{"show_base_description":"1","categories_description":"Because this links to the root category the \"uncategorised\" category is displayed. ","maxLevel":"-1","show_empty_categories":"1","show_description":"1","show_description_image":"1","show_cat_num_articles":"1","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 175, 176, 0, '*', 0), +(252, 'frontendviews', 'News Feed Categories', 'new-feed-categories', '', 'new-feed-categories', 'index.php?option=com_newsfeeds&view=categories&id=0', 'component', 1, 1, 1, 17, 0, '0000-00-00 00:00:00', 0, 1, '', 0, '{"show_base_description":"1","categories_description":"Because this links to the root category the \\"uncategorised\\" category is displayed. ","maxLevel":"-1","show_empty_categories":"1","show_description":"1","show_description_image":"1","show_cat_num_articles":"1","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 175, 176, 0, '*', 0), (253, 'frontendviews', 'News Feed Category', 'news-feed-category', '', 'news-feed-category', 'index.php?option=com_newsfeeds&view=category&id=17', 'component', 1, 1, 1, 17, 0, '0000-00-00 00:00:00', 0, 1, '', 0, '{"maxLevel":"-1","show_empty_categories":"","show_description":"","show_description_image":"","show_cat_num_articles":"","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 179, 180, 0, '*', 0), (254, 'frontendviews', 'Single News Feed', 'single-news-feed', '', 'single-news-feed', 'index.php?option=com_newsfeeds&view=newsfeed&id=4', 'component', 1, 1, 1, 17, 0, '0000-00-00 00:00:00', 0, 1, '', 0, '{"show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 177, 178, 0, '*', 0), (255, 'frontendviews', 'Search', 'search', '', 'search', 'index.php?option=com_search&view=search', 'component', 1, 1, 1, 19, 0, '0000-00-00 00:00:00', 0, 1, '', 0, '{"search_areas":"1","show_date":"1","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 197, 198, 0, '*', 0), diff --git a/installation/sql/postgresql/joomla.sql b/installation/sql/postgresql/joomla.sql index 231c45b6271ab..03b7c99710596 100644 --- a/installation/sql/postgresql/joomla.sql +++ b/installation/sql/postgresql/joomla.sql @@ -31,55 +31,55 @@ COMMENT ON COLUMN "#__assets"."rules" IS 'JSON encoded access control.'; INSERT INTO "#__assets" ("id", "parent_id", "lft", "rgt", "level", "name", "title", "rules") VALUES (1, 0, 0, 103, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.offline":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (2, 1, 1, 2, 1, 'com_admin', 'com_admin', '{}'), -(3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), (4, 1, 7, 8, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (5, 1, 9, 10, 1, 'com_checkin', 'com_checkin', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), (6, 1, 11, 12, 1, 'com_config', 'com_config', '{}'), -(7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(8, 1, 17, 20, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}'), +(7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(8, 1, 17, 20, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}'), (9, 1, 21, 22, 1, 'com_cpanel', 'com_cpanel', '{}'), -(10, 1, 23, 24, 1, 'com_installer', 'com_installer', '{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), -(11, 1, 25, 26, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(10, 1, 23, 24, 1, 'com_installer', 'com_installer', '{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), +(11, 1, 25, 26, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1}}'), (12, 1, 27, 28, 1, 'com_login', 'com_login', '{}'), (13, 1, 29, 30, 1, 'com_mailto', 'com_mailto', '{}'), (14, 1, 31, 32, 1, 'com_massmail', 'com_massmail', '{}'), (15, 1, 33, 34, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}'), -(16, 1, 35, 38, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(16, 1, 35, 38, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1}}'), (17, 1, 39, 40, 1, 'com_messages', 'com_messages', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), -(18, 1, 41, 72, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(19, 1, 73, 76, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(20, 1, 77, 78, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1},"core.manage":[],"core.edit":[],"core.edit.state":[]}'), -(21, 1, 79, 80, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1},"core.manage":[]}'), +(18, 1, 41, 72, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1}}'), +(19, 1, 73, 76, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(20, 1, 77, 78, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1}}'), +(21, 1, 79, 80, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1}}'), (22, 1, 81, 82, 1, 'com_search', 'com_search', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(23, 1, 83, 84, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(24, 1, 85, 88, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(23, 1, 83, 84, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1}}'), +(24, 1, 85, 88, 1, 'com_users', 'com_users', '{"core.admin":{"7":1}}'), (26, 1, 89, 90, 1, 'com_wrapper', 'com_wrapper', '{}'), -(27, 8, 18, 19, 2, 'com_content.category.2', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(30, 19, 74, 75, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(32, 24, 86, 87, 1, 'com_users.category.7', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(27, 8, 18, 19, 2, 'com_content.category.2', 'Uncategorised', '{}'), +(28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{}'), +(29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{}'), +(30, 19, 74, 75, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{}'), +(32, 24, 86, 87, 2, 'com_users.category.7', 'Uncategorised', '{}'), (33, 1, 91, 92, 1, 'com_finder', 'com_finder', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(34, 1, 93, 94, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), -(35, 1, 95, 96, 1, 'com_tags', 'com_tags', '{"core.admin":[],"core.manage":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), +(34, 1, 93, 94, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{}'), +(35, 1, 95, 96, 1, 'com_tags', 'com_tags', '{}'), (36, 1, 97, 98, 1, 'com_contenthistory', 'com_contenthistory', '{}'), (37, 1, 99, 100, 1, 'com_ajax', 'com_ajax', '{}'), (38, 1, 101, 102, 1, 'com_postinstall', 'com_postinstall', '{}'), -(39, 18, 42, 43, 2, 'com_modules.module.1', 'Main Menu', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(40, 18, 44, 45, 2, 'com_modules.module.2', 'Login', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(41, 18, 46, 47, 2, 'com_modules.module.3', 'Popular Articles', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(42, 18, 48, 49, 2, 'com_modules.module.4', 'Recently Added Articles', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(43, 18, 50, 51, 2, 'com_modules.module.8', 'Toolbar', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(44, 18, 52, 53, 2, 'com_modules.module.9', 'Quick Icons', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(45, 18, 54, 55, 2, 'com_modules.module.10', 'Logged-in Users', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(46, 18, 56, 57, 2, 'com_modules.module.12', 'Admin Menu', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(47, 18, 58, 59, 2, 'com_modules.module.13', 'Admin Submenu', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(48, 18, 60, 61, 2, 'com_modules.module.14', 'User Status', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(49, 18, 62, 63, 2, 'com_modules.module.15', 'Title', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(50, 18, 64, 65, 2, 'com_modules.module.16', 'Login Form', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(51, 18, 66, 67, 2, 'com_modules.module.17', 'Breadcrumbs', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(52, 18, 68, 69, 2, 'com_modules.module.79', 'Multilanguage status', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(53, 18, 70, 71, 2, 'com_modules.module.86', 'Joomla Version', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(39, 18, 42, 43, 2, 'com_modules.module.1', 'Main Menu', '{}'), +(40, 18, 44, 45, 2, 'com_modules.module.2', 'Login', '{}'), +(41, 18, 46, 47, 2, 'com_modules.module.3', 'Popular Articles', '{}'), +(42, 18, 48, 49, 2, 'com_modules.module.4', 'Recently Added Articles', '{}'), +(43, 18, 50, 51, 2, 'com_modules.module.8', 'Toolbar', '{}'), +(44, 18, 52, 53, 2, 'com_modules.module.9', 'Quick Icons', '{}'), +(45, 18, 54, 55, 2, 'com_modules.module.10', 'Logged-in Users', '{}'), +(46, 18, 56, 57, 2, 'com_modules.module.12', 'Admin Menu', '{}'), +(47, 18, 58, 59, 2, 'com_modules.module.13', 'Admin Submenu', '{}'), +(48, 18, 60, 61, 2, 'com_modules.module.14', 'User Status', '{}'), +(49, 18, 62, 63, 2, 'com_modules.module.15', 'Title', '{}'), +(50, 18, 64, 65, 2, 'com_modules.module.16', 'Login Form', '{}'), +(51, 18, 66, 67, 2, 'com_modules.module.17', 'Breadcrumbs', '{}'), +(52, 18, 68, 69, 2, 'com_modules.module.79', 'Multilanguage status', '{}'), +(53, 18, 70, 71, 2, 'com_modules.module.86', 'Joomla Version', '{}'), (54, 16, 36, 37, 2, 'com_menus.menu.1', 'Main Menu', '{}'); SELECT setval('#__assets_id_seq', 55, false); @@ -452,7 +452,7 @@ CREATE TABLE "#__extensions" ( "element" varchar(100) NOT NULL, "folder" varchar(100) NOT NULL, "client_id" smallint NOT NULL, - "enabled" smallint DEFAULT 1 NOT NULL, + "enabled" smallint DEFAULT 0 NOT NULL, "access" bigint DEFAULT 1 NOT NULL, "protected" smallint DEFAULT 0 NOT NULL, "manifest_cache" text NOT NULL, @@ -490,17 +490,18 @@ INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder" (17, 'com_newsfeeds', 'component', 'com_newsfeeds', '', 1, 1, 1, 0, '', '{"newsfeed_layout":"_:default","save_history":"1","history_limit":5,"show_feed_image":"1","show_feed_description":"1","show_item_description":"1","feed_character_count":"0","feed_display_order":"des","float_first":"right","float_second":"right","show_tags":"1","category_layout":"_:default","show_category_title":"1","show_description":"1","show_description_image":"1","maxLevel":"-1","show_empty_categories":"0","show_subcat_desc":"1","show_cat_items":"1","show_cat_tags":"1","show_base_description":"1","maxLevelcat":"-1","show_empty_categories_cat":"0","show_subcat_desc_cat":"1","show_cat_items_cat":"1","filter_field":"1","show_pagination_limit":"1","show_headings":"1","show_articles":"0","show_link":"1","show_pagination":"1","show_pagination_results":"1"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (18, 'com_plugins', 'component', 'com_plugins', '', 1, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (19, 'com_search', 'component', 'com_search', '', 1, 1, 1, 0, '', '{"enabled":"0","show_date":"1"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), -(20, 'com_templates', 'component', 'com_templates', '', 1, 1, 1, 1, '', '{"template_positions_display":"0","upload_limit":"10","image_formats":"gif,bmp,jpg,jpeg,png","source_formats":"txt,less,ini,xml,js,php,css","font_formats":"woff,ttf,otf","compressed_formats":"zip"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(20, 'com_templates', 'component', 'com_templates', '', 1, 1, 1, 1, '', '{"template_positions_display":"0","upload_limit":"10","image_formats":"gif,bmp,jpg,jpeg,png","source_formats":"txt,less,ini,xml,js,php,css,scss,sass","font_formats":"woff,ttf,otf","compressed_formats":"zip"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (22, 'com_content', 'component', 'com_content', '', 1, 1, 0, 1, '', '{"article_layout":"_:default","show_title":"1","link_titles":"1","show_intro":"1","show_category":"1","link_category":"1","show_parent_category":"0","link_parent_category":"0","show_author":"1","link_author":"0","show_create_date":"0","show_modify_date":"0","show_publish_date":"1","show_item_navigation":"1","show_vote":"0","show_readmore":"1","show_readmore_title":"1","readmore_limit":"100","show_icons":"1","show_print_icon":"1","show_email_icon":"1","show_hits":"1","show_noauth":"0","show_publishing_options":"1","show_article_options":"1","save_history":"1","history_limit":10,"show_urls_images_frontend":"0","show_urls_images_backend":"1","targeta":0,"targetb":0,"targetc":0,"float_intro":"left","float_fulltext":"left","category_layout":"_:blog","show_category_title":"0","show_description":"0","show_description_image":"0","maxLevel":"1","show_empty_categories":"0","show_no_articles":"1","show_subcat_desc":"1","show_cat_num_articles":"0","show_base_description":"1","maxLevelcat":"-1","show_empty_categories_cat":"0","show_subcat_desc_cat":"1","show_cat_num_articles_cat":"1","num_leading_articles":"1","num_intro_articles":"4","num_columns":"2","num_links":"4","multi_column_order":"0","show_subcategory_content":"0","show_pagination_limit":"1","filter_field":"hide","show_headings":"1","list_show_date":"0","date_format":"","list_show_hits":"1","list_show_author":"1","orderby_pri":"order","orderby_sec":"rdate","order_date":"published","show_pagination":"2","show_pagination_results":"1","show_feed_link":"1","feed_summary":"0"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (23, 'com_config', 'component', 'com_config', '', 1, 1, 0, 1, '', '{"filters":{"1":{"filter_type":"NH","filter_tags":"","filter_attributes":""},"6":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"7":{"filter_type":"NONE","filter_tags":"","filter_attributes":""},"2":{"filter_type":"NH","filter_tags":"","filter_attributes":""},"3":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"4":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"5":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"10":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"12":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"8":{"filter_type":"NONE","filter_tags":"","filter_attributes":""}}}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (24, 'com_redirect', 'component', 'com_redirect', '', 1, 1, 0, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), -(25, 'com_users', 'component', 'com_users', '', 1, 1, 0, 1, '', '{"allowUserRegistration":"0","new_usertype":"2","guest_usergroup":"9","sendpassword":"1","useractivation":"1","mail_to_admin":"0","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","minimum_length":"4","minimum_integers":"0","minimum_symbols":"0","minimum_uppercase":"0","save_history":"1","history_limit":5,"mailSubjectPrefix":"","mailBodySuffix":""}', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(25, 'com_users', 'component', 'com_users', '', 1, 1, 0, 1, '', '{"allowUserRegistration":"0","new_usertype":"2","guest_usergroup":"9","sendpassword":"1","useractivation":"2","mail_to_admin":"1","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","minimum_length":"4","minimum_integers":"0","minimum_symbols":"0","minimum_uppercase":"0","save_history":"1","history_limit":5,"mailSubjectPrefix":"","mailBodySuffix":""}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (27, 'com_finder', 'component', 'com_finder', '', 1, 1, 0, 0, '', '{"show_description":"1","description_length":255,"allow_empty_query":"0","show_url":"1","show_advanced":"1","expand_advanced":"0","show_date_filters":"0","highlight_terms":"1","opensearch_name":"","opensearch_description":"","batch_size":"50","memory_table_limit":30000,"title_multiplier":"1.7","text_multiplier":"0.7","meta_multiplier":"1.2","path_multiplier":"2.0","misc_multiplier":"0.3","stemmer":"snowball"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (28, 'com_joomlaupdate', 'component', 'com_joomlaupdate', '', 1, 1, 0, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (29, 'com_tags', 'component', 'com_tags', '', 1, 1, 1, 1, '', '{"tag_layout":"_:default","save_history":"1","history_limit":5,"show_tag_title":"0","tag_list_show_tag_image":"0","tag_list_show_tag_description":"0","tag_list_image":"","show_tag_num_items":"0","tag_list_orderby":"title","tag_list_orderby_direction":"ASC","show_headings":"0","tag_list_show_date":"0","tag_list_show_item_image":"0","tag_list_show_item_description":"0","tag_list_item_maximum_characters":0,"return_any_or_all":"1","include_children":"0","maximum":200,"tag_list_language_filter":"all","tags_layout":"_:default","all_tags_orderby":"title","all_tags_orderby_direction":"ASC","all_tags_show_tag_image":"0","all_tags_show_tag_descripion":"0","all_tags_tag_maximum_characters":20,"all_tags_show_tag_hits":"0","filter_field":"1","show_pagination_limit":"1","show_pagination":"2","show_pagination_results":"1","tag_field_ajax_mode":"1","show_feed_link":"1"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (30, 'com_contenthistory', 'component', 'com_contenthistory', '', 1, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (31, 'com_ajax', 'component', 'com_ajax', '', 1, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), -(32, 'com_postinstall', 'component', 'com_postinstall', '', 1, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); +(32, 'com_postinstall', 'component', 'com_postinstall', '', 1, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(33, 'com_fields', 'component', 'com_fields', '', 1, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); -- Libraries INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES @@ -616,7 +617,9 @@ INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder" (457, 'plg_installer_urlinstaller', 'plugin', 'urlinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 3, 0), (458, 'plg_quickicon_phpversioncheck', 'plugin', 'phpversioncheck', 'quickicon', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (459, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), -(460, 'plg_editors-xtd_contact', 'plugin', 'contact', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); +(460, 'plg_editors-xtd_contact', 'plugin', 'contact', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(461, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(462, 'plg_fields_gallery', 'plugin', 'gallery', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); -- Templates INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES @@ -640,6 +643,62 @@ INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder" SELECT setval('#__extensions_extension_id_seq', 10000, false); +-- +-- Table: #__fields +-- +CREATE TABLE "#__fields" ( + "id" serial NOT NULL, + "asset_id" bigint DEFAULT 0 NOT NULL, + "context" varchar(255) DEFAULT '' NOT NULL, + "catid" bigint DEFAULT 0 NOT NULL, + "assigned_cat_ids" varchar(255) DEFAULT '' NOT NULL, + "title" varchar(255) DEFAULT '' NOT NULL, + "alias" varchar(255) DEFAULT '' NOT NULL, + "label" varchar(255) DEFAULT '' NOT NULL, + "default_value" text DEFAULT '' NOT NULL, + "type" varchar(255) DEFAULT 'text' NOT NULL, + "options" varchar(255) DEFAULT '' NOT NULL, + "note" varchar(255) DEFAULT '' NOT NULL, + "description" text DEFAULT '' NOT NULL, + "state" smallint DEFAULT 0 NOT NULL, + "required" smallint DEFAULT 0 NOT NULL, + "checked_out" integer DEFAULT 0 NOT NULL, + "checked_out_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "ordering" bigint DEFAULT 0 NOT NULL, + "params" text DEFAULT '' NOT NULL, + "fieldparams" text DEFAULT '' NOT NULL, + "attributes" text DEFAULT '' NOT NULL, + "language" varchar(7) DEFAULT '' NOT NULL, + "created_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "created_user_id" bigint DEFAULT 0 NOT NULL, + "created_by_alias" varchar(255) DEFAULT '' NOT NULL, + "modified_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "modified_by" bigint DEFAULT 0 NOT NULL, + "publish_up" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "publish_down" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "access" bigint DEFAULT 0 NOT NULL, + PRIMARY KEY ("id") +); +CREATE INDEX "#__fields_idx_checked_out" ON "#__fields" ("checked_out"); +CREATE INDEX "#__fields_idx_state" ON "#__fields" ("state"); +CREATE INDEX "#__fields_idx_created_user_id" ON "#__fields" ("created_user_id"); +CREATE INDEX "#__fields_idx_access" ON "#__fields" ("access"); +CREATE INDEX "#__fields_idx_context" ON "#__fields" ("context"); +CREATE INDEX "#__fields_idx_language" ON "#__fields" ("language"); + +-- +-- Table: #__fields_values +-- +CREATE TABLE "#__fields_values" ( +"field_id" bigint DEFAULT 0 NOT NULL, +"item_id" varchar(255) DEFAULT '' NOT NULL, +"context" varchar(255) DEFAULT '' NOT NULL, +"value" text DEFAULT '' NOT NULL +); +CREATE INDEX "#__fields_values_idx_field_id" ON "#__fields_values" ("field_id"); +CREATE INDEX "#__fields_values_idx_context" ON "#__fields_values" ("context"); +CREATE INDEX "#__fields_values_idx_item_id" ON "#__fields_values" ("item_id"); + -- -- Table: #__finder_filters -- @@ -1462,7 +1521,8 @@ INSERT INTO "#__postinstall_messages" ("extension_id", "title_key", "description (700, 'PLG_TWOFACTORAUTH_TOTP_POSTINSTALL_TITLE', 'PLG_TWOFACTORAUTH_TOTP_POSTINSTALL_BODY', 'PLG_TWOFACTORAUTH_TOTP_POSTINSTALL_ACTION', 'plg_twofactorauth_totp', 1, 'action', 'site://plugins/twofactorauth/totp/postinstall/actions.php', 'twofactorauth_postinstall_action', 'site://plugins/twofactorauth/totp/postinstall/actions.php', 'twofactorauth_postinstall_condition', '3.2.0', 1), (700, 'COM_CPANEL_WELCOME_BEGINNERS_TITLE', 'COM_CPANEL_WELCOME_BEGINNERS_MESSAGE', '', 'com_cpanel', 1, 'message', '', '', '', '', '3.2.0', 1), (700, 'COM_CPANEL_MSG_STATS_COLLECTION_TITLE', 'COM_CPANEL_MSG_STATS_COLLECTION_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/statscollection.php', 'admin_postinstall_statscollection_condition', '3.5.0', 1), -(700, 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_BODY', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_ACTION', 'plg_system_updatenotification', 1, 'action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_condition', '3.6.3', 1); +(700, 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_BODY', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_ACTION', 'plg_system_updatenotification', 1, 'action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_condition', '3.6.3', 1), +(700, 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_TITLE', 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/joomla40checks.php', 'admin_postinstall_joomla40checks_condition', '3.7.0', 1); -- -- Table: #__redirect_links diff --git a/installation/sql/postgresql/sample_blog.sql b/installation/sql/postgresql/sample_blog.sql index 7b16dda867806..3e9a5fe7eea23 100644 --- a/installation/sql/postgresql/sample_blog.sql +++ b/installation/sql/postgresql/sample_blog.sql @@ -11,43 +11,43 @@ TRUNCATE "#__modules_menu" RESTART IDENTITY; INSERT INTO "#__assets" VALUES (1,0,0,93,0,'root.1','Root Asset','{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.offline":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (2,1,1,2,1,'com_admin','com_admin','{}'), -(3,1,3,6,1,'com_banners','com_banners','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(3,1,3,6,1,'com_banners','com_banners','{"core.admin":{"7":1},"core.manage":{"6":1}}'), (4,1,7,8,1,'com_cache','com_cache','{"core.admin":{"7":1},"core.manage":{"7":1}}'), (5,1,9,10,1,'com_checkin','com_checkin','{"core.admin":{"7":1},"core.manage":{"7":1}}'), (6,1,11,12,1,'com_config','com_config','{}'), -(7,1,13,16,1,'com_contact','com_contact','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(8,1,17,34,1,'com_content','com_content','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}'), +(7,1,13,16,1,'com_contact','com_contact','{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(8,1,17,34,1,'com_content','com_content','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}'), (9,1,35,36,1,'com_cpanel','com_cpanel','{}'), -(10,1,37,38,1,'com_installer','com_installer','{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), -(11,1,39,40,1,'com_languages','com_languages','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(10,1,37,38,1,'com_installer','com_installer','{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), +(11,1,39,40,1,'com_languages','com_languages','{"core.admin":{"7":1}}'), (12,1,41,42,1,'com_login','com_login','{}'), (13,1,43,44,1,'com_mailto','com_mailto','{}'), (14,1,45,46,1,'com_massmail','com_massmail','{}'), (15,1,47,48,1,'com_media','com_media','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}'), -(16,1,49,50,1,'com_menus','com_menus','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(16,1,49,50,1,'com_menus','com_menus','{"core.admin":{"7":1}}'), (17,1,51,52,1,'com_messages','com_messages','{"core.admin":{"7":1},"core.manage":{"7":1}}'), -(18,1,53,54,1,'com_modules','com_modules','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(19,1,55,58,1,'com_newsfeeds','com_newsfeeds','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(20,1,59,60,1,'com_plugins','com_plugins','{"core.admin":{"7":1},"core.manage":[],"core.edit":[],"core.edit.state":[]}'), -(21,1,61,62,1,'com_redirect','com_redirect','{"core.admin":{"7":1},"core.manage":[]}'), +(18,1,53,54,1,'com_modules','com_modules','{"core.admin":{"7":1}}'), +(19,1,55,58,1,'com_newsfeeds','com_newsfeeds','{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(20,1,59,60,1,'com_plugins','com_plugins','{"core.admin":{"7":1}}'), +(21,1,61,62,1,'com_redirect','com_redirect','{"core.admin":{"7":1}}'), (22,1,63,64,1,'com_search','com_search','{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(23,1,65,66,1,'com_templates','com_templates','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(24,1,67,70,1,'com_users','com_users','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.own":{"6":1},"core.edit.state":[]}'), +(23,1,65,66,1,'com_templates','com_templates','{"core.admin":{"7":1}}'), +(24,1,67,70,1,'com_users','com_users','{"core.admin":{"7":1},"core.edit.own":{"6":1}}'), (26,1,77,78,1,'com_wrapper','com_wrapper','{}'), -(27,8,18,23,2,'com_content.category.2','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(28,3,4,5,2,'com_banners.category.3','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(29,7,14,15,2,'com_contact.category.4','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(30,19,56,57,2,'com_newsfeeds.category.5','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(32,24,68,69,1,'com_users.category.7','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(27,8,18,23,2,'com_content.category.2','Uncategorised','{}'), +(28,3,4,5,2,'com_banners.category.3','Uncategorised','{}'), +(29,7,14,15,2,'com_contact.category.4','Uncategorised','{}'), +(30,19,56,57,2,'com_newsfeeds.category.5','Uncategorised','{}'), +(32,24,68,69,2,'com_users.category.7','Uncategorised','{}'), (33,1,79,80,1,'com_finder','com_finder','{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(35,8,24,33,2,'com_content.category.9','Blog','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(36,27,19,20,3,'com_content.article.1','About','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(37,27,21,22,3,'com_content.article.2','Working on Your Site','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(38,35,25,26,3,'com_content.article.3','Welcome to your blog','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(39,35,27,28,3,'com_content.article.4','About your home page','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(40,35,29,30,3,'com_content.article.5','Your Modules','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(41,1,81,82,1,'com_users.category.10','Uncategorised',''), -(42,1,83,84,1,'com_joomlaupdate','com_joomlaupdate','{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), +(35,8,24,33,2,'com_content.category.9','Blog','{}'), +(36,27,19,20,3,'com_content.article.1','About','{}'), +(37,27,21,22,3,'com_content.article.2','Working on Your Site','{}'), +(38,35,25,26,3,'com_content.article.3','Welcome to your blog','{}'), +(39,35,27,28,3,'com_content.article.4','About your home page','{}'), +(40,35,29,30,3,'com_content.article.5','Your Modules','{}'), +(41,1,81,82,1,'com_users.category.10','Uncategorised','{}'), +(42,1,83,84,1,'com_joomlaupdate','com_joomlaupdate','{}'), (43,35,31,32,3,'com_content.article.6','Your Template','{"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (44,1,85,86,1,'com_tags','com_tags','{"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (45,1,87,88,1,'com_contenthistory','com_contenthistory','{}'), diff --git a/installation/sql/postgresql/sample_data.sql b/installation/sql/postgresql/sample_data.sql index 1f8707bb5a208..f63087b58e6ff 100644 --- a/installation/sql/postgresql/sample_data.sql +++ b/installation/sql/postgresql/sample_data.sql @@ -10,36 +10,36 @@ TRUNCATE "#__modules_menu" RESTART IDENTITY; INSERT INTO "#__assets" VALUES (1,0,0,77,0,'root.1','Root Asset','{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.offline":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (2,1,1,2,1,'com_admin','com_admin','{}'), -(3,1,3,6,1,'com_banners','com_banners','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(3,1,3,6,1,'com_banners','com_banners','{"core.admin":{"7":1},"core.manage":{"6":1}}'), (4,1,7,8,1,'com_cache','com_cache','{"core.admin":{"7":1},"core.manage":{"7":1}}'), (5,1,9,10,1,'com_checkin','com_checkin','{"core.admin":{"7":1},"core.manage":{"7":1}}'), (6,1,11,12,1,'com_config','com_config','{}'), -(7,1,13,16,1,'com_contact','com_contact','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(8,1,17,22,1,'com_content','com_content','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}'), +(7,1,13,16,1,'com_contact','com_contact','{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(8,1,17,22,1,'com_content','com_content','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}'), (9,1,23,24,1,'com_cpanel','com_cpanel','{}'), -(10,1,25,26,1,'com_installer','com_installer','{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), -(11,1,27,28,1,'com_languages','com_languages','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(10,1,25,26,1,'com_installer','com_installer','{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), +(11,1,27,28,1,'com_languages','com_languages','{"core.admin":{"7":1}}'), (12,1,29,30,1,'com_login','com_login','{}'), (13,1,31,32,1,'com_mailto','com_mailto','{}'), (14,1,33,34,1,'com_massmail','com_massmail','{}'), (15,1,35,36,1,'com_media','com_media','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}'), -(16,1,37,38,1,'com_menus','com_menus','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(16,1,37,38,1,'com_menus','com_menus','{"core.admin":{"7":1}}'), (17,1,39,40,1,'com_messages','com_messages','{"core.admin":{"7":1},"core.manage":{"7":1}}'), -(18,1,41,42,1,'com_modules','com_modules','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(19,1,43,46,1,'com_newsfeeds','com_newsfeeds','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(20,1,47,48,1,'com_plugins','com_plugins','{"core.admin":{"7":1},"core.manage":[],"core.edit":[],"core.edit.state":[]}'), -(21,1,49,50,1,'com_redirect','com_redirect','{"core.admin":{"7":1},"core.manage":[]}'), +(18,1,41,42,1,'com_modules','com_modules','{"core.admin":{"7":1}}'), +(19,1,43,46,1,'com_newsfeeds','com_newsfeeds','{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(20,1,47,48,1,'com_plugins','com_plugins','{"core.admin":{"7":1}}'), +(21,1,49,50,1,'com_redirect','com_redirect','{"core.admin":{"7":1}}'), (22,1,51,52,1,'com_search','com_search','{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(23,1,53,54,1,'com_templates','com_templates','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(24,1,55,58,1,'com_users','com_users','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(23,1,53,54,1,'com_templates','com_templates','{"core.admin":{"7":1}}'), +(24,1,55,58,1,'com_users','com_users','{"core.admin":{"7":1}}'), (26,1,63,64,1,'com_wrapper','com_wrapper','{}'), -(27,8,18,21,2,'com_content.category.2','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(28,3,4,5,2,'com_banners.category.3','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(29,7,14,15,2,'com_contact.category.4','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(30,19,44,45,2,'com_newsfeeds.category.5','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(32,24,56,57,1,'com_users.category.7','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(27,8,18,21,2,'com_content.category.2','Uncategorised','{}'), +(28,3,4,5,2,'com_banners.category.3','Uncategorised','{}'), +(29,7,14,15,2,'com_contact.category.4','Uncategorised','{}'), +(30,19,44,45,2,'com_newsfeeds.category.5','Uncategorised','{}'), +(32,24,56,57,2,'com_users.category.7','Uncategorised','{}'), (33,1,65,66,1,'com_finder','com_finder','{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(34,1,67,68,1,'com_joomlaupdate','com_joomlaupdate','{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), +(34,1,67,68,1,'com_joomlaupdate','com_joomlaupdate','{}'), (35,27,19,20,3,'com_content.article.1','Getting Started','{"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (36,1,69,70,1,'com_tags','com_tags','{"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (37,1,71,72,1,'com_contenthistory','com_contenthistory','{}'), diff --git a/installation/sql/postgresql/sample_learn.sql b/installation/sql/postgresql/sample_learn.sql index fc26d9b634264..0c628788191f4 100644 --- a/installation/sql/postgresql/sample_learn.sql +++ b/installation/sql/postgresql/sample_learn.sql @@ -12,161 +12,161 @@ TRUNCATE "#__viewlevels" RESTART IDENTITY; -- Dumping data for table #__assets -- INSERT INTO "#__assets" VALUES -(1,0,1,430,0,'root.1','Root Asset','{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.offline":[],"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), +(1,0,1,430,0,'root.1','Root Asset','{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (2,1,2,3,1,'com_admin','com_admin','{}'), -(3,1,4,11,1,'com_banners','com_banners','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(3,1,4,11,1,'com_banners','com_banners','{"core.admin":{"7":1},"core.manage":{"6":1}}'), (4,1,12,13,1,'com_cache','com_cache','{"core.admin":{"7":1},"core.manage":{"7":1}}'), (5,1,14,15,1,'com_checkin','com_checkin','{"core.admin":{"7":1},"core.manage":{"7":1}}'), (6,1,16,17,1,'com_config','com_config','{}'), -(7,1,18,87,1,'com_contact','com_contact','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(8,1,88,297,1,'com_content','com_content','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}'), +(7,1,18,87,1,'com_contact','com_contact','{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(8,1,88,297,1,'com_content','com_content','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}'), (9,1,298,299,1,'com_cpanel','com_cpanel','{}'), -(10,1,300,301,1,'com_installer','com_installer','{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), -(11,1,302,303,1,'com_languages','com_languages','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(10,1,300,301,1,'com_installer','com_installer','{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), +(11,1,302,303,1,'com_languages','com_languages','{"core.admin":{"7":1}}'), (12,1,304,305,1,'com_login','com_login','{}'), (13,1,306,307,1,'com_mailto','com_mailto','{}'), (14,1,308,309,1,'com_massmail','com_massmail','{}'), -(15,1,310,311,1,'com_media','com_media','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1},"core.edit":[],"core.edit.state":[]}'), -(16,1,312,313,1,'com_menus','com_menus','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(15,1,310,311,1,'com_media','com_media','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}'), +(16,1,312,313,1,'com_menus','com_menus','{"core.admin":{"7":1}}'), (17,1,37,38,1,'com_messages','com_messages','{"core.admin":{"7":1},"core.manage":{"7":1}}'), -(18,1,316,317,1,'com_modules','com_modules','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(19,1,318,325,1,'com_newsfeeds','com_newsfeeds','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(20,1,326,327,1,'com_plugins','com_plugins','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(21,1,328,329,1,'com_redirect','com_redirect','{"core.admin":{"7":1},"core.manage":[]}'), +(18,1,316,317,1,'com_modules','com_modules','{"core.admin":{"7":1}}'), +(19,1,318,325,1,'com_newsfeeds','com_newsfeeds','{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(20,1,326,327,1,'com_plugins','com_plugins','{"core.admin":{"7":1}}'), +(21,1,328,329,1,'com_redirect','com_redirect','{"core.admin":{"7":1}}'), (22,1,330,331,1,'com_search','com_search','{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(23,1,332,333,1,'com_templates','com_templates','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(24,1,334,337,1,'com_users','com_users','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(23,1,332,333,1,'com_templates','com_templates','{"core.admin":{"7":1}}'), +(24,1,334,337,1,'com_users','com_users','{"core.admin":{"7":1}}'), (26,1,356,357,1,'com_wrapper','com_wrapper','{}'), (33,1,418,419,1,'com_finder','com_finder','{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(34,8,105,108,2,'com_content.category.9','Uncategorised','{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(35,3,7,8,2,'com_banners.category.10','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(36,7,23,24,2,'com_contact.category.11','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(37,19,321,322,2,'com_newsfeeds.category.12','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(39,8,109,296,2,'com_content.category.14','Sample Data-Articles','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(40,3,9,10,2,'com_banners.category.15','Sample Data-Banners','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(41,7,25,86,2,'com_contact.category.16','Sample Data-Contact','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(42,19,323,324,2,'com_newsfeeds.category.17','Sample Data-Newsfeeds','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(44,39,110,245,3,'com_content.category.19','Joomla!','{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(45,44,111,222,4,'com_content.category.20','Extensions','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(46,45,112,127,5,'com_content.category.21','Components','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(47,45,128,189,5,'com_content.category.22','Modules','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(48,45,190,199,5,'com_content.category.23','Templates','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(49,45,200,201,5,'com_content.category.24','Languages','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(50,45,202,221,5,'com_content.category.25','Plugins','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(51,39,246,277,3,'com_content.category.26','Park Site','{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(52,51,247,252,4,'com_content.category.27','Park Blog','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(53,51,253,274,4,'com_content.category.28','Photo Gallery','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(54,39,278,291,3,'com_content.category.29','Fruit Shop Site','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(55,54,279,284,4,'com_content.category.30','Growers','{"core.create":{"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"10":1}}'), -(59,41,26,27,3,'com_contact.category.34','Park Site','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(60,41,28,85,3,'com_contact.category.35','Shop Site','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(61,60,29,30,4,'com_contact.category.36','Staff','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(62,60,31,84,4,'com_contact.category.37','Fruit Encyclopedia','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(63,62,32,33,5,'com_contact.category.38','A','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(64,62,34,35,5,'com_contact.category.39','B','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(65,62,36,37,5,'com_contact.category.40','C','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(66,62,38,39,5,'com_contact.category.41','D','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(67,62,40,41,5,'com_contact.category.42','E','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(68,62,42,43,5,'com_contact.category.43','F','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(69,62,44,45,5,'com_contact.category.44','G','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(70,62,46,47,5,'com_contact.category.45','H','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(71,62,48,49,5,'com_contact.category.46','I','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(72,62,50,51,5,'com_contact.category.47','J','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(73,62,52,53,5,'com_contact.category.48','K','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(74,62,54,55,5,'com_contact.category.49','L','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(75,62,56,57,5,'com_contact.category.50','M','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(76,62,58,59,5,'com_contact.category.51','N','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(77,62,60,61,5,'com_contact.category.52','O','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(78,62,62,63,5,'com_contact.category.53','P','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(79,62,64,65,5,'com_contact.category.54','Q','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(80,62,66,67,5,'com_contact.category.55','R','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(81,62,68,69,5,'com_contact.category.56','S','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(82,62,70,71,5,'com_contact.category.57','T','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(83,62,72,73,5,'com_contact.category.58','U','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(84,62,74,75,5,'com_contact.category.59','V','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(85,62,76,77,5,'com_contact.category.60','W','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(86,62,78,79,5,'com_contact.category.61','X','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(87,62,80,81,5,'com_contact.category.62','Y','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(88,62,82,83,5,'com_contact.category.63','Z','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(89,46,113,114,6,'com_content.article.1','Administrator Components','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(90,93,130,131,7,'com_content.article.2','Archive Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(91,93,132,133,7,'com_content.article.3','Article Categories Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(92,93,134,135,7,'com_content.article.4','Articles Category Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(93,47,129,144,6,'com_content.category.64','Content Modules','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(94,47,145,152,6,'com_content.category.65','User Modules','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(95,47,153,166,6,'com_content.category.66','Display Modules','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(96,47,167,180,6,'com_content.category.67','Utility Modules','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(98,48,191,192,6,'com_content.category.69','Beez3','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(100,48,193,194,6,'com_content.category.71','Milky Way','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(101,50,203,204,6,'com_content.article.5','Authentication','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(102,51,275,276,4,'com_content.article.6','Australian Parks ','{"core.delete":[],"core.edit":{"2":1},"core.edit.state":[]}'), -(103,95,154,155,7,'com_content.article.7','Banner Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(104,44,223,224,4,'com_content.article.8','Beginners','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(105,46,115,116,6,'com_content.article.9','Contact','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(106,46,117,118,6,'com_content.article.10','Content','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(107,109,265,266,6,'com_content.article.11','Cradle Mountain','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(108,53,254,263,5,'com_content.category.72','Animals','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(109,53,264,273,5,'com_content.category.73','Scenery','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(110,95,156,157,7,'com_content.article.12','Custom Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(111,54,285,286,4,'com_content.article.13','Directions','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(112,50,205,206,6,'com_content.article.14','Editors','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(113,50,207,208,6,'com_content.article.15','Editors-xtd','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(114,95,158,159,7,'com_content.article.16','Feed Display','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(115,52,248,249,5,'com_content.article.17','First Blog Post','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(116,52,250,251,5,'com_content.article.18','Second Blog Post','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(117,95,160,161,7,'com_content.article.19','Footer Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(118,54,287,288,4,'com_content.article.20','Fruit Shop','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(119,44,225,226,4,'com_content.article.21','Getting Help','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(120,44,227,228,4,'com_content.article.22','Getting Started','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(121,55,280,281,5,'com_content.article.23','Happy Orange Orchard','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(122,44,229,230,4,'com_content.article.24','Joomla!','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(123,108,255,256,6,'com_content.article.25','Koala','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(124,96,168,169,7,'com_content.article.26','Language Switcher','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(125,93,136,137,7,'com_content.article.27','Latest Articles Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(126,94,146,147,7,'com_content.article.28','Login Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(127,166,184,185,7,'com_content.article.29','Menu Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(128,93,138,139,7,'com_content.article.30','Most Read Content','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(129,93,140,141,7,'com_content.article.31','News Flash','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(130,44,231,232,4,'com_content.article.32','Parameters','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(131,108,257,258,6,'com_content.article.33','Phyllopteryx','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(132,109,267,268,6,'com_content.article.34','Pinnacles','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(133,44,233,234,4,'com_content.article.35','Professionals','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(134,95,162,163,7,'com_content.article.36','Random Image Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(135,93,142,143,7,'com_content.article.37','Related Items Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(136,44,235,236,4,'com_content.article.38','Sample Sites','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(137,46,119,120,6,'com_content.article.39','Search','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(138,96,170,171,7,'com_content.article.40','Search Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(139,50,209,210,6,'com_content.article.41','Search ','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(140,39,292,293,3,'com_content.article.42','Site Map','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(141,108,259,260,6,'com_content.article.43','Spotted Quoll','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(142,96,172,173,7,'com_content.article.44','Statistics Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(143,96,174,175,7,'com_content.article.45','Syndicate Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(144,50,211,212,6,'com_content.article.46','System','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(145,44,237,238,4,'com_content.article.47','The Joomla! Community','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(146,44,239,240,4,'com_content.article.48','The Joomla! Project','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(147,48,195,196,6,'com_content.article.49','Typography','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(148,44,241,242,4,'com_content.article.50','Upgraders','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(149,50,213,214,6,'com_content.article.51','User','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(150,46,121,122,6,'com_content.article.52','Users','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(151,44,243,244,4,'com_content.article.53','Using Joomla!','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(154,94,148,149,7,'com_content.article.56','Who\'s Online','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(155,108,261,262,6,'com_content.article.57','Wobbegone','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(156,55,282,283,5,'com_content.article.58','Wonderful Watermelon','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(157,96,176,177,7,'com_content.article.59','Wrapper Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(158,46,125,126,6,'com_content.article.60','News Feeds','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(159,166,186,187,7,'com_content.article.61','Breadcrumbs Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(160,50,215,216,6,'com_content.article.62','Content','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(162,109,269,270,6,'com_content.article.64','Blue Mountain Rain Forest','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(163,109,271,272,6,'com_content.article.65','Ormiston Pound','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(165,94,150,151,7,'com_content.article.66','Latest Users Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(166,47,183,188,6,'com_content.category.75','Navigation Modules','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(167,54,289,290,4,'com_content.category.76','Recipes','{"core.create":{"12":1,"10":1},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"12":1,"10":1}}'), -(168,34,106,107,3,'com_content.article.67','What\'s New in 1.5?','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(169,24,335,336,2,'com_users.category.77','Uncategorised',''), -(170,50,217,218,6,'com_content.article.68','Captcha','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(171,50,219,220,6,'com_content.article.69','Quick Icons','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(172,96,178,179,7,'com_content.article.70','Smart Search','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(173,1,420,421,1,'com_joomlaupdate','com_joomlaupdate','{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), +(34,8,105,108,2,'com_content.category.9','Uncategorised','{"core.create":{"10":0,"12":0}}'), +(35,3,7,8,2,'com_banners.category.10','Uncategorised','{}'), +(36,7,23,24,2,'com_contact.category.11','Uncategorised','{}'), +(37,19,321,322,2,'com_newsfeeds.category.12','Uncategorised','{}'), +(39,8,109,296,2,'com_content.category.14','Sample Data-Articles','{}'), +(40,3,9,10,2,'com_banners.category.15','Sample Data-Banners','{}'), +(41,7,25,86,2,'com_contact.category.16','Sample Data-Contact','{}'), +(42,19,323,324,2,'com_newsfeeds.category.17','Sample Data-Newsfeeds','{}'), +(44,39,110,245,3,'com_content.category.19','Joomla!','{"core.create":{"10":0,"12":0}}'), +(45,44,111,222,4,'com_content.category.20','Extensions','{}'), +(46,45,112,127,5,'com_content.category.21','Components','{}'), +(47,45,128,189,5,'com_content.category.22','Modules','{}'), +(48,45,190,199,5,'com_content.category.23','Templates','{}'), +(49,45,200,201,5,'com_content.category.24','Languages','{}'), +(50,45,202,221,5,'com_content.category.25','Plugins','{}'), +(51,39,246,277,3,'com_content.category.26','Park Site','{"core.create":{"10":0,"12":0}}'), +(52,51,247,252,4,'com_content.category.27','Park Blog','{}'), +(53,51,253,274,4,'com_content.category.28','Photo Gallery','{}'), +(54,39,278,291,3,'com_content.category.29','Fruit Shop Site','{}'), +(55,54,279,284,4,'com_content.category.30','Growers','{"core.create":{"12":0},"core.edit.own":{"10":1}}'), +(59,41,26,27,3,'com_contact.category.34','Park Site','{}'), +(60,41,28,85,3,'com_contact.category.35','Shop Site','{}'), +(61,60,29,30,4,'com_contact.category.36','Staff','{}'), +(62,60,31,84,4,'com_contact.category.37','Fruit Encyclopedia','{}'), +(63,62,32,33,5,'com_contact.category.38','A','{}'), +(64,62,34,35,5,'com_contact.category.39','B','{}'), +(65,62,36,37,5,'com_contact.category.40','C','{}'), +(66,62,38,39,5,'com_contact.category.41','D','{}'), +(67,62,40,41,5,'com_contact.category.42','E','{}'), +(68,62,42,43,5,'com_contact.category.43','F','{}'), +(69,62,44,45,5,'com_contact.category.44','G','{}'), +(70,62,46,47,5,'com_contact.category.45','H','{}'), +(71,62,48,49,5,'com_contact.category.46','I','{}'), +(72,62,50,51,5,'com_contact.category.47','J','{}'), +(73,62,52,53,5,'com_contact.category.48','K','{}'), +(74,62,54,55,5,'com_contact.category.49','L','{}'), +(75,62,56,57,5,'com_contact.category.50','M','{}'), +(76,62,58,59,5,'com_contact.category.51','N','{}'), +(77,62,60,61,5,'com_contact.category.52','O','{}'), +(78,62,62,63,5,'com_contact.category.53','P','{}'), +(79,62,64,65,5,'com_contact.category.54','Q','{}'), +(80,62,66,67,5,'com_contact.category.55','R','{}'), +(81,62,68,69,5,'com_contact.category.56','S','{}'), +(82,62,70,71,5,'com_contact.category.57','T','{}'), +(83,62,72,73,5,'com_contact.category.58','U','{}'), +(84,62,74,75,5,'com_contact.category.59','V','{}'), +(85,62,76,77,5,'com_contact.category.60','W','{}'), +(86,62,78,79,5,'com_contact.category.61','X','{}'), +(87,62,80,81,5,'com_contact.category.62','Y','{}'), +(88,62,82,83,5,'com_contact.category.63','Z','{}'), +(89,46,113,114,6,'com_content.article.1','Administrator Components','{}'), +(90,93,130,131,7,'com_content.article.2','Archive Module','{}'), +(91,93,132,133,7,'com_content.article.3','Article Categories Module','{}'), +(92,93,134,135,7,'com_content.article.4','Articles Category Module','{}'), +(93,47,129,144,6,'com_content.category.64','Content Modules','{}'), +(94,47,145,152,6,'com_content.category.65','User Modules','{}'), +(95,47,153,166,6,'com_content.category.66','Display Modules','{}'), +(96,47,167,180,6,'com_content.category.67','Utility Modules','{}'), +(98,48,191,192,6,'com_content.category.69','Beez3','{}'), +(100,48,193,194,6,'com_content.category.71','Milky Way','{}'), +(101,50,203,204,6,'com_content.article.5','Authentication','{}'), +(102,51,275,276,4,'com_content.article.6','Australian Parks ','{"core.edit":{"2":1}}'), +(103,95,154,155,7,'com_content.article.7','Banner Module','{}'), +(104,44,223,224,4,'com_content.article.8','Beginners','{}'), +(105,46,115,116,6,'com_content.article.9','Contact','{}'), +(106,46,117,118,6,'com_content.article.10','Content','{}'), +(107,109,265,266,6,'com_content.article.11','Cradle Mountain','{}'), +(108,53,254,263,5,'com_content.category.72','Animals','{}'), +(109,53,264,273,5,'com_content.category.73','Scenery','{}'), +(110,95,156,157,7,'com_content.article.12','Custom Module','{}'), +(111,54,285,286,4,'com_content.article.13','Directions','{}'), +(112,50,205,206,6,'com_content.article.14','Editors','{}'), +(113,50,207,208,6,'com_content.article.15','Editors-xtd','{}'), +(114,95,158,159,7,'com_content.article.16','Feed Display','{}'), +(115,52,248,249,5,'com_content.article.17','First Blog Post','{}'), +(116,52,250,251,5,'com_content.article.18','Second Blog Post','{}'), +(117,95,160,161,7,'com_content.article.19','Footer Module','{}'), +(118,54,287,288,4,'com_content.article.20','Fruit Shop','{}'), +(119,44,225,226,4,'com_content.article.21','Getting Help','{}'), +(120,44,227,228,4,'com_content.article.22','Getting Started','{}'), +(121,55,280,281,5,'com_content.article.23','Happy Orange Orchard','{}'), +(122,44,229,230,4,'com_content.article.24','Joomla!','{}'), +(123,108,255,256,6,'com_content.article.25','Koala','{}'), +(124,96,168,169,7,'com_content.article.26','Language Switcher','{}'), +(125,93,136,137,7,'com_content.article.27','Latest Articles Module','{}'), +(126,94,146,147,7,'com_content.article.28','Login Module','{}'), +(127,166,184,185,7,'com_content.article.29','Menu Module','{}'), +(128,93,138,139,7,'com_content.article.30','Most Read Content','{}'), +(129,93,140,141,7,'com_content.article.31','News Flash','{}'), +(130,44,231,232,4,'com_content.article.32','Parameters','{}'), +(131,108,257,258,6,'com_content.article.33','Phyllopteryx','{}'), +(132,109,267,268,6,'com_content.article.34','Pinnacles','{}'), +(133,44,233,234,4,'com_content.article.35','Professionals','{}'), +(134,95,162,163,7,'com_content.article.36','Random Image Module','{}'), +(135,93,142,143,7,'com_content.article.37','Related Items Module','{}'), +(136,44,235,236,4,'com_content.article.38','Sample Sites','{}'), +(137,46,119,120,6,'com_content.article.39','Search','{}'), +(138,96,170,171,7,'com_content.article.40','Search Module','{}'), +(139,50,209,210,6,'com_content.article.41','Search ','{}'), +(140,39,292,293,3,'com_content.article.42','Site Map','{}'), +(141,108,259,260,6,'com_content.article.43','Spotted Quoll','{}'), +(142,96,172,173,7,'com_content.article.44','Statistics Module','{}'), +(143,96,174,175,7,'com_content.article.45','Syndicate Module','{}'), +(144,50,211,212,6,'com_content.article.46','System','{}'), +(145,44,237,238,4,'com_content.article.47','The Joomla! Community','{}'), +(146,44,239,240,4,'com_content.article.48','The Joomla! Project','{}'), +(147,48,195,196,6,'com_content.article.49','Typography','{}'), +(148,44,241,242,4,'com_content.article.50','Upgraders','{}'), +(149,50,213,214,6,'com_content.article.51','User','{}'), +(150,46,121,122,6,'com_content.article.52','Users','{}'), +(151,44,243,244,4,'com_content.article.53','Using Joomla!','{}'), +(154,94,148,149,7,'com_content.article.56','Who\'s Online','{}'), +(155,108,261,262,6,'com_content.article.57','Wobbegone','{}'), +(156,55,282,283,5,'com_content.article.58','Wonderful Watermelon','{}'), +(157,96,176,177,7,'com_content.article.59','Wrapper Module','{}'), +(158,46,125,126,6,'com_content.article.60','News Feeds','{}'), +(159,166,186,187,7,'com_content.article.61','Breadcrumbs Module','{}'), +(160,50,215,216,6,'com_content.article.62','Content','{}'), +(162,109,269,270,6,'com_content.article.64','Blue Mountain Rain Forest','{}'), +(163,109,271,272,6,'com_content.article.65','Ormiston Pound','{}'), +(165,94,150,151,7,'com_content.article.66','Latest Users Module','{}'), +(166,47,183,188,6,'com_content.category.75','Navigation Modules','{}'), +(167,54,289,290,4,'com_content.category.76','Recipes','{"core.create":{"12":1,"10":1},"core.edit.own":{"12":1,"10":1}}'), +(168,34,106,107,3,'com_content.article.67','What\'s New in 1.5?','{}'), +(169,24,335,336,2,'com_users.category.77','Uncategorised','{}'), +(170,50,217,218,6,'com_content.article.68','Captcha','{}'), +(171,50,219,220,6,'com_content.article.69','Quick Icons','{}'), +(172,96,178,179,7,'com_content.article.70','Smart Search','{}'), +(173,1,420,421,1,'com_joomlaupdate','com_joomlaupdate','{}'), (174,48,197,198,6,'com_content.category.78','Protostar','{"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (175,1,422,423,1,'com_tags','com_tags','{"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (176,1,424,425,1,'com_contenthistory','com_contenthistory','{}'), @@ -394,7 +394,7 @@ INSERT INTO "#__menu" VALUES (243,'parks','Parks Home','parks-home','','parks-home','index.php?option=com_content&view=article&id=6','component',1,1,1,22,0,'1970-01-01 00:00:00',0,1,'',114,'{"show_noauth":"","show_title":"0","link_titles":"","show_intro":"","show_category":"0","link_category":"0","show_parent_category":"","link_parent_category":"","show_author":"0","link_author":"","show_create_date":"0","show_modify_date":"0","show_publish_date":"0","show_item_navigation":"0","show_icons":"","show_print_icon":"0","show_email_icon":"0","show_hits":"0","robots":"","rights":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","secure":0}',233,234,0,'en-GB',0), (244,'parks','Image Gallery','image-gallery','','image-gallery','index.php?option=com_content&view=categories&id=28','component',1,1,1,22,0,'1970-01-01 00:00:00',0,1,'',114,'{"show_base_description":"1","categories_description":"","maxLevelcat":"","show_empty_categories_cat":"","show_subcat_desc_cat":"","show_cat_num_articles_cat":"","drill_down_layout":"1","show_category_title":"","show_description":"1","show_description_image":"1","maxLevel":"-1","show_empty_categories":"","show_subcat_desc":"","show_cat_num_articles":"","num_leading_articles":"1","num_intro_articles":"4","num_columns":"2","num_links":"4","multi_column_order":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_pagination_results":"","show_pagination_limit":"","filter_field":"","show_headings":"","list_show_date":"","date_format":"","list_show_hits":"","list_show_author":"","show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","link_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_readmore":"","show_icons":"","show_print_icon":"","show_email_icon":"","show_hits":"","show_noauth":"","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","page_title":"","show_page_heading":0,"page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',239,244,0,'en-GB',0), (251,'aboutjoomla','Contact Categories','contact-categories','','using-joomla/extensions/components/contact-component/contact-categories','index.php?option=com_contact&view=categories&id=16','component',1,270,5,8,0,'1970-01-01 00:00:00',0,1,'',0,'{"show_base_description":"","categories_description":"","maxLevel":"-1","show_empty_categories":"","show_description":"","show_description_image":"","show_cat_num_articles":"","display_num":"","show_headings":"","filter_field":"","show_pagination":"","show_noauth":"","presentation_style":"sliders","show_name":"","show_position":"","show_email":"","show_street_address":"","show_suburb":"","show_state":"","show_postcode":"","show_country":"","show_telephone":"","show_mobile":"","show_fax":"","show_webpage":"","show_misc":"","show_image":"","allow_vcard":"","show_articles":"","show_links":"1","linka_name":"","linkb_name":"","linkc_name":"","linkd_name":"","linke_name":"","show_email_form":"","show_email_copy":"","banned_email":"","banned_subject":"","banned_text":"","validate_session":"","custom_reply":"","redirect":"","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',75,76,0,'*',0), -(252,'aboutjoomla','News Feed Categories','new-feed-categories','','using-joomla/extensions/components/news-feeds-component/new-feed-categories','index.php?option=com_newsfeeds&view=categories&id=0','component',1,267,5,17,0,'1970-01-01 00:00:00',0,1,'',0,'{"show_base_description":"1","categories_description":"Because this links to the root category the "uncategorised" category is displayed. ","maxLevel":"-1","show_empty_categories":"1","show_description":"1","show_description_image":"1","show_cat_num_articles":"1","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',93,94,0,'*',0), +(252,'aboutjoomla','News Feed Categories','new-feed-categories','','using-joomla/extensions/components/news-feeds-component/new-feed-categories','index.php?option=com_newsfeeds&view=categories&id=0','component',1,267,5,17,0,'1970-01-01 00:00:00',0,1,'',0,'{"show_base_description":"1","categories_description":"Because this links to the root category the \\"uncategorised\\" category is displayed. ","maxLevel":"-1","show_empty_categories":"1","show_description":"1","show_description_image":"1","show_cat_num_articles":"1","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',93,94,0,'*',0), (253,'aboutjoomla','News Feed Category','news-feed-category','','using-joomla/extensions/components/news-feeds-component/news-feed-category','index.php?option=com_newsfeeds&view=category&id=17','component',1,267,5,17,0,'1970-01-01 00:00:00',0,1,'',0,'{"maxLevel":"-1","show_empty_categories":"","show_description":"","show_description_image":"","show_cat_num_articles":"","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',97,98,0,'*',0), (254,'aboutjoomla','Single News Feed','single-news-feed','','using-joomla/extensions/components/news-feeds-component/single-news-feed','index.php?option=com_newsfeeds&view=newsfeed&id=4','component',1,267,5,17,0,'1970-01-01 00:00:00',0,1,'',0,'{"show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',95,96,0,'*',0), (255,'aboutjoomla','Search','search','','using-joomla/extensions/components/search-component/search','index.php?option=com_search&view=search','component',1,276,5,19,0,'1970-01-01 00:00:00',0,1,'',0,'{"search_areas":"1","show_date":"1","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',115,116,0,'*',0), diff --git a/installation/sql/postgresql/sample_testing.sql b/installation/sql/postgresql/sample_testing.sql index a9790dccf1e6b..20ecaf731c4ad 100644 --- a/installation/sql/postgresql/sample_testing.sql +++ b/installation/sql/postgresql/sample_testing.sql @@ -14,161 +14,161 @@ TRUNCATE "#__viewlevels" RESTART IDENTITY; INSERT INTO "#__assets" VALUES (1,0,1,431,0,'root.1','Root Asset','{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (2,1,2,3,1,'com_admin','com_admin','{}'), -(3,1,4,11,1,'com_banners','com_banners','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(3,1,4,11,1,'com_banners','com_banners','{"core.admin":{"7":1},"core.manage":{"6":1}}'), (4,1,12,13,1,'com_cache','com_cache','{"core.admin":{"7":1},"core.manage":{"7":1}}'), (5,1,14,15,1,'com_checkin','com_checkin','{"core.admin":{"7":1},"core.manage":{"7":1}}'), (6,1,16,17,1,'com_config','com_config','{}'), -(7,1,18,87,1,'com_contact','com_contact','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(8,1,88,299,1,'com_content','com_content','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}'), +(7,1,18,87,1,'com_contact','com_contact','{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(8,1,88,299,1,'com_content','com_content','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}'), (9,1,300,301,1,'com_cpanel','com_cpanel','{}'), -(10,1,302,303,1,'com_installer','com_installer','{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), -(11,1,304,305,1,'com_languages','com_languages','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(10,1,302,303,1,'com_installer','com_installer','{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}'), +(11,1,304,305,1,'com_languages','com_languages','{"core.admin":{"7":1}}'), (12,1,306,307,1,'com_login','com_login','{}'), (13,1,308,309,1,'com_mailto','com_mailto','{}'), (14,1,310,311,1,'com_massmail','com_massmail','{}'), -(15,1,312,313,1,'com_media','com_media','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1},"core.edit":[],"core.edit.state":[]}'), -(16,1,314,315,1,'com_menus','com_menus','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(15,1,312,313,1,'com_media','com_media','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}'), +(16,1,314,315,1,'com_menus','com_menus','{"core.admin":{"7":1}}'), (17,1,37,38,1,'com_messages','com_messages','{"core.admin":{"7":1},"core.manage":{"7":1}}'), -(18,1,318,319,1,'com_modules','com_modules','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(19,1,320,327,1,'com_newsfeeds','com_newsfeeds','{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(20,1,328,329,1,'com_plugins','com_plugins','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(21,1,330,331,1,'com_redirect','com_redirect','{"core.admin":{"7":1},"core.manage":[]}'), +(18,1,318,319,1,'com_modules','com_modules','{"core.admin":{"7":1}}'), +(19,1,320,327,1,'com_newsfeeds','com_newsfeeds','{"core.admin":{"7":1},"core.manage":{"6":1}}'), +(20,1,328,329,1,'com_plugins','com_plugins','{"core.admin":{"7":1}}'), +(21,1,330,331,1,'com_redirect','com_redirect','{"core.admin":{"7":1}}'), (22,1,332,333,1,'com_search','com_search','{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(23,1,334,335,1,'com_templates','com_templates','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(24,1,336,339,1,'com_users','com_users','{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), +(23,1,334,335,1,'com_templates','com_templates','{"core.admin":{"7":1}}'), +(24,1,336,339,1,'com_users','com_users','{"core.admin":{"7":1}}'), (26,1,358,359,1,'com_wrapper','com_wrapper','{}'), (33,1,420,421,1,'com_finder','com_finder','{"core.admin":{"7":1},"core.manage":{"6":1}}'), -(34,8,105,108,2,'com_content.category.9','Uncategorised','{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(35,3,7,8,2,'com_banners.category.10','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(36,7,23,24,2,'com_contact.category.11','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(37,19,323,324,2,'com_newsfeeds.category.12','Uncategorised','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(39,8,109,298,2,'com_content.category.14','Sample Data-Articles','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(40,3,9,10,2,'com_banners.category.15','Sample Data-Banners','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(41,7,25,86,2,'com_contact.category.16','Sample Data-Contact','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(42,19,325,326,2,'com_newsfeeds.category.17','Sample Data-Newsfeeds','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(44,39,110,247,3,'com_content.category.19','Joomla!','{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(45,44,111,224,4,'com_content.category.20','Extensions','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(46,45,112,127,5,'com_content.category.21','Components','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(47,45,128,189,5,'com_content.category.22','Modules','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(48,45,190,201,5,'com_content.category.23','Templates','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(49,45,202,203,5,'com_content.category.24','Languages','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(50,45,204,223,5,'com_content.category.25','Plugins','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(51,39,248,279,3,'com_content.category.26','Park Site','{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(52,51,249,254,4,'com_content.category.27','Park Blog','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(53,51,255,276,4,'com_content.category.28','Photo Gallery','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(54,39,280,293,3,'com_content.category.29','Fruit Shop Site','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(55,54,281,286,4,'com_content.category.30','Growers','{"core.create":{"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"10":1}}'), -(59,41,26,27,3,'com_contact.category.34','Park Site','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(60,41,28,85,3,'com_contact.category.35','Shop Site','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(61,60,29,30,4,'com_contact.category.36','Staff','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(62,60,31,84,4,'com_contact.category.37','Fruit Encyclopedia','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(63,62,32,33,5,'com_contact.category.38','A','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(64,62,34,35,5,'com_contact.category.39','B','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(65,62,36,37,5,'com_contact.category.40','C','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(66,62,38,39,5,'com_contact.category.41','D','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(67,62,40,41,5,'com_contact.category.42','E','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(68,62,42,43,5,'com_contact.category.43','F','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(69,62,44,45,5,'com_contact.category.44','G','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(70,62,46,47,5,'com_contact.category.45','H','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(71,62,48,49,5,'com_contact.category.46','I','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(72,62,50,51,5,'com_contact.category.47','J','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(73,62,52,53,5,'com_contact.category.48','K','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(74,62,54,55,5,'com_contact.category.49','L','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(75,62,56,57,5,'com_contact.category.50','M','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(76,62,58,59,5,'com_contact.category.51','N','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(77,62,60,61,5,'com_contact.category.52','O','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(78,62,62,63,5,'com_contact.category.53','P','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(79,62,64,65,5,'com_contact.category.54','Q','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(80,62,66,67,5,'com_contact.category.55','R','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(81,62,68,69,5,'com_contact.category.56','S','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(82,62,70,71,5,'com_contact.category.57','T','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(83,62,72,73,5,'com_contact.category.58','U','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(84,62,74,75,5,'com_contact.category.59','V','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(85,62,76,77,5,'com_contact.category.60','W','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(86,62,78,79,5,'com_contact.category.61','X','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(87,62,80,81,5,'com_contact.category.62','Y','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(88,62,82,83,5,'com_contact.category.63','Z','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(89,46,113,114,6,'com_content.article.1','Administrator Components','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(90,93,130,131,7,'com_content.article.2','Archive Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(91,93,132,133,7,'com_content.article.3','Article Categories Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(92,93,134,135,7,'com_content.article.4','Articles Category Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(93,47,129,144,6,'com_content.category.64','Content Modules','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(94,47,145,152,6,'com_content.category.65','User Modules','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(95,47,153,166,6,'com_content.category.66','Display Modules','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(96,47,167,180,6,'com_content.category.67','Utility Modules','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(97,48,191,192,6,'com_content.category.68','Atomic','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(98,48,193,194,6,'com_content.category.69','Beez 20','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(99,48,195,196,6,'com_content.category.70','Beez5','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(100,48,197,198,6,'com_content.category.71','Milky Way','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(101,50,205,206,6,'com_content.article.5','Authentication','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(102,51,277,278,4,'com_content.article.6','Australian Parks ','{"core.delete":[],"core.edit":{"2":1},"core.edit.state":[]}'), -(103,95,154,155,7,'com_content.article.7','Banner Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(104,44,225,226,4,'com_content.article.8','Beginners','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(105,46,115,116,6,'com_content.article.9','Contact','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(106,46,117,118,6,'com_content.article.10','Content','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(107,109,267,268,6,'com_content.article.11','Cradle Mountain','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(108,53,256,265,5,'com_content.category.72','Animals','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(109,53,266,275,5,'com_content.category.73','Scenery','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(110,95,156,157,7,'com_content.article.12','Custom Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(111,54,287,288,4,'com_content.article.13','Directions','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(112,50,207,208,6,'com_content.article.14','Editors','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(113,50,209,210,6,'com_content.article.15','Editors-xtd','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(114,95,158,159,7,'com_content.article.16','Feed Display','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(115,52,250,251,5,'com_content.article.17','First Blog Post','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(116,52,252,253,5,'com_content.article.18','Second Blog Post','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(117,95,160,161,7,'com_content.article.19','Footer Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(118,54,289,290,4,'com_content.article.20','Fruit Shop','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(119,44,227,228,4,'com_content.article.21','Getting Help','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(120,44,229,230,4,'com_content.article.22','Getting Started','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(121,55,282,283,5,'com_content.article.23','Happy Orange Orchard','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(122,44,231,232,4,'com_content.article.24','Joomla! Testing','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(123,108,257,258,6,'com_content.article.25','Koala','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(124,96,168,169,7,'com_content.article.26','Language Switcher','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(125,93,136,137,7,'com_content.article.27','Latest Articles Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(126,94,146,147,7,'com_content.article.28','Login Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(127,166,184,185,7,'com_content.article.29','Menu Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(128,93,138,139,7,'com_content.article.30','Most Read Content','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(129,93,140,141,7,'com_content.article.31','News Flash','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(130,44,233,234,4,'com_content.article.32','Parameters','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(131,108,259,260,6,'com_content.article.33','Phyllopteryx','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(132,109,269,270,6,'com_content.article.34','Pinnacles','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(133,44,235,236,4,'com_content.article.35','Professionals','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(134,95,162,163,7,'com_content.article.36','Random Image Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(135,93,142,143,7,'com_content.article.37','Related Items Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(136,44,237,238,4,'com_content.article.38','Sample Sites','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(137,46,119,120,6,'com_content.article.39','Search','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(138,96,170,171,7,'com_content.article.40','Search Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(139,50,211,212,6,'com_content.article.41','Search ','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(140,39,294,295,3,'com_content.article.42','Site Map','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(141,108,261,262,6,'com_content.article.43','Spotted Quoll','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(142,96,172,173,7,'com_content.article.44','Statistics Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(143,96,174,175,7,'com_content.article.45','Syndicate Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(144,50,213,214,6,'com_content.article.46','System','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(145,44,239,240,4,'com_content.article.47','The Joomla! Community','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(146,44,241,242,4,'com_content.article.48','The Joomla! Project','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(147,48,199,200,6,'com_content.article.49','Typography','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(148,44,243,244,4,'com_content.article.50','Upgraders','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(149,50,215,216,6,'com_content.article.51','User','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(150,46,121,122,6,'com_content.article.52','Users','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(151,44,245,246,4,'com_content.article.53','Using Joomla!','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(154,94,148,149,7,'com_content.article.56','Who''s Online','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(155,108,263,264,6,'com_content.article.57','Wobbegone','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(156,55,284,285,5,'com_content.article.58','Wonderful Watermelon','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(157,96,176,177,7,'com_content.article.59','Wrapper Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(158,46,125,126,6,'com_content.article.60','News Feeds','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(159,166,186,187,7,'com_content.article.61','Breadcrumbs Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(160,50,217,218,6,'com_content.article.62','Content','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(162,109,271,272,6,'com_content.article.64','Blue Mountain Rain Forest','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(163,109,273,274,6,'com_content.article.65','Ormiston Pound','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(165,94,150,151,7,'com_content.article.66','Latest Users Module','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(166,47,183,188,6,'com_content.category.75','Navigation Modules','{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}'), -(167,54,291,292,4,'com_content.category.76','Recipes','{"core.create":{"12":1,"10":1},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"12":1,"10":1}}'), -(168,34,106,107,3,'com_content.article.67','What''s New in 1.5?','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(169,24,337,338,2,'com_users.category.77','Uncategorised',''), -(170,50,219,220,6,'com_content.article.68','Captcha','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(171,50,221,222,6,'com_content.article.69','Quick Icons','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(172,96,178,179,7,'com_content.article.70','Smart Search','{"core.delete":[],"core.edit":[],"core.edit.state":[]}'), -(173,1,422,423,1,'com_joomlaupdate','com_joomlaupdate','{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}'), +(34,8,105,108,2,'com_content.category.9','Uncategorised','{"core.create":{"10":0,"12":0}}'), +(35,3,7,8,2,'com_banners.category.10','Uncategorised','{}'), +(36,7,23,24,2,'com_contact.category.11','Uncategorised','{}'), +(37,19,323,324,2,'com_newsfeeds.category.12','Uncategorised','{}'), +(39,8,109,298,2,'com_content.category.14','Sample Data-Articles','{}'), +(40,3,9,10,2,'com_banners.category.15','Sample Data-Banners','{}'), +(41,7,25,86,2,'com_contact.category.16','Sample Data-Contact','{}'), +(42,19,325,326,2,'com_newsfeeds.category.17','Sample Data-Newsfeeds','{}'), +(44,39,110,247,3,'com_content.category.19','Joomla!','{"core.create":{"10":0,"12":0}}'), +(45,44,111,224,4,'com_content.category.20','Extensions','{}'), +(46,45,112,127,5,'com_content.category.21','Components','{}'), +(47,45,128,189,5,'com_content.category.22','Modules','{}'), +(48,45,190,201,5,'com_content.category.23','Templates','{}'), +(49,45,202,203,5,'com_content.category.24','Languages','{}'), +(50,45,204,223,5,'com_content.category.25','Plugins','{}'), +(51,39,248,279,3,'com_content.category.26','Park Site','{"core.create":{"10":0,"12":0}}'), +(52,51,249,254,4,'com_content.category.27','Park Blog','{}'), +(53,51,255,276,4,'com_content.category.28','Photo Gallery','{}'), +(54,39,280,293,3,'com_content.category.29','Fruit Shop Site','{}'), +(55,54,281,286,4,'com_content.category.30','Growers','{"core.create":{"12":0},"core.edit.own":{"10":1}}'), +(59,41,26,27,3,'com_contact.category.34','Park Site','{}'), +(60,41,28,85,3,'com_contact.category.35','Shop Site','{}'), +(61,60,29,30,4,'com_contact.category.36','Staff','{}'), +(62,60,31,84,4,'com_contact.category.37','Fruit Encyclopedia','{}'), +(63,62,32,33,5,'com_contact.category.38','A','{}'), +(64,62,34,35,5,'com_contact.category.39','B','{}'), +(65,62,36,37,5,'com_contact.category.40','C','{}'), +(66,62,38,39,5,'com_contact.category.41','D','{}'), +(67,62,40,41,5,'com_contact.category.42','E','{}'), +(68,62,42,43,5,'com_contact.category.43','F','{}'), +(69,62,44,45,5,'com_contact.category.44','G','{}'), +(70,62,46,47,5,'com_contact.category.45','H','{}'), +(71,62,48,49,5,'com_contact.category.46','I','{}'), +(72,62,50,51,5,'com_contact.category.47','J','{}'), +(73,62,52,53,5,'com_contact.category.48','K','{}'), +(74,62,54,55,5,'com_contact.category.49','L','{}'), +(75,62,56,57,5,'com_contact.category.50','M','{}'), +(76,62,58,59,5,'com_contact.category.51','N','{}'), +(77,62,60,61,5,'com_contact.category.52','O','{}'), +(78,62,62,63,5,'com_contact.category.53','P','{}'), +(79,62,64,65,5,'com_contact.category.54','Q','{}'), +(80,62,66,67,5,'com_contact.category.55','R','{}'), +(81,62,68,69,5,'com_contact.category.56','S','{}'), +(82,62,70,71,5,'com_contact.category.57','T','{}'), +(83,62,72,73,5,'com_contact.category.58','U','{}'), +(84,62,74,75,5,'com_contact.category.59','V','{}'), +(85,62,76,77,5,'com_contact.category.60','W','{}'), +(86,62,78,79,5,'com_contact.category.61','X','{}'), +(87,62,80,81,5,'com_contact.category.62','Y','{}'), +(88,62,82,83,5,'com_contact.category.63','Z','{}'), +(89,46,113,114,6,'com_content.article.1','Administrator Components','{}'), +(90,93,130,131,7,'com_content.article.2','Archive Module','{}'), +(91,93,132,133,7,'com_content.article.3','Article Categories Module','{}'), +(92,93,134,135,7,'com_content.article.4','Articles Category Module','{}'), +(93,47,129,144,6,'com_content.category.64','Content Modules','{}'), +(94,47,145,152,6,'com_content.category.65','User Modules','{}'), +(95,47,153,166,6,'com_content.category.66','Display Modules','{}'), +(96,47,167,180,6,'com_content.category.67','Utility Modules','{}'), +(97,48,191,192,6,'com_content.category.68','Atomic','{}'), +(98,48,193,194,6,'com_content.category.69','Beez 20','{}'), +(99,48,195,196,6,'com_content.category.70','Beez5','{}'), +(100,48,197,198,6,'com_content.category.71','Milky Way','{}'), +(101,50,205,206,6,'com_content.article.5','Authentication','{}'), +(102,51,277,278,4,'com_content.article.6','Australian Parks ','{"core.edit":{"2":1}}'), +(103,95,154,155,7,'com_content.article.7','Banner Module','{}'), +(104,44,225,226,4,'com_content.article.8','Beginners','{}'), +(105,46,115,116,6,'com_content.article.9','Contact','{}'), +(106,46,117,118,6,'com_content.article.10','Content','{}'), +(107,109,267,268,6,'com_content.article.11','Cradle Mountain','{}'), +(108,53,256,265,5,'com_content.category.72','Animals','{}'), +(109,53,266,275,5,'com_content.category.73','Scenery','{}'), +(110,95,156,157,7,'com_content.article.12','Custom Module','{}'), +(111,54,287,288,4,'com_content.article.13','Directions','{}'), +(112,50,207,208,6,'com_content.article.14','Editors','{}'), +(113,50,209,210,6,'com_content.article.15','Editors-xtd','{}'), +(114,95,158,159,7,'com_content.article.16','Feed Display','{}'), +(115,52,250,251,5,'com_content.article.17','First Blog Post','{}'), +(116,52,252,253,5,'com_content.article.18','Second Blog Post','{}'), +(117,95,160,161,7,'com_content.article.19','Footer Module','{}'), +(118,54,289,290,4,'com_content.article.20','Fruit Shop','{}'), +(119,44,227,228,4,'com_content.article.21','Getting Help','{}'), +(120,44,229,230,4,'com_content.article.22','Getting Started','{}'), +(121,55,282,283,5,'com_content.article.23','Happy Orange Orchard','{}'), +(122,44,231,232,4,'com_content.article.24','Joomla! Testing','{}'), +(123,108,257,258,6,'com_content.article.25','Koala','{}'), +(124,96,168,169,7,'com_content.article.26','Language Switcher','{}'), +(125,93,136,137,7,'com_content.article.27','Latest Articles Module','{}'), +(126,94,146,147,7,'com_content.article.28','Login Module','{}'), +(127,166,184,185,7,'com_content.article.29','Menu Module','{}'), +(128,93,138,139,7,'com_content.article.30','Most Read Content','{}'), +(129,93,140,141,7,'com_content.article.31','News Flash','{}'), +(130,44,233,234,4,'com_content.article.32','Parameters','{}'), +(131,108,259,260,6,'com_content.article.33','Phyllopteryx','{}'), +(132,109,269,270,6,'com_content.article.34','Pinnacles','{}'), +(133,44,235,236,4,'com_content.article.35','Professionals','{}'), +(134,95,162,163,7,'com_content.article.36','Random Image Module','{}'), +(135,93,142,143,7,'com_content.article.37','Related Items Module','{}'), +(136,44,237,238,4,'com_content.article.38','Sample Sites','{}'), +(137,46,119,120,6,'com_content.article.39','Search','{}'), +(138,96,170,171,7,'com_content.article.40','Search Module','{}'), +(139,50,211,212,6,'com_content.article.41','Search ','{}'), +(140,39,294,295,3,'com_content.article.42','Site Map','{}'), +(141,108,261,262,6,'com_content.article.43','Spotted Quoll','{}'), +(142,96,172,173,7,'com_content.article.44','Statistics Module','{}'), +(143,96,174,175,7,'com_content.article.45','Syndicate Module','{}'), +(144,50,213,214,6,'com_content.article.46','System','{}'), +(145,44,239,240,4,'com_content.article.47','The Joomla! Community','{}'), +(146,44,241,242,4,'com_content.article.48','The Joomla! Project','{}'), +(147,48,199,200,6,'com_content.article.49','Typography','{}'), +(148,44,243,244,4,'com_content.article.50','Upgraders','{}'), +(149,50,215,216,6,'com_content.article.51','User','{}'), +(150,46,121,122,6,'com_content.article.52','Users','{}'), +(151,44,245,246,4,'com_content.article.53','Using Joomla!','{}'), +(154,94,148,149,7,'com_content.article.56','Who''s Online','{}'), +(155,108,263,264,6,'com_content.article.57','Wobbegone','{}'), +(156,55,284,285,5,'com_content.article.58','Wonderful Watermelon','{}'), +(157,96,176,177,7,'com_content.article.59','Wrapper Module','{}'), +(158,46,125,126,6,'com_content.article.60','News Feeds','{}'), +(159,166,186,187,7,'com_content.article.61','Breadcrumbs Module','{}'), +(160,50,217,218,6,'com_content.article.62','Content','{}'), +(162,109,271,272,6,'com_content.article.64','Blue Mountain Rain Forest','{}'), +(163,109,273,274,6,'com_content.article.65','Ormiston Pound','{}'), +(165,94,150,151,7,'com_content.article.66','Latest Users Module','{}'), +(166,47,183,188,6,'com_content.category.75','Navigation Modules','{}'), +(167,54,291,292,4,'com_content.category.76','Recipes','{"core.create":{"12":1,"10":1},"core.edit.own":{"12":1,"10":1}}'), +(168,34,106,107,3,'com_content.article.67','What''s New in 1.5?','{}'), +(169,24,337,338,2,'com_users.category.77','Uncategorised','{}'), +(170,50,219,220,6,'com_content.article.68','Captcha','{}'), +(171,50,221,222,6,'com_content.article.69','Quick Icons','{}'), +(172,96,178,179,7,'com_content.article.70','Smart Search','{}'), +(173,1,422,423,1,'com_joomlaupdate','com_joomlaupdate','{}'), (174,1,424,425,1,'com_tags','com_tags','{"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}'), (175,1,426,427,1,'com_contenthistory','com_contenthistory','{}'), (176,1,428,429,1,'com_ajax','com_ajax','{}'), @@ -408,7 +408,7 @@ INSERT INTO "#__menu" VALUES (243,'parks','Parks Home','parks-home','','parks-home','index.php?option=com_content&view=article&id=6','component',1,1,1,22,0,'1970-01-01 00:00:00',0,1,'',114,'{"show_noauth":"","show_title":"0","link_titles":"","show_intro":"","show_category":"0","link_category":"0","show_parent_category":"","link_parent_category":"","show_author":"0","link_author":"","show_create_date":"0","show_modify_date":"0","show_publish_date":"0","show_item_navigation":"0","show_icons":"","show_print_icon":"0","show_email_icon":"0","show_hits":"0","robots":"","rights":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","secure":0}',97,98,0,'en-GB',0), (244,'parks','Image Gallery','image-gallery','','image-gallery','index.php?option=com_content&view=categories&id=28','component',1,1,1,22,0,'1970-01-01 00:00:00',0,1,'',114,'{"show_base_description":"1","categories_description":"","maxLevelcat":"","show_empty_categories_cat":"","show_subcat_desc_cat":"","show_cat_num_articles_cat":"","drill_down_layout":"1","show_category_title":"","show_description":"1","show_description_image":"1","maxLevel":"-1","show_empty_categories":"","show_subcat_desc":"","show_cat_num_articles":"","num_leading_articles":"1","num_intro_articles":"4","num_columns":"2","num_links":"4","multi_column_order":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_pagination_results":"","show_pagination_limit":"","filter_field":"","show_headings":"","list_show_date":"","date_format":"","list_show_hits":"","list_show_author":"","show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","link_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_readmore":"","show_icons":"","show_print_icon":"","show_email_icon":"","show_hits":"","show_noauth":"","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","page_title":"","show_page_heading":0,"page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',103,108,0,'en-GB',0), (251,'frontendviews','Contact Categories','contact-categories','','contact-categories','index.php?option=com_contact&view=categories&id=16','component',1,1,1,8,0,'1970-01-01 00:00:00',0,1,'',0,'{"show_base_description":"","categories_description":"","maxLevel":"-1","show_empty_categories":"","show_description":"","show_description_image":"","show_cat_num_articles":"","display_num":"","show_headings":"","filter_field":"","show_pagination":"","show_noauth":"","presentation_style":"sliders","show_name":"","show_position":"","show_email":"","show_street_address":"","show_suburb":"","show_state":"","show_postcode":"","show_country":"","show_telephone":"","show_mobile":"","show_fax":"","show_webpage":"","show_misc":"","show_image":"","allow_vcard":"","show_articles":"","show_links":"1","linka_name":"","linkb_name":"","linkc_name":"","linkd_name":"","linke_name":"","show_email_form":"","show_email_copy":"","banned_email":"","banned_subject":"","banned_text":"","validate_session":"","custom_reply":"","redirect":"","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',157,158,0,'*',0), -(252,'frontendviews','News Feed Categories','new-feed-categories','','new-feed-categories','index.php?option=com_newsfeeds&view=categories&id=0','component',1,1,1,17,0,'1970-01-01 00:00:00',0,1,'',0,'{"show_base_description":"1","categories_description":"Because this links to the root category the "uncategorised" category is displayed. ","maxLevel":"-1","show_empty_categories":"1","show_description":"1","show_description_image":"1","show_cat_num_articles":"1","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',175,176,0,'*',0), +(252,'frontendviews','News Feed Categories','new-feed-categories','','new-feed-categories','index.php?option=com_newsfeeds&view=categories&id=0','component',1,1,1,17,0,'1970-01-01 00:00:00',0,1,'',0,'{"show_base_description":"1","categories_description":"Because this links to the root category the \\"uncategorised\\" category is displayed. ","maxLevel":"-1","show_empty_categories":"1","show_description":"1","show_description_image":"1","show_cat_num_articles":"1","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',175,176,0,'*',0), (253,'frontendviews','News Feed Category','news-feed-category','','news-feed-category','index.php?option=com_newsfeeds&view=category&id=17','component',1,1,1,17,0,'1970-01-01 00:00:00',0,1,'',0,'{"maxLevel":"-1","show_empty_categories":"","show_description":"","show_description_image":"","show_cat_num_articles":"","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',179,180,0,'*',0), (254,'frontendviews','Single News Feed','single-news-feed','','single-news-feed','index.php?option=com_newsfeeds&view=newsfeed&id=4','component',1,1,1,17,0,'1970-01-01 00:00:00',0,1,'',0,'{"show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',177,178,0,'*',0), (255,'frontendviews','Search','search','','search','index.php?option=com_search&view=search','component',1,1,1,19,0,'1970-01-01 00:00:00',0,1,'',0,'{"search_areas":"1","show_date":"1","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',197,198,0,'*',0), diff --git a/installation/sql/sqlazure/joomla.sql b/installation/sql/sqlazure/joomla.sql index 336a90f8d0a8c..be35af447da34 100644 --- a/installation/sql/sqlazure/joomla.sql +++ b/installation/sql/sqlazure/joomla.sql @@ -38,7 +38,7 @@ SELECT 1, 0, 0, 103, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1 UNION ALL SELECT 2, 1, 1, 2, 1, 'com_admin', 'com_admin', '{}' UNION ALL -SELECT 3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL SELECT 4, 1, 7, 8, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}' UNION ALL @@ -46,15 +46,15 @@ SELECT 5, 1, 9, 10, 1, 'com_checkin', 'com_checkin', '{"core.admin":{"7":1},"cor UNION ALL SELECT 6, 1, 11, 12, 1, 'com_config', 'com_config', '{}' UNION ALL -SELECT 7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 8, 1, 17, 20, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}' +SELECT 8, 1, 17, 20, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}' UNION ALL SELECT 9, 1, 21, 22, 1, 'com_cpanel', 'com_cpanel', '{}' UNION ALL -SELECT 10, 1, 23, 24, 1, 'com_installer', 'com_installer', '{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}' +SELECT 10, 1, 23, 24, 1, 'com_installer', 'com_installer', '{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}' UNION ALL -SELECT 11, 1, 25, 26, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 11, 1, 25, 26, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1}}' UNION ALL SELECT 12, 1, 27, 28, 1, 'com_login', 'com_login', '{}' UNION ALL @@ -64,41 +64,41 @@ SELECT 14, 1, 31, 32, 1, 'com_massmail', 'com_massmail', '{}' UNION ALL SELECT 15, 1, 33, 34, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}' UNION ALL -SELECT 16, 1, 35, 38, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 16, 1, 35, 38, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1}}' UNION ALL SELECT 17, 1, 39, 40, 1, 'com_messages', 'com_messages', '{"core.admin":{"7":1},"core.manage":{"7":1}}' UNION ALL -SELECT 18, 1, 41, 72, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 18, 1, 41, 72, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1}}' UNION ALL -SELECT 19, 1, 73, 76, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 19, 1, 73, 76, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 20, 1, 77, 78, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1},"core.manage":[],"core.edit":[],"core.edit.state":[]}' +SELECT 20, 1, 77, 78, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1}}' UNION ALL -SELECT 21, 1, 79, 80, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1},"core.manage":[]}' +SELECT 21, 1, 79, 80, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1}}' UNION ALL SELECT 22, 1, 81, 82, 1, 'com_search', 'com_search', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 23, 1, 83, 84, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 23, 1, 83, 84, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1}}' UNION ALL -SELECT 24, 1, 85, 88, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 24, 1, 85, 88, 1, 'com_users', 'com_users', '{"core.admin":{"7":1}}' UNION ALL SELECT 26, 1, 89, 90, 1, 'com_wrapper', 'com_wrapper', '{}' UNION ALL -SELECT 27, 8, 18, 19, 2, 'com_content.category.2', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 27, 8, 18, 19, 2, 'com_content.category.2', 'Uncategorised', '{}' UNION ALL -SELECT 28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{}' UNION ALL -SELECT 29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{}' UNION ALL -SELECT 30, 19, 74, 75, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 30, 19, 74, 75, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{}' UNION ALL -SELECT 32, 24, 86, 87, 1, 'com_users.category.7', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 32, 24, 86, 87, 2, 'com_users.category.7', 'Uncategorised', '{}' UNION ALL SELECT 33, 1, 91, 92, 1, 'com_finder', 'com_finder', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 34, 1, 93, 94, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}' +SELECT 34, 1, 93, 94, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{}' UNION ALL -SELECT 35, 1, 95, 96, 1, 'com_tags', 'com_tags', '{"core.admin":[],"core.manage":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}' +SELECT 35, 1, 95, 96, 1, 'com_tags', 'com_tags', '{}' UNION ALL SELECT 36, 1, 97, 98, 1, 'com_contenthistory', 'com_contenthistory', '{}' UNION ALL @@ -106,35 +106,35 @@ SELECT 37, 1, 99, 100, 1, 'com_ajax', 'com_ajax', '{}' UNION ALL SELECT 38, 1, 101, 102, 1, 'com_postinstall', 'com_postinstall', '{}' UNION ALL -SELECT 39, 18, 42, 43, 2, 'com_modules.module.1', 'Main Menu', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 39, 18, 42, 43, 2, 'com_modules.module.1', 'Main Menu', '{}' UNION ALL -SELECT 40, 18, 44, 45, 2, 'com_modules.module.2', 'Login', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 40, 18, 44, 45, 2, 'com_modules.module.2', 'Login', '{}' UNION ALL -SELECT 41, 18, 46, 47, 2, 'com_modules.module.3', 'Popular Articles', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 41, 18, 46, 47, 2, 'com_modules.module.3', 'Popular Articles', '{}' UNION ALL -SELECT 42, 18, 48, 49, 2, 'com_modules.module.4', 'Recently Added Articles', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 42, 18, 48, 49, 2, 'com_modules.module.4', 'Recently Added Articles', '{}' UNION ALL -SELECT 43, 18, 50, 51, 2, 'com_modules.module.8', 'Toolbar', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 43, 18, 50, 51, 2, 'com_modules.module.8', 'Toolbar', '{}' UNION ALL -SELECT 44, 18, 52, 53, 2, 'com_modules.module.9', 'Quick Icons', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 44, 18, 52, 53, 2, 'com_modules.module.9', 'Quick Icons', '{}' UNION ALL -SELECT 45, 18, 54, 55, 2, 'com_modules.module.10', 'Logged-in Users', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 45, 18, 54, 55, 2, 'com_modules.module.10', 'Logged-in Users', '{}' UNION ALL -SELECT 46, 18, 56, 57, 2, 'com_modules.module.12', 'Admin Menu', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 46, 18, 56, 57, 2, 'com_modules.module.12', 'Admin Menu', '{}' UNION ALL -SELECT 47, 18, 58, 59, 2, 'com_modules.module.13', 'Admin Submenu', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 47, 18, 58, 59, 2, 'com_modules.module.13', 'Admin Submenu', '{}' UNION ALL -SELECT 48, 18, 60, 61, 2, 'com_modules.module.14', 'User Status', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 48, 18, 60, 61, 2, 'com_modules.module.14', 'User Status', '{}' UNION ALL -SELECT 49, 18, 62, 63, 2, 'com_modules.module.15', 'Title', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 49, 18, 62, 63, 2, 'com_modules.module.15', 'Title', '{}' UNION ALL -SELECT 50, 18, 64, 65, 2, 'com_modules.module.16', 'Login Form', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 50, 18, 64, 65, 2, 'com_modules.module.16', 'Login Form', '{}' UNION ALL -SELECT 51, 18, 66, 67, 2, 'com_modules.module.17', 'Breadcrumbs', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 51, 18, 66, 67, 2, 'com_modules.module.17', 'Breadcrumbs', '{}' UNION ALL -SELECT 52, 18, 68, 69, 2, 'com_modules.module.79', 'Multilanguage status', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 52, 18, 68, 69, 2, 'com_modules.module.79', 'Multilanguage status', '{}' UNION ALL -SELECT 53, 18, 70, 71, 2, 'com_modules.module.86', 'Joomla Version', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 53, 18, 70, 71, 2, 'com_modules.module.86', 'Joomla Version', '{}' UNION ALL SELECT 54, 16, 36, 37, 2, 'com_menus.menu.1', 'Main Menu', '{}'; @@ -702,7 +702,7 @@ CREATE TABLE [#__extensions]( [element] [nvarchar](100) NOT NULL, [folder] [nvarchar](100) NOT NULL, [client_id] [smallint] NOT NULL, - [enabled] [smallint] NOT NULL DEFAULT 1, + [enabled] [smallint] NOT NULL DEFAULT 0, [access] [int] NOT NULL DEFAULT 1, [protected] [smallint] NOT NULL DEFAULT 0, [manifest_cache] [nvarchar](max) NOT NULL, @@ -782,7 +782,7 @@ SELECT 18, 'com_plugins', 'component', 'com_plugins', '', 1, 1, 1, 1, '', '', '' UNION ALL SELECT 19, 'com_search', 'component', 'com_search', '', 1, 1, 1, 0, '', '{"enabled":"0","show_date":"1"}', '', '', 0, '1900-01-01 00:00:00', 0, 0 UNION ALL -SELECT 20, 'com_templates', 'component', 'com_templates', '', 1, 1, 1, 1, '', '{"template_positions_display":"0","upload_limit":"10","image_formats":"gif,bmp,jpg,jpeg,png","source_formats":"txt,less,ini,xml,js,php,css","font_formats":"woff,ttf,otf","compressed_formats":"zip"}', '', '', 0, '1900-01-01 00:00:00', 0, 0 +SELECT 20, 'com_templates', 'component', 'com_templates', '', 1, 1, 1, 1, '', '{"template_positions_display":"0","upload_limit":"10","image_formats":"gif,bmp,jpg,jpeg,png","source_formats":"txt,less,ini,xml,js,php,css,scss,sass","font_formats":"woff,ttf,otf","compressed_formats":"zip"}', '', '', 0, '1900-01-01 00:00:00', 0, 0 UNION ALL SELECT 22, 'com_content', 'component', 'com_content', '', 1, 1, 0, 1, '', '{"article_layout":"_:default","show_title":"1","link_titles":"1","show_intro":"1","show_category":"1","link_category":"1","show_parent_category":"0","link_parent_category":"0","show_author":"1","link_author":"0","show_create_date":"0","show_modify_date":"0","show_publish_date":"1","show_item_navigation":"1","show_vote":"0","show_readmore":"1","show_readmore_title":"1","readmore_limit":"100","show_icons":"1","show_print_icon":"1","show_email_icon":"1","show_hits":"1","show_noauth":"0","show_publishing_options":"1","show_article_options":"1","save_history":"1","history_limit":10,"show_urls_images_frontend":"0","show_urls_images_backend":"1","targeta":0,"targetb":0,"targetc":0,"float_intro":"left","float_fulltext":"left","category_layout":"_:blog","show_category_title":"0","show_description":"0","show_description_image":"0","maxLevel":"1","show_empty_categories":"0","show_no_articles":"1","show_subcat_desc":"1","show_cat_num_articles":"0","show_base_description":"1","maxLevelcat":"-1","show_empty_categories_cat":"0","show_subcat_desc_cat":"1","show_cat_num_articles_cat":"1","num_leading_articles":"1","num_intro_articles":"4","num_columns":"2","num_links":"4","multi_column_order":"0","show_subcategory_content":"0","show_pagination_limit":"1","filter_field":"hide","show_headings":"1","list_show_date":"0","date_format":"","list_show_hits":"1","list_show_author":"1","orderby_pri":"order","orderby_sec":"rdate","order_date":"published","show_pagination":"2","show_pagination_results":"1","show_feed_link":"1","feed_summary":"0"}', '', '', 0, '1900-01-01 00:00:00', 0, 0 UNION ALL @@ -790,7 +790,7 @@ SELECT 23, 'com_config', 'component', 'com_config', '', 1, 1, 0, 1, '', '{"filte UNION ALL SELECT 24, 'com_redirect', 'component', 'com_redirect', '', 1, 1, 0, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0 UNION ALL -SELECT 25, 'com_users', 'component', 'com_users', '', 1, 1, 0, 1, '', '{"allowUserRegistration":"0","new_usertype":"2","guest_usergroup":"9","sendpassword":"1","useractivation":"1","mail_to_admin":"0","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","minimum_length":"4","minimum_integers":"0","minimum_symbols":"0","minimum_uppercase":"0","save_history":"1","history_limit":5,"mailSubjectPrefix":"","mailBodySuffix":""}', '', '', 0, '1900-01-01 00:00:00', 0, 0 +SELECT 25, 'com_users', 'component', 'com_users', '', 1, 1, 0, 1, '', '{"allowUserRegistration":"0","new_usertype":"2","guest_usergroup":"9","sendpassword":"1","useractivation":"2","mail_to_admin":"1","captcha":"","frontend_userparams":"1","site_language":"0","change_login_name":"0","reset_count":"10","reset_time":"1","minimum_length":"4","minimum_integers":"0","minimum_symbols":"0","minimum_uppercase":"0","save_history":"1","history_limit":5,"mailSubjectPrefix":"","mailBodySuffix":""}', '', '', 0, '1900-01-01 00:00:00', 0, 0 UNION ALL SELECT 27, 'com_finder', 'component', 'com_finder', '', 1, 1, 0, 0, '', '{"show_description":"1","description_length":255,"allow_empty_query":"0","show_url":"1","show_advanced":"1","expand_advanced":"0","show_date_filters":"0","highlight_terms":"1","opensearch_name":"","opensearch_description":"","batch_size":"50","memory_table_limit":30000,"title_multiplier":"1.7","text_multiplier":"0.7","meta_multiplier":"1.2","path_multiplier":"2.0","misc_multiplier":"0.3","stemmer":"snowball"}', '', '', 0, '1900-01-01 00:00:00', 0, 0 UNION ALL @@ -2468,7 +2468,9 @@ SELECT 700, 'COM_CPANEL_WELCOME_BEGINNERS_TITLE', 'COM_CPANEL_WELCOME_BEGINNERS_ UNION ALL SELECT 700, 'COM_CPANEL_MSG_STATS_COLLECTION_TITLE', 'COM_CPANEL_MSG_STATS_COLLECTION_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/statscollection.php', 'admin_postinstall_statscollection_condition', '3.5.0', 1 UNION ALL -SELECT 700, 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_BODY', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_ACTION', 'plg_system_updatenotification', 1, 'action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_condition', '3.6.3', 1; +SELECT 700, 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_BODY', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_ACTION', 'plg_system_updatenotification', 1, 'action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_condition', '3.6.3', 1 +UNION ALL +SELECT 700, 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_TITLE', 'COM_CPANEL_MSG_JOOMLA40_PRE_CHECKS_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/joomla40checks.php', 'admin_postinstall_joomla40checks_condition', '3.7.0', 1; /****** Object: Table [#__redirect_links] ******/ SET QUOTED_IDENTIFIER ON; diff --git a/installation/sql/sqlazure/sample_blog.sql b/installation/sql/sqlazure/sample_blog.sql index 46f48c2598c8b..d7919e195fea3 100644 --- a/installation/sql/sqlazure/sample_blog.sql +++ b/installation/sql/sqlazure/sample_blog.sql @@ -12,7 +12,7 @@ SELECT 1, 0, 0, 93, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1} UNION ALL SELECT 2, 1, 1, 2, 1, 'com_admin', 'com_admin', '{}' UNION ALL -SELECT 3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL SELECT 4, 1, 7, 8, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}' UNION ALL @@ -20,15 +20,15 @@ SELECT 5, 1, 9, 10, 1, 'com_checkin', 'com_checkin', '{"core.admin":{"7":1},"cor UNION ALL SELECT 6, 1, 11, 12, 1, 'com_config', 'com_config', '{}' UNION ALL -SELECT 7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 8, 1, 17, 34, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}' +SELECT 8, 1, 17, 34, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}' UNION ALL SELECT 9, 1, 35, 36, 1, 'com_cpanel', 'com_cpanel', '{}' UNION ALL -SELECT 10, 1, 37, 38, 1, 'com_installer', 'com_installer', '{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}' +SELECT 10, 1, 37, 38, 1, 'com_installer', 'com_installer', '{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}' UNION ALL -SELECT 11, 1, 39, 40, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 11, 1, 39, 40, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1}}' UNION ALL SELECT 12, 1, 41, 42, 1, 'com_login', 'com_login', '{}' UNION ALL @@ -38,53 +38,53 @@ SELECT 14, 1, 45, 46, 1, 'com_massmail', 'com_massmail', '{}' UNION ALL SELECT 15, 1, 47, 48, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}' UNION ALL -SELECT 16, 1, 49, 50, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 16, 1, 49, 50, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1}}' UNION ALL SELECT 17, 1, 51, 52, 1, 'com_messages', 'com_messages', '{"core.admin":{"7":1},"core.manage":{"7":1}}' UNION ALL -SELECT 18, 1, 53, 54, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 18, 1, 53, 54, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1}}' UNION ALL -SELECT 19, 1, 55, 58, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 19, 1, 55, 58, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 20, 1, 59, 60, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1},"core.manage":[],"core.edit":[],"core.edit.state":[]}' +SELECT 20, 1, 59, 60, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1}}' UNION ALL -SELECT 21, 1, 61, 62, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1},"core.manage":[]}' +SELECT 21, 1, 61, 62, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1}}' UNION ALL SELECT 22, 1, 63, 64, 1, 'com_search', 'com_search', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 23, 1, 65, 66, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 23, 1, 65, 66, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1}}' UNION ALL -SELECT 24, 1, 67, 70, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.own":{"6":1},"core.edit.state":[]}' +SELECT 24, 1, 67, 70, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.edit.own":{"6":1}}' UNION ALL SELECT 26, 1, 77, 78, 1, 'com_wrapper', 'com_wrapper', '{}' UNION ALL -SELECT 27, 8, 18, 23, 2, 'com_content.category.2', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 27, 8, 18, 23, 2, 'com_content.category.2', 'Uncategorised', '{}' UNION ALL -SELECT 28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 28, 3, 4, 5, 2, 'com_banners.category.3', 'Uncategorised', '{}' UNION ALL -SELECT 29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{}' UNION ALL -SELECT 30, 19, 56, 57, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 30, 19, 56, 57, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{}' UNION ALL -SELECT 32, 24, 68, 69, 1, 'com_users.category.7', 'Uncategorised', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 32, 24, 68, 69, 2, 'com_users.category.7', 'Uncategorised', '{}' UNION ALL SELECT 33, 1, 79, 80, 1, 'com_finder', 'com_finder', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 35, 8, 24, 33, 2, 'com_content.category.9', 'Blog', '{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 35, 8, 24, 33, 2, 'com_content.category.9', 'Blog', '{}' UNION ALL -SELECT 36, 27, 19, 20, 3, 'com_content.article.1', 'About', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 36, 27, 19, 20, 3, 'com_content.article.1', 'About', '{}' UNION ALL -SELECT 37, 27, 21, 22, 3, 'com_content.article.2', 'Working on Your Site', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 37, 27, 21, 22, 3, 'com_content.article.2', 'Working on Your Site', '{}' UNION ALL -SELECT 38, 35, 25, 26, 3, 'com_content.article.3', 'Welcome to your blog', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 38, 35, 25, 26, 3, 'com_content.article.3', 'Welcome to your blog', '{}' UNION ALL -SELECT 39, 35, 27, 28, 3, 'com_content.article.4', 'About your home page', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 39, 35, 27, 28, 3, 'com_content.article.4', 'About your home page', '{}' UNION ALL -SELECT 40, 35, 29, 30, 3, 'com_content.article.5', 'Your Modules', '{"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 40, 35, 29, 30, 3, 'com_content.article.5', 'Your Modules', '{}' UNION ALL SELECT 41, 1, 81, 82, 1, 'com_users.category.10', 'Uncategorised', '{}' UNION ALL -SELECT 42, 1, 83, 84, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}' +SELECT 42, 1, 83, 84, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{}' UNION ALL SELECT 43, 35, 31, 32, 3, 'com_content.article.6', 'Your Template', '{"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}' UNION ALL diff --git a/installation/sql/sqlazure/sample_brochure.sql b/installation/sql/sqlazure/sample_brochure.sql index 2c4293efda43a..d77e2c1f5ddec 100644 --- a/installation/sql/sqlazure/sample_brochure.sql +++ b/installation/sql/sqlazure/sample_brochure.sql @@ -9,7 +9,7 @@ SELECT 1, 0, 1, 85, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1} UNION ALL SELECT 2, 1, 1, 2, 1, 'com_admin', 'com_admin', '{}' UNION ALL -SELECT 3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL SELECT 4, 1, 7, 8, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}' UNION ALL @@ -17,15 +17,15 @@ SELECT 5, 1, 9, 10, 1, 'com_checkin', 'com_checkin', '{"core.admin":{"7":1},"cor UNION ALL SELECT 6, 1, 11, 12, 1, 'com_config', 'com_config', '{}' UNION ALL -SELECT 7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 8, 1, 17, 34, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}' +SELECT 8, 1, 17, 34, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}' UNION ALL SELECT 9, 1, 35, 36, 1, 'com_cpanel', 'com_cpanel', '{}' UNION ALL -SELECT 10, 1, 37, 38, 1, 'com_installer', 'com_installer', '{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}' +SELECT 10, 1, 37, 38, 1, 'com_installer', 'com_installer', '{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}' UNION ALL -SELECT 11, 1, 39, 40, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 11, 1, 39, 40, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1}}' UNION ALL SELECT 12, 1, 41, 42, 1, 'com_login', 'com_login', '{}' UNION ALL @@ -35,23 +35,23 @@ SELECT 14, 1, 45, 46, 1, 'com_massmail', 'com_massmail', '{}' UNION ALL SELECT 15, 1, 47, 48, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}' UNION ALL -SELECT 16, 1, 49, 50, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 16, 1, 49, 50, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1}}' UNION ALL SELECT 17, 1, 51, 52, 1, 'com_messages', 'com_messages', '{"core.admin":{"7":1},"core.manage":{"7":1}}' UNION ALL -SELECT 18, 1, 53, 54, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 18, 1, 53, 54, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1}}' UNION ALL -SELECT 19, 1, 55, 58, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 19, 1, 55, 58, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 20, 1, 59, 60, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1},"core.manage":[],"core.edit":[],"core.edit.state":[]}' +SELECT 20, 1, 59, 60, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1}}' UNION ALL -SELECT 21, 1, 61, 62, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1},"core.manage":[]}' +SELECT 21, 1, 61, 62, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1}}' UNION ALL SELECT 22, 1, 63, 64, 1, 'com_search', 'com_search', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 23, 1, 65, 66, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 23, 1, 65, 66, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1}}' UNION ALL -SELECT 24, 1, 67, 70, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"6":1}}' +SELECT 24, 1, 67, 70, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.edit.own":{"6":1}}' UNION ALL SELECT 26, 1, 75, 76, 1, 'com_wrapper', 'com_wrapper', '{}' UNION ALL @@ -63,7 +63,7 @@ SELECT 29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncaterised', '{}' UNION ALL SELECT 30, 19, 56, 57, 2, 'com_newsfeeds.category.5', 'Uncaterised', '{}' UNION ALL -SELECT 32, 24, 68, 69, 1, 'com_users.notes.category.7', 'Uncaterised', '{}' +SELECT 32, 24, 68, 69, 2, 'com_users.category.7', 'Uncaterised', '{}' UNION ALL SELECT 33, 1, 77, 78, 1, 'com_finder', 'com_finder', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL @@ -108,7 +108,7 @@ SELECT 5, 30, 1, 7, 8, 1, 'uncategorised', 'com_newsfeeds', 'Uncategorised', 'un UNION ALL SELECT 7, 32, 1, 11, 12, 1, 'uncategorised', 'com_users.notes', 'Uncategorised', 'uncategorised', '', '', 1, 0, '1900-01-01 00:00:00', 1, '{"target":"","image":""}', '', '', '{"page_title":"","author":"","robots":""}', 42, '2010-06-28 13:28:33', 0, '1900-01-01 00:00:00', 0, '*' UNION ALL -SELECT 8, 36, 1, 13, 14, 1, 'news', 'com_content', 'News', 'news', '', '

    This is the latest new from us.

    You can edit this description in the Content Category Manager.

    This will show the most recent article. You can easily change it to show more if you wish.

    The module on the left shows a list of older articles.

    ', 1, 0, '1900-01-01 00:00:00', 1, '{"category_layout":"","image":""}', '', '', '{"author":"","robots":""}', 42, '2012-01-04 03:09:08', 42, '2012-01-04 04:32:05', 0, '*'; +SELECT 8, 36, 1, 13, 14, 1, 'news', 'com_content', 'News', 'news', '', '

    This is the latest news from us.

    You can edit this description in the Content Category Manager.

    This will show the most recent article. You can easily change it to show more if you wish.

    The module on the left shows a list of older articles.

    ', 1, 0, '1900-01-01 00:00:00', 1, '{"category_layout":"","image":""}', '', '', '{"author":"","robots":""}', 42, '2012-01-04 03:09:08', 42, '2012-01-04 04:32:05', 0, '*'; SET IDENTITY_INSERT [#__categories] OFF; @@ -321,14 +321,12 @@ TRUNCATE TABLE [#__template_styles]; SET IDENTITY_INSERT [#__template_styles] ON; INSERT INTO [#__template_styles] ([id], [template], [client_id], [home], [title], [params]) -SELECT 2, 'bluestork', 1, 1, 'Bluestork - Default', '{"useRoundedCorners":"1","showSiteName":"0"}' -UNION ALL -SELECT 3, 'atomic', 0, 0, 'Atomic - Default', '{}' -UNION ALL -SELECT 4, 'beez3', 0, 0, 'Beez3 - Default', '{"wrapperSmall":"53","wrapperLarge":"72","lo":"images/joomla_black.png","sitetitle":"Joomla!","sitedescription":"Open Source Content Management","navposition":"left","templatecolor":"personal","html5":"0"}' +SELECT 4, 'beez3', 0, 0, 'Beez3 - Default', '{"wrapperSmall":"53","wrapperLarge":"72","logo":"images\\/joomla_black.png","sitetitle":"Joomla!","sitedescription":"Open Source Content Management","navposition":"left","templatecolor":"personal","html5":"0"}' UNION ALL SELECT 5, 'hathor', 1, 0, 'Hathor - Default', '{"showSiteName":"0","colourChoice":"","boldText":"0"}' UNION ALL -SELECT 6, 'beez5', 0, 1, 'Your Basic Template', '{"wrapperSmall":53,"wrapperLarge":72,"lo":"","sitetitle":"Your site name or image","sitedescription":"Your tag line for the top of every page","navposition":"left","html5":1}'; +SELECT 7, 'protostar', 0, '1', 'My Default Style (Protostar)', '{"templateColor":"#696969","templateBackgroundColor":"#E3E3E3","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}' +UNION ALL +SELECT 8, 'isis', 1, '1', 'isis - Default', '{"templateColor":"#000000","logoFile":"","admin_menus":1,"displayHeader":1,"statusFixed":1,"stickyToolbar":1}'; SET IDENTITY_INSERT [#__template_styles] OFF; diff --git a/installation/sql/sqlazure/sample_data.sql b/installation/sql/sqlazure/sample_data.sql index d03d339ff33bb..934b9c2126fc1 100644 --- a/installation/sql/sqlazure/sample_data.sql +++ b/installation/sql/sqlazure/sample_data.sql @@ -11,7 +11,7 @@ SELECT 1, 0, 0, 77, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1} UNION ALL SELECT 2, 1, 1, 2, 1, 'com_admin', 'com_admin', '{}' UNION ALL -SELECT 3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL SELECT 4, 1, 7, 8, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}' UNION ALL @@ -19,15 +19,15 @@ SELECT 5, 1, 9, 10, 1, 'com_checkin', 'com_checkin', '{"core.admin":{"7":1},"cor UNION ALL SELECT 6, 1, 11, 12, 1, 'com_config', 'com_config', '{}' UNION ALL -SELECT 7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 7, 1, 13, 16, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 8, 1, 17, 22, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}' +SELECT 8, 1, 17, 22, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}' UNION ALL SELECT 9, 1, 23, 24, 1, 'com_cpanel', 'com_cpanel', '{}' UNION ALL -SELECT 10, 1, 25, 26, 1, 'com_installer', 'com_installer', '{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}' +SELECT 10, 1, 25, 26, 1, 'com_installer', 'com_installer', '{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}' UNION ALL -SELECT 11, 1, 27, 28, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 11, 1, 27, 28, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1}}' UNION ALL SELECT 12, 1, 29, 30, 1, 'com_login', 'com_login', '{}' UNION ALL @@ -37,23 +37,23 @@ SELECT 14, 1, 33, 34, 1, 'com_massmail', 'com_massmail', '{}' UNION ALL SELECT 15, 1, 35, 36, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}' UNION ALL -SELECT 16, 1, 37, 38, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 16, 1, 37, 38, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1}}' UNION ALL SELECT 17, 1, 39, 40, 1, 'com_messages', 'com_messages', '{"core.admin":{"7":1},"core.manage":{"7":1}}' UNION ALL -SELECT 18, 1, 41, 42, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 18, 1, 41, 42, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1}}' UNION ALL -SELECT 19, 1, 43, 46, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}' +SELECT 19, 1, 43, 46, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 20, 1, 47, 48, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1},"core.manage":[],"core.edit":[],"core.edit.state":[]}' +SELECT 20, 1, 47, 48, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1}}' UNION ALL -SELECT 21, 1, 49, 50, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1},"core.manage":[]}' +SELECT 21, 1, 49, 50, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1}}' UNION ALL SELECT 22, 1, 51, 52, 1, 'com_search', 'com_search', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 23, 1, 53, 54, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 23, 1, 53, 54, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1}}' UNION ALL -SELECT 24, 1, 55, 58, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 24, 1, 55, 58, 1, 'com_users', 'com_users', '{"core.admin":{"7":1}}' UNION ALL SELECT 26, 1, 63, 64, 1, 'com_wrapper', 'com_wrapper', '{}' UNION ALL @@ -65,11 +65,11 @@ SELECT 29, 7, 14, 15, 2, 'com_contact.category.4', 'Uncategorised', '{}' UNION ALL SELECT 30, 19, 44, 45, 2, 'com_newsfeeds.category.5', 'Uncategorised', '{}' UNION ALL -SELECT 32, 24, 56, 57, 1, 'com_users.category.7', 'Uncategorised', '{}' +SELECT 32, 24, 56, 57, 2, 'com_users.category.7', 'Uncategorised', '{}' UNION ALL SELECT 33, 1, 65, 66, 1, 'com_finder', 'com_finder', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 34, 1, 67, 68, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{"core.admin":[],"core.manage":[],"core.delete":[],"core.edit.state":[]}' +SELECT 34, 1, 67, 68, 1, 'com_joomlaupdate', 'com_joomlaupdate', '{}' UNION ALL SELECT 35, 27, 19, 20, 3, 'com_content.article.1', 'Getting Started', '{"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1}}' UNION ALL diff --git a/installation/sql/sqlazure/sample_learn.sql b/installation/sql/sqlazure/sample_learn.sql index 9c3e36f49039e..ece61bc997c4f 100644 --- a/installation/sql/sqlazure/sample_learn.sql +++ b/installation/sql/sqlazure/sample_learn.sql @@ -11,11 +11,11 @@ TRUNCATE TABLE [#__viewlevels]; SET IDENTITY_INSERT [#__assets] ON; INSERT INTO [#__assets] ([id], [parent_id], [lft], [rgt], [level], [name], [title], [rules]) -SELECT 1, 0, 1, 430, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.offline":[],"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}' +SELECT 1, 0, 1, 430, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}' UNION ALL SELECT 2, 1, 2, 3, 1, 'com_admin', 'com_admin', '{}' UNION ALL -SELECT 3, 1, 4, 11, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 3, 1, 4, 11, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL SELECT 4, 1, 12, 13, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}' UNION ALL @@ -23,15 +23,15 @@ SELECT 5, 1, 14, 15, 1, 'com_checkin', 'com_checkin', '{"core.admin":{"7":1},"co UNION ALL SELECT 6, 1, 16, 17, 1, 'com_config', 'com_config', '{}' UNION ALL -SELECT 7, 1, 18, 87, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 7, 1, 18, 87, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 8, 1, 88, 297, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}' +SELECT 8, 1, 88, 297, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}' UNION ALL SELECT 9, 1, 298, 299, 1, 'com_cpanel', 'com_cpanel', '{}' UNION ALL -SELECT 10, 1, 300, 301, 1, 'com_installer', 'com_installer', '{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}' +SELECT 10, 1, 300, 301, 1, 'com_installer', 'com_installer', '{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}' UNION ALL -SELECT 11, 1, 302, 303, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 11, 1, 302, 303, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1}}' UNION ALL SELECT 12, 1, 304, 305, 1, 'com_login', 'com_login', '{}' UNION ALL @@ -39,31 +39,31 @@ SELECT 13, 1, 306, 307, 1, 'com_mailto', 'com_mailto', '{}' UNION ALL SELECT 14, 1, 308, 309, 1, 'com_massmail', 'com_massmail', '{}' UNION ALL -SELECT 15, 1, 310, 311, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1},"core.edit":[],"core.edit.state":[]}' +SELECT 15, 1, 310, 311, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}' UNION ALL -SELECT 16, 1, 312, 313, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 16, 1, 312, 313, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1}}' UNION ALL SELECT 17, 1, 37, 38, 1, 'com_messages', 'com_messages', '{"core.admin":{"7":1},"core.manage":{"7":1}}' UNION ALL -SELECT 18, 1, 316, 317, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 18, 1, 316, 317, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1}}' UNION ALL -SELECT 19, 1, 318, 325, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 19, 1, 318, 325, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 20, 1, 326, 327, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 20, 1, 326, 327, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1}}' UNION ALL -SELECT 21, 1, 328, 329, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1},"core.manage":[]}' +SELECT 21, 1, 328, 329, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1}}' UNION ALL SELECT 22, 1, 330, 331, 1, 'com_search', 'com_search', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 23, 1, 332, 333, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 23, 1, 332, 333, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1}}' UNION ALL -SELECT 24, 1, 334, 337, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 24, 1, 334, 337, 1, 'com_users', 'com_users', '{"core.admin":{"7":1}}' UNION ALL SELECT 26, 1, 356, 357, 1, 'com_wrapper', 'com_wrapper', '{}' UNION ALL SELECT 33, 1, 418, 419, 1, 'com_finder', 'com_finder', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 34, 8, 105, 108, 2, 'com_content.category.9', 'Uncategorised', '{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 34, 8, 105, 108, 2, 'com_content.category.9', 'Uncategorised', '{"core.create":{"10":0,"12":0}}' UNION ALL SELECT 35, 3, 7, 8, 2, 'com_banners.category.10', 'Uncategorised', '{}' UNION ALL @@ -79,7 +79,7 @@ SELECT 41, 7, 25, 86, 2, 'com_contact.category.16', 'Sample Data-Contact', '{}' UNION ALL SELECT 42, 19, 323, 324, 2, 'com_newsfeeds.category.17', 'Sample Data-Newsfeeds', '{}' UNION ALL -SELECT 44, 39, 110, 245, 3, 'com_content.category.19', 'Joomla!', '{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 44, 39, 110, 245, 3, 'com_content.category.19', 'Joomla!', '{"core.create":{"10":0,"12":0}}' UNION ALL SELECT 45, 44, 111, 222, 4, 'com_content.category.20', 'Extensions', '{}' UNION ALL @@ -93,7 +93,7 @@ SELECT 49, 45, 200, 201, 5, 'com_content.category.24', 'Languages', '{}' UNION ALL SELECT 50, 45, 202, 221, 5, 'com_content.category.25', 'Plugins', '{}' UNION ALL -SELECT 51, 39, 246, 277, 3, 'com_content.category.26', 'Park Site', '{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 51, 39, 246, 277, 3, 'com_content.category.26', 'Park Site', '{"core.create":{"10":0,"12":0}}' UNION ALL SELECT 52, 51, 247, 252, 4, 'com_content.category.27', 'Park Blog', '{}' UNION ALL @@ -101,7 +101,7 @@ SELECT 53, 51, 253, 274, 4, 'com_content.category.28', 'Photo Gallery', '{}' UNION ALL SELECT 54, 39, 278, 291, 3, 'com_content.category.29', 'Fruit Shop Site', '{}' UNION ALL -SELECT 55, 54, 279, 284, 4, 'com_content.category.30', 'Growers', '{"core.create":{"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"10":1}}' +SELECT 55, 54, 279, 284, 4, 'com_content.category.30', 'Growers', '{"core.create":{"12":0},"core.edit.own":{"10":1}}' UNION ALL SELECT 59, 41, 26, 27, 3, 'com_contact.category.34', 'Park Site', '{}' UNION ALL @@ -185,7 +185,7 @@ SELECT 100, 48, 193, 194, 6, 'com_content.category.71', 'Milky Way', '{}' UNION ALL SELECT 101, 50, 203, 204, 6, 'com_content.article.5', 'Authentication', '{}' UNION ALL -SELECT 102, 51, 275, 276, 4, 'com_content.article.6', 'Australian Parks ', '{"core.delete":[],"core.edit":{"2":1},"core.edit.state":[]}' +SELECT 102, 51, 275, 276, 4, 'com_content.article.6', 'Australian Parks ', '{"core.edit":{"2":1}}' UNION ALL SELECT 103, 95, 154, 155, 7, 'com_content.article.7', 'Banner Module', '{}' UNION ALL @@ -307,11 +307,11 @@ SELECT 165, 94, 150, 151, 7, 'com_content.article.66', 'Latest Users Module', '{ UNION ALL SELECT 166, 47, 183, 188, 6, 'com_content.category.75', 'Navigation Modules', '{}' UNION ALL -SELECT 167, 54, 289, 290, 4, 'com_content.category.76', 'Recipes', '{"core.create":{"12":1,"10":1},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"12":1,"10":1}}' +SELECT 167, 54, 289, 290, 4, 'com_content.category.76', 'Recipes', '{"core.create":{"12":1,"10":1},"core.edit.own":{"12":1,"10":1}}' UNION ALL SELECT 168, 34, 106, 107, 3, 'com_content.article.67', 'What''s New in 1.5?', '{}' UNION ALL -SELECT 169, 24, 335, 336, 2, 'com_users.category.77', 'Uncategorised', '' +SELECT 169, 24, 335, 336, 2, 'com_users.category.77', 'Uncategorised', '{}' UNION ALL SELECT 170, 50, 217, 218, 6, 'com_content.article.68', 'Captcha', '{}' UNION ALL @@ -712,7 +712,7 @@ SELECT 244, 'parks', 'Image Gallery', 'image-gallery', '', 'image-gallery', 'ind UNION ALL SELECT 251, 'aboutjoomla', 'Contact Categories', 'contact-categories', '', 'using-joomla/extensions/components/contact-component/contact-categories', 'index.php?option=com_contact&view=categories&id=16', 'component', 1, 270, 5, 8, 0, '1900-01-01 00:00:01', 0, 1, '', 0, '{"show_base_description":"","categories_description":"","maxLevel":"-1","show_empty_categories":"","show_description":"","show_description_image":"","show_cat_num_articles":"","display_num":"","show_headings":"","filter_field":"","show_pagination":"","show_noauth":"","presentation_style":"sliders","show_name":"","show_position":"","show_email":"","show_street_address":"","show_suburb":"","show_state":"","show_postcode":"","show_country":"","show_telephone":"","show_mobile":"","show_fax":"","show_webpage":"","show_misc":"","show_image":"","allow_vcard":"","show_articles":"","show_links":"1","linka_name":"","linkb_name":"","linkc_name":"","linkd_name":"","linke_name":"","show_email_form":"","show_email_copy":"","banned_email":"","banned_subject":"","banned_text":"","validate_session":"","custom_reply":"","redirect":"","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 75, 76, 0, '*', 0 UNION ALL -SELECT 252, 'aboutjoomla', 'News Feed Categories', 'new-feed-categories', '', 'using-joomla/extensions/components/news-feeds-component/new-feed-categories', 'index.php?option=com_newsfeeds&view=categories&id=0', 'component', 1, 267, 5, 17, 0, '1900-01-01 00:00:01', 0, 1, '', 0, '{"show_base_description":"1","categories_description":"Because this links to the root category the "uncategorised" category is displayed. ","maxLevel":"-1","show_empty_categories":"1","show_description":"1","show_description_image":"1","show_cat_num_articles":"1","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 93, 94, 0, '*', 0 +SELECT 252, 'aboutjoomla', 'News Feed Categories', 'new-feed-categories', '', 'using-joomla/extensions/components/news-feeds-component/new-feed-categories', 'index.php?option=com_newsfeeds&view=categories&id=0', 'component', 1, 267, 5, 17, 0, '1900-01-01 00:00:01', 0, 1, '', 0, '{"show_base_description":"1","categories_description":"Because this links to the root category the \\"uncategorised\\" category is displayed. ","maxLevel":"-1","show_empty_categories":"1","show_description":"1","show_description_image":"1","show_cat_num_articles":"1","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 93, 94, 0, '*', 0 UNION ALL SELECT 253, 'aboutjoomla', 'News Feed Category', 'news-feed-category', '', 'using-joomla/extensions/components/news-feeds-component/news-feed-category', 'index.php?option=com_newsfeeds&view=category&id=17', 'component', 1, 267, 5, 17, 0, '1900-01-01 00:00:01', 0, 1, '', 0, '{"maxLevel":"-1","show_empty_categories":"","show_description":"","show_description_image":"","show_cat_num_articles":"","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 97, 98, 0, '*', 0 UNION ALL diff --git a/installation/sql/sqlazure/sample_testing.sql b/installation/sql/sqlazure/sample_testing.sql index 6cd731e4218ed..b420f8ef9f370 100644 --- a/installation/sql/sqlazure/sample_testing.sql +++ b/installation/sql/sqlazure/sample_testing.sql @@ -15,7 +15,7 @@ SELECT 1, 0, 1, 431, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1 UNION ALL SELECT 2, 1, 2, 3, 1, 'com_admin', 'com_admin', '{}' UNION ALL -SELECT 3, 1, 4, 11, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 3, 1, 4, 11, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL SELECT 4, 1, 12, 13, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}' UNION ALL @@ -23,15 +23,15 @@ SELECT 5, 1, 14, 15, 1, 'com_checkin', 'com_checkin', '{"core.admin":{"7":1},"co UNION ALL SELECT 6, 1, 16, 17, 1, 'com_config', 'com_config', '{}' UNION ALL -SELECT 7, 1, 18, 87, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 7, 1, 18, 87, 1, 'com_contact', 'com_contact', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 8, 1, 88, 299, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":[],"core.edit":{"4":1},"core.edit.state":{"5":1},"core.edit.own":[]}' +SELECT 8, 1, 88, 299, 1, 'com_content', 'com_content', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.edit":{"4":1},"core.edit.state":{"5":1}}' UNION ALL SELECT 9, 1, 300, 301, 1, 'com_cpanel', 'com_cpanel', '{}' UNION ALL -SELECT 10, 1, 302, 303, 1, 'com_installer', 'com_installer', '{"core.admin":[],"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}' +SELECT 10, 1, 302, 303, 1, 'com_installer', 'com_installer', '{"core.manage":{"7":0},"core.delete":{"7":0},"core.edit.state":{"7":0}}' UNION ALL -SELECT 11, 1, 304, 305, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 11, 1, 304, 305, 1, 'com_languages', 'com_languages', '{"core.admin":{"7":1}}' UNION ALL SELECT 12, 1, 306, 307, 1, 'com_login', 'com_login', '{}' UNION ALL @@ -39,31 +39,31 @@ SELECT 13, 1, 308, 309, 1, 'com_mailto', 'com_mailto', '{}' UNION ALL SELECT 14, 1, 310, 311, 1, 'com_massmail', 'com_massmail', '{}' UNION ALL -SELECT 15, 1, 312, 313, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1},"core.edit":[],"core.edit.state":[]}' +SELECT 15, 1, 312, 313, 1, 'com_media', 'com_media', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":{"3":1},"core.delete":{"5":1}}' UNION ALL -SELECT 16, 1, 314, 315, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 16, 1, 314, 315, 1, 'com_menus', 'com_menus', '{"core.admin":{"7":1}}' UNION ALL SELECT 17, 1, 37, 38, 1, 'com_messages', 'com_messages', '{"core.admin":{"7":1},"core.manage":{"7":1}}' UNION ALL -SELECT 18, 1, 318, 319, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 18, 1, 318, 319, 1, 'com_modules', 'com_modules', '{"core.admin":{"7":1}}' UNION ALL -SELECT 19, 1, 320, 327, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1},"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 19, 1, 320, 327, 1, 'com_newsfeeds', 'com_newsfeeds', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 20, 1, 328, 329, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 20, 1, 328, 329, 1, 'com_plugins', 'com_plugins', '{"core.admin":{"7":1}}' UNION ALL -SELECT 21, 1, 330, 331, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1},"core.manage":[]}' +SELECT 21, 1, 330, 331, 1, 'com_redirect', 'com_redirect', '{"core.admin":{"7":1}}' UNION ALL SELECT 22, 1, 332, 333, 1, 'com_search', 'com_search', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 23, 1, 334, 335, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 23, 1, 334, 335, 1, 'com_templates', 'com_templates', '{"core.admin":{"7":1}}' UNION ALL -SELECT 24, 1, 336, 339, 1, 'com_users', 'com_users', '{"core.admin":{"7":1},"core.manage":[],"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 24, 1, 336, 339, 1, 'com_users', 'com_users', '{"core.admin":{"7":1}}' UNION ALL SELECT 26, 1, 358, 359, 1, 'com_wrapper', 'com_wrapper', '{}' UNION ALL SELECT 33, 1, 420, 421, 1, 'com_finder', 'com_finder', '{"core.admin":{"7":1},"core.manage":{"6":1}}' UNION ALL -SELECT 34, 8, 105, 108, 2, 'com_content.category.9', 'Uncategorised', '{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 34, 8, 105, 108, 2, 'com_content.category.9', 'Uncategorised', '{"core.create":{"10":0,"12":0}}' UNION ALL SELECT 35, 3, 7, 8, 2, 'com_banners.category.10', 'Uncategorised', '{}' UNION ALL @@ -79,7 +79,7 @@ SELECT 41, 7, 25, 86, 2, 'com_contact.category.16', 'Sample Data-Contact', '{}' UNION ALL SELECT 42, 19, 325, 326, 2, 'com_newsfeeds.category.17', 'Sample Data-Newsfeeds', '{}' UNION ALL -SELECT 44, 39, 110, 247, 3, 'com_content.category.19', 'Joomla!', '{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 44, 39, 110, 247, 3, 'com_content.category.19', 'Joomla!', '{"core.create":{"10":0,"12":0}}' UNION ALL SELECT 45, 44, 111, 224, 4, 'com_content.category.20', 'Extensions', '{}' UNION ALL @@ -93,7 +93,7 @@ SELECT 49, 45, 202, 203, 5, 'com_content.category.24', 'Languages', '{}' UNION ALL SELECT 50, 45, 204, 223, 5, 'com_content.category.25', 'Plugins', '{}' UNION ALL -SELECT 51, 39, 248, 279, 3, 'com_content.category.26', 'Park Site', '{"core.create":{"10":0,"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[]}' +SELECT 51, 39, 248, 279, 3, 'com_content.category.26', 'Park Site', '{"core.create":{"10":0,"12":0}}' UNION ALL SELECT 52, 51, 249, 254, 4, 'com_content.category.27', 'Park Blog', '{}' UNION ALL @@ -101,7 +101,7 @@ SELECT 53, 51, 255, 276, 4, 'com_content.category.28', 'Photo Gallery', '{}' UNION ALL SELECT 54, 39, 280, 293, 3, 'com_content.category.29', 'Fruit Shop Site', '{}' UNION ALL -SELECT 55, 54, 281, 286, 4, 'com_content.category.30', 'Growers', '{"core.create":{"12":0},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"10":1}}' +SELECT 55, 54, 281, 286, 4, 'com_content.category.30', 'Growers', '{"core.create":{"12":0},"core.edit.own":{"10":1}}' UNION ALL SELECT 59, 41, 26, 27, 3, 'com_contact.category.34', 'Park Site', '{}' UNION ALL @@ -189,7 +189,7 @@ SELECT 100, 48, 197, 198, 6, 'com_content.category.71', 'Milky Way', '{}' UNION ALL SELECT 101, 50, 205, 206, 6, 'com_content.article.5', 'Authentication', '{}' UNION ALL -SELECT 102, 51, 277, 278, 4, 'com_content.article.6', 'Australian Parks ', '{"core.delete":[],"core.edit":{"2":1},"core.edit.state":[]}' +SELECT 102, 51, 277, 278, 4, 'com_content.article.6', 'Australian Parks ', '{"core.edit":{"2":1}}' UNION ALL SELECT 103, 95, 154, 155, 7, 'com_content.article.7', 'Banner Module', '{}' UNION ALL @@ -311,11 +311,11 @@ SELECT 165, 94, 150, 151, 7, 'com_content.article.66', 'Latest Users Module', '{ UNION ALL SELECT 166, 47, 183, 188, 6, 'com_content.category.75', 'Navigation Modules', '{}' UNION ALL -SELECT 167, 54, 291, 292, 4, 'com_content.category.76', 'Recipes', '{"core.create":{"12":1,"10":1},"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":{"12":1,"10":1}}' +SELECT 167, 54, 291, 292, 4, 'com_content.category.76', 'Recipes', '{"core.create":{"12":1,"10":1},"core.edit.own":{"12":1,"10":1}}' UNION ALL SELECT 168, 34, 106, 107, 3, 'com_content.article.67', 'What''s New in 1.5?', '{}' UNION ALL -SELECT 169, 24, 337, 338, 2, 'com_users.category.77', 'Uncategorised', '' +SELECT 169, 24, 337, 338, 2, 'com_users.category.77', 'Uncategorised', '{}' UNION ALL SELECT 170, 50, 219, 220, 6, 'com_content.article.68', 'Captcha', '{}' UNION ALL @@ -731,7 +731,7 @@ SELECT 244, 'parks', 'Image Gallery', 'image-gallery', '', 'image-gallery', 'ind UNION ALL SELECT 251, 'frontendviews', 'Contact Categories', 'contact-categories', '', 'contact-categories', 'index.php?option=com_contact&view=categories&id=16', 'component', 1, 1, 1, 8, 0, '1900-01-01 00:00:00', 0, 1, '', 0, '{"show_base_description":"","categories_description":"","maxLevel":"-1","show_empty_categories":"","show_description":"","show_description_image":"","show_cat_num_articles":"","display_num":"","show_headings":"","filter_field":"","show_pagination":"","show_noauth":"","presentation_style":"sliders","show_name":"","show_position":"","show_email":"","show_street_address":"","show_suburb":"","show_state":"","show_postcode":"","show_country":"","show_telephone":"","show_mobile":"","show_fax":"","show_webpage":"","show_misc":"","show_image":"","allow_vcard":"","show_articles":"","show_links":"1","linka_name":"","linkb_name":"","linkc_name":"","linkd_name":"","linke_name":"","show_email_form":"","show_email_copy":"","banned_email":"","banned_subject":"","banned_text":"","validate_session":"","custom_reply":"","redirect":"","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 157, 158, 0, '*', 0 UNION ALL -SELECT 252, 'frontendviews', 'News Feed Categories', 'new-feed-categories', '', 'new-feed-categories', 'index.php?option=com_newsfeeds&view=categories&id=0', 'component', 1, 1, 1, 17, 0, '1900-01-01 00:00:00', 0, 1, '', 0, '{"show_base_description":"1","categories_description":"Because this links to the root category the "uncategorised" category is displayed. ","maxLevel":"-1","show_empty_categories":"1","show_description":"1","show_description_image":"1","show_cat_num_articles":"1","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 175, 176, 0, '*', 0 +SELECT 252, 'frontendviews', 'News Feed Categories', 'new-feed-categories', '', 'new-feed-categories', 'index.php?option=com_newsfeeds&view=categories&id=0', 'component', 1, 1, 1, 17, 0, '1900-01-01 00:00:00', 0, 1, '', 0, '{"show_base_description":"1","categories_description":"Because this links to the root category the \\"uncategorised\\" category is displayed. ","maxLevel":"-1","show_empty_categories":"1","show_description":"1","show_description_image":"1","show_cat_num_articles":"1","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 175, 176, 0, '*', 0 UNION ALL SELECT 253, 'frontendviews', 'News Feed Category', 'news-feed-category', '', 'news-feed-category', 'index.php?option=com_newsfeeds&view=category&id=17', 'component', 1, 1, 1, 17, 0, '1900-01-01 00:00:00', 0, 1, '', 0, '{"maxLevel":"-1","show_empty_categories":"","show_description":"","show_description_image":"","show_cat_num_articles":"","display_num":"","show_headings":"","orderby_pri":"","orderby_sec":"","order_date":"","show_pagination":"","show_noauth":"","show_feed_image":"","show_feed_description":"","show_item_description":"","feed_character_count":"0","show_feed_link":"","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":0,"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}', 179, 180, 0, '*', 0 UNION ALL diff --git a/installation/template/css/template.css b/installation/template/css/template.css index 730694a901fc2..86cba91eb7545 100644 --- a/installation/template/css/template.css +++ b/installation/template/css/template.css @@ -214,3 +214,12 @@ fieldset { textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05); } + +#jform_activateMultilanguage [class*="btn-"]:active, +#jform_activateMultilanguage [class*="btn-"].active, +#jform_installLocalisedContent [class*="btn-"]:active, +#jform_installLocalisedContent [class*="btn-"].active, +#jform_activatePluginLanguageCode [class*="btn-"]:active, +#jform_activatePluginLanguageCode [class*="btn-"].active { + background-color: #294f7e; +} diff --git a/installation/template/index.php b/installation/template/index.php index df9f0c3d04847..18d7b261b9223 100644 --- a/installation/template/index.php +++ b/installation/template/index.php @@ -20,11 +20,16 @@ JHtml::_('behavior.formvalidator'); JHtml::_('behavior.core'); JHtml::_('behavior.polyfill', array('event'), 'lt IE 9'); -JHtml::_('script', 'installation/template/js/installation.js'); + +// Add installation js +JHtml::_('script', 'installation/template/js/installation.js', array('version' => 'auto')); + +// Add html5 shiv +JHtml::_('script', 'jui/html5.js', array('version' => 'auto', 'relative' => true, 'conditional' => 'lt IE 9')); // Add Stylesheets JHtml::_('bootstrap.loadCss', true, $this->direction); -JHtml::_('stylesheet', 'installation/template/css/template.css'); +JHtml::_('stylesheet', 'installation/template/css/template.css', array('version' => 'auto')); // Load JavaScript message titles JText::script('ERROR'); diff --git a/installation/view/site/tmpl/default.php b/installation/view/site/tmpl/default.php index 43e157fd5e38e..f8133078c5ad4 100644 --- a/installation/view/site/tmpl/default.php +++ b/installation/view/site/tmpl/default.php @@ -54,6 +54,9 @@
    +
    +

    +
    form->getLabel('admin_email'); ?> diff --git a/language/en-GB/en-GB.com_config.ini b/language/en-GB/en-GB.com_config.ini index d89ed7bca77d6..08dd94b00fa81 100644 --- a/language/en-GB/en-GB.com_config.ini +++ b/language/en-GB/en-GB.com_config.ini @@ -23,7 +23,7 @@ COM_CONFIG_FIELD_VALUE_BEFORE="Before" COM_CONFIG_FIELD_SITE_OFFLINE_DESC="Select if access to the Site Frontend is available. If Yes, the Frontend will display a message if set such in Backend." COM_CONFIG_FIELD_SITE_OFFLINE_LABEL="Site Offline" COM_CONFIG_FIELD_SITENAME_PAGETITLES_DESC="Begin or end all Page Titles with the site name (for example, My Site Name - My Article Name)." -COM_CONFIG_FIELD_SITENAME_PAGETITLES_LABEL="Include Site Name in Page Titles" +COM_CONFIG_FIELD_SITENAME_PAGETITLES_LABEL="Site Name in Page Titles" COM_CONFIG_METADATA_SETTINGS="Metadata Settings" COM_CONFIG_MODULES_MODULE_NAME="Module Name" COM_CONFIG_MODULES_MODULE_TYPE="Module Type" diff --git a/language/en-GB/en-GB.com_contact.ini b/language/en-GB/en-GB.com_contact.ini index 3948802802169..8197b5745f4a4 100644 --- a/language/en-GB/en-GB.com_contact.ini +++ b/language/en-GB/en-GB.com_contact.ini @@ -61,4 +61,5 @@ COM_CONTACT_STATE="State" COM_CONTACT_SUBURB="Suburb" COM_CONTACT_TELEPHONE="Phone" COM_CONTACT_TELEPHONE_NUMBER="Phone: %s" +COM_CONTACT_USER_FIELDS="Fields" COM_CONTACT_VCARD="vCard" diff --git a/language/en-GB/en-GB.com_content.ini b/language/en-GB/en-GB.com_content.ini index 4af80e149b782..178035d2e54d5 100644 --- a/language/en-GB/en-GB.com_content.ini +++ b/language/en-GB/en-GB.com_content.ini @@ -28,6 +28,9 @@ COM_CONTENT_ERROR_PARENT_CATEGORY_NOT_FOUND="Parent category not found" COM_CONTENT_FEED_READMORE="Read More ..." COM_CONTENT_FILTER_SEARCH_DESC="Content Filter Search" COM_CONTENT_FORM_EDIT_ARTICLE="Edit an article" +COM_CONTENT_FORM_FILTER_LEGEND="Filters" +COM_CONTENT_FORM_FILTER_SUBMIT="Filter" +COM_CONTENT_CATEGORY_LIST_TABLE_CAPTION="List of articles in category %s" COM_CONTENT_HEADING_TITLE="Title" COM_CONTENT_HITS_FILTER_LABEL="Hits Filter" COM_CONTENT_INTROTEXT="Article must have some content." diff --git a/language/en-GB/en-GB.ini b/language/en-GB/en-GB.ini index 932947d277e03..0109012cf59f1 100644 --- a/language/en-GB/en-GB.ini +++ b/language/en-GB/en-GB.ini @@ -56,6 +56,7 @@ JASSOCIATIONS="Also available:" JAUTHOR="Author" JCANCEL="Cancel" JCATEGORY="Category" +JCLEAR="Clear" JDATE="Date" JDEFAULT="Default" JDETAILS="Details" @@ -67,6 +68,7 @@ JFALSE="False" JFEATURED="Featured" JHIDE="Hide" JINVALID_TOKEN="The most recent request was denied because it contained an invalid security token. Please refresh the page and try again." +JINVALID_TOKEN_NOTICE="The security token did not match. The request was aborted to prevent any security breach. Please try again." JLOGIN="Log in" JLOGOUT="Log out" JNEW="New" @@ -86,12 +88,14 @@ JPUBLISHED="Published" JREGISTER="Register" JREQUIRED="Required" JSAVE="Save" +JSELECT="Select" JSHOW="Show" JSITE="Site" JSTATUS="Status" JSUBMIT="Submit" JTAG="Tags" JTAG_DESC="Assign tags to content items. You may select a tag from the pre-defined list or enter a new tag by typing the name in the field and pressing enter." +JTAG_FIELD_SELECT_DESC="Select the tag to use." JTOOLBAR_VERSIONS="Versions" JTRASH="Trash" JTRASHED="Trashed" @@ -155,6 +159,7 @@ JFIELD_TITLE_DESC="Title for the article." JGLOBAL_ADD_CUSTOM_CATEGORY="Add new Category" JGLOBAL_ARTICLES="Articles" +JGLOBAL_FIELDS="Fields" JGLOBAL_AUTH_ACCESS_DENIED="Access Denied" JGLOBAL_AUTH_ACCESS_GRANTED="Access Granted" JGLOBAL_AUTH_BIND_FAILED="Failed binding to LDAP server" @@ -190,8 +195,8 @@ JGLOBAL_EMAIL="Email" JGLOBAL_EMAIL_TITLE="Email this link to a friend" JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC="Categories that are within this category will be displayed." JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL="Select a Top Level Category" -JGLOBAL_FIELD_CATEGORIES_DESC_DESC="If you enter some text in this field, it will override the Top Level Category Description, if it has one." -JGLOBAL_FIELD_CATEGORIES_DESC_LABEL="Top Level Category Description" +JGLOBAL_FIELD_CATEGORIES_DESC_DESC="If you enter some text in this field, it will replace the Top Level Category Description, if it has one." +JGLOBAL_FIELD_CATEGORIES_DESC_LABEL="Alternative Description" JGLOBAL_FIELD_CREATED_BY_ALIAS_DESC="Uses another name than the author's for display." JGLOBAL_FIELD_CREATED_BY_ALIAS_LABEL="Author's Alias" JGLOBAL_FIELD_CREATED_BY_DESC="The user who created this." @@ -216,7 +221,7 @@ JGLOBAL_FIELD_PUBLISH_DOWN_DESC="An optional date to stop publishing." JGLOBAL_FIELD_PUBLISH_DOWN_LABEL="Finish Publishing" JGLOBAL_FIELD_PUBLISH_UP_DESC="An optional date to start publishing." JGLOBAL_FIELD_PUBLISH_UP_LABEL="Start Publishing" -JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC="Show description of the top level category or optionally override with the text from the description field found in menu item. If using Root as top level category, the description field has to be filled." +JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC="Show description of the top level category or alternatively replace with the text from the description field found in the menu item. If using Root as a top level category, the description field has to be filled." JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL="Top Level Category Description" JGLOBAL_FIELD_VERSION_NOTE_DESC="Enter an optional note for this version of the item." JGLOBAL_FIELD_VERSION_NOTE_LABEL="Version Note" @@ -261,6 +266,7 @@ JGLOBAL_TITLE="Title" JGLOBAL_TYPE_OR_SELECT_CATEGORY="Type or Select a Category" JGLOBAL_TYPE_OR_SELECT_SOME_OPTIONS="Type or select some options" JGLOBAL_USE_GLOBAL="Use Global" +JGLOBAL_USE_GLOBAL_VALUE="Use Global (%s)" JGLOBAL_USERNAME="Username" JGLOBAL_VALIDATION_FORM_FAILED="Invalid form" JGLOBAL_YOU_MUST_LOGIN_FIRST="Please login first" @@ -280,6 +286,7 @@ JLIB_DATABASE_ERROR_DATABASE_CONNECT="Could not connect to database" JLIB_DATABASE_ERROR_LOAD_DATABASE_DRIVER="Unable to load Database Driver: %s" JLIB_ERROR_INFINITE_LOOP="Infinite loop detected in JError" +JOPTION_DO_NOT_USE="- None Selected -" JOPTION_SELECT_ACCESS="- Select Access -" JOPTION_SELECT_AUTHOR="- Select Author -" JOPTION_SELECT_CATEGORY="- Select Category -" diff --git a/language/en-GB/en-GB.lib_joomla.ini b/language/en-GB/en-GB.lib_joomla.ini index a10aeb29e6857..9a79a6e3d1e47 100644 --- a/language/en-GB/en-GB.lib_joomla.ini +++ b/language/en-GB/en-GB.lib_joomla.ini @@ -233,6 +233,7 @@ JLIB_DATABASE_QUERY_FAILED="Database query failed (error # %s): %s" JLIB_DOCUMENT_ERROR_UNABLE_LOAD_DOC_CLASS="Unable to load document class." JLIB_ENVIRONMENT_SESSION_EXPIRED="Your session has expired. Please log in again." JLIB_ENVIRONMENT_SESSION_INVALID="Invalid session cookie. Please check that you have cookies enabled in your web browser." +JLIB_ERROR_COMPONENTS_ACL_CONFIGURATION_FILE_MISSING_OR_IMPROPERLY_STRUCTURED="The %s component's ACL configuration file is either missing or improperly structured." JLIB_ERROR_INFINITE_LOOP="Infinite loop detected in JError." JLIB_EVENT_ERROR_DISPATCHER="JEventDispatcher: :register: Event handler not recognised. Handler: %s" JLIB_FILESYSTEM_BZIP_NOT_SUPPORTED="BZip2 Not Supported." @@ -306,6 +307,60 @@ JLIB_FORM_ERROR_NO_DATA="No data." JLIB_FORM_ERROR_VALIDATE_FIELD="Invalid xml field." JLIB_FORM_ERROR_XML_FILE_DID_NOT_LOAD="XML file did not load." JLIB_FORM_FIELD_INVALID="Invalid field: " +JLIB_FORM_FIELD_PARAM_CALENDAR_FORMAT_DESC="The date format to be used. This is in the format used by PHP to specify date string formats (see below). If no format argument is given, '%Y-%m-%d' is assumed (giving dates like '2008-04-16')." +JLIB_FORM_FIELD_PARAM_CALENDAR_FORMAT_LABEL="Format" +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_DESC="Allow multiple values to be selected." +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_LABEL="Multiple" +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_DESC="The options of the list." +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_NAME_LABEL="Text" +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_LABEL="Checkbox Values" +JLIB_FORM_FIELD_PARAM_CHECKBOX_MULTIPLE_VALUES_VALUE_LABEL="Value" +JLIB_FORM_FIELD_PARAM_EDITOR_BUTTONS_HIDE_DESC="Hide the buttons in the comma separated list." +JLIB_FORM_FIELD_PARAM_EDITOR_BUTTONS_HIDE_LABEL="Hide Buttons" +JLIB_FORM_FIELD_PARAM_EDITOR_HEIGHT_DESC="Defines the height (in pixels) of the WYSIWYG editor and defaults to 250px." +JLIB_FORM_FIELD_PARAM_EDITOR_HEIGHT_LABEL="Height" +JLIB_FORM_FIELD_PARAM_EDITOR_SHOW_BUTTONS_DESC="Should the buttons being shown." +JLIB_FORM_FIELD_PARAM_EDITOR_SHOW_BUTTONS_LABEL="Show Buttons" +JLIB_FORM_FIELD_PARAM_EDITOR_WIDTH_DESC="Defines the width (in pixels) of the WYSIWYG editor and defaults to 100%." +JLIB_FORM_FIELD_PARAM_EDITOR_WIDTH_LABEL="Width" +JLIB_FORM_FIELD_PARAM_IMAGELIST_DIRECTORY_DESC="The filesystem path to the directory containing the image files to be listed." +JLIB_FORM_FIELD_PARAM_IMAGELIST_DIRECTORY_LABEL="Directory" +JLIB_FORM_FIELD_PARAM_INTEGER_FIRST_DESC="This value is the lowest on the list." +JLIB_FORM_FIELD_PARAM_INTEGER_FIRST_LABEL="First" +JLIB_FORM_FIELD_PARAM_INTEGER_LAST_DESC="This value is the highest on the list." +JLIB_FORM_FIELD_PARAM_INTEGER_LAST_LABEL="Last" +JLIB_FORM_FIELD_PARAM_INTEGER_STEP_DESC="Each option will be the previous option incremented by this integer, starting with the first value until the last value is reached." +JLIB_FORM_FIELD_PARAM_INTEGER_STEP_LABEL="Step" +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_DESC="Allow multiple values to be selected." +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_LABEL="Multiple" +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_DESC="The options of the list." +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_LABEL="List Values" +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_VALUE_LABEL="Value" +JLIB_FORM_FIELD_PARAM_LIST_MULTIPLE_VALUES_NAME_LABEL="Text" +JLIB_FORM_FIELD_PARAM_MEDIA_IMAGE_CLASS_DESC="The class which is added to the image (src tag)." +JLIB_FORM_FIELD_PARAM_MEDIA_IMAGE_CLASS_LABEL="Image Class" +JLIB_FORM_FIELD_PARAM_MEDIA_PREVIEW_DESC="Shows or hides the preview of the selected image." +JLIB_FORM_FIELD_PARAM_MEDIA_PREVIEW_INLINE="Inline" +JLIB_FORM_FIELD_PARAM_MEDIA_PREVIEW_LABEL="Preview" +JLIB_FORM_FIELD_PARAM_MEDIA_PREVIEW_TOOLTIP="Tooltip" +JLIB_FORM_FIELD_PARAM_MEDIA_HOME_LABEL="Home Directory" +JLIB_FORM_FIELD_PARAM_MEDIA_HOME_DESC="Should the directory with the files point to a user directory." +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_DESC="Allow multiple values to be selected." +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_LABEL="Multiple" +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_DESC="The options of the list." +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_NAME_LABEL="Text" +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_LABEL="Radio Values" +JLIB_FORM_FIELD_PARAM_RADIO_MULTIPLE_VALUES_VALUE_LABEL="Value" +JLIB_FORM_FIELD_PARAM_SQL_QUERY_DESC="The SQL query which will provide the data for the drop-down list. The query must return two columns; one called 'value' which will hold the values of the list items; the other called 'text' containing the text in the drop-down list." +JLIB_FORM_FIELD_PARAM_SQL_QUERY_LABEL="Query" +JLIB_FORM_FIELD_PARAM_TEXTAREA_COLS_DESC="The number of columns of the field." +JLIB_FORM_FIELD_PARAM_TEXTAREA_COLS_LABEL="Columns" +JLIB_FORM_FIELD_PARAM_TEXTAREA_ROWS_DESC="The number of rows of the field." +JLIB_FORM_FIELD_PARAM_TEXTAREA_ROWS_LABEL="Rows" +JLIB_FORM_FIELD_PARAM_URL_RELATIVE_DESC="Are relative URLs allowed." +JLIB_FORM_FIELD_PARAM_URL_RELATIVE_LABEL="Relative" +JLIB_FORM_FIELD_PARAM_URL_SCHEMES_DESC="The allowed schemes." +JLIB_FORM_FIELD_PARAM_URL_SCHEMES_LABEL="Schemes" JLIB_FORM_INPUTMODE="latin" JLIB_FORM_INVALID_FORM_OBJECT="Invalid Form Object: :%s" JLIB_FORM_INVALID_FORM_RULE="Invalid Form Rule: :%s" diff --git a/language/en-GB/en-GB.mod_login.ini b/language/en-GB/en-GB.mod_login.ini index 8933d1ed59420..2161e51929018 100644 --- a/language/en-GB/en-GB.mod_login.ini +++ b/language/en-GB/en-GB.mod_login.ini @@ -6,9 +6,9 @@ MOD_LOGIN="Login" MOD_LOGIN_FIELD_GREETING_DESC="Show or hide the simple greeting text." MOD_LOGIN_FIELD_GREETING_LABEL="Show Greeting" -MOD_LOGIN_FIELD_LOGIN_REDIRECTURL_DESC="Select the page the user will be redirected to after a successful login. Select from all the pages listed in the dropdown menu. Choosing "Default" will return to the same page." +MOD_LOGIN_FIELD_LOGIN_REDIRECTURL_DESC="Select or create the page the user will be redirected to after a successful login. The default is to remain on the same page." MOD_LOGIN_FIELD_LOGIN_REDIRECTURL_LABEL="Login Redirection Page" -MOD_LOGIN_FIELD_LOGOUT_REDIRECTURL_DESC="Select the page the user will be redirected to after successfully ending their current session by logging out. Select from all the pages listed in the dropdown menu. Choosing "Default" will return to the same page." +MOD_LOGIN_FIELD_LOGOUT_REDIRECTURL_DESC="Select or create the page the user will be redirected to after successfully ending their current session by logging out. The default is to remain on the same page." MOD_LOGIN_FIELD_LOGOUT_REDIRECTURL_LABEL="Logout Redirection Page" MOD_LOGIN_FIELD_NAME_DESC="Displays name or username after logging in." MOD_LOGIN_FIELD_NAME_LABEL="Show Name/Username" @@ -16,6 +16,8 @@ MOD_LOGIN_FIELD_POST_TEXT_DESC="This is the text or HTML that is displayed below MOD_LOGIN_FIELD_POST_TEXT_LABEL="Post-text" MOD_LOGIN_FIELD_PRE_TEXT_DESC="This is the text or HTML that is displayed above the login form." MOD_LOGIN_FIELD_PRE_TEXT_LABEL="Pre-text" +MOD_LOGIN_FIELD_PROFILE_LABEL="Show Profile Link" +MOD_LOGIN_FIELD_PROFILE_DESC="Show a link to the User Profile page after logging in." MOD_LOGIN_FIELD_USESECURE_DESC="Submit encrypted login data using HTTPS (encrypted HTTP connections with the https:// protocol prefix). Note, you must have HTTPS enabled on your server to utilise this option." MOD_LOGIN_FIELD_USESECURE_LABEL="Encrypt Login Form" MOD_LOGIN_FIELD_USETEXT_DESC="Choose text or icons to display the field labels. Default is icons." @@ -23,6 +25,7 @@ MOD_LOGIN_FIELD_USETEXT_LABEL="Display Labels" MOD_LOGIN_FORGOT_YOUR_PASSWORD="Forgot your password?" MOD_LOGIN_FORGOT_YOUR_USERNAME="Forgot your username?" MOD_LOGIN_HINAME="Hi %s," +MOD_LOGIN_PROFILE="View Profile" MOD_LOGIN_REGISTER="Create an account" MOD_LOGIN_REMEMBER_ME="Remember Me" MOD_LOGIN_VALUE_ICONS="Icons" diff --git a/layouts/joomla/content/options_default.php b/layouts/joomla/content/options_default.php index 83e96a8817000..06d8f15f6fa1a 100644 --- a/layouts/joomla/content/options_default.php +++ b/layouts/joomla/content/options_default.php @@ -29,7 +29,7 @@ if ($showonstring = $displayData->form->getFieldAttribute($field->fieldname, 'showon')) { JHtml::_('jquery.framework'); - JHtml::_('script', 'jui/cms.js', false, true); + JHtml::_('script', 'jui/cms.js', array('version' => 'auto', 'relative' => true)); $showonarr = array(); diff --git a/layouts/joomla/edit/associations.php b/layouts/joomla/edit/associations.php index 62229972698f3..1428b8e099b10 100644 --- a/layouts/joomla/edit/associations.php +++ b/layouts/joomla/edit/associations.php @@ -9,13 +9,17 @@ defined('JPATH_BASE') or die; +$form = $displayData->getForm(); +$options = array( + 'formControl' => $form->getFormControl(), + 'hidden' => (int) ($form->getValue('language', null, '*') === '*'), +); + +JHtml::_('behavior.core'); +JText::script('JGLOBAL_ASSOC_NOT_POSSIBLE'); +JText::script('JGLOBAL_ASSOCIATIONS_RESET_WARNING'); +JFactory::getDocument()->addScriptOptions('system.associations.edit', $options); +JHtml::_('script', 'system/associations-edit.js', array('version' => 'auto', 'relative' => true)); + // JLayout for standard handling of associations fields in the administrator items edit screens. -if ($displayData->getForm()->getValue('id') != 0 && $displayData->getForm()->getValue('language') !== '*') -{ - echo $displayData->getForm()->renderFieldset('item_associations'); -} -else -{ - echo '
    ' . JText::_('JGLOBAL_ASSOC_NOT_POSSIBLE') . '
    '; - echo ''; -} \ No newline at end of file +echo $form->renderFieldset('item_associations'); diff --git a/layouts/joomla/edit/frontediting_modules.php b/layouts/joomla/edit/frontediting_modules.php index 74a52d35b8fd3..477d7a0180612 100644 --- a/layouts/joomla/edit/frontediting_modules.php +++ b/layouts/joomla/edit/frontediting_modules.php @@ -64,6 +64,6 @@ JHtml::_('bootstrap.tooltip'); JHtml::_('bootstrap.popover'); - JHtml::_('stylesheet', 'system/frontediting.css', array(), true); - JHtml::_('script', 'system/frontediting.js', false, true); + JHtml::_('stylesheet', 'system/frontediting.css', array('version' => 'auto', 'relative' => true)); + JHtml::_('script', 'system/frontediting.js', array('version' => 'auto', 'relative' => true)); } diff --git a/layouts/joomla/form/field/checkboxes.php b/layouts/joomla/form/field/checkboxes.php index e1cba39033cce..2779bf68879c3 100644 --- a/layouts/joomla/form/field/checkboxes.php +++ b/layouts/joomla/form/field/checkboxes.php @@ -44,7 +44,7 @@ // Including fallback code for HTML5 non supported browsers. JHtml::_('jquery.framework'); -JHtml::_('script', 'system/html5fallback.js', false, true); +JHtml::_('script', 'system/html5fallback.js', array('version' => 'auto', 'relative' => true)); /** * The format of the input tag to be filled in using sprintf. diff --git a/layouts/joomla/form/field/color/advanced.php b/layouts/joomla/form/field/color/advanced.php index 2856369b05972..b5b6a6681f0c8 100644 --- a/layouts/joomla/form/field/color/advanced.php +++ b/layouts/joomla/form/field/color/advanced.php @@ -69,10 +69,10 @@ // Including fallback code for HTML5 non supported browsers. JHtml::_('jquery.framework'); -JHtml::_('script', 'system/html5fallback.js', false, true); -JHtml::_('script', 'jui/jquery.minicolors.min.js', false, true); -JHtml::_('stylesheet', 'jui/jquery.minicolors.css', false, true); -JHtml::_('script', 'system/color-field-adv-init.min.js', false, true, false, false, true); +JHtml::_('script', 'system/html5fallback.js', array('version' => 'auto', 'relative' => true)); +JHtml::_('script', 'jui/jquery.minicolors.min.js', array('version' => 'auto', 'relative' => true)); +JHtml::_('stylesheet', 'jui/jquery.minicolors.css', array('version' => 'auto', 'relative' => true)); +JHtml::_('script', 'system/color-field-adv-init.min.js', array('version' => 'auto', 'relative' => true)); ?> 'auto', 'relative' => true)); +JHtml::_('script', 'jui/jquery.simplecolors.min.js', array('version' => 'auto', 'relative' => true)); +JHtml::_('stylesheet', 'jui/jquery.simplecolors.css', array('version' => 'auto', 'relative' => true)); +JHtml::_('script', 'system/color-field-init.min.js', array('version' => 'auto', 'relative' => true)); ?> 0)); -JHtml::_('script', 'system/moduleorder.js', false, true); +JHtml::_('script', 'system/moduleorder.js', array('version' => 'auto', 'relative' => true)); ?>
    data-url="" data-element="" data-ordering="" data-position-element =" 'auto', 'relative' => true)); ?> 'auto', 'relative' => true)); /** * The format of the input tag to be filled in using sprintf. diff --git a/layouts/joomla/form/field/range.php b/layouts/joomla/form/field/range.php index 3bad9e95f9ea6..fd8f46749f00d 100644 --- a/layouts/joomla/form/field/range.php +++ b/layouts/joomla/form/field/range.php @@ -46,7 +46,7 @@ // Including fallback code for HTML5 non supported browsers. JHtml::_('jquery.framework'); -JHtml::_('script', 'system/html5fallback.js', false, true); +JHtml::_('script', 'system/html5fallback.js', array('version' => 'auto', 'relative' => true)); // Initialize some field attributes. $attributes = array( diff --git a/layouts/joomla/form/field/subform/repeatable-table.php b/layouts/joomla/form/field/subform/repeatable-table.php index 8d368a975feff..d5babf2df7d26 100644 --- a/layouts/joomla/form/field/subform/repeatable-table.php +++ b/layouts/joomla/form/field/subform/repeatable-table.php @@ -30,7 +30,7 @@ if ($multiple) { JHtml::_('jquery.ui', array('core', 'sortable')); - JHtml::_('script', 'system/subform-repeatable.js', false, true); + JHtml::_('script', 'system/subform-repeatable.js', array('version' => 'auto', 'relative' => true)); } // Build heading diff --git a/layouts/joomla/form/field/subform/repeatable.php b/layouts/joomla/form/field/subform/repeatable.php index ae5bd369edb37..d465b129eb1cd 100644 --- a/layouts/joomla/form/field/subform/repeatable.php +++ b/layouts/joomla/form/field/subform/repeatable.php @@ -30,7 +30,7 @@ if ($multiple) { JHtml::_('jquery.ui', array('core', 'sortable')); - JHtml::_('script', 'system/subform-repeatable.js', false, true); + JHtml::_('script', 'system/subform-repeatable.js', array('version' => 'auto', 'relative' => true)); } $sublayout = empty($groupByFieldset) ? 'section' : 'section-byfieldsets'; diff --git a/layouts/joomla/form/field/text.php b/layouts/joomla/form/field/text.php index 0731041b229e1..7188f01e97cba 100644 --- a/layouts/joomla/form/field/text.php +++ b/layouts/joomla/form/field/text.php @@ -46,7 +46,7 @@ // Including fallback code for HTML5 non supported browsers. JHtml::_('jquery.framework'); -JHtml::_('script', 'system/html5fallback.js', false, true); +JHtml::_('script', 'system/html5fallback.js', array('version' => 'auto', 'relative' => true)); $list = ''; diff --git a/layouts/joomla/form/field/textarea.php b/layouts/joomla/form/field/textarea.php index 54478f782328f..e518e01724f1c 100644 --- a/layouts/joomla/form/field/textarea.php +++ b/layouts/joomla/form/field/textarea.php @@ -46,7 +46,7 @@ // Including fallback code for HTML5 non supported browsers. JHtml::_('jquery.framework'); -JHtml::_('script', 'system/html5fallback.js', false, true); +JHtml::_('script', 'system/html5fallback.js', array('version' => 'auto', 'relative' => true)); // Initialize some field attributes. $autocomplete = !$autocomplete ? 'autocomplete="off"' : 'autocomplete="' . $autocomplete . '"'; diff --git a/layouts/joomla/form/field/url.php b/layouts/joomla/form/field/url.php index ab02e087475ab..361d7555ffaca 100644 --- a/layouts/joomla/form/field/url.php +++ b/layouts/joomla/form/field/url.php @@ -46,7 +46,7 @@ // Including fallback code for HTML5 non supported browsers. JHtml::_('jquery.framework'); -JHtml::_('script', 'system/html5fallback.js', false, true); +JHtml::_('script', 'system/html5fallback.js', array('version' => 'auto', 'relative' => true)); $autocomplete = !$autocomplete ? ' autocomplete="off"' : ' autocomplete="' . $autocomplete . '"'; $autocomplete = $autocomplete == ' autocomplete="on"' ? '' : $autocomplete; diff --git a/layouts/joomla/form/field/user.php b/layouts/joomla/form/field/user.php index dded74d19a554..6bf3a3041bc60 100644 --- a/layouts/joomla/form/field/user.php +++ b/layouts/joomla/form/field/user.php @@ -60,7 +60,7 @@ // Load the modal behavior script. JHtml::_('behavior.modal', 'a.modal_' . $id); -JHtml::script('jui/fielduser.min.js', false, true, false, false, true); +JHtml::_('script', 'jui/fielduser.min.js', array('version' => 'auto', 'relative' => true)); ?>
    diff --git a/layouts/joomla/form/renderfield.php b/layouts/joomla/form/renderfield.php index d94a35741f834..c17bb9b33f15b 100644 --- a/layouts/joomla/form/renderfield.php +++ b/layouts/joomla/form/renderfield.php @@ -22,7 +22,7 @@ if (!empty($options['showonEnabled'])) { JHtml::_('jquery.framework'); - JHtml::_('script', 'jui/cms.js', false, true); + JHtml::_('script', 'jui/cms.js', array('version' => 'auto', 'relative' => true)); } $class = empty($options['class']) ? '' : ' ' . $options['class']; diff --git a/layouts/joomla/html/formbehavior/ajaxchosen.php b/layouts/joomla/html/formbehavior/ajaxchosen.php index 4ab80379b9ad4..6d74a537476e7 100644 --- a/layouts/joomla/html/formbehavior/ajaxchosen.php +++ b/layouts/joomla/html/formbehavior/ajaxchosen.php @@ -31,7 +31,7 @@ // Include jQuery JHtml::_('jquery.framework'); -JHtml::_('script', 'jui/ajax-chosen.min.js', false, true, false, false, $debug); +JHtml::_('script', 'jui/ajax-chosen.min.js', array('version' => 'auto', 'relative' => true, 'detectDebug' => $debug)); JFactory::getDocument()->addScriptDeclaration( " diff --git a/layouts/joomla/html/formbehavior/chosen.php b/layouts/joomla/html/formbehavior/chosen.php index ecf59023c9cbe..71f14519e5407 100644 --- a/layouts/joomla/html/formbehavior/chosen.php +++ b/layouts/joomla/html/formbehavior/chosen.php @@ -22,8 +22,8 @@ // Include jQuery JHtml::_('jquery.framework'); -JHtml::_('script', 'jui/chosen.jquery.min.js', false, true, false, false, $debug); -JHtml::_('stylesheet', 'jui/chosen.css', false, true); +JHtml::_('script', 'jui/chosen.jquery.min.js', array('version' => 'auto', 'relative' => true, 'detectDebug' => $debug)); +JHtml::_('stylesheet', 'jui/chosen.css', array('version' => 'auto', 'relative' => true)); // Options array to json options string $options_str = json_encode($options, ($debug && defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : false)); diff --git a/layouts/joomla/html/sortablelist.php b/layouts/joomla/html/sortablelist.php index b7815ba27f62e..ce8137c1d83dc 100644 --- a/layouts/joomla/html/sortablelist.php +++ b/layouts/joomla/html/sortablelist.php @@ -26,8 +26,8 @@ // Depends on jQuery UI JHtml::_('jquery.ui', array('core', 'sortable')); -JHtml::_('script', 'jui/sortablelist.js', false, true); -JHtml::_('stylesheet', 'jui/sortablelist.css', false, true, false); +JHtml::_('script', 'jui/sortablelist.js', array('version' => 'auto', 'relative' => true)); +JHtml::_('stylesheet', 'jui/sortablelist.css', array('version' => 'auto', 'relative' => true)); // Attach sortable to document JFactory::getDocument()->addScriptDeclaration( diff --git a/layouts/joomla/searchtools/default/filters.php b/layouts/joomla/searchtools/default/filters.php index d676219f6d769..bccc8f6cd5714 100644 --- a/layouts/joomla/searchtools/default/filters.php +++ b/layouts/joomla/searchtools/default/filters.php @@ -42,7 +42,7 @@ if ($showOnData = $field->getAttribute('dataShowOn')) { JHtml::_('jquery.framework'); - JHtml::_('script', 'jui/cms.js', false, true); + JHtml::_('script', 'jui/cms.js', array('version' => 'auto', 'relative' => true)); $showOn = " data-showon='" . $showOnData . "'"; } ?> diff --git a/libraries/cms/application/cms.php b/libraries/cms/application/cms.php index 99cb0f2f8f3f1..f63da76b9d705 100644 --- a/libraries/cms/application/cms.php +++ b/libraries/cms/application/cms.php @@ -1147,7 +1147,7 @@ protected function route() * Sets the value of a user state variable. * * @param string $key The path of the state. - * @param string $value The value of the variable. + * @param mixed $value The value of the variable. * * @return mixed The previous state, if one existed. * diff --git a/libraries/cms/application/site.php b/libraries/cms/application/site.php index 6148ccd5b84d1..a3dcb020aa606 100644 --- a/libraries/cms/application/site.php +++ b/libraries/cms/application/site.php @@ -351,8 +351,7 @@ public function getParams($option = null) // Get show_page_heading from com_menu global settings $params[$hash]->def('show_page_heading', $temp->get('show_page_heading')); - $temp = new Registry($menu->params); - $params[$hash]->merge($temp); + $params[$hash]->merge($menu->params); $title = $menu->title; } else @@ -483,13 +482,20 @@ public function getTemplate($params = false) foreach ($templates as &$template) { - $template->params = new Registry($template->params); - // Create home element - if ($template->home == 1 && !isset($templates[0]) || $this->_language_filter && $template->home == $tag) + if ($template->home == 1 && !isset($template_home) || $this->_language_filter && $template->home == $tag) { - $templates[0] = clone $template; + $template_home = clone $template; } + + $template->params = new Registry($template->params); + } + + // Add home element, after loop to avoid double execution + if (isset($template_home)) + { + $template_home->params = new Registry($template_home->params); + $templates[0] = $template_home; } $cache->store($templates, 'templates0' . $tag); @@ -517,9 +523,6 @@ public function getTemplate($params = false) if ($tmpl->template == $template_override) { $template = $tmpl; - - $template->params = new Registry($template->params); - break; } } diff --git a/libraries/cms/form/field/author.php b/libraries/cms/form/field/author.php index 3776264d7f92f..9fc516404f324 100644 --- a/libraries/cms/form/field/author.php +++ b/libraries/cms/form/field/author.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field to load a list of content authors * * @since 3.2 */ -class JFormFieldAuthor extends JFormFieldList +class JFormFieldAuthor extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/captcha.php b/libraries/cms/form/field/captcha.php index c1674b40d2654..0a356de6ad97b 100644 --- a/libraries/cms/form/field/captcha.php +++ b/libraries/cms/form/field/captcha.php @@ -145,4 +145,37 @@ protected function getInput() return $captcha->display($this->name, $this->id, $this->class); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $input = JFactory::getApplication()->input; + + if (JFactory::getApplication()->isAdmin()) + { + $fieldNode->setAttribute('plugin', JFactory::getConfig()->get('captcha')); + } + elseif ($input->get('option') == 'com_users' && $input->get('view') == 'profile' && $input->get('layout') != 'edit' && + $input->get('task') != 'save') + { + // The user profile page does show the values by creating the form + // and getting the values from it so we need to disable the field + $fieldNode->setAttribute('plugin', null); + } + + $fieldNode->setAttribute('validate', 'captcha'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/cms/form/field/contentlanguage.php b/libraries/cms/form/field/contentlanguage.php index 67a6be7cbb8b2..c0e2f854e76dc 100644 --- a/libraries/cms/form/field/contentlanguage.php +++ b/libraries/cms/form/field/contentlanguage.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides a list of content languages @@ -18,7 +16,7 @@ * @see JFormFieldLanguage for a select list of application languages. * @since 1.6 */ -class JFormFieldContentlanguage extends JFormFieldList +class JFormFieldContentlanguage extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/contenttype.php b/libraries/cms/form/field/contenttype.php index 20ee4209bac28..fccdba1c2a0f8 100644 --- a/libraries/cms/form/field/contenttype.php +++ b/libraries/cms/form/field/contenttype.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 3.1 */ -class JFormFieldContenttype extends JFormFieldList +class JFormFieldContenttype extends JFormAbstractlist { /** * A flexible tag list that respects access controls diff --git a/libraries/cms/form/field/editor.php b/libraries/cms/form/field/editor.php index 8f5aaa95b52a3..dac7aa73f47e8 100644 --- a/libraries/cms/form/field/editor.php +++ b/libraries/cms/form/field/editor.php @@ -18,7 +18,7 @@ * @see JEditor * @since 1.6 */ -class JFormFieldEditor extends JFormFieldTextarea +class JFormFieldEditor extends JFormFieldTextarea implements JFormDomfieldinterface { /** * The form field type. @@ -318,4 +318,24 @@ public function save() { return $this->getEditor()->save($this->id); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('buttons', $field->fieldparams->get('buttons', 0) ? 'true' : 'false'); + $fieldNode->setAttribute('filter', 'JComponentHelper::filterText'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/cms/form/field/frontend_language.php b/libraries/cms/form/field/frontend_language.php index 0c8959fabe022..3c5b4b3115887 100644 --- a/libraries/cms/form/field/frontend_language.php +++ b/libraries/cms/form/field/frontend_language.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides a list of published content languages with home pages @@ -18,7 +16,7 @@ * @see JFormFieldLanguage for a select list of application languages. * @since 3.5 */ -class JFormFieldFrontend_Language extends JFormFieldList +class JFormFieldFrontend_Language extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/headertag.php b/libraries/cms/form/field/headertag.php index 37949c3bab0d8..8cb232489de1d 100644 --- a/libraries/cms/form/field/headertag.php +++ b/libraries/cms/form/field/headertag.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla! CMS. * * @since 3.0 */ -class JFormFieldHeadertag extends JFormFieldList +class JFormFieldHeadertag extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/helpsite.php b/libraries/cms/form/field/helpsite.php index 052c9a8c7e82f..9a24e6470843e 100644 --- a/libraries/cms/form/field/helpsite.php +++ b/libraries/cms/form/field/helpsite.php @@ -9,15 +9,13 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides a select list of help sites. * * @since 1.6 */ -class JFormFieldHelpsite extends JFormFieldList +class JFormFieldHelpsite extends JFormAbstractlist { /** * The form field type. @@ -51,7 +49,7 @@ protected function getOptions() */ protected function getInput() { - JHtml::script('system/helpsite.js', false, true); + JHtml::_('script', 'system/helpsite.js', array('version' => 'auto', 'relative' => true)); $showDefault = $this->getAttribute('showDefault') === 'false' ? 'false' : 'true'; diff --git a/libraries/cms/form/field/limitbox.php b/libraries/cms/form/field/limitbox.php index b32ce9f6c3077..bb5a369ca0623 100644 --- a/libraries/cms/form/field/limitbox.php +++ b/libraries/cms/form/field/limitbox.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Field to load a list of posible item count limits * * @since 3.2 */ -class JFormFieldLimitbox extends JFormFieldList +class JFormFieldLimitbox extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/media.php b/libraries/cms/form/field/media.php index e954a84274aca..1f7d13ac4fbf4 100644 --- a/libraries/cms/form/field/media.php +++ b/libraries/cms/form/field/media.php @@ -15,7 +15,7 @@ * * @since 1.6 */ -class JFormFieldMedia extends JFormField +class JFormFieldMedia extends JFormField implements JFormDomfieldinterface { /** * The form field type. @@ -267,4 +267,43 @@ public function getLayoutData() return array_merge($data, $extraData); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('hide_default', 'true'); + + if ($field->fieldparams->get('home')) + { + $userName = JFactory::getUser()->username; + $root = $field->fieldparams->get('directory'); + + if (!$root) + { + $root = 'images'; + } + + $directory = JPATH_ROOT . '/images/' . $root . '/' . $userName; + + if (!JFolder::exists($directory)) + { + JFolder::create($directory); + } + + $fieldNode->setAttribute('directory', str_replace(JPATH_ROOT . '/images', '', $directory)); + } + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/cms/form/field/menu.php b/libraries/cms/form/field/menu.php index d8fdc2e183d99..b3c6863acb592 100644 --- a/libraries/cms/form/field/menu.php +++ b/libraries/cms/form/field/menu.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - // Import the com_menus helper. require_once realpath(JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'); @@ -19,7 +17,7 @@ * * @since 1.6 */ -class JFormFieldMenu extends JFormFieldList +class JFormFieldMenu extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/moduletag.php b/libraries/cms/form/field/moduletag.php index f1bfb80081b92..ef6f7e158456e 100644 --- a/libraries/cms/form/field/moduletag.php +++ b/libraries/cms/form/field/moduletag.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla! CMS. * * @since 3.0 */ -class JFormFieldModuletag extends JFormFieldList +class JFormFieldModuletag extends JFormAbstractlist { /** * The form field type. @@ -36,7 +34,7 @@ class JFormFieldModuletag extends JFormFieldList protected function getOptions() { $options = array(); - $tags = array('div', 'section', 'aside', 'nav', 'address', 'article'); + $tags = array('address', 'article', 'aside', 'details', 'div', 'footer', 'header', 'main', 'nav', 'section', 'summary'); // Create one new option object for each tag foreach ($tags as $tag) diff --git a/libraries/cms/form/field/tag.php b/libraries/cms/form/field/tag.php index 3ebf582c04a13..5d340311fc0a6 100644 --- a/libraries/cms/form/field/tag.php +++ b/libraries/cms/form/field/tag.php @@ -11,14 +11,12 @@ use Joomla\Utilities\ArrayHelper; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 3.1 */ -class JFormFieldTag extends JFormFieldList +class JFormFieldTag extends JFormAbstractlist { /** * A flexible tag list that respects access controls diff --git a/libraries/cms/form/field/user.php b/libraries/cms/form/field/user.php index 4c4c1feb9de99..008165d79718f 100644 --- a/libraries/cms/form/field/user.php +++ b/libraries/cms/form/field/user.php @@ -14,7 +14,7 @@ * * @since 1.6 */ -class JFormFieldUser extends JFormField +class JFormFieldUser extends JFormField implements JFormDomfieldinterface { /** * The form field type. @@ -131,4 +131,29 @@ protected function getExcluded() { return explode(',', $this->element['exclude']); } + + /** + * Transforms the field into an XML element and appends it as child on the given parent. This + * is the default implementation of a field. Form fields which do support to be transformed into + * an XML Element mut implemet the JFormDomfieldinterface. + * + * @param stdClass $field The field. + * @param DOMElement $parent The field node parent. + * @param JForm $form The form. + * + * @return DOMElement + * + * @since __DEPLOY_VERSION__ + * @see JFormDomfieldinterface::appendXMLFieldTag + */ + public function appendXMLFieldTag($field, DOMElement $parent, JForm $form) + { + if (JFactory::getApplication()->isSite()) + { + // The user field is not working on the front end + return; + } + + return parent::appendXMLFieldTag($field, $parent, $form); + } } diff --git a/libraries/cms/form/field/usergrouplist.php b/libraries/cms/form/field/usergrouplist.php index f4b79f5265b54..3ac44f4f091e0 100644 --- a/libraries/cms/form/field/usergrouplist.php +++ b/libraries/cms/form/field/usergrouplist.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Field to load a dropdown list of available user groups * * @since 3.2 */ -class JFormFieldUserGroupList extends JFormFieldList +class JFormFieldUserGroupList extends JFormAbstractlist implements JFormDomfieldinterface { /** * The form field type. diff --git a/libraries/cms/form/parameters/editor.xml b/libraries/cms/form/parameters/editor.xml new file mode 100644 index 0000000000000..6a13b62d990dc --- /dev/null +++ b/libraries/cms/form/parameters/editor.xml @@ -0,0 +1,67 @@ + +
    + +
    + + + + + + + + + + + + + + +
    +
    +
    diff --git a/libraries/cms/form/parameters/media.xml b/libraries/cms/form/parameters/media.xml new file mode 100644 index 0000000000000..490416d1dfb37 --- /dev/null +++ b/libraries/cms/form/parameters/media.xml @@ -0,0 +1,49 @@ + +
    + +
    + + + + + + + + + + + + + + +
    +
    +
    diff --git a/libraries/cms/form/parameters/user.xml b/libraries/cms/form/parameters/user.xml new file mode 100644 index 0000000000000..4b7ff6bfde898 --- /dev/null +++ b/libraries/cms/form/parameters/user.xml @@ -0,0 +1,18 @@ + +
    + +
    + + + + +
    +
    +
    diff --git a/libraries/cms/form/parameters/usergrouplist.xml b/libraries/cms/form/parameters/usergrouplist.xml new file mode 100644 index 0000000000000..4b7ff6bfde898 --- /dev/null +++ b/libraries/cms/form/parameters/usergrouplist.xml @@ -0,0 +1,18 @@ + +
    + +
    + + + + +
    +
    +
    diff --git a/libraries/cms/helper/content.php b/libraries/cms/helper/content.php index 658aa5536f085..d3740064058e4 100644 --- a/libraries/cms/helper/content.php +++ b/libraries/cms/helper/content.php @@ -100,21 +100,29 @@ public static function getActions($component = '', $section = '', $id = 0) return $result; } - $user = JFactory::getUser(); - $result = new JObject; - - $path = JPATH_ADMINISTRATOR . '/components/' . $component . '/access.xml'; + $assetName = $component; if ($section && $id) { - $assetName = $component . '.' . $section . '.' . (int) $id; + $assetName .= '.' . $section . '.' . (int) $id; } - else + + $result = new JObject; + + $user = JFactory::getUser(); + + $actions = JAccess::getActionsFromFile( + JPATH_ADMINISTRATOR . '/components/' . $component . '/access.xml', '/access/section[@name="component"]/' + ); + + if ($actions === false) { - $assetName = $component; - } + JLog::add( + JText::sprintf('JLIB_ERROR_COMPONENTS_ACL_CONFIGURATION_FILE_MISSING_OR_IMPROPERLY_STRUCTURED', $component), JLog::ERROR, 'jerror' + ); - $actions = JAccess::getActionsFromFile($path, "/access/section[@name='component']/"); + return $result; + } foreach ($actions as $action) { diff --git a/libraries/cms/html/behavior.php b/libraries/cms/html/behavior.php index 55d193487f185..9a203decdbbcf 100644 --- a/libraries/cms/html/behavior.php +++ b/libraries/cms/html/behavior.php @@ -60,7 +60,7 @@ public static function framework($extras = false, $debug = null) static::framework(false, $debug); } - JHtml::_('script', 'system/mootools-' . $type . '.js', false, true, false, false, $debug); + JHtml::_('script', 'system/mootools-' . $type . '.js', array('version' => 'auto', 'relative' => true, 'detectDebug' => $debug)); // Keep loading core.js for BC reasons static::core(); @@ -87,7 +87,7 @@ public static function core() return; } - JHtml::_('script', 'system/core.js', false, true); + JHtml::_('script', 'system/core.js', array('version' => 'auto', 'relative' => true)); static::$loaded[__METHOD__] = true; return; @@ -113,7 +113,7 @@ public static function caption($selector = 'img.caption') // Include jQuery JHtml::_('jquery.framework'); - JHtml::_('script', 'system/caption.js', false, true); + JHtml::_('script', 'system/caption.js', array('version' => 'auto', 'relative' => true)); // Attach caption to document JFactory::getDocument()->addScriptDeclaration( @@ -186,8 +186,8 @@ public static function formvalidator() // Add validate.js language strings JText::script('JLIB_FORM_FIELD_INVALID'); - JHtml::_('script', 'system/punycode.js', false, true); - JHtml::_('script', 'system/validate.js', false, true); + JHtml::_('script', 'system/punycode.js', array('version' => 'auto', 'relative' => true)); + JHtml::_('script', 'system/validate.js', array('version' => 'auto', 'relative' => true)); static::$loaded[__METHOD__] = true; } @@ -209,7 +209,7 @@ public static function switcher() // Include jQuery JHtml::_('jquery.framework'); - JHtml::_('script', 'system/switcher.js', true, true); + JHtml::_('script', 'system/switcher.js', array('framework' => true, 'version' => 'auto', 'relative' => true)); $script = " document.switcher = null; @@ -244,7 +244,7 @@ public static function combobox() // Include core static::core(); - JHtml::_('script', 'system/combobox.js', false, true); + JHtml::_('script', 'system/combobox.js', array('version' => 'auto', 'relative' => true)); static::$loaded[__METHOD__] = true; } @@ -358,8 +358,8 @@ public static function modal($selector = 'a.modal', $params = array()) static::framework(true); // Load the JavaScript and css - JHtml::_('script', 'system/modal.js', true, true); - JHtml::_('stylesheet', 'system/modal.css', array(), true); + JHtml::_('script', 'system/modal.js', array('framework' => true, 'version' => 'auto', 'relative' => true)); + JHtml::_('stylesheet', 'system/modal.css', array('version' => 'auto', 'relative' => true)); } $sig = md5(serialize(array($selector, $params))); @@ -473,7 +473,7 @@ public static function multiselect($id = 'adminForm') // Include jQuery JHtml::_('jquery.framework'); - JHtml::_('script', 'system/multiselect.js', false, true); + JHtml::_('script', 'system/multiselect.js', array('version' => 'auto', 'relative' => true)); // Attach multiselect to document JFactory::getDocument()->addScriptDeclaration( @@ -504,8 +504,8 @@ public static function tree($id, $params = array(), $root = array()) // Include MooTools framework static::framework(); - JHtml::_('script', 'system/mootree.js', true, true, false, false); - JHtml::_('stylesheet', 'system/mootree.css', array(), true); + JHtml::_('script', 'system/mootree.js', array('framework' => true, 'version' => 'auto', 'relative' => true)); + JHtml::_('stylesheet', 'system/mootree.css', array('version' => 'auto', 'relative' => true)); if (isset(static::$loaded[__METHOD__][$id])) { @@ -571,11 +571,12 @@ public static function calendar() } $document = JFactory::getDocument(); - $tag = JFactory::getLanguage()->getTag(); + $tag = JFactory::getLanguage()->getTag(); + $attribs = array('title' => JText::_('JLIB_HTML_BEHAVIOR_GREEN'), 'media' => 'all'); - JHtml::_('stylesheet', 'system/calendar-jos.css', array(' title' => JText::_('JLIB_HTML_BEHAVIOR_GREEN'), ' media' => 'all'), true); - JHtml::_('script', $tag . '/calendar.js', false, true); - JHtml::_('script', $tag . '/calendar-setup.js', false, true); + JHtml::_('stylesheet', 'system/calendar-jos.css', array('version' => 'auto', 'relative' => true), $attribs); + JHtml::_('script', $tag . '/calendar.js', array('version' => 'auto', 'relative' => true)); + JHtml::_('script', $tag . '/calendar-setup.js', array('version' => 'auto', 'relative' => true)); $translation = static::calendartranslation(); @@ -607,8 +608,8 @@ public static function colorpicker() // Include jQuery JHtml::_('jquery.framework'); - JHtml::_('script', 'jui/jquery.minicolors.min.js', false, true); - JHtml::_('stylesheet', 'jui/jquery.minicolors.css', false, true); + JHtml::_('script', 'jui/jquery.minicolors.min.js', array('version' => 'auto', 'relative' => true)); + JHtml::_('stylesheet', 'jui/jquery.minicolors.css', array('version' => 'auto', 'relative' => true)); JFactory::getDocument()->addScriptDeclaration(" jQuery(document).ready(function (){ jQuery('.minicolors').each(function() { @@ -653,8 +654,8 @@ public static function simplecolorpicker() // Include jQuery JHtml::_('jquery.framework'); - JHtml::_('script', 'jui/jquery.simplecolors.min.js', false, true); - JHtml::_('stylesheet', 'jui/jquery.simplecolors.css', false, true); + JHtml::_('script', 'jui/jquery.simplecolors.min.js', array('version' => 'auto', 'relative' => true)); + JHtml::_('stylesheet', 'jui/jquery.simplecolors.css', array('version' => 'auto', 'relative' => true)); JFactory::getDocument()->addScriptDeclaration(" jQuery(document).ready(function (){ jQuery('select.simplecolors').simplecolors(); @@ -708,7 +709,7 @@ public static function keepalive() JFactory::getDocument()->addScriptOptions('system.keepalive', array('interval' => $refreshTime * 1000, 'uri' => JRoute::_($uri))); // Add script. - JHtml::script('system/keepalive.js', false, true); + JHtml::_('script', 'system/keepalive.js', array('version' => 'auto', 'relative' => true)); static::$loaded[__METHOD__] = true; @@ -755,7 +756,7 @@ public static function highlighter(array $terms, $start = 'highlighter-start', $ // Include jQuery JHtml::_('jquery.framework'); - JHtml::_('script', 'system/highlighter.js', false, true); + JHtml::_('script', 'system/highlighter.js', array('version' => 'auto', 'relative' => true)); foreach ($terms as $i => $term) { @@ -963,7 +964,7 @@ public static function tabstate() } // Include jQuery JHtml::_('jquery.framework'); - JHtml::_('script', 'system/tabs-state.js', false, true); + JHtml::_('script', 'system/tabs-state.js', array('version' => 'auto', 'relative' => true)); self::$loaded[__METHOD__] = true; } @@ -1000,7 +1001,8 @@ public static function polyfill($polyfillTypes = null, $conditionalBrowser = nul } // If include according to browser. - $scriptOptions = !is_null($conditionalBrowser) ? array('relative' => true, 'conditional' => $conditionalBrowser) : array('relative' => true); + $scriptOptions = array('version' => 'auto', 'relative' => true); + $scriptOptions = $conditionalBrowser !== null ? array_replace($scriptOptions, array('conditional' => $conditionalBrowser)) : $scriptOptions; JHtml::_('script', 'system/polyfill.' . $polyfillType . '.js', $scriptOptions); diff --git a/libraries/cms/html/bootstrap.php b/libraries/cms/html/bootstrap.php index 7824b3c9db7b5..07a9db6a67aa0 100644 --- a/libraries/cms/html/bootstrap.php +++ b/libraries/cms/html/bootstrap.php @@ -46,7 +46,7 @@ public static function affix($selector = 'affix', $params = array()) if (!isset(static::$loaded[__METHOD__][$sig])) { // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); // Setup options object $opt['offset'] = isset($params['offset']) ? $params['offset'] : 10; @@ -83,7 +83,7 @@ public static function alert($selector = 'alert') } // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); // Attach the alerts to the document JFactory::getDocument()->addScriptDeclaration( @@ -113,7 +113,7 @@ public static function button($selector = 'button') } // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); // Attach the button to the document JFactory::getDocument()->addScriptDeclaration( @@ -147,7 +147,7 @@ public static function carousel($selector = 'carousel', $params = array()) if (!isset(static::$loaded[__METHOD__][$sig])) { // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); // Setup options object $opt['interval'] = isset($params['interval']) ? (int) $params['interval'] : 5000; @@ -185,7 +185,7 @@ public static function dropdown($selector = 'dropdown-toggle') } // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); // Attach the dropdown to the document JFactory::getDocument()->addScriptDeclaration( @@ -225,7 +225,7 @@ public static function framework($debug = null) $debug = JDEBUG; } - JHtml::_('script', 'jui/bootstrap.min.js', false, true, false, false, $debug); + JHtml::_('script', 'jui/bootstrap.min.js', array('version' => 'auto', 'relative' => true, 'detectDebug' => $debug)); static::$loaded[__METHOD__] = true; return; @@ -256,7 +256,7 @@ public static function modal($selector = 'modal', $params = array()) if (!isset(static::$loaded[__METHOD__][$sig])) { // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); // Setup options object $opt['backdrop'] = isset($params['backdrop']) ? (boolean) $params['backdrop'] : true; @@ -303,7 +303,7 @@ public static function modal($selector = 'modal', $params = array()) public static function renderModal($selector = 'modal', $params = array(), $body = '') { // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); $layoutData = array( 'selector' => $selector, @@ -348,7 +348,7 @@ public static function popover($selector = '.hasPopover', $params = array()) } // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); $opt['animation'] = isset($params['animation']) ? $params['animation'] : null; $opt['html'] = isset($params['html']) ? $params['html'] : true; @@ -391,7 +391,7 @@ public static function scrollspy($selector = 'navbar', $params = array()) if (!isset(static::$loaded[__METHOD__][$sig])) { // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); // Setup options object $opt['offset'] = isset($params['offset']) ? (int) $params['offset'] : 10; @@ -440,7 +440,7 @@ public static function tooltip($selector = '.hasTooltip', $params = array()) if (!isset(static::$loaded[__METHOD__][$selector])) { // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); // Setup options object $opt['animation'] = isset($params['animation']) ? (boolean) $params['animation'] : null; @@ -505,8 +505,8 @@ public static function tooltipExtended($extended = true) { if ($extended) { - JHtml::_('script', 'jui/bootstrap-tooltip-extended.min.js', false, true); - JHtml::_('stylesheet', 'jui/bootstrap-tooltip-extended.css', false, true); + JHtml::_('script', 'jui/bootstrap-tooltip-extended.min.js', array('version' => 'auto', 'relative' => true)); + JHtml::_('stylesheet', 'jui/bootstrap-tooltip-extended.css', array('version' => 'auto', 'relative' => true)); } } @@ -541,7 +541,7 @@ public static function typeahead($selector = '.typeahead', $params = array()) if (!isset(static::$loaded[__METHOD__][$selector])) { // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); // Setup options object $opt['source'] = isset($params['source']) ? $params['source'] : null; @@ -593,7 +593,7 @@ public static function startAccordion($selector = 'myAccordian', $params = array if (!isset(static::$loaded[__METHOD__][$selector])) { // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); // Setup options object $opt['parent'] = isset($params['parent']) ? ($params['parent'] == true ? '#' . $selector : $params['parent']) : false; @@ -717,7 +717,7 @@ public static function startTabSet($selector = 'myTab', $params = array()) if (!isset(static::$loaded[__METHOD__][$sig])) { // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); // Setup options object $opt['active'] = (isset($params['active']) && ($params['active'])) ? (string) $params['active'] : ''; @@ -804,7 +804,7 @@ public static function startPane($selector = 'myTab', $params = array()) if (!isset(static::$loaded['JHtmlBootstrap::startTabSet'][$sig])) { // Include Bootstrap framework - static::framework(); + JHtml::_('bootstrap.framework'); // Setup options object $opt['active'] = isset($params['active']) ? (string) $params['active'] : ''; @@ -887,15 +887,15 @@ public static function loadCss($includeMainCss = true, $direction = 'ltr', $attr // Load Bootstrap main CSS if ($includeMainCss) { - JHtml::_('stylesheet', 'jui/bootstrap.min.css', $attribs, true); - JHtml::_('stylesheet', 'jui/bootstrap-responsive.min.css', $attribs, true); - JHtml::_('stylesheet', 'jui/bootstrap-extended.css', $attribs, true); + JHtml::_('stylesheet', 'jui/bootstrap.min.css', array('version' => 'auto', 'relative' => true), $attribs); + JHtml::_('stylesheet', 'jui/bootstrap-responsive.min.css', array('version' => 'auto', 'relative' => true), $attribs); + JHtml::_('stylesheet', 'jui/bootstrap-extended.css', array('version' => 'auto', 'relative' => true), $attribs); } // Load Bootstrap RTL CSS if ($direction === 'rtl') { - JHtml::_('stylesheet', 'jui/bootstrap-rtl.css', $attribs, true); + JHtml::_('stylesheet', 'jui/bootstrap-rtl.css', array('version' => 'auto', 'relative' => true), $attribs); } } } diff --git a/libraries/cms/html/html.php b/libraries/cms/html/html.php index ee7733fa8dc7b..12b8c8c1e1d2d 100644 --- a/libraries/cms/html/html.php +++ b/libraries/cms/html/html.php @@ -370,11 +370,9 @@ protected static function includeRelativeFiles($folder, $file, $relative, $detec * Detect if we received a file in the format name.min.ext * If so, strip the .min part out, otherwise append -uncompressed */ - if (strrpos($strip, '.min', '-4')) + if (strlen($strip) > 4 && preg_match('#\.min$#', $strip)) { - $position = strrpos($strip, '.min', '-4'); - $filename = str_replace('.min', '.', $strip, $position); - $files[] = $filename . $ext; + $files[] = preg_replace('#\.min$#', '.', $strip) . $ext; } else { @@ -517,11 +515,9 @@ protected static function includeRelativeFiles($folder, $file, $relative, $detec * Detect if we received a file in the format name.min.ext * If so, strip the .min part out, otherwise append -uncompressed */ - if (strrpos($strip, '.min', '-4')) + if (strlen($strip) > 4 && preg_match('#\.min$#', $strip)) { - $position = strrpos($strip, '.min', '-4'); - $filename = str_replace('.min', '.', $strip, $position); - $files[] = $filename . $ext; + $files[] = preg_replace('#\.min$#', '.', $strip) . $ext; } else { @@ -591,54 +587,53 @@ public static function image($file, $alt, $attribs = null, $relative = false, $r /** * Write a `` element to load a CSS file * - * @param string $file Path to file - * @param array $attribs Attributes to be added to the `` element - * @param boolean $relative Flag if the path to the file is relative to the /media folder (and searches in template). - * @param boolean $returnPath Flag if the file path should be returned or if the file should be included in the global JDocument instance - * @param boolean $detect_browser Flag if the browser should be detected to include specific browser files. - * This will try to include file, `file_*browser*`, `file_*browser*_*major*`, `file_*browser*_*major*_*minor*` - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Navigator browser major.minor
    Safari 3.0.x konqueror 522.x
    Safari 3.1.x and 3.2.x konqueror 525.x
    Safari 4.0 to 4.0.2 konqueror 530.x
    Safari 4.0.3 to 4.0.4 konqueror 531.x
    iOS 4.0 Safari konqueror 532.x
    Safari 5.0 konqueror 533.x
    Google Chrome 1.0 konqueror 528.x
    Google Chrome 2.0 konqueror 530.x
    Google Chrome 3.0 and 4.x konqueror 532.x
    Google Chrome 5.0 konqueror 533.x
    Internet Explorer 5.5 msie 5.5
    Internet Explorer 6.x msie 6.x
    Internet Explorer 7.x msie 7.x
    Internet Explorer 8.x msie 8.x
    Firefox mozilla 5.0
    - * @param boolean $detect_debug Flag if debug mode is enabled to include uncompressed files if debug is on. + * @param string $file Path to file + * @param array $options Array of options. Example: array('version' => 'auto', 'conditional' => 'lt IE 9') + * @param array $attribs Array of attributes. Example: array('id' => 'scriptid', 'async' => 'async', 'data-test' => 1) * * @return array|string|null nothing if $returnPath is false, null, path or array of path if specific CSS browser files were detected * * @see JBrowser * @since 1.5 + * @deprecated 4.0 The (file, attribs, relative, pathOnly, detectBrowser, detectDebug) method signature is deprecated, + * use (file, options, attributes) instead. */ - public static function stylesheet($file, $attribs = array(), $relative = false, $returnPath = false, $detect_browser = true, $detect_debug = true) + public static function stylesheet($file, $options = array(), $attribs = array()) { - $includes = static::includeRelativeFiles('css', $file, $relative, $detect_browser, $detect_debug); + // B/C before __DEPLOY_VERSION__ + if (!is_array($attribs)) + { + JLog::add('The stylesheet method signature used has changed, use (file, options, attributes) instead.', JLog::WARNING, 'deprecated'); + + $argList = func_get_args(); + $options = array(); + + // Old parameters. + $attribs = isset($argList[1]) ? $argList[1] : array(); + $options['relative'] = isset($argList[2]) ? $argList[2] : false; + $options['pathOnly'] = isset($argList[3]) ? $argList[3] : false; + $options['detectBrowser'] = isset($argList[4]) ? $argList[4] : true; + $options['detectDebug'] = isset($argList[5]) ? $argList[5] : true; + } + else + { + $options['relative'] = isset($options['relative']) ? $options['relative'] : false; + $options['pathOnly'] = isset($options['pathOnly']) ? $options['pathOnly'] : false; + $options['detectBrowser'] = isset($options['detectBrowser']) ? $options['detectBrowser'] : true; + $options['detectDebug'] = isset($options['detectDebug']) ? $options['detectDebug'] : true; + } + + $includes = static::includeRelativeFiles('css', $file, $options['relative'], $options['detectBrowser'], $options['detectDebug']); // If only path is required - if ($returnPath) + if ($options['pathOnly']) { - if (count($includes) == 0) + if (count($includes) === 0) { return; } - if (count($includes) == 1) + if (count($includes) === 1) { return $includes[0]; } @@ -651,7 +646,13 @@ public static function stylesheet($file, $attribs = array(), $relative = false, foreach ($includes as $include) { - $document->addStyleSheet($include, 'text/css', null, $attribs); + // If there is already a version hash in the script reference (by using deprecated MD5SUM). + if ($pos = strpos($include, '?') !== false) + { + $options['version'] = substr($include, $pos + 1); + } + + $document->addStyleSheet($include, $options, $attribs); } } diff --git a/libraries/cms/html/jquery.php b/libraries/cms/html/jquery.php index 3a3f749f61179..bfc55ad17ca9d 100644 --- a/libraries/cms/html/jquery.php +++ b/libraries/cms/html/jquery.php @@ -49,18 +49,18 @@ public static function framework($noConflict = true, $debug = null, $migrate = t $debug = (boolean) JFactory::getConfig()->get('debug'); } - JHtml::_('script', 'jui/jquery.min.js', false, true, false, false, $debug); + JHtml::_('script', 'jui/jquery.min.js', array('version' => 'auto', 'relative' => true, 'detectDebug' => $debug)); // Check if we are loading in noConflict if ($noConflict) { - JHtml::_('script', 'jui/jquery-noconflict.js', false, true, false, false, false); + JHtml::_('script', 'jui/jquery-noconflict.js', array('version' => 'auto', 'relative' => true)); } // Check if we are loading Migrate if ($migrate) { - JHtml::_('script', 'jui/jquery-migrate.min.js', false, true, false, false, $debug); + JHtml::_('script', 'jui/jquery-migrate.min.js', array('version' => 'auto', 'relative' => true, 'detectDebug' => $debug)); } static::$loaded[__METHOD__] = true; @@ -100,7 +100,7 @@ public static function ui(array $components = array('core'), $debug = null) // Only attempt to load the component if it's supported in core and hasn't already been loaded if (in_array($component, $supported) && empty(static::$loaded[__METHOD__][$component])) { - JHtml::_('script', 'jui/jquery.ui.' . $component . '.min.js', false, true, false, false, $debug); + JHtml::_('script', 'jui/jquery.ui.' . $component . '.min.js', array('version' => 'auto', 'relative' => true, 'detectDebug' => $debug)); static::$loaded[__METHOD__][$component] = true; } } diff --git a/libraries/cms/html/number.php b/libraries/cms/html/number.php index cfa1cbe176ce3..c1f52932f1bad 100644 --- a/libraries/cms/html/number.php +++ b/libraries/cms/html/number.php @@ -105,6 +105,8 @@ public static function bytes($bytes, $unit = 'auto', $precision = 2, $iec = fals $suffix = $stdSuffixes[$i]; } - return round($oBytes / pow($base, $i), (int) $precision) . ' ' . $suffix; + return number_format( + round($oBytes / pow($base, $i), (int) $precision), (int) $precision, JText::_('DECIMALS_SEPARATOR'), JText::_('THOUSANDS_SEPARATOR') + ) . ' ' . $suffix; } } diff --git a/libraries/cms/html/searchtools.php b/libraries/cms/html/searchtools.php index 6120738a4af30..d273916e79d4e 100644 --- a/libraries/cms/html/searchtools.php +++ b/libraries/cms/html/searchtools.php @@ -43,8 +43,8 @@ public static function main() } // Load the jQuery plugin && CSS - JHtml::_('script', 'jui/jquery.searchtools.min.js', false, true); - JHtml::_('stylesheet', 'jui/jquery.searchtools.css', false, true); + JHtml::_('script', 'jui/jquery.searchtools.min.js', array('version' => 'auto', 'relative' => true)); + JHtml::_('stylesheet', 'jui/jquery.searchtools.css', array('version' => 'auto', 'relative' => true)); static::$loaded[__METHOD__] = true; } diff --git a/libraries/cms/html/tabs.php b/libraries/cms/html/tabs.php index fab03ab4e0efe..9940ea5062514 100644 --- a/libraries/cms/html/tabs.php +++ b/libraries/cms/html/tabs.php @@ -103,7 +103,7 @@ protected static function loadBehavior($group, $params = array()) $document = JFactory::getDocument(); $document->addScriptDeclaration($js); - JHtml::_('script', 'system/tabs.js', false, true); + JHtml::_('script', 'system/tabs.js', array('version' => 'auto', 'relative' => true)); $loaded[(string) $group] = true; } diff --git a/libraries/cms/installer/adapter/package.php b/libraries/cms/installer/adapter/package.php index 54a3d917d8383..830bcc5e4f2fc 100644 --- a/libraries/cms/installer/adapter/package.php +++ b/libraries/cms/installer/adapter/package.php @@ -125,7 +125,7 @@ protected function copyBaseFiles() } $tmpInstaller = new JInstaller; - $installResult = $tmpInstaller->{$this->route}($package['dir']); + $installResult = $tmpInstaller->install($package['dir']); if (!$installResult) { diff --git a/libraries/cms/language/multilang.php b/libraries/cms/language/multilang.php index 0d4905c6a544d..0b1c0cbcf511e 100644 --- a/libraries/cms/language/multilang.php +++ b/libraries/cms/language/multilang.php @@ -69,28 +69,13 @@ public static function isEnabled() * @return array of language extension objects. * * @since 3.5 + * @deprecated __DEPLOY_VERSION__ Use JLanguageHelper::getInstalledLanguages(0) instead. */ public static function getSiteLangs() { - // To avoid doing duplicate database queries. - static $multilangSiteLangs = null; - - if (!isset($multilangSiteLangs)) - { - // Check for published Site Languages. - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select('element') - ->from('#__extensions') - ->where('type = ' . $db->quote('language')) - ->where('client_id = 0') - ->where('enabled = 1'); - $db->setQuery($query); - - $multilangSiteLangs = $db->loadObjectList('element'); - } + JLog::add(__METHOD__ . ' is deprecated. Use JLanguageHelper::getInstalledLanguages(0) instead.', JLog::WARNING, 'deprecated'); - return $multilangSiteLangs; + return JLanguageHelper::getInstalledLanguages(0); } /** diff --git a/libraries/cms/toolbar/button/slider.php b/libraries/cms/toolbar/button/slider.php index 4377b2ca9f346..109028eab80ee 100644 --- a/libraries/cms/toolbar/button/slider.php +++ b/libraries/cms/toolbar/button/slider.php @@ -40,7 +40,7 @@ class JToolbarButtonSlider extends JToolbarButton */ public function fetchButton($type = 'Slider', $name = '', $text = '', $url = '', $width = 640, $height = 480, $onClose = '') { - JHtml::_('script', 'jui/cms.js', false, true); + JHtml::_('script', 'jui/cms.js', array('version' => 'auto', 'relative' => true)); // Store all data to the options array for use with JLayout $options = array(); diff --git a/libraries/fof/form/field/actions.php b/libraries/fof/form/field/actions.php index fc232da742c59..5b3267f9bb8bb 100644 --- a/libraries/fof/form/field/actions.php +++ b/libraries/fof/form/field/actions.php @@ -8,8 +8,6 @@ // Protect from unauthorized access defined('FOF_INCLUDED') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for FOF * Supports a generic list of options. @@ -17,7 +15,7 @@ * @package FrameworkOnFramework * @since 2.0 */ -class FOFFormFieldActions extends JFormFieldList implements FOFFormField +class FOFFormFieldActions extends JFormAbstractlist implements FOFFormField { protected $static; diff --git a/libraries/fof/form/field/components.php b/libraries/fof/form/field/components.php index f236632b0eb2d..1fdafddde23dd 100644 --- a/libraries/fof/form/field/components.php +++ b/libraries/fof/form/field/components.php @@ -8,8 +8,6 @@ // Protect from unauthorized access defined('FOF_INCLUDED') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for FOF * Components installed on the site @@ -17,7 +15,7 @@ * @package FrameworkOnFramework * @since 2.1 */ -class FOFFormFieldComponents extends JFormFieldList implements FOFFormField +class FOFFormFieldComponents extends JFormAbstractlist implements FOFFormField { protected $static; diff --git a/libraries/fof/form/field/list.php b/libraries/fof/form/field/list.php index 1c9ee7bf01bf0..1765f0946edce 100644 --- a/libraries/fof/form/field/list.php +++ b/libraries/fof/form/field/list.php @@ -8,8 +8,6 @@ // Protect from unauthorized access defined('FOF_INCLUDED') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for FOF * Supports a generic list of options. @@ -17,7 +15,7 @@ * @package FrameworkOnFramework * @since 2.0 */ -class FOFFormFieldList extends JFormFieldList implements FOFFormField +class FOFFormFieldList extends JFormAbstractlist implements FOFFormField { protected $static; diff --git a/libraries/fof/form/field/published.php b/libraries/fof/form/field/published.php index ceea5439cec54..be420a1a9a04b 100644 --- a/libraries/fof/form/field/published.php +++ b/libraries/fof/form/field/published.php @@ -8,8 +8,6 @@ // Protect from unauthorized access defined('FOF_INCLUDED') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for FOF * Supports a generic list of options. @@ -17,7 +15,7 @@ * @package FrameworkOnFramework * @since 2.0 */ -class FOFFormFieldPublished extends JFormFieldList implements FOFFormField +class FOFFormFieldPublished extends JFormAbstractlist implements FOFFormField { protected $static; diff --git a/libraries/joomla/application/web.php b/libraries/joomla/application/web.php index 61f55668973f0..c993295e708d0 100644 --- a/libraries/joomla/application/web.php +++ b/libraries/joomla/application/web.php @@ -93,6 +93,33 @@ class JApplicationWeb extends JApplicationBase 308 => 'HTTP/1.1 308 Permanent Redirect', ); + /** + * A map of HTTP Response headers which may only send a single value, all others + * are considered to allow multiple + * + * @var object + * @since 3.5.2 + * @see https://tools.ietf.org/html/rfc7230 + */ + private $singleValueResponseHeaders = array( + 'status', // This is not a valid header name, but the representation used by Joomla to identify the HTTP Response Code + 'Content-Length', + 'Host', + 'Content-Type', + 'Content-Location', + 'Date', + 'Location', + 'Retry-After', + 'Server', + 'Mime-Version', + 'Last-Modified', + 'ETag', + 'Accept-Ranges', + 'Content-Range', + 'Age', + 'Expires' + ); + /** * Class constructor. * @@ -611,23 +638,36 @@ public function setHeader($name, $value, $replace = false) $name = (string) $name; $value = (string) $value; - // If the replace flag is set, unset all known headers with the given name. - if ($replace) + // Create an array of duplicate header names + $keys = false; + if ($this->response->headers) { + $names = array(); foreach ($this->response->headers as $key => $header) { - if ($name == $header['name']) - { - unset($this->response->headers[$key]); - } + $names[$key] = $header['name']; } + // Find existing headers by name + $keys = array_keys($names, $name); + } - // Clean up the array as unsetting nested arrays leaves some junk. - $this->response->headers = array_values($this->response->headers); + // Remove if $replace is true and there are duplicate names + if ($replace && $keys) + { + $this->response->headers = array_diff_key($this->response->headers, array_flip($keys)); } - // Add the header to the internal array. - $this->response->headers[] = array('name' => $name, 'value' => $value); + /** + * If no keys found, safe to insert (!$keys) + * If ($keys && $replace) it's a replacement and previous have been deleted + * if($keys && !in_array...) it's a multiple value header + */ + $single = in_array($name, $this->singleValueResponseHeaders); + if ($value && (!$keys || ($keys && ($replace || !$single)))) + { + // Add the header to the internal array. + $this->response->headers[] = array('name' => $name, 'value' => $value); + } return $this; } @@ -636,8 +676,8 @@ public function setHeader($name, $value, $replace = false) * Method to get the array of response headers to be sent when the response is sent * to the client. * - * @return array - * + * @return array * + * * @since 11.3 */ public function getHeaders() @@ -670,6 +710,8 @@ public function sendHeaders() { if (!$this->checkHeadersSent()) { + // Creating an array of headers, making arrays of headers with multiple values + $val = array(); foreach ($this->response->headers as $header) { if ('status' == strtolower($header['name'])) @@ -679,7 +721,8 @@ public function sendHeaders() } else { - $this->header($header['name'] . ': ' . $header['value']); + $val[$header['name']] = !isset($val[$header['name']])?$header['value']:implode(', ', array($val[$header['name']], $header['value'])); + $this->header($header['name'] . ': ' . $val[$header['name']], true); } } } diff --git a/libraries/joomla/controller/base.php b/libraries/joomla/controller/base.php index d4555ec1cd1aa..abf4ae19f28ec 100644 --- a/libraries/joomla/controller/base.php +++ b/libraries/joomla/controller/base.php @@ -9,6 +9,8 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Application\AbstractApplication; + /** * Joomla Platform Base Controller Class * @@ -19,7 +21,7 @@ abstract class JControllerBase implements JController /** * The application object. * - * @var JApplicationBase + * @var AbstractApplication * @since 12.1 */ protected $app; @@ -35,12 +37,12 @@ abstract class JControllerBase implements JController /** * Instantiate the controller. * - * @param JInput $input The input object. - * @param JApplicationBase $app The application object. + * @param JInput $input The input object. + * @param AbstractApplication $app The application object. * * @since 12.1 */ - public function __construct(JInput $input = null, JApplicationBase $app = null) + public function __construct(JInput $input = null, AbstractApplication $app = null) { // Setup dependencies. $this->app = isset($app) ? $app : $this->loadApplication(); @@ -50,7 +52,7 @@ public function __construct(JInput $input = null, JApplicationBase $app = null) /** * Get the application object. * - * @return JApplicationBase The application object. + * @return AbstractApplication The application object. * * @since 12.1 */ @@ -112,7 +114,7 @@ public function unserialize($input) /** * Load the application object. * - * @return JApplicationBase The application object. + * @return AbstractApplication The application object. * * @since 12.1 */ diff --git a/libraries/joomla/controller/controller.php b/libraries/joomla/controller/controller.php index 9c123ef3627f6..40f63d1e19afe 100644 --- a/libraries/joomla/controller/controller.php +++ b/libraries/joomla/controller/controller.php @@ -32,7 +32,7 @@ public function execute(); /** * Get the application object. * - * @return JApplicationBase The application object. + * @return AbstractApplication The application object. * * @since 12.1 */ @@ -41,7 +41,7 @@ public function getApplication(); /** * Get the input object. * - * @return \Joomla\Input\Input The input object. + * @return JInput The input object. * * @since 12.1 */ diff --git a/libraries/joomla/database/driver/postgresql.php b/libraries/joomla/database/driver/postgresql.php index 94e148d0ee9ad..7ac84fbe7344c 100644 --- a/libraries/joomla/database/driver/postgresql.php +++ b/libraries/joomla/database/driver/postgresql.php @@ -1503,9 +1503,18 @@ public function updateObject($table, &$object, $key, $nulls = false) * @return integer The SQL Error number * * @since 3.4.6 + * + * @throws \JDatabaseExceptionExecuting Thrown if the global cursor is false indicating a query failed */ protected function getErrorNumber() { + if ($this->cursor === false) + { + $this->errorMsg = pg_last_error($this->connection); + + throw new JDatabaseExceptionExecuting($this->sql, $this->errorMsg); + } + return (int) pg_result_error_field($this->cursor, PGSQL_DIAG_SQLSTATE) . ' '; } diff --git a/libraries/joomla/document/document.php b/libraries/joomla/document/document.php index 501dc24019942..483222df6586d 100644 --- a/libraries/joomla/document/document.php +++ b/libraries/joomla/document/document.php @@ -460,7 +460,7 @@ public function setMetaData($name, $content, $attribute = 'name') public function addScript($url, $options = array(), $attribs = array()) { // B/C before __DEPLOY_VERSION__ - if (!is_array($options) && !is_array($attribs)) + if (!is_array($options) && (!is_array($attribs) || $attribs === array())) { JLog::add('The addScript method signature used has changed, use (url, options, attributes) instead.', JLog::WARNING, 'deprecated'); @@ -517,7 +517,7 @@ public function addScriptVersion($url, $options = array(), $attribs = array()) JLog::add('The method is deprecated, use addScript(url, attributes, options) instead.', JLog::WARNING, 'deprecated'); // B/C before __DEPLOY_VERSION__ - if (!is_array($options) && !is_array($attribs)) + if (!is_array($options) && (!is_array($attribs) || $attribs === array())) { $argList = func_get_args(); $options = array(); @@ -632,19 +632,60 @@ public function getScriptOptions($key = null) * Adds a linked stylesheet to the page * * @param string $url URL to the linked style sheet - * @param string $type Mime encoding type - * @param string $media Media type that this stylesheet applies to - * @param array $attribs Array of attributes + * @param array $options Array of options. Example: array('version' => 'auto', 'conditional' => 'lt IE 9') + * @param array $attribs Array of attributes. Example: array('id' => 'stylesheet', 'data-test' => 1) * * @return JDocument instance of $this to allow chaining * * @since 11.1 + * @deprecated 4.0 The (url, mime, media, attribs) method signature is deprecated, use (url, options, attributes) instead. */ - public function addStyleSheet($url, $type = 'text/css', $media = null, $attribs = array()) + public function addStyleSheet($url, $options = array(), $attribs = array()) { - $this->_styleSheets[$url]['mime'] = $type; - $this->_styleSheets[$url]['media'] = $media; - $this->_styleSheets[$url]['attribs'] = $attribs; + // B/C before __DEPLOY_VERSION__ + if (!is_array($options) && (!is_array($attribs) || $attribs === array())) + { + JLog::add('The addStyleSheet method signature used has changed, use (url, options, attributes) instead.', JLog::WARNING, 'deprecated'); + + $argList = func_get_args(); + $options = array(); + $attribs = array(); + + // Old mime type parameter. + if (!empty($argList[1])) + { + $attribs['mime'] = $argList[1]; + } + + // Old media parameter. + if (isset($argList[2]) && $argList[2]) + { + $attribs['media'] = $argList[2]; + } + + // Old attribs parameter. + if (isset($argList[3]) && $argList[3]) + { + $attribs = array_replace($attribs, $argList[3]); + } + } + + // Default value for type. + if (!isset($attribs['type']) && !isset($attribs['mime'])) + { + $attribs['type'] = 'text/css'; + } + + $this->_styleSheets[$url] = isset($this->_styleSheets[$url]) ? array_replace($this->_styleSheets[$url], $attribs) : $attribs; + + if (isset($this->_styleSheets[$url]['options'])) + { + $this->_styleSheets[$url]['options'] = array_replace($this->_styleSheets[$url]['options'], $options); + } + else + { + $this->_styleSheets[$url]['options'] = $options; + } return $this; } @@ -654,29 +695,53 @@ public function addStyleSheet($url, $type = 'text/css', $media = null, $attribs * If not specified Joomla! automatically handles versioning * * @param string $url URL to the linked style sheet - * @param string $version Version of the stylesheet - * @param string $type Mime encoding type - * @param string $media Media type that this stylesheet applies to - * @param array $attribs Array of attributes + * @param array $options Array of options. Example: array('version' => 'auto', 'conditional' => 'lt IE 9') + * @param array $attribs Array of attributes. Example: array('id' => 'stylesheet', 'data-test' => 1) * * @return JDocument instance of $this to allow chaining * * @since 3.2 + * @deprecated 4.0 This method is deprecated, use addStyleSheet(url, options, attributes) instead. */ - public function addStyleSheetVersion($url, $version = null, $type = "text/css", $media = null, $attribs = array()) + public function addStyleSheetVersion($url, $options = array(), $attribs = array()) { - // Automatic version - if ($version === null) + JLog::add('The method is deprecated, use addStyleSheet(url, attributes, options) instead.', JLog::WARNING, 'deprecated'); + + // B/C before __DEPLOY_VERSION__ + if (!is_array($options) && (!is_array($attribs) || $attribs === array())) { - $version = $this->getMediaVersion(); - } + $argList = func_get_args(); + $options = array(); + $attribs = array(); + + // Old version parameter. + $options['version'] = isset($argList[1]) && !is_null($argList[1]) ? $argList[1] : 'auto'; + + // Old mime type parameter. + if (!empty($argList[2])) + { + $attribs['mime'] = $argList[2]; + } + + // Old media parameter. + if (isset($argList[3]) && $argList[3]) + { + $attribs['media'] = $argList[3]; + } - if (!empty($version) && strpos($url, '?') === false) + // Old attribs parameter. + if (isset($argList[4]) && $argList[4]) + { + $attribs = array_replace($attribs, $argList[4]); + } + } + // Default value for version. + else { - $url .= '?' . $version; + $options['version'] = 'auto'; } - return $this->addStyleSheet($url, $type, $media, $attribs); + return $this->addStyleSheet($url, $options, $attribs); } /** diff --git a/libraries/joomla/document/renderer/html/head.php b/libraries/joomla/document/renderer/html/head.php index 224fd2548716b..12e160fd9883c 100644 --- a/libraries/joomla/document/renderer/html/head.php +++ b/libraries/joomla/document/renderer/html/head.php @@ -63,10 +63,11 @@ public function fetchHead($document) $app->triggerEvent('onBeforeCompileHead'); // Get line endings - $lnEnd = $document->_getLineEnd(); - $tab = $document->_getTab(); - $tagEnd = ' />'; - $buffer = ''; + $lnEnd = $document->_getLineEnd(); + $tab = $document->_getTab(); + $tagEnd = ' />'; + $buffer = ''; + $mediaVersion = $document->getMediaVersion(); // Generate charset when using HTML5 (should happen first) if ($document->isHtml5()) @@ -135,29 +136,67 @@ public function fetchHead($document) $defaultCssMimes = array('text/css'); // Generate stylesheet links - foreach ($document->_styleSheets as $strSrc => $strAttr) + foreach ($document->_styleSheets as $src => $attribs) { - $buffer .= $tab . 'isHtml5() || !in_array($strAttr['mime'], $defaultCssMimes))) + // Check if script uses media version. + if (isset($attribs['options']['version']) && $attribs['options']['version'] && strpos($src, '?') === false + && ($mediaVersion || $attribs['options']['version'] !== 'auto')) { - $buffer .= ' type="' . $strAttr['mime'] . '"'; + $src .= '?' . ($attribs['options']['version'] === 'auto' ? $mediaVersion : $attribs['options']['version']); } - if (!is_null($strAttr['media'])) + $buffer .= $tab; + + // This is for IE conditional statements support. + if (!is_null($conditional)) { - $buffer .= ' media="' . $strAttr['media'] . '"'; + $buffer .= ''; + } + + $buffer .= $lnEnd; } // Generate stylesheet declarations @@ -206,7 +245,6 @@ public function fetchHead($document) $defaultJsMimes = array('text/javascript', 'application/javascript', 'text/x-javascript', 'application/x-javascript'); $html5NoValueAttributes = array('defer', 'async'); - $mediaVersion = $document->getMediaVersion(); // Generate script file links foreach ($document->_scripts as $src => $attribs) @@ -215,7 +253,8 @@ public function fetchHead($document) $conditional = isset($attribs['options']) && isset($attribs['options']['conditional']) ? $attribs['options']['conditional'] : null; // Check if script uses media version. - if (strpos($src, '?') === false && isset($attribs['options']) && isset($attribs['options']['version']) && $attribs['options']['version']) + if (isset($attribs['options']['version']) && $attribs['options']['version'] && strpos($src, '?') === false + && ($mediaVersion || $attribs['options']['version'] !== 'auto')) { $src .= '?' . ($attribs['options']['version'] === 'auto' ? $mediaVersion : $attribs['options']['version']); } @@ -314,6 +353,6 @@ public function fetchHead($document) $buffer .= $tab . $custom . $lnEnd; } - return $buffer; + return ltrim($buffer, $tab); } } diff --git a/libraries/joomla/form/abstractlist.php b/libraries/joomla/form/abstractlist.php new file mode 100644 index 0000000000000..ff6a829ba78e9 --- /dev/null +++ b/libraries/joomla/form/abstractlist.php @@ -0,0 +1,258 @@ +class) ? ' class="' . $this->class . '"' : ''; + $attr .= !empty($this->size) ? ' size="' . $this->size . '"' : ''; + $attr .= $this->multiple ? ' multiple' : ''; + $attr .= $this->required ? ' required aria-required="true"' : ''; + $attr .= $this->autofocus ? ' autofocus' : ''; + + // To avoid user's confusion, readonly="true" should imply disabled="true". + if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1'|| (string) $this->disabled == 'true') + { + $attr .= ' disabled="disabled"'; + } + + // Initialize JavaScript field attributes. + $attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : ''; + + // Get the field options. + $options = (array) $this->getOptions(); + + // Create a read-only list (no name) with hidden input(s) to store the value(s). + if ((string) $this->readonly == '1' || (string) $this->readonly == 'true') + { + $html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id); + + // E.g. form field type tag sends $this->value as array + if ($this->multiple && is_array($this->value)) + { + if (!count($this->value)) + { + $this->value[] = ''; + } + + foreach ($this->value as $value) + { + $html[] = ''; + } + } + else + { + $html[] = ''; + } + } + else + // Create a regular list. + { + $html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); + } + + return implode($html); + } + + /** + * Method to get the field options. + * + * @return array The field option objects. + * + * @since __DEPLOY_VERSION__ + */ + protected function getOptions() + { + $fieldname = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname); + $options = array(); + + foreach ($this->element->xpath('option') as $option) + { + // Filter requirements + if ($requires = explode(',', (string) $option['requires'])) + { + // Requires multilanguage + if (in_array('multilanguage', $requires) && !JLanguageMultilang::isEnabled()) + { + continue; + } + + // Requires associations + if (in_array('associations', $requires) && !JLanguageAssociations::isEnabled()) + { + continue; + } + + // Requires vote plugin enabled + if (in_array('vote', $requires) && !JPluginHelper::isEnabled('content', 'vote')) + { + continue; + } + } + + $value = (string) $option['value']; + $text = trim((string) $option) != '' ? trim((string) $option) : $value; + + $disabled = (string) $option['disabled']; + $disabled = ($disabled == 'true' || $disabled == 'disabled' || $disabled == '1'); + $disabled = $disabled || ($this->readonly && $value != $this->value); + + $checked = (string) $option['checked']; + $checked = ($checked == 'true' || $checked == 'checked' || $checked == '1'); + + $selected = (string) $option['selected']; + $selected = ($selected == 'true' || $selected == 'selected' || $selected == '1'); + + $tmp = array( + 'value' => $value, + 'text' => JText::alt($text, $fieldname), + 'disable' => $disabled, + 'class' => (string) $option['class'], + 'selected' => ($checked || $selected), + 'checked' => ($checked || $selected), + ); + + // Set some event handler attributes. But really, should be using unobtrusive js. + $tmp['onclick'] = (string) $option['onclick']; + $tmp['onchange'] = (string) $option['onchange']; + + // Add the option object to the result set. + $options[] = (object) $tmp; + } + + if ($this->element['useglobal']) + { + $tmp = new stdClass; + $tmp->value = ''; + $tmp->text = JText::_('JGLOBAL_USE_GLOBAL'); + $component = JFactory::getApplication()->input->getCmd('option'); + + // Get correct component for menu items + if ($component == 'com_menus') + { + $link = $this->form->getData()->get('link'); + $uri = new JUri($link); + $component = $uri->getVar('option', 'com_menus'); + } + + $params = JComponentHelper::getParams($component); + $value = $params->get($this->fieldname); + + // Try with global configuration + if (is_null($value)) + { + $value = JFactory::getConfig()->get($this->fieldname); + } + + // Try with menu configuration + if (is_null($value) && JFactory::getApplication()->input->getCmd('option') == 'com_menus') + { + $value = JComponentHelper::getParams('com_menus')->get($this->fieldname); + } + + if (!is_null($value)) + { + $value = (string) $value; + + foreach ($options as $option) + { + if ($option->value === $value) + { + $value = $option->text; + + break; + } + } + + $tmp->text = JText::sprintf('JGLOBAL_USE_GLOBAL_VALUE', $value); + } + + array_unshift($options, $tmp); + } + + reset($options); + + return $options; + } + + /** + * Returns an array of key values to put in a list from the given field. + * + * @param stdClass $field The field. + * + * @return array + * + * @since __DEPLOY_VERSION__ + */ + public static function getOptionsFromField($field) + { + $options = $field->fieldparams->get('options', array()); + + if (!is_array($options)) + { + $options = json_decode($options); + } + + $data = array(); + + if (isset($options->name)) + { + foreach ($options->value as $index => $key) + { + $data[$key] = $options->name[$index]; + } + } + + return $data; + } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + foreach (self::getOptionsFromField($field) as $index => $name) + { + $element = $fieldNode->appendChild(new DOMElement('option', $name)); + $element->setAttribute('value', $index); + } + + return parent::postProcessDomNode($field, $fieldNode, $form); + } +} diff --git a/libraries/joomla/form/domfieldinterface.php b/libraries/joomla/form/domfieldinterface.php new file mode 100644 index 0000000000000..e903512966aeb --- /dev/null +++ b/libraries/joomla/form/domfieldinterface.php @@ -0,0 +1,41 @@ +getAttribute('debug', 'false') === 'true'; } + + /** + * Transforms the field into an XML element and appends it as child on the given parent. This + * is the default implementation of a field. Form fields which do support to be transformed into + * an XML Element mut implemet the JFormDomfieldinterface. + * + * @param stdClass $field The field. + * @param DOMElement $parent The field node parent. + * @param JForm $form The form. + * + * @return DOMElement + * + * @since __DEPLOY_VERSION__ + * @see JFormDomfieldinterface::appendXMLFieldTag + */ + public function appendXMLFieldTag($field, DOMElement $parent, JForm $form) + { + $app = JFactory::getApplication(); + + if ($field->params->get('show_on') == 1 && $app->isAdmin()) + { + return; + } + elseif ($field->params->get('show_on') == 2 && $app->isSite()) + { + return; + } + + $node = $parent->appendChild(new DOMElement('field')); + + $node->setAttribute('name', $field->alias); + $node->setAttribute('type', $field->type); + $node->setAttribute('default', $field->default_value); + $node->setAttribute('label', $field->label); + $node->setAttribute('description', $field->description); + $node->setAttribute('class', $field->params->get('class')); + $node->setAttribute('hint', $field->params->get('hint')); + $node->setAttribute('required', $field->required ? 'true' : 'false'); + $node->setAttribute('readonly', $field->params->get('readonly', 0) ? 'true' : 'false'); + + // Set the disabled state based on the parameter and the permission + if ($field->params->get('disabled', 0)) + { + $node->setAttribute('disabled', 'true'); + } + + foreach ($field->fieldparams->toArray() as $key => $param) + { + if (is_array($param)) + { + $param = implode(',', $param); + } + + $node->setAttribute($key, $param); + } + + $this->postProcessDomNode($field, $node, $form); + + return $node; + } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode ($field, DOMElement $fieldNode, JForm $form) + { + } + + /** + * Returns the attributes of the field as an XML string which can be loaded + * into JForm. + * + * @return string + * + * @since __DEPLOY_VERSION__ + */ + public function getFormParameters() + { + jimport('joomla.filesystem.file'); + + $reflectionClass = new ReflectionClass($this); + $fileName = dirname($reflectionClass->getFileName()) . '/../parameters/'; + $fileName .= str_replace('.php', '.xml', basename($reflectionClass->getFileName())); + + if (JFile::exists($fileName)) + { + return JFile::read($fileName); + } + + return ''; + } } diff --git a/libraries/joomla/form/fields/accesslevel.php b/libraries/joomla/form/fields/accesslevel.php index 7634b53976619..4abd822bc3ac0 100644 --- a/libraries/joomla/form/fields/accesslevel.php +++ b/libraries/joomla/form/fields/accesslevel.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides a list of access levels. Access levels control what users in specific @@ -19,7 +17,7 @@ * @see JAccess * @since 11.1 */ -class JFormFieldAccessLevel extends JFormFieldList +class JFormFieldAccessLevel extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/cachehandler.php b/libraries/joomla/form/fields/cachehandler.php index 7323be59d021e..aab972895c94a 100644 --- a/libraries/joomla/form/fields/cachehandler.php +++ b/libraries/joomla/form/fields/cachehandler.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides a list of available cache handlers @@ -18,7 +16,7 @@ * @see JCache * @since 11.1 */ -class JFormFieldCacheHandler extends JFormFieldList +class JFormFieldCacheHandler extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/calendar.php b/libraries/joomla/form/fields/calendar.php index 707f89b544e73..610ca29cc6044 100644 --- a/libraries/joomla/form/fields/calendar.php +++ b/libraries/joomla/form/fields/calendar.php @@ -17,7 +17,7 @@ * * @since 11.1 */ -class JFormFieldCalendar extends JFormField +class JFormFieldCalendar extends JFormField implements JFormDomfieldinterface { /** * The form field type. @@ -224,7 +224,7 @@ protected function getInput() // Including fallback code for HTML5 non supported browsers. JHtml::_('jquery.framework'); - JHtml::_('script', 'system/html5fallback.js', false, true); + JHtml::_('script', 'system/html5fallback.js', array('version' => 'auto', 'relative' => true)); return JHtml::_('calendar', $this->value, $this->name, $this->id, $format, $attributes); } diff --git a/libraries/joomla/form/fields/checkbox.php b/libraries/joomla/form/fields/checkbox.php index 39735ece8be9b..657a5e2b0f3c8 100644 --- a/libraries/joomla/form/fields/checkbox.php +++ b/libraries/joomla/form/fields/checkbox.php @@ -143,7 +143,7 @@ protected function getInput() // Including fallback code for HTML5 non supported browsers. JHtml::_('jquery.framework'); - JHtml::_('script', 'system/html5fallback.js', false, true); + JHtml::_('script', 'system/html5fallback.js', array('version' => 'auto', 'relative' => true)); return ' $this->maxLength, 'multiple' => $this->multiple, ); + return array_merge($data, $extraData); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('validate', 'email'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/joomla/form/fields/file.php b/libraries/joomla/form/fields/file.php index dd686d17350bb..0f629491e6ea4 100644 --- a/libraries/joomla/form/fields/file.php +++ b/libraries/joomla/form/fields/file.php @@ -132,7 +132,7 @@ protected function getInput() * * @return array * - * @since 3.6 + * @since 3.6 */ protected function getLayoutData() { diff --git a/libraries/joomla/form/fields/filelist.php b/libraries/joomla/form/fields/filelist.php index 4c8a42e5e4f85..a3627c9c1d096 100644 --- a/libraries/joomla/form/fields/filelist.php +++ b/libraries/joomla/form/fields/filelist.php @@ -11,14 +11,12 @@ jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); -JFormHelper::loadFieldClass('list'); - /** * Supports an HTML select list of files * * @since 11.1 */ -class JFormFieldFileList extends JFormFieldList +class JFormFieldFileList extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/folderlist.php b/libraries/joomla/form/fields/folderlist.php index 259901aa27166..659e483f0a7f7 100644 --- a/libraries/joomla/form/fields/folderlist.php +++ b/libraries/joomla/form/fields/folderlist.php @@ -10,14 +10,12 @@ defined('JPATH_PLATFORM') or die; jimport('joomla.filesystem.folder'); -JFormHelper::loadFieldClass('list'); - /** * Supports an HTML select list of folder * * @since 11.1 */ -class JFormFieldFolderList extends JFormFieldList +class JFormFieldFolderList extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/imagelist.php b/libraries/joomla/form/fields/imagelist.php index 04b14171ec983..64212f86ff965 100644 --- a/libraries/joomla/form/fields/imagelist.php +++ b/libraries/joomla/form/fields/imagelist.php @@ -16,7 +16,7 @@ * * @since 11.1 */ -class JFormFieldImageList extends JFormFieldFileList +class JFormFieldImageList extends JFormFieldFileList implements JFormDomfieldinterface { /** * The form field type. @@ -42,4 +42,24 @@ protected function getOptions() // Get the field options. return parent::getOptions(); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('hide_default', 'true'); + $fieldNode->setAttribute('directory', '/images/' . $fieldNode->getAttribute('directory')); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/joomla/form/fields/integer.php b/libraries/joomla/form/fields/integer.php index 88b16915a7479..a5039ae10d12d 100644 --- a/libraries/joomla/form/fields/integer.php +++ b/libraries/joomla/form/fields/integer.php @@ -9,15 +9,13 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides a select list of integers with specified first, last and step values. * * @since 11.1 */ -class JFormFieldInteger extends JFormFieldList +class JFormFieldInteger extends JFormAbstractlist implements JFormDomfieldinterface { /** * The form field type. diff --git a/libraries/joomla/form/fields/language.php b/libraries/joomla/form/fields/language.php index 55a79d4c90eef..862799ed064ca 100644 --- a/libraries/joomla/form/fields/language.php +++ b/libraries/joomla/form/fields/language.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Supports a list of installed application languages @@ -18,7 +16,7 @@ * @see JFormFieldContentLanguage for a select list of content languages. * @since 11.1 */ -class JFormFieldLanguage extends JFormFieldList +class JFormFieldLanguage extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/list.php b/libraries/joomla/form/fields/list.php index 6b2e5d4ffb974..9d2da628739b4 100644 --- a/libraries/joomla/form/fields/list.php +++ b/libraries/joomla/form/fields/list.php @@ -15,7 +15,7 @@ * * @since 11.1 */ -class JFormFieldList extends JFormField +class JFormFieldList extends JFormAbstractlist implements JFormDomfieldinterface { /** * The form field type. @@ -24,139 +24,4 @@ class JFormFieldList extends JFormField * @since 11.1 */ protected $type = 'List'; - - /** - * Method to get the field input markup for a generic list. - * Use the multiple attribute to enable multiselect. - * - * @return string The field input markup. - * - * @since 11.1 - */ - protected function getInput() - { - $html = array(); - $attr = ''; - - // Initialize some field attributes. - $attr .= !empty($this->class) ? ' class="' . $this->class . '"' : ''; - $attr .= !empty($this->size) ? ' size="' . $this->size . '"' : ''; - $attr .= $this->multiple ? ' multiple' : ''; - $attr .= $this->required ? ' required aria-required="true"' : ''; - $attr .= $this->autofocus ? ' autofocus' : ''; - - // To avoid user's confusion, readonly="true" should imply disabled="true". - if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1'|| (string) $this->disabled == 'true') - { - $attr .= ' disabled="disabled"'; - } - - // Initialize JavaScript field attributes. - $attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : ''; - - // Get the field options. - $options = (array) $this->getOptions(); - - // Create a read-only list (no name) with hidden input(s) to store the value(s). - if ((string) $this->readonly == '1' || (string) $this->readonly == 'true') - { - $html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id); - - // E.g. form field type tag sends $this->value as array - if ($this->multiple && is_array($this->value)) - { - if (!count($this->value)) - { - $this->value[] = ''; - } - - foreach ($this->value as $value) - { - $html[] = ''; - } - } - else - { - $html[] = ''; - } - } - else - // Create a regular list. - { - $html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); - } - - return implode($html); - } - - /** - * Method to get the field options. - * - * @return array The field option objects. - * - * @since 11.1 - */ - protected function getOptions() - { - $fieldname = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname); - $options = array(); - - foreach ($this->element->xpath('option') as $option) - { - // Filter requirements - if ($requires = explode(',', (string) $option['requires'])) - { - // Requires multilanguage - if (in_array('multilanguage', $requires) && !JLanguageMultilang::isEnabled()) - { - continue; - } - - // Requires associations - if (in_array('associations', $requires) && !JLanguageAssociations::isEnabled()) - { - continue; - } - - // Requires vote plugin enabled - if (in_array('vote', $requires) && !JPluginHelper::isEnabled('content', 'vote')) - { - continue; - } - } - - $value = (string) $option['value']; - $text = trim((string) $option) ? trim((string) $option) : $value; - - $disabled = (string) $option['disabled']; - $disabled = ($disabled == 'true' || $disabled == 'disabled' || $disabled == '1'); - $disabled = $disabled || ($this->readonly && $value != $this->value); - - $checked = (string) $option['checked']; - $checked = ($checked == 'true' || $checked == 'checked' || $checked == '1'); - - $selected = (string) $option['selected']; - $selected = ($selected == 'true' || $selected == 'selected' || $selected == '1'); - - $tmp = array( - 'value' => $value, - 'text' => JText::alt($text, $fieldname), - 'disable' => $disabled, - 'class' => (string) $option['class'], - 'selected' => ($checked || $selected), - 'checked' => ($checked || $selected), - ); - - // Set some event handler attributes. But really, should be using unobtrusive js. - $tmp['onclick'] = (string) $option['onclick']; - $tmp['onchange'] = (string) $option['onchange']; - - // Add the option object to the result set. - $options[] = (object) $tmp; - } - - reset($options); - - return $options; - } } diff --git a/libraries/joomla/form/fields/plugins.php b/libraries/joomla/form/fields/plugins.php index b3ca9ee7704b0..9587e5f5001c3 100644 --- a/libraries/joomla/form/fields/plugins.php +++ b/libraries/joomla/form/fields/plugins.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 11.4 */ -class JFormFieldPlugins extends JFormFieldList +class JFormFieldPlugins extends JFormAbstractlist { /** * The field type. diff --git a/libraries/joomla/form/fields/predefinedlist.php b/libraries/joomla/form/fields/predefinedlist.php index 98436d8d8cd63..b88a4693f7e5d 100644 --- a/libraries/joomla/form/fields/predefinedlist.php +++ b/libraries/joomla/form/fields/predefinedlist.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field to load a list of predefined values * * @since 3.2 */ -abstract class JFormFieldPredefinedList extends JFormFieldList +abstract class JFormFieldPredefinedList extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/radio.php b/libraries/joomla/form/fields/radio.php index d43b80259f9cf..d41a1f6f763fd 100644 --- a/libraries/joomla/form/fields/radio.php +++ b/libraries/joomla/form/fields/radio.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides radio button inputs @@ -18,7 +16,7 @@ * @link http://www.w3.org/TR/html-markup/command.radio.html#command.radio * @since 11.1 */ -class JFormFieldRadio extends JFormFieldList +class JFormFieldRadio extends JFormAbstractlist implements JFormDomfieldinterface { /** * The form field type. diff --git a/libraries/joomla/form/fields/repeatable.php b/libraries/joomla/form/fields/repeatable.php index ab1d9325f4523..f6f26b9536b4a 100644 --- a/libraries/joomla/form/fields/repeatable.php +++ b/libraries/joomla/form/fields/repeatable.php @@ -137,9 +137,9 @@ protected function getInput() // Depends on jQuery UI JHtml::_('jquery.ui', array('core', 'sortable')); - JHtml::_('script', 'jui/sortablelist.js', false, true); - JHtml::_('stylesheet', 'jui/sortablelist.css', false, true, false); - JHtml::_('script', 'system/repeatable.js', true, true); + JHtml::_('script', 'jui/sortablelist.js', array('version' => 'auto', 'relative' => true)); + JHtml::_('stylesheet', 'jui/sortablelist.css', array('version' => 'auto', 'relative' => true)); + JHtml::_('script', 'system/repeatable.js', array('framework' => true, 'version' => 'auto', 'relative' => true)); $javascript = 'jQuery(document).ready(function($) { $("#' . $this->id . '_table tbody").sortable(); });'; diff --git a/libraries/joomla/form/fields/rules.php b/libraries/joomla/form/fields/rules.php index 8be5591144a5f..bb6ec93e6c8f9 100644 --- a/libraries/joomla/form/fields/rules.php +++ b/libraries/joomla/form/fields/rules.php @@ -139,7 +139,7 @@ protected function getInput() JHtml::_('bootstrap.tooltip'); // Add Javascript for permission change - JHtml::_('script', 'system/permissions.js', false, true); + JHtml::_('script', 'system/permissions.js', array('version' => 'auto', 'relative' => true)); // Load JavaScript message titles JText::script('ERROR'); diff --git a/libraries/joomla/form/fields/sessionhandler.php b/libraries/joomla/form/fields/sessionhandler.php index 812a520061785..02c3605a52fe6 100644 --- a/libraries/joomla/form/fields/sessionhandler.php +++ b/libraries/joomla/form/fields/sessionhandler.php @@ -9,15 +9,13 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides a select list of session handler options. * * @since 11.1 */ -class JFormFieldSessionHandler extends JFormFieldList +class JFormFieldSessionHandler extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/sql.php b/libraries/joomla/form/fields/sql.php index 733116575f67e..6c0dc6f2ee219 100644 --- a/libraries/joomla/form/fields/sql.php +++ b/libraries/joomla/form/fields/sql.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Supports an custom SQL select list * * @since 11.1 */ -class JFormFieldSQL extends JFormFieldList +class JFormFieldSQL extends JFormAbstractlist implements JFormDomfieldinterface { /** * The form field type. @@ -305,4 +303,29 @@ protected function getOptions() return $options; } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('value_field', 'text'); + $fieldNode->setAttribute('key_field', 'value'); + + if (! $fieldNode->getAttribute('query')) + { + $fieldNode->setAttribute('query', 'select id as value, name as text from #__users'); + } + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/joomla/form/fields/tel.php b/libraries/joomla/form/fields/tel.php index 2728f24d66cbb..ff14369ba6eea 100644 --- a/libraries/joomla/form/fields/tel.php +++ b/libraries/joomla/form/fields/tel.php @@ -20,7 +20,7 @@ * @see JHtmlTel for rendering of telephone numbers * @since 11.1 */ -class JFormFieldTel extends JFormFieldText +class JFormFieldTel extends JFormFieldText implements JFormDomfieldinterface { /** * The form field type. @@ -60,10 +60,29 @@ protected function getInput() // Including fallback code for HTML5 non supported browsers. JHtml::_('jquery.framework'); - JHtml::_('script', 'system/html5fallback.js', false, true); + JHtml::_('script', 'system/html5fallback.js', array('version' => 'auto', 'relative' => true)); return ''; } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('validate', 'tel'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/joomla/form/fields/text.php b/libraries/joomla/form/fields/text.php index 1f0026cac8496..fa555c7cad3b0 100644 --- a/libraries/joomla/form/fields/text.php +++ b/libraries/joomla/form/fields/text.php @@ -16,7 +16,7 @@ * @link http://www.w3.org/TR/html-markup/input.text.html#input.text * @since 11.1 */ -class JFormFieldText extends JFormField +class JFormFieldText extends JFormField implements JFormDomfieldinterface { /** * The form field type. @@ -170,6 +170,41 @@ public function setup(SimpleXMLElement $element, $value, $group = null) */ protected function getInput() { + if ($this->element['useglobal']) + { + $component = JFactory::getApplication()->input->getCmd('option'); + + // Get correct component for menu items + if ($component == 'com_menus') + { + $link = $this->form->getData()->get('link'); + $uri = new JUri($link); + $component = $uri->getVar('option', 'com_menus'); + } + + $params = JComponentHelper::getParams($component); + $value = $params->get($this->fieldname); + + // Try with global configuration + if (is_null($value)) + { + $value = JFactory::getConfig()->get($this->fieldname); + } + + // Try with menu configuration + if (is_null($value) && JFactory::getApplication()->input->getCmd('option') == 'com_menus') + { + $value = JComponentHelper::getParams('com_menus')->get($this->fieldname); + } + + if (!is_null($value)) + { + $value = (string) $value; + + $this->hint = JText::sprintf('JGLOBAL_USE_GLOBAL_VALUE', $value); + } + } + return $this->getRenderer($this->layout)->render($this->getLayoutData()); } diff --git a/libraries/joomla/form/fields/textarea.php b/libraries/joomla/form/fields/textarea.php index 5bdfb608ebc63..949fcb30f845d 100644 --- a/libraries/joomla/form/fields/textarea.php +++ b/libraries/joomla/form/fields/textarea.php @@ -16,7 +16,7 @@ * @link http://www.w3.org/TR/html-markup/textarea.html#textarea * @since 11.1 */ -class JFormFieldTextarea extends JFormField +class JFormFieldTextarea extends JFormField implements JFormDomfieldinterface { /** * The form field type. @@ -171,4 +171,23 @@ protected function getLayoutData() return array_merge($data, $extraData); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('filter', 'JComponentHelper::filterText'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/joomla/form/fields/timezone.php b/libraries/joomla/form/fields/timezone.php index ded39d8af3e35..fbda44ee36631 100644 --- a/libraries/joomla/form/fields/timezone.php +++ b/libraries/joomla/form/fields/timezone.php @@ -16,7 +16,7 @@ * * @since 11.1 */ -class JFormFieldTimezone extends JFormFieldGroupedList +class JFormFieldTimezone extends JFormFieldGroupedList implements JFormDomfieldinterface { /** * The form field type. diff --git a/libraries/joomla/form/fields/url.php b/libraries/joomla/form/fields/url.php index 42ca304fa5abb..3ec397ad6443e 100644 --- a/libraries/joomla/form/fields/url.php +++ b/libraries/joomla/form/fields/url.php @@ -19,7 +19,7 @@ * @see JFormRuleUrl for validation of full urls * @since 11.1 */ -class JFormFieldUrl extends JFormFieldText +class JFormFieldUrl extends JFormFieldText implements JFormDomfieldinterface { /** * The form field type. @@ -75,4 +75,28 @@ protected function getLayoutData() return array_merge($data, $extraData); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('validate', 'url'); + + if (! $fieldNode->getAttribute('relative')) + { + $fieldNode->removeAttribute('relative'); + } + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/joomla/form/parameters/calendar.xml b/libraries/joomla/form/parameters/calendar.xml new file mode 100644 index 0000000000000..9baed970604f7 --- /dev/null +++ b/libraries/joomla/form/parameters/calendar.xml @@ -0,0 +1,16 @@ + +
    + +
    + +
    +
    +
    diff --git a/libraries/joomla/form/parameters/checkboxes.xml b/libraries/joomla/form/parameters/checkboxes.xml new file mode 100644 index 0000000000000..641dee4e8eff3 --- /dev/null +++ b/libraries/joomla/form/parameters/checkboxes.xml @@ -0,0 +1,30 @@ + +
    + +
    + + + +
    +
    +
    diff --git a/libraries/joomla/form/parameters/imagelist.xml b/libraries/joomla/form/parameters/imagelist.xml new file mode 100644 index 0000000000000..2ccc1d6855697 --- /dev/null +++ b/libraries/joomla/form/parameters/imagelist.xml @@ -0,0 +1,43 @@ + +
    + +
    + + + + + + + + + + +
    +
    +
    diff --git a/libraries/joomla/form/parameters/integer.xml b/libraries/joomla/form/parameters/integer.xml new file mode 100644 index 0000000000000..718500e74ebf2 --- /dev/null +++ b/libraries/joomla/form/parameters/integer.xml @@ -0,0 +1,51 @@ + +
    + +
    + + + + + + + + + + +
    +
    +
    diff --git a/libraries/joomla/form/parameters/list.xml b/libraries/joomla/form/parameters/list.xml new file mode 100644 index 0000000000000..78d811c52ef87 --- /dev/null +++ b/libraries/joomla/form/parameters/list.xml @@ -0,0 +1,41 @@ + +
    + +
    + + + + + + + +
    +
    +
    diff --git a/libraries/joomla/form/parameters/radio.xml b/libraries/joomla/form/parameters/radio.xml new file mode 100644 index 0000000000000..a6af95a419188 --- /dev/null +++ b/libraries/joomla/form/parameters/radio.xml @@ -0,0 +1,40 @@ + +
    + +
    + + + +
    +
    + + + diff --git a/libraries/joomla/form/parameters/sql.xml b/libraries/joomla/form/parameters/sql.xml new file mode 100644 index 0000000000000..84a500f27540b --- /dev/null +++ b/libraries/joomla/form/parameters/sql.xml @@ -0,0 +1,29 @@ + +
    + +
    + + + + + + +
    +
    +
    diff --git a/libraries/joomla/form/parameters/textarea.xml b/libraries/joomla/form/parameters/textarea.xml new file mode 100644 index 0000000000000..1afdceea853e8 --- /dev/null +++ b/libraries/joomla/form/parameters/textarea.xml @@ -0,0 +1,26 @@ + +
    + +
    + + + +
    +
    +
    diff --git a/libraries/joomla/form/parameters/url.xml b/libraries/joomla/form/parameters/url.xml new file mode 100644 index 0000000000000..f1a19b5e9f077 --- /dev/null +++ b/libraries/joomla/form/parameters/url.xml @@ -0,0 +1,35 @@ + +
    + +
    + + + + + + + + + + + + + + +
    +
    +
    diff --git a/libraries/joomla/form/rule/email.php b/libraries/joomla/form/rule/email.php index e816ff9d854e5..f599ad6ebda8c 100644 --- a/libraries/joomla/form/rule/email.php +++ b/libraries/joomla/form/rule/email.php @@ -25,7 +25,7 @@ class JFormRuleEmail extends JFormRule * @since 11.1 * @see http://www.w3.org/TR/html-markup/input.email.html */ - protected $regex = '^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$'; + protected $regex = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$"; /** * Method to test the email address and optionally check for uniqueness. @@ -57,7 +57,7 @@ public function test(SimpleXMLElement $element, $value, $group = null, Registry if ($tld) { - $this->regex = '^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])' + $this->regex = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])" . '?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$'; } diff --git a/libraries/joomla/language/helper.php b/libraries/joomla/language/helper.php index 25b01dc2eee8d..ede1cc82a5295 100644 --- a/libraries/joomla/language/helper.php +++ b/libraries/joomla/language/helper.php @@ -9,6 +9,8 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Utilities\ArrayHelper; + /** * Language helper class * @@ -30,41 +32,19 @@ class JLanguageHelper */ public static function createLanguageList($actualLanguage, $basePath = JPATH_BASE, $caching = false, $installed = false) { - $list = array(); - - // Cache activation - $langs = JLanguage::getKnownLanguages($basePath); + $list = array(); + $clientId = $basePath === JPATH_ADMINISTRATOR ? 1 : 0; + $languages = $installed ? static::getInstalledLanguages($clientId, true) : JLanguage::getKnownLanguages($basePath); - if ($installed) + foreach ($languages as $languageCode => $language) { - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select('element') - ->from('#__extensions') - ->where('type=' . $db->quote('language')) - ->where('state=0') - ->where('enabled=1') - ->where('client_id=' . ($basePath == JPATH_ADMINISTRATOR ? 1 : 0)); - $db->setQuery($query); - $installed_languages = $db->loadObjectList('element'); - } - - foreach ($langs as $lang => $metadata) - { - if (!$installed || array_key_exists($lang, $installed_languages)) - { - $option = array(); - - $option['text'] = $metadata['name']; - $option['value'] = $lang; + $metadata = $installed ? $language->metadata : $language; - if ($lang == $actualLanguage) - { - $option['selected'] = 'selected="selected"'; - } - - $list[] = $option; - } + $list[] = array( + 'text' => isset($metadata['nativeName']) ? $metadata['nativeName'] : $metadata['name'], + 'value' => $languageCode, + 'selected' => $languageCode === $actualLanguage ? 'selected="selected"' : null, + ); } return $list; @@ -181,4 +161,199 @@ public static function getLanguages($key = 'default') return $languages[$key]; } + + /** + * Get a list of installed languages. + * + * @param integer $clientId The client app id. + * @param boolean $processMetaData Fetch Language metadata. + * @param boolean $processManifest Fetch Language manifest. + * @param string $pivot The pivot of the returning array. + * @param string $orderField Field to order the results. + * @param string $orderDirection Direction to order the results. + * + * @return array Array with the installed languages. + * + * @since __DEPLOY_VERSION__ + */ + public static function getInstalledLanguages($clientId = null, $processMetaData = false, $processManifest = false, $pivot = 'element', + $orderField = null, $orderDirection = null) + { + static $installedLanguages = null; + + if ($installedLanguages === null) + { + $cache = JFactory::getCache('com_languages', ''); + + if (!$installedLanguages = $cache->get('installedlanguages')) + { + $db = JFactory::getDbo(); + + $query = $db->getQuery(true) + ->select($db->quoteName(array('element', 'name', 'client_id', 'extension_id'))) + ->from($db->quoteName('#__extensions')) + ->where($db->quoteName('type') . ' = ' . $db->quote('language')) + ->where($db->quoteName('state') . ' = 0') + ->where($db->quoteName('enabled') . ' = 1'); + + $installedLanguages = $db->setQuery($query)->loadObjectList(); + + $cache->store($installedLanguages, 'installedlanguages'); + } + } + + $clients = $clientId === null ? array(0, 1) : array((int) $clientId); + $languages = array( + 0 => array(), + 1 => array(), + ); + + foreach ($installedLanguages as $language) + { + // If the language client is not needed continue cycle. Drop for performance. + if (!in_array((int) $language->client_id, $clients)) + { + continue; + } + + $lang = $language; + + if ($processMetaData || $processManifest) + { + $clientPath = (int) $language->client_id === 0 ? JPATH_SITE : JPATH_ADMINISTRATOR; + $metafile = JLanguage::getLanguagePath($clientPath, $language->element) . '/' . $language->element . '.xml'; + + // Process the language metadata. + if ($processMetaData) + { + $lang->metadata = JLanguage::parseXMLLanguageFile($metafile); + + // No metadata found, not a valid language. + if (!is_array($lang->metadata)) + { + continue; + } + } + + // Process the language manifest. + if ($processManifest) + { + $lang->manifest = JInstaller::parseXMLInstallFile($metafile); + + // No metadata found, not a valid language. + if (!is_array($lang->manifest)) + { + continue; + } + } + } + + $languages[$language->client_id][] = $lang; + } + + // Order the list, if needed. + if ($orderField !== null && $orderDirection !== null) + { + $orderDirection = strtolower($orderDirection) === 'desc' ? -1 : 1; + + foreach ($languages as $cId => $language) + { + // If the language client is not needed continue cycle. Drop for performance. + if (!in_array($cId, $clients)) + { + continue; + } + + $languages[$cId] = ArrayHelper::sortObjects($languages[$cId], $orderField, $orderDirection, true, true); + } + } + + // Add the pivot, if needed. + if ($pivot !== null) + { + foreach ($languages as $cId => $language) + { + // If the language client is not needed continue cycle. Drop for performance. + if (!in_array($cId, $clients)) + { + continue; + } + + $languages[$cId] = ArrayHelper::pivot($languages[$cId], $pivot); + } + } + + return $clientId !== null ? $languages[$clientId] : $languages; + } + + /** + * Get a list of content languages. + * + * @param integer $checkPublished Check if the content language is published. + * @param integer $checkInstalled Check if the content language is installed. + * @param string $pivot The pivot of the returning array. + * @param string $orderField Field to order the results. + * @param string $orderDirection Direction to order the results. + * + * @return array Array of the content languages. + * + * @since __DEPLOY_VERSION__ + */ + public static function getContentLanguages($checkPublished = true, $checkInstalled = true, $pivot = 'lang_code', $orderField = null, + $orderDirection = null) + { + static $contentLanguages = null; + + if ($contentLanguages === null) + { + $cache = JFactory::getCache('com_languages', ''); + + if (!$contentLanguages = $cache->get('contentlanguages')) + { + $db = JFactory::getDbo(); + + $query = $db->getQuery(true) + ->select('*') + ->from($db->quoteName('#__languages')); + + $contentLanguages = $db->setQuery($query)->loadObjectList(); + + $cache->store($contentLanguages, 'contentlanguages'); + } + } + + $languages = $contentLanguages; + + // Check if the language is published, if needed. + if ($checkPublished) + { + foreach ($languages as $key => $language) + { + if ((int) $language->published === 0) + { + unset($languages[$key]); + } + } + } + + // Check if the language is installed, if needed. + if ($checkInstalled) + { + $languages = array_values(array_intersect_key(ArrayHelper::pivot($languages, 'lang_code'), static::getInstalledLanguages(0))); + } + + // Order the list, if needed. + if ($orderField !== null && $orderDirection !== null) + { + $languages = ArrayHelper::sortObjects($languages, $orderField, strtolower($orderDirection) === 'desc' ? -1 : 1, true, true); + } + + // Add the pivot, if needed. + if ($pivot !== null) + { + $languages = ArrayHelper::pivot($languages, $pivot); + } + + return $languages; + } } diff --git a/libraries/joomla/mail/helper.php b/libraries/joomla/mail/helper.php index ea69db1cabd7e..bcd67ad757a56 100644 --- a/libraries/joomla/mail/helper.php +++ b/libraries/joomla/mail/helper.php @@ -123,11 +123,11 @@ public static function isEmailAddress($email) /* * Check the local address - * We're a bit more conservative about what constitutes a "legal" address, that is, a-zA-Z0-9.!#$%&’*+/=?^_`{|}~- + * We're a bit more conservative about what constitutes a "legal" address, that is, a-zA-Z0-9.!#$%&'*+/=?^_`{|}~- * The first and last character in local cannot be a period ('.') * Also, period should not appear 2 or more times consecutively */ - $allowed = 'a-zA-Z0-9.!#$%&’*+\/=?^_`{|}~-'; + $allowed = "a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-"; $regex = "/^[$allowed][\.$allowed]{0,63}$/"; if (!preg_match($regex, $local) || substr($local, -1) == '.' || $local[0] == '.' || preg_match('/\.\./', $local)) diff --git a/libraries/joomla/observer/updater.php b/libraries/joomla/observer/updater.php index 14f84f09d062a..4131f1a3abf64 100644 --- a/libraries/joomla/observer/updater.php +++ b/libraries/joomla/observer/updater.php @@ -46,7 +46,7 @@ public function __construct(JObservableInterface $observable) /** * Adds an observer to the JObservableInterface instance updated by this - * This method can be called fron JObservableInterface::attachObserver + * This method can be called from JObservableInterface::attachObserver * * @param JObserverInterface $observer The observer object * @@ -59,6 +59,24 @@ public function attachObserver(JObserverInterface $observer) $this->observers[get_class($observer)] = $observer; } + /** + * Removes an observer from the JObservableInterface instance updated by this + * This method can be called from JObservableInterface::attachObserver + * + * @param String $observer The observer class name + * + * @return void + * + * @since 3.6.0 + */ + public function detachObserver($observer) + { + if (isset($this->observers[$observer])) + { + unset($this->observers[$observer]); + } + } + /** * Gets the instance of the observer of class $observerClass * diff --git a/libraries/joomla/session/session.php b/libraries/joomla/session/session.php index f8ba686bc46dc..e0b2dcdb8298d 100644 --- a/libraries/joomla/session/session.php +++ b/libraries/joomla/session/session.php @@ -800,6 +800,7 @@ public function fork() public function close() { $this->_handler->save(); + $this->_state = 'inactive'; } /** diff --git a/libraries/joomla/table/nested.php b/libraries/joomla/table/nested.php index e05c013de483f..4caa4b65ce7fd 100644 --- a/libraries/joomla/table/nested.php +++ b/libraries/joomla/table/nested.php @@ -919,7 +919,7 @@ public function publish($pks = null, $state = 1, $userId = 0) // Nothing to set publishing state on, return false. else { - $e = new UnexpectedValueException(sprintf('%s::publish(%s, %d, %d) empty.', get_class($this), $pks, $state, $userId)); + $e = new UnexpectedValueException(sprintf('%s::publish(%s, %d, %d) empty.', get_class($this), $pks[0], $state, $userId)); $this->setError($e); return false; @@ -954,7 +954,7 @@ public function publish($pks = null, $state = 1, $userId = 0) if ($this->_db->loadResult()) { // TODO Convert to a conflict exception when available. - $e = new RuntimeException(sprintf('%s::publish(%s, %d, %d) checked-out conflict.', get_class($this), $pks, $state, $userId)); + $e = new RuntimeException(sprintf('%s::publish(%s, %d, %d) checked-out conflict.', get_class($this), $pks[0], $state, $userId)); $this->setError($e); @@ -972,7 +972,7 @@ public function publish($pks = null, $state = 1, $userId = 0) ->where('n.lft < ' . (int) $node->lft) ->where('n.rgt > ' . (int) $node->rgt) ->where('n.parent_id > 0') - ->where('n.published < ' . (int) $compareState); + ->where($this->_db->qn('n.' . $this->getColumnAlias('published')) . ' < ' . (int) $compareState); // Just fetch one row (one is one too many). $this->_db->setQuery($query, 0, 1); @@ -982,7 +982,7 @@ public function publish($pks = null, $state = 1, $userId = 0) if (!empty($rows)) { $e = new UnexpectedValueException( - sprintf('%s::publish(%s, %d, %d) ancestors have lower state.', get_class($this), $pks, $state, $userId) + sprintf('%s::publish(%s, %d, %d) ancestors have lower state.', get_class($this), $pks[0], $state, $userId) ); $this->setError($e); @@ -993,7 +993,7 @@ public function publish($pks = null, $state = 1, $userId = 0) // Update and cascade the publishing state. $query->clear() ->update($this->_db->quoteName($this->_tbl)) - ->set('published = ' . (int) $state) + ->set($this->_db->qn($this->getColumnAlias('published')) . ' = ' . (int) $state) ->where('(lft > ' . (int) $node->lft . ' AND rgt < ' . (int) $node->rgt . ') OR ' . $k . ' = ' . (int) $pk); $this->_db->setQuery($query)->execute(); diff --git a/libraries/joomla/uri/uri.php b/libraries/joomla/uri/uri.php index e19f815c45b6a..9072cc43bcbd7 100644 --- a/libraries/joomla/uri/uri.php +++ b/libraries/joomla/uri/uri.php @@ -67,6 +67,12 @@ public static function getInstance($uri = 'SERVER') { $https = 's://'; } + elseif ((isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && + !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && + (strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) !== 'http'))) + { + $https = 's://'; + } else { $https = '://'; diff --git a/libraries/legacy/access/rule.php b/libraries/legacy/access/rule.php index d03964402eacb..410d690e379ed 100644 --- a/libraries/legacy/access/rule.php +++ b/libraries/legacy/access/rule.php @@ -12,9 +12,8 @@ /** * Deprecated class placeholder. You should use JAccessRule instead. * - * @since 11.1 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - * @codeCoverageIgnore + * @since 1.6 + * @deprecated 2.5 */ class JRule extends JAccessRule { @@ -26,8 +25,8 @@ class JRule extends JAccessRule * * @param mixed $identities A JSON format string (probably from the database) or a named array. * - * @since 11.1 - * @deprecated 12.3 + * @since 1.6 + * @deprecated 2.5 */ public function __construct($identities) { diff --git a/libraries/legacy/access/rules.php b/libraries/legacy/access/rules.php index 9263877dd7f1e..c0dc230630004 100644 --- a/libraries/legacy/access/rules.php +++ b/libraries/legacy/access/rules.php @@ -12,9 +12,8 @@ /** * Deprecated class placeholder. You should use JAccessRules instead. * - * @since 11.1 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - * @codeCoverageIgnore + * @since 1.6 + * @deprecated 2.5 */ class JRules extends JAccessRules { @@ -26,8 +25,8 @@ class JRules extends JAccessRules * * @param mixed $input A JSON format string (probably from the database) or a nested array. * - * @since 11.1 - * @deprecated 12.3 + * @since 1.6 + * @deprecated 2.5 */ public function __construct($input = '') { diff --git a/libraries/legacy/application/application.php b/libraries/legacy/application/application.php index 402c48dcd66ea..a474ae797afaa 100644 --- a/libraries/legacy/application/application.php +++ b/libraries/legacy/application/application.php @@ -20,8 +20,8 @@ * supporting API functions. Derived clases should supply the route(), dispatch() * and render() functions. * - * @since 11.1 - * @deprecated 4.0 Use JApplicationCms instead unless specified otherwise + * @since 1.5 + * @deprecated 3.2 Use JApplicationCms instead unless specified otherwise */ class JApplication extends JApplicationBase { @@ -29,8 +29,8 @@ class JApplication extends JApplicationBase * The client identifier. * * @var integer - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ protected $_clientId = null; @@ -38,8 +38,8 @@ class JApplication extends JApplicationBase * The application message queue. * * @var array - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ protected $_messageQueue = array(); @@ -47,8 +47,8 @@ class JApplication extends JApplicationBase * The name of the application. * * @var array - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ protected $_name = null; @@ -56,17 +56,17 @@ class JApplication extends JApplicationBase * The scope of the application. * * @var string - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public $scope = null; /** * The time the request was made. * - * @var date - * @since 11.1 - * @deprecated 4.0 + * @var string + * @since 1.5 + * @deprecated 3.2 */ public $requestTime = null; @@ -74,22 +74,26 @@ class JApplication extends JApplicationBase * The time the request was made as Unix timestamp. * * @var integer - * @since 11.1 - * @deprecated 4.0 + * @since 1.6 + * @deprecated 3.2 */ public $startTime = null; /** - * @var JApplicationWebClient The application client object. - * @since 12.2 - * @deprecated 4.0 + * The application client object. + * + * @var JApplicationWebClient + * @since 3.0 + * @deprecated 3.2 */ public $client; /** - * @var array JApplication instances container. - * @since 11.3 - * @deprecated 4.0 + * JApplication instances container. + * + * @var JApplication[] + * @since 2.5 + * @deprecated 3.2 */ protected static $instances = array(); @@ -99,8 +103,8 @@ class JApplication extends JApplicationBase * @param array $config A configuration array including optional elements such as session * session_name, clientId and others. This is not exhaustive. * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function __construct($config = array()) { @@ -166,8 +170,8 @@ public function __construct($config = array()) * * @return JApplicationCms A JApplicationCms object. * - * @since 11.1 - * @deprecated 4.0 Use JApplicationCms::getInstance() instead + * @since 1.5 + * @deprecated 3.2 Use JApplicationCms::getInstance() instead * @note As of 3.2, this proxies to JApplicationCms::getInstance() */ public static function getInstance($client, $config = array(), $prefix = 'J') @@ -182,8 +186,8 @@ public static function getInstance($client, $config = array(), $prefix = 'J') * * @return void * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function initialise($options = array()) { @@ -227,8 +231,8 @@ public function initialise($options = array()) * * @return void * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function route() { @@ -259,8 +263,8 @@ public function route() * * @return void * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function dispatch($component = null) { @@ -283,8 +287,8 @@ public function dispatch($component = null) * * @return void * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function render() { @@ -324,8 +328,8 @@ public function render() * * @return void Calls exit(). * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 * * @see JApplication::enqueueMessage() */ @@ -417,8 +421,8 @@ public function redirect($url, $msg = '', $msgType = 'message', $moved = false) * * @return void * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function enqueueMessage($msg, $type = 'message') { @@ -444,8 +448,8 @@ public function enqueueMessage($msg, $type = 'message') * * @return array The system message queue. * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function getMessageQueue() { @@ -475,8 +479,8 @@ public function getMessageQueue() * * @return mixed The user state. * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function getCfg($varname, $default = null) { @@ -493,8 +497,8 @@ public function getCfg($varname, $default = null) * * @return string The name of the dispatcher. * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function getName() { @@ -523,8 +527,8 @@ public function getName() * * @return mixed The user state or null. * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function getUserState($key, $default = null) { @@ -547,8 +551,8 @@ public function getUserState($key, $default = null) * * @return mixed The previous state, if one existed. * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function setUserState($key, $value) { @@ -573,8 +577,8 @@ public function setUserState($key, $value) * * @return The request user state. * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function getUserStateFromRequest($key, $request, $default = null, $type = 'none') { @@ -611,8 +615,8 @@ public function getUserStateFromRequest($key, $request, $default = null, $type = * * @return boolean|JException True on success, false if failed or silent handling is configured, or a JException object on authentication error. * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function login($credentials, $options = array()) { @@ -733,8 +737,8 @@ public function login($credentials, $options = array()) * * @return boolean True on success * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function logout($userid = null, $options = array()) { @@ -778,8 +782,8 @@ public function logout($userid = null, $options = array()) * * @return mixed System is the fallback. * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function getTemplate($params = false) { @@ -804,8 +808,8 @@ public function getTemplate($params = false) * * @return JRouter|null A JRouter object * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public static function getRouter($name = null, array $options = array()) { @@ -836,8 +840,8 @@ public static function getRouter($name = null, array $options = array()) * * @return string Processed string * - * @since 11.1 - * @deprecated 4.0 Use JApplicationHelper::stringURLSafe instead + * @since 1.6 + * @deprecated 3.2 Use JApplicationHelper::stringURLSafe instead */ public static function stringURLSafe($string) { @@ -852,8 +856,8 @@ public static function stringURLSafe($string) * * @return JPathway|null A JPathway object * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function getPathway($name = null, $options = array()) { @@ -882,8 +886,8 @@ public function getPathway($name = null, $options = array()) * * @return JMenu|null JMenu object. * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function getMenu($name = null, $options = array()) { @@ -911,8 +915,8 @@ public function getMenu($name = null, $options = array()) * * @return string A secure hash * - * @since 11.1 - * @deprecated 4.0 Use JApplicationHelper::getHash instead + * @since 1.6 + * @deprecated 3.2 Use JApplicationHelper::getHash instead */ public static function getHash($seed) { @@ -926,8 +930,8 @@ public static function getHash($seed) * * @return JConfig A JConfig object * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ protected function _createConfiguration($file) { @@ -957,8 +961,8 @@ protected function _createConfiguration($file) * * @return JSession JSession on success. May call exit() on database error. * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ protected function _createSession($name) { @@ -1027,8 +1031,8 @@ protected function _createSession($name) * * @return void * - * @since 11.1 - * @deprecated 4.0 + * @since 1.6 + * @deprecated 3.2 */ public function checkSession() { @@ -1088,8 +1092,8 @@ public function checkSession() * * @return void * - * @since 12.2 - * @deprecated 4.0 + * @since 3.0 + * @deprecated 3.2 */ public function afterSessionStart() { @@ -1107,8 +1111,8 @@ public function afterSessionStart() * * @return integer A client identifier. * - * @since 11.1 - * @deprecated 4.0 + * @since 1.5 + * @deprecated 3.2 */ public function getClientId() { @@ -1120,8 +1124,8 @@ public function getClientId() * * @return boolean True if this application is administrator. * - * @since 11.1 - * @deprecated 4.0 Use isClient('administrator') instead. + * @since 1.0.2 + * @deprecated 3.2 */ public function isAdmin() { @@ -1133,8 +1137,8 @@ public function isAdmin() * * @return boolean True if this application is site. * - * @since 11.1 - * @deprecated 4.0 Use isClient('site') instead. + * @since 1.5 + * @deprecated 3.2 */ public function isSite() { @@ -1160,8 +1164,8 @@ public function isClient($identifier) * * @return boolean True if Windows OS * - * @since 11.1 - * @deprecated 13.3 (Platform) & 4.0 (CMS) Use the IS_WIN constant instead. + * @since 1.6 + * @deprecated 4.0 Use the IS_WIN constant instead. */ public static function isWinOs() { @@ -1175,8 +1179,8 @@ public static function isWinOs() * * @return boolean True if using SSL, false if not. * - * @since 12.2 - * @deprecated 4.0 + * @since 3.0 + * @deprecated 3.2 */ public function isSSLConnection() { @@ -1188,8 +1192,8 @@ public function isSSLConnection() * * @return string The response * - * @since 11.1 - * @deprecated 4.0 + * @since 1.6 + * @deprecated 3.2 */ public function __toString() { diff --git a/libraries/legacy/application/cli.php b/libraries/legacy/application/cli.php index 55b3e10e5569f..e2919c562c173 100644 --- a/libraries/legacy/application/cli.php +++ b/libraries/legacy/application/cli.php @@ -14,9 +14,8 @@ /** * Deprecated class placeholder. You should use JApplicationCli instead. * - * @since 11.1 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - Use JApplicationCli instead. - * @codeCoverageIgnore + * @since 1.7 + * @deprecated 2.5 Use JApplicationCli instead. */ class JCli extends JApplicationCli { @@ -35,8 +34,8 @@ class JCli extends JApplicationCli * will be created based on the application's loadDispatcher() method. * * @see JApplicationBase::loadDispatcher() - * @since 11.1 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - Use JApplicationCli instead. + * @since 1.7 + * @deprecated 2.5 Use JApplicationCli instead. */ public function __construct(JInputCli $input = null, Registry $config = null, JEventDispatcher $dispatcher = null) { diff --git a/libraries/legacy/application/daemon.php b/libraries/legacy/application/daemon.php index 1c85dd12ae8f4..d365bb618d993 100644 --- a/libraries/legacy/application/daemon.php +++ b/libraries/legacy/application/daemon.php @@ -16,9 +16,8 @@ /** * Backward Compatability Stub for JApplicationDaemon * - * @since 11.1 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - Use JApplicationDaemon instead. - * @codeCoverageIgnore + * @since 1.7 + * @deprecated 2.5 Use JApplicationDaemon instead. */ class JDaemon extends JApplicationDaemon { @@ -36,8 +35,8 @@ class JDaemon extends JApplicationDaemon * the application's event dispatcher, if it is null then the default event dispatcher * will be created based on the application's loadDispatcher() method. * - * @since 11.1 - * @deprecated 12.3 Use JApplicationDaemon instead. + * @since 1.7 + * @deprecated 2.5 Use JApplicationDaemon instead. * @throws RuntimeException */ public function __construct(JInputCli $input = null, Registry $config = null, JEventDispatcher $dispatcher = null) diff --git a/libraries/legacy/base/node.php b/libraries/legacy/base/node.php index 87453c97e0b8c..39218cc893946 100644 --- a/libraries/legacy/base/node.php +++ b/libraries/legacy/base/node.php @@ -12,32 +12,34 @@ /** * Tree Node Class. * - * @since 11.1 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - * @codeCoverageIgnore + * @since 1.5 + * @deprecated 3.0 */ class JNode extends JObject { /** * Parent node - * @var object * - * @since 11.1 + * @var JNode + * @since 1.5 + * @deprecated 3.0 */ protected $_parent = null; /** * Array of Children * - * @var array - * @since 11.1 + * @var JNode[] + * @since 1.5 + * @deprecated 3.0 */ protected $_children = array(); /** * Constructor * - * @since 11.1 + * @since 1.5 + * @deprecated 3.0 */ public function __construct() { @@ -55,7 +57,8 @@ public function __construct() * * @return void * - * @since 11.1 + * @since 1.5 + * @deprecated 3.0 */ public function addChild(&$child) { @@ -72,11 +75,12 @@ public function addChild(&$child) * * If the node already has a parent, the link is unset * - * @param mixed &$parent The JNode for parent to be set or null + * @param JNode|null &$parent The JNode for parent to be set or null * * @return void * - * @since 11.1 + * @since 1.5 + * @deprecated 3.0 */ public function setParent(&$parent) { @@ -103,9 +107,10 @@ public function setParent(&$parent) /** * Get the children of this node * - * @return array The children + * @return JNode[] The children * - * @since 11.1 + * @since 1.5 + * @deprecated 3.0 */ public function &getChildren() { @@ -117,9 +122,10 @@ public function &getChildren() /** * Get the parent of this node * - * @return mixed JNode object with the parent or null for no parent + * @return JNode|null JNode object with the parent or null for no parent * - * @since 11.1 + * @since 1.5 + * @deprecated 3.0 */ public function &getParent() { @@ -131,9 +137,10 @@ public function &getParent() /** * Test if this node has children * - * @return boolean True if there are children + * @return boolean True if there are children * - * @since 11.1 + * @since 1.5 + * @deprecated 3.0 */ public function hasChildren() { @@ -147,7 +154,8 @@ public function hasChildren() * * @return boolean True if there is a parent * - * @since 11.1 + * @since 1.6 + * @deprecated 3.0 */ public function hasParent() { diff --git a/libraries/legacy/base/observable.php b/libraries/legacy/base/observable.php index e2dc9f8425424..fb1ffab72e650 100644 --- a/libraries/legacy/base/observable.php +++ b/libraries/legacy/base/observable.php @@ -12,9 +12,8 @@ /** * Abstract observable class to implement the observer design pattern * - * @since 11.1 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - * @codeCoverageIgnore + * @since 1.5 + * @deprecated 2.5 */ class JObservable extends JObject { @@ -22,8 +21,8 @@ class JObservable extends JObject * An array of Observer objects to notify * * @var array - * @since 11.1 - * @deprecated 12.3 + * @since 1.5 + * @deprecated 2.5 */ protected $_observers = array(); @@ -31,8 +30,8 @@ class JObservable extends JObject * The state of the observable object * * @var mixed - * @since 11.1 - * @deprecated 12.3 + * @since 1.5 + * @deprecated 2.5 */ protected $_state = null; @@ -40,8 +39,8 @@ class JObservable extends JObject * A multi dimensional array of [function][] = key for observers * * @var array - * @since 11.1 - * @deprecated 12.3 + * @since 1.6 + * @deprecated 2.5 */ protected $_methods = array(); @@ -50,7 +49,8 @@ class JObservable extends JObject * * Note: Make Sure it's not directly instantiated * - * @deprecated 12.3 + * @since 1.5 + * @deprecated 2.5 */ public function __construct() { @@ -60,10 +60,10 @@ public function __construct() /** * Get the state of the JObservable object * - * @return mixed The state of the object. + * @return mixed The state of the object. * - * @since 11.1 - * @deprecated 12.3 + * @since 1.5 + * @deprecated 2.5 */ public function getState() { @@ -73,10 +73,10 @@ public function getState() /** * Update each attached observer object and return an array of their return values * - * @return array Array of return values from the observers + * @return array Array of return values from the observers * - * @since 11.1 - * @deprecated 12.3 + * @since 1.5 + * @deprecated 2.5 */ public function notify() { @@ -96,8 +96,8 @@ public function notify() * * @return void * - * @since 11.1 - * @deprecated 12.3 + * @since 1.5 + * @deprecated 2.5 */ public function attach($observer) { @@ -165,8 +165,8 @@ public function attach($observer) * * @return boolean True if the observer object was detached. * - * @since 11.1 - * @deprecated 12.3 + * @since 1.5 + * @deprecated 2.5 */ public function detach($observer) { diff --git a/libraries/legacy/base/observer.php b/libraries/legacy/base/observer.php index d38d4f0cf04a7..b2d59540feabb 100644 --- a/libraries/legacy/base/observer.php +++ b/libraries/legacy/base/observer.php @@ -12,9 +12,8 @@ /** * Abstract observer class to implement the observer design pattern * - * @since 11.1 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - * @codeCoverageIgnore + * @since 1.5 + * @deprecated 2.5 */ abstract class JObserver extends JObject { @@ -22,8 +21,8 @@ abstract class JObserver extends JObject * Event object to observe. * * @var object - * @since 11.1 - * @deprecated 12.3 + * @since 1.5 + * @deprecated 2.5 */ protected $_subject = null; @@ -32,8 +31,8 @@ abstract class JObserver extends JObject * * @param object &$subject The object to observe. * - * @since 11.1 - * @deprecated 12.3 + * @since 1.5 + * @deprecated 2.5 */ public function __construct(&$subject) { @@ -51,8 +50,8 @@ public function __construct(&$subject) * * @return mixed * - * @since 11.1 - * @deprecated 12.3 + * @since 1.5 + * @deprecated 2.5 */ abstract public function update(&$args); } diff --git a/libraries/legacy/base/tree.php b/libraries/legacy/base/tree.php index 70e789d758b2c..d18d519712c92 100644 --- a/libraries/legacy/base/tree.php +++ b/libraries/legacy/base/tree.php @@ -12,32 +12,34 @@ /** * Tree Class. * - * @since 11.1 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - * @codeCoverageIgnore + * @since 1.5 + * @deprecated 3.0 */ class JTree extends JObject { /** * Root node * - * @var object - * @since 11.1 + * @var JNode + * @since 1.5 + * @deprecated 3.0 */ protected $_root = null; /** * Current working node * - * @var object - * @since 11.1 + * @var JNode + * @since 1.5 + * @deprecated 3.0 */ protected $_current = null; /** * Constructor * - * @since 11.1 + * @since 1.5 + * @deprecated 3.0 */ public function __construct() { @@ -53,9 +55,10 @@ public function __construct() * @param array &$node The node to process * @param boolean $setCurrent True to set as current working node * - * @return mixed + * @return void * - * @since 11.1 + * @since 1.5 + * @deprecated 3.0 */ public function addChild(&$node, $setCurrent = false) { @@ -74,7 +77,8 @@ public function addChild(&$node, $setCurrent = false) * * @return void * - * @since 11.1 + * @since 1.5 + * @deprecated 3.0 */ public function getParent() { @@ -88,7 +92,8 @@ public function getParent() * * @return void * - * @since 11.1 + * @since 1.5 + * @deprecated 3.0 */ public function reset() { diff --git a/libraries/legacy/categories/categories.php b/libraries/legacy/categories/categories.php index 380f73e3930ec..1bf8879f891a9 100644 --- a/libraries/legacy/categories/categories.php +++ b/libraries/legacy/categories/categories.php @@ -14,31 +14,31 @@ /** * JCategories Class. * - * @since 11.1 + * @since 1.6 */ class JCategories { /** * Array to hold the object instances * - * @var array - * @since 11.1 + * @var JCategories[] + * @since 1.6 */ public static $instances = array(); /** * Array of category nodes * - * @var mixed - * @since 11.1 + * @var JCategoryNode[] + * @since 1.6 */ protected $_nodes; /** * Array of checked categories -- used to save values when _nodes are null * - * @var array - * @since 11.1 + * @var boolean[] + * @since 1.6 */ protected $_checkedCategories; @@ -46,7 +46,7 @@ class JCategories * Name of the extension the categories belong to * * @var string - * @since 11.1 + * @since 1.6 */ protected $_extension = null; @@ -54,7 +54,7 @@ class JCategories * Name of the linked content table to get category content count * * @var string - * @since 11.1 + * @since 1.6 */ protected $_table = null; @@ -62,7 +62,7 @@ class JCategories * Name of the category field * * @var string - * @since 11.1 + * @since 1.6 */ protected $_field = null; @@ -70,7 +70,7 @@ class JCategories * Name of the key field * * @var string - * @since 11.1 + * @since 1.6 */ protected $_key = null; @@ -78,7 +78,7 @@ class JCategories * Name of the items state field * * @var string - * @since 11.1 + * @since 1.6 */ protected $_statefield = null; @@ -86,7 +86,7 @@ class JCategories * Array of options * * @var array - * @since 11.1 + * @since 1.6 */ protected $_options = null; @@ -95,7 +95,7 @@ class JCategories * * @param array $options Array of options * - * @since 11.1 + * @since 1.6 */ public function __construct($options) { @@ -119,9 +119,9 @@ public function __construct($options) * @param string $extension Name of the categories extension * @param array $options An array of options * - * @return JCategories JCategories object + * @return JCategories|boolean JCategories object on success, boolean false if an object does not exist * - * @since 11.1 + * @since 1.6 */ public static function getInstance($extension, $options = array()) { @@ -160,9 +160,9 @@ public static function getInstance($extension, $options = array()) * @param mixed $id an optional id integer or equal to 'root' * @param boolean $forceload True to force the _load method to execute * - * @return mixed JCategoryNode object or null if $id is not valid + * @return JCategoryNode|null|boolean JCategoryNode object or null if $id is not valid * - * @since 11.1 + * @since 1.6 */ public function get($id = 'root', $forceload = false) { @@ -203,7 +203,7 @@ public function get($id = 'root', $forceload = false) * * @return void * - * @since 11.1 + * @since 1.6 */ protected function _load($id) { @@ -388,7 +388,7 @@ protected function _load($id) /** * Helper class to load Categorytree * - * @since 11.1 + * @since 1.6 */ class JCategoryNode extends JObject { @@ -396,7 +396,7 @@ class JCategoryNode extends JObject * Primary key * * @var integer - * @since 11.1 + * @since 1.6 */ public $id = null; @@ -404,7 +404,7 @@ class JCategoryNode extends JObject * The id of the category in the asset table * * @var integer - * @since 11.1 + * @since 1.6 */ public $asset_id = null; @@ -412,7 +412,7 @@ class JCategoryNode extends JObject * The id of the parent of category in the asset table, 0 for category root * * @var integer - * @since 11.1 + * @since 1.6 */ public $parent_id = null; @@ -420,7 +420,7 @@ class JCategoryNode extends JObject * The lft value for this category in the category tree * * @var integer - * @since 11.1 + * @since 1.6 */ public $lft = null; @@ -428,7 +428,7 @@ class JCategoryNode extends JObject * The rgt value for this category in the category tree * * @var integer - * @since 11.1 + * @since 1.6 */ public $rgt = null; @@ -436,7 +436,7 @@ class JCategoryNode extends JObject * The depth of this category's position in the category tree * * @var integer - * @since 11.1 + * @since 1.6 */ public $level = null; @@ -444,7 +444,7 @@ class JCategoryNode extends JObject * The extension this category is associated with * * @var integer - * @since 11.1 + * @since 1.6 */ public $extension = null; @@ -452,7 +452,7 @@ class JCategoryNode extends JObject * The menu title for the category (a short name) * * @var string - * @since 11.1 + * @since 1.6 */ public $title = null; @@ -460,7 +460,7 @@ class JCategoryNode extends JObject * The the alias for the category * * @var string - * @since 11.1 + * @since 1.6 */ public $alias = null; @@ -468,7 +468,7 @@ class JCategoryNode extends JObject * Description of the category. * * @var string - * @since 11.1 + * @since 1.6 */ public $description = null; @@ -476,7 +476,7 @@ class JCategoryNode extends JObject * The publication status of the category * * @var boolean - * @since 11.1 + * @since 1.6 */ public $published = null; @@ -484,7 +484,7 @@ class JCategoryNode extends JObject * Whether the category is or is not checked out * * @var boolean - * @since 11.1 + * @since 1.6 */ public $checked_out = 0; @@ -492,7 +492,7 @@ class JCategoryNode extends JObject * The time at which the category was checked out * * @var string - * @since 11.1 + * @since 1.6 */ public $checked_out_time = 0; @@ -500,7 +500,7 @@ class JCategoryNode extends JObject * Access level for the category * * @var integer - * @since 11.1 + * @since 1.6 */ public $access = null; @@ -508,7 +508,7 @@ class JCategoryNode extends JObject * JSON string of parameters * * @var string - * @since 11.1 + * @since 1.6 */ public $params = null; @@ -516,7 +516,7 @@ class JCategoryNode extends JObject * Metadata description * * @var string - * @since 11.1 + * @since 1.6 */ public $metadesc = null; @@ -524,7 +524,7 @@ class JCategoryNode extends JObject * Key words for meta data * * @var string - * @since 11.1 + * @since 1.6 */ public $metakey = null; @@ -532,7 +532,7 @@ class JCategoryNode extends JObject * JSON string of other meta data * * @var string - * @since 11.1 + * @since 1.6 */ public $metadata = null; @@ -540,7 +540,7 @@ class JCategoryNode extends JObject * The ID of the user who created the category * * @var integer - * @since 11.1 + * @since 1.6 */ public $created_user_id = null; @@ -548,7 +548,7 @@ class JCategoryNode extends JObject * The time at which the category was created * * @var string - * @since 11.1 + * @since 1.6 */ public $created_time = null; @@ -556,7 +556,7 @@ class JCategoryNode extends JObject * The ID of the user who last modified the category * * @var integer - * @since 11.1 + * @since 1.6 */ public $modified_user_id = null; @@ -564,7 +564,7 @@ class JCategoryNode extends JObject * The time at which the category was modified * * @var string - * @since 11.1 + * @since 1.6 */ public $modified_time = null; @@ -572,7 +572,7 @@ class JCategoryNode extends JObject * Nmber of times the category has been viewed * * @var integer - * @since 11.1 + * @since 1.6 */ public $hits = null; @@ -580,7 +580,7 @@ class JCategoryNode extends JObject * The language for the category in xx-XX format * * @var string - * @since 11.1 + * @since 1.6 */ public $language = null; @@ -588,7 +588,7 @@ class JCategoryNode extends JObject * Number of items in this category or descendants of this category * * @var integer - * @since 11.1 + * @since 1.6 */ public $numitems = null; @@ -596,7 +596,7 @@ class JCategoryNode extends JObject * Number of children items * * @var integer - * @since 11.1 + * @since 1.6 */ public $childrennumitems = null; @@ -604,7 +604,7 @@ class JCategoryNode extends JObject * Slug fo the category (used in URL) * * @var string - * @since 11.1 + * @since 1.6 */ public $slug = null; @@ -612,21 +612,23 @@ class JCategoryNode extends JObject * Array of assets * * @var array - * @since 11.1 + * @since 1.6 */ public $assets = null; /** * Parent Category object * - * @var object - * @since 11.1 + * @var JCategoryNode + * @since 1.6 */ protected $_parent = null; /** - * @var Array of Children - * @since 11.1 + * Array of Children + * + * @var JCategoryNode[] + * @since 1.6 */ protected $_children = array(); @@ -634,39 +636,39 @@ class JCategoryNode extends JObject * Path from root to this category * * @var array - * @since 11.1 + * @since 1.6 */ protected $_path = array(); /** * Category left of this one * - * @var integer - * @since 11.1 + * @var JCategoryNode + * @since 1.6 */ protected $_leftSibling = null; /** * Category right of this one * - * @var - * @since 11.1 + * @var JCategoryNode + * @since 1.6 */ protected $_rightSibling = null; /** - * true if all children have been loaded + * Flag if all children have been loaded * - * @var boolean - * @since 11.1 + * @var boolean + * @since 1.6 */ protected $_allChildrenloaded = false; /** * Constructor of this tree * - * @var - * @since 11.1 + * @var JCategoryNode + * @since 1.6 */ protected $_constructor = null; @@ -676,7 +678,7 @@ class JCategoryNode extends JObject * @param array $category The category data. * @param JCategoryNode $constructor The tree constructor. * - * @since 11.1 + * @since 1.6 */ public function __construct($category = null, $constructor = null) { @@ -700,11 +702,11 @@ public function __construct($category = null, $constructor = null) * * If the category already has a parent, the link is unset * - * @param mixed $parent JCategoryNode for the parent to be set or null + * @param JCategoryNode|null $parent JCategoryNode for the parent to be set or null * * @return void * - * @since 11.1 + * @since 1.6 */ public function setParent($parent) { @@ -751,7 +753,7 @@ public function setParent($parent) * * @return void * - * @since 11.1 + * @since 1.6 */ public function addChild($child) { @@ -768,7 +770,7 @@ public function addChild($child) * * @return void * - * @since 11.1 + * @since 1.6 */ public function removeChild($id) { @@ -781,9 +783,9 @@ public function removeChild($id) * * @param boolean $recursive False by default * - * @return array The children + * @return JCategoryNode[] The children * - * @since 11.1 + * @since 1.6 */ public function &getChildren($recursive = false) { @@ -819,9 +821,9 @@ public function &getChildren($recursive = false) /** * Get the parent of this node * - * @return mixed JCategoryNode or null + * @return JCategoryNode * - * @since 11.1 + * @since 1.6 */ public function getParent() { @@ -833,7 +835,7 @@ public function getParent() * * @return boolean True if there is a child * - * @since 11.1 + * @since 1.6 */ public function hasChildren() { @@ -843,9 +845,9 @@ public function hasChildren() /** * Test if this node has a parent * - * @return boolean True if there is a parent + * @return boolean True if there is a parent * - * @since 11.1 + * @since 1.6 */ public function hasParent() { @@ -860,7 +862,7 @@ public function hasParent() * * @return void * - * @since 11.1 + * @since 1.6 */ public function setSibling($sibling, $right = true) { @@ -879,10 +881,9 @@ public function setSibling($sibling, $right = true) * * @param boolean $right If set to false, returns the left sibling * - * @return mixed JCategoryNode object with the sibling information or - * NULL if there is no sibling on that side. + * @return JCategoryNode|null JCategoryNode object with the sibling information or null if there is no sibling on that side. * - * @since 11.1 + * @since 1.6 */ public function getSibling($right = true) { @@ -910,7 +911,7 @@ public function getSibling($right = true) * * @return Registry * - * @since 11.1 + * @since 1.6 */ public function getParams() { @@ -927,7 +928,7 @@ public function getParams() * * @return Registry A Registry object containing the metadata * - * @since 11.1 + * @since 1.6 */ public function getMetadata() { @@ -944,7 +945,7 @@ public function getMetadata() * * @return array * - * @since 11.1 + * @since 1.6 */ public function getPath() { @@ -958,7 +959,7 @@ public function getPath() * * @return JUser A JUser object containing a userid * - * @since 11.1 + * @since 1.6 */ public function getAuthor($modified_user = false) { @@ -975,7 +976,7 @@ public function getAuthor($modified_user = false) * * @return void * - * @since 11.1 + * @since 1.6 */ public function setAllLoaded() { @@ -994,7 +995,7 @@ public function setAllLoaded() * * @return integer Number of children or descendants * - * @since 11.1 + * @since 1.6 */ public function getNumItems($recursive = false) { diff --git a/libraries/legacy/controller/admin.php b/libraries/legacy/controller/admin.php index dc7937acc8fda..9867cbb88f4de 100644 --- a/libraries/legacy/controller/admin.php +++ b/libraries/legacy/controller/admin.php @@ -15,7 +15,7 @@ * Controller (controllers are where you put all the actual code) Provides basic * functionality, such as rendering views (aka displaying templates). * - * @since 12.2 + * @since 1.6 */ class JControllerAdmin extends JControllerLegacy { @@ -23,7 +23,7 @@ class JControllerAdmin extends JControllerLegacy * The URL option for the component. * * @var string - * @since 12.2 + * @since 1.6 */ protected $option; @@ -31,7 +31,7 @@ class JControllerAdmin extends JControllerLegacy * The prefix to use with controller messages. * * @var string - * @since 12.2 + * @since 1.6 */ protected $text_prefix; @@ -39,7 +39,7 @@ class JControllerAdmin extends JControllerLegacy * The URL view list variable. * * @var string - * @since 12.2 + * @since 1.6 */ protected $view_list; @@ -49,7 +49,7 @@ class JControllerAdmin extends JControllerLegacy * @param array $config An optional associative array of configuration settings. * * @see JControllerLegacy - * @since 12.2 + * @since 1.6 * @throws Exception */ public function __construct($config = array()) @@ -103,7 +103,7 @@ public function __construct($config = array()) * * @return void * - * @since 12.2 + * @since 1.6 */ public function delete() { @@ -152,7 +152,7 @@ public function delete() * * @return void * - * @since 12.2 + * @since 3.1 */ protected function postDeleteHook(JModelLegacy $model, $id = null) { @@ -166,7 +166,7 @@ protected function postDeleteHook(JModelLegacy $model, $id = null) * * @return JControllerLegacy A JControllerLegacy object to support chaining. * - * @since 12.2 + * @since 1.6 */ public function display($cachable = false, $urlparams = array()) { @@ -178,7 +178,7 @@ public function display($cachable = false, $urlparams = array()) * * @return void * - * @since 12.2 + * @since 1.6 */ public function publish() { @@ -208,6 +208,7 @@ public function publish() { $model->publish($cid, $value); $errors = $model->getErrors(); + $ntext = null; if ($value == 1) { @@ -234,7 +235,10 @@ public function publish() $ntext = $this->text_prefix . '_N_ITEMS_TRASHED'; } - $this->setMessage(JText::plural($ntext, count($cid))); + if ($ntext !== null) + { + $this->setMessage(JText::plural($ntext, count($cid))); + } } catch (Exception $e) { @@ -252,7 +256,7 @@ public function publish() * * @return boolean True on success * - * @since 12.2 + * @since 1.6 */ public function reorder() { @@ -288,7 +292,7 @@ public function reorder() * * @return boolean True on success * - * @since 12.2 + * @since 1.6 */ public function saveorder() { @@ -332,7 +336,7 @@ public function saveorder() * * @return boolean True on success * - * @since 12.2 + * @since 1.6 */ public function checkin() { diff --git a/libraries/legacy/controller/form.php b/libraries/legacy/controller/form.php index 08a5689d381a0..e9621df7ddd57 100644 --- a/libraries/legacy/controller/form.php +++ b/libraries/legacy/controller/form.php @@ -12,7 +12,7 @@ /** * Controller tailored to suit most form-based admin operations. * - * @since 12.2 + * @since 1.6 * @todo Add ability to set redirect manually to better cope with frontend usage. */ class JControllerForm extends JControllerLegacy @@ -21,7 +21,7 @@ class JControllerForm extends JControllerLegacy * The context for storing internal data, e.g. record. * * @var string - * @since 12.2 + * @since 1.6 */ protected $context; @@ -29,7 +29,7 @@ class JControllerForm extends JControllerLegacy * The URL option for the component. * * @var string - * @since 12.2 + * @since 1.6 */ protected $option; @@ -37,7 +37,7 @@ class JControllerForm extends JControllerLegacy * The URL view item variable. * * @var string - * @since 12.2 + * @since 1.6 */ protected $view_item; @@ -45,7 +45,7 @@ class JControllerForm extends JControllerLegacy * The URL view list variable. * * @var string - * @since 12.2 + * @since 1.6 */ protected $view_list; @@ -53,7 +53,7 @@ class JControllerForm extends JControllerLegacy * The prefix to use with controller messages. * * @var string - * @since 12.2 + * @since 1.6 */ protected $text_prefix; @@ -63,7 +63,7 @@ class JControllerForm extends JControllerLegacy * @param array $config An optional associative array of configuration settings. * * @see JControllerLegacy - * @since 12.2 + * @since 1.6 * @throws Exception */ public function __construct($config = array()) @@ -140,7 +140,7 @@ public function __construct($config = array()) * * @return boolean True if the record can be added, false if not. * - * @since 12.2 + * @since 1.6 */ public function add() { @@ -186,7 +186,7 @@ public function add() * * @return boolean * - * @since 12.2 + * @since 1.6 */ protected function allowAdd($data = array()) { @@ -205,7 +205,7 @@ protected function allowAdd($data = array()) * * @return boolean * - * @since 12.2 + * @since 1.6 */ protected function allowEdit($data = array(), $key = 'id') { @@ -222,7 +222,7 @@ protected function allowEdit($data = array(), $key = 'id') * * @return boolean * - * @since 12.2 + * @since 1.6 */ protected function allowSave($data, $key = 'id') { @@ -245,7 +245,7 @@ protected function allowSave($data, $key = 'id') * * @return boolean True if successful, false otherwise and internal error is set. * - * @since 12.2 + * @since 1.7 */ public function batch($model) { @@ -292,7 +292,7 @@ public function batch($model) * * @return boolean True if access level checks pass, false otherwise. * - * @since 12.2 + * @since 1.6 */ public function cancel($key = null) { @@ -355,7 +355,7 @@ public function cancel($key = null) * * @return boolean True if access level check and checkout passes, false otherwise. * - * @since 12.2 + * @since 1.6 */ public function edit($key = null, $urlVar = null) { @@ -438,7 +438,7 @@ public function edit($key = null, $urlVar = null) * * @return JModelLegacy The model. * - * @since 12.2 + * @since 1.6 */ public function getModel($name = '', $prefix = '', $config = array('ignore_request' => true)) { @@ -458,7 +458,7 @@ public function getModel($name = '', $prefix = '', $config = array('ignore_reque * * @return string The arguments to append to the redirect URL. * - * @since 12.2 + * @since 1.6 */ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') { @@ -493,7 +493,7 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') * * @return string The arguments to append to the redirect URL. * - * @since 12.2 + * @since 1.6 */ protected function getRedirectToListAppend() { @@ -522,7 +522,7 @@ protected function getRedirectToListAppend() * * @return void * - * @since 12.2 + * @since 1.6 */ protected function postSaveHook(JModelLegacy $model, $validData = array()) { @@ -611,7 +611,7 @@ public function loadhistory() * * @return boolean True if successful, false otherwise. * - * @since 12.2 + * @since 1.6 */ public function save($key = null, $urlVar = null) { diff --git a/libraries/legacy/controller/legacy.php b/libraries/legacy/controller/legacy.php index 9b77f4755d798..395f3891707cd 100644 --- a/libraries/legacy/controller/legacy.php +++ b/libraries/legacy/controller/legacy.php @@ -15,7 +15,7 @@ * Controller (Controllers are where you put all the actual code.) Provides basic * functionality, such as rendering views (aka displaying templates). * - * @since 12.2 + * @since 2.5.5 */ class JControllerLegacy extends JObject { @@ -23,7 +23,7 @@ class JControllerLegacy extends JObject * The base path of the controller * * @var string - * @since 12.2 + * @since 3.0 */ protected $basePath; @@ -31,7 +31,7 @@ class JControllerLegacy extends JObject * The default view for the display method. * * @var string - * @since 12.2 + * @since 3.0 */ protected $default_view; @@ -39,7 +39,7 @@ class JControllerLegacy extends JObject * The mapped task that was performed. * * @var string - * @since 12.2 + * @since 3.0 */ protected $doTask; @@ -47,7 +47,7 @@ class JControllerLegacy extends JObject * Redirect message. * * @var string - * @since 12.2 + * @since 3.0 */ protected $message; @@ -55,7 +55,7 @@ class JControllerLegacy extends JObject * Redirect message type. * * @var string - * @since 12.2 + * @since 3.0 */ protected $messageType; @@ -63,7 +63,7 @@ class JControllerLegacy extends JObject * Array of class methods * * @var array - * @since 12.2 + * @since 3.0 */ protected $methods; @@ -71,7 +71,7 @@ class JControllerLegacy extends JObject * The name of the controller * * @var array - * @since 12.2 + * @since 3.0 */ protected $name; @@ -79,7 +79,7 @@ class JControllerLegacy extends JObject * The prefix of the models * * @var string - * @since 12.2 + * @since 3.0 */ protected $model_prefix; @@ -87,7 +87,7 @@ class JControllerLegacy extends JObject * The set of search directories for resources (views). * * @var array - * @since 12.2 + * @since 3.0 */ protected $paths; @@ -95,7 +95,7 @@ class JControllerLegacy extends JObject * URL for redirection. * * @var string - * @since 12.2 + * @since 3.0 */ protected $redirect; @@ -103,7 +103,7 @@ class JControllerLegacy extends JObject * Current or most recently performed task. * * @var string - * @since 12.2 + * @since 3.0 */ protected $task; @@ -111,7 +111,7 @@ class JControllerLegacy extends JObject * Array of class methods to call for a given task. * * @var array - * @since 12.2 + * @since 3.0 */ protected $taskMap; @@ -119,7 +119,7 @@ class JControllerLegacy extends JObject * Hold a JInput object for easier access to the input variables. * * @var JInput - * @since 12.2 + * @since 3.0 */ protected $input; @@ -127,7 +127,7 @@ class JControllerLegacy extends JObject * Instance container. * * @var JControllerLegacy - * @since 12.2 + * @since 3.0 */ protected static $instance; @@ -146,6 +146,8 @@ class JControllerLegacy extends JObject * @param string $prefix A prefix for models * * @return void + * + * @since 3.0 */ public static function addModelPath($path, $prefix = '') { @@ -160,7 +162,7 @@ public static function addModelPath($path, $prefix = '') * * @return string The filename. * - * @since 12.2 + * @since 3.0 */ protected static function createFileName($type, $parts = array()) { @@ -213,7 +215,7 @@ protected static function createFileName($type, $parts = array()) * * @return JControllerLegacy * - * @since 12.2 + * @since 3.0 * @throws Exception if the controller cannot be loaded. */ public static function getInstance($prefix, $config = array()) @@ -307,7 +309,7 @@ public static function getInstance($prefix, $config = array()) * Recognized key values include 'name', 'default_task', 'model_path', and * 'view_path' (this list is not meant to be comprehensive). * - * @since 12.2 + * @since 3.0 */ public function __construct($config = array()) { @@ -434,7 +436,7 @@ public function __construct($config = array()) * * @return JControllerLegacy A JControllerLegacy object to support chaining. * - * @since 12.2 + * @since 3.0 */ protected function addPath($type, $path) { @@ -465,6 +467,8 @@ protected function addPath($type, $path) * @param mixed $path The directory (string) or list of directories (array) to add. * * @return JControllerLegacy This object to support chaining. + * + * @since 3.0 */ public function addViewPath($path) { @@ -478,8 +482,8 @@ public function addViewPath($path) * * @return boolean True if authorised * - * @since 12.2 - * @deprecated 13.3 Use JAccess instead. + * @since 3.0 + * @deprecated 3.0 Use JAccess instead. */ public function authorise($task) { @@ -496,7 +500,7 @@ public function authorise($task) * * @return boolean True if the ID is in the edit list. * - * @since 12.2 + * @since 3.0 */ protected function checkEditId($context, $id) { @@ -537,7 +541,7 @@ protected function checkEditId($context, $id) * * @return JModelLegacy|boolean Model object on success; otherwise false on failure. * - * @since 12.2 + * @since 3.0 */ protected function createModel($name, $prefix = '', $config = array()) { @@ -563,7 +567,7 @@ protected function createModel($name, $prefix = '', $config = array()) * * @return JViewLegacy|null View object on success; null or error result on failure. * - * @since 12.2 + * @since 3.0 * @throws Exception */ protected function createView($name, $prefix = '', $type = '', $config = array()) @@ -608,7 +612,7 @@ protected function createView($name, $prefix = '', $type = '', $config = array() * * @return JControllerLegacy A JControllerLegacy object to support chaining. * - * @since 12.2 + * @since 3.0 */ public function display($cachable = false, $urlparams = array()) { @@ -675,7 +679,7 @@ public function display($cachable = false, $urlparams = array()) * * @return mixed The value returned by the called method. * - * @since 12.2 + * @since 3.0 * @throws Exception */ public function execute($task) @@ -712,7 +716,7 @@ public function execute($task) * * @return JModelLegacy|boolean Model object on success; otherwise false on failure. * - * @since 12.2 + * @since 3.0 */ public function getModel($name = '', $prefix = '', $config = array()) { @@ -757,7 +761,7 @@ public function getModel($name = '', $prefix = '', $config = array()) * * @return string The name of the dispatcher * - * @since 12.2 + * @since 3.0 * @throws Exception */ public function getName() @@ -782,7 +786,7 @@ public function getName() * * @return string The task that is being performed or was most recently performed. * - * @since 12.2 + * @since 3.0 */ public function getTask() { @@ -794,7 +798,7 @@ public function getTask() * * @return array Array[i] of task names. * - * @since 12.2 + * @since 3.0 */ public function getTasks() { @@ -811,7 +815,7 @@ public function getTasks() * * @return JViewLegacy Reference to the view or an error. * - * @since 12.2 + * @since 3.0 * @throws Exception */ public function getView($name = '', $type = '', $prefix = '', $config = array()) @@ -867,7 +871,7 @@ public function getView($name = '', $type = '', $prefix = '', $config = array()) * * @return void * - * @since 12.2 + * @since 3.0 */ protected function holdEditId($context, $id) { @@ -902,7 +906,7 @@ protected function holdEditId($context, $id) * * @return boolean False if no redirect exists. * - * @since 12.2 + * @since 3.0 */ public function redirect() { @@ -927,7 +931,7 @@ public function redirect() * * @return JControllerLegacy A JControllerLegacy object to support chaining. * - * @since 12.2 + * @since 3.0 */ public function registerDefaultTask($method) { @@ -944,7 +948,7 @@ public function registerDefaultTask($method) * * @return JControllerLegacy A JControllerLegacy object to support chaining. * - * @since 12.2 + * @since 3.0 */ public function registerTask($task, $method) { @@ -963,7 +967,7 @@ public function registerTask($task, $method) * * @return JControllerLegacy This object to support chaining. * - * @since 12.2 + * @since 3.0 */ public function unregisterTask($task) { @@ -980,7 +984,7 @@ public function unregisterTask($task) * * @return void * - * @since 12.2 + * @since 3.0 */ protected function releaseEditId($context, $id) { @@ -1019,7 +1023,7 @@ protected function releaseEditId($context, $id) * * @return string Previous message * - * @since 12.2 + * @since 3.0 */ public function setMessage($text, $type = 'message') { @@ -1038,7 +1042,7 @@ public function setMessage($text, $type = 'message') * * @return void * - * @since 12.2 + * @since 3.0 */ protected function setPath($type, $path) { @@ -1049,6 +1053,40 @@ protected function setPath($type, $path) $this->addPath($type, $path); } + /** + * Checks for a form token in the request. + * + * Use in conjunction with JHtml::_('form.token') or JSession::getFormToken. + * + * @param string $method The request method in which to look for the token key. + * @param boolean $redirect Whether to implicitly redirect user to the referrer page on failure or simply return false. + * + * @return boolean True if found and valid, otherwise return false or redirect to referrer page. + * + * @since __DEPLOY_VERSION__ + * @see JSession::checkToken() + */ + public function checkToken($method = 'post', $redirect = true) + { + $valid = JSession::checkToken($method); + + if (!$valid && $redirect) + { + $referrer = $this->input->server->getString('HTTP_REFERER'); + + if (!JUri::isInternal($referrer)) + { + $referrer = 'index.php'; + } + + $app = JFactory::getApplication(); + $app->enqueueMessage(JText::_('JINVALID_TOKEN_NOTICE'), 'warning'); + $app->redirect($referrer); + } + + return $valid; + } + /** * Set a URL for browser redirection. * @@ -1058,7 +1096,7 @@ protected function setPath($type, $path) * * @return JControllerLegacy This object to support chaining. * - * @since 12.2 + * @since 3.0 */ public function setRedirect($url, $msg = null, $type = null) { diff --git a/libraries/legacy/database/exception.php b/libraries/legacy/database/exception.php index 9a6250843a9df..14469d8885b68 100644 --- a/libraries/legacy/database/exception.php +++ b/libraries/legacy/database/exception.php @@ -14,8 +14,8 @@ /** * Exception class definition for the Database subpackage. * - * @since 11.1 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - Use semantic exceptions instead + * @since 1.7 + * @deprecated 2.5.5 */ class JDatabaseException extends RuntimeException { diff --git a/libraries/legacy/database/mysql.php b/libraries/legacy/database/mysql.php index a22be0c199dd1..172901e631cb1 100644 --- a/libraries/legacy/database/mysql.php +++ b/libraries/legacy/database/mysql.php @@ -15,8 +15,8 @@ * MySQL database driver * * @see http://dev.mysql.com/doc/ - * @since 11.1 - * @deprecated 13.1 (Platform) & 4.0 (CMS) - Use JDatabaseDriverMysql instead. + * @since 1.5 + * @deprecated 3.0 Use JDatabaseDriverMysql instead. */ class JDatabaseMysql extends JDatabaseDriverMysql { diff --git a/libraries/legacy/database/mysqli.php b/libraries/legacy/database/mysqli.php index cd8354480f9ea..64abae170ce1e 100644 --- a/libraries/legacy/database/mysqli.php +++ b/libraries/legacy/database/mysqli.php @@ -15,8 +15,8 @@ * MySQLi database driver * * @see https://secure.php.net/manual/en/book.mysqli.php - * @since 11.1 - * @deprecated 13.1 (Platform) & 4.0 (CMS) - Use JDatabaseDriverMysqli instead. + * @since 1.5 + * @deprecated 3.0 Use JDatabaseDriverMysqli instead. */ class JDatabaseMysqli extends JDatabaseDriverMysqli { diff --git a/libraries/legacy/database/sqlazure.php b/libraries/legacy/database/sqlazure.php index 3eac38d4c8ee5..c757b6c1c08dd 100644 --- a/libraries/legacy/database/sqlazure.php +++ b/libraries/legacy/database/sqlazure.php @@ -15,8 +15,8 @@ * SQL Server database driver * * @see https://azure.microsoft.com/en-us/documentation/services/sql-database/ - * @since 11.1 - * @deprecated 13.1 (Platform) & 4.0 (CMS) - Use JDatabaseDriverSqlazure instead. + * @since 1.7 + * @deprecated 3.0 Use JDatabaseDriverSqlazure instead. */ class JDatabaseSqlazure extends JDatabaseDriverSqlazure { diff --git a/libraries/legacy/database/sqlsrv.php b/libraries/legacy/database/sqlsrv.php index 50dc12029fdb9..52e1227f28ff7 100644 --- a/libraries/legacy/database/sqlsrv.php +++ b/libraries/legacy/database/sqlsrv.php @@ -15,8 +15,8 @@ * SQL Server database driver * * @see https://msdn.microsoft.com/en-us/library/cc296152(SQL.90).aspx - * @since 11.1 - * @deprecated 13.1 (Platform) & 4.0 (CMS) - Use JDatabaseDriverSqlsrv instead. + * @since 1.7 + * @deprecated 3.0 Use JDatabaseDriverSqlsrv instead. */ class JDatabaseSqlsrv extends JDatabaseDriverSqlsrv { diff --git a/libraries/legacy/dispatcher/dispatcher.php b/libraries/legacy/dispatcher/dispatcher.php index e0568ae43896a..eb4a00206c1d2 100644 --- a/libraries/legacy/dispatcher/dispatcher.php +++ b/libraries/legacy/dispatcher/dispatcher.php @@ -12,16 +12,15 @@ /** * Deprecated class placeholder. You should use JEventDispatcher instead. * - * @since 11.1 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - * @codeCoverageIgnore + * @since 1.5 + * @deprecated 3.0 */ class JDispatcher extends JEventDispatcher { /** * Constructor. * - * @since 11.1 + * @since 1.5 */ public function __construct() { diff --git a/libraries/legacy/error/error.php b/libraries/legacy/error/error.php index b50952a3beea3..79575213ef9d3 100644 --- a/libraries/legacy/error/error.php +++ b/libraries/legacy/error/error.php @@ -13,8 +13,8 @@ * Error Definition: Illegal Options * * @var integer - * @since 11.1 - * @deprecated 12.1 (Platform) & 4.0 (CMS) + * @since 1.5 + * @deprecated 1.7 */ const JERROR_ILLEGAL_OPTIONS = 1; @@ -22,8 +22,8 @@ * Error Definition: Callback does not exist * * @var integer - * @since 11.1 - * @deprecated 12.1 (Platform) & 4.0 (CMS) + * @since 1.5 + * @deprecated 1.7 */ const JERROR_CALLBACK_NOT_CALLABLE = 2; @@ -31,8 +31,8 @@ * Error Definition: Illegal Handler * * @var integer - * @since 11.1 - * @deprecated 12.1 (Platform) & 4.0 (CMS) + * @since 1.5 + * @deprecated 1.7 */ const JERROR_ILLEGAL_MODE = 3; @@ -46,8 +46,8 @@ * - Sebastian Mordziol * - Stephan Schmidt * - * @since 11.1 - * @deprecated 12.1 (Platform) & 4.0 (CMS) - Use PHP Exception + * @since 1.5 + * @deprecated 1.7 */ abstract class JError { @@ -57,8 +57,8 @@ abstract class JError * @var boolean True to enable legacy error handling using JError, false to use exception handling. This flag * is present to allow an easy transition into exception handling for code written against the * existing JError API in Joomla. - * @since 11.1 - * @deprecated 12.1 (Platform) & 4.0 (CMS) + * @since 1.7 + * @deprecated 1.7 */ public static $legacy = false; @@ -66,8 +66,8 @@ abstract class JError * Array of message levels * * @var array - * @since 11.1 - * @deprecated 12.1 (Platform) & 4.0 (CMS) + * @since 1.6 + * @deprecated 1.7 */ protected static $levels = array(E_NOTICE => 'Notice', E_WARNING => 'Warning', E_ERROR => 'Error'); @@ -75,8 +75,8 @@ abstract class JError * Array of message handlers * * @var array - * @since 11.1 - * @deprecated 12.1 (Platform) & 4.0 (CMS) + * @since 1.6 + * @deprecated 1.7 */ protected static $handlers = array( E_NOTICE => array('mode' => 'ignore'), @@ -88,8 +88,8 @@ abstract class JError * Array containing the error stack * * @var JException[] - * @since 11.1 - * @deprecated 12.1 (Platform) & 4.0 (CMS) + * @since 1.6 + * @deprecated 1.7 */ protected static $stack = array(); @@ -100,8 +100,8 @@ abstract class JError * * @return boolean True if argument is an exception, false otherwise. * - * @deprecated 12.1 - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ public static function isError($object) { @@ -117,8 +117,8 @@ public static function isError($object) * * @return JException|boolean Last JException object in the error stack or boolean false if none exist * - * @deprecated 12.1 - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ public static function getError($unset = false) { @@ -146,8 +146,8 @@ public static function getError($unset = false) * * @return JException[] Chronological array of errors that have been stored during script execution * - * @deprecated 12.1 - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ public static function getErrors() { @@ -163,8 +163,8 @@ public static function getErrors() * * @return void * - * @since 11.1 - * @deprecated 12.1 + * @since 1.6 + * @deprecated 1.7 */ public static function addToStack(JException &$e) { @@ -188,8 +188,8 @@ public static function addToStack(JException &$e) * * @return JException * - * @since 11.1 - * @deprecated 12.1 Use PHP Exception + * @since 1.5 + * @deprecated 1.7 * @see JException */ public static function raise($level, $code, $msg, $info = null, $backtrace = false) @@ -209,9 +209,9 @@ public static function raise($level, $code, $msg, $info = null, $backtrace = fal * * @return JException A reference to the handled JException object * - * @deprecated 12.1 Use PHP Exception + * @since 1.6 + * @deprecated 1.7 * @see JException - * @since 11.1 */ public static function throwError(&$exception) { @@ -266,9 +266,9 @@ public static function throwError(&$exception) * * @return JException $error The thrown JException object * - * @deprecated 12.1 Use PHP Exception - * @see JError::raise() - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 + * @see JError::raise() */ public static function raiseError($code, $msg, $info = null) { @@ -288,9 +288,9 @@ public static function raiseError($code, $msg, $info = null) * * @return JException $error The thrown JException object * - * @deprecated 12.1 Use PHP Exception - * @see JError::raise() - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 + * @see JError::raise() */ public static function raiseWarning($code, $msg, $info = null) { @@ -310,9 +310,9 @@ public static function raiseWarning($code, $msg, $info = null) * * @return JException $error The thrown JException object * - * @deprecated 12.1 Use PHP Exception - * @see raise() - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 + * @see JError::raise() */ public static function raiseNotice($code, $msg, $info = null) { @@ -329,8 +329,8 @@ public static function raiseNotice($code, $msg, $info = null) * * @return array All error handling details * - * @deprecated 12.1 Use PHP Exception - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ public static function getErrorHandling($level) { @@ -363,8 +363,8 @@ public static function getErrorHandling($level) * * @return boolean|JException True on success or a JException object if failed. * - * @deprecated 12.1 Use PHP Exception - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ public static function setErrorHandling($level, $mode, $options = null) { @@ -434,9 +434,9 @@ public static function setErrorHandling($level, $mode, $options = null) * * @return void * - * @deprecated 12.1 + * @since 1.5 + * @deprecated 1.7 * @see set_error_handler - * @since 11.1 */ public static function attachHandler() { @@ -450,9 +450,9 @@ public static function attachHandler() * * @return void * - * @deprecated 12.1 + * @since 1.5 + * @deprecated 1.7 * @see restore_error_handler - * @since 11.1 */ public static function detachHandler() { @@ -475,8 +475,8 @@ public static function detachHandler() * * @return boolean True on success; false if the level already has been registered * - * @deprecated 12.1 - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ public static function registerErrorLevel($level, $name, $handler = 'ignore') { @@ -501,10 +501,9 @@ public static function registerErrorLevel($level, $name, $handler = 'ignore') * * @return string|boolean Human readable error level name or boolean false if it doesn't exist * - * @deprecated 12.1 - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ - public static function translateErrorLevel($level) { JLog::add('JError::translateErrorLevel() is deprecated.', JLog::WARNING, 'deprecated'); @@ -526,9 +525,9 @@ public static function translateErrorLevel($level) * * @return JException The exception object * - * @deprecated 12.1 + * @since 1.5 + * @deprecated 1.7 * @see JError::raise() - * @since 11.1 */ public static function handleIgnore(&$error, $options) { @@ -546,9 +545,9 @@ public static function handleIgnore(&$error, $options) * * @return JException The exception object * - * @deprecated 12.1 - * @see JError::raise() - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 + * @see JError::raise() */ public static function handleEcho(&$error, $options) { @@ -622,9 +621,9 @@ public static function handleEcho(&$error, $options) * * @return JException The exception object * - * @deprecated 12.1 - * @see JError::raise() - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 + * @see JError::raise() */ public static function handleVerbose(&$error, $options) { @@ -668,9 +667,9 @@ public static function handleVerbose(&$error, $options) * * @return void Calls die() * - * @deprecated 12.1 - * @see JError::raise() - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 + * @see JError::raise() */ public static function handleDie(&$error, $options) { @@ -709,9 +708,9 @@ public static function handleDie(&$error, $options) * * @return JException The exception object * - * @deprecated 12.1 - * @see JError::raise() - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 + * @see JError::raise() */ public static function handleMessage(&$error, $options) { @@ -733,9 +732,9 @@ public static function handleMessage(&$error, $options) * * @return JException The exception object * - * @deprecated 12.1 - * @see JError::raise() - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 + * @see JError::raise() */ public static function handleLog(&$error, $options) { @@ -770,9 +769,9 @@ public static function handleLog(&$error, $options) * * @return JException The exception object * - * @deprecated 12.1 - * @see JError::raise() - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 + * @see JError::raise() */ public static function handleCallback(&$error, $options) { @@ -788,8 +787,8 @@ public static function handleCallback(&$error, $options) * * @return void * - * @deprecated 12.1 - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ public static function customErrorPage($error) { @@ -808,8 +807,8 @@ public static function customErrorPage($error) * * @return void * - * @deprecated 12.1 - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ public static function customErrorHandler($level, $msg) { @@ -825,8 +824,8 @@ public static function customErrorHandler($level, $msg) * * @return string Contents of the backtrace * - * @deprecated 12.1 - * @since 11.1 + * @since 1.6 + * @deprecated 1.7 */ public static function renderBacktrace($error) { diff --git a/libraries/legacy/exception/exception.php b/libraries/legacy/exception/exception.php index 6659ba5ee44ef..90d4c32dece33 100644 --- a/libraries/legacy/exception/exception.php +++ b/libraries/legacy/exception/exception.php @@ -12,26 +12,35 @@ /** * Joomla! Exception object. * - * @since 11.1 - * @deprecated 12.1 (Platform) & 4.0 (CMS) + * @since 1.5 + * @deprecated 1.7 */ class JException extends Exception { /** - * @var string Error level. - * @since 11.1 + * Error level. + * + * @var string + * @since 1.5 + * @deprecated 1.7 */ protected $level = null; /** - * @var string Error code. - * @since 11.1 + * Error code. + * + * @var string + * @since 1.5 + * @deprecated 1.7 */ protected $code = null; /** - * @var string Error message. - * @since 11.1 + * Error message. + * + * @var string + * @since 1.5 + * @deprecated 1.7 */ protected $message = null; @@ -40,7 +49,8 @@ class JException extends Exception * for example, if a database connect fails, the dsn used * * @var string - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ protected $info = ''; @@ -48,15 +58,17 @@ class JException extends Exception * Name of the file the error occurred in [Available if backtrace is enabled] * * @var string - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ protected $file = null; /** * Line number the error occurred in [Available if backtrace is enabled] * - * @var int - * @since 11.1 + * @var integer + * @since 1.5 + * @deprecated 1.7 */ protected $line = 0; @@ -64,7 +76,8 @@ class JException extends Exception * Name of the method the error occurred in [Available if backtrace is enabled] * * @var string - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ protected $function = null; @@ -72,13 +85,15 @@ class JException extends Exception * Name of the class the error occurred in [Available if backtrace is enabled] * * @var string - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ protected $class = null; /** * @var string Error type. - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ protected $type = null; @@ -86,29 +101,41 @@ class JException extends Exception * Arguments received by the method the error occurred in [Available if backtrace is enabled] * * @var array - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ protected $args = array(); /** - * @var mixed Backtrace information. - * @since 11.1 + * Backtrace information. + * + * @var mixed + * @since 1.5 + * @deprecated 1.7 */ protected $backtrace = null; + /** + * Container holding the error messages + * + * @var string[] + * @since 1.6 + * @deprecated 1.7 + */ + protected $_errors = array(); + /** * Constructor * - used to set up the error with all needed error details. * * @param string $msg The error message - * @param string $code The error code from the application + * @param integer $code The error code from the application * @param integer $level The error level (use the PHP constants E_ALL, E_NOTICE etc.). * @param string $info Optional: The additional error information. * @param boolean $backtrace True if backtrace information is to be collected * - * @since 11.1 - * - * @deprecated 12.1 + * @since 1.5 + * @deprecated 1.7 */ public function __construct($msg, $code = 0, $level = null, $info = null, $backtrace = false) { @@ -178,9 +205,8 @@ public function __construct($msg, $code = 0, $level = null, $info = null, $backt * * @return string Error message * - * @since 11.1 - * - * @deprecated 12.1 + * @since 1.6 + * @deprecated 1.7 */ public function __toString() { @@ -194,8 +220,8 @@ public function __toString() * * @return string Error message * - * @since 11.1 - * @deprecated 12.1 + * @since 1.5 + * @deprecated 1.7 */ public function toString() { @@ -212,9 +238,9 @@ public function toString() * * @return mixed The value of the property or null * - * @deprecated 12.1 - * @see JException::getProperties() - * @since 11.1 + * @since 1.6 + * @deprecated 1.7 + * @see JException::getProperties() */ public function get($property, $default = null) { @@ -235,9 +261,9 @@ public function get($property, $default = null) * * @return array Object properties * - * @deprecated 12.1 + * @since 1.6 + * @deprecated 1.7 * @see JException::get() - * @since 11.1 */ public function getProperties($public = true) { @@ -267,9 +293,8 @@ public function getProperties($public = true) * * @return string Error message * - * @since 11.1 - * - * @deprecated 12.1 + * @since 1.6 + * @deprecated 1.7 */ public function getError($i = null, $toString = true) { @@ -305,9 +330,8 @@ public function getError($i = null, $toString = true) * * @return array Array of error messages or JErrors * - * @since 11.1 - * - * @deprecated 12.1 + * @since 1.6 + * @deprecated 1.7 */ public function getErrors() { @@ -324,9 +348,9 @@ public function getErrors() * * @return mixed Previous value of the property * - * @deprecated 12.1 - * @see JException::setProperties() - * @since 11.1 + * @since 1.6 + * @deprecated 1.7 + * @see JException::setProperties() */ public function set($property, $value = null) { @@ -345,9 +369,9 @@ public function set($property, $value = null) * * @return boolean * - * @deprecated 12.1 - * @see JException::set() - * @since 11.1 + * @since 1.6 + * @deprecated 1.7 + * @see JException::set() */ public function setProperties($properties) { @@ -376,9 +400,8 @@ public function setProperties($properties) * * @return void * - * @since 11.1 - * - * @deprecated 12.1 + * @since 1.6 + * @deprecated 1.7 */ public function setError($error) { diff --git a/libraries/legacy/form/field/category.php b/libraries/legacy/form/field/category.php index c5cabb9fb5fd7..93c627220f364 100644 --- a/libraries/legacy/form/field/category.php +++ b/libraries/legacy/form/field/category.php @@ -9,21 +9,19 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Supports an HTML select list of categories * - * @since 11.1 + * @since 1.6 */ -class JFormFieldCategory extends JFormFieldList +class JFormFieldCategory extends JFormAbstractlist { /** * The form field type. * * @var string - * @since 11.1 + * @since 1.6 */ public $type = 'Category'; @@ -35,7 +33,7 @@ class JFormFieldCategory extends JFormFieldList * * @return array The field option objects. * - * @since 11.1 + * @since 1.6 */ protected function getOptions() { diff --git a/libraries/legacy/form/field/componentlayout.php b/libraries/legacy/form/field/componentlayout.php index 0e7207f6a7fdb..b203715e07c2b 100644 --- a/libraries/legacy/form/field/componentlayout.php +++ b/libraries/legacy/form/field/componentlayout.php @@ -15,7 +15,7 @@ * Form Field to display a list of the layouts for a component view from * the extension or template overrides. * - * @since 11.1 + * @since 1.6 */ class JFormFieldComponentlayout extends JFormField { @@ -23,7 +23,7 @@ class JFormFieldComponentlayout extends JFormField * The form field type. * * @var string - * @since 11.1 + * @since 1.6 */ protected $type = 'ComponentLayout'; @@ -32,7 +32,7 @@ class JFormFieldComponentlayout extends JFormField * * @return string The field input. * - * @since 11.1 + * @since 1.6 */ protected function getInput() { diff --git a/libraries/legacy/form/field/modulelayout.php b/libraries/legacy/form/field/modulelayout.php index 54f3a633c5037..d9712c9788c38 100644 --- a/libraries/legacy/form/field/modulelayout.php +++ b/libraries/legacy/form/field/modulelayout.php @@ -14,7 +14,7 @@ /** * Form Field to display a list of the layouts for module display from the module or template overrides. * - * @since 11.1 + * @since 1.6 */ class JFormFieldModulelayout extends JFormField { @@ -22,7 +22,7 @@ class JFormFieldModulelayout extends JFormField * The form field type. * * @var string - * @since 11.1 + * @since 1.6 */ protected $type = 'ModuleLayout'; @@ -31,7 +31,7 @@ class JFormFieldModulelayout extends JFormField * * @return string The field input. * - * @since 11.1 + * @since 1.6 */ protected function getInput() { diff --git a/libraries/legacy/log/logexception.php b/libraries/legacy/log/logexception.php index 8a40585d4e2f5..efcc844d8b1b3 100644 --- a/libraries/legacy/log/logexception.php +++ b/libraries/legacy/log/logexception.php @@ -14,8 +14,8 @@ /** * Exception class definition for the Log subpackage. * - * @since 11.1 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - Use semantic exceptions instead + * @since 1.7 + * @deprecated 2.5.5 Use semantic exceptions instead */ class LogException extends RuntimeException { diff --git a/libraries/legacy/model/admin.php b/libraries/legacy/model/admin.php index 6772842789c35..3aaefa6ed8c30 100644 --- a/libraries/legacy/model/admin.php +++ b/libraries/legacy/model/admin.php @@ -15,7 +15,7 @@ /** * Prototype admin model. * - * @since 12.2 + * @since 1.6 */ abstract class JModelAdmin extends JModelForm { @@ -23,7 +23,7 @@ abstract class JModelAdmin extends JModelForm * The prefix to use with controller messages. * * @var string - * @since 12.2 + * @since 1.6 */ protected $text_prefix = null; @@ -31,7 +31,7 @@ abstract class JModelAdmin extends JModelForm * The event to trigger after deleting the data. * * @var string - * @since 12.2 + * @since 1.6 */ protected $event_after_delete = null; @@ -39,7 +39,7 @@ abstract class JModelAdmin extends JModelForm * The event to trigger after saving the data. * * @var string - * @since 12.2 + * @since 1.6 */ protected $event_after_save = null; @@ -47,7 +47,7 @@ abstract class JModelAdmin extends JModelForm * The event to trigger before deleting the data. * * @var string - * @since 12.2 + * @since 1.6 */ protected $event_before_delete = null; @@ -55,7 +55,7 @@ abstract class JModelAdmin extends JModelForm * The event to trigger before saving the data. * * @var string - * @since 12.2 + * @since 1.6 */ protected $event_before_save = null; @@ -63,7 +63,7 @@ abstract class JModelAdmin extends JModelForm * The event to trigger after changing the published state of the data. * * @var string - * @since 12.2 + * @since 1.6 */ protected $event_change_state = null; @@ -71,14 +71,16 @@ abstract class JModelAdmin extends JModelForm * Batch copy/move command. If set to false, * the batch copy/move command is not supported * - * @var string + * @var string + * @since 3.4 */ protected $batch_copymove = 'category_id'; /** * Allowed batch commands * - * @var array + * @var array + * @since 3.4 */ protected $batch_commands = array( 'assetgroup_id' => 'batchAccess', @@ -100,7 +102,7 @@ abstract class JModelAdmin extends JModelForm * @param array $config An optional associative array of configuration settings. * * @see JModelLegacy - * @since 12.2 + * @since 1.6 */ public function __construct($config = array()) { @@ -182,7 +184,7 @@ public function __construct($config = array()) * * @return boolean Returns true on success, false on failure. * - * @since 12.2 + * @since 1.7 */ public function batch($commands, $pks, $contexts) { @@ -285,7 +287,7 @@ public function batch($commands, $pks, $contexts) * * @return boolean True if successful, false otherwise and internal error is set. * - * @since 12.2 + * @since 1.7 */ protected function batchAccess($value, $pks, $contexts) { @@ -342,7 +344,7 @@ protected function batchAccess($value, $pks, $contexts) * * @return array|boolean An array of new IDs on success, boolean false on failure. * - * @since 12.2 + * @since 1.7 */ protected function batchCopy($value, $pks, $contexts) { @@ -455,7 +457,7 @@ protected function batchCopy($value, $pks, $contexts) * * @return boolean True if successful, false otherwise and internal error is set. * - * @since 11.3 + * @since 2.5 */ protected function batchLanguage($value, $pks, $contexts) { @@ -512,7 +514,7 @@ protected function batchLanguage($value, $pks, $contexts) * * @return boolean True if successful, false otherwise and internal error is set. * - * @since 12.2 + * @since 1.7 */ protected function batchMove($value, $pks, $contexts) { @@ -651,7 +653,7 @@ protected function batchTag($value, $pks, $contexts) * * @return boolean True if allowed to delete the record. Defaults to the permission for the component. * - * @since 12.2 + * @since 1.6 */ protected function canDelete($record) { @@ -665,7 +667,7 @@ protected function canDelete($record) * * @return boolean True if allowed to change the state of the record. Defaults to the permission for the component. * - * @since 12.2 + * @since 1.6 */ protected function canEditState($record) { @@ -679,7 +681,7 @@ protected function canEditState($record) * * @return integer|boolean Boolean false if there is an error, otherwise the count of records checked in. * - * @since 12.2 + * @since 1.6 */ public function checkin($pks = array()) { @@ -725,7 +727,7 @@ public function checkin($pks = array()) * * @return boolean True if successful, false if an error occurs. * - * @since 12.2 + * @since 1.6 */ public function checkout($pk = null) { @@ -741,7 +743,7 @@ public function checkout($pk = null) * * @return boolean True if successful, false if an error occurs. * - * @since 12.2 + * @since 1.6 */ public function delete(&$pks) { @@ -856,7 +858,7 @@ public function delete(&$pks) * * @return array Contains the modified title and alias. * - * @since 12.2 + * @since 1.7 */ protected function generateNewTitle($category_id, $alias, $title) { @@ -879,7 +881,7 @@ protected function generateNewTitle($category_id, $alias, $title) * * @return JObject|boolean Object on success, false on failure. * - * @since 12.2 + * @since 1.6 */ public function getItem($pk = null) { @@ -920,7 +922,7 @@ public function getItem($pk = null) * * @return array An array of conditions to add to ordering queries. * - * @since 12.2 + * @since 1.6 */ protected function getReorderConditions($table) { @@ -932,7 +934,7 @@ protected function getReorderConditions($table) * * @return void * - * @since 12.2 + * @since 1.6 */ protected function populateState() { @@ -955,7 +957,7 @@ protected function populateState() * * @return void * - * @since 12.2 + * @since 1.6 */ protected function prepareTable($table) { @@ -970,7 +972,7 @@ protected function prepareTable($table) * * @return boolean True on success. * - * @since 12.2 + * @since 1.6 */ public function publish(&$pks, $value = 1) { @@ -1049,7 +1051,7 @@ public function publish(&$pks, $value = 1) * * @return boolean|null False on failure or error, true on success, null if the $pk is empty (no items selected). * - * @since 12.2 + * @since 1.6 */ public function reorder($pks, $delta = 0) { @@ -1116,7 +1118,7 @@ public function reorder($pks, $delta = 0) * * @return boolean True on success, False on error. * - * @since 12.2 + * @since 1.6 */ public function save($data) { @@ -1290,7 +1292,7 @@ public function save($data) * * @return boolean|JException Boolean true on success, false on failure, or JException if no items are selected * - * @since 12.2 + * @since 1.6 */ public function saveorder($pks = array(), $order = null) { diff --git a/libraries/legacy/model/form.php b/libraries/legacy/model/form.php index 525d483ba837c..f142d541eb9c4 100644 --- a/libraries/legacy/model/form.php +++ b/libraries/legacy/model/form.php @@ -15,7 +15,7 @@ * @see JForm * @see JFormField * @see JFormRule - * @since 12.2 + * @since 1.6 */ abstract class JModelForm extends JModelLegacy { @@ -23,14 +23,15 @@ abstract class JModelForm extends JModelLegacy * Array of form objects. * * @var JForm[] - * @since 12.2 + * @since 1.6 */ protected $_forms = array(); /** * Maps events to plugin groups. * - * @var array + * @var array + * @since 3.6 */ protected $events_map = null; @@ -63,7 +64,7 @@ public function __construct($config = array()) * * @return boolean False on failure or error, true otherwise. * - * @since 12.2 + * @since 1.6 */ public function checkin($pk = null) { @@ -115,7 +116,7 @@ public function checkin($pk = null) * * @return boolean False on failure or error, true otherwise. * - * @since 12.2 + * @since 1.6 */ public function checkout($pk = null) { @@ -168,7 +169,7 @@ public function checkout($pk = null) * * @return JForm|boolean A JForm object on success, false on failure * - * @since 12.2 + * @since 1.6 */ abstract public function getForm($data = array(), $loadData = true); @@ -184,7 +185,7 @@ abstract public function getForm($data = array(), $loadData = true); * @return JForm|boolean JForm object on success, false on error. * * @see JForm - * @since 12.2 + * @since 1.6 */ protected function loadForm($name, $source = null, $options = array(), $clear = false, $xpath = false) { @@ -245,7 +246,7 @@ protected function loadForm($name, $source = null, $options = array(), $clear = * * @return array The default data is an empty array. * - * @since 12.2 + * @since 1.6 */ protected function loadFormData() { @@ -289,7 +290,7 @@ protected function preprocessData($context, &$data, $group = 'content') * @return void * * @see JFormField - * @since 12.2 + * @since 1.6 * @throws Exception if there is an error in the form event. */ protected function preprocessForm(JForm $form, $data, $group = 'content') @@ -327,7 +328,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') * * @see JFormRule * @see JFilterInput - * @since 12.2 + * @since 1.6 */ public function validate($form, $data, $group = null) { diff --git a/libraries/legacy/model/item.php b/libraries/legacy/model/item.php index 0730c34ce6738..6f1a71fdeed00 100644 --- a/libraries/legacy/model/item.php +++ b/libraries/legacy/model/item.php @@ -12,7 +12,7 @@ /** * Prototype item model. * - * @since 12.2 + * @since 1.6 */ abstract class JModelItem extends JModelLegacy { @@ -20,6 +20,7 @@ abstract class JModelItem extends JModelLegacy * An item. * * @var array + * @since 1.6 */ protected $_item = null; @@ -27,7 +28,7 @@ abstract class JModelItem extends JModelLegacy * Model context string. * * @var string - * @since 12.2 + * @since 1.6 */ protected $_context = 'group.type'; @@ -42,7 +43,7 @@ abstract class JModelItem extends JModelLegacy * * @return string A store id. * - * @since 12.2 + * @since 1.6 */ protected function getStoreId($id = '') { diff --git a/libraries/legacy/model/legacy.php b/libraries/legacy/model/legacy.php index c415d20528ed1..9158ca1a326cc 100644 --- a/libraries/legacy/model/legacy.php +++ b/libraries/legacy/model/legacy.php @@ -14,7 +14,7 @@ * * Acts as a Factory class for application specific objects and provides many supporting API functions. * - * @since 12.2 + * @since 2.5.5 */ abstract class JModelLegacy extends JObject { @@ -22,7 +22,7 @@ abstract class JModelLegacy extends JObject * Indicates if the internal state has been set * * @var boolean - * @since 12.2 + * @since 3.0 */ protected $__state_set = null; @@ -30,7 +30,7 @@ abstract class JModelLegacy extends JObject * Database Connector * * @var JDatabaseDriver - * @since 12.2 + * @since 3.0 */ protected $_db; @@ -38,7 +38,7 @@ abstract class JModelLegacy extends JObject * The model (base) name * * @var string - * @since 12.2 + * @since 3.0 */ protected $name; @@ -46,7 +46,7 @@ abstract class JModelLegacy extends JObject * The URL option for the component. * * @var string - * @since 12.2 + * @since 3.0 */ protected $option = null; @@ -54,7 +54,7 @@ abstract class JModelLegacy extends JObject * A state object * * @var JObject - * @since 12.2 + * @since 3.0 */ protected $state; @@ -62,7 +62,7 @@ abstract class JModelLegacy extends JObject * The event to trigger when cleaning cache. * * @var string - * @since 12.2 + * @since 3.0 */ protected $event_clean_cache = null; @@ -75,7 +75,7 @@ abstract class JModelLegacy extends JObject * * @return array An array with directory elements. If prefix is equal to '', all directories are returned. * - * @since 12.2 + * @since 3.0 */ public static function addIncludePath($path = '', $prefix = '') { @@ -129,7 +129,7 @@ public static function addIncludePath($path = '', $prefix = '') * * @return void * - * @since 12.2 + * @since 3.0 */ public static function addTablePath($path) { @@ -144,7 +144,7 @@ public static function addTablePath($path) * * @return string The filename * - * @since 12.2 + * @since 3.0 */ protected static function _createFileName($type, $parts = array()) { @@ -169,7 +169,7 @@ protected static function _createFileName($type, $parts = array()) * * @return JModelLegacy|boolean A JModelLegacy instance or false on failure * - * @since 12.2 + * @since 3.0 */ public static function getInstance($type, $prefix = '', $config = array()) { @@ -209,7 +209,7 @@ public static function getInstance($type, $prefix = '', $config = array()) * * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). * - * @since 12.2 + * @since 3.0 * @throws Exception */ public function __construct($config = array()) @@ -300,7 +300,7 @@ public function __construct($config = array()) * * @return object[] An array of results. * - * @since 12.2 + * @since 3.0 * @throws RuntimeException */ protected function _getList($query, $limitstart = 0, $limit = 0) @@ -317,7 +317,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0) * * @return integer Number of rows for query. * - * @since 12.2 + * @since 3.0 */ protected function _getListCount($query) { @@ -361,7 +361,7 @@ protected function _getListCount($query) * * @return JTable|boolean Table object or boolean false if failed * - * @since 12.2 + * @since 3.0 * @see JTable::getInstance() */ protected function _createTable($name, $prefix = 'Table', $config = array()) @@ -383,6 +383,8 @@ protected function _createTable($name, $prefix = 'Table', $config = array()) * Method to get the database driver object * * @return JDatabaseDriver + * + * @since 3.0 */ public function getDbo() { @@ -397,7 +399,7 @@ public function getDbo() * * @return string The name of the model * - * @since 12.2 + * @since 3.0 * @throws Exception */ public function getName() @@ -425,7 +427,7 @@ public function getName() * * @return mixed The property where specified, the state object where omitted * - * @since 12.2 + * @since 3.0 */ public function getState($property = null, $default = null) { @@ -450,7 +452,7 @@ public function getState($property = null, $default = null) * * @return JTable A JTable object * - * @since 12.2 + * @since 3.0 * @throws Exception */ public function getTable($name = '', $prefix = 'Table', $options = array()) @@ -476,7 +478,7 @@ public function getTable($name = '', $prefix = 'Table', $options = array()) * * @return boolean False on failure or error, true otherwise. * - * @since 12.2 + * @since 3.2 */ public function loadHistory($version_id, JTable &$table) { @@ -529,7 +531,7 @@ public function loadHistory($version_id, JTable &$table) * @return void * * @note Calling getState in this method will result in recursion. - * @since 12.2 + * @since 3.0 */ protected function populateState() { @@ -542,7 +544,7 @@ protected function populateState() * * @return void * - * @since 12.2 + * @since 3.0 */ public function setDbo($db) { @@ -557,7 +559,7 @@ public function setDbo($db) * * @return mixed The previous value of the property or null if not set. * - * @since 12.2 + * @since 3.0 */ public function setState($property, $value = null) { @@ -572,7 +574,7 @@ public function setState($property, $value = null) * * @return void * - * @since 12.2 + * @since 3.0 */ protected function cleanCache($group = null, $client_id = 0) { diff --git a/libraries/legacy/model/list.php b/libraries/legacy/model/list.php index fc09477f7fe4c..3285d1acce43e 100644 --- a/libraries/legacy/model/list.php +++ b/libraries/legacy/model/list.php @@ -12,7 +12,7 @@ /** * Model class for handling lists of items. * - * @since 12.2 + * @since 1.6 */ class JModelList extends JModelLegacy { @@ -20,7 +20,7 @@ class JModelList extends JModelLegacy * Internal memory based cache array of data. * * @var array - * @since 12.2 + * @since 1.6 */ protected $cache = array(); @@ -29,7 +29,7 @@ class JModelList extends JModelLegacy * when dealing with the getStoreId() method and caching data structures. * * @var string - * @since 12.2 + * @since 1.6 */ protected $context = null; @@ -37,7 +37,7 @@ class JModelList extends JModelLegacy * Valid filter fields or ordering. * * @var array - * @since 12.2 + * @since 1.6 */ protected $filter_fields = array(); @@ -45,7 +45,7 @@ class JModelList extends JModelLegacy * An internal cache for the last query used. * * @var JDatabaseQuery[] - * @since 12.2 + * @since 1.6 */ protected $query = array(); @@ -60,7 +60,8 @@ class JModelList extends JModelLegacy /** * Associated HTML form * - * @var string + * @var string + * @since 3.2 */ protected $htmlFormName = 'adminForm'; @@ -86,7 +87,7 @@ class JModelList extends JModelLegacy * @param array $config An optional associative array of configuration settings. * * @see JModelLegacy - * @since 12.2 + * @since 1.6 */ public function __construct($config = array()) { @@ -112,7 +113,7 @@ public function __construct($config = array()) * * @return JDatabaseQuery A JDatabaseQuery object * - * @since 12.2 + * @since 1.6 */ protected function _getListQuery() { @@ -164,7 +165,7 @@ public function getActiveFilters() * * @return mixed An array of data items on success, false on failure. * - * @since 12.2 + * @since 1.6 */ public function getItems() { @@ -197,7 +198,7 @@ public function getItems() * * @return JDatabaseQuery A JDatabaseQuery object to retrieve the data set. * - * @since 12.2 + * @since 1.6 */ protected function getListQuery() { @@ -209,7 +210,7 @@ protected function getListQuery() * * @return JPagination A JPagination object for the data set. * - * @since 12.2 + * @since 1.6 */ public function getPagination() { @@ -241,7 +242,7 @@ public function getPagination() * * @return string A store id. * - * @since 12.2 + * @since 1.6 */ protected function getStoreId($id = '') { @@ -259,7 +260,7 @@ protected function getStoreId($id = '') * * @return integer The total number of items available in the data set. * - * @since 12.2 + * @since 1.6 */ public function getTotal() { @@ -292,7 +293,7 @@ public function getTotal() * * @return integer The starting number of items available in the data set. * - * @since 12.2 + * @since 1.6 */ public function getStart() { @@ -360,11 +361,11 @@ public function getFilterForm($data = array(), $loadData = true) /** * Method to get a form object. * - * @param string $name The name of the form. - * @param string $source The form source. Can be XML string if file flag is set to false. - * @param array $options Optional array of options for the form creation. - * @param boolean $clear Optional argument to force load a new form. - * @param string $xpath An optional xpath to search for the fields. + * @param string $name The name of the form. + * @param string $source The form source. Can be XML string if file flag is set to false. + * @param array $options Optional array of options for the form creation. + * @param boolean $clear Optional argument to force load a new form. + * @param string|boolean $xpath An optional xpath to search for the fields. * * @return JForm|boolean JForm object on success, False on error. * @@ -463,7 +464,7 @@ protected function loadFormData() * * @return void * - * @since 12.2 + * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { @@ -671,7 +672,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') * * @return mixed The request user state. * - * @since 12.2 + * @since 1.6 */ public function getUserStateFromRequest($key, $request, $default = null, $type = 'none', $resetPage = true) { @@ -718,6 +719,8 @@ public function getUserStateFromRequest($key, $request, $default = null, $type = * @param string $regexDelimiter The regex delimiter to use for the quoting * * @return string Search string escaped for regex + * + * @since 3.4 */ protected function refineSearchStringToRegex($search, $regexDelimiter = '/') { diff --git a/libraries/legacy/request/request.php b/libraries/legacy/request/request.php index 3d5c72c37e29a..d6eca8f951eac 100644 --- a/libraries/legacy/request/request.php +++ b/libraries/legacy/request/request.php @@ -30,8 +30,8 @@ * request variables. This includes $_POST, $_GET, and naturally $_REQUEST. Variables * can be passed through an input filter to avoid injection or returned raw. * - * @since 11.1 - * @deprecated 12.1 (Platform) & 4.0 (CMS) - Get the JInput object from the application instead + * @since 1.5 + * @deprecated 1.7 Get the JInput object from the application instead */ class JRequest { @@ -40,9 +40,8 @@ class JRequest * * @return string * - * @since 11.1 - * - * @deprecated 12.1 + * @since 1.5 + * @deprecated 1.7 */ public static function getUri() { @@ -56,9 +55,8 @@ public static function getUri() * * @return string * - * @since 11.1 - * - * @deprecated 12.1 Use JInput::getMethod() instead + * @since 1.5 + * @deprecated 1.7 Use JInput::getMethod() instead */ public static function getMethod() { @@ -87,16 +85,15 @@ public static function getMethod() * default $_REQUEST * * @param string $name Variable name. - * @param string $default Default value if the variable does not exist. + * @param mixed $default Default value if the variable does not exist. * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD). * @param string $type Return type for the variable, for valid values see {@link JFilterInput::clean()}. * @param integer $mask Filter mask for the variable. * * @return mixed Requested variable. * - * @since 11.1 - * - * @deprecated 12.1 Use JInput::Get + * @since 1.5 + * @deprecated 1.7 Use JInput::get() */ public static function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask = 0) { @@ -178,15 +175,14 @@ public static function getVar($name, $default = null, $hash = 'default', $type = * * See getVar() for more in-depth documentation on the parameters. * - * @param string $name Variable name. - * @param string $default Default value if the variable does not exist. - * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD). + * @param string $name Variable name. + * @param integer $default Default value if the variable does not exist. + * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD). * * @return integer Requested variable. * - * @since 11.1 - * - * @deprecated 12.1 + * @since 1.5 + * @deprecated 1.7 */ public static function getInt($name, $default = 0, $hash = 'default') { @@ -200,14 +196,14 @@ public static function getInt($name, $default = 0, $hash = 'default') * * See getVar() for more in-depth documentation on the parameters. * - * @param string $name Variable name. - * @param string $default Default value if the variable does not exist. - * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD). + * @param string $name Variable name. + * @param integer $default Default value if the variable does not exist. + * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD). * * @return integer Requested variable. * - * @deprecated 12.1 - * @since 11.1 + * @since 1.7 + * @deprecated 1.7 */ public static function getUInt($name, $default = 0, $hash = 'default') { @@ -222,14 +218,13 @@ public static function getUInt($name, $default = 0, $hash = 'default') * See getVar() for more in-depth documentation on the parameters. * * @param string $name Variable name. - * @param string $default Default value if the variable does not exist. + * @param float $default Default value if the variable does not exist. * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD). * * @return float Requested variable. * - * @since 11.1 - * - * @deprecated 12.1 + * @since 1.5 + * @deprecated 1.7 */ public static function getFloat($name, $default = 0.0, $hash = 'default') { @@ -243,14 +238,14 @@ public static function getFloat($name, $default = 0.0, $hash = 'default') * * See getVar() for more in-depth documentation on the parameters. * - * @param string $name Variable name. - * @param string $default Default value if the variable does not exist. - * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD). + * @param string $name Variable name. + * @param boolean $default Default value if the variable does not exist. + * @param string $hash Where the var should come from (POST, GET, FILES, COOKIE, METHOD). * * @return boolean Requested variable. * - * @deprecated 12.1 - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ public static function getBool($name, $default = false, $hash = 'default') { @@ -270,9 +265,8 @@ public static function getBool($name, $default = false, $hash = 'default') * * @return string Requested variable. * - * @since 11.1 - * - * @deprecated 12.1 + * @since 1.5 + * @deprecated 1.7 */ public static function getWord($name, $default = '', $hash = 'default') { @@ -294,8 +288,8 @@ public static function getWord($name, $default = '', $hash = 'default') * * @return string Requested variable * - * @deprecated 12.1 - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ public static function getCmd($name, $default = '', $hash = 'default') { @@ -316,9 +310,8 @@ public static function getCmd($name, $default = '', $hash = 'default') * * @return string Requested variable * - * @since 11.1 - * - * @deprecated 12.1 + * @since 1.5 + * @deprecated 1.7 */ public static function getString($name, $default = '', $hash = 'default', $mask = 0) { @@ -336,9 +329,8 @@ public static function getString($name, $default = '', $hash = 'default', $mask * * @return string Previous value * - * @since 11.1 - * - * @deprecated 12.1 + * @since 1.5 + * @deprecated 1.7 */ public static function setVar($name, $value = null, $hash = 'method', $overwrite = true) { @@ -416,9 +408,9 @@ public static function setVar($name, $value = null, $hash = 'method', $overwrite * * @return mixed Request hash. * - * @deprecated 12.1 User JInput::get - * @see JInput - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 Use JInput::get() + * @see JInput */ public static function get($hash = 'default', $mask = 0) { @@ -474,9 +466,8 @@ public static function get($hash = 'default', $mask = 0) * * @return void * - * @deprecated 12.1 Use JInput::set() - * @see JInput::set() - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 Use JInput::set() */ public static function set($array, $hash = 'default', $overwrite = true) { @@ -495,8 +486,8 @@ public static function set($array, $hash = 'default', $overwrite = true) * * @return boolean True if found and valid, false otherwise. * - * @deprecated 12.1 Use JSession::checkToken() instead. Note that 'default' has to become 'request'. - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 Use JSession::checkToken() instead. Note that 'default' has to become 'request'. */ public static function checkToken($method = 'post') { @@ -522,8 +513,8 @@ public static function checkToken($method = 'post') * * @return mixed Same as $var * - * @deprecated 12.1 - * @since 11.1 + * @since 1.5 + * @deprecated 1.7 */ protected static function _cleanVar($var, $mask = 0, $type = null) { diff --git a/libraries/legacy/response/response.php b/libraries/legacy/response/response.php index c6c6cd0536c0d..f86807dfd4872 100644 --- a/libraries/legacy/response/response.php +++ b/libraries/legacy/response/response.php @@ -18,28 +18,34 @@ * response variables. This includes header and body. * * @since 11.1 - * @deprecated 4.0 Use JApplicationWeb instead + * @deprecated 1.5 Use JApplicationWeb instead */ class JResponse { /** - * @var array Body - * @since 11.1 - * @deprecated 4.0 + * Response body + * + * @var array + * @since 1.6 + * @deprecated 3.2 */ protected static $body = array(); /** - * @var boolean Cachable - * @since 11.1 - * @deprecated 4.0 + * Flag if the response is cachable + * + * @var boolean + * @since 1.6 + * @deprecated 3.2 */ protected static $cachable = false; /** - * @var array Headers - * @since 11.1 - * @deprecated 4.0 + * Response headers + * + * @var array + * @since 1.6 + * @deprecated 3.2 */ protected static $headers = array(); @@ -52,8 +58,8 @@ class JResponse * * @return boolean True if browser caching should be allowed * - * @since 11.1 - * @deprecated 4.0 Use JApplicationWeb::allowCache() instead + * @since 1.5 + * @deprecated 3.2 Use JApplicationWeb::allowCache() instead */ public static function allowCache($allow = null) { @@ -71,8 +77,8 @@ public static function allowCache($allow = null) * * @return void * - * @since 11.1 - * @deprecated 4.0 Use JApplicationWeb::setHeader() instead + * @since 1.5 + * @deprecated 3.2 Use JApplicationWeb::setHeader() instead */ public static function setHeader($name, $value, $replace = false) { @@ -84,8 +90,8 @@ public static function setHeader($name, $value, $replace = false) * * @return array * - * @since 11.1 - * @deprecated 4.0 Use JApplicationWeb::getHeaders() instead + * @since 1.5 + * @deprecated 3.2 Use JApplicationWeb::getHeaders() instead */ public static function getHeaders() { @@ -97,8 +103,8 @@ public static function getHeaders() * * @return void * - * @since 11.1 - * @deprecated 4.0 Use JApplicationWeb::clearHeaders() instead + * @since 1.5 + * @deprecated 3.2 Use JApplicationWeb::clearHeaders() instead */ public static function clearHeaders() { @@ -110,8 +116,8 @@ public static function clearHeaders() * * @return void * - * @since 11.1 - * @deprecated 4.0 Use JApplicationWeb::sendHeaders() instead + * @since 1.5 + * @deprecated 3.2 Use JApplicationWeb::sendHeaders() instead */ public static function sendHeaders() { @@ -127,8 +133,8 @@ public static function sendHeaders() * * @return void * - * @since 11.1 - * @deprecated 4.0 Use JApplicationWeb::setBody() instead + * @since 1.5 + * @deprecated 3.2 Use JApplicationWeb::setBody() instead */ public static function setBody($content) { @@ -142,8 +148,8 @@ public static function setBody($content) * * @return void * - * @since 11.1 - * @deprecated 4.0 Use JApplicationWeb::prependBody() instead + * @since 1.5 + * @deprecated 3.2 Use JApplicationWeb::prependBody() instead */ public static function prependBody($content) { @@ -157,8 +163,8 @@ public static function prependBody($content) * * @return void * - * @since 11.1 - * @deprecated 4.0 Use JApplicationWeb::appendBody() instead + * @since 1.5 + * @deprecated 3.2 Use JApplicationWeb::appendBody() instead */ public static function appendBody($content) { @@ -172,8 +178,8 @@ public static function appendBody($content) * * @return string array * - * @since 11.1 - * @deprecated 4.0 Use JApplicationWeb::getBody() instead + * @since 1.5 + * @deprecated 3.2 Use JApplicationWeb::getBody() instead */ public static function getBody($toArray = false) { @@ -187,8 +193,8 @@ public static function getBody($toArray = false) * * @return string * - * @since 11.1 - * @deprecated 4.0 Use JApplicationCms::toString() instead + * @since 1.5 + * @deprecated 3.2 Use JApplicationCms::toString() instead */ public static function toString($compress = false) { @@ -205,9 +211,9 @@ public static function toString($compress = false) * * @return string compressed data * - * @note Replaces _compress method in 11.1 - * @since 11.1 - * @deprecated 4.0 Use JApplicationWeb::compress() instead + * @note Replaces _compress method from 1.5 + * @since 1.7 + * @deprecated 3.2 Use JApplicationWeb::compress() instead */ protected static function compress($data) { @@ -263,9 +269,9 @@ protected static function compress($data) * * @return boolean * - * @since 11.1 - * @note Replaces _clientEncoding method from 11.1 - * @deprecated 4.0 Use JApplicationWebClient instead + * @since 1.7 + * @note Replaces _clientEncoding method from 1.5 + * @deprecated 3.2 Use JApplicationWebClient instead */ protected static function clientEncoding() { diff --git a/libraries/legacy/simplecrypt/simplecrypt.php b/libraries/legacy/simplecrypt/simplecrypt.php index bd627b09d41e0..cfe10c2fd6960 100644 --- a/libraries/legacy/simplecrypt/simplecrypt.php +++ b/libraries/legacy/simplecrypt/simplecrypt.php @@ -12,8 +12,8 @@ /** * JSimpleCrypt is a very simple encryption algorithm for encrypting/decrypting strings * - * @since 11.1 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - Use JCrypt instead. + * @since 1.5 + * @deprecated 2.5.5 Use JCrypt instead. */ class JSimplecrypt { @@ -21,8 +21,8 @@ class JSimplecrypt * Encryption/Decryption Key * * @var JCrypt - * @since 12.1 - * @deprecated 12.3 Use JCrypt instead. + * @since 3.0 + * @deprecated 3.0 Use JCrypt instead. */ private $_crypt; @@ -32,8 +32,8 @@ class JSimplecrypt * * @param string $privateKey Optional encryption key * - * @since 11.1 - * @deprecated 12.3 Use JCrypt instead. + * @since 1.5 + * @deprecated 2.5.5 Use JCrypt instead. */ public function __construct($privateKey = null) { @@ -58,8 +58,8 @@ public function __construct($privateKey = null) * * @return string * - * @since 11.1 - * @deprecated 12.3 Use JCrypt instead. + * @since 1.5 + * @deprecated 2.5.5 Use JCrypt instead. */ public function decrypt($s) { @@ -73,8 +73,8 @@ public function decrypt($s) * * @return string * - * @since 11.1 - * @deprecated 12.3 Use JCrypt instead. + * @since 1.5 + * @deprecated 2.5.5 Use JCrypt instead. */ public function encrypt($s) { diff --git a/libraries/legacy/simplepie/factory.php b/libraries/legacy/simplepie/factory.php index ef655d9b720ac..16f218f21dad5 100644 --- a/libraries/legacy/simplepie/factory.php +++ b/libraries/legacy/simplepie/factory.php @@ -16,8 +16,8 @@ * * The user's navigated path within the application. * - * @since 12.2 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - Use JFeed or supply your own methods + * @since 3.0 + * @deprecated 3.0 Use JFeed or supply your own methods */ class JSimplepieFactory { @@ -27,12 +27,10 @@ class JSimplepieFactory * @param string $url Url for feed source. * @param integer $cache_time Time to cache feed for (using internal cache mechanism). * - * @return mixed SimplePie parsed object on success, false on failure. + * @return SimplePie|boolean SimplePie parsed object on success, false on failure. * - * @since 12.2 - * @deprecated 4.0 Use JFeedFactory($url) instead. - * - * @note In 3.2 will be proxied to JFeedFactory() + * @since 3.0 + * @deprecated 3.0 Use JFeedFactory($url) instead. */ public static function getFeedParser($url, $cache_time = 0) { diff --git a/libraries/legacy/table/category.php b/libraries/legacy/table/category.php index 2f815bb90fba3..4146c79f0812b 100644 --- a/libraries/legacy/table/category.php +++ b/libraries/legacy/table/category.php @@ -14,7 +14,7 @@ /** * Category table * - * @since 11.1 + * @since 1.5 */ class JTableCategory extends JTableNested { @@ -23,7 +23,7 @@ class JTableCategory extends JTableNested * * @param JDatabaseDriver $db Database driver object. * - * @since 11.1 + * @since 1.5 */ public function __construct(JDatabaseDriver $db) { @@ -42,7 +42,7 @@ public function __construct(JDatabaseDriver $db) * * @return string * - * @since 11.1 + * @since 1.6 */ protected function _getAssetName() { @@ -56,7 +56,7 @@ protected function _getAssetName() * * @return string * - * @since 11.1 + * @since 1.6 */ protected function _getAssetTitle() { @@ -71,7 +71,7 @@ protected function _getAssetTitle() * * @return integer The id of the asset's parent * - * @since 11.1 + * @since 1.6 */ protected function _getAssetParentId(JTable $table = null, $id = null) { @@ -129,7 +129,7 @@ protected function _getAssetParentId(JTable $table = null, $id = null) * @return boolean * * @see JTable::check() - * @since 11.1 + * @since 1.5 */ public function check() { @@ -168,7 +168,7 @@ public function check() * @return mixed Null if operation was satisfactory, otherwise returns an error * * @see JTable::bind() - * @since 11.1 + * @since 1.6 */ public function bind($array, $ignore = '') { @@ -201,7 +201,7 @@ public function bind($array, $ignore = '') * * @return boolean True on success. * - * @since 11.1 + * @since 1.6 */ public function store($updateNulls = false) { diff --git a/libraries/legacy/table/content.php b/libraries/legacy/table/content.php index af03f4aa01947..7024aab2dbdff 100644 --- a/libraries/legacy/table/content.php +++ b/libraries/legacy/table/content.php @@ -15,8 +15,8 @@ /** * Content table * - * @since 11.1 - * @deprecated Class will be removed upon completion of transition to UCM + * @since 1.5 + * @deprecated 3.1.4 Class will be removed upon completion of transition to UCM */ class JTableContent extends JTable { @@ -25,7 +25,8 @@ class JTableContent extends JTable * * @param JDatabaseDriver $db A database connector object * - * @since 11.1 + * @since 1.5 + * @deprecated 3.1.4 Class will be removed upon completion of transition to UCM */ public function __construct(JDatabaseDriver $db) { @@ -45,7 +46,8 @@ public function __construct(JDatabaseDriver $db) * * @return string * - * @since 11.1 + * @since 1.6 + * @deprecated 3.1.4 Class will be removed upon completion of transition to UCM */ protected function _getAssetName() { @@ -59,7 +61,8 @@ protected function _getAssetName() * * @return string * - * @since 11.1 + * @since 1.6 + * @deprecated 3.1.4 Class will be removed upon completion of transition to UCM */ protected function _getAssetTitle() { @@ -74,7 +77,8 @@ protected function _getAssetTitle() * * @return integer * - * @since 11.1 + * @since 1.6 + * @deprecated 3.1.4 Class will be removed upon completion of transition to UCM */ protected function _getAssetParentId(JTable $table = null, $id = null) { @@ -119,7 +123,8 @@ protected function _getAssetParentId(JTable $table = null, $id = null) * @return mixed Null if operation was satisfactory, otherwise returns an error string * * @see JTable::bind() - * @since 11.1 + * @since 1.6 + * @deprecated 3.1.4 Class will be removed upon completion of transition to UCM */ public function bind($array, $ignore = '') { @@ -168,7 +173,8 @@ public function bind($array, $ignore = '') * @return boolean True on success, false on failure * * @see JTable::check() - * @since 11.1 + * @since 1.5 + * @deprecated 3.1.4 Class will be removed upon completion of transition to UCM */ public function check() { @@ -278,9 +284,12 @@ public function check() /** * Gets the default asset values for a component. * - * @param $string $component The component asset name to search for + * @param string $component The component asset name to search for * * @return JAccessRules The JAccessRules object for the asset + * + * @since 3.4 + * @deprecated 3.4 Class will be removed upon completion of transition to UCM */ protected function getDefaultAssetValues($component) { @@ -303,7 +312,8 @@ protected function getDefaultAssetValues($component) * * @return boolean True on success. * - * @since 11.1 + * @since 1.6 + * @deprecated 3.1.4 Class will be removed upon completion of transition to UCM */ public function store($updateNulls = false) { diff --git a/libraries/legacy/table/menu.php b/libraries/legacy/table/menu.php index 0b81f1e3ecd09..2050edcab19c7 100644 --- a/libraries/legacy/table/menu.php +++ b/libraries/legacy/table/menu.php @@ -14,7 +14,7 @@ /** * Menu table * - * @since 11.1 + * @since 1.5 */ class JTableMenu extends JTableNested { @@ -23,7 +23,7 @@ class JTableMenu extends JTableNested * * @param JDatabaseDriver $db Database driver object. * - * @since 11.1 + * @since 1.5 */ public function __construct(JDatabaseDriver $db) { @@ -42,7 +42,7 @@ public function __construct(JDatabaseDriver $db) * @return mixed Null if operation was satisfactory, otherwise returns an error * * @see JTable::bind() - * @since 11.1 + * @since 1.5 */ public function bind($array, $ignore = '') { @@ -85,7 +85,7 @@ public function bind($array, $ignore = '') * @return boolean True on success * * @see JTable::check() - * @since 11.1 + * @since 1.5 */ public function check() { @@ -97,12 +97,6 @@ public function check() return false; } - // Set correct component id to ensure proper 404 messages with separator items - if ($this->type == "separator") - { - $this->component_id = 0; - } - // Check for a path. if (trim($this->path) == '') { @@ -122,25 +116,7 @@ public function check() // Cast the home property to an int for checking. $this->home = (int) $this->home; - // Verify that a first level menu item alias is not 'component'. - if ($this->parent_id == 1 && $this->alias == 'component') - { - $this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_COMPONENT')); - - return false; - } - - // Verify that a first level menu item alias is not the name of a folder. - jimport('joomla.filesystem.folder'); - - if ($this->parent_id == 1 && in_array($this->alias, JFolder::folders(JPATH_ROOT))) - { - $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_FOLDER', $this->alias, $this->alias)); - - return false; - } - - // Verify that the home item a component. + // Verify that the home item is a component. if ($this->home && $this->type != 'component') { $this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_HOME_NOT_COMPONENT')); @@ -159,7 +135,7 @@ public function check() * @return mixed False on failure, positive integer on success. * * @see JTable::store() - * @since 11.1 + * @since 1.6 */ public function store($updateNulls = false) { @@ -172,6 +148,24 @@ public function store($updateNulls = false) $this->alias = !$originalAlias ? $this->title : $originalAlias; $this->alias = JApplicationHelper::stringURLSafe(trim($this->alias), $this->language); + // Verify that a first level menu item alias is not 'component'. + if ($this->parent_id == 1 && $this->alias == 'component') + { + $this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_COMPONENT')); + + return false; + } + + // Verify that a first level menu item alias is not the name of a folder. + jimport('joomla.filesystem.folder'); + + if ($this->parent_id == 1 && in_array($this->alias, JFolder::folders(JPATH_ROOT))) + { + $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_FOLDER', $this->alias, $this->alias)); + + return false; + } + // If alias still empty (for instance, new menu item with chinese characters with no unicode alias setting). if (empty($this->alias)) { diff --git a/libraries/legacy/table/menu/type.php b/libraries/legacy/table/menu/type.php index 95cda7b976022..8da7aba17995e 100644 --- a/libraries/legacy/table/menu/type.php +++ b/libraries/legacy/table/menu/type.php @@ -12,7 +12,7 @@ /** * Menu Types table * - * @since 11.1 + * @since 1.6 */ class JTableMenuType extends JTable { @@ -21,7 +21,7 @@ class JTableMenuType extends JTable * * @param JDatabaseDriver $db Database driver object. * - * @since 11.1 + * @since 1.6 */ public function __construct(JDatabaseDriver $db) { @@ -34,7 +34,7 @@ public function __construct(JDatabaseDriver $db) * @return boolean True on success, false on failure * * @see JTable::check() - * @since 11.1 + * @since 1.6 */ public function check() { @@ -81,7 +81,7 @@ public function check() * * @return boolean True on success. * - * @since 11.1 + * @since 1.6 */ public function store($updateNulls = false) { @@ -162,7 +162,7 @@ public function store($updateNulls = false) * * @return boolean True on success. * - * @since 11.1 + * @since 1.6 */ public function delete($pk = null) { diff --git a/libraries/legacy/table/module.php b/libraries/legacy/table/module.php index 389792f5207e7..48be33010ac5b 100644 --- a/libraries/legacy/table/module.php +++ b/libraries/legacy/table/module.php @@ -14,7 +14,7 @@ /** * Module table * - * @since 11.1 + * @since 1.5 */ class JTableModule extends JTable { @@ -23,7 +23,7 @@ class JTableModule extends JTable * * @param JDatabaseDriver $db Database driver object. * - * @since 11.1 + * @since 1.5 */ public function __construct(JDatabaseDriver $db) { @@ -39,7 +39,7 @@ public function __construct(JDatabaseDriver $db) * * @return string * - * @since 11.1 + * @since 3.2 */ protected function _getAssetName() { @@ -53,7 +53,7 @@ protected function _getAssetName() * * @return string * - * @since 11.1 + * @since 3.2 */ protected function _getAssetTitle() { @@ -68,7 +68,7 @@ protected function _getAssetTitle() * * @return integer * - * @since 11.1 + * @since 3.2 */ protected function _getAssetParentId(JTable $table = null, $id = null) { @@ -109,7 +109,7 @@ protected function _getAssetParentId(JTable $table = null, $id = null) * @return boolean True if the instance is sane and able to be stored in the database. * * @see JTable::check() - * @since 11.1 + * @since 1.5 */ public function check() { @@ -142,7 +142,7 @@ public function check() * @return mixed Null if operation was satisfactory, otherwise returns an error * * @see JTable::bind() - * @since 11.1 + * @since 1.5 */ public function bind($array, $ignore = '') { diff --git a/libraries/legacy/table/session.php b/libraries/legacy/table/session.php index 468372997e579..a508ffbc10180 100644 --- a/libraries/legacy/table/session.php +++ b/libraries/legacy/table/session.php @@ -12,8 +12,8 @@ /** * Session table * - * @since 11.1 - * @deprecated 13.3 (Platform) & 4.0 (CMS) - Use SQL queries to interact with the session table. + * @since 1.5 + * @deprecated 3.2 Use SQL queries to interact with the session table. */ class JTableSession extends JTable { @@ -22,8 +22,8 @@ class JTableSession extends JTable * * @param JDatabaseDriver $db Database driver object. * - * @since 11.1 - * @deprecated 13.3 Use SQL queries to interact with the session table. + * @since 1.5 + * @deprecated 3.2 Use SQL queries to interact with the session table. */ public function __construct(JDatabaseDriver $db) { @@ -42,8 +42,8 @@ public function __construct(JDatabaseDriver $db) * * @return boolean True on success * - * @since 11.1 - * @deprecated 13.3 Use SQL queries to interact with the session table. + * @since 1.5 + * @deprecated 3.2 Use SQL queries to interact with the session table. */ public function insert($sessionId, $clientId) { @@ -72,8 +72,8 @@ public function insert($sessionId, $clientId) * * @return boolean True on success. * - * @since 11.1 - * @deprecated 13.3 Use SQL queries to interact with the session table. + * @since 1.5 + * @deprecated 3.2 Use SQL queries to interact with the session table. */ public function update($updateNulls = false) { @@ -100,8 +100,8 @@ public function update($updateNulls = false) * * @return boolean True on success. * - * @since 11.1 - * @deprecated 13.3 Use SQL queries to interact with the session table. + * @since 1.5 + * @deprecated 3.2 Use SQL queries to interact with the session table. */ public function destroy($userId, $clientIds = array()) { @@ -130,8 +130,8 @@ public function destroy($userId, $clientIds = array()) * * @return mixed Resource on success, null on fail * - * @since 11.1 - * @deprecated 13.3 Use SQL queries to interact with the session table. + * @since 1.5 + * @deprecated 3.2 Use SQL queries to interact with the session table. */ public function purge($maxLifetime = 1440) { @@ -151,8 +151,8 @@ public function purge($maxLifetime = 1440) * * @return boolean True if a session for this user exists * - * @since 11.1 - * @deprecated 13.3 Use SQL queries to interact with the session table. + * @since 1.5 + * @deprecated 3.2 Use SQL queries to interact with the session table. */ public function exists($userid) { @@ -181,8 +181,8 @@ public function exists($userid) * * @return mixed True if successful otherwise an error message * - * @since 11.1 - * @deprecated 13.3 Use SQL queries to interact with the session table. + * @since 1.5 + * @deprecated 3.2 Use SQL queries to interact with the session table. */ public function delete($oid = null) { diff --git a/libraries/legacy/utilities/xmlelement.php b/libraries/legacy/utilities/xmlelement.php index 4faca9f5d1d6c..be8d62c77bfb2 100644 --- a/libraries/legacy/utilities/xmlelement.php +++ b/libraries/legacy/utilities/xmlelement.php @@ -14,8 +14,8 @@ /** * Wrapper class for php SimpleXMLElement. * - * @since 11.1 - * @deprecated 13.3 (Platform) & 4.0 (CMS) - Use SimpleXMLElement instead. + * @since 1.6 + * @deprecated 3.0 Use SimpleXMLElement instead. */ class JXMLElement extends SimpleXMLElement { @@ -24,8 +24,8 @@ class JXMLElement extends SimpleXMLElement * * @return string * - * @since 11.1 - * @deprecated 13.3 Use SimpleXMLElement::getName() instead. + * @since 1.6 + * @deprecated 3.0 Use SimpleXMLElement::getName() instead. */ public function name() { @@ -43,8 +43,8 @@ public function name() * * @return string * - * @since 11.1 - * @deprecated 13.3 Use SimpleXMLElement::asXml() instead. + * @since 1.6 + * @deprecated 3.0 Use SimpleXMLElement::asXml() instead. */ public function asFormattedXml($compressed = false, $indent = "\t", $level = 0) { diff --git a/libraries/legacy/view/legacy.php b/libraries/legacy/view/legacy.php index 338e1448dd9f4..ab698ff91eaf3 100644 --- a/libraries/legacy/view/legacy.php +++ b/libraries/legacy/view/legacy.php @@ -14,7 +14,7 @@ * * Class holding methods for displaying presentation data. * - * @since 12.2 + * @since 2.5.5 */ class JViewLegacy extends JObject { @@ -22,6 +22,7 @@ class JViewLegacy extends JObject * The active document object * * @var JDocument + * @since 3.0 */ public $document; @@ -29,6 +30,7 @@ class JViewLegacy extends JObject * The name of the view * * @var array + * @since 3.0 */ protected $_name = null; @@ -36,6 +38,7 @@ class JViewLegacy extends JObject * Registered models * * @var array + * @since 3.0 */ protected $_models = array(); @@ -43,13 +46,15 @@ class JViewLegacy extends JObject * The base path of the view * * @var string + * @since 3.0 */ protected $_basePath = null; /** * The default model * - * @var string + * @var string + * @since 3.0 */ protected $_defaultModel = null; @@ -57,6 +62,7 @@ class JViewLegacy extends JObject * Layout name * * @var string + * @since 3.0 */ protected $_layout = 'default'; @@ -64,6 +70,7 @@ class JViewLegacy extends JObject * Layout extension * * @var string + * @since 3.0 */ protected $_layoutExt = 'php'; @@ -71,42 +78,48 @@ class JViewLegacy extends JObject * Layout template * * @var string + * @since 3.0 */ protected $_layoutTemplate = '_'; /** * The set of search directories for resources (templates) * - * @var array + * @var array + * @since 3.0 */ protected $_path = array('template' => array(), 'helper' => array()); /** * The name of the default template source file. * - * @var string + * @var string + * @since 3.0 */ protected $_template = null; /** * The output of the template script. * - * @var string + * @var string + * @since 3.0 */ protected $_output = null; /** * Callback for escaping. * - * @var string - * @deprecated 13.3 + * @var string + * @since 3.0 + * @deprecated 3.0 */ protected $_escape = 'htmlspecialchars'; /** * Charset to use in escaping mechanisms; defaults to urf8 (UTF-8) * - * @var string + * @var string + * @since 3.0 */ protected $_charset = 'UTF-8'; @@ -122,7 +135,7 @@ class JViewLegacy extends JObject * helper_path: the path (optional) of the helper files (defaults to base_path + /helpers/) * layout: the layout (optional) to use to display the view * - * @since 12.2 + * @since 3.0 */ public function __construct($config = array()) { @@ -209,7 +222,7 @@ public function __construct($config = array()) * @return mixed A string if successful, otherwise an Error object. * * @see JViewLegacy::loadTemplate() - * @since 12.2 + * @since 3.0 */ public function display($tpl = null) { @@ -258,7 +271,8 @@ public function display($tpl = null) * * @return boolean True on success, false on failure. * - * @deprecated 13.3 Use native PHP syntax. + * @since 3.0 + * @deprecated 3.0 Use native PHP syntax. */ public function assign() { @@ -334,8 +348,8 @@ public function assign() * * @return boolean True on success, false on failure. * - * @since 12.2 - * @deprecated 13.3 Use native PHP syntax. + * @since 3.0 + * @deprecated 3.0 Use native PHP syntax. */ public function assignRef($key, &$val) { @@ -361,7 +375,7 @@ public function assignRef($key, &$val) * * @return mixed The escaped value. * - * @since 12.2 + * @since 3.0 */ public function escape($var) { @@ -381,7 +395,7 @@ public function escape($var) * * @return mixed The return value of the method * - * @since 12.2 + * @since 3.0 */ public function get($property, $default = null) { @@ -424,7 +438,7 @@ public function get($property, $default = null) * * @return mixed JModelLegacy object * - * @since 12.2 + * @since 3.0 */ public function getModel($name = null) { @@ -440,6 +454,8 @@ public function getModel($name = null) * Get the layout. * * @return string The layout name + * + * @since 3.0 */ public function getLayout() { @@ -450,6 +466,8 @@ public function getLayout() * Get the layout template. * * @return string The layout template name + * + * @since 3.0 */ public function getLayoutTemplate() { @@ -464,7 +482,7 @@ public function getLayoutTemplate() * * @return string The name of the model * - * @since 12.2 + * @since 3.0 * @throws Exception */ public function getName() @@ -495,9 +513,9 @@ public function getName() * @param JModelLegacy $model The model to add to the view. * @param boolean $default Is this the default model? * - * @return object The added model. + * @return JModelLegacy The added model. * - * @since 12.2 + * @since 3.0 */ public function setModel($model, $default = false) { @@ -519,7 +537,7 @@ public function setModel($model, $default = false) * * @return string Previous value. * - * @since 12.2 + * @since 3.0 */ public function setLayout($layout) { @@ -547,9 +565,9 @@ public function setLayout($layout) * * @param string $value The extension. * - * @return string Previous value + * @return string Previous value * - * @since 12.2 + * @since 3.0 */ public function setLayoutExt($value) { @@ -570,8 +588,8 @@ public function setLayoutExt($value) * * @return void * - * @since 12.2 - * @deprecated 13.3 Override JViewLegacy::escape() instead. + * @since 3.0 + * @deprecated 3.0 Override JViewLegacy::escape() instead. */ public function setEscape($spec) { @@ -587,7 +605,7 @@ public function setEscape($spec) * * @return void * - * @since 12.2 + * @since 3.0 */ public function addTemplatePath($path) { @@ -601,7 +619,7 @@ public function addTemplatePath($path) * * @return void * - * @since 12.2 + * @since 3.0 */ public function addHelperPath($path) { @@ -615,7 +633,7 @@ public function addHelperPath($path) * * @return string The output of the the template script. * - * @since 12.2 + * @since 3.0 * @throws Exception */ public function loadTemplate($tpl = null) @@ -696,7 +714,7 @@ public function loadTemplate($tpl = null) * * @return void * - * @since 12.2 + * @since 3.0 */ public function loadHelper($hlp = null) { @@ -722,7 +740,7 @@ public function loadHelper($hlp = null) * * @return void * - * @since 12.2 + * @since 3.0 */ protected function _setPath($type, $path) { @@ -758,7 +776,7 @@ protected function _setPath($type, $path) * * @return void * - * @since 12.2 + * @since 3.0 */ protected function _addPath($type, $path) { @@ -793,7 +811,7 @@ protected function _addPath($type, $path) * * @return string The filename * - * @since 12.2 + * @since 3.0 */ protected function _createFileName($type, $parts = array()) { diff --git a/libraries/legacy/web/client.php b/libraries/legacy/web/client.php index d5d8786be5816..d76f308ffc529 100644 --- a/libraries/legacy/web/client.php +++ b/libraries/legacy/web/client.php @@ -12,9 +12,8 @@ /** * Deprecated class placeholder. You should use JApplicationWebClient instead. * - * @since 11.3 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - * @codeCoverageIgnore + * @since 1.7 + * @deprecated 2.5 */ class JWebClient extends JApplicationWebClient { @@ -25,7 +24,8 @@ class JWebClient extends JApplicationWebClient * @param mixed $acceptEncoding The optional client accept encoding string to parse. * @param mixed $acceptLanguage The optional client accept language string to parse. * - * @since 11.3 + * @since 1.7 + * @deprecated 2.5 */ public function __construct($userAgent = null, $acceptEncoding = null, $acceptLanguage = null) { diff --git a/libraries/legacy/web/web.php b/libraries/legacy/web/web.php index 8a3d231631cb3..b6b765ecddf6b 100644 --- a/libraries/legacy/web/web.php +++ b/libraries/legacy/web/web.php @@ -14,8 +14,8 @@ /** * Deprecated class placeholder. You should use JApplicationWeb instead. * - * @since 11.3 - * @deprecated 12.3 (Platform) & 4.0 (CMS) - Use JApplicationWeb instead. + * @since 1.7 + * @deprecated 2.5 Use JApplicationWeb instead. * @codeCoverageIgnore */ class JWeb extends JApplicationWeb @@ -33,8 +33,8 @@ class JWeb extends JApplicationWeb * client object. If the argument is a JApplicationWebClient object that object will become * the application's client object, otherwise a default client object is created. * - * @since 11.3 - * @deprecated 12.3 (Platform) & 4.0 (CMS) Use JApplicationWeb instead. + * @since 1.7 + * @deprecated 2.5 Use JApplicationWeb instead. */ public function __construct(JInput $input = null, Registry $config = null, JApplicationWebClient $client = null) { diff --git a/libraries/vendor/composer/autoload_files.php b/libraries/vendor/composer/autoload_files.php index 791ac6a40f886..bc30413ae6f83 100644 --- a/libraries/vendor/composer/autoload_files.php +++ b/libraries/vendor/composer/autoload_files.php @@ -22,7 +22,7 @@ '4292e2fa66516089e6006723267587b4' => $vendorDir . '/joomla/string/src/phputf8/utils/ascii.php', '87465e33b7551b401bf051928f220e9a' => $vendorDir . '/joomla/string/src/phputf8/utils/validation.php', 'e40631d46120a9c38ea139981f8dab26' => $vendorDir . '/ircmaxell/password-compat/lib/password.php', - 'edc6464955a37aa4d5fbf39d40fb6ee7' => $vendorDir . '/symfony/polyfill-php55/bootstrap.php', '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php', 'bd9634f2d41831496de0d3dfe4c94881' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php', + 'edc6464955a37aa4d5fbf39d40fb6ee7' => $vendorDir . '/symfony/polyfill-php55/bootstrap.php', ); diff --git a/libraries/vendor/composer/autoload_real.php b/libraries/vendor/composer/autoload_real.php index f919171466c14..1298690b3bb5d 100644 --- a/libraries/vendor/composer/autoload_real.php +++ b/libraries/vendor/composer/autoload_real.php @@ -23,35 +23,24 @@ public static function getLoader() self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit205c915b9c7d3e718e7c95793ee67ffe', 'loadClassLoader')); - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION'); - if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit205c915b9c7d3e718e7c95793ee67ffe::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); } $loader->register(true); - if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit205c915b9c7d3e718e7c95793ee67ffe::$files; - } else { - $includeFiles = require __DIR__ . '/autoload_files.php'; - } + $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $fileIdentifier => $file) { composerRequire205c915b9c7d3e718e7c95793ee67ffe($fileIdentifier, $file); } diff --git a/libraries/vendor/composer/installed.json b/libraries/vendor/composer/installed.json index 6a755b3e597c5..8589ce2a48165 100644 --- a/libraries/vendor/composer/installed.json +++ b/libraries/vendor/composer/installed.json @@ -262,6 +262,69 @@ "joomla" ] }, + { + "name": "phpmailer/phpmailer", + "version": "v5.2.14", + "version_normalized": "5.2.14.0", + "source": { + "type": "git", + "url": "https://github.com/PHPMailer/PHPMailer.git", + "reference": "e774bc9152de85547336e22b8926189e582ece95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e774bc9152de85547336e22b8926189e582ece95", + "reference": "e774bc9152de85547336e22b8926189e582ece95", + "shasum": "" + }, + "require": { + "php": ">=5.0.0" + }, + "require-dev": { + "phpdocumentor/phpdocumentor": "*", + "phpunit/phpunit": "4.7.*" + }, + "suggest": { + "league/oauth2-client": "Needed for XOAUTH2 authentication", + "league/oauth2-google": "Needed for Gmail XOAUTH2" + }, + "time": "2015-11-01 10:15:28", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "class.phpmailer.php", + "class.phpmaileroauth.php", + "class.phpmaileroauthgoogle.php", + "class.smtp.php", + "class.pop3.php", + "extras/EasyPeasyICS.php", + "extras/ntlm_sasl_client.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1" + ], + "authors": [ + { + "name": "Jim Jagielski", + "email": "jimjag@gmail.com" + }, + { + "name": "Marcus Bointon", + "email": "phpmailer@synchromedia.co.uk" + }, + { + "name": "Andy Prevost", + "email": "codeworxtech@users.sourceforge.net" + }, + { + "name": "Brent R. Matzelle" + } + ], + "description": "PHPMailer is a full-featured email creation and transfer class for PHP" + }, { "name": "leafo/lessphp", "version": "v0.5.0", @@ -623,152 +686,144 @@ ] }, { - "name": "joomla/application", - "version": "1.6.0", - "version_normalized": "1.6.0.0", + "name": "symfony/polyfill-php56", + "version": "v1.1.1", + "version_normalized": "1.1.1.0", "source": { "type": "git", - "url": "https://github.com/joomla-framework/application.git", - "reference": "2c2fb32553819f22ee15d4022dec805e750f43ce" + "url": "https://github.com/symfony/polyfill-php56.git", + "reference": "4d891fff050101a53a4caabb03277284942d1ad9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/application/zipball/2c2fb32553819f22ee15d4022dec805e750f43ce", - "reference": "2c2fb32553819f22ee15d4022dec805e750f43ce", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/4d891fff050101a53a4caabb03277284942d1ad9", + "reference": "4d891fff050101a53a4caabb03277284942d1ad9", "shasum": "" }, "require": { - "joomla/input": "~1.2", - "joomla/registry": "~1.1", - "php": ">=5.3.10|>=7.0", - "psr/log": "~1.0" - }, - "require-dev": { - "joomla/session": "^1.2.1", - "joomla/test": "~1.1", - "joomla/uri": "~1.1", - "phpunit/phpunit": "~4.8|~5.0", - "squizlabs/php_codesniffer": "1.*" - }, - "suggest": { - "joomla/session": "To use AbstractWebApplication with session support, install joomla/session", - "joomla/uri": "To use AbstractWebApplication, install joomla/uri" + "php": ">=5.3.3", + "symfony/polyfill-util": "~1.0" }, - "time": "2016-04-09 03:08:55", - "type": "joomla-package", + "time": "2016-01-20 09:13:37", + "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "1.1-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Joomla\\Application\\": "src/" - } + "Symfony\\Polyfill\\Php56\\": "" + }, + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "GPL-2.0+" + "MIT" ], - "description": "Joomla Application Package", - "homepage": "https://github.com/joomla-framework/application", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", + "homepage": "https://symfony.com", "keywords": [ - "application", - "framework", - "joomla" + "compatibility", + "polyfill", + "portable", + "shim" ] }, { - "name": "simplepie/simplepie", - "version": "1.3.1", - "version_normalized": "1.3.1.0", + "name": "symfony/yaml", + "version": "v2.8.4", + "version_normalized": "2.8.4.0", "source": { "type": "git", - "url": "https://github.com/simplepie/simplepie.git", - "reference": "ce53709778bc1e2e4deda1651b66e5081398d5cc" + "url": "https://github.com/symfony/yaml.git", + "reference": "584e52cb8f788a887553ba82db6caacb1d6260bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/simplepie/simplepie/zipball/ce53709778bc1e2e4deda1651b66e5081398d5cc", - "reference": "ce53709778bc1e2e4deda1651b66e5081398d5cc", + "url": "https://api.github.com/repos/symfony/yaml/zipball/584e52cb8f788a887553ba82db6caacb1d6260bb", + "reference": "584e52cb8f788a887553ba82db6caacb1d6260bb", "shasum": "" }, "require": { - "php": ">=5.2.0" + "php": ">=5.3.9" }, - "time": "2012-10-30 17:54:03", + "time": "2016-03-04 07:54:35", "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, "installation-source": "dist", "autoload": { - "psr-0": { - "SimplePie": "library" - } + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Ryan Parman", - "homepage": "http://ryanparman.com/", - "role": "Creator, alumnus developer" - }, - { - "name": "Geoffrey Sneddon", - "homepage": "http://gsnedders.com/", - "role": "Alumnus developer" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { - "name": "Ryan McCue", - "email": "me@ryanmccue.info", - "homepage": "http://ryanmccue.info/", - "role": "Developer" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "A simple Atom/RSS parsing library for PHP", - "homepage": "http://simplepie.org/", - "keywords": [ - "atom", - "feeds", - "rss" - ] + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com" }, { - "name": "symfony/polyfill-php55", - "version": "v1.2.0", - "version_normalized": "1.2.0.0", + "name": "symfony/polyfill-util", + "version": "v1.1.1", + "version_normalized": "1.1.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d" + "url": "https://github.com/symfony/polyfill-util.git", + "reference": "8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", - "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4", + "reference": "8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4", "shasum": "" }, "require": { - "ircmaxell/password-compat": "~1.0", "php": ">=5.3.3" }, - "time": "2016-05-18 14:26:46", + "time": "2016-01-20 09:13:37", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.1-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php55\\": "" - }, - "files": [ - "bootstrap.php" - ] + "Symfony\\Polyfill\\Util\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -784,97 +839,34 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", + "description": "Symfony utilities for portability of PHP codes", "homepage": "https://symfony.com", "keywords": [ + "compat", "compatibility", "polyfill", - "portable", "shim" ] }, - { - "name": "phpmailer/phpmailer", - "version": "v5.2.16", - "version_normalized": "5.2.16.0", - "source": { - "type": "git", - "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a", - "reference": "1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a", - "shasum": "" - }, - "require": { - "php": ">=5.0.0" - }, - "require-dev": { - "phpdocumentor/phpdocumentor": "*", - "phpunit/phpunit": "4.7.*" - }, - "suggest": { - "league/oauth2-google": "Needed for Google XOAUTH2 authentication" - }, - "time": "2016-06-06 09:09:37", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "class.phpmailer.php", - "class.phpmaileroauth.php", - "class.phpmaileroauthgoogle.php", - "class.smtp.php", - "class.pop3.php", - "extras/EasyPeasyICS.php", - "extras/ntlm_sasl_client.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1" - ], - "authors": [ - { - "name": "Jim Jagielski", - "email": "jimjag@gmail.com" - }, - { - "name": "Marcus Bointon", - "email": "phpmailer@synchromedia.co.uk" - }, - { - "name": "Andy Prevost", - "email": "codeworxtech@users.sourceforge.net" - }, - { - "name": "Brent R. Matzelle" - } - ], - "description": "PHPMailer is a full-featured email creation and transfer class for PHP" - }, { "name": "joomla/registry", - "version": "1.5.2", - "version_normalized": "1.5.2.0", + "version": "1.5.1", + "version_normalized": "1.5.1.0", "source": { "type": "git", "url": "https://github.com/joomla-framework/registry.git", - "reference": "bd3592c6f0554a72811df52aeaea98c7815f6e5a" + "reference": "b9fd1812e19619bb4722a0711b691dbfefff8ee9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/registry/zipball/bd3592c6f0554a72811df52aeaea98c7815f6e5a", - "reference": "bd3592c6f0554a72811df52aeaea98c7815f6e5a", + "url": "https://api.github.com/repos/joomla-framework/registry/zipball/b9fd1812e19619bb4722a0711b691dbfefff8ee9", + "reference": "b9fd1812e19619bb4722a0711b691dbfefff8ee9", "shasum": "" }, "require": { "joomla/compat": "~1.0", "joomla/utilities": "~1.0", - "php": ">=5.3.10|>=7.0", - "symfony/polyfill-php55": "~1.0" + "php": ">=5.3.10|>=7.0" }, "require-dev": { "joomla/test": "~1.0", @@ -885,7 +877,7 @@ "suggest": { "symfony/yaml": "Install symfony/yaml if you require YAML support." }, - "time": "2016-05-14 20:42:05", + "time": "2016-04-18 23:57:43", "type": "joomla-package", "extra": { "branch-alias": { @@ -911,130 +903,135 @@ ] }, { - "name": "symfony/polyfill-php56", - "version": "v1.2.0", - "version_normalized": "1.2.0.0", + "name": "joomla/application", + "version": "1.6.0", + "version_normalized": "1.6.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php56.git", - "reference": "3edf57a8fbf9a927533344cef65ad7e1cf31030a" + "url": "https://github.com/joomla-framework/application.git", + "reference": "2c2fb32553819f22ee15d4022dec805e750f43ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/3edf57a8fbf9a927533344cef65ad7e1cf31030a", - "reference": "3edf57a8fbf9a927533344cef65ad7e1cf31030a", + "url": "https://api.github.com/repos/joomla-framework/application/zipball/2c2fb32553819f22ee15d4022dec805e750f43ce", + "reference": "2c2fb32553819f22ee15d4022dec805e750f43ce", "shasum": "" }, "require": { - "php": ">=5.3.3", - "symfony/polyfill-util": "~1.0" + "joomla/input": "~1.2", + "joomla/registry": "~1.1", + "php": ">=5.3.10|>=7.0", + "psr/log": "~1.0" }, - "time": "2016-05-18 14:26:46", - "type": "library", + "require-dev": { + "joomla/session": "^1.2.1", + "joomla/test": "~1.1", + "joomla/uri": "~1.1", + "phpunit/phpunit": "~4.8|~5.0", + "squizlabs/php_codesniffer": "1.*" + }, + "suggest": { + "joomla/session": "To use AbstractWebApplication with session support, install joomla/session", + "joomla/uri": "To use AbstractWebApplication, install joomla/uri" + }, + "time": "2016-04-09 03:08:55", + "type": "joomla-package", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.x-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php56\\": "" - }, - "files": [ - "bootstrap.php" - ] + "Joomla\\Application\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } + "GPL-2.0+" ], - "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", - "homepage": "https://symfony.com", + "description": "Joomla Application Package", + "homepage": "https://github.com/joomla-framework/application", "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" + "application", + "framework", + "joomla" ] }, { - "name": "symfony/yaml", - "version": "v2.8.8", - "version_normalized": "2.8.8.0", + "name": "simplepie/simplepie", + "version": "1.3.1", + "version_normalized": "1.3.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "dba4bb5846798cd12f32e2d8f3f35d77045773c8" + "url": "https://github.com/simplepie/simplepie.git", + "reference": "ce53709778bc1e2e4deda1651b66e5081398d5cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/dba4bb5846798cd12f32e2d8f3f35d77045773c8", - "reference": "dba4bb5846798cd12f32e2d8f3f35d77045773c8", + "url": "https://api.github.com/repos/simplepie/simplepie/zipball/ce53709778bc1e2e4deda1651b66e5081398d5cc", + "reference": "ce53709778bc1e2e4deda1651b66e5081398d5cc", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.2.0" }, - "time": "2016-06-29 05:29:29", + "time": "2012-10-30 17:54:03", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, "installation-source": "dist", "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "psr-0": { + "SimplePie": "library" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Ryan Parman", + "homepage": "http://ryanparman.com/", + "role": "Creator, alumnus developer" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Geoffrey Sneddon", + "homepage": "http://gsnedders.com/", + "role": "Alumnus developer" + }, + { + "name": "Ryan McCue", + "email": "me@ryanmccue.info", + "homepage": "http://ryanmccue.info/", + "role": "Developer" } ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com" + "description": "A simple Atom/RSS parsing library for PHP", + "homepage": "http://simplepie.org/", + "keywords": [ + "atom", + "feeds", + "rss" + ] }, { - "name": "symfony/polyfill-util", + "name": "symfony/polyfill-php55", "version": "v1.2.0", "version_normalized": "1.2.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-util.git", - "reference": "ef830ce3d218e622b221d6bfad42c751d974bf99" + "url": "https://github.com/symfony/polyfill-php55.git", + "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/ef830ce3d218e622b221d6bfad42c751d974bf99", - "reference": "ef830ce3d218e622b221d6bfad42c751d974bf99", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", + "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", "shasum": "" }, "require": { + "ircmaxell/password-compat": "~1.0", "php": ">=5.3.3" }, "time": "2016-05-18 14:26:46", @@ -1047,8 +1044,11 @@ "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Polyfill\\Util\\": "" - } + "Symfony\\Polyfill\\Php55\\": "" + }, + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1064,12 +1064,12 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony utilities for portability of PHP codes", + "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ - "compat", "compatibility", "polyfill", + "portable", "shim" ] }, diff --git a/libraries/vendor/joomla/registry/src/Format/Json.php b/libraries/vendor/joomla/registry/src/Format/Json.php index 0aed96abb6e3a..6f4b8682ef2aa 100644 --- a/libraries/vendor/joomla/registry/src/Format/Json.php +++ b/libraries/vendor/joomla/registry/src/Format/Json.php @@ -53,7 +53,6 @@ public function objectToString($object, $options = array()) * @return object Data object. * * @since 1.0 - * @throws \RuntimeException */ public function stringToObject($data, array $options = array('processSections' => false)) { @@ -64,14 +63,6 @@ public function stringToObject($data, array $options = array('processSections' = return AbstractRegistryFormat::getInstance('Ini')->stringToObject($data, $options); } - $decoded = json_decode($data); - - // Check for an error decoding the data - if ($decoded === null) - { - throw new \RuntimeException(sprintf('Error decoding JSON data: %s', json_last_error_msg())); - } - - return $decoded; + return json_decode($data); } } diff --git a/libraries/vendor/joomla/registry/src/Registry.php b/libraries/vendor/joomla/registry/src/Registry.php index 8f753549e43b4..7ce6f45e42d88 100644 --- a/libraries/vendor/joomla/registry/src/Registry.php +++ b/libraries/vendor/joomla/registry/src/Registry.php @@ -25,14 +25,6 @@ class Registry implements \JsonSerializable, \ArrayAccess, \IteratorAggregate, \ */ protected $data; - /** - * Flag if the Registry data object has been initialized - * - * @var boolean - * @since 1.5.2 - */ - protected $initialized = false; - /** * Registry instances container. * @@ -364,16 +356,6 @@ public function loadString($data, $format = 'JSON', $options = array()) $handler = AbstractRegistryFormat::getInstance($format, $options); $obj = $handler->stringToObject($data, $options); - - // If the data object has not yet been initialized, direct assign the object - if (!$this->initialized) - { - $this->data = $obj; - $this->initialized = true; - - return $this; - } - $this->loadObject($obj); return $this; @@ -680,9 +662,6 @@ public function toString($format = 'JSON', $options = array()) */ protected function bindData($parent, $data, $recursive = true, $allowNull = true) { - // The data object is now initialized - $this->initialized = true; - // Ensure the input data is an array. $data = is_object($data) ? get_object_vars($data) diff --git a/libraries/vendor/phpmailer/phpmailer/VERSION b/libraries/vendor/phpmailer/phpmailer/VERSION index 56f1219b499cf..ba678f2d2cf28 100644 --- a/libraries/vendor/phpmailer/phpmailer/VERSION +++ b/libraries/vendor/phpmailer/phpmailer/VERSION @@ -1 +1 @@ -5.2.16 \ No newline at end of file +5.2.14 \ No newline at end of file diff --git a/libraries/vendor/phpmailer/phpmailer/class.phpmailer.php b/libraries/vendor/phpmailer/phpmailer/class.phpmailer.php index f9013ebb1744a..e4dd00bf39eaa 100644 --- a/libraries/vendor/phpmailer/phpmailer/class.phpmailer.php +++ b/libraries/vendor/phpmailer/phpmailer/class.phpmailer.php @@ -31,7 +31,7 @@ class PHPMailer * The PHPMailer Version number. * @var string */ - public $Version = '5.2.16'; + public $Version = '5.2.14'; /** * Email priority. @@ -285,7 +285,7 @@ class PHPMailer /** * SMTP auth type. - * Options are CRAM-MD5, LOGIN, PLAIN, NTLM, XOAUTH2, attempted in that order if not specified + * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5 * @var string */ public $AuthType = ''; @@ -352,7 +352,6 @@ class PHPMailer /** * Whether to split multiple to addresses into multiple messages * or send them all in one message. - * Only supported in `mail` and `sendmail` transports, not in SMTP. * @var boolean */ public $SingleTo = false; @@ -395,7 +394,7 @@ class PHPMailer /** * DKIM Identity. - * Usually the email address used as the source of the email. + * Usually the email address used as the source of the email * @var string */ public $DKIM_identity = ''; @@ -447,15 +446,6 @@ class PHPMailer */ public $XMailer = ''; - /** - * Which validator to use by default when validating email addresses. - * May be a callable to inject your own validator, but there are several built-in validators. - * @see PHPMailer::validateAddress() - * @var string|callable - * @static - */ - public static $validator = 'auto'; - /** * An instance of the SMTP sender class. * @var SMTP @@ -644,11 +634,9 @@ class PHPMailer * Constructor. * @param boolean $exceptions Should we throw external exceptions? */ - public function __construct($exceptions = null) + public function __construct($exceptions = false) { - if ($exceptions !== null) { - $this->exceptions = (boolean)$exceptions; - } + $this->exceptions = (boolean)$exceptions; } /** @@ -657,7 +645,9 @@ public function __construct($exceptions = null) public function __destruct() { //Close any open SMTP connection nicely - $this->smtpClose(); + if ($this->Mailer == 'smtp') { + $this->smtpClose(); + } } /** @@ -681,9 +671,7 @@ private function mailPassthru($to, $subject, $body, $header, $params) } else { $subject = $this->encodeHeader($this->secureHeader($subject)); } - //Can't use additional_parameters in safe_mode - //@link http://php.net/manual/en/function.mail.php - if (ini_get('safe_mode') or !$this->UseSendmailOptions) { + if (ini_get('safe_mode') || !($this->UseSendmailOptions)) { $result = @mail($to, $subject, $body, $header); } else { $result = @mail($to, $subject, $body, $header, $params); @@ -725,7 +713,7 @@ protected function edebug($str) case 'echo': default: //Normalize line breaks - $str = preg_replace('/\r\n?/ms', "\n", $str); + $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( "\n", "\n \t ", @@ -862,7 +850,7 @@ protected function addOrEnqueueAnAddress($kind, $address, $name) $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim if (($pos = strrpos($address, '@')) === false) { // At-sign is misssing. - $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address"; + $error_message = $this->lang('invalid_address') . $address; $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { @@ -912,7 +900,7 @@ protected function addAnAddress($kind, $address, $name = '') return false; } if (!$this->validateAddress($address)) { - $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address"; + $error_message = $this->lang('invalid_address') . $address; $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { @@ -1006,7 +994,7 @@ public function setFrom($address, $name = '', $auto = true) if (($pos = strrpos($address, '@')) === false or (!$this->has8bitChars(substr($address, ++$pos)) or !$this->idnSupported()) and !$this->validateAddress($address)) { - $error_message = $this->lang('invalid_address') . " (setFrom) $address"; + $error_message = $this->lang('invalid_address') . $address; $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { @@ -1039,30 +1027,19 @@ public function getLastMessageID() /** * Check that a string looks like an email address. * @param string $address The email address to check - * @param string|callable $patternselect A selector for the validation pattern to use : + * @param string $patternselect A selector for the validation pattern to use : * * `auto` Pick best pattern automatically; * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14; * * `pcre` Use old PCRE implementation; * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. * * `noregex` Don't use a regex: super fast, really dumb. - * Alternatively you may pass in a callable to inject your own validator, for example: - * PHPMailer::validateAddress('user@example.com', function($address) { - * return (strpos($address, '@') !== false); - * }); - * You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator. * @return boolean * @static * @access public */ - public static function validateAddress($address, $patternselect = null) + public static function validateAddress($address, $patternselect = 'auto') { - if (is_null($patternselect)) { - $patternselect = self::$validator; - } - if (is_callable($patternselect)) { - return call_user_func($patternselect, $address); - } //Reject line breaks in addresses; it's valid RFC5322, but not RFC5321 if (strpos($address, "\n") !== false or strpos($address, "\r") !== false) { return false; @@ -1239,7 +1216,7 @@ public function preSend() } $this->$address_kind = $this->punyencodeAddress($this->$address_kind); if (!$this->validateAddress($this->$address_kind)) { - $error_message = $this->lang('invalid_address') . ' (punyEncode) ' . $this->$address_kind; + $error_message = $this->lang('invalid_address') . $this->$address_kind; $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { @@ -1250,7 +1227,7 @@ public function preSend() } // Set whether the message is multipart/alternative - if ($this->alternativeExists()) { + if (!empty($this->AltBody)) { $this->ContentType = 'multipart/alternative'; } @@ -1427,9 +1404,9 @@ protected function mailSend($header, $body) } $to = implode(', ', $toArr); - $params = null; - //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver - if (!empty($this->Sender)) { + if (empty($this->Sender)) { + $params = ' '; + } else { $params = sprintf('-f%s', $this->Sender); } if ($this->Sender != '' and !ini_get('safe_mode')) { @@ -1437,7 +1414,7 @@ protected function mailSend($header, $body) ini_set('sendmail_from', $this->Sender); } $result = false; - if ($this->SingleTo and count($toArr) > 1) { + if ($this->SingleTo && count($toArr) > 1) { foreach ($toArr as $toAddr) { $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params); $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From); @@ -1543,17 +1520,12 @@ protected function smtpSend($header, $body) * @throws phpmailerException * @return boolean */ - public function smtpConnect($options = null) + public function smtpConnect($options = array()) { if (is_null($this->smtp)) { $this->smtp = $this->getSMTPInstance(); } - //If no options are provided, use whatever is set in the instance - if (is_null($options)) { - $options = $this->SMTPOptions; - } - // Already connected? if ($this->smtp->connected()) { return true; @@ -1623,7 +1595,7 @@ public function smtpConnect($options = null) if (!$this->smtp->startTLS()) { throw new phpmailerException($this->lang('connect_host')); } - // We must resend EHLO after TLS negotiation + // We must resend HELO after tls negotiation $this->smtp->hello($hello); } if ($this->SMTPAuth) { @@ -1662,7 +1634,7 @@ public function smtpConnect($options = null) */ public function smtpClose() { - if (is_a($this->smtp, 'SMTP')) { + if ($this->smtp !== null) { if ($this->smtp->connected()) { $this->smtp->quit(); $this->smtp->close(); @@ -2000,7 +1972,7 @@ public function createHeader() $result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject))); } - if ('' != $this->MessageID and preg_match('/^<.*@.*>$/', $this->MessageID)) { + if ($this->MessageID != '') { $this->lastMessageID = $this->MessageID; } else { $this->lastMessageID = sprintf('<%s@%s>', $this->uniqueid, $this->serverHostname()); @@ -2102,7 +2074,7 @@ public function getMailMIME() */ public function getSentMIMEMessage() { - return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . self::CRLF . self::CRLF . $this->MIMEBody; + return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody; } /** @@ -2132,12 +2104,12 @@ public function createBody() //Can we do a 7-bit downgrade? if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) { $bodyEncoding = '7bit'; - //All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit $bodyCharSet = 'us-ascii'; } //If lines are too long, and we're not already using an encoding that will shorten them, - //change to quoted-printable transfer encoding for the body part only + //change to quoted-printable transfer encoding if ('base64' != $this->Encoding and self::hasLineLongerThanMax($this->Body)) { + $this->Encoding = 'quoted-printable'; $bodyEncoding = 'quoted-printable'; } @@ -2146,12 +2118,10 @@ public function createBody() //Can we do a 7-bit downgrade? if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) { $altBodyEncoding = '7bit'; - //All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit $altBodyCharSet = 'us-ascii'; } - //If lines are too long, and we're not already using an encoding that will shorten them, - //change to quoted-printable transfer encoding for the alt body part only - if ('base64' != $altBodyEncoding and self::hasLineLongerThanMax($this->AltBody)) { + //If lines are too long, change to quoted-printable transfer encoding + if (self::hasLineLongerThanMax($this->AltBody)) { $altBodyEncoding = 'quoted-printable'; } //Use this as a preamble in all multipart message types @@ -2254,10 +2224,8 @@ public function createBody() $body .= $this->attachAll('attachment', $this->boundary[1]); break; default: - // Catch case 'plain' and case '', applies to simple `text/plain` and `text/html` body content types - //Reset the `Encoding` property in case we changed it for line length reasons - $this->Encoding = $bodyEncoding; - $body .= $this->encodeString($this->Body, $this->Encoding); + // catch case 'plain' and case '' + $body .= $this->encodeString($this->Body, $bodyEncoding); break; } @@ -2363,7 +2331,8 @@ protected function endBoundary($boundary) /** * Set the message type. - * PHPMailer only supports some preset message types, not arbitrary MIME structures. + * PHPMailer only supports some preset message types, + * not arbitrary MIME structures. * @access protected * @return void */ @@ -2381,7 +2350,6 @@ protected function setMessageType() } $this->message_type = implode('_', $type); if ($this->message_type == '') { - //The 'plain' message_type refers to the message having a single body element, not that it is plain-text $this->message_type = 'plain'; } } @@ -3328,7 +3296,7 @@ public function msgHTML($message, $basedir = '', $advanced = false) $message ); } - } elseif (substr($url, 0, 4) !== 'cid:' && !preg_match('#^[a-z][a-z0-9+.-]*://#i', $url)) { + } elseif (substr($url, 0, 4) !== 'cid:' && !preg_match('#^[A-z]+://#', $url)) { // Do not change urls for absolute images (thanks to corvuscorax) // Do not change urls that are already inline images $filename = basename($url); @@ -3364,7 +3332,7 @@ public function msgHTML($message, $basedir = '', $advanced = false) // Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better $this->Body = $this->normalizeBreaks($message); $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced)); - if (!$this->alternativeExists()) { + if (empty($this->AltBody)) { $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . self::CRLF . self::CRLF; } @@ -3689,13 +3657,11 @@ public function DKIM_Sign($signHeader) if ($this->DKIM_passphrase != '') { $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase); } else { - $privKey = openssl_pkey_get_private($privKeyStr); + $privKey = $privKeyStr; } - if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) { //sha1WithRSAEncryption - openssl_pkey_free($privKey); + if (openssl_sign($signHeader, $signature, $privKey)) { return base64_encode($signature); } - openssl_pkey_free($privKey); return ''; } @@ -3712,7 +3678,7 @@ public function DKIM_HeaderC($signHeader) foreach ($lines as $key => $line) { list($heading, $value) = explode(':', $line, 2); $heading = strtolower($heading); - $value = preg_replace('/\s{2,}/', ' ', $value); // Compress useless spaces + $value = preg_replace('/\s+/', ' ', $value); // Compress useless spaces $lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value } $signHeader = implode("\r\n", $lines); @@ -3750,7 +3716,7 @@ public function DKIM_BodyC($body) */ public function DKIM_Add($headers_line, $subject, $body) { - $DKIMsignatureType = 'rsa-sha256'; // Signature & hash algorithms + $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body $DKIMquery = 'dns/txt'; // Query method $DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone) @@ -3758,7 +3724,6 @@ public function DKIM_Add($headers_line, $subject, $body) $headers = explode($this->LE, $headers_line); $from_header = ''; $to_header = ''; - $date_header = ''; $current = ''; foreach ($headers as $header) { if (strpos($header, 'From:') === 0) { @@ -3767,9 +3732,6 @@ public function DKIM_Add($headers_line, $subject, $body) } elseif (strpos($header, 'To:') === 0) { $to_header = $header; $current = 'to_header'; - } elseif (strpos($header, 'Date:') === 0) { - $date_header = $header; - $current = 'date_header'; } else { if (!empty($$current) && strpos($header, ' =?') === 0) { $$current .= $header; @@ -3780,7 +3742,6 @@ public function DKIM_Add($headers_line, $subject, $body) } $from = str_replace('|', '=7C', $this->DKIM_QP($from_header)); $to = str_replace('|', '=7C', $this->DKIM_QP($to_header)); - $date = str_replace('|', '=7C', $this->DKIM_QP($date_header)); $subject = str_replace( '|', '=7C', @@ -3788,7 +3749,7 @@ public function DKIM_Add($headers_line, $subject, $body) ); // Copied header fields (dkim-quoted-printable) $body = $this->DKIM_BodyC($body); $DKIMlen = strlen($body); // Length of body - $DKIMb64 = base64_encode(pack('H*', hash('sha256', $body))); // Base64 of packed binary SHA-256 hash of body + $DKIMb64 = base64_encode(pack('H*', sha1($body))); // Base64 of packed binary SHA-1 hash of body if ('' == $this->DKIM_identity) { $ident = ''; } else { @@ -3801,18 +3762,16 @@ public function DKIM_Add($headers_line, $subject, $body) $this->DKIM_selector . ";\r\n" . "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" . - "\th=From:To:Date:Subject;\r\n" . + "\th=From:To:Subject;\r\n" . "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" . "\tz=$from\r\n" . "\t|$to\r\n" . - "\t|$date\r\n" . "\t|$subject;\r\n" . "\tbh=" . $DKIMb64 . ";\r\n" . "\tb="; $toSign = $this->DKIM_HeaderC( $from_header . "\r\n" . $to_header . "\r\n" . - $date_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs ); diff --git a/libraries/vendor/phpmailer/phpmailer/class.phpmaileroauthgoogle.php b/libraries/vendor/phpmailer/phpmailer/class.phpmaileroauthgoogle.php index 71c9bd32ff6af..ab6292b82f301 100644 --- a/libraries/vendor/phpmailer/phpmailer/class.phpmaileroauthgoogle.php +++ b/libraries/vendor/phpmailer/phpmailer/class.phpmaileroauthgoogle.php @@ -49,8 +49,7 @@ public function __construct( $this->oauthUserEmail = $UserEmail; } - private function getProvider() - { + private function getProvider() { return new League\OAuth2\Client\Provider\Google([ 'clientId' => $this->oauthClientId, 'clientSecret' => $this->oauthClientSecret diff --git a/libraries/vendor/phpmailer/phpmailer/class.pop3.php b/libraries/vendor/phpmailer/phpmailer/class.pop3.php index 56ad1bfcf9e6c..403b573eb3710 100644 --- a/libraries/vendor/phpmailer/phpmailer/class.pop3.php +++ b/libraries/vendor/phpmailer/phpmailer/class.pop3.php @@ -34,7 +34,7 @@ class POP3 * @var string * @access public */ - public $Version = '5.2.16'; + public $Version = '5.2.14'; /** * Default POP3 port number. diff --git a/libraries/vendor/phpmailer/phpmailer/class.smtp.php b/libraries/vendor/phpmailer/phpmailer/class.smtp.php index 0c016f12191d3..2e32e2fce00ea 100644 --- a/libraries/vendor/phpmailer/phpmailer/class.smtp.php +++ b/libraries/vendor/phpmailer/phpmailer/class.smtp.php @@ -30,7 +30,7 @@ class SMTP * The PHPMailer SMTP version number. * @var string */ - const VERSION = '5.2.16'; + const VERSION = '5.2.14'; /** * SMTP line break constant. @@ -81,7 +81,7 @@ class SMTP * @deprecated Use the `VERSION` constant instead * @see SMTP::VERSION */ - public $Version = '5.2.16'; + public $Version = '5.2.14'; /** * SMTP server port number. @@ -336,22 +336,11 @@ public function startTLS() if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) { return false; } - - //Allow the best TLS version(s) we can - $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; - - //PHP 5.6.7 dropped inclusion of TLS 1.1 and 1.2 in STREAM_CRYPTO_METHOD_TLS_CLIENT - //so add them back in manually if we can - if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { - $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; - $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; - } - // Begin encrypted connection if (!stream_socket_enable_crypto( $this->smtp_conn, true, - $crypto_method + STREAM_CRYPTO_METHOD_TLS_CLIENT )) { return false; } @@ -400,7 +389,7 @@ public function authenticate( ); if (empty($authtype)) { - foreach (array('CRAM-MD5', 'LOGIN', 'PLAIN', 'NTLM', 'XOAUTH2') as $method) { + foreach (array('LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN', 'XOAUTH2') as $method) { if (in_array($method, $this->server_caps['AUTH'])) { $authtype = $method; break; @@ -747,7 +736,7 @@ protected function sendHello($hello, $host) protected function parseHelloFields($type) { $this->server_caps = array(); - $lines = explode("\n", $this->helo_rply); + $lines = explode("\n", $this->last_reply); foreach ($lines as $n => $s) { //First 4 chars contain response code followed by - or space diff --git a/libraries/vendor/phpmailer/phpmailer/composer.lock b/libraries/vendor/phpmailer/phpmailer/composer.lock index 3e8cb618a9661..15a841d8a35eb 100644 --- a/libraries/vendor/phpmailer/phpmailer/composer.lock +++ b/libraries/vendor/phpmailer/phpmailer/composer.lock @@ -4,8 +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" ], - "hash": "ca5abc72444d9608a35c39f9064c139b", - "content-hash": "8b66ed71ae9ca8cd0258c814615d624f", + "hash": "0eb36ae77d61050323a94e312176ea66", "packages": [], "packages-dev": [ { @@ -331,16 +330,16 @@ }, { "name": "erusev/parsedown", - "version": "1.6.0", + "version": "1.5.4", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", - "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7" + "reference": "0e89e3714bda18973184d30646306bb0a482bd96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7", - "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/0e89e3714bda18973184d30646306bb0a482bd96", + "reference": "0e89e3714bda18973184d30646306bb0a482bd96", "shasum": "" }, "type": "library", @@ -366,7 +365,7 @@ "markdown", "parser" ], - "time": "2015-10-04 16:44:32" + "time": "2015-08-03 09:24:05" }, { "name": "herrera-io/json", @@ -627,9 +626,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -646,16 +645,16 @@ }, { "name": "justinrainbow/json-schema", - "version": "v1.6.0", + "version": "1.4.4", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "f9e27c3e202faf14fd581ef41355d83bb4b7eb7d" + "reference": "8dc9b9d85ab639ca60ab4608b34c1279d6ae7bce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/f9e27c3e202faf14fd581ef41355d83bb4b7eb7d", - "reference": "f9e27c3e202faf14fd581ef41355d83bb4b7eb7d", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/8dc9b9d85ab639ca60ab4608b34c1279d6ae7bce", + "reference": "8dc9b9d85ab639ca60ab4608b34c1279d6ae7bce", "shasum": "" }, "require": { @@ -676,8 +675,8 @@ } }, "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" + "psr-0": { + "JsonSchema": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -708,7 +707,7 @@ "json", "schema" ], - "time": "2016-01-06 14:37:04" + "time": "2015-07-14 16:29:50" }, { "name": "kherge/version", @@ -755,16 +754,16 @@ }, { "name": "monolog/monolog", - "version": "1.17.2", + "version": "1.17.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24" + "reference": "0524c87587ab85bc4c2d6f5b41253ccb930a5422" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bee7f0dc9c3e0b69a6039697533dca1e845c8c24", - "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/0524c87587ab85bc4c2d6f5b41253ccb930a5422", + "reference": "0524c87587ab85bc4c2d6f5b41253ccb930a5422", "shasum": "" }, "require": { @@ -778,11 +777,10 @@ "aws/aws-sdk-php": "^2.4.9", "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", - "jakub-onderka/php-parallel-lint": "0.9", "php-console/php-console": "^3.1.3", "phpunit/phpunit": "~4.5", "phpunit/phpunit-mock-objects": "2.3.0", - "raven/raven": "^0.13", + "raven/raven": "~0.11", "ruflin/elastica": ">=0.90 <3.0", "swiftmailer/swiftmailer": "~5.3", "videlalvaro/php-amqplib": "~2.4" @@ -828,7 +826,7 @@ "logging", "psr-3" ], - "time": "2015-10-14 12:51:02" + "time": "2015-08-31 09:17:37" }, { "name": "nikic/php-parser", @@ -909,9 +907,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -1313,16 +1311,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.2.4", + "version": "2.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c", + "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c", "shasum": "" }, "require": { @@ -1371,7 +1369,7 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2015-08-04 03:42:39" }, { "name": "phpunit/php-file-iterator", @@ -1504,16 +1502,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.4.8", + "version": "1.4.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3ab72c62e550370a6cd5dc873e1a04ab57562f5b", + "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b", "shasum": "" }, "require": { @@ -1549,7 +1547,7 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-15 10:49:45" + "time": "2015-08-16 08:51:00" }, { "name": "phpunit/phpunit", @@ -1625,16 +1623,16 @@ }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", + "version": "2.3.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + "reference": "5e2645ad49d196e020b85598d7c97e482725786a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5e2645ad49d196e020b85598d7c97e482725786a", + "reference": "5e2645ad49d196e020b85598d7c97e482725786a", "shasum": "" }, "require": { @@ -1677,7 +1675,7 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2015-08-19 09:14:08" }, { "name": "pimple/pimple", @@ -1714,9 +1712,7 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" + "email": "fabien@symfony.com" } ], "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", @@ -1831,28 +1827,28 @@ }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -1875,24 +1871,24 @@ } ], "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", + "homepage": "http://www.github.com/sebastianbergmann/diff", "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2015-02-22 15:13:53" }, { "name": "sebastian/environment", - "version": "1.3.3", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6e7133793a8e5a5714a551a8324337374be209df" + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df", - "reference": "6e7133793a8e5a5714a551a8324337374be209df", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", "shasum": "" }, "require": { @@ -1929,7 +1925,7 @@ "environment", "hhvm" ], - "time": "2015-12-02 08:37:27" + "time": "2015-08-03 06:14:51" }, { "name": "sebastian/exporter", @@ -1999,16 +1995,16 @@ }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", "shasum": "" }, "require": { @@ -2046,20 +2042,20 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "time": "2014-10-06 09:23:50" }, { "name": "sebastian/recursion-context", - "version": "1.0.2", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", "shasum": "" }, "require": { @@ -2099,7 +2095,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" + "time": "2015-06-21 08:04:50" }, { "name": "sebastian/version", @@ -2138,20 +2134,20 @@ }, { "name": "seld/jsonlint", - "version": "1.4.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "66834d3e3566bb5798db7294619388786ae99394" + "reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/66834d3e3566bb5798db7294619388786ae99394", - "reference": "66834d3e3566bb5798db7294619388786ae99394", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/863ae85c6d3ef60ca49cb12bd051c4a0648c40c4", + "reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4", "shasum": "" }, "require": { - "php": "^5.3 || ^7.0" + "php": ">=5.3.0" }, "bin": [ "bin/jsonlint" @@ -2180,39 +2176,39 @@ "parser", "validator" ], - "time": "2015-11-21 02:21:41" + "time": "2015-01-04 21:18:15" }, { "name": "symfony/config", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "17d4b2e64ce1c6ba7caa040f14469b3c44d7f7d2" + "url": "https://github.com/symfony/Config.git", + "reference": "6c905bbed1e728226de656e4c07d620dfe9e80d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/17d4b2e64ce1c6ba7caa040f14469b3c44d7f7d2", - "reference": "17d4b2e64ce1c6ba7caa040f14469b3c44d7f7d2", + "url": "https://api.github.com/repos/symfony/Config/zipball/6c905bbed1e728226de656e4c07d620dfe9e80d9", + "reference": "6c905bbed1e728226de656e4c07d620dfe9e80d9", "shasum": "" }, "require": { "php": ">=5.3.9", - "symfony/filesystem": "~2.3|~3.0.0" + "symfony/filesystem": "~2.3" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2230,30 +2226,30 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2015-12-26 13:37:56" + "time": "2015-07-09 16:07:40" }, { "name": "symfony/console", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "2e06a5ccb19dcf9b89f1c6a677a39a8df773635a" + "url": "https://github.com/symfony/Console.git", + "reference": "d6cf02fe73634c96677e428f840704bfbcaec29e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/2e06a5ccb19dcf9b89f1c6a677a39a8df773635a", - "reference": "2e06a5ccb19dcf9b89f1c6a677a39a8df773635a", + "url": "https://api.github.com/repos/symfony/Console/zipball/d6cf02fe73634c96677e428f840704bfbcaec29e", + "reference": "d6cf02fe73634c96677e428f840704bfbcaec29e", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=5.3.9" }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/process": "~2.1|~3.0.0" + "symfony/event-dispatcher": "~2.1", + "symfony/phpunit-bridge": "~2.7", + "symfony/process": "~2.1" }, "suggest": { "psr/log": "For using the console logger", @@ -2263,16 +2259,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2290,20 +2283,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2015-12-22 10:25:57" + "time": "2015-07-28 15:18:12" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc" + "url": "https://github.com/symfony/EventDispatcher.git", + "reference": "9310b5f9a87ec2ea75d20fec0b0017c77c66dac3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a5eb815363c0388e83247e7e9853e5dbc14999cc", - "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/9310b5f9a87ec2ea75d20fec0b0017c77c66dac3", + "reference": "9310b5f9a87ec2ea75d20fec0b0017c77c66dac3", "shasum": "" }, "require": { @@ -2311,10 +2304,11 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0" + "symfony/config": "~2.0,>=2.0.5", + "symfony/dependency-injection": "~2.6", + "symfony/expression-language": "~2.6", + "symfony/phpunit-bridge": "~2.7", + "symfony/stopwatch": "~2.3" }, "suggest": { "symfony/dependency-injection": "", @@ -2323,16 +2317,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2350,38 +2341,38 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2015-10-30 20:15:42" + "time": "2015-06-18 19:21:56" }, { "name": "symfony/filesystem", - "version": "v3.0.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "c2e59d11dccd135dc8f00ee97f34fe1de842e70c" + "url": "https://github.com/symfony/Filesystem.git", + "reference": "2d7b2ddaf3f548f4292df49a99d19c853d43f0b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/c2e59d11dccd135dc8f00ee97f34fe1de842e70c", - "reference": "c2e59d11dccd135dc8f00ee97f34fe1de842e70c", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/2d7b2ddaf3f548f4292df49a99d19c853d43f0b8", + "reference": "2d7b2ddaf3f548f4292df49a99d19c853d43f0b8", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2399,38 +2390,38 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2015-12-22 10:39:06" + "time": "2015-07-09 16:07:40" }, { "name": "symfony/finder", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "dd41ae57f4f737be271d944a0cc5f5f21203a7c6" + "url": "https://github.com/symfony/Finder.git", + "reference": "ae0f363277485094edc04c9f3cbe595b183b78e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/dd41ae57f4f737be271d944a0cc5f5f21203a7c6", - "reference": "dd41ae57f4f737be271d944a0cc5f5f21203a7c6", + "url": "https://api.github.com/repos/symfony/Finder/zipball/ae0f363277485094edc04c9f3cbe595b183b78e4", + "reference": "ae0f363277485094edc04c9f3cbe595b183b78e4", "shasum": "" }, "require": { "php": ">=5.3.9" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2448,97 +2439,38 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2015-12-05 11:09:21" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "49ff736bd5d41f45240cec77b44967d76e0c3d25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/49ff736bd5d41f45240cec77b44967d76e0c3d25", - "reference": "49ff736bd5d41f45240cec77b44967d76e0c3d25", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2015-11-20 09:19:13" + "time": "2015-07-09 16:07:40" }, { "name": "symfony/process", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "62c254438b5040bc2217156e1570cf2206e8540c" + "url": "https://github.com/symfony/Process.git", + "reference": "48aeb0e48600321c272955132d7606ab0a49adb3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/62c254438b5040bc2217156e1570cf2206e8540c", - "reference": "62c254438b5040bc2217156e1570cf2206e8540c", + "url": "https://api.github.com/repos/symfony/Process/zipball/48aeb0e48600321c272955132d7606ab0a49adb3", + "reference": "48aeb0e48600321c272955132d7606ab0a49adb3", "shasum": "" }, "require": { "php": ">=5.3.9" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2556,38 +2488,38 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2015-12-23 11:03:46" + "time": "2015-07-01 11:25:50" }, { "name": "symfony/stopwatch", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "5f1e2ebd1044da542d2b9510527836e8be92b1cb" + "url": "https://github.com/symfony/Stopwatch.git", + "reference": "b07a866719bbac5294c67773340f97b871733310" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5f1e2ebd1044da542d2b9510527836e8be92b1cb", - "reference": "5f1e2ebd1044da542d2b9510527836e8be92b1cb", + "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/b07a866719bbac5294c67773340f97b871733310", + "reference": "b07a866719bbac5294c67773340f97b871733310", "shasum": "" }, "require": { "php": ">=5.3.9" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Stopwatch\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2605,34 +2537,34 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2015-10-30 20:15:42" + "time": "2015-07-01 18:23:16" }, { "name": "symfony/translation", - "version": "v3.0.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "dff0867826a7068d673801b7522f8e2634016ef9" + "url": "https://github.com/symfony/Translation.git", + "reference": "c8dc34cc936152c609cdd722af317e4239d10dd6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/dff0867826a7068d673801b7522f8e2634016ef9", - "reference": "dff0867826a7068d673801b7522f8e2634016ef9", + "url": "https://api.github.com/repos/symfony/Translation/zipball/c8dc34cc936152c609cdd722af317e4239d10dd6", + "reference": "c8dc34cc936152c609cdd722af317e4239d10dd6", "shasum": "" }, "require": { - "php": ">=5.5.9", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=5.3.9" }, "conflict": { - "symfony/config": "<2.8" + "symfony/config": "<2.7" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/intl": "~2.8|~3.0", - "symfony/yaml": "~2.8|~3.0" + "symfony/config": "~2.7", + "symfony/intl": "~2.3", + "symfony/phpunit-bridge": "~2.7", + "symfony/yaml": "~2.2" }, "suggest": { "psr/log": "To use logging capability in translator", @@ -2642,16 +2574,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2669,36 +2598,37 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2015-12-05 17:45:07" + "time": "2015-07-09 16:07:40" }, { "name": "symfony/validator", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/validator.git", - "reference": "ab56537745fe90066e23275f3dd8a002ff4e2c25" + "url": "https://github.com/symfony/Validator.git", + "reference": "646df03e635a8a232804274401449ccdf5f03cad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/ab56537745fe90066e23275f3dd8a002ff4e2c25", - "reference": "ab56537745fe90066e23275f3dd8a002ff4e2c25", + "url": "https://api.github.com/repos/symfony/Validator/zipball/646df03e635a8a232804274401449ccdf5f03cad", + "reference": "646df03e635a8a232804274401449ccdf5f03cad", "shasum": "" }, "require": { "php": ">=5.3.9", - "symfony/translation": "~2.4|~3.0.0" + "symfony/translation": "~2.4" }, "require-dev": { "doctrine/annotations": "~1.0", "doctrine/cache": "~1.0", "egulias/email-validator": "~1.2,>=1.2.1", - "symfony/config": "~2.2|~3.0.0", - "symfony/expression-language": "~2.4|~3.0.0", - "symfony/http-foundation": "~2.1|~3.0.0", - "symfony/intl": "~2.4|~3.0.0", - "symfony/property-access": "~2.3|~3.0.0", - "symfony/yaml": "~2.0,>=2.0.5|~3.0.0" + "symfony/config": "~2.2", + "symfony/expression-language": "~2.4", + "symfony/http-foundation": "~2.1", + "symfony/intl": "~2.3", + "symfony/phpunit-bridge": "~2.7", + "symfony/property-access": "~2.3", + "symfony/yaml": "~2.0,>=2.0.5" }, "suggest": { "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", @@ -2714,16 +2644,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Validator\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2741,38 +2668,38 @@ ], "description": "Symfony Validator Component", "homepage": "https://symfony.com", - "time": "2015-12-26 13:37:56" + "time": "2015-07-31 06:49:15" }, { "name": "symfony/yaml", - "version": "v3.0.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691" + "url": "https://github.com/symfony/Yaml.git", + "reference": "71340e996171474a53f3d29111d046be4ad8a0ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/3df409958a646dad2bc5046c3fb671ee24a1a691", - "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/71340e996171474a53f3d29111d046be4ad8a0ff", + "reference": "71340e996171474a53f3d29111d046be4ad8a0ff", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2790,20 +2717,20 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-12-26 13:39:53" + "time": "2015-07-28 14:07:07" }, { "name": "twig/twig", - "version": "v1.23.1", + "version": "v1.21.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6" + "reference": "ca8d3aa90b6a01c82e07909fe815d6b443e75a23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/d9b6333ae8dd2c8e3fd256e127548def0bc614c6", - "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/ca8d3aa90b6a01c82e07909fe815d6b443e75a23", + "reference": "ca8d3aa90b6a01c82e07909fe815d6b443e75a23", "shasum": "" }, "require": { @@ -2816,7 +2743,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.23-dev" + "dev-master": "1.21-dev" } }, "autoload": { @@ -2851,32 +2778,32 @@ "keywords": [ "templating" ], - "time": "2015-11-05 12:49:06" + "time": "2015-08-26 08:58:31" }, { "name": "zendframework/zend-cache", - "version": "2.5.3", + "version": "2.5.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-cache.git", - "reference": "7ff9d6b922ae29dbdc53f6a62b471fb6e58565df" + "reference": "325afc68d4381cf8b95288ebb9b1d38dc32ed579" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-cache/zipball/7ff9d6b922ae29dbdc53f6a62b471fb6e58565df", - "reference": "7ff9d6b922ae29dbdc53f6a62b471fb6e58565df", + "url": "https://api.github.com/repos/zendframework/zend-cache/zipball/325afc68d4381cf8b95288ebb9b1d38dc32ed579", + "reference": "325afc68d4381cf8b95288ebb9b1d38dc32ed579", "shasum": "" }, "require": { "php": ">=5.5", "zendframework/zend-eventmanager": "~2.5", + "zendframework/zend-serializer": "~2.5", "zendframework/zend-servicemanager": "~2.5", "zendframework/zend-stdlib": "~2.5" }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", - "zendframework/zend-serializer": "~2.5", "zendframework/zend-session": "~2.5" }, "suggest": { @@ -2914,7 +2841,7 @@ "cache", "zf2" ], - "time": "2015-09-15 16:09:09" + "time": "2015-07-16 18:44:41" }, { "name": "zendframework/zend-config", @@ -2975,16 +2902,16 @@ }, { "name": "zendframework/zend-eventmanager", - "version": "2.6.1", + "version": "2.5.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-eventmanager.git", - "reference": "a03de810b99b0302059ab744c535d464b8dc4721" + "reference": "135af03d07fd048c322259aab6611d2be290475c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/a03de810b99b0302059ab744c535d464b8dc4721", - "reference": "a03de810b99b0302059ab744c535d464b8dc4721", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/135af03d07fd048c322259aab6611d2be290475c", + "reference": "135af03d07fd048c322259aab6611d2be290475c", "shasum": "" }, "require": { @@ -2992,15 +2919,14 @@ "zendframework/zend-stdlib": "~2.5" }, "require-dev": { - "athletic/athletic": "dev-master", "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev", - "dev-develop": "3.0-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3017,7 +2943,7 @@ "eventmanager", "zf2" ], - "time": "2015-10-06 11:53:40" + "time": "2015-07-16 19:00:49" }, { "name": "zendframework/zend-filter", @@ -3077,62 +3003,6 @@ ], "time": "2015-06-03 15:32:01" }, - { - "name": "zendframework/zend-hydrator", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-hydrator.git", - "reference": "f3ed8b833355140350bbed98d8a7b8b66875903f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-hydrator/zipball/f3ed8b833355140350bbed98d8a7b8b66875903f", - "reference": "f3ed8b833355140350bbed98d8a7b8b66875903f", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "zendframework/zend-stdlib": "^2.5.1" - }, - "require-dev": { - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "^2.0@dev", - "zendframework/zend-eventmanager": "^2.5.1", - "zendframework/zend-filter": "^2.5.1", - "zendframework/zend-inputfilter": "^2.5.1", - "zendframework/zend-serializer": "^2.5.1", - "zendframework/zend-servicemanager": "^2.5.1" - }, - "suggest": { - "zendframework/zend-eventmanager": "^2.5.1, to support aggregate hydrator usage", - "zendframework/zend-filter": "^2.5.1, to support naming strategy hydrator usage", - "zendframework/zend-serializer": "^2.5.1, to use the SerializableStrategy", - "zendframework/zend-servicemanager": "^2.5.1, to support hydrator plugin manager usage" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev", - "dev-develop": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\Hydrator\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "homepage": "https://github.com/zendframework/zend-hydrator", - "keywords": [ - "hydrator", - "zf2" - ], - "time": "2015-09-17 14:06:43" - }, { "name": "zendframework/zend-i18n", "version": "2.5.1", @@ -3198,40 +3068,39 @@ }, { "name": "zendframework/zend-json", - "version": "2.6.0", + "version": "2.5.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-json.git", - "reference": "e2945611a98e1fefcaaf69969350a0bfa6a8d574" + "reference": "4a3add6505fd8618728239d8ce35f182dfbdac02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-json/zipball/e2945611a98e1fefcaaf69969350a0bfa6a8d574", - "reference": "e2945611a98e1fefcaaf69969350a0bfa6a8d574", + "url": "https://api.github.com/repos/zendframework/zend-json/zipball/4a3add6505fd8618728239d8ce35f182dfbdac02", + "reference": "4a3add6505fd8618728239d8ce35f182dfbdac02", "shasum": "" }, "require": { - "php": ">=5.5" + "php": ">=5.5", + "zendframework/zend-stdlib": "~2.5" }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", "zendframework/zend-http": "~2.5", "zendframework/zend-server": "~2.5", - "zendframework/zend-stdlib": "~2.5", "zendframework/zendxml": "~1.0" }, "suggest": { "zendframework/zend-http": "Zend\\Http component", "zendframework/zend-server": "Zend\\Server component", - "zendframework/zend-stdlib": "To use the cache for Zend\\Server", "zendframework/zendxml": "To support Zend\\Json\\Json::fromXml() usage" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev", - "dev-develop": "2.7-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3249,24 +3118,24 @@ "json", "zf2" ], - "time": "2015-11-18 13:59:33" + "time": "2015-08-05 14:45:17" }, { "name": "zendframework/zend-math", - "version": "2.5.2", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-math.git", - "reference": "2648ee3cce39aa3876788c837e3b58f198dc8a78" + "reference": "9f02a1ac4d3374d3332c80f9215deec9c71558fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-math/zipball/2648ee3cce39aa3876788c837e3b58f198dc8a78", - "reference": "2648ee3cce39aa3876788c837e3b58f198dc8a78", + "url": "https://api.github.com/repos/zendframework/zend-math/zipball/9f02a1ac4d3374d3332c80f9215deec9c71558fc", + "reference": "9f02a1ac4d3374d3332c80f9215deec9c71558fc", "shasum": "" }, "require": { - "php": ">=5.5" + "php": ">=5.3.23" }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", @@ -3301,7 +3170,7 @@ "math", "zf2" ], - "time": "2015-12-17 15:31:58" + "time": "2015-06-03 15:32:02" }, { "name": "zendframework/zend-serializer", @@ -3408,24 +3277,22 @@ }, { "name": "zendframework/zend-stdlib", - "version": "2.7.4", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-stdlib.git", - "reference": "cae029346a33663b998507f94962eb27de060683" + "reference": "a35758803fc9051ec1aff43989e679b6b451b1b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cae029346a33663b998507f94962eb27de060683", - "reference": "cae029346a33663b998507f94962eb27de060683", + "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/a35758803fc9051ec1aff43989e679b6b451b1b4", + "reference": "a35758803fc9051ec1aff43989e679b6b451b1b4", "shasum": "" }, "require": { - "php": ">=5.5", - "zendframework/zend-hydrator": "~1.0" + "php": ">=5.5" }, "require-dev": { - "athletic/athletic": "~0.1", "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", "zendframework/zend-config": "~2.5", @@ -3444,8 +3311,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev", - "dev-develop": "2.8-dev" + "dev-master": "2.6-dev", + "dev-develop": "2.7-dev" } }, "autoload": { @@ -3462,7 +3329,7 @@ "stdlib", "zf2" ], - "time": "2015-10-15 15:57:32" + "time": "2015-07-21 17:08:05" }, { "name": "zetacomponents/base", diff --git a/libraries/vendor/symfony/yaml/Dumper.php b/libraries/vendor/symfony/yaml/Dumper.php index 05817f5d73063..21351a5c34fc9 100644 --- a/libraries/vendor/symfony/yaml/Dumper.php +++ b/libraries/vendor/symfony/yaml/Dumper.php @@ -28,7 +28,7 @@ class Dumper /** * Sets the indentation. * - * @param int $num The amount of spaces to use for indentation of nested nodes + * @param int $num The amount of spaces to use for indentation of nested nodes. */ public function setIndentation($num) { @@ -58,7 +58,7 @@ public function dump($input, $inline = 0, $indent = 0, $exceptionOnInvalidType = if ($inline <= 0 || !is_array($input) || empty($input)) { $output .= $prefix.Inline::dump($input, $exceptionOnInvalidType, $objectSupport); } else { - $isAHash = Inline::isHash($input); + $isAHash = array_keys($input) !== range(0, count($input) - 1); foreach ($input as $key => $value) { $willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value); diff --git a/libraries/vendor/symfony/yaml/Escaper.php b/libraries/vendor/symfony/yaml/Escaper.php index a74f14dd9c17a..7bac8dde40ead 100644 --- a/libraries/vendor/symfony/yaml/Escaper.php +++ b/libraries/vendor/symfony/yaml/Escaper.php @@ -46,7 +46,7 @@ class Escaper * * @param string $value A PHP value * - * @return bool True if the value would require double quotes + * @return bool True if the value would require double quotes. */ public static function requiresDoubleQuoting($value) { @@ -70,7 +70,7 @@ public static function escapeWithDoubleQuotes($value) * * @param string $value A PHP value * - * @return bool True if the value would require single quotes + * @return bool True if the value would require single quotes. */ public static function requiresSingleQuoting($value) { diff --git a/libraries/vendor/symfony/yaml/Inline.php b/libraries/vendor/symfony/yaml/Inline.php index 717cbfd5ec8f2..bb2db360f7e35 100644 --- a/libraries/vendor/symfony/yaml/Inline.php +++ b/libraries/vendor/symfony/yaml/Inline.php @@ -157,28 +157,6 @@ public static function dump($value, $exceptionOnInvalidType = false, $objectSupp } } - /** - * Check if given array is hash or just normal indexed array. - * - * @internal - * - * @param array $value The PHP array to check - * - * @return bool true if value is hash array, false otherwise - */ - public static function isHash(array $value) - { - $expectedKey = 0; - - foreach ($value as $key => $val) { - if ($key !== $expectedKey++) { - return true; - } - } - - return false; - } - /** * Dumps a PHP array to a YAML string. * @@ -191,7 +169,11 @@ public static function isHash(array $value) private static function dumpArray($value, $exceptionOnInvalidType, $objectSupport) { // array - if ($value && !self::isHash($value)) { + $keys = array_keys($value); + $keysCount = count($keys); + if ((1 === $keysCount && '0' == $keys[0]) + || ($keysCount > 1 && array_reduce($keys, function ($v, $w) { return (int) $v + $w; }, 0) === $keysCount * ($keysCount - 1) / 2) + ) { $output = array(); foreach ($value as $val) { $output[] = self::dump($val, $exceptionOnInvalidType, $objectSupport); @@ -200,7 +182,7 @@ private static function dumpArray($value, $exceptionOnInvalidType, $objectSuppor return sprintf('[%s]', implode(', ', $output)); } - // hash + // mapping $output = array(); foreach ($value as $key => $val) { $output[] = sprintf('%s: %s', self::dump($key, $exceptionOnInvalidType, $objectSupport), self::dump($val, $exceptionOnInvalidType, $objectSupport)); diff --git a/libraries/vendor/symfony/yaml/Parser.php b/libraries/vendor/symfony/yaml/Parser.php index 7cdb964393bc2..41134e6b6c72e 100644 --- a/libraries/vendor/symfony/yaml/Parser.php +++ b/libraries/vendor/symfony/yaml/Parser.php @@ -25,26 +25,19 @@ class Parser const FOLDED_SCALAR_PATTERN = self::BLOCK_SCALAR_HEADER_PATTERN; private $offset = 0; - private $totalNumberOfLines; private $lines = array(); private $currentLineNb = -1; private $currentLine = ''; private $refs = array(); - private $skippedLineNumbers = array(); - private $locallySkippedLineNumbers = array(); /** * Constructor. * - * @param int $offset The offset of YAML document (used for line numbers in error messages) - * @param int|null $totalNumberOfLines The overall number of lines being parsed - * @param int[] $skippedLineNumbers Number of comment lines that have been skipped by the parser + * @param int $offset The offset of YAML document (used for line numbers in error messages) */ - public function __construct($offset = 0, $totalNumberOfLines = null, array $skippedLineNumbers = array()) + public function __construct($offset = 0) { $this->offset = $offset; - $this->totalNumberOfLines = $totalNumberOfLines; - $this->skippedLineNumbers = $skippedLineNumbers; } /** @@ -69,10 +62,6 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $value = $this->cleanup($value); $this->lines = explode("\n", $value); - if (null === $this->totalNumberOfLines) { - $this->totalNumberOfLines = count($this->lines); - } - if (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) { $mbEncoding = mb_internal_encoding(); mb_internal_encoding('UTF-8'); @@ -94,7 +83,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $isRef = $mergeNode = false; if (preg_match('#^\-((?P\s+)(?P.+?))?\s*$#u', $this->currentLine, $values)) { if ($context && 'mapping' == $context) { - throw new ParseException('You cannot define a sequence item when in a mapping', $this->getRealCurrentLineNb() + 1, $this->currentLine); + throw new ParseException('You cannot define a sequence item when in a mapping'); } $context = 'sequence'; @@ -105,18 +94,25 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = // array if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { - $data[] = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport, $objectForMap); + $c = $this->getRealCurrentLineNb() + 1; + $parser = new self($c); + $parser->refs = &$this->refs; + $data[] = $parser->parse($this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport, $objectForMap); } else { if (isset($values['leadspaces']) && preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P.+?))?\s*$#u', $values['value'], $matches) ) { // this is a compact notation element, add to next block and parse + $c = $this->getRealCurrentLineNb(); + $parser = new self($c); + $parser->refs = &$this->refs; + $block = $values['value']; if ($this->isNextLineIndented()) { $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + strlen($values['leadspaces']) + 1); } - $data[] = $this->parseBlock($this->getRealCurrentLineNb(), $block, $exceptionOnInvalidType, $objectSupport, $objectForMap); + $data[] = $parser->parse($block, $exceptionOnInvalidType, $objectSupport, $objectForMap); } else { $data[] = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport, $objectForMap, $context); } @@ -126,7 +122,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = } } elseif (preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P.+?))?\s*$#u', $this->currentLine, $values) && (false === strpos($values['key'], ' #') || in_array($values['key'][0], array('"', "'")))) { if ($context && 'sequence' == $context) { - throw new ParseException('You cannot define a mapping item when in a sequence', $this->currentLineNb + 1, $this->currentLine); + throw new ParseException('You cannot define a mapping item when in a sequence'); } $context = 'mapping'; @@ -172,7 +168,10 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = } else { $value = $this->getNextEmbedBlock(); } - $parsed = $this->parseBlock($this->getRealCurrentLineNb() + 1, $value, $exceptionOnInvalidType, $objectSupport, $objectForMap); + $c = $this->getRealCurrentLineNb() + 1; + $parser = new self($c); + $parser->refs = &$this->refs; + $parsed = $parser->parse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap); if (!is_array($parsed)) { throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine); @@ -220,7 +219,10 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $data[$key] = null; } } else { - $value = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport, $objectForMap); + $c = $this->getRealCurrentLineNb() + 1; + $parser = new self($c); + $parser->refs = &$this->refs; + $value = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport, $objectForMap); // Spec: Keys MUST be unique; first one wins. // But overwriting is allowed when a merge node is used in current block. if ($allowOverwrite || !isset($data[$key])) { @@ -241,7 +243,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = } else { // multiple documents are not supported if ('---' === $this->currentLine) { - throw new ParseException('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine); + throw new ParseException('Multiple documents are not supported.'); } // 1-liner optionally followed by newline(s) @@ -314,24 +316,6 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = return empty($data) ? null : $data; } - private function parseBlock($offset, $yaml, $exceptionOnInvalidType, $objectSupport, $objectForMap) - { - $skippedLineNumbers = $this->skippedLineNumbers; - - foreach ($this->locallySkippedLineNumbers as $lineNumber) { - if ($lineNumber < $offset) { - continue; - } - - $skippedLineNumbers[] = $lineNumber; - } - - $parser = new self($offset, $this->totalNumberOfLines, $skippedLineNumbers); - $parser->refs = &$this->refs; - - return $parser->parse($yaml, $exceptionOnInvalidType, $objectSupport, $objectForMap); - } - /** * Returns the current line number (takes the offset into account). * @@ -339,17 +323,7 @@ private function parseBlock($offset, $yaml, $exceptionOnInvalidType, $objectSupp */ private function getRealCurrentLineNb() { - $realCurrentLineNumber = $this->currentLineNb + $this->offset; - - foreach ($this->skippedLineNumbers as $skippedLineNumber) { - if ($skippedLineNumber > $realCurrentLineNumber) { - break; - } - - ++$realCurrentLineNumber; - } - - return $realCurrentLineNumber; + return $this->currentLineNb + $this->offset; } /** @@ -452,14 +426,6 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false) // we ignore "comment" lines only when we are not inside a scalar block if (empty($blockScalarIndentations) && $this->isCurrentLineComment()) { - // remember ignored comment lines (they are used later in nested - // parser calls to determine real line numbers) - // - // CAUTION: beware to not populate the global property here as it - // will otherwise influence the getRealCurrentLineNb() call here - // for consecutive comment lines and subsequent embedded blocks - $this->locallySkippedLineNumbers[] = $this->getRealCurrentLineNb(); - continue; } @@ -495,18 +461,10 @@ private function moveToNextLine() /** * Moves the parser to the previous line. - * - * @return bool */ private function moveToPreviousLine() { - if ($this->currentLineNb < 1) { - return false; - } - $this->currentLine = $this->lines[--$this->currentLineNb]; - - return true; } /** @@ -532,7 +490,7 @@ private function parseValue($value, $exceptionOnInvalidType, $objectSupport, $ob } if (!array_key_exists($value, $this->refs)) { - throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine); + throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLine); } return $this->refs[$value]; @@ -627,8 +585,6 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0) if ($notEOF) { $blockLines[] = ''; $this->moveToPreviousLine(); - } elseif (!$notEOF && !$this->isCurrentLineLastLineInDocument()) { - $blockLines[] = ''; } // folded style @@ -735,11 +691,6 @@ private function isCurrentLineComment() return '' !== $ltrimmedLine && $ltrimmedLine[0] === '#'; } - private function isCurrentLineLastLineInDocument() - { - return ($this->offset + $this->currentLineNb) >= ($this->totalNumberOfLines - 1); - } - /** * Cleanups a YAML string to be parsed. * @@ -817,7 +768,7 @@ private function isNextLineUnIndentedCollection() */ private function isStringUnIndentedCollectionItem() { - return '-' === rtrim($this->currentLine) || 0 === strpos($this->currentLine, '- '); + return 0 === strpos($this->currentLine, '- '); } /** diff --git a/libraries/vendor/symfony/yaml/Unescaper.php b/libraries/vendor/symfony/yaml/Unescaper.php index 1e02cc9fd8086..bb3301615b4a2 100644 --- a/libraries/vendor/symfony/yaml/Unescaper.php +++ b/libraries/vendor/symfony/yaml/Unescaper.php @@ -39,9 +39,9 @@ class Unescaper /** * Unescapes a single quoted string. * - * @param string $value A single quoted string + * @param string $value A single quoted string. * - * @return string The unescaped string + * @return string The unescaped string. */ public function unescapeSingleQuotedString($value) { @@ -51,9 +51,9 @@ public function unescapeSingleQuotedString($value) /** * Unescapes a double quoted string. * - * @param string $value A double quoted string + * @param string $value A double quoted string. * - * @return string The unescaped string + * @return string The unescaped string. */ public function unescapeDoubleQuotedString($value) { diff --git a/libraries/vendor/symfony/yaml/Yaml.php b/libraries/vendor/symfony/yaml/Yaml.php index d5fbbeeccf7f5..374365492f3a2 100644 --- a/libraries/vendor/symfony/yaml/Yaml.php +++ b/libraries/vendor/symfony/yaml/Yaml.php @@ -80,7 +80,7 @@ public static function parse($input, $exceptionOnInvalidType = false, $objectSup * * @param array $array PHP array * @param int $inline The level where you switch to inline YAML - * @param int $indent The amount of spaces to use for indentation of nested nodes + * @param int $indent The amount of spaces to use for indentation of nested nodes. * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise * @param bool $objectSupport true if object support is enabled, false otherwise * diff --git a/media/com_wrapper/js/iframe-height.js b/media/com_wrapper/js/iframe-height.js index 1a0c88d8351e2..7c0bf35e40919 100644 --- a/media/com_wrapper/js/iframe-height.js +++ b/media/com_wrapper/js/iframe-height.js @@ -1,13 +1,17 @@ function iFrameHeight() { - var h = 0; - if (!document.all) - { - h = document.getElementById('blockrandom').height; - document.getElementById('blockrandom').style.height = parseInt(h) + 60 + 'px'; - } else if (document.all) - { - h = document.frames('blockrandom').document.body.scrollHeight; - document.all.blockrandom.style.height = parseInt(h) + 20 + 'px'; - } + var height = 0; + var iframe = document.getElementById('blockrandom'); + var doc = 'contentDocument' in iframe ? iframe.contentDocument : iframe.contentWindow.document; + + if (!document.all) + { + height = doc.body.scrollHeight; + iframe.style.height = parseInt(height) + 60 + 'px'; + } + else if (document.all) + { + height = doc.body.scrollHeight; + document.all.blockrandom.style.height = parseInt(height) + 20 + 'px'; + } } diff --git a/media/com_wrapper/js/iframe-height.min.js b/media/com_wrapper/js/iframe-height.min.js index 0f033b986561b..4e5489b305995 100644 --- a/media/com_wrapper/js/iframe-height.min.js +++ b/media/com_wrapper/js/iframe-height.min.js @@ -1 +1 @@ -function iFrameHeight(){var e=0;if(!document.all){e=document.getElementById("blockrandom").height;document.getElementById("blockrandom").style.height=parseInt(e)+60+"px"}else if(document.all){e=document.frames("blockrandom").document.body.scrollHeight;document.all.blockrandom.style.height=parseInt(e)+20+"px"}} +function iFrameHeight(){var a=0,b=document.getElementById("blockrandom"),c="contentDocument"in b?b.contentDocument:b.contentWindow.document;document.all?document.all&&(a=c.body.scrollHeight,document.all.blockrandom.style.height=parseInt(a)+20+"px"):(a=c.body.scrollHeight,b.style.height=parseInt(a)+60+"px")} \ No newline at end of file diff --git a/media/editors/codemirror/addon/edit/closebrackets.js b/media/editors/codemirror/addon/edit/closebrackets.js index af7fce2a82222..7c47bcd096e66 100644 --- a/media/editors/codemirror/addon/edit/closebrackets.js +++ b/media/editors/codemirror/addon/edit/closebrackets.js @@ -116,7 +116,9 @@ if (opening && !range.empty()) { curType = "surround"; } else if ((identical || !opening) && next == ch) { - if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch) + if (identical && stringStartsAfter(cm, cur)) + curType = "both"; + else if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch) curType = "skipThree"; else curType = "skip"; @@ -192,4 +194,9 @@ stream.start = stream.pos; } } + + function stringStartsAfter(cm, pos) { + var token = cm.getTokenAt(Pos(pos.line, pos.ch + 1)) + return /\bstring/.test(token.type) && token.start == pos.ch + } }); diff --git a/media/editors/codemirror/addon/edit/closebrackets.min.js b/media/editors/codemirror/addon/edit/closebrackets.min.js index 67d29255c6148..af00768a7c92b 100644 --- a/media/editors/codemirror/addon/edit/closebrackets.min.js +++ b/media/editors/codemirror/addon/edit/closebrackets.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){function b(a,b){return"pairs"==b&&"string"==typeof a?a:"object"==typeof a&&null!=a[b]?a[b]:l[b]}function c(a){return function(b){return h(b,a)}}function d(a){var b=a.state.closeBrackets;if(!b)return null;var c=a.getModeAt(a.getCursor());return c.closeBrackets||b}function e(c){var e=d(c);if(!e||c.getOption("disableInput"))return a.Pass;for(var f=b(e,"pairs"),g=c.listSelections(),h=0;h=0;h--){var k=g[h].head;c.replaceRange("",m(k.line,k.ch-1),m(k.line,k.ch+1),"+delete")}}function f(c){var e=d(c),f=e&&b(e,"explode");if(!f||c.getOption("disableInput"))return a.Pass;for(var g=c.listSelections(),h=0;h0;return{anchor:new m(b.anchor.line,b.anchor.ch+(c?-1:1)),head:new m(b.head.line,b.head.ch+(c?1:-1))}}function h(c,e){var f=d(c);if(!f||c.getOption("disableInput"))return a.Pass;var h=b(f,"pairs"),j=h.indexOf(e);if(j==-1)return a.Pass;for(var l,n=b(f,"triples"),o=h.charAt(j+1)==e,p=c.listSelections(),q=j%2==0,r=0;r1&&n.indexOf(e)>=0&&c.getRange(m(u.line,u.ch-2),u)==e+e&&(u.ch<=2||c.getRange(m(u.line,u.ch-3),m(u.line,u.ch-2))!=e))s="addFour";else if(o){if(a.isWordChar(v)||!k(c,u,e))return a.Pass;s="both"}else{if(!q||c.getLine(u.line).length!=u.ch&&!i(v,h)&&!/\s/.test(v))return a.Pass;s="both"}else s=n.indexOf(e)>=0&&c.getRange(u,m(u.line,u.ch+3))==e+e+e?"skipThree":"skip";if(l){if(l!=s)return a.Pass}else l=s}var w=j%2?h.charAt(j-1):e,x=j%2?e:h.charAt(j+1);c.operation((function(){if("skip"==l)c.execCommand("goCharRight");else if("skipThree"==l)for(var a=0;a<3;a++)c.execCommand("goCharRight");else if("surround"==l){for(var b=c.getSelections(),a=0;a-1&&c%2==1}function j(a,b){var c=a.getRange(m(b.line,b.ch-1),m(b.line,b.ch+1));return 2==c.length?c:null}function k(b,c,d){var e=b.getLine(c.line),f=b.getTokenAt(c);if(/\bstring2?\b/.test(f.type))return!1;var g=new a.StringStream(e.slice(0,c.ch)+d+e.slice(c.ch),4);for(g.pos=g.start=f.start;;){var h=b.getMode().token(g,f.state);if(g.pos>=c.ch+1)return/\bstring2?\b/.test(h);g.start=g.pos}}var l={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},m=a.Pos;a.defineOption("autoCloseBrackets",!1,(function(b,c,d){d&&d!=a.Init&&(b.removeKeyMap(o),b.state.closeBrackets=null),c&&(b.state.closeBrackets=c,b.addKeyMap(o))}));for(var n=l.pairs+"`",o={Backspace:e,Enter:f},p=0;p=0;h--){var k=g[h].head;c.replaceRange("",n(k.line,k.ch-1),n(k.line,k.ch+1),"+delete")}}function f(c){var e=d(c),f=e&&b(e,"explode");if(!f||c.getOption("disableInput"))return a.Pass;for(var g=c.listSelections(),h=0;h0;return{anchor:new n(b.anchor.line,b.anchor.ch+(c?-1:1)),head:new n(b.head.line,b.head.ch+(c?1:-1))}}function h(c,e){var f=d(c);if(!f||c.getOption("disableInput"))return a.Pass;var h=b(f,"pairs"),j=h.indexOf(e);if(j==-1)return a.Pass;for(var m,o=b(f,"triples"),p=h.charAt(j+1)==e,q=c.listSelections(),r=j%2==0,s=0;s1&&o.indexOf(e)>=0&&c.getRange(n(v.line,v.ch-2),v)==e+e&&(v.ch<=2||c.getRange(n(v.line,v.ch-3),n(v.line,v.ch-2))!=e))t="addFour";else if(p){if(a.isWordChar(w)||!k(c,v,e))return a.Pass;t="both"}else{if(!r||c.getLine(v.line).length!=v.ch&&!i(w,h)&&!/\s/.test(w))return a.Pass;t="both"}else t=p&&l(c,v)?"both":o.indexOf(e)>=0&&c.getRange(v,n(v.line,v.ch+3))==e+e+e?"skipThree":"skip";if(m){if(m!=t)return a.Pass}else m=t}var x=j%2?h.charAt(j-1):e,y=j%2?e:h.charAt(j+1);c.operation((function(){if("skip"==m)c.execCommand("goCharRight");else if("skipThree"==m)for(var a=0;a<3;a++)c.execCommand("goCharRight");else if("surround"==m){for(var b=c.getSelections(),a=0;a-1&&c%2==1}function j(a,b){var c=a.getRange(n(b.line,b.ch-1),n(b.line,b.ch+1));return 2==c.length?c:null}function k(b,c,d){var e=b.getLine(c.line),f=b.getTokenAt(c);if(/\bstring2?\b/.test(f.type))return!1;var g=new a.StringStream(e.slice(0,c.ch)+d+e.slice(c.ch),4);for(g.pos=g.start=f.start;;){var h=b.getMode().token(g,f.state);if(g.pos>=c.ch+1)return/\bstring2?\b/.test(h);g.start=g.pos}}function l(a,b){var c=a.getTokenAt(n(b.line,b.ch+1));return/\bstring/.test(c.type)&&c.start==b.ch}var m={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},n=a.Pos;a.defineOption("autoCloseBrackets",!1,(function(b,c,d){d&&d!=a.Init&&(b.removeKeyMap(p),b.state.closeBrackets=null),c&&(b.state.closeBrackets=c,b.addKeyMap(p))}));for(var o=m.pairs+"`",p={Backspace:e,Enter:f},q=0;q[> ]*|[*+-]\s|(\d+)([.)]))(\s*)/, - emptyListRE = /^(\s*)(>[> ]*|[*+-]|(\d+)[.)])(\s*)$/, + var listRE = /^(\s*)(>[> ]*|- \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/, + emptyListRE = /^(\s*)(>[> ]*|- \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/, unorderedListRE = /[*+-]\s/; CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) { @@ -39,7 +39,7 @@ } else { var indent = match[1], after = match[5]; var bullet = unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0 - ? match[2] + ? match[2].replace("x", " ") : (parseInt(match[3], 10) + 1) + match[4]; replacements[i] = "\n" + indent + bullet + after; diff --git a/media/editors/codemirror/addon/edit/continuelist.min.js b/media/editors/codemirror/addon/edit/continuelist.min.js index 04f5f8190b132..fb0f66d51d167 100644 --- a/media/editors/codemirror/addon/edit/continuelist.min.js +++ b/media/editors/codemirror/addon/edit/continuelist.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";var b=/^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\s*)/,c=/^(\s*)(>[> ]*|[*+-]|(\d+)[.)])(\s*)$/,d=/[*+-]\s/;a.commands.newlineAndIndentContinueMarkdownList=function(e){if(e.getOption("disableInput"))return a.Pass;for(var f=e.listSelections(),g=[],h=0;h")>=0?n[2]:parseInt(n[3],10)+1+n[4];g[h]="\n"+o+q+p}}e.replaceSelections(g)}})); \ No newline at end of file +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";var b=/^(\s*)(>[> ]*|- \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,c=/^(\s*)(>[> ]*|- \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,d=/[*+-]\s/;a.commands.newlineAndIndentContinueMarkdownList=function(e){if(e.getOption("disableInput"))return a.Pass;for(var f=e.listSelections(),g=[],h=0;h")>=0?n[2].replace("x"," "):parseInt(n[3],10)+1+n[4];g[h]="\n"+o+q+p}}e.replaceSelections(g)}})); \ No newline at end of file diff --git a/media/editors/codemirror/addon/lint/lint.js b/media/editors/codemirror/addon/lint/lint.js index e3a452766d313..c1f1702f92152 100644 --- a/media/editors/codemirror/addon/lint/lint.js +++ b/media/editors/codemirror/addon/lint/lint.js @@ -226,7 +226,7 @@ var state = cm.state.lint = new LintState(cm, parseOptions(cm, val), hasLintGutter); if (state.options.lintOnChange !== false) cm.on("change", onChange); - if (state.options.tooltips != false) + if (state.options.tooltips != false && state.options.tooltips != "gutter") CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver); startLinting(cm); diff --git a/media/editors/codemirror/addon/lint/lint.min.js b/media/editors/codemirror/addon/lint/lint.min.js index c1715f8cceeae..3ad0b3474d55b 100644 --- a/media/editors/codemirror/addon/lint/lint.min.js +++ b/media/editors/codemirror/addon/lint/lint.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(b,c){function d(b){return e.parentNode?(e.style.top=Math.max(0,b.clientY-e.offsetHeight-5)+"px",void(e.style.left=b.clientX+5+"px")):a.off(document,"mousemove",d)}var e=document.createElement("div");return e.className="CodeMirror-lint-tooltip",e.appendChild(c.cloneNode(!0)),document.body.appendChild(e),a.on(document,"mousemove",d),d(b),null!=e.style.opacity&&(e.style.opacity=1),e}function c(a){a.parentNode&&a.parentNode.removeChild(a)}function d(a){a.parentNode&&(null==a.style.opacity&&c(a),a.style.opacity=0,setTimeout((function(){c(a)}),600))}function e(c,e,f){function g(){a.off(f,"mouseout",g),h&&(d(h),h=null)}var h=b(c,e),i=setInterval((function(){if(h)for(var a=f;;a=a.parentNode){if(a&&11==a.nodeType&&(a=a.host),a==document.body)return;if(!a){g();break}}if(!h)return clearInterval(i)}),400);a.on(f,"mouseout",g)}function f(a,b,c){this.marked=[],this.options=b,this.timeout=null,this.hasGutter=c,this.onMouseOver=function(b){r(a,b)},this.waitingFor=0}function g(a,b){return b instanceof Function?{getAnnotations:b}:(b&&b!==!0||(b={}),b)}function h(a){var b=a.state.lint;b.hasGutter&&a.clearGutter(s);for(var c=0;c1,c.options.tooltips))}}d.onUpdateLinting&&d.onUpdateLinting(b,e,a)}function p(a){var b=a.state.lint;b&&(clearTimeout(b.timeout),b.timeout=setTimeout((function(){n(a)}),b.options.delay||500))}function q(a,b){for(var c=b.target||b.srcElement,d=document.createDocumentFragment(),f=0;f1,c.options.tooltips))}}d.onUpdateLinting&&d.onUpdateLinting(b,e,a)}function p(a){var b=a.state.lint;b&&(clearTimeout(b.timeout),b.timeout=setTimeout((function(){n(a)}),b.options.delay||500))}function q(a,b){for(var c=b.target||b.srcElement,d=document.createDocumentFragment(),f=0;fe)return!1;var f=c.getScrollInfo();if("align"==a.mv.options.connect)q=f.top;else{var h,i,j=.5*f.clientHeight,k=f.top+j,l=c.lineAtHeight(k,"local"),m=z(a.chunks,l,b==DIFF_INSERT),n=g(c,b==DIFF_INSERT?m.edit:m.orig),o=g(d,b==DIFF_INSERT?m.orig:m.edit),p=(k-n.top)/(n.bot-n.top),q=o.top-j+p*(o.bot-o.top);if(q>f.top&&(i=f.top/j)<1)q=q*i+f.top*(1-i);else if((h=f.height-f.clientHeight-f.top)h&&(i=h/j)<1&&(q=q*i+(r.height-r.clientHeight-h)*(1-i))}}return d.scrollTo(f.left,q),d.state.scrollSetAt=e,d.state.scrollSetBy=a,!0}function g(a,b){var c=b.after;return null==c&&(c=a.lastLine()+1),{top:a.heightAtLine(b.before||0,"local"),bot:a.heightAtLine(c,"local")}}function h(a,b,c){a.lockScroll=b,b&&0!=c&&f(a,DIFF_INSERT)&&l(a),a.lockButton.innerHTML=b?"⇛⇚":"⇛  ⇚"}function i(b,c,d){for(var e=0;e20||c.from-f.to>20?(i(a,c.marked,e),k(a,b,d,c.marked,f.from,f.to,e),c.from=f.from,c.to=f.to):(f.fromc.to&&(k(a,b,d,c.marked,c.to,f.to,e),c.to=f.to))}))}function k(a,b,c,d,e,f,g){function h(b,c){for(var h=Math.max(e,b),i=Math.min(f,c),j=h;jr&&(n&&h(m,r),m=s)}else if(p==c){var t=I(i,q,!0),u=K(j,i),v=J(k,t);L(u,v)||d.push(a.markText(u,v,{className:l})),i=t}}m<=i.line&&h(m,i.line+1)}function l(a){if(a.showDifferences){if(a.svg){F(a.svg);var b=a.gap.offsetWidth;G(a.svg,"width",b,"height",a.gap.offsetHeight)}a.copyButtons&&F(a.copyButtons);for(var c=a.edit.getViewport(),d=a.orig.getViewport(),e=a.mv.wrap.getBoundingClientRect().top,f=e-a.edit.getScrollerElement().getBoundingClientRect().top+a.edit.getScrollInfo().top,g=e-a.orig.getScrollerElement().getBoundingClientRect().top+a.orig.getScrollInfo().top,h=0;h=c.from&&i.origFrom<=d.to&&i.origTo>=d.from&&r(a,i,g,f,b)}}}function m(a,b){for(var c=0,d=0,e=0;ea&&f.editFrom<=a)return null;if(f.editFrom>a)break;c=f.editTo,d=f.origTo}return d+(a-c)}function n(a,b){for(var c=[],d=0;de.editTo)break}f>-1&&c.splice(f-1,0,[m(e.editTo,a.chunks),e.editTo,e.origTo])}return c}function o(a,b){if(a.dealigned||b){if(!a.orig.curOp)return a.orig.operation((function(){o(a,b)}));a.dealigned=!1;var d=a.mv.left==a?a.mv.right:a.mv.left;d&&(c(d),d.dealigned=!1);for(var e=n(a,d),f=a.mv.aligners,g=0;g1&&c.push(q(a[f],b[f],h))}}function q(a,b,c){var d=!0;b>a.lastLine()&&(b--,d=!1);var e=document.createElement("div");return e.className="CodeMirror-merge-spacer",e.style.height=c+"px",e.style.minWidth="1px",a.addLineWidget(b,e,{height:c,above:d})}function r(a,b,c,d,e){var f="left"==a.type,g=a.orig.heightAtLine(b.origFrom,"local")-c;if(a.svg){var h=g,i=a.edit.heightAtLine(b.editFrom,"local")-d;if(f){var j=h;h=i,i=j}var k=a.orig.heightAtLine(b.origTo,"local")-c,l=a.edit.heightAtLine(b.editTo,"local")-d;if(f){var j=k;k=l,l=j}var m=" C "+e/2+" "+i+" "+e/2+" "+h+" "+(e+2)+" "+h,n=" C "+e/2+" "+k+" "+e/2+" "+l+" -1 "+l;G(a.svg.appendChild(document.createElementNS(Q,"path")),"d","M -1 "+i+m+" L "+(e+2)+" "+k+n+" z","class",a.classes.connect)}if(a.copyButtons){var o=a.copyButtons.appendChild(E("div","left"==a.type?"⇝":"⇜","CodeMirror-merge-copy")),p=a.mv.options.allowEditingOriginals;if(o.title=p?"Push to left":"Revert chunk",o.chunk=b,o.style.top=g+"px",p){var q=a.orig.heightAtLine(b.editFrom,"local")-d,r=a.copyButtons.appendChild(E("div","right"==a.type?"⇝":"⇜","CodeMirror-merge-copy-reverse"));r.title="Push to right",r.chunk={editFrom:b.origFrom,editTo:b.origTo,origFrom:b.editFrom,origTo:b.editTo},r.style.top=q+"px","right"==a.type?r.style.left="2px":r.style.right="2px"}}}function s(a,b,c,d){if(!a.diffOutOfDate){var e=d.editTo>b.lastLine()?P(d.editFrom-1):P(d.editFrom,0),f=d.origTo>c.lastLine()?P(d.origFrom-1):P(d.origFrom,0);b.replaceRange(c.getRange(f,P(d.origTo,0)),e,P(d.editTo,0))}}function t(b){var c=b.lockButton=E("div",null,"CodeMirror-merge-scrolllock");c.title="Toggle locked scrolling";var d=E("div",[c],"CodeMirror-merge-scrolllock-wrap");a.on(c,"click",(function(){h(b,!b.lockScroll)}));var e=[d];if(b.mv.options.revertButtons!==!1&&(b.copyButtons=E("div",null,"CodeMirror-merge-copybuttons-"+b.type),a.on(b.copyButtons,"click",(function(a){var c=a.target||a.srcElement;if(c.chunk)return"CodeMirror-merge-copy-reverse"==c.className?void s(b,b.orig,b.edit,c.chunk):void s(b,b.edit,b.orig,c.chunk)})),e.unshift(b.copyButtons)),"align"!=b.mv.options.connect){var f=document.createElementNS&&document.createElementNS(Q,"svg");f&&!f.createSVGRect&&(f=null),b.svg=f,f&&e.push(f)}return b.gap=E("div",e,"CodeMirror-merge-gap")}function u(a){return"string"==typeof a?a:a.getValue()}function v(a,b){var c=T.diff_main(a,b);T.diff_cleanupSemantic(c);for(var d=0;dk&&(g&&b.push({origFrom:d,origTo:l,editFrom:c,editTo:k}),c=n,d=o)}else I(i==DIFF_INSERT?e:f,h[1])}return(c<=e.line||d<=f.line)&&b.push({origFrom:d,origTo:f.line+1,editFrom:c,editTo:e.line+1}),b}function x(a,b){if(b==a.length-1)return!0;var c=a[b+1][1];return 1!=c.length&&10==c.charCodeAt(0)&&(b==a.length-2||(c=a[b+2][1],c.length>1&&10==c.charCodeAt(0)))}function y(a,b){if(0==b)return!0;var c=a[b-1][1];return 10==c.charCodeAt(c.length-1)&&(1==b||(c=a[b-2][1],10==c.charCodeAt(c.length-1)))}function z(a,b,c){for(var d,e,f,g,h=0;hb?(e=i.editFrom,g=i.origFrom):k>b&&(e=i.editTo,g=i.origTo)),k<=b?(d=i.editTo,f=i.origTo):j<=b&&(d=i.editFrom,f=i.origFrom)}return{edit:{before:d,after:e},orig:{before:f,after:g}}}function A(b,c,d){function e(){g.clear(),b.removeLineClass(c,"wrap","CodeMirror-merge-collapsed-line")}b.addLineClass(c,"wrap","CodeMirror-merge-collapsed-line");var f=document.createElement("span");f.className="CodeMirror-merge-collapsed-widget",f.title="Identical text collapsed. Click to expand.";var g=b.markText(P(c,0),P(d-1),{inclusiveLeft:!0,inclusiveRight:!0,replacedWith:f,clearOnEnter:!0});return a.on(f,"click",e),{mark:g,clear:e}}function B(a,b){function c(){for(var a=0;a=0&&hb){var k=[{line:i,cm:d}];a.left&&k.push({line:m(i,a.left.chunks),cm:a.left.orig}),a.right&&k.push({line:m(i,a.right.chunks),cm:a.right.orig});var l=B(j,k);a.options.onCollapse&&a.options.onCollapse(a,i,j,l)}}}function E(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f0;--b)a.removeChild(a.firstChild)}function G(a){for(var b=1;b0?a:b}function L(a,b){return a.line==b.line&&a.ch==b.ch}function M(a,b,c){for(var d=a.length-1;d>=0;d--){var e=a[d],f=(c?e.origTo:e.editTo)-1;if(fb)return f}}function O(b,d){var e=null,f=b.state.diffViews,g=b.getCursor().line;if(f)for(var h=0;he:ke)return!1;var f=c.getScrollInfo();if("align"==a.mv.options.connect)q=f.top;else{var h,i,j=.5*f.clientHeight,k=f.top+j,l=c.lineAtHeight(k,"local"),m=B(a.chunks,l,b==DIFF_INSERT),n=g(c,b==DIFF_INSERT?m.edit:m.orig),o=g(d,b==DIFF_INSERT?m.orig:m.edit),p=(k-n.top)/(n.bot-n.top),q=o.top-j+p*(o.bot-o.top);if(q>f.top&&(i=f.top/j)<1)q=q*i+f.top*(1-i);else if((h=f.height-f.clientHeight-f.top)h&&(i=h/j)<1&&(q=q*i+(r.height-r.clientHeight-h)*(1-i))}}return d.scrollTo(f.left,q),d.state.scrollSetAt=e,d.state.scrollSetBy=a,!0}function g(a,b){var c=b.after;return null==c&&(c=a.lastLine()+1),{top:a.heightAtLine(b.before||0,"local"),bot:a.heightAtLine(c,"local")}}function h(a,b,c){a.lockScroll=b,b&&0!=c&&f(a,DIFF_INSERT)&&n(a),a.lockButton.innerHTML=b?"⇛⇚":"⇛  ⇚"}function i(a,b,c){for(var d=c.classLocation,e=0;e20||c.from-f.to>20?(j(a,c.marked,e),m(a,b,d,c.marked,f.from,f.to,e),c.from=f.from,c.to=f.to):(f.fromc.to&&(m(a,b,d,c.marked,c.to,f.to,e),c.to=f.to))}))}function l(a,b,c,d,e,f){for(var g=c.classLocation,h=a.getLineHandle(b),i=0;is&&(o&&h(n,s),n=t)}else if(q==c){var u=K(i,r,!0),v=M(j,i),w=L(k,u);N(v,w)||d.push(a.markText(v,w,{className:m})),i=u}}n<=i.line&&h(n,i.line+1)}function n(a){if(a.showDifferences){if(a.svg){H(a.svg);var b=a.gap.offsetWidth;I(a.svg,"width",b,"height",a.gap.offsetHeight)}a.copyButtons&&H(a.copyButtons);for(var c=a.edit.getViewport(),d=a.orig.getViewport(),e=a.mv.wrap.getBoundingClientRect().top,f=e-a.edit.getScrollerElement().getBoundingClientRect().top+a.edit.getScrollInfo().top,g=e-a.orig.getScrollerElement().getBoundingClientRect().top+a.orig.getScrollInfo().top,h=0;h=c.from&&i.origFrom<=d.to&&i.origTo>=d.from&&t(a,i,g,f,b)}}}function o(a,b){for(var c=0,d=0,e=0;ea&&f.editFrom<=a)return null;if(f.editFrom>a)break;c=f.editTo,d=f.origTo}return d+(a-c)}function p(a,b){for(var c=[],d=0;de.editTo)break}f>-1&&c.splice(f-1,0,[o(e.editTo,a.chunks),e.editTo,e.origTo])}return c}function q(a,b){if(a.dealigned||b){if(!a.orig.curOp)return a.orig.operation((function(){q(a,b)}));a.dealigned=!1;var d=a.mv.left==a?a.mv.right:a.mv.left;d&&(c(d),d.dealigned=!1);for(var e=p(a,d),f=a.mv.aligners,g=0;g1&&c.push(s(a[f],b[f],h))}}function s(a,b,c){var d=!0;b>a.lastLine()&&(b--,d=!1);var e=document.createElement("div");return e.className="CodeMirror-merge-spacer",e.style.height=c+"px",e.style.minWidth="1px",a.addLineWidget(b,e,{height:c,above:d})}function t(a,b,c,d,e){var f="left"==a.type,g=a.orig.heightAtLine(b.origFrom,"local")-c;if(a.svg){var h=g,i=a.edit.heightAtLine(b.editFrom,"local")-d;if(f){var j=h;h=i,i=j}var k=a.orig.heightAtLine(b.origTo,"local")-c,l=a.edit.heightAtLine(b.editTo,"local")-d;if(f){var j=k;k=l,l=j}var m=" C "+e/2+" "+i+" "+e/2+" "+h+" "+(e+2)+" "+h,n=" C "+e/2+" "+k+" "+e/2+" "+l+" -1 "+l;I(a.svg.appendChild(document.createElementNS(S,"path")),"d","M -1 "+i+m+" L "+(e+2)+" "+k+n+" z","class",a.classes.connect)}if(a.copyButtons){var o=a.copyButtons.appendChild(G("div","left"==a.type?"⇝":"⇜","CodeMirror-merge-copy")),p=a.mv.options.allowEditingOriginals;if(o.title=p?"Push to left":"Revert chunk",o.chunk=b,o.style.top=g+"px",p){var q=a.orig.heightAtLine(b.editFrom,"local")-d,r=a.copyButtons.appendChild(G("div","right"==a.type?"⇝":"⇜","CodeMirror-merge-copy-reverse"));r.title="Push to right",r.chunk={editFrom:b.origFrom,editTo:b.origTo,origFrom:b.editFrom,origTo:b.editTo},r.style.top=q+"px","right"==a.type?r.style.left="2px":r.style.right="2px"}}}function u(a,b,c,d){if(!a.diffOutOfDate){var e=d.editTo>b.lastLine()?R(d.editFrom-1):R(d.editFrom,0),f=d.origTo>c.lastLine()?R(d.origFrom-1):R(d.origFrom,0);b.replaceRange(c.getRange(f,R(d.origTo,0)),e,R(d.editTo,0))}}function v(b){var c=b.lockButton=G("div",null,"CodeMirror-merge-scrolllock");c.title="Toggle locked scrolling";var d=G("div",[c],"CodeMirror-merge-scrolllock-wrap");a.on(c,"click",(function(){h(b,!b.lockScroll)}));var e=[d];if(b.mv.options.revertButtons!==!1&&(b.copyButtons=G("div",null,"CodeMirror-merge-copybuttons-"+b.type),a.on(b.copyButtons,"click",(function(a){var c=a.target||a.srcElement;if(c.chunk)return"CodeMirror-merge-copy-reverse"==c.className?void u(b,b.orig,b.edit,c.chunk):void u(b,b.edit,b.orig,c.chunk)})),e.unshift(b.copyButtons)),"align"!=b.mv.options.connect){var f=document.createElementNS&&document.createElementNS(S,"svg");f&&!f.createSVGRect&&(f=null),b.svg=f,f&&e.push(f)}return b.gap=G("div",e,"CodeMirror-merge-gap")}function w(a){return"string"==typeof a?a:a.getValue()}function x(a,b){var c=V.diff_main(a,b);V.diff_cleanupSemantic(c);for(var d=0;dk&&(g&&b.push({origFrom:d,origTo:l,editFrom:c,editTo:k}),c=n,d=o)}else K(i==DIFF_INSERT?e:f,h[1])}return(c<=e.line||d<=f.line)&&b.push({origFrom:d,origTo:f.line+1,editFrom:c,editTo:e.line+1}),b}function z(a,b){if(b==a.length-1)return!0;var c=a[b+1][1];return 1!=c.length&&10==c.charCodeAt(0)&&(b==a.length-2||(c=a[b+2][1],c.length>1&&10==c.charCodeAt(0)))}function A(a,b){if(0==b)return!0;var c=a[b-1][1];return 10==c.charCodeAt(c.length-1)&&(1==b||(c=a[b-2][1],10==c.charCodeAt(c.length-1)))}function B(a,b,c){for(var d,e,f,g,h=0;hb?(e=i.editFrom,g=i.origFrom):k>b&&(e=i.editTo,g=i.origTo)),k<=b?(d=i.editTo,f=i.origTo):j<=b&&(d=i.editFrom,f=i.origFrom)}return{edit:{before:d,after:e},orig:{before:f,after:g}}}function C(b,c,d){function e(){g.clear(),b.removeLineClass(c,"wrap","CodeMirror-merge-collapsed-line")}b.addLineClass(c,"wrap","CodeMirror-merge-collapsed-line");var f=document.createElement("span");f.className="CodeMirror-merge-collapsed-widget",f.title="Identical text collapsed. Click to expand.";var g=b.markText(R(c,0),R(d-1),{inclusiveLeft:!0,inclusiveRight:!0,replacedWith:f,clearOnEnter:!0});return a.on(f,"click",e),{mark:g,clear:e}}function D(a,b){function c(){for(var a=0;a=0&&hb){var k=[{line:i,cm:d}];a.left&&k.push({line:o(i,a.left.chunks),cm:a.left.orig}),a.right&&k.push({line:o(i,a.right.chunks),cm:a.right.orig});var l=D(j,k);a.options.onCollapse&&a.options.onCollapse(a,i,j,l)}}}function G(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f0;--b)a.removeChild(a.firstChild)}function I(a){for(var b=1;b0?a:b}function N(a,b){return a.line==b.line&&a.ch==b.ch}function O(a,b,c){for(var d=a.length-1;d>=0;d--){var e=a[d],f=(c?e.origTo:e.editTo)-1;if(fb)return f}}function Q(b,d){var e=null,f=b.state.diffViews,g=b.getCursor().line;if(f)for(var h=0;he:k0&&c.ch>=e.length)return b.clipPos(m(c.line+1,0));for(var f,g="start",h=c.ch,i=d<0?0:e.length,j=0;h!=i;h+=d,j++){var k=e.charAt(d<0?h-1:h),l="_"!=k&&a.isWordChar(k)?"w":"o";if("w"==l&&k.toUpperCase()==k&&(l="W"),"start"==g)"o"!=l&&(g="in",f=l);else if("in"==g&&f!=l){if("w"==f&&"W"==l&&d<0&&h--,"W"==f&&"w"==l&&d>0){f="w";continue}break}}return m(c.line,h)}function c(a,c){a.extendSelectionsBy((function(d){return a.display.shift||a.doc.extend||d.empty()?b(a.doc,d.head,c):c<0?d.from():d.to()}))}function d(b,c){return b.isReadOnly()?a.Pass:(b.operation((function(){for(var a=b.listSelections().length,d=[],e=-1,f=0;f=0;h--){var i=d[f[h]];if(!(j&&a.cmpPos(i.head,j)>0)){var k=e(b,i.head);j=k.from,b.replaceRange(c(k.word),k.from,k.to)}}}))}function i(b){var c=b.getCursor("from"),d=b.getCursor("to");if(0==a.cmpPos(c,d)){var f=e(b,c);if(!f.word)return;c=f.from,d=f.to}return{from:c,to:d,query:b.getRange(c,d),word:f}}function j(a,b){var c=i(a);if(c){var d=c.query,e=a.getSearchCursor(d,b?c.to:c.from);(b?e.findNext():e.findPrevious())?a.setSelection(e.from(),e.to()):(e=a.getSearchCursor(d,b?m(a.firstLine(),0):a.clipPos(m(a.lastLine()))),(b?e.findNext():e.findPrevious())?a.setSelection(e.from(),e.to()):c.word&&a.setSelection(c.from,c.to))}}var k=a.keyMap.sublime={fallthrough:"default"},l=a.commands,m=a.Pos,n=a.keyMap.default==a.keyMap.macDefault,o=n?"Cmd-":"Ctrl-",p=n?"Ctrl-":"Alt-";l[k[p+"Left"]="goSubwordLeft"]=function(a){c(a,-1)},l[k[p+"Right"]="goSubwordRight"]=function(a){c(a,1)},n&&(k["Cmd-Left"]="goLineStartSmart");var q=n?"Ctrl-Alt-":"Ctrl-";l[k[q+"Up"]="scrollLineUp"]=function(a){var b=a.getScrollInfo();if(!a.somethingSelected()){var c=a.lineAtHeight(b.top+b.clientHeight,"local");a.getCursor().line>=c&&a.execCommand("goLineUp")}a.scrollTo(null,b.top-a.defaultTextHeight())},l[k[q+"Down"]="scrollLineDown"]=function(a){var b=a.getScrollInfo();if(!a.somethingSelected()){var c=a.lineAtHeight(b.top,"local")+1;a.getCursor().line<=c&&a.execCommand("goLineDown")}a.scrollTo(null,b.top+a.defaultTextHeight())},l[k["Shift-"+o+"L"]="splitSelectionByLine"]=function(a){for(var b=a.listSelections(),c=[],d=0;de.line&&g==f.line&&0==f.ch||c.push({anchor:g==e.line?e:m(g,0),head:g==f.line?f:m(g)});a.setSelections(c,0)},k["Shift-Tab"]="indentLess",l[k.Esc="singleSelectionTop"]=function(a){var b=a.listSelections()[0];a.setSelection(b.anchor,b.head,{scroll:!1})},l[k[o+"L"]="selectLine"]=function(a){for(var b=a.listSelections(),c=[],d=0;de?d.push(i,j):d.length&&(d[d.length-1]=j),e=j}b.operation((function(){for(var a=0;ab.lastLine()?b.replaceRange("\n"+g,m(b.lastLine()),null,"+swapLine"):b.replaceRange(g+"\n",m(e,0),null,"+swapLine")}b.setSelections(f),b.scrollIntoView()}))},l[k[s+"Down"]="swapLineDown"]=function(b){if(b.isReadOnly())return a.Pass;for(var c=b.listSelections(),d=[],e=b.lastLine()+1,f=c.length-1;f>=0;f--){var g=c[f],h=g.to().line+1,i=g.from().line;0!=g.to().ch||g.empty()||h--,h=0;a-=2){var c=d[a],e=d[a+1],f=b.getLine(c);c==b.lastLine()?b.replaceRange("",m(c-1),m(c),"+swapLine"):b.replaceRange("",m(c,0),m(c+1,0),"+swapLine"),b.replaceRange(f+"\n",m(e,0),null,"+swapLine")}b.scrollIntoView()}))},l[k[o+"/"]="toggleCommentIndented"]=function(a){a.toggleComment({indent:!0})},l[k[o+"J"]="joinLines"]=function(a){for(var b=a.listSelections(),c=[],d=0;d=0;e--){var f=c[e].head,g=b.getRange({line:f.line,ch:0},f),h=a.countColumn(g,null,b.getOption("tabSize")),i=b.findPosH(f,-1,"char",!1);if(g&&!/\S/.test(g)&&h%d==0){var j=new m(f.line,a.findColumn(g,h-d,d));j.ch!=f.ch&&(i=j)}b.replaceRange("",i,f,"+delete")}}))},l[k[t+o+"K"]="delLineRight"]=function(a){a.operation((function(){for(var b=a.listSelections(),c=b.length-1;c>=0;c--)a.replaceRange("",b[c].anchor,m(b[c].to().line),"+delete");a.scrollIntoView()}))},l[k[t+o+"U"]="upcaseAtCursor"]=function(a){h(a,(function(a){return a.toUpperCase()}))},l[k[t+o+"L"]="downcaseAtCursor"]=function(a){h(a,(function(a){return a.toLowerCase()}))},l[k[t+o+"Space"]="setSublimeMark"]=function(a){a.state.sublimeMark&&a.state.sublimeMark.clear(),a.state.sublimeMark=a.setBookmark(a.getCursor())},l[k[t+o+"A"]="selectToSublimeMark"]=function(a){var b=a.state.sublimeMark&&a.state.sublimeMark.find();b&&a.setSelection(a.getCursor(),b)},l[k[t+o+"W"]="deleteToSublimeMark"]=function(b){var c=b.state.sublimeMark&&b.state.sublimeMark.find();if(c){var d=b.getCursor(),e=c;if(a.cmpPos(d,e)>0){var f=e;e=d,d=f}b.state.sublimeKilled=b.getRange(d,e),b.replaceRange("",d,e)}},l[k[t+o+"X"]="swapWithSublimeMark"]=function(a){var b=a.state.sublimeMark&&a.state.sublimeMark.find();b&&(a.state.sublimeMark.clear(),a.state.sublimeMark=a.setBookmark(a.getCursor()),a.setCursor(b))},l[k[t+o+"Y"]="sublimeYank"]=function(a){null!=a.state.sublimeKilled&&a.replaceSelection(a.state.sublimeKilled,null,"paste")},k[t+o+"G"]="clearBookmarks",l[k[t+o+"C"]="showInCenter"]=function(a){var b=a.cursorCoords(null,"local");a.scrollTo(null,(b.top+b.bottom)/2-a.getScrollInfo().clientHeight/2)};var u=n?"Ctrl-Shift-":"Ctrl-Alt-";l[k[u+"Up"]="selectLinesUpward"]=function(a){a.operation((function(){for(var b=a.listSelections(),c=0;ca.firstLine()&&a.addSelection(m(d.head.line-1,d.head.ch))}}))},l[k[u+"Down"]="selectLinesDownward"]=function(a){a.operation((function(){for(var b=a.listSelections(),c=0;c0&&c.ch>=e.length)return b.clipPos(m(c.line+1,0));for(var f,g="start",h=c.ch,i=d<0?0:e.length,j=0;h!=i;h+=d,j++){var k=e.charAt(d<0?h-1:h),l="_"!=k&&a.isWordChar(k)?"w":"o";if("w"==l&&k.toUpperCase()==k&&(l="W"),"start"==g)"o"!=l&&(g="in",f=l);else if("in"==g&&f!=l){if("w"==f&&"W"==l&&d<0&&h--,"W"==f&&"w"==l&&d>0){f="w";continue}break}}return m(c.line,h)}function c(a,c){a.extendSelectionsBy((function(d){return a.display.shift||a.doc.extend||d.empty()?b(a.doc,d.head,c):c<0?d.from():d.to()}))}function d(b,c){return b.isReadOnly()?a.Pass:(b.operation((function(){for(var a=b.listSelections().length,d=[],e=-1,f=0;f=0;h--){var i=d[f[h]];if(!(j&&a.cmpPos(i.head,j)>0)){var k=e(b,i.head);j=k.from,b.replaceRange(c(k.word),k.from,k.to)}}}))}function i(b){var c=b.getCursor("from"),d=b.getCursor("to");if(0==a.cmpPos(c,d)){var f=e(b,c);if(!f.word)return;c=f.from,d=f.to}return{from:c,to:d,query:b.getRange(c,d),word:f}}function j(a,b){var c=i(a);if(c){var d=c.query,e=a.getSearchCursor(d,b?c.to:c.from);(b?e.findNext():e.findPrevious())?a.setSelection(e.from(),e.to()):(e=a.getSearchCursor(d,b?m(a.firstLine(),0):a.clipPos(m(a.lastLine()))),(b?e.findNext():e.findPrevious())?a.setSelection(e.from(),e.to()):c.word&&a.setSelection(c.from,c.to))}}var k=a.keyMap.sublime={fallthrough:"default"},l=a.commands,m=a.Pos,n=a.keyMap.default==a.keyMap.macDefault,o=n?"Cmd-":"Ctrl-",p=n?"Ctrl-":"Alt-";l[k[p+"Left"]="goSubwordLeft"]=function(a){c(a,-1)},l[k[p+"Right"]="goSubwordRight"]=function(a){c(a,1)},n&&(k["Cmd-Left"]="goLineStartSmart");var q=n?"Ctrl-Alt-":"Ctrl-";l[k[q+"Up"]="scrollLineUp"]=function(a){var b=a.getScrollInfo();if(!a.somethingSelected()){var c=a.lineAtHeight(b.top+b.clientHeight,"local");a.getCursor().line>=c&&a.execCommand("goLineUp")}a.scrollTo(null,b.top-a.defaultTextHeight())},l[k[q+"Down"]="scrollLineDown"]=function(a){var b=a.getScrollInfo();if(!a.somethingSelected()){var c=a.lineAtHeight(b.top,"local")+1;a.getCursor().line<=c&&a.execCommand("goLineDown")}a.scrollTo(null,b.top+a.defaultTextHeight())},l[k["Shift-"+o+"L"]="splitSelectionByLine"]=function(a){for(var b=a.listSelections(),c=[],d=0;de.line&&g==f.line&&0==f.ch||c.push({anchor:g==e.line?e:m(g,0),head:g==f.line?f:m(g)});a.setSelections(c,0)},k["Shift-Tab"]="indentLess",l[k.Esc="singleSelectionTop"]=function(a){var b=a.listSelections()[0];a.setSelection(b.anchor,b.head,{scroll:!1})},l[k[o+"L"]="selectLine"]=function(a){for(var b=a.listSelections(),c=[],d=0;de?d.push(i,j):d.length&&(d[d.length-1]=j),e=j}b.operation((function(){for(var a=0;ab.lastLine()?b.replaceRange("\n"+g,m(b.lastLine()),null,"+swapLine"):b.replaceRange(g+"\n",m(e,0),null,"+swapLine")}b.setSelections(f),b.scrollIntoView()}))},l[k[s+"Down"]="swapLineDown"]=function(b){if(b.isReadOnly())return a.Pass;for(var c=b.listSelections(),d=[],e=b.lastLine()+1,f=c.length-1;f>=0;f--){var g=c[f],h=g.to().line+1,i=g.from().line;0!=g.to().ch||g.empty()||h--,h=0;a-=2){var c=d[a],e=d[a+1],f=b.getLine(c);c==b.lastLine()?b.replaceRange("",m(c-1),m(c),"+swapLine"):b.replaceRange("",m(c,0),m(c+1,0),"+swapLine"),b.replaceRange(f+"\n",m(e,0),null,"+swapLine")}b.scrollIntoView()}))},l[k[o+"/"]="toggleCommentIndented"]=function(a){a.toggleComment({indent:!0})},l[k[o+"J"]="joinLines"]=function(a){for(var b=a.listSelections(),c=[],d=0;d=0;e--){var f=c[e].head,g=b.getRange({line:f.line,ch:0},f),h=a.countColumn(g,null,b.getOption("tabSize")),i=b.findPosH(f,-1,"char",!1);if(g&&!/\S/.test(g)&&h%d==0){var j=new m(f.line,a.findColumn(g,h-d,d));j.ch!=f.ch&&(i=j)}b.replaceRange("",i,f,"+delete")}}))},l[k[t+o+"K"]="delLineRight"]=function(a){a.operation((function(){for(var b=a.listSelections(),c=b.length-1;c>=0;c--)a.replaceRange("",b[c].anchor,m(b[c].to().line),"+delete");a.scrollIntoView()}))},l[k[t+o+"U"]="upcaseAtCursor"]=function(a){h(a,(function(a){return a.toUpperCase()}))},l[k[t+o+"L"]="downcaseAtCursor"]=function(a){h(a,(function(a){return a.toLowerCase()}))},l[k[t+o+"Space"]="setSublimeMark"]=function(a){a.state.sublimeMark&&a.state.sublimeMark.clear(),a.state.sublimeMark=a.setBookmark(a.getCursor())},l[k[t+o+"A"]="selectToSublimeMark"]=function(a){var b=a.state.sublimeMark&&a.state.sublimeMark.find();b&&a.setSelection(a.getCursor(),b)},l[k[t+o+"W"]="deleteToSublimeMark"]=function(b){var c=b.state.sublimeMark&&b.state.sublimeMark.find();if(c){var d=b.getCursor(),e=c;if(a.cmpPos(d,e)>0){var f=e;e=d,d=f}b.state.sublimeKilled=b.getRange(d,e),b.replaceRange("",d,e)}},l[k[t+o+"X"]="swapWithSublimeMark"]=function(a){var b=a.state.sublimeMark&&a.state.sublimeMark.find();b&&(a.state.sublimeMark.clear(),a.state.sublimeMark=a.setBookmark(a.getCursor()),a.setCursor(b))},l[k[t+o+"Y"]="sublimeYank"]=function(a){null!=a.state.sublimeKilled&&a.replaceSelection(a.state.sublimeKilled,null,"paste")},k[t+o+"G"]="clearBookmarks",l[k[t+o+"C"]="showInCenter"]=function(a){var b=a.cursorCoords(null,"local");a.scrollTo(null,(b.top+b.bottom)/2-a.getScrollInfo().clientHeight/2)};var u=n?"Ctrl-Shift-":"Ctrl-Alt-";l[k[u+"Up"]="selectLinesUpward"]=function(a){a.operation((function(){for(var b=a.listSelections(),c=0;ca.firstLine()&&a.addSelection(m(d.head.line-1,d.head.ch))}}))},l[k[u+"Down"]="selectLinesDownward"]=function(a){a.operation((function(){for(var b=a.listSelections(),c=0;c= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch) + if (identical && stringStartsAfter(cm, cur)) + curType = "both"; + else if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch) curType = "skipThree"; else curType = "skip"; @@ -347,6 +349,11 @@ stream.start = stream.pos; } } + + function stringStartsAfter(cm, pos) { + var token = cm.getTokenAt(Pos(pos.line, pos.ch + 1)) + return /\bstring/.test(token.type) && token.start == pos.ch + } }); // CodeMirror, copyright (c) by Marijn Haverbeke and others diff --git a/media/editors/codemirror/lib/addons.min.js b/media/editors/codemirror/lib/addons.min.js index ea15a0a77566c..beaae8d690a1b 100644 --- a/media/editors/codemirror/lib/addons.min.js +++ b/media/editors/codemirror/lib/addons.min.js @@ -1,4 +1,4 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a){var b=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:b.style.width,height:b.style.height},b.style.width="",b.style.height="auto",b.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function c(a){var b=a.getWrapperElement();b.className=b.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var c=a.state.fullScreenRestore;b.style.width=c.width,b.style.height=c.height,window.scrollTo(c.scrollLeft,c.scrollTop),a.refresh()}a.defineOption("fullScreen",!1,(function(d,e,f){f==a.Init&&(f=!1),!f!=!e&&(e?b(d):c(d))}))})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){function b(a,b,c,d){this.cm=a,this.node=b,this.options=c,this.height=d,this.cleared=!1}function c(a){var b=a.getWrapperElement(),c=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,d=parseInt(c.height),e=a.state.panels={setHeight:b.style.height,heightLeft:d,panels:0,wrapper:document.createElement("div")};b.parentNode.insertBefore(e.wrapper,b);var f=a.hasFocus();e.wrapper.appendChild(b),f&&a.focus(),a._setSize=a.setSize,null!=d&&(a.setSize=function(b,c){if(null==c)return this._setSize(b,c);if(e.setHeight=c,"number"!=typeof c){var f=/^(\d+\.?\d*)px$/.exec(c);f?c=Number(f[1]):(e.wrapper.style.height=c,c=e.wrapper.offsetHeight,e.wrapper.style.height="")}a._setSize(b,e.heightLeft+=c-d),d=c})}function d(a){var b=a.state.panels;a.state.panels=null;var c=a.getWrapperElement();b.wrapper.parentNode.replaceChild(c,b.wrapper),c.style.height=b.setHeight,a.setSize=a._setSize,a.setSize()}a.defineExtension("addPanel",(function(a,d){d=d||{},this.state.panels||c(this);var e=this.state.panels,f=e.wrapper,g=this.getWrapperElement();d.after instanceof b&&!d.after.cleared?f.insertBefore(a,d.before.node.nextSibling):d.before instanceof b&&!d.before.cleared?f.insertBefore(a,d.before.node):d.replace instanceof b&&!d.replace.cleared?(f.insertBefore(a,d.replace.node),d.replace.clear()):"bottom"==d.position?f.appendChild(a):"before-bottom"==d.position?f.insertBefore(a,g.nextSibling):"after-top"==d.position?f.insertBefore(a,g):f.insertBefore(a,f.firstChild);var h=d&&d.height||a.offsetHeight;return this._setSize(null,e.heightLeft-=h),e.panels++,new b(this,a,d,h)})),b.prototype.clear=function(){if(!this.cleared){this.cleared=!0;var a=this.cm.state.panels;this.cm._setSize(null,a.heightLeft+=this.height),a.wrapper.removeChild(this.node),0==--a.panels&&d(this.cm)}},b.prototype.changed=function(a){var b=null==a?this.node.offsetHeight:a,c=this.cm.state.panels;this.cm._setSize(null,c.height+=b-this.height),this.height=b}})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){function b(a,b){return"pairs"==b&&"string"==typeof a?a:"object"==typeof a&&null!=a[b]?a[b]:l[b]}function c(a){return function(b){return h(b,a)}}function d(a){var b=a.state.closeBrackets;if(!b)return null;var c=a.getModeAt(a.getCursor());return c.closeBrackets||b}function e(c){var e=d(c);if(!e||c.getOption("disableInput"))return a.Pass;for(var f=b(e,"pairs"),g=c.listSelections(),h=0;h=0;h--){var k=g[h].head;c.replaceRange("",m(k.line,k.ch-1),m(k.line,k.ch+1),"+delete")}}function f(c){var e=d(c),f=e&&b(e,"explode");if(!f||c.getOption("disableInput"))return a.Pass;for(var g=c.listSelections(),h=0;h0;return{anchor:new m(b.anchor.line,b.anchor.ch+(c?-1:1)),head:new m(b.head.line,b.head.ch+(c?1:-1))}}function h(c,e){var f=d(c);if(!f||c.getOption("disableInput"))return a.Pass;var h=b(f,"pairs"),j=h.indexOf(e);if(j==-1)return a.Pass;for(var l,n=b(f,"triples"),o=h.charAt(j+1)==e,p=c.listSelections(),q=j%2==0,r=0;r1&&n.indexOf(e)>=0&&c.getRange(m(u.line,u.ch-2),u)==e+e&&(u.ch<=2||c.getRange(m(u.line,u.ch-3),m(u.line,u.ch-2))!=e))s="addFour";else if(o){if(a.isWordChar(v)||!k(c,u,e))return a.Pass;s="both"}else{if(!q||c.getLine(u.line).length!=u.ch&&!i(v,h)&&!/\s/.test(v))return a.Pass;s="both"}else s=n.indexOf(e)>=0&&c.getRange(u,m(u.line,u.ch+3))==e+e+e?"skipThree":"skip";if(l){if(l!=s)return a.Pass}else l=s}var w=j%2?h.charAt(j-1):e,x=j%2?e:h.charAt(j+1);c.operation((function(){if("skip"==l)c.execCommand("goCharRight");else if("skipThree"==l)for(var a=0;a<3;a++)c.execCommand("goCharRight");else if("surround"==l){for(var b=c.getSelections(),a=0;a-1&&c%2==1}function j(a,b){var c=a.getRange(m(b.line,b.ch-1),m(b.line,b.ch+1));return 2==c.length?c:null}function k(b,c,d){var e=b.getLine(c.line),f=b.getTokenAt(c);if(/\bstring2?\b/.test(f.type))return!1;var g=new a.StringStream(e.slice(0,c.ch)+d+e.slice(c.ch),4);for(g.pos=g.start=f.start;;){var h=b.getMode().token(g,f.state);if(g.pos>=c.ch+1)return/\bstring2?\b/.test(h);g.start=g.pos}}var l={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},m=a.Pos;a.defineOption("autoCloseBrackets",!1,(function(b,c,d){d&&d!=a.Init&&(b.removeKeyMap(o),b.state.closeBrackets=null),c&&(b.state.closeBrackets=c,b.addKeyMap(o))}));for(var n=l.pairs+"`",o={Backspace:e,Enter:f},p=0;pj.ch&&(r=r.slice(0,r.length-k.end+j.ch));var s=r.toLowerCase();if(!r||"string"==k.type&&(k.end!=j.ch||!/[\"\']/.test(k.string.charAt(k.string.length-1))||1==k.string.length)||"tag"==k.type&&"closeTag"==m.type||k.string.indexOf("/")==k.string.length-1||p&&e(p,s)>-1||f(b,r,j,m,!0))return a.Pass;var t=q&&e(q,s)>-1;d[i]={indent:t,text:">"+(t?"\n\n":"")+"",newPos:t?a.Pos(j.line+1,0):a.Pos(j.line,j.ch+1)}}for(var i=c.length-1;i>=0;i--){var u=d[i];b.replaceRange(u.text,c[i].head,c[i].anchor,"+insert");var v=b.listSelections().slice(0);v[i]={head:u.newPos,anchor:u.newPos},b.setSelections(v),u.indent&&(b.indentLine(u.newPos.line,null,!0),b.indentLine(u.newPos.line+1,null,!0))}}function c(b,c){for(var d=b.listSelections(),e=[],g=c?"/":""!=b.getLine(i.line).charAt(j.end)&&(m+=">"),e[h]=m}b.replaceSelections(e),d=b.listSelections();for(var h=0;h'"]=function(a){return b(a)}),c.addKeyMap(g)}}));var g=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],h=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];a.commands.closeTag=function(a){return c(a)}})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){function b(a,b,d,e){var f=a.getLineHandle(b.line),i=b.ch-1,j=i>=0&&h[f.text.charAt(i)]||h[f.text.charAt(++i)];if(!j)return null;var k=">"==j.charAt(1)?1:-1;if(d&&k>0!=(i==b.ch))return null;var l=a.getTokenTypeAt(g(b.line,i+1)),m=c(a,g(b.line,i+(k>0?1:0)),k,l||null,e);return null==m?null:{from:g(b.line,i),to:m&&m.pos,match:m&&m.ch==j.charAt(0),forward:k>0}}function c(a,b,c,d,e){for(var f=e&&e.maxScanLineLength||1e4,i=e&&e.maxScanLines||1e3,j=[],k=e&&e.bracketRegex?e.bracketRegex:/[(){}[\]]/,l=c>0?Math.min(b.line+i,a.lastLine()+1):Math.max(a.firstLine()-1,b.line-i),m=b.line;m!=l;m+=c){var n=a.getLine(m);if(n){var o=c>0?0:n.length-1,p=c>0?n.length:-1;if(!(n.length>f))for(m==b.line&&(o=b.ch-(c<0?1:0));o!=p;o+=c){var q=n.charAt(o);if(k.test(q)&&(void 0===d||a.getTokenTypeAt(g(m,o+1))==d)){var r=h[q];if(">"==r.charAt(1)==c>0)j.push(q);else{if(!j.length)return{pos:g(m,o),ch:q};j.pop()}}}}}return m-c!=(c>0?a.lastLine():a.firstLine())&&null}function d(a,c,d){for(var e=a.state.matchBrackets.maxHighlightLineLength||1e3,h=[],i=a.listSelections(),j=0;j",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},i=null;a.defineOption("matchBrackets",!1,(function(b,c,d){d&&d!=a.Init&&(b.off("cursorActivity",e),i&&(i(),i=null)),c&&(b.state.matchBrackets="object"==typeof c?c:{},b.on("cursorActivity",e))})),a.defineExtension("matchBrackets",(function(){d(this,!0)})),a.defineExtension("findMatchingBracket",(function(a,c,d){return b(this,a,c,d)})),a.defineExtension("scanForBracket",(function(a,b,d,e){return c(this,a,b,d,e)}))})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],a):a(CodeMirror)})((function(a){"use strict";function b(a){a.state.tagHit&&a.state.tagHit.clear(),a.state.tagOther&&a.state.tagOther.clear(),a.state.tagHit=a.state.tagOther=null}function c(c){c.state.failedTagMatch=!1,c.operation((function(){if(b(c),!c.somethingSelected()){var d=c.getCursor(),e=c.getViewport();e.from=Math.min(e.from,d.line),e.to=Math.max(d.line+1,e.to);var f=a.findMatchingTag(c,d,e);if(f){if(c.state.matchBothTags){var g="open"==f.at?f.open:f.close;g&&(c.state.tagHit=c.markText(g.from,g.to,{className:"CodeMirror-matchingtag"}))}var h="close"==f.at?f.open:f.close;h?c.state.tagOther=c.markText(h.from,h.to,{className:"CodeMirror-matchingtag"}):c.state.failedTagMatch=!0}}}))}function d(a){a.state.failedTagMatch&&c(a)}a.defineOption("matchTags",!1,(function(e,f,g){g&&g!=a.Init&&(e.off("cursorActivity",c),e.off("viewportChange",d),b(e)),f&&(e.state.matchBothTags="object"==typeof f&&f.bothTags,e.on("cursorActivity",c),e.on("viewportChange",d),c(e))})),a.commands.toMatchingTag=function(b){var c=a.findMatchingTag(b,b.getCursor());if(c){var d="close"==c.at?c.open:c.close;d&&b.extendSelection(d.to,d.from)}}})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";a.registerHelper("fold","brace",(function(b,c){function d(d){for(var h=c.ch,i=0;;){var j=h<=0?-1:g.lastIndexOf(d,h-1);if(j!=-1){if(1==i&&jb.lastLine())return null;var d=b.getTokenAt(a.Pos(c,1));if(/\S/.test(d.string)||(d=b.getTokenAt(a.Pos(c,d.end+1))),"keyword"!=d.type||"import"!=d.string)return null;for(var e=c,f=Math.min(b.lastLine(),c+10);e<=f;++e){var g=b.getLine(e),h=g.indexOf(";");if(h!=-1)return{startCh:d.end,end:a.Pos(e,h)}}}var e,f=c.line,g=d(f);if(!g||d(f-1)||(e=d(f-2))&&e.end.line==f-1)return null;for(var h=g.end;;){var i=d(h.line+1);if(null==i)break;h=i.end}return{from:b.clipPos(a.Pos(f,g.startCh+1)),to:h}})),a.registerHelper("fold","include",(function(b,c){function d(c){if(cb.lastLine())return null;var d=b.getTokenAt(a.Pos(c,1));return/\S/.test(d.string)||(d=b.getTokenAt(a.Pos(c,d.end+1))),"meta"==d.type&&"#include"==d.string.slice(0,8)?d.start+8:void 0}var e=c.line,f=d(e);if(null==f||null!=d(e-1))return null;for(var g=e;;){var h=d(g+1);if(null==h)break;++g}return{from:a.Pos(e,f+1),to:b.clipPos(a.Pos(g))}}))})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(b,e,f,g){function h(a){var c=i(b,e);if(!c||c.to.line-c.from.lineb.firstLine();)e=a.Pos(e.line-1,0),k=h(!1);if(k&&!k.cleared&&"unfold"!==g){var l=c(b,f);a.on(l,"mousedown",(function(b){m.clear(),a.e_preventDefault(b)}));var m=b.markText(k.from,k.to,{replacedWith:l,clearOnEnter:d(b,f,"clearOnEnter"),__isFold:!0});m.on("clear",(function(c,d){a.signal(b,"unfold",b,c,d)})),a.signal(b,"fold",b,k.from,k.to)}}function c(a,b){var c=d(a,b,"widget");if("string"==typeof c){var e=document.createTextNode(c);c=document.createElement("span"),c.appendChild(e),c.className="CodeMirror-foldmarker"}return c}function d(a,b,c){if(b&&void 0!==b[c])return b[c];var d=a.options.foldOptions;return d&&void 0!==d[c]?d[c]:e[c]}a.newFoldFunction=function(a,c){return function(d,e){b(d,e,{rangeFinder:a,widget:c})}},a.defineExtension("foldCode",(function(a,c,d){b(this,a,c,d)})),a.defineExtension("isFolded",(function(a){for(var b=this.findMarksAt(a),c=0;c=h&&(c=e(f.indicatorOpen))}a.setGutterMarker(b,f.gutter,c),++g}))}function g(a){var b=a.getViewport(),c=a.state.foldGutter;c&&(a.operation((function(){f(a,b.from,b.to)})),c.from=b.from,c.to=b.to)}function h(a,b,c){var e=a.state.foldGutter;if(e){var f=e.options;if(c==f.gutter){var g=d(a,b);g?g.clear():a.foldCode(l(b,0),f.rangeFinder)}}}function i(a){var b=a.state.foldGutter;if(b){var c=b.options;b.from=b.to=0,clearTimeout(b.changeUpdate),b.changeUpdate=setTimeout((function(){g(a)}),c.foldOnChangeTimeSpan||600)}}function j(a){var b=a.state.foldGutter;if(b){var c=b.options;clearTimeout(b.changeUpdate),b.changeUpdate=setTimeout((function(){var c=a.getViewport();b.from==b.to||c.from-b.to>20||b.from-c.to>20?g(a):a.operation((function(){c.fromb.to&&(f(a,b.to,c.to),b.to=c.to)}))}),c.updateViewportTimeSpan||400)}}function k(a,b){var c=a.state.foldGutter;if(c){var d=b.line;d>=c.from&&d=a.max))return a.ch=0,a.text=a.cm.getLine(++a.line),!0}function f(a){if(!(a.line<=a.min))return a.text=a.cm.getLine(--a.line),a.ch=a.text.length,!0}function g(a){for(;;){var b=a.text.indexOf(">",a.ch);if(b==-1){if(e(a))continue;return}{if(d(a,b+1)){var c=a.text.lastIndexOf("/",b),f=c>-1&&!/\S/.test(a.text.slice(c+1,b));return a.ch=b+1,f?"selfClose":"regular"}a.ch=b+1}}}function h(a){for(;;){var b=a.ch?a.text.lastIndexOf("<",a.ch-1):-1;if(b==-1){if(f(a))continue;return}if(d(a,b+1)){p.lastIndex=b,a.ch=b;var c=p.exec(a.text);if(c&&c.index==b)return c}else a.ch=b}}function i(a){for(;;){p.lastIndex=a.ch;var b=p.exec(a.text);if(!b){if(e(a))continue;return}{if(d(a,b.index+1))return a.ch=b.index+b[0].length,b;a.ch=b.index+1}}}function j(a){for(;;){var b=a.ch?a.text.lastIndexOf(">",a.ch-1):-1;if(b==-1){if(f(a))continue;return}{if(d(a,b+1)){var c=a.text.lastIndexOf("/",b),e=c>-1&&!/\S/.test(a.text.slice(c+1,b));return a.ch=b+1,e?"selfClose":"regular"}a.ch=b}}}function k(a,b){for(var c=[];;){var d,e=i(a),f=a.line,h=a.ch-(e?e[0].length:0);if(!e||!(d=g(a)))return;if("selfClose"!=d)if(e[1]){for(var j=c.length-1;j>=0;--j)if(c[j]==e[2]){c.length=j;break}if(j<0&&(!b||b==e[2]))return{tag:e[2],from:m(f,h),to:m(a.line,a.ch)}}else c.push(e[2])}}function l(a,b){for(var c=[];;){var d=j(a);if(!d)return;if("selfClose"!=d){var e=a.line,f=a.ch,g=h(a);if(!g)return;if(g[1])c.push(g[2]);else{for(var i=c.length-1;i>=0;--i)if(c[i]==g[2]){c.length=i;break}if(i<0&&(!b||b==g[2]))return{tag:g[2],from:m(a.line,a.ch),to:m(e,f)}}}else h(a)}}var m=a.Pos,n="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",o=n+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",p=new RegExp("<(/?)(["+n+"]["+o+"]*)","g");a.registerHelper("fold","xml",(function(a,b){for(var d=new c(a,b.line,0);;){var e,f=i(d);if(!f||d.line!=b.line||!(e=g(d)))return;if(!f[1]&&"selfClose"!=e){var h=m(d.line,d.ch),j=k(d,f[2]);return j&&{from:h,to:j.from}}}})),a.findMatchingTag=function(a,d,e){var f=new c(a,d.line,d.ch,e);if(f.text.indexOf(">")!=-1||f.text.indexOf("<")!=-1){var i=g(f),j=i&&m(f.line,f.ch),n=i&&h(f);if(i&&n&&!(b(f,d)>0)){var o={from:m(f.line,f.ch),to:j,tag:n[2]};return"selfClose"==i?{open:o,close:null,at:"open"}:n[1]?{open:l(f,n[2]),close:o,at:"close"}:(f=new c(a,j.line,j.ch,e),{open:o,close:k(f,n[2]),at:"open"})}}},a.findEnclosingTag=function(a,b,d){for(var e=new c(a,b.line,b.ch,d);;){var f=l(e);if(!f)break;var g=new c(a,b.line,b.ch,d),h=k(g,f.tag);if(h)return{open:f,close:h}}},a.scanForClosingTag=function(a,b,d,e){var f=new c(a,b.line,b.ch,e?{from:0,to:e}:null);return k(f,d)}})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),"cjs"):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],(function(b){a(b,"amd")})):a(CodeMirror,"plain")})((function(a,b){function c(a,b){var c=b;return function(){0==--c&&a()}}function d(b,d){var e=a.modes[b].dependencies;if(!e)return d();for(var f=[],g=0;g-1?e+b.length:e}var f=b.exec(c?a.slice(c):a);return f?f.index+c+(d?f[0].length:0):-1}var d=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:a.startState(b),innerActive:null,inner:null}},copyState:function(c){return{outer:a.copyState(b,c.outer),innerActive:c.innerActive,inner:c.innerActive&&a.copyState(c.innerActive.mode,c.inner)}},token:function(e,f){if(f.innerActive){var g=f.innerActive,h=e.string;if(!g.close&&e.sol())return f.innerActive=f.inner=null,this.token(e,f);var i=g.close?c(h,g.close,e.pos,g.parseDelimiters):-1;if(i==e.pos&&!g.parseDelimiters)return e.match(g.close),f.innerActive=f.inner=null,g.delimStyle&&g.delimStyle+" "+g.delimStyle+"-close";i>-1&&(e.string=h.slice(0,i));var j=g.mode.token(e,f.inner);return i>-1&&(e.string=h),i==e.pos&&g.parseDelimiters&&(f.innerActive=f.inner=null),g.innerStyle&&(j=j?j+" "+g.innerStyle:g.innerStyle),j}for(var k=1/0,h=e.string,l=0;lh)return c.charCoords(a,"local")[b?"top":"bottom"];var d=c.heightAtLine(j,"local");return d+(b?0:j.height)}a!==!1&&this.computeScale();var c=this.cm,d=this.hScale,e=document.createDocumentFragment(),f=this.annotations,g=c.getOption("lineWrapping"),h=g&&1.5*c.defaultTextHeight(),i=null,j=null;if(c.display.barWidth)for(var k,l=0;lo+.9));)m=f[++l],o=b(m.to,!1)*d;if(o!=n){var p=Math.max(o-n,3),q=e.appendChild(document.createElement("div"));q.style.cssText="position: absolute; right: 0px; width: "+Math.max(c.display.barWidth-1,2)+"px; top: "+(n+this.buttonHeight)+"px; height: "+p+"px",q.className=this.options.className,m.id&&q.setAttribute("annotation-id",m.id)}}this.div.textContent="",this.div.appendChild(e)},b.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(b,c,d){function e(b){var c=a.wheelEventPixels(b)["horizontal"==f.orientation?"x":"y"],d=f.pos;f.moveTo(f.pos+c),f.pos!=d&&a.e_preventDefault(b)}this.orientation=c,this.scroll=d,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=b+"-"+c,this.inner=this.node.appendChild(document.createElement("div"));var f=this;a.on(this.inner,"mousedown",(function(b){function c(){a.off(document,"mousemove",d),a.off(document,"mouseup",c)}function d(a){return 1!=a.which?c():void f.moveTo(h+(a[e]-g)*(f.total/f.size))}if(1==b.which){a.e_preventDefault(b);var e="horizontal"==f.orientation?"pageX":"pageY",g=b[e],h=f.pos;a.on(document,"mousemove",d),a.on(document,"mouseup",c)}})),a.on(this.node,"click",(function(b){a.e_preventDefault(b);var c,d=f.inner.getBoundingClientRect();c="horizontal"==f.orientation?b.clientXd.right?1:0:b.clientYd.bottom?1:0,f.moveTo(f.pos+c*f.screen)})),a.on(this.node,"mousewheel",e),a.on(this.node,"DOMMouseScroll",e)}function c(a,c,d){this.addClass=a,this.horiz=new b(a,"horizontal",d),c(this.horiz.node),this.vert=new b(a,"vertical",d),c(this.vert.node),this.width=null}b.prototype.setPos=function(a,b){return a<0&&(a=0),a>this.total-this.screen&&(a=this.total-this.screen),!(!b&&a==this.pos)&&(this.pos=a,this.inner.style["horizontal"==this.orientation?"left":"top"]=a*(this.size/this.total)+"px",!0)},b.prototype.moveTo=function(a){this.setPos(a)&&this.scroll(a,this.orientation)};var d=10;b.prototype.update=function(a,b,c){var e=this.screen!=b||this.total!=a||this.size!=c;e&&(this.screen=b,this.total=a,this.size=c);var f=this.screen*(this.size/this.total);fa.clientWidth+1,e=a.scrollHeight>a.clientHeight+1;return this.vert.node.style.display=e?"block":"none",this.horiz.node.style.display=d?"block":"none",e&&(this.vert.update(a.scrollHeight,a.clientHeight,a.viewHeight-(d?c:0)),this.vert.node.style.bottom=d?c+"px":"0"), -d&&(this.horiz.update(a.scrollWidth,a.clientWidth,a.viewWidth-(e?c:0)-a.barLeft),this.horiz.node.style.right=e?c+"px":"0",this.horiz.node.style.left=a.barLeft+"px"),{right:e?c:0,bottom:d?c:0}},c.prototype.setScrollTop=function(a){this.vert.setPos(a)},c.prototype.setScrollLeft=function(a){this.horiz.setPos(a)},c.prototype.clear=function(){var a=this.horiz.node.parentNode;a.removeChild(this.horiz.node),a.removeChild(this.vert.node)},a.scrollbarModel.simple=function(a,b){return new c("CodeMirror-simplescroll",a,b)},a.scrollbarModel.overlay=function(a,b){return new c("CodeMirror-overlayscroll",a,b)}})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],a):a(CodeMirror)})((function(a){"use strict";function b(a,b,c,d){this.cm=a,this.options=d;var e={listenForChanges:!1};for(var f in d)e[f]=d[f];e.className||(e.className="CodeMirror-search-match"),this.annotation=a.annotateScrollbar(e),this.query=b,this.caseFold=c,this.gap={from:a.firstLine(),to:a.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var g=this;a.on("change",this.changeHandler=function(a,b){g.onChange(b)})}function c(a,b,c){return a<=b?a:Math.max(b,a+c)}a.defineExtension("showMatchesOnScrollbar",(function(a,c,d){return"string"==typeof d&&(d={className:d}),d||(d={}),new b(this,a,c,d)}));var d=1e3;b.prototype.findMatches=function(){if(this.gap){for(var b=0;b=this.gap.to)break;c.to.line>=this.gap.from&&this.matches.splice(b--,1)}for(var e=this.cm.getSearchCursor(this.query,a.Pos(this.gap.from,0),this.caseFold),f=this.options&&this.options.maxMatches||d;e.findNext();){var c={from:e.from(),to:e.to()};if(c.from.line>=this.gap.to)break;if(this.matches.splice(b++,0,c),this.matches.length>f)break}this.gap=null}},b.prototype.onChange=function(b){var d=b.from.line,e=a.changeEnd(b).line,f=e-b.to.line;if(this.gap?(this.gap.from=Math.min(c(this.gap.from,d,f),b.from.line),this.gap.to=Math.max(c(this.gap.to,d,f),b.from.line)):this.gap={from:b.from.line,to:e+1},f)for(var g=0;g=b.options.minChars&&f(a,m,!1,b.options.style)}}))}function i(a,b,c){var d=a.getRange(b,c);if(null!==d.match(/^\w+$/)){if(b.ch>0){var e={line:b.line,ch:b.ch-1},f=a.getRange(e,b);if(null===f.match(/\W/))return!1}if(c.ch-1)return k=c(i,j,k),{from:d(f.line,k),to:d(f.line,k+g.length)}}else{var i=a.getLine(f.line).slice(f.ch),j=h(i),k=j.indexOf(b);if(k>-1)return k=c(i,j,k)+f.ch,{from:d(f.line,k),to:d(f.line,k+g.length)}}}:this.matches=function(){};else{var j=g.split("\n");this.matches=function(b,c){var e=i.length-1;if(b){if(c.line-(i.length-1)=1;--k,--g)if(i[k]!=h(a.getLine(g)))return;var l=a.getLine(g),m=l.length-j[0].length;if(h(l.slice(m))!=i[0])return;return{from:d(g,m),to:f}}if(!(c.line+(i.length-1)>a.lastLine())){var l=a.getLine(c.line),m=l.length-j[0].length;if(h(l.slice(m))==i[0]){for(var n=d(c.line,m),g=c.line+1,k=1;kc))return d;--d}}}var d=a.Pos;b.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(a){function b(a){var b=d(a,0);return c.pos={from:b,to:b},c.atOccurrence=!1,!1}for(var c=this,e=this.doc.clipPos(a?this.pos.from:this.pos.to);;){if(this.pos=this.matches(a,e))return this.atOccurrence=!0,this.pos.match||!0;if(a){if(!e.line)return b(0);e=d(e.line-1,this.doc.getLine(e.line-1).length)}else{var f=this.doc.lineCount();if(e.line==f-1)return b(f);e=d(e.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(b,c){if(this.atOccurrence){var e=a.splitLines(b);this.doc.replaceRange(e,this.pos.from,this.pos.to,c),this.pos.to=d(this.pos.from.line+e.length-1,e[e.length-1].length+(1==e.length?this.pos.from.ch:0))}}},a.defineExtension("getSearchCursor",(function(a,c,d){return new b(this.doc,a,c,d)})),a.defineDocExtension("getSearchCursor",(function(a,c,d){return new b(this,a,c,d)})),a.defineExtension("selectMatches",(function(b,c){for(var d=[],e=this.getSearchCursor(b,this.getCursor("from"),c);e.findNext()&&!(a.cmpPos(e.to(),this.getCursor("to"))>0);)d.push({anchor:e.from(),head:e.to()});d.length&&this.setSelections(d,0)}))})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a){for(var b=0;b",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{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"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0}},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],c=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],d=a.Pos,e=function(){function e(b){b.setOption("disableInput",!0),b.setOption("showCursorWhenSelecting",!1),a.signal(b,"vim-mode-change",{mode:"normal"}),b.on("cursorActivity",ab),x(b),a.on(b.getInputField(),"paste",k(b))}function f(b){b.setOption("disableInput",!1),b.off("cursorActivity",ab),a.off(b.getInputField(),"paste",k(b)),b.state.vim=null}function g(b,c){this==a.keyMap.vim&&a.rmClass(b.getWrapperElement(),"cm-fat-cursor"),c&&c.attach==h||f(b,!1)}function h(b,c){this==a.keyMap.vim&&a.addClass(b.getWrapperElement(),"cm-fat-cursor"),c&&c.attach==h||e(b)}function i(b,c){if(c){if(this[b])return this[b];var d=j(b);if(!d)return!1;var e=a.Vim.findKey(c,d);return"function"==typeof e&&a.signal(c,"vim-keypress",d),e}}function j(a){if("'"==a.charAt(0))return a.charAt(1);var b=a.split(/-(?!$)/),c=b[b.length-1];if(1==b.length&&1==b[0].length)return!1;if(2==b.length&&"Shift"==b[0]&&1==c.length)return!1;for(var d=!1,e=0;e")}function k(a){var b=a.state.vim;return b.onPasteFn||(b.onPasteFn=function(){b.insertMode||(a.setCursor(L(a.getCursor(),0,1)),Ab.enterInsertMode(a,{},b))}),b.onPasteFn}function l(a,b){for(var c=[],d=a;d=a.firstLine()&&b<=a.lastLine()}function n(a){return/^[a-z]$/.test(a)}function o(a){return"()[]{}".indexOf(a)!=-1}function p(a){return jb.test(a)}function q(a){return/^[A-Z]$/.test(a)}function r(a){return/^\s*$/.test(a)}function s(a,b){for(var c=0;c"==b.slice(-11)){var c=b.length-11,d=a.slice(0,c),e=b.slice(0,c);return d==e&&a.length>c?"full":0==e.indexOf(d)&&"partial"}return a==b?"full":0==b.indexOf(a)&&"partial"}function P(a){var b=/^.*(<[\w\-]+>)$/.exec(a),c=b?b[1]:a.slice(-1);if(c.length>1)switch(c){case"":c="\n";break;case"":c=" "}return c}function Q(a,b,c){return function(){for(var d=0;d2&&(b=U.apply(void 0,Array.prototype.slice.call(arguments,1))),T(a,b)?a:b}function V(a,b){return arguments.length>2&&(b=V.apply(void 0,Array.prototype.slice.call(arguments,1))),T(a,b)?b:a}function W(a,b,c){var d=T(a,b),e=T(b,c);return d&&e}function X(a,b){return a.getLine(b).length}function Y(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function Z(a){return a.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function $(a,b,c){var e=X(a,b),f=new Array(c-e+1).join(" ");a.setCursor(d(b,e)),a.replaceRange(f,a.getCursor())}function _(a,b){var c=[],e=a.listSelections(),f=R(a.clipPos(b)),g=!S(b,f),h=a.getCursor("head"),i=ba(e,h),j=S(e[i].head,e[i].anchor),k=e.length-1,l=k-i>i?k:0,m=e[l].anchor,n=Math.min(m.line,f.line),o=Math.max(m.line,f.line),p=m.ch,q=f.ch,r=e[l].head.ch-p,s=q-p;r>0&&s<=0?(p++,g||q--):r<0&&s>=0?(p--,j||q++):r<0&&s==-1&&(p--,q++);for(var t=n;t<=o;t++){var u={anchor:new d(t,p),head:new d(t,q)};c.push(u)}return i=f.line==o?c.length-1:0,a.setSelections(c),b.ch=q,m.ch=p,m}function aa(a,b,c){for(var d=[],e=0;ej&&(f.line=j),f.ch=X(a,f.line)}return{ranges:[{anchor:g,head:f}],primary:0}}if("block"==c){for(var k=Math.min(g.line,f.line),l=Math.min(g.ch,f.ch),m=Math.max(g.line,f.line),n=Math.max(g.ch,f.ch)+1,o=m-k+1,p=f.line==k?0:o-1,q=[],r=0;r0&&f&&r(f);f=e.pop())c.line--,c.ch=0;f?(c.line--,c.ch=X(a,c.line)):c.ch=0}}function ka(a,b,c){b.ch=0,c.ch=0,c.line++}function la(a){if(!a)return 0;var b=a.search(/\S/);return b==-1?a.length:b}function ma(a,b,c,e,f){for(var g=ha(a),h=a.getLine(g.line),i=g.ch,j=f?kb[0]:lb[0];!j(h.charAt(i));)if(i++,i>=h.length)return null;e?j=lb[0]:(j=kb[0],j(h.charAt(i))||(j=kb[1]));for(var k=i,l=i;j(h.charAt(k))&&k=0;)l--;if(l++,b){for(var m=k;/\s/.test(h.charAt(k))&&k0;)l--;l||(l=n)}}return{start:d(g.line,l),end:d(g.line,k)}}function na(a,b,c){S(b,c)||ub.jumpList.add(a,b,c)}function oa(a,b){ub.lastCharacterSearch.increment=a,ub.lastCharacterSearch.forward=b.forward,ub.lastCharacterSearch.selectedCharacter=b.selectedCharacter}function pa(a,b,c,e){var f=R(a.getCursor()),g=c?1:-1,h=c?a.lineCount():-1,i=f.ch,j=f.line,k=a.getLine(j),l={lineText:k,nextCh:k.charAt(i),lastCh:null,index:i,symb:e,reverseSymb:(c?{")":"(","}":"{"}:{"(":")","{":"}"})[e],forward:c,depth:0,curMoveThrough:!1},m=Bb[e];if(!m)return f;var n=Cb[m].init,o=Cb[m].isComplete;for(n&&n(l);j!==h&&b;){if(l.index+=g,l.nextCh=l.lineText.charAt(l.index),!l.nextCh){if(j+=g,l.lineText=a.getLine(j)||"",g>0)l.index=0;else{var p=l.lineText.length;l.index=p>0?p-1:0}l.nextCh=l.lineText.charAt(l.index)}o(l)&&(f.line=j,f.ch=l.index,b--)}return l.nextCh||l.curMoveThrough?d(j,l.index):f}function qa(a,b,c,d,e){var f=b.line,g=b.ch,h=a.getLine(f),i=c?1:-1,j=d?lb:kb;if(e&&""==h){if(f+=i,h=a.getLine(f),!m(a,f))return null;g=c?0:h.length}for(;;){if(e&&""==h)return{from:0,to:0,line:f};for(var k=i>0?h.length:-1,l=k,n=k;g!=k;){for(var o=!1,p=0;p0?0:h.length}}function ra(a,b,c,e,f,g){var h=R(b),i=[];(e&&!f||!e&&f)&&c++;for(var j=!(e&&f),k=0;k0;)h(n,e)&&c--,n+=e;return new d(n,0)}var o=a.state.vim;if(o.visualLine&&h(k,1,!0)){var p=o.sel.anchor;h(p.line,-1,!0)&&(f&&p.line==k||(k+=1))}var q=g(k);for(n=k;n<=m&&c;n++)h(n,1,!0)&&(f&&g(n)==q||c--);for(j=new d(n,0),n>m&&!q?q=!0:f=!1,n=k;n>l&&(f&&g(n)!=q&&n!=k||!h(n,-1,!0));n--);return i=new d(n,0),{start:i,end:j}}function xa(a,b,c,e){var f,g,h=b,i={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[c],j={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[c],k=a.getLine(h.line).charAt(h.ch),l=k===j?1:0;if(f=a.scanForBracket(d(h.line,h.ch+l),-1,null,{bracketRegex:i}),g=a.scanForBracket(d(h.line,h.ch+l),1,null,{bracketRegex:i}),!f||!g)return{start:h,end:h};if(f=f.pos,g=g.pos,f.line==g.line&&f.ch>g.ch||f.line>g.line){var m=f;f=g,g=m}return e?g.ch+=1:f.ch+=1,{start:f,end:g}}function ya(a,b,c,e){var f,g,h,i,j=R(b),k=a.getLine(j.line),l=k.split(""),m=l.indexOf(c);if(j.ch-1&&!f;h--)l[h]==c&&(f=h+1);else f=j.ch+1;if(f&&!g)for(h=f,i=l.length;h'+b+"",{bottom:!0,duration:5e3}):alert(b)}function Ja(a,b){var c=''+(a||"")+'';return b&&(c+=' '+b+""),c}function Ka(a,b){var c=(b.prefix||"")+" "+(b.desc||""),d=Ja(b.prefix,b.desc);Ba(a,d,c,b.onClose,b)}function La(a,b){if(a instanceof RegExp&&b instanceof RegExp){for(var c=["global","multiline","ignoreCase","source"],d=0;d=b&&a<=c:a==b}function Sa(a){var b=a.getScrollInfo(),c=6,d=10,e=a.coordsChar({left:0,top:c+b.top},"local"),f=b.clientHeight-d+b.top,g=a.coordsChar({left:0,top:f},"local");return{top:e.line,bottom:g.line}}function Ta(b,c,d,e,f,g,h,i,j){function k(){b.operation((function(){for(;!p;)l(),m();n()}))}function l(){var a=b.getRange(g.from(),g.to()),c=a.replace(h,i);g.replace(c)}function m(){for(;g.findNext()&&Ra(g.from(),e,f);)if(d||!q||g.from().line!=q.line)return b.scrollIntoView(g.from(),30),b.setSelection(g.from(),g.to()),q=g.from(),void(p=!1);p=!0}function n(a){if(a&&a(),b.focus(),q){b.setCursor(q);var c=b.state.vim;c.exMode=!1,c.lastHPos=c.lastHSPos=q.ch}j&&j()}function o(c,d,e){a.e_stop(c);var f=a.keyName(c);switch(f){case"Y":l(),m();break;case"N":m();break;case"A":var g=j;j=void 0,b.operation(k),j=g;break;case"L":l();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":n(e)}return p&&n(e),!0}b.state.vim.exMode=!0;var p=!1,q=g.from();return m(),p?void Ia(b,"No matches for "+h.source):c?void Ka(b,{prefix:"replace with "+i+" (y/n/a/q/l)",onKeyDown:o}):(k(),void(j&&j()))}function Ua(b){var c=b.state.vim,d=ub.macroModeState,e=ub.registerController.getRegister("."),f=d.isPlaying,g=d.lastInsertModeChanges,h=[];if(!f){for(var i=g.inVisualBlock?c.lastSelection.visualBlock.height:1,j=g.changes,h=[],k=0;k1&&(fb(b,c,c.insertModeRepeat-1,!0),c.lastEditInputState.repeatOverride=c.insertModeRepeat),delete c.insertModeRepeat,c.insertMode=!1,b.setCursor(b.getCursor().line,b.getCursor().ch-1),b.setOption("keyMap","vim"),b.setOption("disableInput",!0),b.toggleOverwrite(!1),e.setText(g.changes.join("")),a.signal(b,"vim-mode-change",{mode:"normal"}),d.isRecording&&Za(d)}function Va(a){b.unshift(a)}function Wa(a,b,c,d,e){var f={keys:a,type:b};f[b]=c,f[b+"Args"]=d;for(var g in e)f[g]=e[g];Va(f)}function Xa(b,c,d,e){var f=ub.registerController.getRegister(e);if(":"==e)return f.keyBuffer[0]&&Ib.processCommand(b,f.keyBuffer[0]),void(d.isPlaying=!1);var g=f.keyBuffer,h=0;d.isPlaying=!0,d.replaySearchQueries=f.searchQueries.slice(0);for(var i=0;i|<\w+>|./.exec(l),k=j[0],l=l.substring(j.index+k.length),a.Vim.handleKey(b,k,"macro"),c.insertMode){var m=f.insertModeChanges[h++].changes;ub.macroModeState.lastInsertModeChanges.changes=m,gb(b,m,1),Ua(b)}d.isPlaying=!1}function Ya(a,b){if(!a.isPlaying){var c=a.latestRegister,d=ub.registerController.getRegister(c);d&&d.pushText(b)}}function Za(a){if(!a.isPlaying){var b=a.latestRegister,c=ub.registerController.getRegister(b);c&&c.pushInsertModeChanges&&c.pushInsertModeChanges(a.lastInsertModeChanges)}}function $a(a,b){if(!a.isPlaying){var c=a.latestRegister,d=ub.registerController.getRegister(c);d&&d.pushSearchQuery&&d.pushSearchQuery(b)}}function _a(a,b){var c=ub.macroModeState,d=c.lastInsertModeChanges;if(!c.isPlaying)for(;b;){if(d.expectCursorActivityForChange=!0,"+input"==b.origin||"paste"==b.origin||void 0===b.origin){var e=b.text.join("\n");d.maybeReset&&(d.changes=[],d.maybeReset=!1),d.changes.push(e)}b=b.next}}function ab(a){var b=a.state.vim;if(b.insertMode){var c=ub.macroModeState;if(c.isPlaying)return;var d=c.lastInsertModeChanges;d.expectCursorActivityForChange?d.expectCursorActivityForChange=!1:d.maybeReset=!0}else a.curOp.isVimOp||cb(a,b);b.visualMode&&bb(a)}function bb(a){var b=a.state.vim,c=J(a,R(b.sel.head)),d=L(c,0,1);b.fakeCursor&&b.fakeCursor.clear(),b.fakeCursor=a.markText(c,d,{className:"cm-animate-fat-cursor"})}function cb(b,c){var d=b.getCursor("anchor"),e=b.getCursor("head");if(c.visualMode&&!b.somethingSelected()?ia(b,!1):c.visualMode||c.insertMode||!b.somethingSelected()||(c.visualMode=!0,c.visualLine=!1,a.signal(b,"vim-mode-change",{mode:"visual"})),c.visualMode){var f=T(e,d)?0:-1,g=T(e,d)?-1:0;e=L(e,0,f),d=L(d,0,g),c.sel={anchor:d,head:e},ua(b,c,"<",U(e,d)),ua(b,c,">",V(e,d))}else c.insertMode||(c.lastHPos=b.getCursor().ch)}function db(a){this.keyName=a}function eb(b){function c(){return e.maybeReset&&(e.changes=[],e.maybeReset=!1),e.changes.push(new db(f)),!0}var d=ub.macroModeState,e=d.lastInsertModeChanges,f=a.keyName(b);f&&(f.indexOf("Delete")==-1&&f.indexOf("Backspace")==-1||a.lookupKey(f,"vim-insert",c))}function fb(a,b,c,d){function e(){h?xb.processAction(a,b,b.lastEditActionCommand):xb.evalInput(a,b)}function f(c){if(g.lastInsertModeChanges.changes.length>0){c=b.lastEditActionCommand?c:1;var d=g.lastInsertModeChanges;gb(a,d.changes,c)}}var g=ub.macroModeState;g.isPlaying=!0;var h=!!b.lastEditActionCommand,i=b.inputState;if(b.inputState=b.lastEditInputState,h&&b.lastEditActionCommand.interlaceInsertRepeat)for(var j=0;j"]),qb=[].concat(mb,nb,ob,["-",'"',".",":","/"]),rb={};t("filetype",void 0,"string",["ft"],(function(a,b){if(void 0!==b){if(void 0===a){var c=b.getOption("mode");return"null"==c?"":c}var c=""==a?"null":a;b.setOption("mode",c)}}));var sb=function(){function a(a,b,h){function i(b){var e=++d%c,f=g[e];f&&f.clear(),g[e]=a.setBookmark(b)}var j=d%c,k=g[j];if(k){var l=k.find();l&&!S(l,b)&&i(b)}else i(b);i(h),e=d,f=d-c+1,f<0&&(f=0)}function b(a,b){d+=b,d>e?d=e:d0?1:-1,k=a.getCursor();do if(d+=j,h=g[(c+d)%c],h&&(i=h.find())&&!S(k,i))break;while(df)}return h}var c=100,d=-1,e=0,f=0,g=new Array(c);return{cachedCursor:void 0,add:a,move:b}},tb=function(a){return a?{changes:a.changes,expectCursorActivityForChange:a.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};w.prototype={exitMacroRecordMode:function(){var a=ub.macroModeState;a.onRecordingDone&&a.onRecordingDone(),a.onRecordingDone=void 0,a.isRecording=!1},enterMacroRecordMode:function(a,b){var c=ub.registerController.getRegister(b);c&&(c.clear(),this.latestRegister=b,a.openDialog&&(this.onRecordingDone=a.openDialog("(recording)["+b+"]",null,{bottom:!0})),this.isRecording=!0)}};var ub,vb,wb={buildKeyMap:function(){},getRegisterController:function(){return ub.registerController},resetVimGlobalState_:y,getVimGlobalState_:function(){return ub},maybeInitVimState_:x,suppressErrorLogging:!1,InsertModeKey:db,map:function(a,b,c){Ib.map(a,b,c)},unmap:function(a,b){Ib.unmap(a,b)},setOption:u,getOption:v,defineOption:t,defineEx:function(a,b,c){if(b){if(0!==a.indexOf(b))throw new Error('(Vim.defineEx) "'+b+'" is not a prefix of "'+a+'", command not registered')}else b=a;Hb[a]=c,Ib.commandMap_[b]={name:a,shortName:b,type:"api"}},handleKey:function(a,b,c){var d=this.findKey(a,b,c);if("function"==typeof d)return d()},findKey:function(c,d,e){function f(){var a=ub.macroModeState;if(a.isRecording){if("q"==d)return a.exitMacroRecordMode(),A(c),!0;"mapping"!=e&&Ya(a,d)}}function g(){if(""==d)return A(c),l.visualMode?ia(c):l.insertMode&&Ua(c),!0}function h(b){for(var e;b;)e=/<\w+-.+?>|<\w+>|./.exec(b),d=e[0],b=b.substring(e.index+d.length),a.Vim.handleKey(c,d,"mapping")}function i(){if(g())return!0;for(var a=l.inputState.keyBuffer=l.inputState.keyBuffer+d,e=1==d.length,f=xb.matchCommand(a,b,l.inputState,"insert");a.length>1&&"full"!=f.type;){var a=l.inputState.keyBuffer=a.slice(1),h=xb.matchCommand(a,b,l.inputState,"insert");"none"!=h.type&&(f=h)}if("none"==f.type)return A(c),!1;if("partial"==f.type)return vb&&window.clearTimeout(vb),vb=window.setTimeout((function(){l.insertMode&&l.inputState.keyBuffer&&A(c)}),v("insertModeEscKeysTimeout")),!e;if(vb&&window.clearTimeout(vb),e){for(var i=c.listSelections(),j=0;j0||this.motionRepeat.length>0)&&(a=1,this.prefixRepeat.length>0&&(a*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(a*=parseInt(this.motionRepeat.join(""),10))),a},B.prototype={setText:function(a,b,c){this.keyBuffer=[a||""],this.linewise=!!b,this.blockwise=!!c},pushText:function(a,b){b&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(a)},pushInsertModeChanges:function(a){this.insertModeChanges.push(tb(a))},pushSearchQuery:function(a){this.searchQueries.push(a)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},D.prototype={pushText:function(a,b,c,d,e){d&&"\n"==c.charAt(0)&&(c=c.slice(1)+"\n"),d&&"\n"!==c.charAt(c.length-1)&&(c+="\n");var f=this.isValidRegister(a)?this.getRegister(a):null;if(!f){switch(b){case"yank":this.registers[0]=new B(c,d,e);break;case"delete":case"change":c.indexOf("\n")==-1?this.registers["-"]=new B(c,d):(this.shiftNumericRegisters_(),this.registers[1]=new B(c,d))}return void this.unnamedRegister.setText(c,d,e)}var g=q(a);g?f.pushText(c,d):f.setText(c,d,e),this.unnamedRegister.setText(f.toString(),d)},getRegister:function(a){return this.isValidRegister(a)?(a=a.toLowerCase(),this.registers[a]||(this.registers[a]=new B),this.registers[a]):this.unnamedRegister},isValidRegister:function(a){return a&&s(a,qb)},shiftNumericRegisters_:function(){for(var a=9;a>=2;a--)this.registers[a]=this.getRegister(""+(a-1))}},E.prototype={nextMatch:function(a,b){var c=this.historyBuffer,d=b?-1:1;null===this.initialPrefix&&(this.initialPrefix=a);for(var e=this.iterator+d;b?e>=0:e=c.length?(this.iterator=c.length,this.initialPrefix):e<0?a:void 0},pushInput:function(a){var b=this.historyBuffer.indexOf(a);b>-1&&this.historyBuffer.splice(b,1),a.length&&this.historyBuffer.push(a)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var xb={matchCommand:function(a,b,c,d){var e=N(a,b,d,c);if(!e.full&&!e.partial)return{type:"none"};if(!e.full&&e.partial)return{type:"partial"};for(var f,g=0;g"==f.keys.slice(-11)&&(c.selectedCharacter=P(a)),{type:"full",command:f}},processCommand:function(a,b,c){switch(b.inputState.repeatOverride=c.repeatOverride,c.type){case"motion":this.processMotion(a,b,c);break;case"operator":this.processOperator(a,b,c);break;case"operatorMotion":this.processOperatorMotion(a,b,c);break;case"action":this.processAction(a,b,c);break;case"search":this.processSearch(a,b,c);break;case"ex":case"keyToEx":this.processEx(a,b,c)}},processMotion:function(a,b,c){b.inputState.motion=c.motion,b.inputState.motionArgs=K(c.motionArgs),this.evalInput(a,b)},processOperator:function(a,b,c){var d=b.inputState;if(d.operator){if(d.operator==c.operator)return d.motion="expandToLine",d.motionArgs={linewise:!0},void this.evalInput(a,b);A(a)}d.operator=c.operator,d.operatorArgs=K(c.operatorArgs),b.visualMode&&this.evalInput(a,b)},processOperatorMotion:function(a,b,c){var d=b.visualMode,e=K(c.operatorMotionArgs);e&&d&&e.visualLine&&(b.visualLine=!0),this.processOperator(a,b,c),d||this.processMotion(a,b,c)},processAction:function(a,b,c){var d=b.inputState,e=d.getRepeat(),f=!!e,g=K(c.actionArgs)||{};d.selectedCharacter&&(g.selectedCharacter=d.selectedCharacter),c.operator&&this.processOperator(a,b,c),c.motion&&this.processMotion(a,b,c),(c.motion||c.operator)&&this.evalInput(a,b),g.repeat=e||1,g.repeatIsExplicit=f,g.registerName=d.registerName,A(a),b.lastMotion=null,c.isEdit&&this.recordLastEdit(b,d,c),Ab[c.action](a,g,b)},processSearch:function(b,c,d){function e(a,e,f){ub.searchHistoryController.pushInput(a),ub.searchHistoryController.reset();try{Ma(b,a,e,f)}catch(c){return Ia(b,"Invalid regex: "+a),void A(b)}xb.processMotion(b,c,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:d.searchArgs.toJumplist}})}function f(a){b.scrollTo(m.left,m.top),e(a,!0,!0);var c=ub.macroModeState;c.isRecording&&$a(c,a)}function g(c,d,e){var f,g=a.keyName(c);"Up"==g||"Down"==g?(f="Up"==g,d=ub.searchHistoryController.nextMatch(d,f)||"",e(d)):"Left"!=g&&"Right"!=g&&"Ctrl"!=g&&"Alt"!=g&&"Shift"!=g&&ub.searchHistoryController.reset();var h;try{h=Ma(b,d,!0,!0)}catch(a){}h?b.scrollIntoView(Pa(b,!i,h),30):(Qa(b),b.scrollTo(m.left,m.top))}function h(c,d,e){var f=a.keyName(c);"Esc"==f||"Ctrl-C"==f||"Ctrl-["==f||"Backspace"==f&&""==d?(ub.searchHistoryController.pushInput(d),ub.searchHistoryController.reset(),Ma(b,l),Qa(b),b.scrollTo(m.left,m.top),a.e_stop(c),A(b),e(),b.focus()):"Ctrl-U"==f&&(a.e_stop(c),e(""))}if(b.getSearchCursor){var i=d.searchArgs.forward,j=d.searchArgs.wholeWordOnly;Aa(b).setReversed(!i);var k=i?"/":"?",l=Aa(b).getQuery(),m=b.getScrollInfo();switch(d.searchArgs.querySrc){case"prompt":var n=ub.macroModeState;if(n.isPlaying){var o=n.replaySearchQueries.shift();e(o,!0,!1)}else Ka(b,{onClose:f,prefix:k,desc:Fb,onKeyUp:g,onKeyDown:h});break;case"wordUnderCursor":var p=ma(b,!1,!0,!1,!0),q=!0;if(p||(p=ma(b,!1,!0,!1,!1),q=!1),!p)return;var o=b.getLine(p.start.line).substring(p.start.ch,p.end.ch);o=q&&j?"\\b"+o+"\\b":Z(o),ub.jumpList.cachedCursor=b.getCursor(),b.setCursor(p.start),e(o,!0,!1)}}},processEx:function(b,c,d){function e(a){ub.exCommandHistoryController.pushInput(a),ub.exCommandHistoryController.reset(),Ib.processCommand(b,a)}function f(c,d,e){var f,g=a.keyName(c);("Esc"==g||"Ctrl-C"==g||"Ctrl-["==g||"Backspace"==g&&""==d)&&(ub.exCommandHistoryController.pushInput(d),ub.exCommandHistoryController.reset(),a.e_stop(c),A(b),e(),b.focus()),"Up"==g||"Down"==g?(f="Up"==g,d=ub.exCommandHistoryController.nextMatch(d,f)||"",e(d)):"Ctrl-U"==g?(a.e_stop(c),e("")):"Left"!=g&&"Right"!=g&&"Ctrl"!=g&&"Alt"!=g&&"Shift"!=g&&ub.exCommandHistoryController.reset()}"keyToEx"==d.type?Ib.processCommand(b,d.exArgs.input):c.visualMode?Ka(b,{onClose:e,prefix:":",value:"'<,'>",onKeyDown:f}):Ka(b,{onClose:e,prefix:":",onKeyDown:f})},evalInput:function(a,b){var c,e,f,g=b.inputState,h=g.motion,i=g.motionArgs||{},j=g.operator,k=g.operatorArgs||{},l=g.registerName,m=b.sel,n=R(b.visualMode?J(a,m.head):a.getCursor("head")),o=R(b.visualMode?J(a,m.anchor):a.getCursor("anchor")),p=R(n),q=R(o);if(j&&this.recordLastEdit(b,g),f=void 0!==g.repeatOverride?g.repeatOverride:g.getRepeat(),f>0&&i.explicitRepeat?i.repeatIsExplicit=!0:(i.noRepeat||!i.explicitRepeat&&0===f)&&(f=1,i.repeatIsExplicit=!1),g.selectedCharacter&&(i.selectedCharacter=k.selectedCharacter=g.selectedCharacter),i.repeat=f,A(a),h){var r=yb[h](a,n,i,b);if(b.lastMotion=yb[h],!r)return;if(i.toJumplist){var s=ub.jumpList,t=s.cachedCursor;t?(na(a,t,r),delete s.cachedCursor):na(a,n,r)}r instanceof Array?(e=r[0],c=r[1]):c=r,c||(c=R(n)),b.visualMode?(b.visualBlock&&c.ch===1/0||(c=J(a,c,b.visualBlock)),e&&(e=J(a,e,!0)),e=e||q,m.anchor=e,m.head=c,fa(a),ua(a,b,"<",T(e,c)?e:c),ua(a,b,">",T(e,c)?c:e)):j||(c=J(a,c),a.setCursor(c.line,c.ch))}if(j){if(k.lastSel){e=q;var u=k.lastSel,v=Math.abs(u.head.line-u.anchor.line),w=Math.abs(u.head.ch-u.anchor.ch);c=u.visualLine?d(q.line+v,q.ch):u.visualBlock?d(q.line+v,q.ch+w):u.head.line==u.anchor.line?d(q.line,q.ch+w):d(q.line+v,q.ch),b.visualMode=!0,b.visualLine=u.visualLine,b.visualBlock=u.visualBlock,m=b.sel={anchor:e,head:c},fa(a)}else b.visualMode&&(k.lastSel={anchor:R(m.anchor),head:R(m.head),visualBlock:b.visualBlock,visualLine:b.visualLine});var x,y,z,B,C;if(b.visualMode){if(x=U(m.head,m.anchor),y=V(m.head,m.anchor),z=b.visualLine||k.linewise,B=b.visualBlock?"block":z?"line":"char",C=ga(a,{anchor:x,head:y},B),z){var D=C.ranges;if("block"==B)for(var E=0;Ek&&f.line==k?this.moveToEol(a,b,c,e):(c.toFirstChar&&(g=la(a.getLine(i)),e.lastHPos=g),e.lastHSPos=a.charCoords(d(i,g),"div").left,d(i,g))},moveByDisplayLines:function(a,b,c,e){var f=b;switch(e.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:e.lastHSPos=a.charCoords(f,"div").left}var g=c.repeat,h=a.findPosV(f,c.forward?g:-g,"line",e.lastHSPos);if(h.hitSide)if(c.forward)var i=a.charCoords(h,"div"),j={top:i.top+8,left:e.lastHSPos},h=a.coordsChar(j,"div");else{var k=a.charCoords(d(a.firstLine(),0),"div");k.left=e.lastHSPos,h=a.coordsChar(k,"div")}return e.lastHPos=h.ch,h},moveByPage:function(a,b,c){var d=b,e=c.repeat;return a.findPosV(d,c.forward?e:-e,"page")},moveByParagraph:function(a,b,c){var d=c.forward?1:-1;return wa(a,b,c.repeat,d)},moveByScroll:function(a,b,c,d){var e=a.getScrollInfo(),f=null,g=c.repeat;g||(g=e.clientHeight/(2*a.defaultTextHeight()));var h=a.charCoords(b,"local");c.repeat=g;var f=yb.moveByDisplayLines(a,b,c,d);if(!f)return null;var i=a.charCoords(f,"local");return a.scrollTo(null,e.top+i.top-h.top),f},moveByWords:function(a,b,c){return ra(a,b,c.repeat,!!c.forward,!!c.wordEnd,!!c.bigWord)},moveTillCharacter:function(a,b,c){var d=c.repeat,e=sa(a,d,c.forward,c.selectedCharacter),f=c.forward?-1:1;return oa(f,c),e?(e.ch+=f,e):null},moveToCharacter:function(a,b,c){var d=c.repeat;return oa(0,c),sa(a,d,c.forward,c.selectedCharacter)||b},moveToSymbol:function(a,b,c){var d=c.repeat;return pa(a,d,c.forward,c.selectedCharacter)||b},moveToColumn:function(a,b,c,d){var e=c.repeat;return d.lastHPos=e-1,d.lastHSPos=a.charCoords(b,"div").left,ta(a,e)},moveToEol:function(a,b,c,e){var f=b;e.lastHPos=1/0;var g=d(f.line+c.repeat-1,1/0),h=a.clipPos(g);return h.ch--,e.lastHSPos=a.charCoords(h,"div").left,g},moveToFirstNonWhiteSpaceCharacter:function(a,b){var c=b;return d(c.line,la(a.getLine(c.line)))},moveToMatchedSymbol:function(a,b){var c,e=b,f=e.line,g=e.ch,h=a.getLine(f);do if(c=h.charAt(g++),c&&o(c)){var i=a.getTokenTypeAt(d(f,g));if("string"!==i&&"comment"!==i)break}while(c);if(c){var j=a.findMatchingBracket(d(f,g));return j.to}return e},moveToStartOfLine:function(a,b){return d(b.line,0)},moveToLineOrEdgeOfDocument:function(a,b,c){var e=c.forward?a.lastLine():a.firstLine();return c.repeatIsExplicit&&(e=c.repeat-a.getOption("firstLineNumber")),d(e,la(a.getLine(e)))},textObjectManipulation:function(a,b,c,d){var e={"(":")",")":"(","{":"}","}":"{","[":"]","]":"["},f={"'":!0,'"':!0},g=c.selectedCharacter;"b"==g?g="(":"B"==g&&(g="{");var h,i=!c.textObjectInner;if(e[g])h=xa(a,b,g,i);else if(f[g])h=ya(a,b,g,i);else if("W"===g)h=ma(a,i,!0,!0);else if("w"===g)h=ma(a,i,!0,!1);else{if("p"!==g)return null;if(h=wa(a,b,c.repeat,0,i),c.linewise=!0,d.visualMode)d.visualLine||(d.visualLine=!0);else{var j=d.inputState.operatorArgs;j&&(j.linewise=!0),h.end.line--}}return a.state.vim.visualMode?ea(a,h.start,h.end):[h.start,h.end]},repeatLastCharacterSearch:function(a,b,c){var d=ub.lastCharacterSearch,e=c.repeat,f=c.forward===d.forward,g=(d.increment?1:0)*(f?-1:1);a.moveH(-g,"char"),c.inclusive=!!f;var h=sa(a,e,f,d.selectedCharacter);return h?(h.ch+=g,h):(a.moveH(g,"char"),b)}},zb={change:function(b,c,e){var f,g,h=b.state.vim;if(ub.macroModeState.lastInsertModeChanges.inVisualBlock=h.visualBlock,h.visualMode){g=b.getSelection();var i=G("",e.length);b.replaceSelections(i),f=U(e[0].head,e[0].anchor)}else{var j=e[0].anchor,k=e[0].head;g=b.getRange(j,k);var l=h.lastEditInputState||{};if("moveByWords"==l.motion&&!r(g)){var m=/\s+$/.exec(g);m&&l.motionArgs&&l.motionArgs.forward&&(k=L(k,0,-m[0].length),g=g.slice(0,-m[0].length))}var n=new d(j.line-1,Number.MAX_VALUE),o=b.firstLine()==b.lastLine();k.line>b.lastLine()&&c.linewise&&!o?b.replaceRange("",n,k):b.replaceRange("",j,k),c.linewise&&(o||(b.setCursor(n),a.commands.newlineAndIndent(b)),j.ch=Number.MAX_VALUE),f=j}ub.registerController.pushText(c.registerName,"change",g,c.linewise,e.length>1),Ab.enterInsertMode(b,{head:f},b.state.vim)},delete:function(a,b,c){var e,f,g=a.state.vim;if(g.visualBlock){f=a.getSelection();var h=G("",c.length);a.replaceSelections(h),e=c[0].anchor}else{var i=c[0].anchor,j=c[0].head;b.linewise&&j.line!=a.firstLine()&&i.line==a.lastLine()&&i.line==j.line-1&&(i.line==a.firstLine()?i.ch=0:i=d(i.line-1,X(a,i.line-1))), +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a){var b=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:b.style.width,height:b.style.height},b.style.width="",b.style.height="auto",b.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function c(a){var b=a.getWrapperElement();b.className=b.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var c=a.state.fullScreenRestore;b.style.width=c.width,b.style.height=c.height,window.scrollTo(c.scrollLeft,c.scrollTop),a.refresh()}a.defineOption("fullScreen",!1,(function(d,e,f){f==a.Init&&(f=!1),!f!=!e&&(e?b(d):c(d))}))})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){function b(a,b,c,d){this.cm=a,this.node=b,this.options=c,this.height=d,this.cleared=!1}function c(a){var b=a.getWrapperElement(),c=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,d=parseInt(c.height),e=a.state.panels={setHeight:b.style.height,heightLeft:d,panels:0,wrapper:document.createElement("div")};b.parentNode.insertBefore(e.wrapper,b);var f=a.hasFocus();e.wrapper.appendChild(b),f&&a.focus(),a._setSize=a.setSize,null!=d&&(a.setSize=function(b,c){if(null==c)return this._setSize(b,c);if(e.setHeight=c,"number"!=typeof c){var f=/^(\d+\.?\d*)px$/.exec(c);f?c=Number(f[1]):(e.wrapper.style.height=c,c=e.wrapper.offsetHeight,e.wrapper.style.height="")}a._setSize(b,e.heightLeft+=c-d),d=c})}function d(a){var b=a.state.panels;a.state.panels=null;var c=a.getWrapperElement();b.wrapper.parentNode.replaceChild(c,b.wrapper),c.style.height=b.setHeight,a.setSize=a._setSize,a.setSize()}a.defineExtension("addPanel",(function(a,d){d=d||{},this.state.panels||c(this);var e=this.state.panels,f=e.wrapper,g=this.getWrapperElement();d.after instanceof b&&!d.after.cleared?f.insertBefore(a,d.before.node.nextSibling):d.before instanceof b&&!d.before.cleared?f.insertBefore(a,d.before.node):d.replace instanceof b&&!d.replace.cleared?(f.insertBefore(a,d.replace.node),d.replace.clear()):"bottom"==d.position?f.appendChild(a):"before-bottom"==d.position?f.insertBefore(a,g.nextSibling):"after-top"==d.position?f.insertBefore(a,g):f.insertBefore(a,f.firstChild);var h=d&&d.height||a.offsetHeight;return this._setSize(null,e.heightLeft-=h),e.panels++,new b(this,a,d,h)})),b.prototype.clear=function(){if(!this.cleared){this.cleared=!0;var a=this.cm.state.panels;this.cm._setSize(null,a.heightLeft+=this.height),a.wrapper.removeChild(this.node),0==--a.panels&&d(this.cm)}},b.prototype.changed=function(a){var b=null==a?this.node.offsetHeight:a,c=this.cm.state.panels;this.cm._setSize(null,c.height+=b-this.height),this.height=b}})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){function b(a,b){return"pairs"==b&&"string"==typeof a?a:"object"==typeof a&&null!=a[b]?a[b]:m[b]}function c(a){return function(b){return h(b,a)}}function d(a){var b=a.state.closeBrackets;if(!b)return null;var c=a.getModeAt(a.getCursor());return c.closeBrackets||b}function e(c){var e=d(c);if(!e||c.getOption("disableInput"))return a.Pass;for(var f=b(e,"pairs"),g=c.listSelections(),h=0;h=0;h--){var k=g[h].head;c.replaceRange("",n(k.line,k.ch-1),n(k.line,k.ch+1),"+delete")}}function f(c){var e=d(c),f=e&&b(e,"explode");if(!f||c.getOption("disableInput"))return a.Pass;for(var g=c.listSelections(),h=0;h0;return{anchor:new n(b.anchor.line,b.anchor.ch+(c?-1:1)),head:new n(b.head.line,b.head.ch+(c?1:-1))}}function h(c,e){var f=d(c);if(!f||c.getOption("disableInput"))return a.Pass;var h=b(f,"pairs"),j=h.indexOf(e);if(j==-1)return a.Pass;for(var m,o=b(f,"triples"),p=h.charAt(j+1)==e,q=c.listSelections(),r=j%2==0,s=0;s1&&o.indexOf(e)>=0&&c.getRange(n(v.line,v.ch-2),v)==e+e&&(v.ch<=2||c.getRange(n(v.line,v.ch-3),n(v.line,v.ch-2))!=e))t="addFour";else if(p){if(a.isWordChar(w)||!k(c,v,e))return a.Pass;t="both"}else{if(!r||c.getLine(v.line).length!=v.ch&&!i(w,h)&&!/\s/.test(w))return a.Pass;t="both"}else t=p&&l(c,v)?"both":o.indexOf(e)>=0&&c.getRange(v,n(v.line,v.ch+3))==e+e+e?"skipThree":"skip";if(m){if(m!=t)return a.Pass}else m=t}var x=j%2?h.charAt(j-1):e,y=j%2?e:h.charAt(j+1);c.operation((function(){if("skip"==m)c.execCommand("goCharRight");else if("skipThree"==m)for(var a=0;a<3;a++)c.execCommand("goCharRight");else if("surround"==m){for(var b=c.getSelections(),a=0;a-1&&c%2==1}function j(a,b){var c=a.getRange(n(b.line,b.ch-1),n(b.line,b.ch+1));return 2==c.length?c:null}function k(b,c,d){var e=b.getLine(c.line),f=b.getTokenAt(c);if(/\bstring2?\b/.test(f.type))return!1;var g=new a.StringStream(e.slice(0,c.ch)+d+e.slice(c.ch),4);for(g.pos=g.start=f.start;;){var h=b.getMode().token(g,f.state);if(g.pos>=c.ch+1)return/\bstring2?\b/.test(h);g.start=g.pos}}function l(a,b){var c=a.getTokenAt(n(b.line,b.ch+1));return/\bstring/.test(c.type)&&c.start==b.ch}var m={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},n=a.Pos;a.defineOption("autoCloseBrackets",!1,(function(b,c,d){d&&d!=a.Init&&(b.removeKeyMap(p),b.state.closeBrackets=null),c&&(b.state.closeBrackets=c,b.addKeyMap(p))}));for(var o=m.pairs+"`",p={Backspace:e,Enter:f},q=0;qj.ch&&(r=r.slice(0,r.length-k.end+j.ch));var s=r.toLowerCase();if(!r||"string"==k.type&&(k.end!=j.ch||!/[\"\']/.test(k.string.charAt(k.string.length-1))||1==k.string.length)||"tag"==k.type&&"closeTag"==m.type||k.string.indexOf("/")==k.string.length-1||p&&e(p,s)>-1||f(b,r,j,m,!0))return a.Pass;var t=q&&e(q,s)>-1;d[i]={indent:t,text:">"+(t?"\n\n":"")+"",newPos:t?a.Pos(j.line+1,0):a.Pos(j.line,j.ch+1)}}for(var i=c.length-1;i>=0;i--){var u=d[i];b.replaceRange(u.text,c[i].head,c[i].anchor,"+insert");var v=b.listSelections().slice(0);v[i]={head:u.newPos,anchor:u.newPos},b.setSelections(v),u.indent&&(b.indentLine(u.newPos.line,null,!0),b.indentLine(u.newPos.line+1,null,!0))}}function c(b,c){for(var d=b.listSelections(),e=[],g=c?"/":""!=b.getLine(i.line).charAt(j.end)&&(m+=">"),e[h]=m}b.replaceSelections(e),d=b.listSelections();for(var h=0;h'"]=function(a){return b(a)}),c.addKeyMap(g)}}));var g=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],h=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];a.commands.closeTag=function(a){return c(a)}})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){function b(a,b,d,e){var f=a.getLineHandle(b.line),i=b.ch-1,j=i>=0&&h[f.text.charAt(i)]||h[f.text.charAt(++i)];if(!j)return null;var k=">"==j.charAt(1)?1:-1;if(d&&k>0!=(i==b.ch))return null;var l=a.getTokenTypeAt(g(b.line,i+1)),m=c(a,g(b.line,i+(k>0?1:0)),k,l||null,e);return null==m?null:{from:g(b.line,i),to:m&&m.pos,match:m&&m.ch==j.charAt(0),forward:k>0}}function c(a,b,c,d,e){for(var f=e&&e.maxScanLineLength||1e4,i=e&&e.maxScanLines||1e3,j=[],k=e&&e.bracketRegex?e.bracketRegex:/[(){}[\]]/,l=c>0?Math.min(b.line+i,a.lastLine()+1):Math.max(a.firstLine()-1,b.line-i),m=b.line;m!=l;m+=c){var n=a.getLine(m);if(n){var o=c>0?0:n.length-1,p=c>0?n.length:-1;if(!(n.length>f))for(m==b.line&&(o=b.ch-(c<0?1:0));o!=p;o+=c){var q=n.charAt(o);if(k.test(q)&&(void 0===d||a.getTokenTypeAt(g(m,o+1))==d)){var r=h[q];if(">"==r.charAt(1)==c>0)j.push(q);else{if(!j.length)return{pos:g(m,o),ch:q};j.pop()}}}}}return m-c!=(c>0?a.lastLine():a.firstLine())&&null}function d(a,c,d){for(var e=a.state.matchBrackets.maxHighlightLineLength||1e3,h=[],i=a.listSelections(),j=0;j",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},i=null;a.defineOption("matchBrackets",!1,(function(b,c,d){d&&d!=a.Init&&(b.off("cursorActivity",e),i&&(i(),i=null)),c&&(b.state.matchBrackets="object"==typeof c?c:{},b.on("cursorActivity",e))})),a.defineExtension("matchBrackets",(function(){d(this,!0)})),a.defineExtension("findMatchingBracket",(function(a,c,d){return b(this,a,c,d)})),a.defineExtension("scanForBracket",(function(a,b,d,e){return c(this,a,b,d,e)}))})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],a):a(CodeMirror)})((function(a){"use strict";function b(a){a.state.tagHit&&a.state.tagHit.clear(),a.state.tagOther&&a.state.tagOther.clear(),a.state.tagHit=a.state.tagOther=null}function c(c){c.state.failedTagMatch=!1,c.operation((function(){if(b(c),!c.somethingSelected()){var d=c.getCursor(),e=c.getViewport();e.from=Math.min(e.from,d.line),e.to=Math.max(d.line+1,e.to);var f=a.findMatchingTag(c,d,e);if(f){if(c.state.matchBothTags){var g="open"==f.at?f.open:f.close;g&&(c.state.tagHit=c.markText(g.from,g.to,{className:"CodeMirror-matchingtag"}))}var h="close"==f.at?f.open:f.close;h?c.state.tagOther=c.markText(h.from,h.to,{className:"CodeMirror-matchingtag"}):c.state.failedTagMatch=!0}}}))}function d(a){a.state.failedTagMatch&&c(a)}a.defineOption("matchTags",!1,(function(e,f,g){g&&g!=a.Init&&(e.off("cursorActivity",c),e.off("viewportChange",d),b(e)),f&&(e.state.matchBothTags="object"==typeof f&&f.bothTags,e.on("cursorActivity",c),e.on("viewportChange",d),c(e))})),a.commands.toMatchingTag=function(b){var c=a.findMatchingTag(b,b.getCursor());if(c){var d="close"==c.at?c.open:c.close;d&&b.extendSelection(d.to,d.from)}}})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";a.registerHelper("fold","brace",(function(b,c){function d(d){for(var h=c.ch,i=0;;){var j=h<=0?-1:g.lastIndexOf(d,h-1);if(j!=-1){if(1==i&&jb.lastLine())return null;var d=b.getTokenAt(a.Pos(c,1));if(/\S/.test(d.string)||(d=b.getTokenAt(a.Pos(c,d.end+1))),"keyword"!=d.type||"import"!=d.string)return null;for(var e=c,f=Math.min(b.lastLine(),c+10);e<=f;++e){var g=b.getLine(e),h=g.indexOf(";");if(h!=-1)return{startCh:d.end,end:a.Pos(e,h)}}}var e,f=c.line,g=d(f);if(!g||d(f-1)||(e=d(f-2))&&e.end.line==f-1)return null;for(var h=g.end;;){var i=d(h.line+1);if(null==i)break;h=i.end}return{from:b.clipPos(a.Pos(f,g.startCh+1)),to:h}})),a.registerHelper("fold","include",(function(b,c){function d(c){if(cb.lastLine())return null;var d=b.getTokenAt(a.Pos(c,1));return/\S/.test(d.string)||(d=b.getTokenAt(a.Pos(c,d.end+1))),"meta"==d.type&&"#include"==d.string.slice(0,8)?d.start+8:void 0}var e=c.line,f=d(e);if(null==f||null!=d(e-1))return null;for(var g=e;;){var h=d(g+1);if(null==h)break;++g}return{from:a.Pos(e,f+1),to:b.clipPos(a.Pos(g))}}))})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(b,e,f,g){function h(a){var c=i(b,e);if(!c||c.to.line-c.from.lineb.firstLine();)e=a.Pos(e.line-1,0),k=h(!1);if(k&&!k.cleared&&"unfold"!==g){var l=c(b,f);a.on(l,"mousedown",(function(b){m.clear(),a.e_preventDefault(b)}));var m=b.markText(k.from,k.to,{replacedWith:l,clearOnEnter:d(b,f,"clearOnEnter"),__isFold:!0});m.on("clear",(function(c,d){a.signal(b,"unfold",b,c,d)})),a.signal(b,"fold",b,k.from,k.to)}}function c(a,b){var c=d(a,b,"widget");if("string"==typeof c){var e=document.createTextNode(c);c=document.createElement("span"),c.appendChild(e),c.className="CodeMirror-foldmarker"}return c}function d(a,b,c){if(b&&void 0!==b[c])return b[c];var d=a.options.foldOptions;return d&&void 0!==d[c]?d[c]:e[c]}a.newFoldFunction=function(a,c){return function(d,e){b(d,e,{rangeFinder:a,widget:c})}},a.defineExtension("foldCode",(function(a,c,d){b(this,a,c,d)})),a.defineExtension("isFolded",(function(a){for(var b=this.findMarksAt(a),c=0;c=h&&(c=e(f.indicatorOpen))}a.setGutterMarker(b,f.gutter,c),++g}))}function g(a){var b=a.getViewport(),c=a.state.foldGutter;c&&(a.operation((function(){f(a,b.from,b.to)})),c.from=b.from,c.to=b.to)}function h(a,b,c){var e=a.state.foldGutter;if(e){var f=e.options;if(c==f.gutter){var g=d(a,b);g?g.clear():a.foldCode(l(b,0),f.rangeFinder)}}}function i(a){var b=a.state.foldGutter;if(b){var c=b.options;b.from=b.to=0,clearTimeout(b.changeUpdate),b.changeUpdate=setTimeout((function(){g(a)}),c.foldOnChangeTimeSpan||600)}}function j(a){var b=a.state.foldGutter;if(b){var c=b.options;clearTimeout(b.changeUpdate),b.changeUpdate=setTimeout((function(){var c=a.getViewport();b.from==b.to||c.from-b.to>20||b.from-c.to>20?g(a):a.operation((function(){c.fromb.to&&(f(a,b.to,c.to),b.to=c.to)}))}),c.updateViewportTimeSpan||400)}}function k(a,b){var c=a.state.foldGutter;if(c){var d=b.line;d>=c.from&&d=a.max))return a.ch=0,a.text=a.cm.getLine(++a.line),!0}function f(a){if(!(a.line<=a.min))return a.text=a.cm.getLine(--a.line),a.ch=a.text.length,!0}function g(a){for(;;){var b=a.text.indexOf(">",a.ch);if(b==-1){if(e(a))continue;return}{if(d(a,b+1)){var c=a.text.lastIndexOf("/",b),f=c>-1&&!/\S/.test(a.text.slice(c+1,b));return a.ch=b+1,f?"selfClose":"regular"}a.ch=b+1}}}function h(a){for(;;){var b=a.ch?a.text.lastIndexOf("<",a.ch-1):-1;if(b==-1){if(f(a))continue;return}if(d(a,b+1)){p.lastIndex=b,a.ch=b;var c=p.exec(a.text);if(c&&c.index==b)return c}else a.ch=b}}function i(a){for(;;){p.lastIndex=a.ch;var b=p.exec(a.text);if(!b){if(e(a))continue;return}{if(d(a,b.index+1))return a.ch=b.index+b[0].length,b;a.ch=b.index+1}}}function j(a){for(;;){var b=a.ch?a.text.lastIndexOf(">",a.ch-1):-1;if(b==-1){if(f(a))continue;return}{if(d(a,b+1)){var c=a.text.lastIndexOf("/",b),e=c>-1&&!/\S/.test(a.text.slice(c+1,b));return a.ch=b+1,e?"selfClose":"regular"}a.ch=b}}}function k(a,b){for(var c=[];;){var d,e=i(a),f=a.line,h=a.ch-(e?e[0].length:0);if(!e||!(d=g(a)))return;if("selfClose"!=d)if(e[1]){for(var j=c.length-1;j>=0;--j)if(c[j]==e[2]){c.length=j;break}if(j<0&&(!b||b==e[2]))return{tag:e[2],from:m(f,h),to:m(a.line,a.ch)}}else c.push(e[2])}}function l(a,b){for(var c=[];;){var d=j(a);if(!d)return;if("selfClose"!=d){var e=a.line,f=a.ch,g=h(a);if(!g)return;if(g[1])c.push(g[2]);else{for(var i=c.length-1;i>=0;--i)if(c[i]==g[2]){c.length=i;break}if(i<0&&(!b||b==g[2]))return{tag:g[2],from:m(a.line,a.ch),to:m(e,f)}}}else h(a)}}var m=a.Pos,n="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",o=n+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",p=new RegExp("<(/?)(["+n+"]["+o+"]*)","g");a.registerHelper("fold","xml",(function(a,b){for(var d=new c(a,b.line,0);;){var e,f=i(d);if(!f||d.line!=b.line||!(e=g(d)))return;if(!f[1]&&"selfClose"!=e){var h=m(d.line,d.ch),j=k(d,f[2]);return j&&{from:h,to:j.from}}}})),a.findMatchingTag=function(a,d,e){var f=new c(a,d.line,d.ch,e);if(f.text.indexOf(">")!=-1||f.text.indexOf("<")!=-1){var i=g(f),j=i&&m(f.line,f.ch),n=i&&h(f);if(i&&n&&!(b(f,d)>0)){var o={from:m(f.line,f.ch),to:j,tag:n[2]};return"selfClose"==i?{open:o,close:null,at:"open"}:n[1]?{open:l(f,n[2]),close:o,at:"close"}:(f=new c(a,j.line,j.ch,e),{open:o,close:k(f,n[2]),at:"open"})}}},a.findEnclosingTag=function(a,b,d){for(var e=new c(a,b.line,b.ch,d);;){var f=l(e);if(!f)break;var g=new c(a,b.line,b.ch,d),h=k(g,f.tag);if(h)return{open:f,close:h}}},a.scanForClosingTag=function(a,b,d,e){var f=new c(a,b.line,b.ch,e?{from:0,to:e}:null);return k(f,d)}})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),"cjs"):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],(function(b){a(b,"amd")})):a(CodeMirror,"plain")})((function(a,b){function c(a,b){var c=b;return function(){0==--c&&a()}}function d(b,d){var e=a.modes[b].dependencies;if(!e)return d();for(var f=[],g=0;g-1?e+b.length:e}var f=b.exec(c?a.slice(c):a);return f?f.index+c+(d?f[0].length:0):-1}var d=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:a.startState(b),innerActive:null,inner:null}},copyState:function(c){return{outer:a.copyState(b,c.outer),innerActive:c.innerActive,inner:c.innerActive&&a.copyState(c.innerActive.mode,c.inner)}},token:function(e,f){if(f.innerActive){var g=f.innerActive,h=e.string;if(!g.close&&e.sol())return f.innerActive=f.inner=null,this.token(e,f);var i=g.close?c(h,g.close,e.pos,g.parseDelimiters):-1;if(i==e.pos&&!g.parseDelimiters)return e.match(g.close),f.innerActive=f.inner=null,g.delimStyle&&g.delimStyle+" "+g.delimStyle+"-close";i>-1&&(e.string=h.slice(0,i));var j=g.mode.token(e,f.inner);return i>-1&&(e.string=h),i==e.pos&&g.parseDelimiters&&(f.innerActive=f.inner=null),g.innerStyle&&(j=j?j+" "+g.innerStyle:g.innerStyle),j}for(var k=1/0,h=e.string,l=0;lh)return c.charCoords(a,"local")[b?"top":"bottom"];var d=c.heightAtLine(j,"local");return d+(b?0:j.height)}a!==!1&&this.computeScale();var c=this.cm,d=this.hScale,e=document.createDocumentFragment(),f=this.annotations,g=c.getOption("lineWrapping"),h=g&&1.5*c.defaultTextHeight(),i=null,j=null;if(c.display.barWidth)for(var k,l=0;lo+.9));)m=f[++l],o=b(m.to,!1)*d;if(o!=n){var p=Math.max(o-n,3),q=e.appendChild(document.createElement("div"));q.style.cssText="position: absolute; right: 0px; width: "+Math.max(c.display.barWidth-1,2)+"px; top: "+(n+this.buttonHeight)+"px; height: "+p+"px",q.className=this.options.className,m.id&&q.setAttribute("annotation-id",m.id)}}this.div.textContent="",this.div.appendChild(e)},b.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(b,c,d){function e(b){var c=a.wheelEventPixels(b)["horizontal"==f.orientation?"x":"y"],d=f.pos;f.moveTo(f.pos+c),f.pos!=d&&a.e_preventDefault(b)}this.orientation=c,this.scroll=d,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=b+"-"+c,this.inner=this.node.appendChild(document.createElement("div"));var f=this;a.on(this.inner,"mousedown",(function(b){function c(){a.off(document,"mousemove",d),a.off(document,"mouseup",c)}function d(a){return 1!=a.which?c():void f.moveTo(h+(a[e]-g)*(f.total/f.size))}if(1==b.which){a.e_preventDefault(b);var e="horizontal"==f.orientation?"pageX":"pageY",g=b[e],h=f.pos;a.on(document,"mousemove",d),a.on(document,"mouseup",c)}})),a.on(this.node,"click",(function(b){a.e_preventDefault(b);var c,d=f.inner.getBoundingClientRect();c="horizontal"==f.orientation?b.clientXd.right?1:0:b.clientYd.bottom?1:0,f.moveTo(f.pos+c*f.screen)})),a.on(this.node,"mousewheel",e),a.on(this.node,"DOMMouseScroll",e)}function c(a,c,d){this.addClass=a,this.horiz=new b(a,"horizontal",d),c(this.horiz.node),this.vert=new b(a,"vertical",d),c(this.vert.node),this.width=null}b.prototype.setPos=function(a,b){return a<0&&(a=0),a>this.total-this.screen&&(a=this.total-this.screen),!(!b&&a==this.pos)&&(this.pos=a,this.inner.style["horizontal"==this.orientation?"left":"top"]=a*(this.size/this.total)+"px",!0)},b.prototype.moveTo=function(a){this.setPos(a)&&this.scroll(a,this.orientation)};var d=10;b.prototype.update=function(a,b,c){var e=this.screen!=b||this.total!=a||this.size!=c;e&&(this.screen=b,this.total=a,this.size=c);var f=this.screen*(this.size/this.total);fa.clientWidth+1,e=a.scrollHeight>a.clientHeight+1;return this.vert.node.style.display=e?"block":"none",this.horiz.node.style.display=d?"block":"none", +e&&(this.vert.update(a.scrollHeight,a.clientHeight,a.viewHeight-(d?c:0)),this.vert.node.style.bottom=d?c+"px":"0"),d&&(this.horiz.update(a.scrollWidth,a.clientWidth,a.viewWidth-(e?c:0)-a.barLeft),this.horiz.node.style.right=e?c+"px":"0",this.horiz.node.style.left=a.barLeft+"px"),{right:e?c:0,bottom:d?c:0}},c.prototype.setScrollTop=function(a){this.vert.setPos(a)},c.prototype.setScrollLeft=function(a){this.horiz.setPos(a)},c.prototype.clear=function(){var a=this.horiz.node.parentNode;a.removeChild(this.horiz.node),a.removeChild(this.vert.node)},a.scrollbarModel.simple=function(a,b){return new c("CodeMirror-simplescroll",a,b)},a.scrollbarModel.overlay=function(a,b){return new c("CodeMirror-overlayscroll",a,b)}})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],a):a(CodeMirror)})((function(a){"use strict";function b(a,b,c,d){this.cm=a,this.options=d;var e={listenForChanges:!1};for(var f in d)e[f]=d[f];e.className||(e.className="CodeMirror-search-match"),this.annotation=a.annotateScrollbar(e),this.query=b,this.caseFold=c,this.gap={from:a.firstLine(),to:a.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var g=this;a.on("change",this.changeHandler=function(a,b){g.onChange(b)})}function c(a,b,c){return a<=b?a:Math.max(b,a+c)}a.defineExtension("showMatchesOnScrollbar",(function(a,c,d){return"string"==typeof d&&(d={className:d}),d||(d={}),new b(this,a,c,d)}));var d=1e3;b.prototype.findMatches=function(){if(this.gap){for(var b=0;b=this.gap.to)break;c.to.line>=this.gap.from&&this.matches.splice(b--,1)}for(var e=this.cm.getSearchCursor(this.query,a.Pos(this.gap.from,0),this.caseFold),f=this.options&&this.options.maxMatches||d;e.findNext();){var c={from:e.from(),to:e.to()};if(c.from.line>=this.gap.to)break;if(this.matches.splice(b++,0,c),this.matches.length>f)break}this.gap=null}},b.prototype.onChange=function(b){var d=b.from.line,e=a.changeEnd(b).line,f=e-b.to.line;if(this.gap?(this.gap.from=Math.min(c(this.gap.from,d,f),b.from.line),this.gap.to=Math.max(c(this.gap.to,d,f),b.from.line)):this.gap={from:b.from.line,to:e+1},f)for(var g=0;g=b.options.minChars&&f(a,m,!1,b.options.style)}}))}function i(a,b,c){var d=a.getRange(b,c);if(null!==d.match(/^\w+$/)){if(b.ch>0){var e={line:b.line,ch:b.ch-1},f=a.getRange(e,b);if(null===f.match(/\W/))return!1}if(c.ch-1)return k=c(i,j,k),{from:d(f.line,k),to:d(f.line,k+g.length)}}else{var i=a.getLine(f.line).slice(f.ch),j=h(i),k=j.indexOf(b);if(k>-1)return k=c(i,j,k)+f.ch,{from:d(f.line,k),to:d(f.line,k+g.length)}}}:this.matches=function(){};else{var j=g.split("\n");this.matches=function(b,c){var e=i.length-1;if(b){if(c.line-(i.length-1)=1;--k,--g)if(i[k]!=h(a.getLine(g)))return;var l=a.getLine(g),m=l.length-j[0].length;if(h(l.slice(m))!=i[0])return;return{from:d(g,m),to:f}}if(!(c.line+(i.length-1)>a.lastLine())){var l=a.getLine(c.line),m=l.length-j[0].length;if(h(l.slice(m))==i[0]){for(var n=d(c.line,m),g=c.line+1,k=1;kc))return d;--d}}}var d=a.Pos;b.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(a){function b(a){var b=d(a,0);return c.pos={from:b,to:b},c.atOccurrence=!1,!1}for(var c=this,e=this.doc.clipPos(a?this.pos.from:this.pos.to);;){if(this.pos=this.matches(a,e))return this.atOccurrence=!0,this.pos.match||!0;if(a){if(!e.line)return b(0);e=d(e.line-1,this.doc.getLine(e.line-1).length)}else{var f=this.doc.lineCount();if(e.line==f-1)return b(f);e=d(e.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(b,c){if(this.atOccurrence){var e=a.splitLines(b);this.doc.replaceRange(e,this.pos.from,this.pos.to,c),this.pos.to=d(this.pos.from.line+e.length-1,e[e.length-1].length+(1==e.length?this.pos.from.ch:0))}}},a.defineExtension("getSearchCursor",(function(a,c,d){return new b(this.doc,a,c,d)})),a.defineDocExtension("getSearchCursor",(function(a,c,d){return new b(this,a,c,d)})),a.defineExtension("selectMatches",(function(b,c){for(var d=[],e=this.getSearchCursor(b,this.getCursor("from"),c);e.findNext()&&!(a.cmpPos(e.to(),this.getCursor("to"))>0);)d.push({anchor:e.from(),head:e.to()});d.length&&this.setSelections(d,0)}))})),(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a){for(var b=0;b",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{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"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0}},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],c=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],d=a.Pos,e=function(){function e(b){b.setOption("disableInput",!0),b.setOption("showCursorWhenSelecting",!1),a.signal(b,"vim-mode-change",{mode:"normal"}),b.on("cursorActivity",ab),x(b),a.on(b.getInputField(),"paste",k(b))}function f(b){b.setOption("disableInput",!1),b.off("cursorActivity",ab),a.off(b.getInputField(),"paste",k(b)),b.state.vim=null}function g(b,c){this==a.keyMap.vim&&a.rmClass(b.getWrapperElement(),"cm-fat-cursor"),c&&c.attach==h||f(b,!1)}function h(b,c){this==a.keyMap.vim&&a.addClass(b.getWrapperElement(),"cm-fat-cursor"),c&&c.attach==h||e(b)}function i(b,c){if(c){if(this[b])return this[b];var d=j(b);if(!d)return!1;var e=a.Vim.findKey(c,d);return"function"==typeof e&&a.signal(c,"vim-keypress",d),e}}function j(a){if("'"==a.charAt(0))return a.charAt(1);var b=a.split(/-(?!$)/),c=b[b.length-1];if(1==b.length&&1==b[0].length)return!1;if(2==b.length&&"Shift"==b[0]&&1==c.length)return!1;for(var d=!1,e=0;e")}function k(a){var b=a.state.vim;return b.onPasteFn||(b.onPasteFn=function(){b.insertMode||(a.setCursor(L(a.getCursor(),0,1)),Ab.enterInsertMode(a,{},b))}),b.onPasteFn}function l(a,b){for(var c=[],d=a;d=a.firstLine()&&b<=a.lastLine()}function n(a){return/^[a-z]$/.test(a)}function o(a){return"()[]{}".indexOf(a)!=-1}function p(a){return jb.test(a)}function q(a){return/^[A-Z]$/.test(a)}function r(a){return/^\s*$/.test(a)}function s(a,b){for(var c=0;c"==b.slice(-11)){var c=b.length-11,d=a.slice(0,c),e=b.slice(0,c);return d==e&&a.length>c?"full":0==e.indexOf(d)&&"partial"}return a==b?"full":0==b.indexOf(a)&&"partial"}function P(a){var b=/^.*(<[\w\-]+>)$/.exec(a),c=b?b[1]:a.slice(-1);if(c.length>1)switch(c){case"":c="\n";break;case"":c=" "}return c}function Q(a,b,c){return function(){for(var d=0;d2&&(b=U.apply(void 0,Array.prototype.slice.call(arguments,1))),T(a,b)?a:b}function V(a,b){return arguments.length>2&&(b=V.apply(void 0,Array.prototype.slice.call(arguments,1))),T(a,b)?b:a}function W(a,b,c){var d=T(a,b),e=T(b,c);return d&&e}function X(a,b){return a.getLine(b).length}function Y(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function Z(a){return a.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function $(a,b,c){var e=X(a,b),f=new Array(c-e+1).join(" ");a.setCursor(d(b,e)),a.replaceRange(f,a.getCursor())}function _(a,b){var c=[],e=a.listSelections(),f=R(a.clipPos(b)),g=!S(b,f),h=a.getCursor("head"),i=ba(e,h),j=S(e[i].head,e[i].anchor),k=e.length-1,l=k-i>i?k:0,m=e[l].anchor,n=Math.min(m.line,f.line),o=Math.max(m.line,f.line),p=m.ch,q=f.ch,r=e[l].head.ch-p,s=q-p;r>0&&s<=0?(p++,g||q--):r<0&&s>=0?(p--,j||q++):r<0&&s==-1&&(p--,q++);for(var t=n;t<=o;t++){var u={anchor:new d(t,p),head:new d(t,q)};c.push(u)}return i=f.line==o?c.length-1:0,a.setSelections(c),b.ch=q,m.ch=p,m}function aa(a,b,c){for(var d=[],e=0;ej&&(f.line=j),f.ch=X(a,f.line)}return{ranges:[{anchor:g,head:f}],primary:0}}if("block"==c){for(var k=Math.min(g.line,f.line),l=Math.min(g.ch,f.ch),m=Math.max(g.line,f.line),n=Math.max(g.ch,f.ch)+1,o=m-k+1,p=f.line==k?0:o-1,q=[],r=0;r0&&f&&r(f);f=e.pop())c.line--,c.ch=0;f?(c.line--,c.ch=X(a,c.line)):c.ch=0}}function ka(a,b,c){b.ch=0,c.ch=0,c.line++}function la(a){if(!a)return 0;var b=a.search(/\S/);return b==-1?a.length:b}function ma(a,b,c,e,f){for(var g=ha(a),h=a.getLine(g.line),i=g.ch,j=f?kb[0]:lb[0];!j(h.charAt(i));)if(i++,i>=h.length)return null;e?j=lb[0]:(j=kb[0],j(h.charAt(i))||(j=kb[1]));for(var k=i,l=i;j(h.charAt(k))&&k=0;)l--;if(l++,b){for(var m=k;/\s/.test(h.charAt(k))&&k0;)l--;l||(l=n)}}return{start:d(g.line,l),end:d(g.line,k)}}function na(a,b,c){S(b,c)||ub.jumpList.add(a,b,c)}function oa(a,b){ub.lastCharacterSearch.increment=a,ub.lastCharacterSearch.forward=b.forward,ub.lastCharacterSearch.selectedCharacter=b.selectedCharacter}function pa(a,b,c,e){var f=R(a.getCursor()),g=c?1:-1,h=c?a.lineCount():-1,i=f.ch,j=f.line,k=a.getLine(j),l={lineText:k,nextCh:k.charAt(i),lastCh:null,index:i,symb:e,reverseSymb:(c?{")":"(","}":"{"}:{"(":")","{":"}"})[e],forward:c,depth:0,curMoveThrough:!1},m=Bb[e];if(!m)return f;var n=Cb[m].init,o=Cb[m].isComplete;for(n&&n(l);j!==h&&b;){if(l.index+=g,l.nextCh=l.lineText.charAt(l.index),!l.nextCh){if(j+=g,l.lineText=a.getLine(j)||"",g>0)l.index=0;else{var p=l.lineText.length;l.index=p>0?p-1:0}l.nextCh=l.lineText.charAt(l.index)}o(l)&&(f.line=j,f.ch=l.index,b--)}return l.nextCh||l.curMoveThrough?d(j,l.index):f}function qa(a,b,c,d,e){var f=b.line,g=b.ch,h=a.getLine(f),i=c?1:-1,j=d?lb:kb;if(e&&""==h){if(f+=i,h=a.getLine(f),!m(a,f))return null;g=c?0:h.length}for(;;){if(e&&""==h)return{from:0,to:0,line:f};for(var k=i>0?h.length:-1,l=k,n=k;g!=k;){for(var o=!1,p=0;p0?0:h.length}}function ra(a,b,c,e,f,g){var h=R(b),i=[];(e&&!f||!e&&f)&&c++;for(var j=!(e&&f),k=0;k0;)h(n,e)&&c--,n+=e;return new d(n,0)}var o=a.state.vim;if(o.visualLine&&h(k,1,!0)){var p=o.sel.anchor;h(p.line,-1,!0)&&(f&&p.line==k||(k+=1))}var q=g(k);for(n=k;n<=m&&c;n++)h(n,1,!0)&&(f&&g(n)==q||c--);for(j=new d(n,0),n>m&&!q?q=!0:f=!1,n=k;n>l&&(f&&g(n)!=q&&n!=k||!h(n,-1,!0));n--);return i=new d(n,0),{start:i,end:j}}function xa(a,b,c,e){var f,g,h=b,i={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[c],j={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[c],k=a.getLine(h.line).charAt(h.ch),l=k===j?1:0;if(f=a.scanForBracket(d(h.line,h.ch+l),-1,null,{bracketRegex:i}),g=a.scanForBracket(d(h.line,h.ch+l),1,null,{bracketRegex:i}),!f||!g)return{start:h,end:h};if(f=f.pos,g=g.pos,f.line==g.line&&f.ch>g.ch||f.line>g.line){var m=f;f=g,g=m}return e?g.ch+=1:f.ch+=1,{start:f,end:g}}function ya(a,b,c,e){var f,g,h,i,j=R(b),k=a.getLine(j.line),l=k.split(""),m=l.indexOf(c);if(j.ch-1&&!f;h--)l[h]==c&&(f=h+1);else f=j.ch+1;if(f&&!g)for(h=f,i=l.length;h'+b+"",{bottom:!0,duration:5e3}):alert(b)}function Ja(a,b){var c=''+(a||"")+'';return b&&(c+=' '+b+""),c}function Ka(a,b){var c=(b.prefix||"")+" "+(b.desc||""),d=Ja(b.prefix,b.desc);Ba(a,d,c,b.onClose,b)}function La(a,b){if(a instanceof RegExp&&b instanceof RegExp){for(var c=["global","multiline","ignoreCase","source"],d=0;d=b&&a<=c:a==b}function Sa(a){var b=a.getScrollInfo(),c=6,d=10,e=a.coordsChar({left:0,top:c+b.top},"local"),f=b.clientHeight-d+b.top,g=a.coordsChar({left:0,top:f},"local");return{top:e.line,bottom:g.line}}function Ta(b,c,d,e,f,g,h,i,j){function k(){b.operation((function(){for(;!p;)l(),m();n()}))}function l(){var a=b.getRange(g.from(),g.to()),c=a.replace(h,i);g.replace(c)}function m(){for(;g.findNext()&&Ra(g.from(),e,f);)if(d||!q||g.from().line!=q.line)return b.scrollIntoView(g.from(),30),b.setSelection(g.from(),g.to()),q=g.from(),void(p=!1);p=!0}function n(a){if(a&&a(),b.focus(),q){b.setCursor(q);var c=b.state.vim;c.exMode=!1,c.lastHPos=c.lastHSPos=q.ch}j&&j()}function o(c,d,e){a.e_stop(c);var f=a.keyName(c);switch(f){case"Y":l(),m();break;case"N":m();break;case"A":var g=j;j=void 0,b.operation(k),j=g;break;case"L":l();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":n(e)}return p&&n(e),!0}b.state.vim.exMode=!0;var p=!1,q=g.from();return m(),p?void Ia(b,"No matches for "+h.source):c?void Ka(b,{prefix:"replace with "+i+" (y/n/a/q/l)",onKeyDown:o}):(k(),void(j&&j()))}function Ua(b){var c=b.state.vim,d=ub.macroModeState,e=ub.registerController.getRegister("."),f=d.isPlaying,g=d.lastInsertModeChanges,h=[];if(!f){for(var i=g.inVisualBlock?c.lastSelection.visualBlock.height:1,j=g.changes,h=[],k=0;k1&&(fb(b,c,c.insertModeRepeat-1,!0),c.lastEditInputState.repeatOverride=c.insertModeRepeat),delete c.insertModeRepeat,c.insertMode=!1,b.setCursor(b.getCursor().line,b.getCursor().ch-1),b.setOption("keyMap","vim"),b.setOption("disableInput",!0),b.toggleOverwrite(!1),e.setText(g.changes.join("")),a.signal(b,"vim-mode-change",{mode:"normal"}),d.isRecording&&Za(d)}function Va(a){b.unshift(a)}function Wa(a,b,c,d,e){var f={keys:a,type:b};f[b]=c,f[b+"Args"]=d;for(var g in e)f[g]=e[g];Va(f)}function Xa(b,c,d,e){var f=ub.registerController.getRegister(e);if(":"==e)return f.keyBuffer[0]&&Ib.processCommand(b,f.keyBuffer[0]),void(d.isPlaying=!1);var g=f.keyBuffer,h=0;d.isPlaying=!0,d.replaySearchQueries=f.searchQueries.slice(0);for(var i=0;i|<\w+>|./.exec(l),k=j[0],l=l.substring(j.index+k.length),a.Vim.handleKey(b,k,"macro"),c.insertMode){var m=f.insertModeChanges[h++].changes;ub.macroModeState.lastInsertModeChanges.changes=m,gb(b,m,1),Ua(b)}d.isPlaying=!1}function Ya(a,b){if(!a.isPlaying){var c=a.latestRegister,d=ub.registerController.getRegister(c);d&&d.pushText(b)}}function Za(a){if(!a.isPlaying){var b=a.latestRegister,c=ub.registerController.getRegister(b);c&&c.pushInsertModeChanges&&c.pushInsertModeChanges(a.lastInsertModeChanges)}}function $a(a,b){if(!a.isPlaying){var c=a.latestRegister,d=ub.registerController.getRegister(c);d&&d.pushSearchQuery&&d.pushSearchQuery(b)}}function _a(a,b){var c=ub.macroModeState,d=c.lastInsertModeChanges;if(!c.isPlaying)for(;b;){if(d.expectCursorActivityForChange=!0,"+input"==b.origin||"paste"==b.origin||void 0===b.origin){var e=b.text.join("\n");d.maybeReset&&(d.changes=[],d.maybeReset=!1),d.changes.push(e)}b=b.next}}function ab(a){var b=a.state.vim;if(b.insertMode){var c=ub.macroModeState;if(c.isPlaying)return;var d=c.lastInsertModeChanges;d.expectCursorActivityForChange?d.expectCursorActivityForChange=!1:d.maybeReset=!0}else a.curOp.isVimOp||cb(a,b);b.visualMode&&bb(a)}function bb(a){var b=a.state.vim,c=J(a,R(b.sel.head)),d=L(c,0,1);b.fakeCursor&&b.fakeCursor.clear(),b.fakeCursor=a.markText(c,d,{className:"cm-animate-fat-cursor"})}function cb(b,c){var d=b.getCursor("anchor"),e=b.getCursor("head");if(c.visualMode&&!b.somethingSelected()?ia(b,!1):c.visualMode||c.insertMode||!b.somethingSelected()||(c.visualMode=!0,c.visualLine=!1,a.signal(b,"vim-mode-change",{mode:"visual"})),c.visualMode){var f=T(e,d)?0:-1,g=T(e,d)?-1:0;e=L(e,0,f),d=L(d,0,g),c.sel={anchor:d,head:e},ua(b,c,"<",U(e,d)),ua(b,c,">",V(e,d))}else c.insertMode||(c.lastHPos=b.getCursor().ch)}function db(a){this.keyName=a}function eb(b){function c(){return e.maybeReset&&(e.changes=[],e.maybeReset=!1),e.changes.push(new db(f)),!0}var d=ub.macroModeState,e=d.lastInsertModeChanges,f=a.keyName(b);f&&(f.indexOf("Delete")==-1&&f.indexOf("Backspace")==-1||a.lookupKey(f,"vim-insert",c))}function fb(a,b,c,d){function e(){h?xb.processAction(a,b,b.lastEditActionCommand):xb.evalInput(a,b)}function f(c){if(g.lastInsertModeChanges.changes.length>0){c=b.lastEditActionCommand?c:1;var d=g.lastInsertModeChanges;gb(a,d.changes,c)}}var g=ub.macroModeState;g.isPlaying=!0;var h=!!b.lastEditActionCommand,i=b.inputState;if(b.inputState=b.lastEditInputState,h&&b.lastEditActionCommand.interlaceInsertRepeat)for(var j=0;j"]),qb=[].concat(mb,nb,ob,["-",'"',".",":","/"]),rb={};t("filetype",void 0,"string",["ft"],(function(a,b){if(void 0!==b){if(void 0===a){var c=b.getOption("mode");return"null"==c?"":c}var c=""==a?"null":a;b.setOption("mode",c)}}));var sb=function(){function a(a,b,h){function i(b){var e=++d%c,f=g[e];f&&f.clear(),g[e]=a.setBookmark(b)}var j=d%c,k=g[j];if(k){var l=k.find();l&&!S(l,b)&&i(b)}else i(b);i(h),e=d,f=d-c+1,f<0&&(f=0)}function b(a,b){d+=b,d>e?d=e:d0?1:-1,k=a.getCursor();do if(d+=j,h=g[(c+d)%c],h&&(i=h.find())&&!S(k,i))break;while(df)}return h}var c=100,d=-1,e=0,f=0,g=new Array(c);return{cachedCursor:void 0,add:a,move:b}},tb=function(a){return a?{changes:a.changes,expectCursorActivityForChange:a.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};w.prototype={exitMacroRecordMode:function(){var a=ub.macroModeState;a.onRecordingDone&&a.onRecordingDone(),a.onRecordingDone=void 0,a.isRecording=!1},enterMacroRecordMode:function(a,b){var c=ub.registerController.getRegister(b);c&&(c.clear(),this.latestRegister=b,a.openDialog&&(this.onRecordingDone=a.openDialog("(recording)["+b+"]",null,{bottom:!0})),this.isRecording=!0)}};var ub,vb,wb={buildKeyMap:function(){},getRegisterController:function(){return ub.registerController},resetVimGlobalState_:y,getVimGlobalState_:function(){return ub},maybeInitVimState_:x,suppressErrorLogging:!1,InsertModeKey:db,map:function(a,b,c){Ib.map(a,b,c)},unmap:function(a,b){Ib.unmap(a,b)},setOption:u,getOption:v,defineOption:t,defineEx:function(a,b,c){if(b){if(0!==a.indexOf(b))throw new Error('(Vim.defineEx) "'+b+'" is not a prefix of "'+a+'", command not registered')}else b=a;Hb[a]=c,Ib.commandMap_[b]={name:a,shortName:b,type:"api"}},handleKey:function(a,b,c){var d=this.findKey(a,b,c);if("function"==typeof d)return d()},findKey:function(c,d,e){function f(){var a=ub.macroModeState;if(a.isRecording){if("q"==d)return a.exitMacroRecordMode(),A(c),!0;"mapping"!=e&&Ya(a,d)}}function g(){if(""==d)return A(c),l.visualMode?ia(c):l.insertMode&&Ua(c),!0}function h(b){for(var e;b;)e=/<\w+-.+?>|<\w+>|./.exec(b),d=e[0],b=b.substring(e.index+d.length),a.Vim.handleKey(c,d,"mapping")}function i(){if(g())return!0;for(var a=l.inputState.keyBuffer=l.inputState.keyBuffer+d,e=1==d.length,f=xb.matchCommand(a,b,l.inputState,"insert");a.length>1&&"full"!=f.type;){var a=l.inputState.keyBuffer=a.slice(1),h=xb.matchCommand(a,b,l.inputState,"insert");"none"!=h.type&&(f=h)}if("none"==f.type)return A(c),!1;if("partial"==f.type)return vb&&window.clearTimeout(vb),vb=window.setTimeout((function(){l.insertMode&&l.inputState.keyBuffer&&A(c)}),v("insertModeEscKeysTimeout")),!e;if(vb&&window.clearTimeout(vb),e){for(var i=c.listSelections(),j=0;j0||this.motionRepeat.length>0)&&(a=1,this.prefixRepeat.length>0&&(a*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(a*=parseInt(this.motionRepeat.join(""),10))),a},B.prototype={setText:function(a,b,c){this.keyBuffer=[a||""],this.linewise=!!b,this.blockwise=!!c},pushText:function(a,b){b&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(a)},pushInsertModeChanges:function(a){this.insertModeChanges.push(tb(a))},pushSearchQuery:function(a){this.searchQueries.push(a)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},D.prototype={pushText:function(a,b,c,d,e){d&&"\n"==c.charAt(0)&&(c=c.slice(1)+"\n"),d&&"\n"!==c.charAt(c.length-1)&&(c+="\n");var f=this.isValidRegister(a)?this.getRegister(a):null;if(!f){switch(b){case"yank":this.registers[0]=new B(c,d,e);break;case"delete":case"change":c.indexOf("\n")==-1?this.registers["-"]=new B(c,d):(this.shiftNumericRegisters_(),this.registers[1]=new B(c,d))}return void this.unnamedRegister.setText(c,d,e)}var g=q(a);g?f.pushText(c,d):f.setText(c,d,e),this.unnamedRegister.setText(f.toString(),d)},getRegister:function(a){return this.isValidRegister(a)?(a=a.toLowerCase(),this.registers[a]||(this.registers[a]=new B),this.registers[a]):this.unnamedRegister},isValidRegister:function(a){return a&&s(a,qb)},shiftNumericRegisters_:function(){for(var a=9;a>=2;a--)this.registers[a]=this.getRegister(""+(a-1))}},E.prototype={nextMatch:function(a,b){var c=this.historyBuffer,d=b?-1:1;null===this.initialPrefix&&(this.initialPrefix=a);for(var e=this.iterator+d;b?e>=0:e=c.length?(this.iterator=c.length,this.initialPrefix):e<0?a:void 0},pushInput:function(a){var b=this.historyBuffer.indexOf(a);b>-1&&this.historyBuffer.splice(b,1),a.length&&this.historyBuffer.push(a)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var xb={matchCommand:function(a,b,c,d){var e=N(a,b,d,c);if(!e.full&&!e.partial)return{type:"none"};if(!e.full&&e.partial)return{type:"partial"};for(var f,g=0;g"==f.keys.slice(-11)&&(c.selectedCharacter=P(a)),{type:"full",command:f}},processCommand:function(a,b,c){switch(b.inputState.repeatOverride=c.repeatOverride,c.type){case"motion":this.processMotion(a,b,c);break;case"operator":this.processOperator(a,b,c);break;case"operatorMotion":this.processOperatorMotion(a,b,c);break;case"action":this.processAction(a,b,c);break;case"search":this.processSearch(a,b,c);break;case"ex":case"keyToEx":this.processEx(a,b,c)}},processMotion:function(a,b,c){b.inputState.motion=c.motion,b.inputState.motionArgs=K(c.motionArgs),this.evalInput(a,b)},processOperator:function(a,b,c){var d=b.inputState;if(d.operator){if(d.operator==c.operator)return d.motion="expandToLine",d.motionArgs={linewise:!0},void this.evalInput(a,b);A(a)}d.operator=c.operator,d.operatorArgs=K(c.operatorArgs),b.visualMode&&this.evalInput(a,b)},processOperatorMotion:function(a,b,c){var d=b.visualMode,e=K(c.operatorMotionArgs);e&&d&&e.visualLine&&(b.visualLine=!0),this.processOperator(a,b,c),d||this.processMotion(a,b,c)},processAction:function(a,b,c){var d=b.inputState,e=d.getRepeat(),f=!!e,g=K(c.actionArgs)||{};d.selectedCharacter&&(g.selectedCharacter=d.selectedCharacter),c.operator&&this.processOperator(a,b,c),c.motion&&this.processMotion(a,b,c),(c.motion||c.operator)&&this.evalInput(a,b),g.repeat=e||1,g.repeatIsExplicit=f,g.registerName=d.registerName,A(a),b.lastMotion=null,c.isEdit&&this.recordLastEdit(b,d,c),Ab[c.action](a,g,b)},processSearch:function(b,c,d){function e(a,e,f){ub.searchHistoryController.pushInput(a),ub.searchHistoryController.reset();try{Ma(b,a,e,f)}catch(c){return Ia(b,"Invalid regex: "+a),void A(b)}xb.processMotion(b,c,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:d.searchArgs.toJumplist}})}function f(a){b.scrollTo(m.left,m.top),e(a,!0,!0);var c=ub.macroModeState;c.isRecording&&$a(c,a)}function g(c,d,e){var f,g=a.keyName(c);"Up"==g||"Down"==g?(f="Up"==g,d=ub.searchHistoryController.nextMatch(d,f)||"",e(d)):"Left"!=g&&"Right"!=g&&"Ctrl"!=g&&"Alt"!=g&&"Shift"!=g&&ub.searchHistoryController.reset();var h;try{h=Ma(b,d,!0,!0)}catch(a){}h?b.scrollIntoView(Pa(b,!i,h),30):(Qa(b),b.scrollTo(m.left,m.top))}function h(c,d,e){var f=a.keyName(c);"Esc"==f||"Ctrl-C"==f||"Ctrl-["==f||"Backspace"==f&&""==d?(ub.searchHistoryController.pushInput(d),ub.searchHistoryController.reset(),Ma(b,l),Qa(b),b.scrollTo(m.left,m.top),a.e_stop(c),A(b),e(),b.focus()):"Ctrl-U"==f&&(a.e_stop(c),e(""))}if(b.getSearchCursor){var i=d.searchArgs.forward,j=d.searchArgs.wholeWordOnly;Aa(b).setReversed(!i);var k=i?"/":"?",l=Aa(b).getQuery(),m=b.getScrollInfo();switch(d.searchArgs.querySrc){case"prompt":var n=ub.macroModeState;if(n.isPlaying){var o=n.replaySearchQueries.shift();e(o,!0,!1)}else Ka(b,{onClose:f,prefix:k,desc:Fb,onKeyUp:g,onKeyDown:h});break;case"wordUnderCursor":var p=ma(b,!1,!0,!1,!0),q=!0;if(p||(p=ma(b,!1,!0,!1,!1),q=!1),!p)return;var o=b.getLine(p.start.line).substring(p.start.ch,p.end.ch);o=q&&j?"\\b"+o+"\\b":Z(o),ub.jumpList.cachedCursor=b.getCursor(),b.setCursor(p.start),e(o,!0,!1)}}},processEx:function(b,c,d){function e(a){ub.exCommandHistoryController.pushInput(a),ub.exCommandHistoryController.reset(),Ib.processCommand(b,a)}function f(c,d,e){var f,g=a.keyName(c);("Esc"==g||"Ctrl-C"==g||"Ctrl-["==g||"Backspace"==g&&""==d)&&(ub.exCommandHistoryController.pushInput(d),ub.exCommandHistoryController.reset(),a.e_stop(c),A(b),e(),b.focus()),"Up"==g||"Down"==g?(f="Up"==g,d=ub.exCommandHistoryController.nextMatch(d,f)||"",e(d)):"Ctrl-U"==g?(a.e_stop(c),e("")):"Left"!=g&&"Right"!=g&&"Ctrl"!=g&&"Alt"!=g&&"Shift"!=g&&ub.exCommandHistoryController.reset()}"keyToEx"==d.type?Ib.processCommand(b,d.exArgs.input):c.visualMode?Ka(b,{onClose:e,prefix:":",value:"'<,'>",onKeyDown:f}):Ka(b,{onClose:e,prefix:":",onKeyDown:f})},evalInput:function(a,b){var c,e,f,g=b.inputState,h=g.motion,i=g.motionArgs||{},j=g.operator,k=g.operatorArgs||{},l=g.registerName,m=b.sel,n=R(b.visualMode?J(a,m.head):a.getCursor("head")),o=R(b.visualMode?J(a,m.anchor):a.getCursor("anchor")),p=R(n),q=R(o);if(j&&this.recordLastEdit(b,g),f=void 0!==g.repeatOverride?g.repeatOverride:g.getRepeat(),f>0&&i.explicitRepeat?i.repeatIsExplicit=!0:(i.noRepeat||!i.explicitRepeat&&0===f)&&(f=1,i.repeatIsExplicit=!1),g.selectedCharacter&&(i.selectedCharacter=k.selectedCharacter=g.selectedCharacter),i.repeat=f,A(a),h){var r=yb[h](a,n,i,b);if(b.lastMotion=yb[h],!r)return;if(i.toJumplist){var s=ub.jumpList,t=s.cachedCursor;t?(na(a,t,r),delete s.cachedCursor):na(a,n,r)}r instanceof Array?(e=r[0],c=r[1]):c=r,c||(c=R(n)),b.visualMode?(b.visualBlock&&c.ch===1/0||(c=J(a,c,b.visualBlock)),e&&(e=J(a,e,!0)),e=e||q,m.anchor=e,m.head=c,fa(a),ua(a,b,"<",T(e,c)?e:c),ua(a,b,">",T(e,c)?c:e)):j||(c=J(a,c),a.setCursor(c.line,c.ch))}if(j){if(k.lastSel){e=q;var u=k.lastSel,v=Math.abs(u.head.line-u.anchor.line),w=Math.abs(u.head.ch-u.anchor.ch);c=u.visualLine?d(q.line+v,q.ch):u.visualBlock?d(q.line+v,q.ch+w):u.head.line==u.anchor.line?d(q.line,q.ch+w):d(q.line+v,q.ch),b.visualMode=!0,b.visualLine=u.visualLine,b.visualBlock=u.visualBlock,m=b.sel={anchor:e,head:c},fa(a)}else b.visualMode&&(k.lastSel={anchor:R(m.anchor),head:R(m.head),visualBlock:b.visualBlock,visualLine:b.visualLine});var x,y,z,B,C;if(b.visualMode){if(x=U(m.head,m.anchor),y=V(m.head,m.anchor),z=b.visualLine||k.linewise,B=b.visualBlock?"block":z?"line":"char",C=ga(a,{anchor:x,head:y},B),z){var D=C.ranges;if("block"==B)for(var E=0;Ek&&f.line==k?this.moveToEol(a,b,c,e):(c.toFirstChar&&(g=la(a.getLine(i)),e.lastHPos=g),e.lastHSPos=a.charCoords(d(i,g),"div").left,d(i,g))},moveByDisplayLines:function(a,b,c,e){var f=b;switch(e.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:e.lastHSPos=a.charCoords(f,"div").left}var g=c.repeat,h=a.findPosV(f,c.forward?g:-g,"line",e.lastHSPos);if(h.hitSide)if(c.forward)var i=a.charCoords(h,"div"),j={top:i.top+8,left:e.lastHSPos},h=a.coordsChar(j,"div");else{var k=a.charCoords(d(a.firstLine(),0),"div");k.left=e.lastHSPos,h=a.coordsChar(k,"div")}return e.lastHPos=h.ch,h},moveByPage:function(a,b,c){var d=b,e=c.repeat;return a.findPosV(d,c.forward?e:-e,"page")},moveByParagraph:function(a,b,c){var d=c.forward?1:-1;return wa(a,b,c.repeat,d)},moveByScroll:function(a,b,c,d){var e=a.getScrollInfo(),f=null,g=c.repeat;g||(g=e.clientHeight/(2*a.defaultTextHeight()));var h=a.charCoords(b,"local");c.repeat=g;var f=yb.moveByDisplayLines(a,b,c,d);if(!f)return null;var i=a.charCoords(f,"local");return a.scrollTo(null,e.top+i.top-h.top),f},moveByWords:function(a,b,c){return ra(a,b,c.repeat,!!c.forward,!!c.wordEnd,!!c.bigWord)},moveTillCharacter:function(a,b,c){var d=c.repeat,e=sa(a,d,c.forward,c.selectedCharacter),f=c.forward?-1:1;return oa(f,c),e?(e.ch+=f,e):null},moveToCharacter:function(a,b,c){var d=c.repeat;return oa(0,c),sa(a,d,c.forward,c.selectedCharacter)||b},moveToSymbol:function(a,b,c){var d=c.repeat;return pa(a,d,c.forward,c.selectedCharacter)||b},moveToColumn:function(a,b,c,d){var e=c.repeat;return d.lastHPos=e-1,d.lastHSPos=a.charCoords(b,"div").left,ta(a,e)},moveToEol:function(a,b,c,e){var f=b;e.lastHPos=1/0;var g=d(f.line+c.repeat-1,1/0),h=a.clipPos(g);return h.ch--,e.lastHSPos=a.charCoords(h,"div").left,g},moveToFirstNonWhiteSpaceCharacter:function(a,b){var c=b;return d(c.line,la(a.getLine(c.line)))},moveToMatchedSymbol:function(a,b){var c,e=b,f=e.line,g=e.ch,h=a.getLine(f);do if(c=h.charAt(g++),c&&o(c)){var i=a.getTokenTypeAt(d(f,g));if("string"!==i&&"comment"!==i)break}while(c);if(c){var j=a.findMatchingBracket(d(f,g));return j.to}return e},moveToStartOfLine:function(a,b){return d(b.line,0)},moveToLineOrEdgeOfDocument:function(a,b,c){var e=c.forward?a.lastLine():a.firstLine();return c.repeatIsExplicit&&(e=c.repeat-a.getOption("firstLineNumber")),d(e,la(a.getLine(e)))},textObjectManipulation:function(a,b,c,d){var e={"(":")",")":"(","{":"}","}":"{","[":"]","]":"["},f={"'":!0,'"':!0},g=c.selectedCharacter;"b"==g?g="(":"B"==g&&(g="{");var h,i=!c.textObjectInner;if(e[g])h=xa(a,b,g,i);else if(f[g])h=ya(a,b,g,i);else if("W"===g)h=ma(a,i,!0,!0);else if("w"===g)h=ma(a,i,!0,!1);else{if("p"!==g)return null;if(h=wa(a,b,c.repeat,0,i),c.linewise=!0,d.visualMode)d.visualLine||(d.visualLine=!0);else{var j=d.inputState.operatorArgs;j&&(j.linewise=!0),h.end.line--}}return a.state.vim.visualMode?ea(a,h.start,h.end):[h.start,h.end]},repeatLastCharacterSearch:function(a,b,c){var d=ub.lastCharacterSearch,e=c.repeat,f=c.forward===d.forward,g=(d.increment?1:0)*(f?-1:1);a.moveH(-g,"char"),c.inclusive=!!f;var h=sa(a,e,f,d.selectedCharacter);return h?(h.ch+=g,h):(a.moveH(g,"char"),b)}},zb={change:function(b,c,e){var f,g,h=b.state.vim;if(ub.macroModeState.lastInsertModeChanges.inVisualBlock=h.visualBlock,h.visualMode){g=b.getSelection();var i=G("",e.length);b.replaceSelections(i),f=U(e[0].head,e[0].anchor)}else{var j=e[0].anchor,k=e[0].head;g=b.getRange(j,k);var l=h.lastEditInputState||{};if("moveByWords"==l.motion&&!r(g)){var m=/\s+$/.exec(g);m&&l.motionArgs&&l.motionArgs.forward&&(k=L(k,0,-m[0].length),g=g.slice(0,-m[0].length))}var n=new d(j.line-1,Number.MAX_VALUE),o=b.firstLine()==b.lastLine();k.line>b.lastLine()&&c.linewise&&!o?b.replaceRange("",n,k):b.replaceRange("",j,k),c.linewise&&(o||(b.setCursor(n),a.commands.newlineAndIndent(b)),j.ch=Number.MAX_VALUE),f=j}ub.registerController.pushText(c.registerName,"change",g,c.linewise,e.length>1),Ab.enterInsertMode(b,{head:f},b.state.vim)},delete:function(a,b,c){var e,f,g=a.state.vim;if(g.visualBlock){f=a.getSelection();var h=G("",c.length);a.replaceSelections(h),e=c[0].anchor}else{var i=c[0].anchor,j=c[0].head;b.linewise&&j.line!=a.firstLine()&&i.line==a.lastLine()&&i.line==j.line-1&&(i.line==a.firstLine()?i.ch=0:i=d(i.line-1,X(a,i.line-1))), f=a.getRange(i,j),a.replaceRange("",i,j),e=i,b.linewise&&(e=yb.moveToFirstNonWhiteSpaceCharacter(a,i))}return ub.registerController.pushText(b.registerName,"delete",f,b.linewise,g.visualBlock),J(a,e)},indent:function(a,b,c){var d=a.state.vim,e=c[0].anchor.line,f=d.visualBlock?c[c.length-1].anchor.line:c[0].head.line,g=d.visualMode?b.repeat:1;b.linewise&&f--;for(var h=e;h<=f;h++)for(var i=0;ij.top?(i.line+=(h-j.top)/e,i.line=Math.ceil(i.line),a.setCursor(i),j=a.charCoords(i,"local"),a.scrollTo(null,j.top)):a.scrollTo(null,h);else{var k=h+a.getScrollInfo().clientHeight;k=g.anchor.line?L(g.head,0,1):d(g.anchor.line,0);else if("inplace"==f&&e.visualMode)return;b.setOption("disableInput",!1),c&&c.replace?(b.toggleOverwrite(!0),b.setOption("keyMap","vim-replace"),a.signal(b,"vim-mode-change",{mode:"replace"})):(b.toggleOverwrite(!1),b.setOption("keyMap","vim-insert"),a.signal(b,"vim-mode-change",{mode:"insert"})),ub.macroModeState.isPlaying||(b.on("change",_a),a.on(b.getInputField(),"keydown",eb)),e.visualMode&&ia(b),aa(b,h,i)}},toggleVisualMode:function(b,c,e){var f,g=c.repeat,h=b.getCursor();e.visualMode?e.visualLine^c.linewise||e.visualBlock^c.blockwise?(e.visualLine=!!c.linewise,e.visualBlock=!!c.blockwise,a.signal(b,"vim-mode-change",{mode:"visual",subMode:e.visualLine?"linewise":e.visualBlock?"blockwise":""}),fa(b)):ia(b):(e.visualMode=!0,e.visualLine=!!c.linewise,e.visualBlock=!!c.blockwise,f=J(b,d(h.line,h.ch+g-1),!0),e.sel={anchor:h,head:f},a.signal(b,"vim-mode-change",{mode:"visual",subMode:e.visualLine?"linewise":e.visualBlock?"blockwise":""}),fa(b),ua(b,e,"<",U(h,f)),ua(b,e,">",V(h,f)))},reselectLastSelection:function(b,c,d){var e=d.lastSelection;if(d.visualMode&&da(b,d),e){var f=e.anchorMark.find(),g=e.headMark.find();if(!f||!g)return;d.sel={anchor:f,head:g},d.visualMode=!0,d.visualLine=e.visualLine,d.visualBlock=e.visualBlock,fa(b),ua(b,d,"<",U(f,g)),ua(b,d,">",V(f,g)),a.signal(b,"vim-mode-change",{mode:"visual",subMode:d.visualLine?"linewise":d.visualBlock?"blockwise":""})}},joinLines:function(a,b,c){var e,f;if(c.visualMode){if(e=a.getCursor("anchor"),f=a.getCursor("head"),T(f,e)){var g=f;f=e,e=g}f.ch=X(a,f.line)-1}else{var h=Math.max(b.repeat,2);e=a.getCursor(),f=J(a,d(e.line+h-1,1/0))}for(var i=0,j=e.line;j1)var g=Array(b.repeat+1).join(g);var o=f.linewise,p=f.blockwise;if(o)c.visualMode?g=c.visualLine?g.slice(0,-1):"\n"+g.slice(0,g.length-1)+"\n":b.after?(g="\n"+g.slice(0,g.length-1),e.ch=X(a,e.line)):e.ch=0;else{if(p){g=g.split("\n");for(var q=0;qa.lastLine()&&a.replaceRange("\n",d(A,0));var B=X(a,A);Bk.length&&(f=k.length),g=d(i.line,f)}if("\n"==h)e.visualMode||b.replaceRange("",i,g),(a.commands.newlineAndIndentContinueComment||a.commands.newlineAndIndent)(b);else{var l=b.getRange(i,g);if(l=l.replace(/[^\n]/g,h),e.visualBlock){var m=new Array(b.getOption("tabSize")+1).join(" ");l=b.getSelection(),l=l.replace(/\t/g,m).replace(/[^\n]/g,h).split("\n"),b.replaceSelections(l)}else b.replaceRange(l,i,g);e.visualMode?(i=T(j[0].anchor,j[0].head)?j[0].anchor:j[0].head,b.setCursor(i),ia(b,!1)):b.setCursor(L(g,0,-1))}},incrementNumberToken:function(a,b){for(var c,e,f,g,h,i=a.getCursor(),j=a.getLine(i.line),k=/-?\d+/g;null!==(c=k.exec(j))&&(h=c[0],e=c.index,f=e+h.length,!(i.ch=1)return!0}else a.nextCh===a.reverseSymb&&a.depth--;return!1}},section:{init:function(a){a.curMoveThrough=!0,a.symb=(a.forward?"]":"[")===a.symb?"{":"}"},isComplete:function(a){return 0===a.index&&a.nextCh===a.symb}},comment:{isComplete:function(a){var b="*"===a.lastCh&&"/"===a.nextCh;return a.lastCh=a.nextCh,b}},method:{init:function(a){a.symb="m"===a.symb?"{":"}",a.reverseSymb="{"===a.symb?"}":"{"},isComplete:function(a){return a.nextCh===a.symb}},preprocess:{init:function(a){a.index=0},isComplete:function(a){if("#"===a.nextCh){var b=a.lineText.match(/#(\w+)/)[1];if("endif"===b){if(a.forward&&0===a.depth)return!0;a.depth++}else if("if"===b){if(!a.forward&&0===a.depth)return!0;a.depth--}if("else"===b&&0===a.depth)return!0}return!1}}};t("pcre",!0,"boolean"),za.prototype={getQuery:function(){return ub.query},setQuery:function(a){ub.query=a},getOverlay:function(){return this.searchOverlay},setOverlay:function(a){this.searchOverlay=a},isReversed:function(){return ub.isReversed},setReversed:function(a){ub.isReversed=a},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(a){this.annotate=a}};var Db={"\\n":"\n","\\r":"\r","\\t":"\t"},Eb={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":"\t"},Fb="(Javascript regexp)",Gb=function(){this.buildCommandMap_()};Gb.prototype={processCommand:function(a,b,c){var d=this;a.operation((function(){a.curOp.isVimOp=!0,d._processCommand(a,b,c)}))},_processCommand:function(b,c,d){var e=b.state.vim,f=ub.registerController.getRegister(":"),g=f.toString();e.visualMode&&ia(b);var h=new a.StringStream(c);f.setText(c);var i=d||{};i.input=c;try{this.parseInput_(b,h,i)}catch(a){throw Ia(b,a),a}var j,k;if(i.commandName){if(j=this.matchCommand_(i.commandName)){if(k=j.name,j.excludeFromCommandHistory&&f.setText(g),this.parseCommandArgs_(h,i,j),"exToKey"==j.type){for(var l=0;l0;b--){var c=a.substring(0,b);if(this.commandMap_[c]){var d=this.commandMap_[c];if(0===d.name.indexOf(a))return d}}return null},buildCommandMap_:function(){this.commandMap_={};for(var a=0;a
    ";if(c){var f;c=c.join("");for(var g=0;g"}}else for(var f in d){var i=d[f].toString();i.length&&(e+='"'+f+" "+i+"
    ")}Ia(a,e)},sort:function(b,c){function e(){if(c.argString){var b=new a.StringStream(c.argString);if(b.eat("!")&&(g=!0),b.eol())return;if(!b.eatSpace())return"Invalid arguments";var d=b.match(/[a-z]+/);if(d){d=d[0],h=d.indexOf("i")!=-1,i=d.indexOf("u")!=-1;var e=d.indexOf("d")!=-1&&1,f=d.indexOf("x")!=-1&&1,k=d.indexOf("o")!=-1&&1;if(e+f+k>1)return"Invalid arguments";j=e&&"decimal"||f&&"hex"||k&&"octal"}if(b.match(/\/.*\//))return"patterns not supported"}}function f(a,b){if(g){var c;c=a,a=b,b=c}h&&(a=a.toLowerCase(),b=b.toLowerCase());var d=j&&q.exec(a),e=j&&q.exec(b);return d?(d=parseInt((d[1]+d[2]).toLowerCase(),r),e=parseInt((e[1]+e[2]).toLowerCase(),r),d-e):a")}if(!d)return void Ia(a,k);var n=0,o=function(){if(n=k)return void Ia(b,"Invalid argument: "+c.argString.substring(f));for(var l=0;l<=k-j;l++){var m=String.fromCharCode(j+l);delete d.marks[m]}}else delete d.marks[g]}}},Ib=new Gb;return a.keyMap.vim={attach:h,detach:g,call:i},t("insertModeEscKeysTimeout",200,"number"),a.keyMap["vim-insert"]={fallthrough:["default"],attach:h,detach:g,call:i},a.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:h,detach:g,call:i},y(),wb};a.Vim=e()})); \ No newline at end of file diff --git a/media/editors/codemirror/lib/codemirror.css b/media/editors/codemirror/lib/codemirror.css index 18b0bf70dbf23..d7821d17dfe3c 100644 --- a/media/editors/codemirror/lib/codemirror.css +++ b/media/editors/codemirror/lib/codemirror.css @@ -206,9 +206,6 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} display: inline-block; vertical-align: top; margin-bottom: -30px; - /* Hack to make IE7 behave */ - *zoom:1; - *display:inline; } .CodeMirror-gutter-wrapper { position: absolute; @@ -327,9 +324,6 @@ div.CodeMirror-dragcursors { background: rgba(255, 255, 0, .4); } -/* IE7 hack to prevent it from returning funny offsetTops on the spans */ -.CodeMirror span { *vertical-align: text-bottom; } - /* Used to force a border model for a node */ .cm-force-border { padding-right: .1px; } diff --git a/media/editors/codemirror/lib/codemirror.js b/media/editors/codemirror/lib/codemirror.js index 32d974398163f..c6f2d835233de 100644 --- a/media/editors/codemirror/lib/codemirror.js +++ b/media/editors/codemirror/lib/codemirror.js @@ -7,8958 +7,9089 @@ // You can find some technical background for some of the code below // at http://marijnhaverbeke.nl/blog/#cm-internals . -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - module.exports = mod(); - else if (typeof define == "function" && define.amd) // AMD - return define([], mod); - else // Plain browser env - (this || window).CodeMirror = mod(); -})(function() { - "use strict"; - - // BROWSER SNIFFING - - // Kludges for bugs and behavior differences that can't be feature - // detected are enabled based on userAgent etc sniffing. - var userAgent = navigator.userAgent; - var platform = navigator.platform; - - var gecko = /gecko\/\d/i.test(userAgent); - var ie_upto10 = /MSIE \d/.test(userAgent); - var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent); - var ie = ie_upto10 || ie_11up; - var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : ie_11up[1]); - var webkit = /WebKit\//.test(userAgent); - var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent); - var chrome = /Chrome\//.test(userAgent); - var presto = /Opera\//.test(userAgent); - var safari = /Apple Computer/.test(navigator.vendor); - var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent); - var phantom = /PhantomJS/.test(userAgent); - - var ios = /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent); - // This is woefully incomplete. Suggestions for alternative methods welcome. - var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent); - var mac = ios || /Mac/.test(platform); - var chromeOS = /\bCrOS\b/.test(userAgent); - var windows = /win/i.test(platform); - - var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/); - if (presto_version) presto_version = Number(presto_version[1]); - if (presto_version && presto_version >= 15) { presto = false; webkit = true; } - // Some browsers use the wrong event properties to signal cmd/ctrl on OS X - var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11)); - var captureRightClick = gecko || (ie && ie_version >= 9); - - // Optimize some code when these features are not used. - var sawReadOnlySpans = false, sawCollapsedSpans = false; - - // EDITOR CONSTRUCTOR - - // A CodeMirror instance represents an editor. This is the object - // that user code is usually dealing with. - - function CodeMirror(place, options) { - if (!(this instanceof CodeMirror)) return new CodeMirror(place, options); - - this.options = options = options ? copyObj(options) : {}; - // Determine effective options based on given values and defaults. - copyObj(defaults, options, false); - setGuttersForLineNumbers(options); - - var doc = options.value; - if (typeof doc == "string") doc = new Doc(doc, options.mode, null, options.lineSeparator); - this.doc = doc; - - var input = new CodeMirror.inputStyles[options.inputStyle](this); - var display = this.display = new Display(place, doc, input); - display.wrapper.CodeMirror = this; - updateGutters(this); - themeChanged(this); - if (options.lineWrapping) - this.display.wrapper.className += " CodeMirror-wrap"; - if (options.autofocus && !mobile) display.input.focus(); - initScrollbars(this); - - this.state = { - keyMaps: [], // stores maps added by addKeyMap - overlays: [], // highlighting overlays, as added by addOverlay - modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info - overwrite: false, - delayingBlurEvent: false, - focused: false, - suppressEdits: false, // used to disable editing during key handlers when in readOnly mode - pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll - selectingText: false, - draggingText: false, - highlight: new Delayed(), // stores highlight worker timeout - keySeq: null, // Unfinished key sequence - specialChars: null - }; - - var cm = this; - - // Override magic textarea content restore that IE sometimes does - // on our hidden textarea on reload - if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20); - - registerEventHandlers(this); - ensureGlobalHandlers(); - - startOperation(this); - this.curOp.forceUpdate = true; - attachDoc(this, doc); - - if ((options.autofocus && !mobile) || cm.hasFocus()) - setTimeout(bind(onFocus, this), 20); - else - onBlur(this); - - for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt)) - optionHandlers[opt](this, options[opt], Init); - maybeUpdateLineNumberWidth(this); - if (options.finishInit) options.finishInit(this); - for (var i = 0; i < initHooks.length; ++i) initHooks[i](this); - endOperation(this); - // Suppress optimizelegibility in Webkit, since it breaks text - // measuring on line wrapping boundaries. - if (webkit && options.lineWrapping && - getComputedStyle(display.lineDiv).textRendering == "optimizelegibility") - display.lineDiv.style.textRendering = "auto"; - } - - // DISPLAY CONSTRUCTOR - - // The display handles the DOM integration, both for input reading - // and content drawing. It holds references to DOM nodes and - // display-related state. - - function Display(place, doc, input) { - var d = this; - this.input = input; - - // Covers bottom-right square when both scrollbars are present. - d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler"); - d.scrollbarFiller.setAttribute("cm-not-content", "true"); - // Covers bottom of gutter when coverGutterNextToScrollbar is on - // and h scrollbar is present. - d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler"); - d.gutterFiller.setAttribute("cm-not-content", "true"); - // Will contain the actual code, positioned to cover the viewport. - d.lineDiv = elt("div", null, "CodeMirror-code"); - // Elements are added to these to represent selection and cursors. - d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1"); - d.cursorDiv = elt("div", null, "CodeMirror-cursors"); - // A visibility: hidden element used to find the size of things. - d.measure = elt("div", null, "CodeMirror-measure"); - // When lines outside of the viewport are measured, they are drawn in this. - d.lineMeasure = elt("div", null, "CodeMirror-measure"); - // Wraps everything that needs to exist inside the vertically-padded coordinate system - d.lineSpace = elt("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv], - null, "position: relative; outline: none"); - // Moved around its parent to cover visible view. - d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative"); - // Set to the height of the document, allowing scrolling. - d.sizer = elt("div", [d.mover], "CodeMirror-sizer"); - d.sizerWidth = null; - // Behavior of elts with overflow: auto and padding is - // inconsistent across browsers. This is used to ensure the - // scrollable area is big enough. - d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;"); - // Will contain the gutters, if any. - d.gutters = elt("div", null, "CodeMirror-gutters"); - d.lineGutter = null; - // Actual scrollable element. - d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll"); - d.scroller.setAttribute("tabIndex", "-1"); - // The element in which the editor lives. - d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror"); - - // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) - if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; } - if (!webkit && !(gecko && mobile)) d.scroller.draggable = true; - - if (place) { - if (place.appendChild) place.appendChild(d.wrapper); - else place(d.wrapper); - } - - // Current rendered range (may be bigger than the view window). - d.viewFrom = d.viewTo = doc.first; - d.reportedViewFrom = d.reportedViewTo = doc.first; - // Information about the rendered lines. - d.view = []; - d.renderedView = null; - // Holds info about a single rendered line when it was rendered - // for measurement, while not in view. - d.externalMeasured = null; - // Empty space (in pixels) above the view - d.viewOffset = 0; - d.lastWrapHeight = d.lastWrapWidth = 0; - d.updateLineNumbers = null; - - d.nativeBarWidth = d.barHeight = d.barWidth = 0; - d.scrollbarsClipped = false; - - // Used to only resize the line number gutter when necessary (when - // the amount of lines crosses a boundary that makes its width change) - d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null; - // Set to true when a non-horizontal-scrolling line widget is - // added. As an optimization, line widget aligning is skipped when - // this is false. - d.alignWidgets = false; - - d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; - - // Tracks the maximum line length so that the horizontal scrollbar - // can be kept static when scrolling. - d.maxLine = null; - d.maxLineLength = 0; - d.maxLineChanged = false; - - // Used for measuring wheel scrolling granularity - d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null; - - // True when shift is held down. - d.shift = false; - - // Used to track whether anything happened since the context menu - // was opened. - d.selForContextMenu = null; - - d.activeTouch = null; - - input.init(d); - } - - // STATE UPDATES - - // Used to get the editor into a consistent state again when options change. - - function loadMode(cm) { - cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption); - resetModeState(cm); - } - - function resetModeState(cm) { - cm.doc.iter(function(line) { - if (line.stateAfter) line.stateAfter = null; - if (line.styles) line.styles = null; - }); - cm.doc.frontier = cm.doc.first; - startWorker(cm, 100); - cm.state.modeGen++; - if (cm.curOp) regChange(cm); - } - - function wrappingChanged(cm) { - if (cm.options.lineWrapping) { - addClass(cm.display.wrapper, "CodeMirror-wrap"); - cm.display.sizer.style.minWidth = ""; - cm.display.sizerWidth = null; +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.CodeMirror = factory()); +}(this, (function () { 'use strict'; + +// Kludges for bugs and behavior differences that can't be feature +// detected are enabled based on userAgent etc sniffing. +var userAgent = navigator.userAgent +var platform = navigator.platform + +var gecko = /gecko\/\d/i.test(userAgent) +var ie_upto10 = /MSIE \d/.test(userAgent) +var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent) +var ie = ie_upto10 || ie_11up +var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : ie_11up[1]) +var webkit = /WebKit\//.test(userAgent) +var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent) +var chrome = /Chrome\//.test(userAgent) +var presto = /Opera\//.test(userAgent) +var safari = /Apple Computer/.test(navigator.vendor) +var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent) +var phantom = /PhantomJS/.test(userAgent) + +var ios = /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent) +// This is woefully incomplete. Suggestions for alternative methods welcome. +var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent) +var mac = ios || /Mac/.test(platform) +var chromeOS = /\bCrOS\b/.test(userAgent) +var windows = /win/i.test(platform) + +var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/) +if (presto_version) { presto_version = Number(presto_version[1]) } +if (presto_version && presto_version >= 15) { presto = false; webkit = true } +// Some browsers use the wrong event properties to signal cmd/ctrl on OS X +var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11)) +var captureRightClick = gecko || (ie && ie_version >= 9) + +function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") } + +var rmClass = function(node, cls) { + var current = node.className + var match = classTest(cls).exec(current) + if (match) { + var after = current.slice(match.index + match[0].length) + node.className = current.slice(0, match.index) + (after ? match[1] + after : "") + } +} + +function removeChildren(e) { + for (var count = e.childNodes.length; count > 0; --count) + { e.removeChild(e.firstChild) } + return e +} + +function removeChildrenAndAdd(parent, e) { + return removeChildren(parent).appendChild(e) +} + +function elt(tag, content, className, style) { + var e = document.createElement(tag) + if (className) { e.className = className } + if (style) { e.style.cssText = style } + if (typeof content == "string") { e.appendChild(document.createTextNode(content)) } + else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]) } } + return e +} + +var range +if (document.createRange) { range = function(node, start, end, endNode) { + var r = document.createRange() + r.setEnd(endNode || node, end) + r.setStart(node, start) + return r +} } +else { range = function(node, start, end) { + var r = document.body.createTextRange() + try { r.moveToElementText(node.parentNode) } + catch(e) { return r } + r.collapse(true) + r.moveEnd("character", end) + r.moveStart("character", start) + return r +} } + +function contains(parent, child) { + if (child.nodeType == 3) // Android browser always returns false when child is a textnode + { child = child.parentNode } + if (parent.contains) + { return parent.contains(child) } + do { + if (child.nodeType == 11) { child = child.host } + if (child == parent) { return true } + } while (child = child.parentNode) +} + +var activeElt = function() { + var activeElement = document.activeElement + while (activeElement && activeElement.root && activeElement.root.activeElement) + { activeElement = activeElement.root.activeElement } + return activeElement +} +// Older versions of IE throws unspecified error when touching +// document.activeElement in some cases (during loading, in iframe) +if (ie && ie_version < 11) { activeElt = function() { + try { return document.activeElement } + catch(e) { return document.body } +} } + +function addClass(node, cls) { + var current = node.className + if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls } +} +function joinClasses(a, b) { + var as = a.split(" ") + for (var i = 0; i < as.length; i++) + { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i] } } + return b +} + +var selectInput = function(node) { node.select() } +if (ios) // Mobile Safari apparently has a bug where select() is broken. + { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length } } +else if (ie) // Suppress mysterious IE10 errors + { selectInput = function(node) { try { node.select() } catch(_e) {} } } + +function bind(f) { + var args = Array.prototype.slice.call(arguments, 1) + return function(){return f.apply(null, args)} +} + +function copyObj(obj, target, overwrite) { + if (!target) { target = {} } + for (var prop in obj) + { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop))) + { target[prop] = obj[prop] } } + return target +} + +// Counts the column offset in a string, taking tabs into account. +// Used mostly to find indentation. +function countColumn(string, end, tabSize, startIndex, startValue) { + if (end == null) { + end = string.search(/[^\s\u00a0]/) + if (end == -1) { end = string.length } + } + for (var i = startIndex || 0, n = startValue || 0;;) { + var nextTab = string.indexOf("\t", i) + if (nextTab < 0 || nextTab >= end) + { return n + (end - i) } + n += nextTab - i + n += tabSize - (n % tabSize) + i = nextTab + 1 + } +} + +function Delayed() {this.id = null} +Delayed.prototype.set = function(ms, f) { + clearTimeout(this.id) + this.id = setTimeout(f, ms) +} + +function indexOf(array, elt) { + for (var i = 0; i < array.length; ++i) + { if (array[i] == elt) { return i } } + return -1 +} + +// Number of pixels added to scroller and sizer to hide scrollbar +var scrollerGap = 30 + +// Returned or thrown by various protocols to signal 'I'm not +// handling this'. +var Pass = {toString: function(){return "CodeMirror.Pass"}} + +// Reused option objects for setSelection & friends +var sel_dontScroll = {scroll: false}; +var sel_mouse = {origin: "*mouse"}; +var sel_move = {origin: "+move"}; +// The inverse of countColumn -- find the offset that corresponds to +// a particular column. +function findColumn(string, goal, tabSize) { + for (var pos = 0, col = 0;;) { + var nextTab = string.indexOf("\t", pos) + if (nextTab == -1) { nextTab = string.length } + var skipped = nextTab - pos + if (nextTab == string.length || col + skipped >= goal) + { return pos + Math.min(skipped, goal - col) } + col += nextTab - pos + col += tabSize - (col % tabSize) + pos = nextTab + 1 + if (col >= goal) { return pos } + } +} + +var spaceStrs = [""] +function spaceStr(n) { + while (spaceStrs.length <= n) + { spaceStrs.push(lst(spaceStrs) + " ") } + return spaceStrs[n] +} + +function lst(arr) { return arr[arr.length-1] } + +function map(array, f) { + var out = [] + for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i) } + return out +} + +function insertSorted(array, value, score) { + var pos = 0, priority = score(value) + while (pos < array.length && score(array[pos]) <= priority) { pos++ } + array.splice(pos, 0, value) +} + +function nothing() {} + +function createObj(base, props) { + var inst + if (Object.create) { + inst = Object.create(base) + } else { + nothing.prototype = base + inst = new nothing() + } + if (props) { copyObj(props, inst) } + return inst +} + +var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/ +function isWordCharBasic(ch) { + return /\w/.test(ch) || ch > "\x80" && + (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch)) +} +function isWordChar(ch, helper) { + if (!helper) { return isWordCharBasic(ch) } + if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true } + return helper.test(ch) +} + +function isEmpty(obj) { + for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } } + return true +} + +// Extending unicode characters. A series of a non-extending char + +// any number of extending chars is treated as a single unit as far +// as editing and measuring is concerned. This is not fully correct, +// since some scripts/fonts/browsers also treat other configurations +// of code points as a group. +var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/ +function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) } + +// The display handles the DOM integration, both for input reading +// and content drawing. It holds references to DOM nodes and +// display-related state. + +function Display(place, doc, input) { + var d = this + this.input = input + + // Covers bottom-right square when both scrollbars are present. + d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler") + d.scrollbarFiller.setAttribute("cm-not-content", "true") + // Covers bottom of gutter when coverGutterNextToScrollbar is on + // and h scrollbar is present. + d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler") + d.gutterFiller.setAttribute("cm-not-content", "true") + // Will contain the actual code, positioned to cover the viewport. + d.lineDiv = elt("div", null, "CodeMirror-code") + // Elements are added to these to represent selection and cursors. + d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1") + d.cursorDiv = elt("div", null, "CodeMirror-cursors") + // A visibility: hidden element used to find the size of things. + d.measure = elt("div", null, "CodeMirror-measure") + // When lines outside of the viewport are measured, they are drawn in this. + d.lineMeasure = elt("div", null, "CodeMirror-measure") + // Wraps everything that needs to exist inside the vertically-padded coordinate system + d.lineSpace = elt("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv], + null, "position: relative; outline: none") + // Moved around its parent to cover visible view. + d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative") + // Set to the height of the document, allowing scrolling. + d.sizer = elt("div", [d.mover], "CodeMirror-sizer") + d.sizerWidth = null + // Behavior of elts with overflow: auto and padding is + // inconsistent across browsers. This is used to ensure the + // scrollable area is big enough. + d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;") + // Will contain the gutters, if any. + d.gutters = elt("div", null, "CodeMirror-gutters") + d.lineGutter = null + // Actual scrollable element. + d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll") + d.scroller.setAttribute("tabIndex", "-1") + // The element in which the editor lives. + d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror") + + // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) + if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0 } + if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true } + + if (place) { + if (place.appendChild) { place.appendChild(d.wrapper) } + else { place(d.wrapper) } + } + + // Current rendered range (may be bigger than the view window). + d.viewFrom = d.viewTo = doc.first + d.reportedViewFrom = d.reportedViewTo = doc.first + // Information about the rendered lines. + d.view = [] + d.renderedView = null + // Holds info about a single rendered line when it was rendered + // for measurement, while not in view. + d.externalMeasured = null + // Empty space (in pixels) above the view + d.viewOffset = 0 + d.lastWrapHeight = d.lastWrapWidth = 0 + d.updateLineNumbers = null + + d.nativeBarWidth = d.barHeight = d.barWidth = 0 + d.scrollbarsClipped = false + + // Used to only resize the line number gutter when necessary (when + // the amount of lines crosses a boundary that makes its width change) + d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null + // Set to true when a non-horizontal-scrolling line widget is + // added. As an optimization, line widget aligning is skipped when + // this is false. + d.alignWidgets = false + + d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null + + // Tracks the maximum line length so that the horizontal scrollbar + // can be kept static when scrolling. + d.maxLine = null + d.maxLineLength = 0 + d.maxLineChanged = false + + // Used for measuring wheel scrolling granularity + d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null + + // True when shift is held down. + d.shift = false + + // Used to track whether anything happened since the context menu + // was opened. + d.selForContextMenu = null + + d.activeTouch = null + + input.init(d) +} + +// Find the line object corresponding to the given line number. +function getLine(doc, n) { + n -= doc.first + if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") } + var chunk = doc + while (!chunk.lines) { + for (var i = 0;; ++i) { + var child = chunk.children[i], sz = child.chunkSize() + if (n < sz) { chunk = child; break } + n -= sz + } + } + return chunk.lines[n] +} + +// Get the part of a document between two positions, as an array of +// strings. +function getBetween(doc, start, end) { + var out = [], n = start.line + doc.iter(start.line, end.line + 1, function (line) { + var text = line.text + if (n == end.line) { text = text.slice(0, end.ch) } + if (n == start.line) { text = text.slice(start.ch) } + out.push(text) + ++n + }) + return out +} +// Get the lines between from and to, as array of strings. +function getLines(doc, from, to) { + var out = [] + doc.iter(from, to, function (line) { out.push(line.text) }) // iter aborts when callback returns truthy value + return out +} + +// Update the height of a line, propagating the height change +// upwards to parent nodes. +function updateLineHeight(line, height) { + var diff = height - line.height + if (diff) { for (var n = line; n; n = n.parent) { n.height += diff } } +} + +// Given a line object, find its line number by walking up through +// its parent links. +function lineNo(line) { + if (line.parent == null) { return null } + var cur = line.parent, no = indexOf(cur.lines, line) + for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { + for (var i = 0;; ++i) { + if (chunk.children[i] == cur) { break } + no += chunk.children[i].chunkSize() + } + } + return no + cur.first +} + +// Find the line at the given vertical position, using the height +// information in the document tree. +function lineAtHeight(chunk, h) { + var n = chunk.first + outer: do { + for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) { + var child = chunk.children[i$1], ch = child.height + if (h < ch) { chunk = child; continue outer } + h -= ch + n += child.chunkSize() + } + return n + } while (!chunk.lines) + var i = 0 + for (; i < chunk.lines.length; ++i) { + var line = chunk.lines[i], lh = line.height + if (h < lh) { break } + h -= lh + } + return n + i +} + +function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size} + +function lineNumberFor(options, i) { + return String(options.lineNumberFormatter(i + options.firstLineNumber)) +} + +// A Pos instance represents a position within the text. +function Pos (line, ch) { + if (!(this instanceof Pos)) { return new Pos(line, ch) } + this.line = line; this.ch = ch +} + +// Compare two positions, return 0 if they are the same, a negative +// number when a is less, and a positive number otherwise. +function cmp(a, b) { return a.line - b.line || a.ch - b.ch } + +function copyPos(x) {return Pos(x.line, x.ch)} +function maxPos(a, b) { return cmp(a, b) < 0 ? b : a } +function minPos(a, b) { return cmp(a, b) < 0 ? a : b } + +// Most of the external API clips given positions to make sure they +// actually exist within the document. +function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))} +function clipPos(doc, pos) { + if (pos.line < doc.first) { return Pos(doc.first, 0) } + var last = doc.first + doc.size - 1 + if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) } + return clipToLen(pos, getLine(doc, pos.line).text.length) +} +function clipToLen(pos, linelen) { + var ch = pos.ch + if (ch == null || ch > linelen) { return Pos(pos.line, linelen) } + else if (ch < 0) { return Pos(pos.line, 0) } + else { return pos } +} +function clipPosArray(doc, array) { + var out = [] + for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]) } + return out +} + +// Optimize some code when these features are not used. +var sawReadOnlySpans = false; +var sawCollapsedSpans = false; +function seeReadOnlySpans() { + sawReadOnlySpans = true +} + +function seeCollapsedSpans() { + sawCollapsedSpans = true +} + +// TEXTMARKER SPANS + +function MarkedSpan(marker, from, to) { + this.marker = marker + this.from = from; this.to = to +} + +// Search an array of spans for a span matching the given marker. +function getMarkedSpanFor(spans, marker) { + if (spans) { for (var i = 0; i < spans.length; ++i) { + var span = spans[i] + if (span.marker == marker) { return span } + } } +} +// Remove a span from an array, returning undefined if no spans are +// left (we don't store arrays for lines without spans). +function removeMarkedSpan(spans, span) { + var r + for (var i = 0; i < spans.length; ++i) + { if (spans[i] != span) { (r || (r = [])).push(spans[i]) } } + return r +} +// Add a span to a line. +function addMarkedSpan(line, span) { + line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span] + span.marker.attachLine(line) +} + +// Used for the algorithm that adjusts markers for a change in the +// document. These functions cut an array of spans at a given +// character position, returning an array of remaining chunks (or +// undefined if nothing remains). +function markedSpansBefore(old, startCh, isInsert) { + var nw + if (old) { for (var i = 0; i < old.length; ++i) { + var span = old[i], marker = span.marker + var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh) + if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) { + var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh) + ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to)) + } + } } + return nw +} +function markedSpansAfter(old, endCh, isInsert) { + var nw + if (old) { for (var i = 0; i < old.length; ++i) { + var span = old[i], marker = span.marker + var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh) + if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) { + var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh) + ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh, + span.to == null ? null : span.to - endCh)) + } + } } + return nw +} + +// Given a change object, compute the new set of marker spans that +// cover the line in which the change took place. Removes spans +// entirely within the change, reconnects spans belonging to the +// same marker that appear on both sides of the change, and cuts off +// spans partially within the change. Returns an array of span +// arrays with one element for each line in (after) the change. +function stretchSpansOverChange(doc, change) { + if (change.full) { return null } + var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans + var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans + if (!oldFirst && !oldLast) { return null } + + var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0 + // Get the spans that 'stick out' on both sides + var first = markedSpansBefore(oldFirst, startCh, isInsert) + var last = markedSpansAfter(oldLast, endCh, isInsert) + + // Next, merge those two ends + var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0) + if (first) { + // Fix up .to properties of first + for (var i = 0; i < first.length; ++i) { + var span = first[i] + if (span.to == null) { + var found = getMarkedSpanFor(last, span.marker) + if (!found) { span.to = startCh } + else if (sameLine) { span.to = found.to == null ? null : found.to + offset } + } + } + } + if (last) { + // Fix up .from in last (or move them into first in case of sameLine) + for (var i$1 = 0; i$1 < last.length; ++i$1) { + var span$1 = last[i$1] + if (span$1.to != null) { span$1.to += offset } + if (span$1.from == null) { + var found$1 = getMarkedSpanFor(first, span$1.marker) + if (!found$1) { + span$1.from = offset + if (sameLine) { (first || (first = [])).push(span$1) } + } + } else { + span$1.from += offset + if (sameLine) { (first || (first = [])).push(span$1) } + } + } + } + // Make sure we didn't create any zero-length spans + if (first) { first = clearEmptySpans(first) } + if (last && last != first) { last = clearEmptySpans(last) } + + var newMarkers = [first] + if (!sameLine) { + // Fill gap with whole-line-spans + var gap = change.text.length - 2, gapMarkers + if (gap > 0 && first) + { for (var i$2 = 0; i$2 < first.length; ++i$2) + { if (first[i$2].to == null) + { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)) } } } + for (var i$3 = 0; i$3 < gap; ++i$3) + { newMarkers.push(gapMarkers) } + newMarkers.push(last) + } + return newMarkers +} + +// Remove spans that are empty and don't have a clearWhenEmpty +// option of false. +function clearEmptySpans(spans) { + for (var i = 0; i < spans.length; ++i) { + var span = spans[i] + if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) + { spans.splice(i--, 1) } + } + if (!spans.length) { return null } + return spans +} + +// Used to 'clip' out readOnly ranges when making a change. +function removeReadOnlyRanges(doc, from, to) { + var markers = null + doc.iter(from.line, to.line + 1, function (line) { + if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) { + var mark = line.markedSpans[i].marker + if (mark.readOnly && (!markers || indexOf(markers, mark) == -1)) + { (markers || (markers = [])).push(mark) } + } } + }) + if (!markers) { return null } + var parts = [{from: from, to: to}] + for (var i = 0; i < markers.length; ++i) { + var mk = markers[i], m = mk.find(0) + for (var j = 0; j < parts.length; ++j) { + var p = parts[j] + if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue } + var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to) + if (dfrom < 0 || !mk.inclusiveLeft && !dfrom) + { newParts.push({from: p.from, to: m.from}) } + if (dto > 0 || !mk.inclusiveRight && !dto) + { newParts.push({from: m.to, to: p.to}) } + parts.splice.apply(parts, newParts) + j += newParts.length - 1 + } + } + return parts +} + +// Connect or disconnect spans from a line. +function detachMarkedSpans(line) { + var spans = line.markedSpans + if (!spans) { return } + for (var i = 0; i < spans.length; ++i) + { spans[i].marker.detachLine(line) } + line.markedSpans = null +} +function attachMarkedSpans(line, spans) { + if (!spans) { return } + for (var i = 0; i < spans.length; ++i) + { spans[i].marker.attachLine(line) } + line.markedSpans = spans +} + +// Helpers used when computing which overlapping collapsed span +// counts as the larger one. +function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 } +function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 } + +// Returns a number indicating which of two overlapping collapsed +// spans is larger (and thus includes the other). Falls back to +// comparing ids when the spans cover exactly the same range. +function compareCollapsedMarkers(a, b) { + var lenDiff = a.lines.length - b.lines.length + if (lenDiff != 0) { return lenDiff } + var aPos = a.find(), bPos = b.find() + var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b) + if (fromCmp) { return -fromCmp } + var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b) + if (toCmp) { return toCmp } + return b.id - a.id +} + +// Find out whether a line ends or starts in a collapsed span. If +// so, return the marker for that span. +function collapsedSpanAtSide(line, start) { + var sps = sawCollapsedSpans && line.markedSpans, found + if (sps) { for (var sp = void 0, i = 0; i < sps.length; ++i) { + sp = sps[i] + if (sp.marker.collapsed && (start ? sp.from : sp.to) == null && + (!found || compareCollapsedMarkers(found, sp.marker) < 0)) + { found = sp.marker } + } } + return found +} +function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) } +function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) } + +// Test whether there exists a collapsed span that partially +// overlaps (covers the start or end, but not both) of a new span. +// Such overlap is not allowed. +function conflictingCollapsedRange(doc, lineNo, from, to, marker) { + var line = getLine(doc, lineNo) + var sps = sawCollapsedSpans && line.markedSpans + if (sps) { for (var i = 0; i < sps.length; ++i) { + var sp = sps[i] + if (!sp.marker.collapsed) { continue } + var found = sp.marker.find(0) + var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker) + var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker) + if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue } + if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) || + fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0)) + { return true } + } } +} + +// A visual line is a line as drawn on the screen. Folding, for +// example, can cause multiple logical lines to appear on the same +// visual line. This finds the start of the visual line that the +// given line is part of (usually that is the line itself). +function visualLine(line) { + var merged + while (merged = collapsedSpanAtStart(line)) + { line = merged.find(-1, true).line } + return line +} + +// Returns an array of logical lines that continue the visual line +// started by the argument, or undefined if there are no such lines. +function visualLineContinued(line) { + var merged, lines + while (merged = collapsedSpanAtEnd(line)) { + line = merged.find(1, true).line + ;(lines || (lines = [])).push(line) + } + return lines +} + +// Get the line number of the start of the visual line that the +// given line number is part of. +function visualLineNo(doc, lineN) { + var line = getLine(doc, lineN), vis = visualLine(line) + if (line == vis) { return lineN } + return lineNo(vis) +} + +// Get the line number of the start of the next visual line after +// the given line. +function visualLineEndNo(doc, lineN) { + if (lineN > doc.lastLine()) { return lineN } + var line = getLine(doc, lineN), merged + if (!lineIsHidden(doc, line)) { return lineN } + while (merged = collapsedSpanAtEnd(line)) + { line = merged.find(1, true).line } + return lineNo(line) + 1 +} + +// Compute whether a line is hidden. Lines count as hidden when they +// are part of a visual line that starts with another line, or when +// they are entirely covered by collapsed, non-widget span. +function lineIsHidden(doc, line) { + var sps = sawCollapsedSpans && line.markedSpans + if (sps) { for (var sp = void 0, i = 0; i < sps.length; ++i) { + sp = sps[i] + if (!sp.marker.collapsed) { continue } + if (sp.from == null) { return true } + if (sp.marker.widgetNode) { continue } + if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp)) + { return true } + } } +} +function lineIsHiddenInner(doc, line, span) { + if (span.to == null) { + var end = span.marker.find(1, true) + return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker)) + } + if (span.marker.inclusiveRight && span.to == line.text.length) + { return true } + for (var sp = void 0, i = 0; i < line.markedSpans.length; ++i) { + sp = line.markedSpans[i] + if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to && + (sp.to == null || sp.to != span.from) && + (sp.marker.inclusiveLeft || span.marker.inclusiveRight) && + lineIsHiddenInner(doc, line, sp)) { return true } + } +} + +// Find the height above the given line. +function heightAtLine(lineObj) { + lineObj = visualLine(lineObj) + + var h = 0, chunk = lineObj.parent + for (var i = 0; i < chunk.lines.length; ++i) { + var line = chunk.lines[i] + if (line == lineObj) { break } + else { h += line.height } + } + for (var p = chunk.parent; p; chunk = p, p = chunk.parent) { + for (var i$1 = 0; i$1 < p.children.length; ++i$1) { + var cur = p.children[i$1] + if (cur == chunk) { break } + else { h += cur.height } + } + } + return h +} + +// Compute the character length of a line, taking into account +// collapsed ranges (see markText) that might hide parts, and join +// other lines onto it. +function lineLength(line) { + if (line.height == 0) { return 0 } + var len = line.text.length, merged, cur = line + while (merged = collapsedSpanAtStart(cur)) { + var found = merged.find(0, true) + cur = found.from.line + len += found.from.ch - found.to.ch + } + cur = line + while (merged = collapsedSpanAtEnd(cur)) { + var found$1 = merged.find(0, true) + len -= cur.text.length - found$1.from.ch + cur = found$1.to.line + len += cur.text.length - found$1.to.ch + } + return len +} + +// Find the longest line in the document. +function findMaxLine(cm) { + var d = cm.display, doc = cm.doc + d.maxLine = getLine(doc, doc.first) + d.maxLineLength = lineLength(d.maxLine) + d.maxLineChanged = true + doc.iter(function (line) { + var len = lineLength(line) + if (len > d.maxLineLength) { + d.maxLineLength = len + d.maxLine = line + } + }) +} + +// BIDI HELPERS + +function iterateBidiSections(order, from, to, f) { + if (!order) { return f(from, to, "ltr") } + var found = false + for (var i = 0; i < order.length; ++i) { + var part = order[i] + if (part.from < to && part.to > from || from == to && part.to == from) { + f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr") + found = true + } + } + if (!found) { f(from, to, "ltr") } +} + +function bidiLeft(part) { return part.level % 2 ? part.to : part.from } +function bidiRight(part) { return part.level % 2 ? part.from : part.to } + +function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0 } +function lineRight(line) { + var order = getOrder(line) + if (!order) { return line.text.length } + return bidiRight(lst(order)) +} + +function compareBidiLevel(order, a, b) { + var linedir = order[0].level + if (a == linedir) { return true } + if (b == linedir) { return false } + return a < b +} + +var bidiOther = null +function getBidiPartAt(order, pos) { + var found + bidiOther = null + for (var i = 0; i < order.length; ++i) { + var cur = order[i] + if (cur.from < pos && cur.to > pos) { return i } + if ((cur.from == pos || cur.to == pos)) { + if (found == null) { + found = i + } else if (compareBidiLevel(order, cur.level, order[found].level)) { + if (cur.from != cur.to) { bidiOther = found } + return i + } else { + if (cur.from != cur.to) { bidiOther = i } + return found + } + } + } + return found +} + +function moveInLine(line, pos, dir, byUnit) { + if (!byUnit) { return pos + dir } + do { pos += dir } + while (pos > 0 && isExtendingChar(line.text.charAt(pos))) + return pos +} + +// This is needed in order to move 'visually' through bi-directional +// text -- i.e., pressing left should make the cursor go left, even +// when in RTL text. The tricky part is the 'jumps', where RTL and +// LTR text touch each other. This often requires the cursor offset +// to move more than one unit, in order to visually move one unit. +function moveVisually(line, start, dir, byUnit) { + var bidi = getOrder(line) + if (!bidi) { return moveLogically(line, start, dir, byUnit) } + var pos = getBidiPartAt(bidi, start), part = bidi[pos] + var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit) + + for (;;) { + if (target > part.from && target < part.to) { return target } + if (target == part.from || target == part.to) { + if (getBidiPartAt(bidi, target) == pos) { return target } + part = bidi[pos += dir] + return (dir > 0) == part.level % 2 ? part.to : part.from } else { - rmClass(cm.display.wrapper, "CodeMirror-wrap"); - findMaxLine(cm); - } - estimateLineHeights(cm); - regChange(cm); - clearCaches(cm); - setTimeout(function(){updateScrollbars(cm);}, 100); - } - - // Returns a function that estimates the height of a line, to use as - // first approximation until the line becomes visible (and is thus - // properly measurable). - function estimateHeight(cm) { - var th = textHeight(cm.display), wrapping = cm.options.lineWrapping; - var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3); - return function(line) { - if (lineIsHidden(cm.doc, line)) return 0; - - var widgetsHeight = 0; - if (line.widgets) for (var i = 0; i < line.widgets.length; i++) { - if (line.widgets[i].height) widgetsHeight += line.widgets[i].height; - } - - if (wrapping) - return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th; + part = bidi[pos += dir] + if (!part) { return null } + if ((dir > 0) == part.level % 2) + { target = moveInLine(line, part.to, -1, byUnit) } else - return widgetsHeight + th; - }; - } - - function estimateLineHeights(cm) { - var doc = cm.doc, est = estimateHeight(cm); - doc.iter(function(line) { - var estHeight = est(line); - if (estHeight != line.height) updateLineHeight(line, estHeight); - }); - } - - function themeChanged(cm) { - cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") + - cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-"); - clearCaches(cm); - } - - function guttersChanged(cm) { - updateGutters(cm); - regChange(cm); - setTimeout(function(){alignHorizontally(cm);}, 20); - } - - // Rebuild the gutter elements, ensure the margin to the left of the - // code matches their width. - function updateGutters(cm) { - var gutters = cm.display.gutters, specs = cm.options.gutters; - removeChildren(gutters); - for (var i = 0; i < specs.length; ++i) { - var gutterClass = specs[i]; - var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass)); - if (gutterClass == "CodeMirror-linenumbers") { - cm.display.lineGutter = gElt; - gElt.style.width = (cm.display.lineNumWidth || 1) + "px"; - } - } - gutters.style.display = i ? "" : "none"; - updateGutterSpace(cm); - } - - function updateGutterSpace(cm) { - var width = cm.display.gutters.offsetWidth; - cm.display.sizer.style.marginLeft = width + "px"; - } - - // Compute the character length of a line, taking into account - // collapsed ranges (see markText) that might hide parts, and join - // other lines onto it. - function lineLength(line) { - if (line.height == 0) return 0; - var len = line.text.length, merged, cur = line; - while (merged = collapsedSpanAtStart(cur)) { - var found = merged.find(0, true); - cur = found.from.line; - len += found.from.ch - found.to.ch; - } - cur = line; - while (merged = collapsedSpanAtEnd(cur)) { - var found = merged.find(0, true); - len -= cur.text.length - found.from.ch; - cur = found.to.line; - len += cur.text.length - found.to.ch; - } - return len; - } - - // Find the longest line in the document. - function findMaxLine(cm) { - var d = cm.display, doc = cm.doc; - d.maxLine = getLine(doc, doc.first); - d.maxLineLength = lineLength(d.maxLine); - d.maxLineChanged = true; - doc.iter(function(line) { - var len = lineLength(line); - if (len > d.maxLineLength) { - d.maxLineLength = len; - d.maxLine = line; - } - }); - } - - // Make sure the gutters options contains the element - // "CodeMirror-linenumbers" when the lineNumbers option is true. - function setGuttersForLineNumbers(options) { - var found = indexOf(options.gutters, "CodeMirror-linenumbers"); - if (found == -1 && options.lineNumbers) { - options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]); - } else if (found > -1 && !options.lineNumbers) { - options.gutters = options.gutters.slice(0); - options.gutters.splice(found, 1); - } - } - - // SCROLLBARS - - // Prepare DOM reads needed to update the scrollbars. Done in one - // shot to minimize update/measure roundtrips. - function measureForScrollbars(cm) { - var d = cm.display, gutterW = d.gutters.offsetWidth; - var docH = Math.round(cm.doc.height + paddingVert(cm.display)); - return { - clientHeight: d.scroller.clientHeight, - viewHeight: d.wrapper.clientHeight, - scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth, - viewWidth: d.wrapper.clientWidth, - barLeft: cm.options.fixedGutter ? gutterW : 0, - docHeight: docH, - scrollHeight: docH + scrollGap(cm) + d.barHeight, - nativeBarWidth: d.nativeBarWidth, - gutterWidth: gutterW - }; - } - - function NativeScrollbars(place, scroll, cm) { - this.cm = cm; - var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar"); - var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar"); - place(vert); place(horiz); - - on(vert, "scroll", function() { - if (vert.clientHeight) scroll(vert.scrollTop, "vertical"); - }); - on(horiz, "scroll", function() { - if (horiz.clientWidth) scroll(horiz.scrollLeft, "horizontal"); - }); - - this.checkedZeroWidth = false; - // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). - if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; - } - - NativeScrollbars.prototype = copyObj({ - update: function(measure) { - var needsH = measure.scrollWidth > measure.clientWidth + 1; - var needsV = measure.scrollHeight > measure.clientHeight + 1; - var sWidth = measure.nativeBarWidth; - - if (needsV) { - this.vert.style.display = "block"; - this.vert.style.bottom = needsH ? sWidth + "px" : "0"; - var totalHeight = measure.viewHeight - (needsH ? sWidth : 0); - // A bug in IE8 can cause this value to be negative, so guard it. - this.vert.firstChild.style.height = - Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"; + { target = moveInLine(line, part.from, 1, byUnit) } + } + } +} + +function moveLogically(line, start, dir, byUnit) { + var target = start + dir + if (byUnit) { while (target > 0 && isExtendingChar(line.text.charAt(target))) { target += dir } } + return target < 0 || target > line.text.length ? null : target +} + +// Bidirectional ordering algorithm +// See http://unicode.org/reports/tr9/tr9-13.html for the algorithm +// that this (partially) implements. + +// One-char codes used for character types: +// L (L): Left-to-Right +// R (R): Right-to-Left +// r (AL): Right-to-Left Arabic +// 1 (EN): European Number +// + (ES): European Number Separator +// % (ET): European Number Terminator +// n (AN): Arabic Number +// , (CS): Common Number Separator +// m (NSM): Non-Spacing Mark +// b (BN): Boundary Neutral +// s (B): Paragraph Separator +// t (S): Segment Separator +// w (WS): Whitespace +// N (ON): Other Neutrals + +// Returns null if characters are ordered as they appear +// (left-to-right), or an array of sections ({from, to, level} +// objects) in the order in which they occur visually. +var bidiOrdering = (function() { + // Character types for codepoints 0 to 0xff + var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN" + // Character types for codepoints 0x600 to 0x6ff + var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm" + function charType(code) { + if (code <= 0xf7) { return lowTypes.charAt(code) } + else if (0x590 <= code && code <= 0x5f4) { return "R" } + else if (0x600 <= code && code <= 0x6ed) { return arabicTypes.charAt(code - 0x600) } + else if (0x6ee <= code && code <= 0x8ac) { return "r" } + else if (0x2000 <= code && code <= 0x200b) { return "w" } + else if (code == 0x200c) { return "b" } + else { return "L" } + } + + var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/ + var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/ + // Browsers seem to always treat the boundaries of block elements as being L. + var outerType = "L" + + function BidiSpan(level, from, to) { + this.level = level + this.from = from; this.to = to + } + + return function(str) { + if (!bidiRE.test(str)) { return false } + var len = str.length, types = [] + for (var i = 0; i < len; ++i) + { types.push(charType(str.charCodeAt(i))) } + + // W1. Examine each non-spacing mark (NSM) in the level run, and + // change the type of the NSM to the type of the previous + // character. If the NSM is at the start of the level run, it will + // get the type of sor. + for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) { + var type = types[i$1] + if (type == "m") { types[i$1] = prev } + else { prev = type } + } + + // W2. Search backwards from each instance of a European number + // until the first strong type (R, L, AL, or sor) is found. If an + // AL is found, change the type of the European number to Arabic + // number. + // W3. Change all ALs to R. + for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) { + var type$1 = types[i$2] + if (type$1 == "1" && cur == "r") { types[i$2] = "n" } + else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R" } } + } + + // W4. A single European separator between two European numbers + // changes to a European number. A single common separator between + // two numbers of the same type changes to that type. + for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) { + var type$2 = types[i$3] + if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1" } + else if (type$2 == "," && prev$1 == types[i$3+1] && + (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1 } + prev$1 = type$2 + } + + // W5. A sequence of European terminators adjacent to European + // numbers changes to all European numbers. + // W6. Otherwise, separators and terminators change to Other + // Neutral. + for (var i$4 = 0; i$4 < len; ++i$4) { + var type$3 = types[i$4] + if (type$3 == ",") { types[i$4] = "N" } + else if (type$3 == "%") { + var end = void 0 + for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {} + var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N" + for (var j = i$4; j < end; ++j) { types[j] = replace } + i$4 = end - 1 + } + } + + // W7. Search backwards from each instance of a European number + // until the first strong type (R, L, or sor) is found. If an L is + // found, then change the type of the European number to L. + for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) { + var type$4 = types[i$5] + if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L" } + else if (isStrong.test(type$4)) { cur$1 = type$4 } + } + + // N1. A sequence of neutrals takes the direction of the + // surrounding strong text if the text on both sides has the same + // direction. European and Arabic numbers act as if they were R in + // terms of their influence on neutrals. Start-of-level-run (sor) + // and end-of-level-run (eor) are used at level run boundaries. + // N2. Any remaining neutrals take the embedding direction. + for (var i$6 = 0; i$6 < len; ++i$6) { + if (isNeutral.test(types[i$6])) { + var end$1 = void 0 + for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {} + var before = (i$6 ? types[i$6-1] : outerType) == "L" + var after = (end$1 < len ? types[end$1] : outerType) == "L" + var replace$1 = before || after ? "L" : "R" + for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1 } + i$6 = end$1 - 1 + } + } + + // Here we depart from the documented algorithm, in order to avoid + // building up an actual levels array. Since there are only three + // levels (0, 1, 2) in an implementation that doesn't take + // explicit embedding into account, we can build up the order on + // the fly, without following the level-based algorithm. + var order = [], m + for (var i$7 = 0; i$7 < len;) { + if (countsAsLeft.test(types[i$7])) { + var start = i$7 + for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {} + order.push(new BidiSpan(0, start, i$7)) } else { - this.vert.style.display = ""; - this.vert.firstChild.style.height = "0"; + var pos = i$7, at = order.length + for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {} + for (var j$2 = pos; j$2 < i$7;) { + if (countsAsNum.test(types[j$2])) { + if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)) } + var nstart = j$2 + for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {} + order.splice(at, 0, new BidiSpan(2, nstart, j$2)) + pos = j$2 + } else { ++j$2 } + } + if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)) } + } + } + if (order[0].level == 1 && (m = str.match(/^\s+/))) { + order[0].from = m[0].length + order.unshift(new BidiSpan(0, 0, m[0].length)) + } + if (lst(order).level == 1 && (m = str.match(/\s+$/))) { + lst(order).to -= m[0].length + order.push(new BidiSpan(0, len - m[0].length, len)) + } + if (order[0].level == 2) + { order.unshift(new BidiSpan(1, order[0].to, order[0].to)) } + if (order[0].level != lst(order).level) + { order.push(new BidiSpan(order[0].level, len, len)) } + + return order + } +})() + +// Get the bidi ordering for the given line (and cache it). Returns +// false for lines that are fully left-to-right, and an array of +// BidiSpan objects otherwise. +function getOrder(line) { + var order = line.order + if (order == null) { order = line.order = bidiOrdering(line.text) } + return order +} + +// EVENT HANDLING + +// Lightweight event framework. on/off also work on DOM nodes, +// registering native DOM handlers. + +var on = function(emitter, type, f) { + if (emitter.addEventListener) + { emitter.addEventListener(type, f, false) } + else if (emitter.attachEvent) + { emitter.attachEvent("on" + type, f) } + else { + var map = emitter._handlers || (emitter._handlers = {}) + var arr = map[type] || (map[type] = []) + arr.push(f) + } +} + +var noHandlers = [] +function getHandlers(emitter, type, copy) { + var arr = emitter._handlers && emitter._handlers[type] + if (copy) { return arr && arr.length > 0 ? arr.slice() : noHandlers } + else { return arr || noHandlers } +} + +function off(emitter, type, f) { + if (emitter.removeEventListener) + { emitter.removeEventListener(type, f, false) } + else if (emitter.detachEvent) + { emitter.detachEvent("on" + type, f) } + else { + var handlers = getHandlers(emitter, type, false) + for (var i = 0; i < handlers.length; ++i) + { if (handlers[i] == f) { handlers.splice(i, 1); break } } + } +} + +function signal(emitter, type /*, values...*/) { + var handlers = getHandlers(emitter, type, true) + if (!handlers.length) { return } + var args = Array.prototype.slice.call(arguments, 2) + for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args) } +} + +// The DOM events that CodeMirror handles can be overridden by +// registering a (non-DOM) handler on the editor for the event name, +// and preventDefault-ing the event in that handler. +function signalDOMEvent(cm, e, override) { + if (typeof e == "string") + { e = {type: e, preventDefault: function() { this.defaultPrevented = true }} } + signal(cm, override || e.type, cm, e) + return e_defaultPrevented(e) || e.codemirrorIgnore +} + +function signalCursorActivity(cm) { + var arr = cm._handlers && cm._handlers.cursorActivity + if (!arr) { return } + var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []) + for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1) + { set.push(arr[i]) } } +} + +function hasHandler(emitter, type) { + return getHandlers(emitter, type).length > 0 +} + +// Add on and off methods to a constructor's prototype, to make +// registering events on such objects more convenient. +function eventMixin(ctor) { + ctor.prototype.on = function(type, f) {on(this, type, f)} + ctor.prototype.off = function(type, f) {off(this, type, f)} +} + +// Due to the fact that we still support jurassic IE versions, some +// compatibility wrappers are needed. + +function e_preventDefault(e) { + if (e.preventDefault) { e.preventDefault() } + else { e.returnValue = false } +} +function e_stopPropagation(e) { + if (e.stopPropagation) { e.stopPropagation() } + else { e.cancelBubble = true } +} +function e_defaultPrevented(e) { + return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false +} +function e_stop(e) {e_preventDefault(e); e_stopPropagation(e)} + +function e_target(e) {return e.target || e.srcElement} +function e_button(e) { + var b = e.which + if (b == null) { + if (e.button & 1) { b = 1 } + else if (e.button & 2) { b = 3 } + else if (e.button & 4) { b = 2 } + } + if (mac && e.ctrlKey && b == 1) { b = 3 } + return b +} + +// Detect drag-and-drop +var dragAndDrop = function() { + // There is *some* kind of drag-and-drop support in IE6-8, but I + // couldn't get it to work yet. + if (ie && ie_version < 9) { return false } + var div = elt('div') + return "draggable" in div || "dragDrop" in div +}() + +var zwspSupported +function zeroWidthElement(measure) { + if (zwspSupported == null) { + var test = elt("span", "\u200b") + removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")])) + if (measure.firstChild.offsetHeight != 0) + { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8) } + } + var node = zwspSupported ? elt("span", "\u200b") : + elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px") + node.setAttribute("cm-text", "") + return node +} + +// Feature-detect IE's crummy client rect reporting for bidi text +var badBidiRects +function hasBadBidiRects(measure) { + if (badBidiRects != null) { return badBidiRects } + var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA")) + var r0 = range(txt, 0, 1).getBoundingClientRect() + var r1 = range(txt, 1, 2).getBoundingClientRect() + removeChildren(measure) + if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780) + return badBidiRects = (r1.right - r0.right < 3) +} + +// See if "".split is the broken IE version, if so, provide an +// alternative way to split lines. +var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) { + var pos = 0, result = [], l = string.length + while (pos <= l) { + var nl = string.indexOf("\n", pos) + if (nl == -1) { nl = string.length } + var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl) + var rt = line.indexOf("\r") + if (rt != -1) { + result.push(line.slice(0, rt)) + pos += rt + 1 + } else { + result.push(line) + pos = nl + 1 + } + } + return result +} : function (string) { return string.split(/\r\n?|\n/); } + +var hasSelection = window.getSelection ? function (te) { + try { return te.selectionStart != te.selectionEnd } + catch(e) { return false } +} : function (te) { + var range + try {range = te.ownerDocument.selection.createRange()} + catch(e) {} + if (!range || range.parentElement() != te) { return false } + return range.compareEndPoints("StartToEnd", range) != 0 +} + +var hasCopyEvent = (function () { + var e = elt("div") + if ("oncopy" in e) { return true } + e.setAttribute("oncopy", "return;") + return typeof e.oncopy == "function" +})() + +var badZoomedRects = null +function hasBadZoomedRects(measure) { + if (badZoomedRects != null) { return badZoomedRects } + var node = removeChildrenAndAdd(measure, elt("span", "x")) + var normal = node.getBoundingClientRect() + var fromRange = range(node, 0, 1).getBoundingClientRect() + return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1 +} + +var modes = {}; +var mimeModes = {}; +// Extra arguments are stored as the mode's dependencies, which is +// used by (legacy) mechanisms like loadmode.js to automatically +// load a mode. (Preferred mechanism is the require/define calls.) +function defineMode(name, mode) { + if (arguments.length > 2) + { mode.dependencies = Array.prototype.slice.call(arguments, 2) } + modes[name] = mode +} + +function defineMIME(mime, spec) { + mimeModes[mime] = spec +} + +// Given a MIME type, a {name, ...options} config object, or a name +// string, return a mode config object. +function resolveMode(spec) { + if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) { + spec = mimeModes[spec] + } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) { + var found = mimeModes[spec.name] + if (typeof found == "string") { found = {name: found} } + spec = createObj(found, spec) + spec.name = found.name + } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) { + return resolveMode("application/xml") + } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) { + return resolveMode("application/json") + } + if (typeof spec == "string") { return {name: spec} } + else { return spec || {name: "null"} } +} + +// Given a mode spec (anything that resolveMode accepts), find and +// initialize an actual mode object. +function getMode(options, spec) { + spec = resolveMode(spec) + var mfactory = modes[spec.name] + if (!mfactory) { return getMode(options, "text/plain") } + var modeObj = mfactory(options, spec) + if (modeExtensions.hasOwnProperty(spec.name)) { + var exts = modeExtensions[spec.name] + for (var prop in exts) { + if (!exts.hasOwnProperty(prop)) { continue } + if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop] } + modeObj[prop] = exts[prop] + } + } + modeObj.name = spec.name + if (spec.helperType) { modeObj.helperType = spec.helperType } + if (spec.modeProps) { for (var prop$1 in spec.modeProps) + { modeObj[prop$1] = spec.modeProps[prop$1] } } + + return modeObj +} + +// This can be used to attach properties to mode objects from +// outside the actual mode definition. +var modeExtensions = {} +function extendMode(mode, properties) { + var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {}) + copyObj(properties, exts) +} + +function copyState(mode, state) { + if (state === true) { return state } + if (mode.copyState) { return mode.copyState(state) } + var nstate = {} + for (var n in state) { + var val = state[n] + if (val instanceof Array) { val = val.concat([]) } + nstate[n] = val + } + return nstate +} + +// Given a mode and a state (for that mode), find the inner mode and +// state at the position that the state refers to. +function innerMode(mode, state) { + var info + while (mode.innerMode) { + info = mode.innerMode(state) + if (!info || info.mode == mode) { break } + state = info.state + mode = info.mode + } + return info || {mode: mode, state: state} +} + +function startState(mode, a1, a2) { + return mode.startState ? mode.startState(a1, a2) : true +} + +// STRING STREAM + +// Fed to the mode parsers, provides helper functions to make +// parsers more succinct. + +var StringStream = function(string, tabSize) { + this.pos = this.start = 0 + this.string = string + this.tabSize = tabSize || 8 + this.lastColumnPos = this.lastColumnValue = 0 + this.lineStart = 0 +} + +StringStream.prototype = { + eol: function() {return this.pos >= this.string.length}, + sol: function() {return this.pos == this.lineStart}, + peek: function() {return this.string.charAt(this.pos) || undefined}, + next: function() { + if (this.pos < this.string.length) + { return this.string.charAt(this.pos++) } + }, + eat: function(match) { + var ch = this.string.charAt(this.pos) + var ok + if (typeof match == "string") { ok = ch == match } + else { ok = ch && (match.test ? match.test(ch) : match(ch)) } + if (ok) {++this.pos; return ch} + }, + eatWhile: function(match) { + var start = this.pos + while (this.eat(match)){} + return this.pos > start + }, + eatSpace: function() { + var this$1 = this; + + var start = this.pos + while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos } + return this.pos > start + }, + skipToEnd: function() {this.pos = this.string.length}, + skipTo: function(ch) { + var found = this.string.indexOf(ch, this.pos) + if (found > -1) {this.pos = found; return true} + }, + backUp: function(n) {this.pos -= n}, + column: function() { + if (this.lastColumnPos < this.start) { + this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue) + this.lastColumnPos = this.start + } + return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0) + }, + indentation: function() { + return countColumn(this.string, null, this.tabSize) - + (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0) + }, + match: function(pattern, consume, caseInsensitive) { + if (typeof pattern == "string") { + var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; } + var substr = this.string.substr(this.pos, pattern.length) + if (cased(substr) == cased(pattern)) { + if (consume !== false) { this.pos += pattern.length } + return true } - - if (needsH) { - this.horiz.style.display = "block"; - this.horiz.style.right = needsV ? sWidth + "px" : "0"; - this.horiz.style.left = measure.barLeft + "px"; - var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0); - this.horiz.firstChild.style.width = - (measure.scrollWidth - measure.clientWidth + totalWidth) + "px"; + } else { + var match = this.string.slice(this.pos).match(pattern) + if (match && match.index > 0) { return null } + if (match && consume !== false) { this.pos += match[0].length } + return match + } + }, + current: function(){return this.string.slice(this.start, this.pos)}, + hideFirstChars: function(n, inner) { + this.lineStart += n + try { return inner() } + finally { this.lineStart -= n } + } +} + +// Compute a style array (an array starting with a mode generation +// -- for invalidation -- followed by pairs of end positions and +// style strings), which is used to highlight the tokens on the +// line. +function highlightLine(cm, line, state, forceToEnd) { + // A styles array always starts with a number identifying the + // mode/overlays that it is based on (for easy invalidation). + var st = [cm.state.modeGen], lineClasses = {} + // Compute the base array of styles + runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); }, + lineClasses, forceToEnd) + + // Run overlays, adjust style array. + var loop = function ( o ) { + var overlay = cm.state.overlays[o], i = 1, at = 0 + runMode(cm, line.text, overlay.mode, true, function (end, style) { + var start = i + // Ensure there's a token end at the current position, and that i points at it + while (at < end) { + var i_end = st[i] + if (i_end > end) + { st.splice(i, 1, end, st[i+1], i_end) } + i += 2 + at = Math.min(end, i_end) + } + if (!style) { return } + if (overlay.opaque) { + st.splice(start, i - start, end, "overlay " + style) + i = start + 2 } else { - this.horiz.style.display = ""; - this.horiz.firstChild.style.width = "0"; + for (; start < i; start += 2) { + var cur = st[start+1] + st[start+1] = (cur ? cur + " " : "") + "overlay " + style + } } + }, lineClasses) + }; - if (!this.checkedZeroWidth && measure.clientHeight > 0) { - if (sWidth == 0) this.zeroWidthHack(); - this.checkedZeroWidth = true; + for (var o = 0; o < cm.state.overlays.length; ++o) loop( o ); + + return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null} +} + +function getLineStyles(cm, line, updateFrontier) { + if (!line.styles || line.styles[0] != cm.state.modeGen) { + var state = getStateBefore(cm, lineNo(line)) + var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state) + line.stateAfter = state + line.styles = result.styles + if (result.classes) { line.styleClasses = result.classes } + else if (line.styleClasses) { line.styleClasses = null } + if (updateFrontier === cm.doc.frontier) { cm.doc.frontier++ } + } + return line.styles +} + +function getStateBefore(cm, n, precise) { + var doc = cm.doc, display = cm.display + if (!doc.mode.startState) { return true } + var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter + if (!state) { state = startState(doc.mode) } + else { state = copyState(doc.mode, state) } + doc.iter(pos, n, function (line) { + processLine(cm, line.text, state) + var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo + line.stateAfter = save ? copyState(doc.mode, state) : null + ++pos + }) + if (precise) { doc.frontier = pos } + return state +} + +// Lightweight form of highlight -- proceed over this line and +// update state, but don't save a style array. Used for lines that +// aren't currently visible. +function processLine(cm, text, state, startAt) { + var mode = cm.doc.mode + var stream = new StringStream(text, cm.options.tabSize) + stream.start = stream.pos = startAt || 0 + if (text == "") { callBlankLine(mode, state) } + while (!stream.eol()) { + readToken(mode, stream, state) + stream.start = stream.pos + } +} + +function callBlankLine(mode, state) { + if (mode.blankLine) { return mode.blankLine(state) } + if (!mode.innerMode) { return } + var inner = innerMode(mode, state) + if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) } +} + +function readToken(mode, stream, state, inner) { + for (var i = 0; i < 10; i++) { + if (inner) { inner[0] = innerMode(mode, state).mode } + var style = mode.token(stream, state) + if (stream.pos > stream.start) { return style } + } + throw new Error("Mode " + mode.name + " failed to advance stream.") +} + +// Utility for getTokenAt and getLineTokens +function takeToken(cm, pos, precise, asArray) { + var getObj = function (copy) { return ({ + start: stream.start, end: stream.pos, + string: stream.current(), + type: style || null, + state: copy ? copyState(doc.mode, state) : state + }); } + + var doc = cm.doc, mode = doc.mode, style + pos = clipPos(doc, pos) + var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise) + var stream = new StringStream(line.text, cm.options.tabSize), tokens + if (asArray) { tokens = [] } + while ((asArray || stream.pos < pos.ch) && !stream.eol()) { + stream.start = stream.pos + style = readToken(mode, stream, state) + if (asArray) { tokens.push(getObj(true)) } + } + return asArray ? tokens : getObj() +} + +function extractLineClasses(type, output) { + if (type) { for (;;) { + var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/) + if (!lineClass) { break } + type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length) + var prop = lineClass[1] ? "bgClass" : "textClass" + if (output[prop] == null) + { output[prop] = lineClass[2] } + else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop])) + { output[prop] += " " + lineClass[2] } + } } + return type +} + +// Run the given mode's parser over a line, calling f for each token. +function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) { + var flattenSpans = mode.flattenSpans + if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans } + var curStart = 0, curStyle = null + var stream = new StringStream(text, cm.options.tabSize), style + var inner = cm.options.addModeClass && [null] + if (text == "") { extractLineClasses(callBlankLine(mode, state), lineClasses) } + while (!stream.eol()) { + if (stream.pos > cm.options.maxHighlightLength) { + flattenSpans = false + if (forceToEnd) { processLine(cm, text, state, stream.pos) } + stream.pos = text.length + style = null + } else { + style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses) + } + if (inner) { + var mName = inner[0].name + if (mName) { style = "m-" + (style ? mName + " " + style : mName) } + } + if (!flattenSpans || curStyle != style) { + while (curStart < stream.start) { + curStart = Math.min(stream.start, curStart + 5000) + f(curStart, curStyle) + } + curStyle = style + } + stream.start = stream.pos + } + while (curStart < stream.pos) { + // Webkit seems to refuse to render text nodes longer than 57444 + // characters, and returns inaccurate measurements in nodes + // starting around 5000 chars. + var pos = Math.min(stream.pos, curStart + 5000) + f(pos, curStyle) + curStart = pos + } +} + +// Finds the line to start with when starting a parse. Tries to +// find a line with a stateAfter, so that it can start with a +// valid state. If that fails, it returns the line with the +// smallest indentation, which tends to need the least context to +// parse correctly. +function findStartLine(cm, n, precise) { + var minindent, minline, doc = cm.doc + var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100) + for (var search = n; search > lim; --search) { + if (search <= doc.first) { return doc.first } + var line = getLine(doc, search - 1) + if (line.stateAfter && (!precise || search <= doc.frontier)) { return search } + var indented = countColumn(line.text, null, cm.options.tabSize) + if (minline == null || minindent > indented) { + minline = search - 1 + minindent = indented + } + } + return minline +} + +// LINE DATA STRUCTURE + +// Line objects. These hold state related to a line, including +// highlighting info (the styles array). +function Line(text, markedSpans, estimateHeight) { + this.text = text + attachMarkedSpans(this, markedSpans) + this.height = estimateHeight ? estimateHeight(this) : 1 +} +eventMixin(Line) +Line.prototype.lineNo = function() { return lineNo(this) } + +// Change the content (text, markers) of a line. Automatically +// invalidates cached information and tries to re-estimate the +// line's height. +function updateLine(line, text, markedSpans, estimateHeight) { + line.text = text + if (line.stateAfter) { line.stateAfter = null } + if (line.styles) { line.styles = null } + if (line.order != null) { line.order = null } + detachMarkedSpans(line) + attachMarkedSpans(line, markedSpans) + var estHeight = estimateHeight ? estimateHeight(line) : 1 + if (estHeight != line.height) { updateLineHeight(line, estHeight) } +} + +// Detach a line from the document tree and its markers. +function cleanUpLine(line) { + line.parent = null + detachMarkedSpans(line) +} + +// Convert a style as returned by a mode (either null, or a string +// containing one or more styles) to a CSS style. This is cached, +// and also looks for line-wide styles. +var styleToClassCache = {}; +var styleToClassCacheWithMode = {}; +function interpretTokenStyle(style, options) { + if (!style || /^\s*$/.test(style)) { return null } + var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache + return cache[style] || + (cache[style] = style.replace(/\S+/g, "cm-$&")) +} + +// Render the DOM representation of the text of a line. Also builds +// up a 'line map', which points at the DOM nodes that represent +// specific stretches of text, and is used by the measuring code. +// The returned object contains the DOM node, this map, and +// information about line-wide styles that were set by the mode. +function buildLineContent(cm, lineView) { + // The padding-right forces the element to have a 'border', which + // is needed on Webkit to be able to get line-level bounding + // rectangles for it (in measureChar). + var content = elt("span", null, null, webkit ? "padding-right: .1px" : null) + var builder = {pre: elt("pre", [content], "CodeMirror-line"), content: content, + col: 0, pos: 0, cm: cm, + trailingSpace: false, + splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")} + lineView.measure = {} + + // Iterate over the logical lines that make up this visual line. + for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) { + var line = i ? lineView.rest[i - 1] : lineView.line, order = void 0 + builder.pos = 0 + builder.addToken = buildToken + // Optionally wire in some hacks into the token-rendering + // algorithm, to deal with browser quirks. + if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line))) + { builder.addToken = buildTokenBadBidi(builder.addToken, order) } + builder.map = [] + var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line) + insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate)) + if (line.styleClasses) { + if (line.styleClasses.bgClass) + { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || "") } + if (line.styleClasses.textClass) + { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || "") } + } + + // Ensure at least a single node is present, for measuring. + if (builder.map.length == 0) + { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) } + + // Store the map and a cache object for the current logical line + if (i == 0) { + lineView.measure.map = builder.map + lineView.measure.cache = {} + } else { + ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map) + ;(lineView.measure.caches || (lineView.measure.caches = [])).push({}) + } + } + + // See issue #2901 + if (webkit) { + var last = builder.content.lastChild + if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab"))) + { builder.content.className = "cm-tab-wrap-hack" } + } + + signal(cm, "renderLine", cm, lineView.line, builder.pre) + if (builder.pre.className) + { builder.textClass = joinClasses(builder.pre.className, builder.textClass || "") } + + return builder +} + +function defaultSpecialCharPlaceholder(ch) { + var token = elt("span", "\u2022", "cm-invalidchar") + token.title = "\\u" + ch.charCodeAt(0).toString(16) + token.setAttribute("aria-label", token.title) + return token +} + +// Build up the DOM representation for a single token, and add it to +// the line map. Takes care to render special characters separately. +function buildToken(builder, text, style, startStyle, endStyle, title, css) { + if (!text) { return } + var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text + var special = builder.cm.state.specialChars, mustWrap = false + var content + if (!special.test(text)) { + builder.col += text.length + content = document.createTextNode(displayText) + builder.map.push(builder.pos, builder.pos + text.length, content) + if (ie && ie_version < 9) { mustWrap = true } + builder.pos += text.length + } else { + content = document.createDocumentFragment() + var pos = 0 + while (true) { + special.lastIndex = pos + var m = special.exec(text) + var skipped = m ? m.index - pos : text.length - pos + if (skipped) { + var txt = document.createTextNode(displayText.slice(pos, pos + skipped)) + if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])) } + else { content.appendChild(txt) } + builder.map.push(builder.pos, builder.pos + skipped, txt) + builder.col += skipped + builder.pos += skipped + } + if (!m) { break } + pos += skipped + 1 + var txt$1 = void 0 + if (m[0] == "\t") { + var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize + txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab")) + txt$1.setAttribute("role", "presentation") + txt$1.setAttribute("cm-text", "\t") + builder.col += tabWidth + } else if (m[0] == "\r" || m[0] == "\n") { + txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar")) + txt$1.setAttribute("cm-text", m[0]) + builder.col += 1 + } else { + txt$1 = builder.cm.options.specialCharPlaceholder(m[0]) + txt$1.setAttribute("cm-text", m[0]) + if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])) } + else { content.appendChild(txt$1) } + builder.col += 1 + } + builder.map.push(builder.pos, builder.pos + 1, txt$1) + builder.pos++ + } + } + builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32 + if (style || startStyle || endStyle || mustWrap || css) { + var fullStyle = style || "" + if (startStyle) { fullStyle += startStyle } + if (endStyle) { fullStyle += endStyle } + var token = elt("span", [content], fullStyle, css) + if (title) { token.title = title } + return builder.content.appendChild(token) + } + builder.content.appendChild(content) +} + +function splitSpaces(text, trailingBefore) { + if (text.length > 1 && !/ /.test(text)) { return text } + var spaceBefore = trailingBefore, result = "" + for (var i = 0; i < text.length; i++) { + var ch = text.charAt(i) + if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32)) + { ch = "\u00a0" } + result += ch + spaceBefore = ch == " " + } + return result +} + +// Work around nonsense dimensions being reported for stretches of +// right-to-left text. +function buildTokenBadBidi(inner, order) { + return function (builder, text, style, startStyle, endStyle, title, css) { + style = style ? style + " cm-force-border" : "cm-force-border" + var start = builder.pos, end = start + text.length + for (;;) { + // Find the part that overlaps with the start of this text + var part = void 0 + for (var i = 0; i < order.length; i++) { + part = order[i] + if (part.to > start && part.from <= start) { break } + } + if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) } + inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css) + startStyle = null + text = text.slice(part.to - start) + start = part.to + } + } +} + +function buildCollapsedSpan(builder, size, marker, ignoreWidget) { + var widget = !ignoreWidget && marker.widgetNode + if (widget) { builder.map.push(builder.pos, builder.pos + size, widget) } + if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) { + if (!widget) + { widget = builder.content.appendChild(document.createElement("span")) } + widget.setAttribute("cm-marker", marker.id) + } + if (widget) { + builder.cm.display.input.setUneditable(widget) + builder.content.appendChild(widget) + } + builder.pos += size + builder.trailingSpace = false +} + +// Outputs a number of spans to make up a line, taking highlighting +// and marked text into account. +function insertLineContent(line, builder, styles) { + var spans = line.markedSpans, allText = line.text, at = 0 + if (!spans) { + for (var i$1 = 1; i$1 < styles.length; i$1+=2) + { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)) } + return + } + + var len = allText.length, pos = 0, i = 1, text = "", style, css + var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed + for (;;) { + if (nextChange == pos) { // Update current marker set + spanStyle = spanEndStyle = spanStartStyle = title = css = "" + collapsed = null; nextChange = Infinity + var foundBookmarks = [], endStyles = void 0 + for (var j = 0; j < spans.length; ++j) { + var sp = spans[j], m = sp.marker + if (m.type == "bookmark" && sp.from == pos && m.widgetNode) { + foundBookmarks.push(m) + } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) { + if (sp.to != null && sp.to != pos && nextChange > sp.to) { + nextChange = sp.to + spanEndStyle = "" + } + if (m.className) { spanStyle += " " + m.className } + if (m.css) { css = (css ? css + ";" : "") + m.css } + if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle } + if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to) } + if (m.title && !title) { title = m.title } + if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) + { collapsed = sp } + } else if (sp.from > pos && nextChange > sp.from) { + nextChange = sp.from + } } + if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2) + { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1] } } } - return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}; - }, - setScrollLeft: function(pos) { - if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos; - if (this.disableHoriz) this.enableZeroWidthBar(this.horiz, this.disableHoriz); - }, - setScrollTop: function(pos) { - if (this.vert.scrollTop != pos) this.vert.scrollTop = pos; - if (this.disableVert) this.enableZeroWidthBar(this.vert, this.disableVert); - }, - zeroWidthHack: function() { - var w = mac && !mac_geMountainLion ? "12px" : "18px"; - this.horiz.style.height = this.vert.style.width = w; - this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none"; - this.disableHoriz = new Delayed; - this.disableVert = new Delayed; - }, - enableZeroWidthBar: function(bar, delay) { - bar.style.pointerEvents = "auto"; - function maybeDisable() { - // To find out whether the scrollbar is still visible, we - // check whether the element under the pixel in the bottom - // left corner of the scrollbar box is the scrollbar box - // itself (when the bar is still visible) or its filler child - // (when the bar is hidden). If it is still visible, we keep - // it enabled, if it's hidden, we disable pointer events. - var box = bar.getBoundingClientRect(); - var elt = document.elementFromPoint(box.left + 1, box.bottom - 1); - if (elt != bar) bar.style.pointerEvents = "none"; - else delay.set(1000, maybeDisable); - } - delay.set(1000, maybeDisable); - }, - clear: function() { - var parent = this.horiz.parentNode; - parent.removeChild(this.horiz); - parent.removeChild(this.vert); - } - }, NativeScrollbars.prototype); - - function NullScrollbars() {} - - NullScrollbars.prototype = copyObj({ - update: function() { return {bottom: 0, right: 0}; }, - setScrollLeft: function() {}, - setScrollTop: function() {}, - clear: function() {} - }, NullScrollbars.prototype); - - CodeMirror.scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars}; - - function initScrollbars(cm) { - if (cm.display.scrollbars) { - cm.display.scrollbars.clear(); - if (cm.display.scrollbars.addClass) - rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); - } - - cm.display.scrollbars = new CodeMirror.scrollbarModel[cm.options.scrollbarStyle](function(node) { - cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller); - // Prevent clicks in the scrollbars from killing focus - on(node, "mousedown", function() { - if (cm.state.focused) setTimeout(function() { cm.display.input.focus(); }, 0); - }); - node.setAttribute("cm-not-content", "true"); - }, function(pos, axis) { - if (axis == "horizontal") setScrollLeft(cm, pos); - else setScrollTop(cm, pos); - }, cm); - if (cm.display.scrollbars.addClass) - addClass(cm.display.wrapper, cm.display.scrollbars.addClass); - } - - function updateScrollbars(cm, measure) { - if (!measure) measure = measureForScrollbars(cm); - var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight; - updateScrollbarsInner(cm, measure); - for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) { - if (startWidth != cm.display.barWidth && cm.options.lineWrapping) - updateHeightsInViewport(cm); - updateScrollbarsInner(cm, measureForScrollbars(cm)); - startWidth = cm.display.barWidth; startHeight = cm.display.barHeight; - } - } - - // Re-synchronize the fake scrollbars with the actual size of the - // content. - function updateScrollbarsInner(cm, measure) { - var d = cm.display; - var sizes = d.scrollbars.update(measure); - - d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px"; - d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px"; - d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent" - - if (sizes.right && sizes.bottom) { - d.scrollbarFiller.style.display = "block"; - d.scrollbarFiller.style.height = sizes.bottom + "px"; - d.scrollbarFiller.style.width = sizes.right + "px"; - } else d.scrollbarFiller.style.display = ""; - if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) { - d.gutterFiller.style.display = "block"; - d.gutterFiller.style.height = sizes.bottom + "px"; - d.gutterFiller.style.width = measure.gutterWidth + "px"; - } else d.gutterFiller.style.display = ""; - } - - // Compute the lines that are visible in a given viewport (defaults - // the the current scroll position). viewport may contain top, - // height, and ensure (see op.scrollToPos) properties. - function visibleLines(display, doc, viewport) { - var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop; - top = Math.floor(top - paddingTop(display)); - var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight; - - var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom); - // Ensure is a {from: {line, ch}, to: {line, ch}} object, and - // forces those lines into the viewport (if possible). - if (viewport && viewport.ensure) { - var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line; - if (ensureFrom < from) { - from = ensureFrom; - to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight); - } else if (Math.min(ensureTo, doc.lastLine()) >= to) { - from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight); - to = ensureTo; + if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2) + { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]) } } + if (collapsed && (collapsed.from || 0) == pos) { + buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos, + collapsed.marker, collapsed.from == null) + if (collapsed.to == null) { return } + if (collapsed.to == pos) { collapsed = false } } } - return {from: from, to: Math.max(to, from + 1)}; - } - - // LINE NUMBERS + if (pos >= len) { break } - // Re-align line numbers and gutter marks to compensate for - // horizontal scrolling. - function alignHorizontally(cm) { - var display = cm.display, view = display.view; - if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return; - var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft; - var gutterW = display.gutters.offsetWidth, left = comp + "px"; - for (var i = 0; i < view.length; i++) if (!view[i].hidden) { - if (cm.options.fixedGutter) { - if (view[i].gutter) - view[i].gutter.style.left = left; - if (view[i].gutterBackground) - view[i].gutterBackground.style.left = left; - } - var align = view[i].alignable; - if (align) for (var j = 0; j < align.length; j++) - align[j].style.left = left; - } - if (cm.options.fixedGutter) - display.gutters.style.left = (comp + gutterW) + "px"; - } - - // Used to ensure that the line number gutter is still the right - // size for the current document size. Returns true when an update - // is needed. - function maybeUpdateLineNumberWidth(cm) { - if (!cm.options.lineNumbers) return false; - var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display; - if (last.length != display.lineNumChars) { - var test = display.measure.appendChild(elt("div", [elt("div", last)], - "CodeMirror-linenumber CodeMirror-gutter-elt")); - var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW; - display.lineGutter.style.width = ""; - display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1; - display.lineNumWidth = display.lineNumInnerWidth + padding; - display.lineNumChars = display.lineNumInnerWidth ? last.length : -1; - display.lineGutter.style.width = display.lineNumWidth + "px"; - updateGutterSpace(cm); - return true; - } - return false; - } - - function lineNumberFor(options, i) { - return String(options.lineNumberFormatter(i + options.firstLineNumber)); - } - - // Computes display.scroller.scrollLeft + display.gutters.offsetWidth, - // but using getBoundingClientRect to get a sub-pixel-accurate - // result. - function compensateForHScroll(display) { - return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left; - } - - // DISPLAY DRAWING - - function DisplayUpdate(cm, viewport, force) { - var display = cm.display; - - this.viewport = viewport; - // Store some values that we'll need later (but don't want to force a relayout for) - this.visible = visibleLines(display, cm.doc, viewport); - this.editorIsHidden = !display.wrapper.offsetWidth; - this.wrapperHeight = display.wrapper.clientHeight; - this.wrapperWidth = display.wrapper.clientWidth; - this.oldDisplayWidth = displayWidth(cm); - this.force = force; - this.dims = getDimensions(cm); - this.events = []; - } - - DisplayUpdate.prototype.signal = function(emitter, type) { - if (hasHandler(emitter, type)) - this.events.push(arguments); - }; - DisplayUpdate.prototype.finish = function() { - for (var i = 0; i < this.events.length; i++) - signal.apply(null, this.events[i]); + var upto = Math.min(len, nextChange) + while (true) { + if (text) { + var end = pos + text.length + if (!collapsed) { + var tokenText = end > upto ? text.slice(0, upto - pos) : text + builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle, + spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css) + } + if (end >= upto) {text = text.slice(upto - pos); pos = upto; break} + pos = end + spanStartStyle = "" + } + text = allText.slice(at, at = styles[i++]) + style = interpretTokenStyle(styles[i++], builder.cm.options) + } + } +} + + +// These objects are used to represent the visible (currently drawn) +// part of the document. A LineView may correspond to multiple +// logical lines, if those are connected by collapsed ranges. +function LineView(doc, line, lineN) { + // The starting line + this.line = line + // Continuing lines, if any + this.rest = visualLineContinued(line) + // Number of logical lines in this visual line + this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1 + this.node = this.text = null + this.hidden = lineIsHidden(doc, line) +} + +// Create a range of LineView objects for the given lines. +function buildViewArray(cm, from, to) { + var array = [], nextPos + for (var pos = from; pos < to; pos = nextPos) { + var view = new LineView(cm.doc, getLine(cm.doc, pos), pos) + nextPos = pos + view.size + array.push(view) + } + return array +} + +var operationGroup = null + +function pushOperation(op) { + if (operationGroup) { + operationGroup.ops.push(op) + } else { + op.ownsGroup = operationGroup = { + ops: [op], + delayedCallbacks: [] + } + } +} + +function fireCallbacksForOps(group) { + // Calls delayed callbacks and cursorActivity handlers until no + // new ones appear + var callbacks = group.delayedCallbacks, i = 0 + do { + for (; i < callbacks.length; i++) + { callbacks[i].call(null) } + for (var j = 0; j < group.ops.length; j++) { + var op = group.ops[j] + if (op.cursorActivityHandlers) + { while (op.cursorActivityCalled < op.cursorActivityHandlers.length) + { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm) } } + } + } while (i < callbacks.length) +} + +function finishOperation(op, endCb) { + var group = op.ownsGroup + if (!group) { return } + + try { fireCallbacksForOps(group) } + finally { + operationGroup = null + endCb(group) + } +} + +var orphanDelayedCallbacks = null + +// Often, we want to signal events at a point where we are in the +// middle of some work, but don't want the handler to start calling +// other methods on the editor, which might be in an inconsistent +// state or simply not expect any other events to happen. +// signalLater looks whether there are any handlers, and schedules +// them to be executed when the last operation ends, or, if no +// operation is active, when a timeout fires. +function signalLater(emitter, type /*, values...*/) { + var arr = getHandlers(emitter, type, false) + if (!arr.length) { return } + var args = Array.prototype.slice.call(arguments, 2), list + if (operationGroup) { + list = operationGroup.delayedCallbacks + } else if (orphanDelayedCallbacks) { + list = orphanDelayedCallbacks + } else { + list = orphanDelayedCallbacks = [] + setTimeout(fireOrphanDelayed, 0) + } + var loop = function ( i ) { + list.push(function () { return arr[i].apply(null, args); }) }; - function maybeClipScrollbars(cm) { - var display = cm.display; - if (!display.scrollbarsClipped && display.scroller.offsetWidth) { - display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth; - display.heightForcer.style.height = scrollGap(cm) + "px"; - display.sizer.style.marginBottom = -display.nativeBarWidth + "px"; - display.sizer.style.borderRightWidth = scrollGap(cm) + "px"; - display.scrollbarsClipped = true; - } + for (var i = 0; i < arr.length; ++i) + loop( i ); +} + +function fireOrphanDelayed() { + var delayed = orphanDelayedCallbacks + orphanDelayedCallbacks = null + for (var i = 0; i < delayed.length; ++i) { delayed[i]() } +} + +// When an aspect of a line changes, a string is added to +// lineView.changes. This updates the relevant part of the line's +// DOM structure. +function updateLineForChanges(cm, lineView, lineN, dims) { + for (var j = 0; j < lineView.changes.length; j++) { + var type = lineView.changes[j] + if (type == "text") { updateLineText(cm, lineView) } + else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims) } + else if (type == "class") { updateLineClasses(lineView) } + else if (type == "widget") { updateLineWidgets(cm, lineView, dims) } + } + lineView.changes = null +} + +// Lines with gutter elements, widgets or a background class need to +// be wrapped, and have the extra elements added to the wrapper div +function ensureLineWrapped(lineView) { + if (lineView.node == lineView.text) { + lineView.node = elt("div", null, null, "position: relative") + if (lineView.text.parentNode) + { lineView.text.parentNode.replaceChild(lineView.node, lineView.text) } + lineView.node.appendChild(lineView.text) + if (ie && ie_version < 8) { lineView.node.style.zIndex = 2 } + } + return lineView.node +} + +function updateLineBackground(lineView) { + var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass + if (cls) { cls += " CodeMirror-linebackground" } + if (lineView.background) { + if (cls) { lineView.background.className = cls } + else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null } + } else if (cls) { + var wrap = ensureLineWrapped(lineView) + lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild) + } +} + +// Wrapper around buildLineContent which will reuse the structure +// in display.externalMeasured when possible. +function getLineContent(cm, lineView) { + var ext = cm.display.externalMeasured + if (ext && ext.line == lineView.line) { + cm.display.externalMeasured = null + lineView.measure = ext.measure + return ext.built + } + return buildLineContent(cm, lineView) +} + +// Redraw the line's text. Interacts with the background and text +// classes because the mode may output tokens that influence these +// classes. +function updateLineText(cm, lineView) { + var cls = lineView.text.className + var built = getLineContent(cm, lineView) + if (lineView.text == lineView.node) { lineView.node = built.pre } + lineView.text.parentNode.replaceChild(built.pre, lineView.text) + lineView.text = built.pre + if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) { + lineView.bgClass = built.bgClass + lineView.textClass = built.textClass + updateLineClasses(lineView) + } else if (cls) { + lineView.text.className = cls + } +} + +function updateLineClasses(lineView) { + updateLineBackground(lineView) + if (lineView.line.wrapClass) + { ensureLineWrapped(lineView).className = lineView.line.wrapClass } + else if (lineView.node != lineView.text) + { lineView.node.className = "" } + var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass + lineView.text.className = textClass || "" +} + +function updateLineGutter(cm, lineView, lineN, dims) { + if (lineView.gutter) { + lineView.node.removeChild(lineView.gutter) + lineView.gutter = null + } + if (lineView.gutterBackground) { + lineView.node.removeChild(lineView.gutterBackground) + lineView.gutterBackground = null + } + if (lineView.line.gutterClass) { + var wrap = ensureLineWrapped(lineView) + lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass, + ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px")) + wrap.insertBefore(lineView.gutterBackground, lineView.text) + } + var markers = lineView.line.gutterMarkers + if (cm.options.lineNumbers || markers) { + var wrap$1 = ensureLineWrapped(lineView) + var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px")) + cm.display.input.setUneditable(gutterWrap) + wrap$1.insertBefore(gutterWrap, lineView.text) + if (lineView.line.gutterClass) + { gutterWrap.className += " " + lineView.line.gutterClass } + if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"])) + { lineView.lineNumber = gutterWrap.appendChild( + elt("div", lineNumberFor(cm.options, lineN), + "CodeMirror-linenumber CodeMirror-gutter-elt", + ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))) } + if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) { + var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id] + if (found) + { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", + ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))) } + } } + } +} + +function updateLineWidgets(cm, lineView, dims) { + if (lineView.alignable) { lineView.alignable = null } + for (var node = lineView.node.firstChild, next = void 0; node; node = next) { + next = node.nextSibling + if (node.className == "CodeMirror-linewidget") + { lineView.node.removeChild(node) } + } + insertLineWidgets(cm, lineView, dims) +} + +// Build a line's DOM representation from scratch +function buildLineElement(cm, lineView, lineN, dims) { + var built = getLineContent(cm, lineView) + lineView.text = lineView.node = built.pre + if (built.bgClass) { lineView.bgClass = built.bgClass } + if (built.textClass) { lineView.textClass = built.textClass } + + updateLineClasses(lineView) + updateLineGutter(cm, lineView, lineN, dims) + insertLineWidgets(cm, lineView, dims) + return lineView.node +} + +// A lineView may contain multiple logical lines (when merged by +// collapsed spans). The widgets for all of them need to be drawn. +function insertLineWidgets(cm, lineView, dims) { + insertLineWidgetsFor(cm, lineView.line, lineView, dims, true) + if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++) + { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false) } } +} + +function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) { + if (!line.widgets) { return } + var wrap = ensureLineWrapped(lineView) + for (var i = 0, ws = line.widgets; i < ws.length; ++i) { + var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget") + if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true") } + positionLineWidget(widget, node, lineView, dims) + cm.display.input.setUneditable(node) + if (allowAbove && widget.above) + { wrap.insertBefore(node, lineView.gutter || lineView.text) } + else + { wrap.appendChild(node) } + signalLater(widget, "redraw") + } +} + +function positionLineWidget(widget, node, lineView, dims) { + if (widget.noHScroll) { + ;(lineView.alignable || (lineView.alignable = [])).push(node) + var width = dims.wrapperWidth + node.style.left = dims.fixedPos + "px" + if (!widget.coverGutter) { + width -= dims.gutterTotalWidth + node.style.paddingLeft = dims.gutterTotalWidth + "px" + } + node.style.width = width + "px" + } + if (widget.coverGutter) { + node.style.zIndex = 5 + node.style.position = "relative" + if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px" } + } +} + +function widgetHeight(widget) { + if (widget.height != null) { return widget.height } + var cm = widget.doc.cm + if (!cm) { return 0 } + if (!contains(document.body, widget.node)) { + var parentStyle = "position: relative;" + if (widget.coverGutter) + { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;" } + if (widget.noHScroll) + { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;" } + removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle)) + } + return widget.height = widget.node.parentNode.offsetHeight +} + +// Return true when the given mouse event happened in a widget +function eventInWidget(display, e) { + for (var n = e_target(e); n != display.wrapper; n = n.parentNode) { + if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") || + (n.parentNode == display.sizer && n != display.mover)) + { return true } + } +} + +// POSITION MEASUREMENT + +function paddingTop(display) {return display.lineSpace.offsetTop} +function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight} +function paddingH(display) { + if (display.cachedPaddingH) { return display.cachedPaddingH } + var e = removeChildrenAndAdd(display.measure, elt("pre", "x")) + var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle + var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)} + if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data } + return data +} + +function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth } +function displayWidth(cm) { + return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth +} +function displayHeight(cm) { + return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight +} + +// Ensure the lineView.wrapping.heights array is populated. This is +// an array of bottom offsets for the lines that make up a drawn +// line. When lineWrapping is on, there might be more than one +// height. +function ensureLineHeights(cm, lineView, rect) { + var wrapping = cm.options.lineWrapping + var curWidth = wrapping && displayWidth(cm) + if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { + var heights = lineView.measure.heights = [] + if (wrapping) { + lineView.measure.width = curWidth + var rects = lineView.text.firstChild.getClientRects() + for (var i = 0; i < rects.length - 1; i++) { + var cur = rects[i], next = rects[i + 1] + if (Math.abs(cur.bottom - next.bottom) > 2) + { heights.push((cur.bottom + next.top) / 2 - rect.top) } + } + } + heights.push(rect.bottom - rect.top) + } +} + +// Find a line map (mapping character offsets to text nodes) and a +// measurement cache for the given line number. (A line view might +// contain multiple lines when collapsed ranges are present.) +function mapFromLineView(lineView, line, lineN) { + if (lineView.line == line) + { return {map: lineView.measure.map, cache: lineView.measure.cache} } + for (var i = 0; i < lineView.rest.length; i++) + { if (lineView.rest[i] == line) + { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } } + for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) + { if (lineNo(lineView.rest[i$1]) > lineN) + { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } } +} + +// Render a line into the hidden node display.externalMeasured. Used +// when measurement is needed for a line that's not in the viewport. +function updateExternalMeasurement(cm, line) { + line = visualLine(line) + var lineN = lineNo(line) + var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN) + view.lineN = lineN + var built = view.built = buildLineContent(cm, view) + view.text = built.pre + removeChildrenAndAdd(cm.display.lineMeasure, built.pre) + return view +} + +// Get a {top, bottom, left, right} box (in line-local coordinates) +// for a given character. +function measureChar(cm, line, ch, bias) { + return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias) +} + +// Find a line view that corresponds to the given line number. +function findViewForLine(cm, lineN) { + if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) + { return cm.display.view[findViewIndex(cm, lineN)] } + var ext = cm.display.externalMeasured + if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) + { return ext } +} + +// Measurement can be split in two steps, the set-up work that +// applies to the whole line, and the measurement of the actual +// character. Functions like coordsChar, that need to do a lot of +// measurements in a row, can thus ensure that the set-up work is +// only done once. +function prepareMeasureForLine(cm, line) { + var lineN = lineNo(line) + var view = findViewForLine(cm, lineN) + if (view && !view.text) { + view = null + } else if (view && view.changes) { + updateLineForChanges(cm, view, lineN, getDimensions(cm)) + cm.curOp.forceUpdate = true + } + if (!view) + { view = updateExternalMeasurement(cm, line) } + + var info = mapFromLineView(view, line, lineN) + return { + line: line, view: view, rect: null, + map: info.map, cache: info.cache, before: info.before, + hasHeights: false + } +} + +// Given a prepared measurement object, measures the position of an +// actual character (or fetches it from the cache). +function measureCharPrepared(cm, prepared, ch, bias, varHeight) { + if (prepared.before) { ch = -1 } + var key = ch + (bias || ""), found + if (prepared.cache.hasOwnProperty(key)) { + found = prepared.cache[key] + } else { + if (!prepared.rect) + { prepared.rect = prepared.view.text.getBoundingClientRect() } + if (!prepared.hasHeights) { + ensureLineHeights(cm, prepared.view, prepared.rect) + prepared.hasHeights = true + } + found = measureCharInner(cm, prepared, ch, bias) + if (!found.bogus) { prepared.cache[key] = found } + } + return {left: found.left, right: found.right, + top: varHeight ? found.rtop : found.top, + bottom: varHeight ? found.rbottom : found.bottom} +} + +var nullRect = {left: 0, right: 0, top: 0, bottom: 0} + +function nodeAndOffsetInLineMap(map, ch, bias) { + var node, start, end, collapse, mStart, mEnd + // First, search the line map for the text node corresponding to, + // or closest to, the target character. + for (var i = 0; i < map.length; i += 3) { + mStart = map[i] + mEnd = map[i + 1] + if (ch < mStart) { + start = 0; end = 1 + collapse = "left" + } else if (ch < mEnd) { + start = ch - mStart + end = start + 1 + } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) { + end = mEnd - mStart + start = end - 1 + if (ch >= mEnd) { collapse = "right" } + } + if (start != null) { + node = map[i + 2] + if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right")) + { collapse = bias } + if (bias == "left" && start == 0) + { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) { + node = map[(i -= 3) + 2] + collapse = "left" + } } + if (bias == "right" && start == mEnd - mStart) + { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) { + node = map[(i += 3) + 2] + collapse = "right" + } } + break + } + } + return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd} +} + +function getUsefulRect(rects, bias) { + var rect = nullRect + if (bias == "left") { for (var i = 0; i < rects.length; i++) { + if ((rect = rects[i]).left != rect.right) { break } + } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) { + if ((rect = rects[i$1]).left != rect.right) { break } + } } + return rect +} + +function measureCharInner(cm, prepared, ch, bias) { + var place = nodeAndOffsetInLineMap(prepared.map, ch, bias) + var node = place.node, start = place.start, end = place.end, collapse = place.collapse + + var rect + if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates. + for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned + while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start } + while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end } + if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) + { rect = node.parentNode.getBoundingClientRect() } + else + { rect = getUsefulRect(range(node, start, end).getClientRects(), bias) } + if (rect.left || rect.right || start == 0) { break } + end = start + start = start - 1 + collapse = "right" + } + if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect) } + } else { // If it is a widget, simply get the box for the whole widget. + if (start > 0) { collapse = bias = "right" } + var rects + if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1) + { rect = rects[bias == "right" ? rects.length - 1 : 0] } + else + { rect = node.getBoundingClientRect() } } - - // Does the actual updating of the line display. Bails out - // (returning false) when there is nothing to be done and forced is - // false. - function updateDisplayIfNeeded(cm, update) { - var display = cm.display, doc = cm.doc; - - if (update.editorIsHidden) { - resetView(cm); - return false; - } - - // Bail out if the visible area is already rendered and nothing changed. - if (!update.force && - update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo && - (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) && - display.renderedView == display.view && countDirtyView(cm) == 0) - return false; - - if (maybeUpdateLineNumberWidth(cm)) { - resetView(cm); - update.dims = getDimensions(cm); + if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) { + var rSpan = node.parentNode.getClientRects()[0] + if (rSpan) + { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom} } + else + { rect = nullRect } + } + + var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top + var mid = (rtop + rbot) / 2 + var heights = prepared.view.measure.heights + var i = 0 + for (; i < heights.length - 1; i++) + { if (mid < heights[i]) { break } } + var top = i ? heights[i - 1] : 0, bot = heights[i] + var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left, + right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left, + top: top, bottom: bot} + if (!rect.left && !rect.right) { result.bogus = true } + if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot } + + return result +} + +// Work around problem with bounding client rects on ranges being +// returned incorrectly when zoomed on IE10 and below. +function maybeUpdateRectForZooming(measure, rect) { + if (!window.screen || screen.logicalXDPI == null || + screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure)) + { return rect } + var scaleX = screen.logicalXDPI / screen.deviceXDPI + var scaleY = screen.logicalYDPI / screen.deviceYDPI + return {left: rect.left * scaleX, right: rect.right * scaleX, + top: rect.top * scaleY, bottom: rect.bottom * scaleY} +} + +function clearLineMeasurementCacheFor(lineView) { + if (lineView.measure) { + lineView.measure.cache = {} + lineView.measure.heights = null + if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++) + { lineView.measure.caches[i] = {} } } + } +} + +function clearLineMeasurementCache(cm) { + cm.display.externalMeasure = null + removeChildren(cm.display.lineMeasure) + for (var i = 0; i < cm.display.view.length; i++) + { clearLineMeasurementCacheFor(cm.display.view[i]) } +} + +function clearCaches(cm) { + clearLineMeasurementCache(cm) + cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null + if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true } + cm.display.lineNumChars = null +} + +function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft } +function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop } + +// Converts a {top, bottom, left, right} box from line-local +// coordinates into another coordinate system. Context may be one of +// "line", "div" (display.lineDiv), "local"./null (editor), "window", +// or "page". +function intoCoordSystem(cm, lineObj, rect, context) { + if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) { + var size = widgetHeight(lineObj.widgets[i]) + rect.top += size; rect.bottom += size + } } } + if (context == "line") { return rect } + if (!context) { context = "local" } + var yOff = heightAtLine(lineObj) + if (context == "local") { yOff += paddingTop(cm.display) } + else { yOff -= cm.display.viewOffset } + if (context == "page" || context == "window") { + var lOff = cm.display.lineSpace.getBoundingClientRect() + yOff += lOff.top + (context == "window" ? 0 : pageScrollY()) + var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()) + rect.left += xOff; rect.right += xOff + } + rect.top += yOff; rect.bottom += yOff + return rect +} + +// Coverts a box from "div" coords to another coordinate system. +// Context may be "window", "page", "div", or "local"./null. +function fromCoordSystem(cm, coords, context) { + if (context == "div") { return coords } + var left = coords.left, top = coords.top + // First move into "page" coordinate system + if (context == "page") { + left -= pageScrollX() + top -= pageScrollY() + } else if (context == "local" || !context) { + var localBox = cm.display.sizer.getBoundingClientRect() + left += localBox.left + top += localBox.top + } + + var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect() + return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top} +} + +function charCoords(cm, pos, context, lineObj, bias) { + if (!lineObj) { lineObj = getLine(cm.doc, pos.line) } + return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context) +} + +// Returns a box for a given cursor position, which may have an +// 'other' property containing the position of the secondary cursor +// on a bidi boundary. +function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) { + lineObj = lineObj || getLine(cm.doc, pos.line) + if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj) } + function get(ch, right) { + var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight) + if (right) { m.left = m.right; } else { m.right = m.left } + return intoCoordSystem(cm, lineObj, m, context) + } + function getBidi(ch, partPos) { + var part = order[partPos], right = part.level % 2 + if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) { + part = order[--partPos] + ch = bidiRight(part) - (part.level % 2 ? 0 : 1) + right = true + } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) { + part = order[++partPos] + ch = bidiLeft(part) - part.level % 2 + right = false + } + if (right && ch == part.to && ch > part.from) { return get(ch - 1) } + return get(ch, right) + } + var order = getOrder(lineObj), ch = pos.ch + if (!order) { return get(ch) } + var partPos = getBidiPartAt(order, ch) + var val = getBidi(ch, partPos) + if (bidiOther != null) { val.other = getBidi(ch, bidiOther) } + return val +} + +// Used to cheaply estimate the coordinates for a position. Used for +// intermediate scroll updates. +function estimateCoords(cm, pos) { + var left = 0 + pos = clipPos(cm.doc, pos) + if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch } + var lineObj = getLine(cm.doc, pos.line) + var top = heightAtLine(lineObj) + paddingTop(cm.display) + return {left: left, right: left, top: top, bottom: top + lineObj.height} +} + +// Positions returned by coordsChar contain some extra information. +// xRel is the relative x position of the input coordinates compared +// to the found position (so xRel > 0 means the coordinates are to +// the right of the character position, for example). When outside +// is true, that means the coordinates lie outside the line's +// vertical range. +function PosWithInfo(line, ch, outside, xRel) { + var pos = Pos(line, ch) + pos.xRel = xRel + if (outside) { pos.outside = true } + return pos +} + +// Compute the character position closest to the given coordinates. +// Input must be lineSpace-local ("div" coordinate system). +function coordsChar(cm, x, y) { + var doc = cm.doc + y += cm.display.viewOffset + if (y < 0) { return PosWithInfo(doc.first, 0, true, -1) } + var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1 + if (lineN > last) + { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1) } + if (x < 0) { x = 0 } + + var lineObj = getLine(doc, lineN) + for (;;) { + var found = coordsCharInner(cm, lineObj, lineN, x, y) + var merged = collapsedSpanAtEnd(lineObj) + var mergedPos = merged && merged.find(0, true) + if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0)) + { lineN = lineNo(lineObj = mergedPos.to.line) } + else + { return found } + } +} + +function coordsCharInner(cm, lineObj, lineNo, x, y) { + var innerOff = y - heightAtLine(lineObj) + var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth + var preparedMeasure = prepareMeasureForLine(cm, lineObj) + + function getX(ch) { + var sp = cursorCoords(cm, Pos(lineNo, ch), "line", lineObj, preparedMeasure) + wrongLine = true + if (innerOff > sp.bottom) { return sp.left - adjust } + else if (innerOff < sp.top) { return sp.left + adjust } + else { wrongLine = false } + return sp.left + } + + var bidi = getOrder(lineObj), dist = lineObj.text.length + var from = lineLeft(lineObj), to = lineRight(lineObj) + var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine + + if (x > toX) { return PosWithInfo(lineNo, to, toOutside, 1) } + // Do a binary search between these bounds. + for (;;) { + if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) { + var ch = x < fromX || x - fromX <= toX - x ? from : to + var outside = ch == from ? fromOutside : toOutside + var xDiff = x - (ch == from ? fromX : toX) + // This is a kludge to handle the case where the coordinates + // are after a line-wrapped line. We should replace it with a + // more general handling of cursor positions around line + // breaks. (Issue #4078) + if (toOutside && !bidi && !/\s/.test(lineObj.text.charAt(ch)) && xDiff > 0 && + ch < lineObj.text.length && preparedMeasure.view.measure.heights.length > 1) { + var charSize = measureCharPrepared(cm, preparedMeasure, ch, "right") + if (innerOff <= charSize.bottom && innerOff >= charSize.top && Math.abs(x - charSize.right) < xDiff) { + outside = false + ch++ + xDiff = x - charSize.right + } + } + while (isExtendingChar(lineObj.text.charAt(ch))) { ++ch } + var pos = PosWithInfo(lineNo, ch, outside, xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0) + return pos + } + var step = Math.ceil(dist / 2), middle = from + step + if (bidi) { + middle = from + for (var i = 0; i < step; ++i) { middle = moveVisually(lineObj, middle, 1) } + } + var middleX = getX(middle) + if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) { toX += 1000; } dist = step} + else {from = middle; fromX = middleX; fromOutside = wrongLine; dist -= step} + } +} + +var measureText +// Compute the default text height. +function textHeight(display) { + if (display.cachedTextHeight != null) { return display.cachedTextHeight } + if (measureText == null) { + measureText = elt("pre") + // Measure a bunch of lines, for browsers that compute + // fractional heights. + for (var i = 0; i < 49; ++i) { + measureText.appendChild(document.createTextNode("x")) + measureText.appendChild(elt("br")) + } + measureText.appendChild(document.createTextNode("x")) + } + removeChildrenAndAdd(display.measure, measureText) + var height = measureText.offsetHeight / 50 + if (height > 3) { display.cachedTextHeight = height } + removeChildren(display.measure) + return height || 1 +} + +// Compute the default character width. +function charWidth(display) { + if (display.cachedCharWidth != null) { return display.cachedCharWidth } + var anchor = elt("span", "xxxxxxxxxx") + var pre = elt("pre", [anchor]) + removeChildrenAndAdd(display.measure, pre) + var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10 + if (width > 2) { display.cachedCharWidth = width } + return width || 10 +} + +// Do a bulk-read of the DOM positions and sizes needed to draw the +// view, so that we don't interleave reading and writing to the DOM. +function getDimensions(cm) { + var d = cm.display, left = {}, width = {} + var gutterLeft = d.gutters.clientLeft + for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) { + left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft + width[cm.options.gutters[i]] = n.clientWidth + } + return {fixedPos: compensateForHScroll(d), + gutterTotalWidth: d.gutters.offsetWidth, + gutterLeft: left, + gutterWidth: width, + wrapperWidth: d.wrapper.clientWidth} +} + +// Computes display.scroller.scrollLeft + display.gutters.offsetWidth, +// but using getBoundingClientRect to get a sub-pixel-accurate +// result. +function compensateForHScroll(display) { + return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left +} + +// Returns a function that estimates the height of a line, to use as +// first approximation until the line becomes visible (and is thus +// properly measurable). +function estimateHeight(cm) { + var th = textHeight(cm.display), wrapping = cm.options.lineWrapping + var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3) + return function (line) { + if (lineIsHidden(cm.doc, line)) { return 0 } + + var widgetsHeight = 0 + if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) { + if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height } + } } + + if (wrapping) + { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th } + else + { return widgetsHeight + th } + } +} + +function estimateLineHeights(cm) { + var doc = cm.doc, est = estimateHeight(cm) + doc.iter(function (line) { + var estHeight = est(line) + if (estHeight != line.height) { updateLineHeight(line, estHeight) } + }) +} + +// Given a mouse event, find the corresponding position. If liberal +// is false, it checks whether a gutter or scrollbar was clicked, +// and returns null if it was. forRect is used by rectangular +// selections, and tries to estimate a character position even for +// coordinates beyond the right of the text. +function posFromMouse(cm, e, liberal, forRect) { + var display = cm.display + if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null } + + var x, y, space = display.lineSpace.getBoundingClientRect() + // Fails unpredictably on IE[67] when mouse is dragged around quickly. + try { x = e.clientX - space.left; y = e.clientY - space.top } + catch (e) { return null } + var coords = coordsChar(cm, x, y), line + if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) { + var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length + coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff)) + } + return coords +} + +// Find the view element corresponding to a given line. Return null +// when the line isn't visible. +function findViewIndex(cm, n) { + if (n >= cm.display.viewTo) { return null } + n -= cm.display.viewFrom + if (n < 0) { return null } + var view = cm.display.view + for (var i = 0; i < view.length; i++) { + n -= view[i].size + if (n < 0) { return i } + } +} + +function updateSelection(cm) { + cm.display.input.showSelection(cm.display.input.prepareSelection()) +} + +function prepareSelection(cm, primary) { + var doc = cm.doc, result = {} + var curFragment = result.cursors = document.createDocumentFragment() + var selFragment = result.selection = document.createDocumentFragment() + + for (var i = 0; i < doc.sel.ranges.length; i++) { + if (primary === false && i == doc.sel.primIndex) { continue } + var range = doc.sel.ranges[i] + if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue } + var collapsed = range.empty() + if (collapsed || cm.options.showCursorWhenSelecting) + { drawSelectionCursor(cm, range.head, curFragment) } + if (!collapsed) + { drawSelectionRange(cm, range, selFragment) } + } + return result +} + +// Draws a cursor for the given range +function drawSelectionCursor(cm, head, output) { + var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine) + + var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor")) + cursor.style.left = pos.left + "px" + cursor.style.top = pos.top + "px" + cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px" + + if (pos.other) { + // Secondary cursor, shown when on a 'jump' in bi-directional text + var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")) + otherCursor.style.display = "" + otherCursor.style.left = pos.other.left + "px" + otherCursor.style.top = pos.other.top + "px" + otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px" + } +} + +// Draws the given range as a highlighted selection +function drawSelectionRange(cm, range, output) { + var display = cm.display, doc = cm.doc + var fragment = document.createDocumentFragment() + var padding = paddingH(cm.display), leftSide = padding.left + var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right + + function add(left, top, width, bottom) { + if (top < 0) { top = 0 } + top = Math.round(top) + bottom = Math.round(bottom) + fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px"))) + } + + function drawForLine(line, fromArg, toArg) { + var lineObj = getLine(doc, line) + var lineLen = lineObj.text.length + var start, end + function coords(ch, bias) { + return charCoords(cm, Pos(line, ch), "div", lineObj, bias) + } + + iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) { + var leftPos = coords(from, "left"), rightPos, left, right + if (from == to) { + rightPos = leftPos + left = right = leftPos.left + } else { + rightPos = coords(to - 1, "right") + if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp } + left = leftPos.left + right = rightPos.right + } + if (fromArg == null && from == 0) { left = leftSide } + if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part + add(left, leftPos.top, null, leftPos.bottom) + left = leftSide + if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top) } + } + if (toArg == null && to == lineLen) { right = rightSide } + if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left) + { start = leftPos } + if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right) + { end = rightPos } + if (left < leftSide + 1) { left = leftSide } + add(left, rightPos.top, right - left, rightPos.bottom) + }) + return {start: start, end: end} + } + + var sFrom = range.from(), sTo = range.to() + if (sFrom.line == sTo.line) { + drawForLine(sFrom.line, sFrom.ch, sTo.ch) + } else { + var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line) + var singleVLine = visualLine(fromLine) == visualLine(toLine) + var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end + var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start + if (singleVLine) { + if (leftEnd.top < rightStart.top - 2) { + add(leftEnd.right, leftEnd.top, null, leftEnd.bottom) + add(leftSide, rightStart.top, rightStart.left, rightStart.bottom) + } else { + add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom) + } + } + if (leftEnd.bottom < rightStart.top) + { add(leftSide, leftEnd.bottom, null, rightStart.top) } + } + + output.appendChild(fragment) +} + +// Cursor-blinking +function restartBlink(cm) { + if (!cm.state.focused) { return } + var display = cm.display + clearInterval(display.blinker) + var on = true + display.cursorDiv.style.visibility = "" + if (cm.options.cursorBlinkRate > 0) + { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; }, + cm.options.cursorBlinkRate) } + else if (cm.options.cursorBlinkRate < 0) + { display.cursorDiv.style.visibility = "hidden" } +} + +function ensureFocus(cm) { + if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm) } +} + +function delayBlurEvent(cm) { + cm.state.delayingBlurEvent = true + setTimeout(function () { if (cm.state.delayingBlurEvent) { + cm.state.delayingBlurEvent = false + onBlur(cm) + } }, 100) +} + +function onFocus(cm, e) { + if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false } + + if (cm.options.readOnly == "nocursor") { return } + if (!cm.state.focused) { + signal(cm, "focus", cm, e) + cm.state.focused = true + addClass(cm.display.wrapper, "CodeMirror-focused") + // This test prevents this from firing when a context + // menu is closed (since the input reset would kill the + // select-all detection hack) + if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) { + cm.display.input.reset() + if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20) } // Issue #1730 + } + cm.display.input.receivedFocus() + } + restartBlink(cm) +} +function onBlur(cm, e) { + if (cm.state.delayingBlurEvent) { return } + + if (cm.state.focused) { + signal(cm, "blur", cm, e) + cm.state.focused = false + rmClass(cm.display.wrapper, "CodeMirror-focused") + } + clearInterval(cm.display.blinker) + setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false } }, 150) +} + +// Re-align line numbers and gutter marks to compensate for +// horizontal scrolling. +function alignHorizontally(cm) { + var display = cm.display, view = display.view + if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return } + var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft + var gutterW = display.gutters.offsetWidth, left = comp + "px" + for (var i = 0; i < view.length; i++) { if (!view[i].hidden) { + if (cm.options.fixedGutter) { + if (view[i].gutter) + { view[i].gutter.style.left = left } + if (view[i].gutterBackground) + { view[i].gutterBackground.style.left = left } + } + var align = view[i].alignable + if (align) { for (var j = 0; j < align.length; j++) + { align[j].style.left = left } } + } } + if (cm.options.fixedGutter) + { display.gutters.style.left = (comp + gutterW) + "px" } +} + +// Used to ensure that the line number gutter is still the right +// size for the current document size. Returns true when an update +// is needed. +function maybeUpdateLineNumberWidth(cm) { + if (!cm.options.lineNumbers) { return false } + var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display + if (last.length != display.lineNumChars) { + var test = display.measure.appendChild(elt("div", [elt("div", last)], + "CodeMirror-linenumber CodeMirror-gutter-elt")) + var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW + display.lineGutter.style.width = "" + display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1 + display.lineNumWidth = display.lineNumInnerWidth + padding + display.lineNumChars = display.lineNumInnerWidth ? last.length : -1 + display.lineGutter.style.width = display.lineNumWidth + "px" + updateGutterSpace(cm) + return true + } + return false +} + +// Read the actual heights of the rendered lines, and update their +// stored heights to match. +function updateHeightsInViewport(cm) { + var display = cm.display + var prevBottom = display.lineDiv.offsetTop + for (var i = 0; i < display.view.length; i++) { + var cur = display.view[i], height = void 0 + if (cur.hidden) { continue } + if (ie && ie_version < 8) { + var bot = cur.node.offsetTop + cur.node.offsetHeight + height = bot - prevBottom + prevBottom = bot + } else { + var box = cur.node.getBoundingClientRect() + height = box.bottom - box.top + } + var diff = cur.line.height - height + if (height < 2) { height = textHeight(display) } + if (diff > .001 || diff < -.001) { + updateLineHeight(cur.line, height) + updateWidgetHeight(cur.line) + if (cur.rest) { for (var j = 0; j < cur.rest.length; j++) + { updateWidgetHeight(cur.rest[j]) } } + } + } +} + +// Read and store the height of line widgets associated with the +// given line. +function updateWidgetHeight(line) { + if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) + { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight } } +} + +// Compute the lines that are visible in a given viewport (defaults +// the the current scroll position). viewport may contain top, +// height, and ensure (see op.scrollToPos) properties. +function visibleLines(display, doc, viewport) { + var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop + top = Math.floor(top - paddingTop(display)) + var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight + + var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom) + // Ensure is a {from: {line, ch}, to: {line, ch}} object, and + // forces those lines into the viewport (if possible). + if (viewport && viewport.ensure) { + var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line + if (ensureFrom < from) { + from = ensureFrom + to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight) + } else if (Math.min(ensureTo, doc.lastLine()) >= to) { + from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight) + to = ensureTo + } + } + return {from: from, to: Math.max(to, from + 1)} +} + +// Sync the scrollable area and scrollbars, ensure the viewport +// covers the visible area. +function setScrollTop(cm, val) { + if (Math.abs(cm.doc.scrollTop - val) < 2) { return } + cm.doc.scrollTop = val + if (!gecko) { updateDisplaySimple(cm, {top: val}) } + if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val } + cm.display.scrollbars.setScrollTop(val) + if (gecko) { updateDisplaySimple(cm) } + startWorker(cm, 100) +} +// Sync scroller and scrollbar, ensure the gutter elements are +// aligned. +function setScrollLeft(cm, val, isScroller) { + if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) { return } + val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth) + cm.doc.scrollLeft = val + alignHorizontally(cm) + if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val } + cm.display.scrollbars.setScrollLeft(val) +} + +// Since the delta values reported on mouse wheel events are +// unstandardized between browsers and even browser versions, and +// generally horribly unpredictable, this code starts by measuring +// the scroll effect that the first few mouse wheel events have, +// and, from that, detects the way it can convert deltas to pixel +// offsets afterwards. +// +// The reason we want to know the amount a wheel event will scroll +// is that it gives us a chance to update the display before the +// actual scrolling happens, reducing flickering. + +var wheelSamples = 0; +var wheelPixelsPerUnit = null; +// Fill in a browser-detected starting value on browsers where we +// know one. These don't have to be accurate -- the result of them +// being wrong would just be a slight flicker on the first wheel +// scroll (if it is large enough). +if (ie) { wheelPixelsPerUnit = -.53 } +else if (gecko) { wheelPixelsPerUnit = 15 } +else if (chrome) { wheelPixelsPerUnit = -.7 } +else if (safari) { wheelPixelsPerUnit = -1/3 } + +function wheelEventDelta(e) { + var dx = e.wheelDeltaX, dy = e.wheelDeltaY + if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail } + if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail } + else if (dy == null) { dy = e.wheelDelta } + return {x: dx, y: dy} +} +function wheelEventPixels(e) { + var delta = wheelEventDelta(e) + delta.x *= wheelPixelsPerUnit + delta.y *= wheelPixelsPerUnit + return delta +} + +function onScrollWheel(cm, e) { + var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y + + var display = cm.display, scroll = display.scroller + // Quit if there's nothing to scroll here + var canScrollX = scroll.scrollWidth > scroll.clientWidth + var canScrollY = scroll.scrollHeight > scroll.clientHeight + if (!(dx && canScrollX || dy && canScrollY)) { return } + + // Webkit browsers on OS X abort momentum scrolls when the target + // of the scroll event is removed from the scrollable element. + // This hack (see related code in patchDisplay) makes sure the + // element is kept around. + if (dy && mac && webkit) { + outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) { + for (var i = 0; i < view.length; i++) { + if (view[i].node == cur) { + cm.display.currentWheelTarget = cur + break outer + } + } } + } - // Compute a suitable new viewport (from & to) - var end = doc.first + doc.size; - var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first); - var to = Math.min(end, update.visible.to + cm.options.viewportMargin); - if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom); - if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo); - if (sawCollapsedSpans) { - from = visualLineNo(cm.doc, from); - to = visualLineEndNo(cm.doc, to); + // On some browsers, horizontal scrolling will cause redraws to + // happen before the gutter has been realigned, causing it to + // wriggle around in a most unseemly way. When we have an + // estimated pixels/delta value, we just handle horizontal + // scrolling entirely here. It'll be slightly off from native, but + // better than glitching out. + if (dx && !gecko && !presto && wheelPixelsPerUnit != null) { + if (dy && canScrollY) + { setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))) } + setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth))) + // Only prevent default scrolling if vertical scrolling is + // actually possible. Otherwise, it causes vertical scroll + // jitter on OSX trackpads when deltaX is small and deltaY + // is large (issue #3579) + if (!dy || (dy && canScrollY)) + { e_preventDefault(e) } + display.wheelStartX = null // Abort measurement, if in progress + return + } + + // 'Project' the visible viewport to cover the area that is being + // scrolled into view (if we know enough to estimate it). + if (dy && wheelPixelsPerUnit != null) { + var pixels = dy * wheelPixelsPerUnit + var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight + if (pixels < 0) { top = Math.max(0, top + pixels - 50) } + else { bot = Math.min(cm.doc.height, bot + pixels + 50) } + updateDisplaySimple(cm, {top: top, bottom: bot}) + } + + if (wheelSamples < 20) { + if (display.wheelStartX == null) { + display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop + display.wheelDX = dx; display.wheelDY = dy + setTimeout(function () { + if (display.wheelStartX == null) { return } + var movedX = scroll.scrollLeft - display.wheelStartX + var movedY = scroll.scrollTop - display.wheelStartY + var sample = (movedY && display.wheelDY && movedY / display.wheelDY) || + (movedX && display.wheelDX && movedX / display.wheelDX) + display.wheelStartX = display.wheelStartY = null + if (!sample) { return } + wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1) + ++wheelSamples + }, 200) + } else { + display.wheelDX += dx; display.wheelDY += dy + } + } +} + +// SCROLLBARS + +// Prepare DOM reads needed to update the scrollbars. Done in one +// shot to minimize update/measure roundtrips. +function measureForScrollbars(cm) { + var d = cm.display, gutterW = d.gutters.offsetWidth + var docH = Math.round(cm.doc.height + paddingVert(cm.display)) + return { + clientHeight: d.scroller.clientHeight, + viewHeight: d.wrapper.clientHeight, + scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth, + viewWidth: d.wrapper.clientWidth, + barLeft: cm.options.fixedGutter ? gutterW : 0, + docHeight: docH, + scrollHeight: docH + scrollGap(cm) + d.barHeight, + nativeBarWidth: d.nativeBarWidth, + gutterWidth: gutterW + } +} + +function NativeScrollbars(place, scroll, cm) { + this.cm = cm + var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar") + var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar") + place(vert); place(horiz) + + on(vert, "scroll", function () { + if (vert.clientHeight) { scroll(vert.scrollTop, "vertical") } + }) + on(horiz, "scroll", function () { + if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal") } + }) + + this.checkedZeroWidth = false + // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). + if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px" } +} + +NativeScrollbars.prototype = copyObj({ + update: function(measure) { + var needsH = measure.scrollWidth > measure.clientWidth + 1 + var needsV = measure.scrollHeight > measure.clientHeight + 1 + var sWidth = measure.nativeBarWidth + + if (needsV) { + this.vert.style.display = "block" + this.vert.style.bottom = needsH ? sWidth + "px" : "0" + var totalHeight = measure.viewHeight - (needsH ? sWidth : 0) + // A bug in IE8 can cause this value to be negative, so guard it. + this.vert.firstChild.style.height = + Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px" + } else { + this.vert.style.display = "" + this.vert.firstChild.style.height = "0" } - var different = from != display.viewFrom || to != display.viewTo || - display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth; - adjustView(cm, from, to); - - display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom)); - // Position the mover div to align with the current scroll position - cm.display.mover.style.top = display.viewOffset + "px"; - - var toUpdate = countDirtyView(cm); - if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view && - (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)) - return false; - - // For big changes, we hide the enclosing element during the - // update, since that speeds up the operations on most browsers. - var focused = activeElt(); - if (toUpdate > 4) display.lineDiv.style.display = "none"; - patchDisplay(cm, display.updateLineNumbers, update.dims); - if (toUpdate > 4) display.lineDiv.style.display = ""; - display.renderedView = display.view; - // There might have been a widget with a focused element that got - // hidden or updated, if so re-focus it. - if (focused && activeElt() != focused && focused.offsetHeight) focused.focus(); - - // Prevent selection and cursors from interfering with the scroll - // width and height. - removeChildren(display.cursorDiv); - removeChildren(display.selectionDiv); - display.gutters.style.height = display.sizer.style.minHeight = 0; - - if (different) { - display.lastWrapHeight = update.wrapperHeight; - display.lastWrapWidth = update.wrapperWidth; - startWorker(cm, 400); + if (needsH) { + this.horiz.style.display = "block" + this.horiz.style.right = needsV ? sWidth + "px" : "0" + this.horiz.style.left = measure.barLeft + "px" + var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0) + this.horiz.firstChild.style.width = + (measure.scrollWidth - measure.clientWidth + totalWidth) + "px" + } else { + this.horiz.style.display = "" + this.horiz.firstChild.style.width = "0" + } + + if (!this.checkedZeroWidth && measure.clientHeight > 0) { + if (sWidth == 0) { this.zeroWidthHack() } + this.checkedZeroWidth = true + } + + return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0} + }, + setScrollLeft: function(pos) { + if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos } + if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz) } + }, + setScrollTop: function(pos) { + if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos } + if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert) } + }, + zeroWidthHack: function() { + var w = mac && !mac_geMountainLion ? "12px" : "18px" + this.horiz.style.height = this.vert.style.width = w + this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none" + this.disableHoriz = new Delayed + this.disableVert = new Delayed + }, + enableZeroWidthBar: function(bar, delay) { + bar.style.pointerEvents = "auto" + function maybeDisable() { + // To find out whether the scrollbar is still visible, we + // check whether the element under the pixel in the bottom + // left corner of the scrollbar box is the scrollbar box + // itself (when the bar is still visible) or its filler child + // (when the bar is hidden). If it is still visible, we keep + // it enabled, if it's hidden, we disable pointer events. + var box = bar.getBoundingClientRect() + var elt = document.elementFromPoint(box.left + 1, box.bottom - 1) + if (elt != bar) { bar.style.pointerEvents = "none" } + else { delay.set(1000, maybeDisable) } + } + delay.set(1000, maybeDisable) + }, + clear: function() { + var parent = this.horiz.parentNode + parent.removeChild(this.horiz) + parent.removeChild(this.vert) + } +}, NativeScrollbars.prototype) + +function NullScrollbars() {} + +NullScrollbars.prototype = copyObj({ + update: function() { return {bottom: 0, right: 0} }, + setScrollLeft: function() {}, + setScrollTop: function() {}, + clear: function() {} +}, NullScrollbars.prototype) + +function updateScrollbars(cm, measure) { + if (!measure) { measure = measureForScrollbars(cm) } + var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight + updateScrollbarsInner(cm, measure) + for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) { + if (startWidth != cm.display.barWidth && cm.options.lineWrapping) + { updateHeightsInViewport(cm) } + updateScrollbarsInner(cm, measureForScrollbars(cm)) + startWidth = cm.display.barWidth; startHeight = cm.display.barHeight + } +} + +// Re-synchronize the fake scrollbars with the actual size of the +// content. +function updateScrollbarsInner(cm, measure) { + var d = cm.display + var sizes = d.scrollbars.update(measure) + + d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px" + d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px" + d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent" + + if (sizes.right && sizes.bottom) { + d.scrollbarFiller.style.display = "block" + d.scrollbarFiller.style.height = sizes.bottom + "px" + d.scrollbarFiller.style.width = sizes.right + "px" + } else { d.scrollbarFiller.style.display = "" } + if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) { + d.gutterFiller.style.display = "block" + d.gutterFiller.style.height = sizes.bottom + "px" + d.gutterFiller.style.width = measure.gutterWidth + "px" + } else { d.gutterFiller.style.display = "" } +} + +var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars} + +function initScrollbars(cm) { + if (cm.display.scrollbars) { + cm.display.scrollbars.clear() + if (cm.display.scrollbars.addClass) + { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass) } + } + + cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) { + cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller) + // Prevent clicks in the scrollbars from killing focus + on(node, "mousedown", function () { + if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0) } + }) + node.setAttribute("cm-not-content", "true") + }, function (pos, axis) { + if (axis == "horizontal") { setScrollLeft(cm, pos) } + else { setScrollTop(cm, pos) } + }, cm) + if (cm.display.scrollbars.addClass) + { addClass(cm.display.wrapper, cm.display.scrollbars.addClass) } +} + +// SCROLLING THINGS INTO VIEW + +// If an editor sits on the top or bottom of the window, partially +// scrolled out of view, this ensures that the cursor is visible. +function maybeScrollWindow(cm, coords) { + if (signalDOMEvent(cm, "scrollCursorIntoView")) { return } + + var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null + if (coords.top + box.top < 0) { doScroll = true } + else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false } + if (doScroll != null && !phantom) { + var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (coords.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (coords.bottom - coords.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (coords.left) + "px; width: 2px;")) + cm.display.lineSpace.appendChild(scrollNode) + scrollNode.scrollIntoView(doScroll) + cm.display.lineSpace.removeChild(scrollNode) + } +} + +// Scroll a given position into view (immediately), verifying that +// it actually became visible (as line heights are accurately +// measured, the position of something may 'drift' during drawing). +function scrollPosIntoView(cm, pos, end, margin) { + if (margin == null) { margin = 0 } + var coords + for (var limit = 0; limit < 5; limit++) { + var changed = false + coords = cursorCoords(cm, pos) + var endCoords = !end || end == pos ? coords : cursorCoords(cm, end) + var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left), + Math.min(coords.top, endCoords.top) - margin, + Math.max(coords.left, endCoords.left), + Math.max(coords.bottom, endCoords.bottom) + margin) + var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft + if (scrollPos.scrollTop != null) { + setScrollTop(cm, scrollPos.scrollTop) + if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true } + } + if (scrollPos.scrollLeft != null) { + setScrollLeft(cm, scrollPos.scrollLeft) + if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true } + } + if (!changed) { break } + } + return coords +} + +// Scroll a given set of coordinates into view (immediately). +function scrollIntoView(cm, x1, y1, x2, y2) { + var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2) + if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop) } + if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft) } +} + +// Calculate a new scroll position needed to scroll the given +// rectangle into view. Returns an object with scrollTop and +// scrollLeft properties. When these are undefined, the +// vertical/horizontal position does not need to be adjusted. +function calculateScrollPos(cm, x1, y1, x2, y2) { + var display = cm.display, snapMargin = textHeight(cm.display) + if (y1 < 0) { y1 = 0 } + var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop + var screen = displayHeight(cm), result = {} + if (y2 - y1 > screen) { y2 = y1 + screen } + var docBottom = cm.doc.height + paddingVert(display) + var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin + if (y1 < screentop) { + result.scrollTop = atTop ? 0 : y1 + } else if (y2 > screentop + screen) { + var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen) + if (newTop != screentop) { result.scrollTop = newTop } + } + + var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft + var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0) + var tooWide = x2 - x1 > screenw + if (tooWide) { x2 = x1 + screenw } + if (x1 < 10) + { result.scrollLeft = 0 } + else if (x1 < screenleft) + { result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10)) } + else if (x2 > screenw + screenleft - 3) + { result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw } + return result +} + +// Store a relative adjustment to the scroll position in the current +// operation (to be applied when the operation finishes). +function addToScrollPos(cm, left, top) { + if (left != null || top != null) { resolveScrollToPos(cm) } + if (left != null) + { cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left } + if (top != null) + { cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top } +} + +// Make sure that at the end of the operation the current cursor is +// shown. +function ensureCursorVisible(cm) { + resolveScrollToPos(cm) + var cur = cm.getCursor(), from = cur, to = cur + if (!cm.options.lineWrapping) { + from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur + to = Pos(cur.line, cur.ch + 1) + } + cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true} +} + +// When an operation has its scrollToPos property set, and another +// scroll action is applied before the end of the operation, this +// 'simulates' scrolling that position into view in a cheap way, so +// that the effect of intermediate scroll commands is not ignored. +function resolveScrollToPos(cm) { + var range = cm.curOp.scrollToPos + if (range) { + cm.curOp.scrollToPos = null + var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to) + var sPos = calculateScrollPos(cm, Math.min(from.left, to.left), + Math.min(from.top, to.top) - range.margin, + Math.max(from.right, to.right), + Math.max(from.bottom, to.bottom) + range.margin) + cm.scrollTo(sPos.scrollLeft, sPos.scrollTop) + } +} + +// Operations are used to wrap a series of changes to the editor +// state in such a way that each change won't have to update the +// cursor and display (which would be awkward, slow, and +// error-prone). Instead, display updates are batched and then all +// combined and executed at once. + +var nextOpId = 0 +// Start a new operation. +function startOperation(cm) { + cm.curOp = { + cm: cm, + viewChanged: false, // Flag that indicates that lines might need to be redrawn + startHeight: cm.doc.height, // Used to detect need to update scrollbar + forceUpdate: false, // Used to force a redraw + updateInput: null, // Whether to reset the input textarea + typing: false, // Whether this reset should be careful to leave existing text (for compositing) + changeObjs: null, // Accumulated changes, for firing change events + cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on + cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already + selectionChanged: false, // Whether the selection needs to be redrawn + updateMaxLine: false, // Set when the widest line needs to be determined anew + scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet + scrollToPos: null, // Used to scroll to a specific position + focus: false, + id: ++nextOpId // Unique ID + } + pushOperation(cm.curOp) +} + +// Finish an operation, updating the display and signalling delayed events +function endOperation(cm) { + var op = cm.curOp + finishOperation(op, function (group) { + for (var i = 0; i < group.ops.length; i++) + { group.ops[i].cm.curOp = null } + endOperations(group) + }) +} + +// The DOM updates done when an operation finishes are batched so +// that the minimum number of relayouts are required. +function endOperations(group) { + var ops = group.ops + for (var i = 0; i < ops.length; i++) // Read DOM + { endOperation_R1(ops[i]) } + for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe) + { endOperation_W1(ops[i$1]) } + for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM + { endOperation_R2(ops[i$2]) } + for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe) + { endOperation_W2(ops[i$3]) } + for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM + { endOperation_finish(ops[i$4]) } +} + +function endOperation_R1(op) { + var cm = op.cm, display = cm.display + maybeClipScrollbars(cm) + if (op.updateMaxLine) { findMaxLine(cm) } + + op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null || + op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom || + op.scrollToPos.to.line >= display.viewTo) || + display.maxLineChanged && cm.options.lineWrapping + op.update = op.mustUpdate && + new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate) +} + +function endOperation_W1(op) { + op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update) +} + +function endOperation_R2(op) { + var cm = op.cm, display = cm.display + if (op.updatedDisplay) { updateHeightsInViewport(cm) } + + op.barMeasure = measureForScrollbars(cm) + + // If the max line changed since it was last measured, measure it, + // and ensure the document's width matches it. + // updateDisplay_W2 will use these properties to do the actual resizing + if (display.maxLineChanged && !cm.options.lineWrapping) { + op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3 + cm.display.sizerWidth = op.adjustWidthTo + op.barMeasure.scrollWidth = + Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth) + op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm)) + } + + if (op.updatedDisplay || op.selectionChanged) + { op.preparedSelection = display.input.prepareSelection(op.focus) } +} + +function endOperation_W2(op) { + var cm = op.cm + + if (op.adjustWidthTo != null) { + cm.display.sizer.style.minWidth = op.adjustWidthTo + "px" + if (op.maxScrollLeft < cm.doc.scrollLeft) + { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true) } + cm.display.maxLineChanged = false + } + + var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus()) + if (op.preparedSelection) + { cm.display.input.showSelection(op.preparedSelection, takeFocus) } + if (op.updatedDisplay || op.startHeight != cm.doc.height) + { updateScrollbars(cm, op.barMeasure) } + if (op.updatedDisplay) + { setDocumentHeight(cm, op.barMeasure) } + + if (op.selectionChanged) { restartBlink(cm) } + + if (cm.state.focused && op.updateInput) + { cm.display.input.reset(op.typing) } + if (takeFocus) { ensureFocus(op.cm) } +} + +function endOperation_finish(op) { + var cm = op.cm, display = cm.display, doc = cm.doc + + if (op.updatedDisplay) { postUpdateDisplay(cm, op.update) } + + // Abort mouse wheel delta measurement, when scrolling explicitly + if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos)) + { display.wheelStartX = display.wheelStartY = null } + + // Propagate the scroll position to the actual DOM scroller + if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) { + doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop)) + display.scrollbars.setScrollTop(doc.scrollTop) + display.scroller.scrollTop = doc.scrollTop + } + if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) { + doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft)) + display.scrollbars.setScrollLeft(doc.scrollLeft) + display.scroller.scrollLeft = doc.scrollLeft + alignHorizontally(cm) + } + // If we need to scroll a specific position into view, do so. + if (op.scrollToPos) { + var coords = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from), + clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin) + if (op.scrollToPos.isCursor && cm.state.focused) { maybeScrollWindow(cm, coords) } + } + + // Fire events for markers that are hidden/unidden by editing or + // undoing + var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers + if (hidden) { for (var i = 0; i < hidden.length; ++i) + { if (!hidden[i].lines.length) { signal(hidden[i], "hide") } } } + if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1) + { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide") } } } + + if (display.wrapper.offsetHeight) + { doc.scrollTop = cm.display.scroller.scrollTop } + + // Fire change events, and delayed event handlers + if (op.changeObjs) + { signal(cm, "changes", cm, op.changeObjs) } + if (op.update) + { op.update.finish() } +} + +// Run the given function in an operation +function runInOp(cm, f) { + if (cm.curOp) { return f() } + startOperation(cm) + try { return f() } + finally { endOperation(cm) } +} +// Wraps a function in an operation. Returns the wrapped function. +function operation(cm, f) { + return function() { + if (cm.curOp) { return f.apply(cm, arguments) } + startOperation(cm) + try { return f.apply(cm, arguments) } + finally { endOperation(cm) } + } +} +// Used to add methods to editor and doc instances, wrapping them in +// operations. +function methodOp(f) { + return function() { + if (this.curOp) { return f.apply(this, arguments) } + startOperation(this) + try { return f.apply(this, arguments) } + finally { endOperation(this) } + } +} +function docMethodOp(f) { + return function() { + var cm = this.cm + if (!cm || cm.curOp) { return f.apply(this, arguments) } + startOperation(cm) + try { return f.apply(this, arguments) } + finally { endOperation(cm) } + } +} + +// Updates the display.view data structure for a given change to the +// document. From and to are in pre-change coordinates. Lendiff is +// the amount of lines added or subtracted by the change. This is +// used for changes that span multiple lines, or change the way +// lines are divided into visual lines. regLineChange (below) +// registers single-line changes. +function regChange(cm, from, to, lendiff) { + if (from == null) { from = cm.doc.first } + if (to == null) { to = cm.doc.first + cm.doc.size } + if (!lendiff) { lendiff = 0 } + + var display = cm.display + if (lendiff && to < display.viewTo && + (display.updateLineNumbers == null || display.updateLineNumbers > from)) + { display.updateLineNumbers = from } + + cm.curOp.viewChanged = true + + if (from >= display.viewTo) { // Change after + if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo) + { resetView(cm) } + } else if (to <= display.viewFrom) { // Change before + if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) { + resetView(cm) + } else { + display.viewFrom += lendiff + display.viewTo += lendiff + } + } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap + resetView(cm) + } else if (from <= display.viewFrom) { // Top overlap + var cut = viewCuttingPoint(cm, to, to + lendiff, 1) + if (cut) { + display.view = display.view.slice(cut.index) + display.viewFrom = cut.lineN + display.viewTo += lendiff + } else { + resetView(cm) } - - display.updateLineNumbers = null; - - return true; + } else if (to >= display.viewTo) { // Bottom overlap + var cut$1 = viewCuttingPoint(cm, from, from, -1) + if (cut$1) { + display.view = display.view.slice(0, cut$1.index) + display.viewTo = cut$1.lineN + } else { + resetView(cm) + } + } else { // Gap in the middle + var cutTop = viewCuttingPoint(cm, from, from, -1) + var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1) + if (cutTop && cutBot) { + display.view = display.view.slice(0, cutTop.index) + .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN)) + .concat(display.view.slice(cutBot.index)) + display.viewTo += lendiff + } else { + resetView(cm) + } + } + + var ext = display.externalMeasured + if (ext) { + if (to < ext.lineN) + { ext.lineN += lendiff } + else if (from < ext.lineN + ext.size) + { display.externalMeasured = null } + } +} + +// Register a change to a single line. Type must be one of "text", +// "gutter", "class", "widget" +function regLineChange(cm, line, type) { + cm.curOp.viewChanged = true + var display = cm.display, ext = cm.display.externalMeasured + if (ext && line >= ext.lineN && line < ext.lineN + ext.size) + { display.externalMeasured = null } + + if (line < display.viewFrom || line >= display.viewTo) { return } + var lineView = display.view[findViewIndex(cm, line)] + if (lineView.node == null) { return } + var arr = lineView.changes || (lineView.changes = []) + if (indexOf(arr, type) == -1) { arr.push(type) } +} + +// Clear the view. +function resetView(cm) { + cm.display.viewFrom = cm.display.viewTo = cm.doc.first + cm.display.view = [] + cm.display.viewOffset = 0 +} + +function viewCuttingPoint(cm, oldN, newN, dir) { + var index = findViewIndex(cm, oldN), diff, view = cm.display.view + if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size) + { return {index: index, lineN: newN} } + var n = cm.display.viewFrom + for (var i = 0; i < index; i++) + { n += view[i].size } + if (n != oldN) { + if (dir > 0) { + if (index == view.length - 1) { return null } + diff = (n + view[index].size) - oldN + index++ + } else { + diff = n - oldN + } + oldN += diff; newN += diff + } + while (visualLineNo(cm.doc, newN) != newN) { + if (index == (dir < 0 ? 0 : view.length - 1)) { return null } + newN += dir * view[index - (dir < 0 ? 1 : 0)].size + index += dir + } + return {index: index, lineN: newN} +} + +// Force the view to cover a given range, adding empty view element +// or clipping off existing ones as needed. +function adjustView(cm, from, to) { + var display = cm.display, view = display.view + if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) { + display.view = buildViewArray(cm, from, to) + display.viewFrom = from + } else { + if (display.viewFrom > from) + { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view) } + else if (display.viewFrom < from) + { display.view = display.view.slice(findViewIndex(cm, from)) } + display.viewFrom = from + if (display.viewTo < to) + { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)) } + else if (display.viewTo > to) + { display.view = display.view.slice(0, findViewIndex(cm, to)) } + } + display.viewTo = to +} + +// Count the number of lines in the view whose DOM representation is +// out of date (or nonexistent). +function countDirtyView(cm) { + var view = cm.display.view, dirty = 0 + for (var i = 0; i < view.length; i++) { + var lineView = view[i] + if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty } + } + return dirty +} + +// HIGHLIGHT WORKER + +function startWorker(cm, time) { + if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo) + { cm.state.highlight.set(time, bind(highlightWorker, cm)) } +} + +function highlightWorker(cm) { + var doc = cm.doc + if (doc.frontier < doc.first) { doc.frontier = doc.first } + if (doc.frontier >= cm.display.viewTo) { return } + var end = +new Date + cm.options.workTime + var state = copyState(doc.mode, getStateBefore(cm, doc.frontier)) + var changedLines = [] + + doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) { + if (doc.frontier >= cm.display.viewFrom) { // Visible + var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength + var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true) + line.styles = highlighted.styles + var oldCls = line.styleClasses, newCls = highlighted.classes + if (newCls) { line.styleClasses = newCls } + else if (oldCls) { line.styleClasses = null } + var ischange = !oldStyles || oldStyles.length != line.styles.length || + oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass) + for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i] } + if (ischange) { changedLines.push(doc.frontier) } + line.stateAfter = tooLong ? state : copyState(doc.mode, state) + } else { + if (line.text.length <= cm.options.maxHighlightLength) + { processLine(cm, line.text, state) } + line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null + } + ++doc.frontier + if (+new Date > end) { + startWorker(cm, cm.options.workDelay) + return true + } + }) + if (changedLines.length) { runInOp(cm, function () { + for (var i = 0; i < changedLines.length; i++) + { regLineChange(cm, changedLines[i], "text") } + }) } +} + +// DISPLAY DRAWING + +function DisplayUpdate(cm, viewport, force) { + var display = cm.display + + this.viewport = viewport + // Store some values that we'll need later (but don't want to force a relayout for) + this.visible = visibleLines(display, cm.doc, viewport) + this.editorIsHidden = !display.wrapper.offsetWidth + this.wrapperHeight = display.wrapper.clientHeight + this.wrapperWidth = display.wrapper.clientWidth + this.oldDisplayWidth = displayWidth(cm) + this.force = force + this.dims = getDimensions(cm) + this.events = [] +} + +DisplayUpdate.prototype.signal = function(emitter, type) { + if (hasHandler(emitter, type)) + { this.events.push(arguments) } +} +DisplayUpdate.prototype.finish = function() { + var this$1 = this; + + for (var i = 0; i < this.events.length; i++) + { signal.apply(null, this$1.events[i]) } +} + +function maybeClipScrollbars(cm) { + var display = cm.display + if (!display.scrollbarsClipped && display.scroller.offsetWidth) { + display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth + display.heightForcer.style.height = scrollGap(cm) + "px" + display.sizer.style.marginBottom = -display.nativeBarWidth + "px" + display.sizer.style.borderRightWidth = scrollGap(cm) + "px" + display.scrollbarsClipped = true + } +} + +// Does the actual updating of the line display. Bails out +// (returning false) when there is nothing to be done and forced is +// false. +function updateDisplayIfNeeded(cm, update) { + var display = cm.display, doc = cm.doc + + if (update.editorIsHidden) { + resetView(cm) + return false + } + + // Bail out if the visible area is already rendered and nothing changed. + if (!update.force && + update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo && + (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) && + display.renderedView == display.view && countDirtyView(cm) == 0) + { return false } + + if (maybeUpdateLineNumberWidth(cm)) { + resetView(cm) + update.dims = getDimensions(cm) + } + + // Compute a suitable new viewport (from & to) + var end = doc.first + doc.size + var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first) + var to = Math.min(end, update.visible.to + cm.options.viewportMargin) + if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom) } + if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo) } + if (sawCollapsedSpans) { + from = visualLineNo(cm.doc, from) + to = visualLineEndNo(cm.doc, to) + } + + var different = from != display.viewFrom || to != display.viewTo || + display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth + adjustView(cm, from, to) + + display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom)) + // Position the mover div to align with the current scroll position + cm.display.mover.style.top = display.viewOffset + "px" + + var toUpdate = countDirtyView(cm) + if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view && + (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)) + { return false } + + // For big changes, we hide the enclosing element during the + // update, since that speeds up the operations on most browsers. + var focused = activeElt() + if (toUpdate > 4) { display.lineDiv.style.display = "none" } + patchDisplay(cm, display.updateLineNumbers, update.dims) + if (toUpdate > 4) { display.lineDiv.style.display = "" } + display.renderedView = display.view + // There might have been a widget with a focused element that got + // hidden or updated, if so re-focus it. + if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus() } + + // Prevent selection and cursors from interfering with the scroll + // width and height. + removeChildren(display.cursorDiv) + removeChildren(display.selectionDiv) + display.gutters.style.height = display.sizer.style.minHeight = 0 + + if (different) { + display.lastWrapHeight = update.wrapperHeight + display.lastWrapWidth = update.wrapperWidth + startWorker(cm, 400) + } + + display.updateLineNumbers = null + + return true +} + +function postUpdateDisplay(cm, update) { + var viewport = update.viewport + + for (var first = true;; first = false) { + if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) { + // Clip forced viewport to actual scrollable area. + if (viewport && viewport.top != null) + { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)} } + // Updated line heights might result in the drawn area not + // actually covering the viewport. Keep looping until it does. + update.visible = visibleLines(cm.display, cm.doc, viewport) + if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo) + { break } + } + if (!updateDisplayIfNeeded(cm, update)) { break } + updateHeightsInViewport(cm) + var barMeasure = measureForScrollbars(cm) + updateSelection(cm) + updateScrollbars(cm, barMeasure) + setDocumentHeight(cm, barMeasure) + } + + update.signal(cm, "update", cm) + if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) { + update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo) + cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo + } +} + +function updateDisplaySimple(cm, viewport) { + var update = new DisplayUpdate(cm, viewport) + if (updateDisplayIfNeeded(cm, update)) { + updateHeightsInViewport(cm) + postUpdateDisplay(cm, update) + var barMeasure = measureForScrollbars(cm) + updateSelection(cm) + updateScrollbars(cm, barMeasure) + setDocumentHeight(cm, barMeasure) + update.finish() + } +} + +// Sync the actual display DOM structure with display.view, removing +// nodes for lines that are no longer in view, and creating the ones +// that are not there yet, and updating the ones that are out of +// date. +function patchDisplay(cm, updateNumbersFrom, dims) { + var display = cm.display, lineNumbers = cm.options.lineNumbers + var container = display.lineDiv, cur = container.firstChild + + function rm(node) { + var next = node.nextSibling + // Works around a throw-scroll bug in OS X Webkit + if (webkit && mac && cm.display.currentWheelTarget == node) + { node.style.display = "none" } + else + { node.parentNode.removeChild(node) } + return next + } + + var view = display.view, lineN = display.viewFrom + // Loop over the elements in the view, syncing cur (the DOM nodes + // in display.lineDiv) with the view as we go. + for (var i = 0; i < view.length; i++) { + var lineView = view[i] + if (lineView.hidden) { + } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet + var node = buildLineElement(cm, lineView, lineN, dims) + container.insertBefore(node, cur) + } else { // Already drawn + while (cur != lineView.node) { cur = rm(cur) } + var updateNumber = lineNumbers && updateNumbersFrom != null && + updateNumbersFrom <= lineN && lineView.lineNumber + if (lineView.changes) { + if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false } + updateLineForChanges(cm, lineView, lineN, dims) + } + if (updateNumber) { + removeChildren(lineView.lineNumber) + lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN))) + } + cur = lineView.node.nextSibling + } + lineN += lineView.size + } + while (cur) { cur = rm(cur) } +} + +function updateGutterSpace(cm) { + var width = cm.display.gutters.offsetWidth + cm.display.sizer.style.marginLeft = width + "px" +} + +function setDocumentHeight(cm, measure) { + cm.display.sizer.style.minHeight = measure.docHeight + "px" + cm.display.heightForcer.style.top = measure.docHeight + "px" + cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px" +} + +// Rebuild the gutter elements, ensure the margin to the left of the +// code matches their width. +function updateGutters(cm) { + var gutters = cm.display.gutters, specs = cm.options.gutters + removeChildren(gutters) + var i = 0 + for (; i < specs.length; ++i) { + var gutterClass = specs[i] + var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass)) + if (gutterClass == "CodeMirror-linenumbers") { + cm.display.lineGutter = gElt + gElt.style.width = (cm.display.lineNumWidth || 1) + "px" + } + } + gutters.style.display = i ? "" : "none" + updateGutterSpace(cm) +} + +// Make sure the gutters options contains the element +// "CodeMirror-linenumbers" when the lineNumbers option is true. +function setGuttersForLineNumbers(options) { + var found = indexOf(options.gutters, "CodeMirror-linenumbers") + if (found == -1 && options.lineNumbers) { + options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]) + } else if (found > -1 && !options.lineNumbers) { + options.gutters = options.gutters.slice(0) + options.gutters.splice(found, 1) + } +} + +// Selection objects are immutable. A new one is created every time +// the selection changes. A selection is one or more non-overlapping +// (and non-touching) ranges, sorted, and an integer that indicates +// which one is the primary selection (the one that's scrolled into +// view, that getCursor returns, etc). +function Selection(ranges, primIndex) { + this.ranges = ranges + this.primIndex = primIndex +} + +Selection.prototype = { + primary: function() { return this.ranges[this.primIndex] }, + equals: function(other) { + var this$1 = this; + + if (other == this) { return true } + if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false } + for (var i = 0; i < this.ranges.length; i++) { + var here = this$1.ranges[i], there = other.ranges[i] + if (cmp(here.anchor, there.anchor) != 0 || cmp(here.head, there.head) != 0) { return false } + } + return true + }, + deepCopy: function() { + var this$1 = this; + + var out = [] + for (var i = 0; i < this.ranges.length; i++) + { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)) } + return new Selection(out, this.primIndex) + }, + somethingSelected: function() { + var this$1 = this; + + for (var i = 0; i < this.ranges.length; i++) + { if (!this$1.ranges[i].empty()) { return true } } + return false + }, + contains: function(pos, end) { + var this$1 = this; + + if (!end) { end = pos } + for (var i = 0; i < this.ranges.length; i++) { + var range = this$1.ranges[i] + if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0) + { return i } + } + return -1 + } +} + +function Range(anchor, head) { + this.anchor = anchor; this.head = head +} + +Range.prototype = { + from: function() { return minPos(this.anchor, this.head) }, + to: function() { return maxPos(this.anchor, this.head) }, + empty: function() { + return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch + } +} + +// Take an unsorted, potentially overlapping set of ranges, and +// build a selection out of it. 'Consumes' ranges array (modifying +// it). +function normalizeSelection(ranges, primIndex) { + var prim = ranges[primIndex] + ranges.sort(function (a, b) { return cmp(a.from(), b.from()); }) + primIndex = indexOf(ranges, prim) + for (var i = 1; i < ranges.length; i++) { + var cur = ranges[i], prev = ranges[i - 1] + if (cmp(prev.to(), cur.from()) >= 0) { + var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to()) + var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head + if (i <= primIndex) { --primIndex } + ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to)) + } + } + return new Selection(ranges, primIndex) +} + +function simpleSelection(anchor, head) { + return new Selection([new Range(anchor, head || anchor)], 0) +} + +// Compute the position of the end of a change (its 'to' property +// refers to the pre-change end). +function changeEnd(change) { + if (!change.text) { return change.to } + return Pos(change.from.line + change.text.length - 1, + lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0)) +} + +// Adjust a position to refer to the post-change position of the +// same text, or the end of the change if the change covers it. +function adjustForChange(pos, change) { + if (cmp(pos, change.from) < 0) { return pos } + if (cmp(pos, change.to) <= 0) { return changeEnd(change) } + + var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch + if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch } + return Pos(line, ch) +} + +function computeSelAfterChange(doc, change) { + var out = [] + for (var i = 0; i < doc.sel.ranges.length; i++) { + var range = doc.sel.ranges[i] + out.push(new Range(adjustForChange(range.anchor, change), + adjustForChange(range.head, change))) + } + return normalizeSelection(out, doc.sel.primIndex) +} + +function offsetPos(pos, old, nw) { + if (pos.line == old.line) + { return Pos(nw.line, pos.ch - old.ch + nw.ch) } + else + { return Pos(nw.line + (pos.line - old.line), pos.ch) } +} + +// Used by replaceSelections to allow moving the selection to the +// start or around the replaced test. Hint may be "start" or "around". +function computeReplacedSel(doc, changes, hint) { + var out = [] + var oldPrev = Pos(doc.first, 0), newPrev = oldPrev + for (var i = 0; i < changes.length; i++) { + var change = changes[i] + var from = offsetPos(change.from, oldPrev, newPrev) + var to = offsetPos(changeEnd(change), oldPrev, newPrev) + oldPrev = change.to + newPrev = to + if (hint == "around") { + var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0 + out[i] = new Range(inv ? to : from, inv ? from : to) + } else { + out[i] = new Range(from, from) + } + } + return new Selection(out, doc.sel.primIndex) +} + +// Used to get the editor into a consistent state again when options change. + +function loadMode(cm) { + cm.doc.mode = getMode(cm.options, cm.doc.modeOption) + resetModeState(cm) +} + +function resetModeState(cm) { + cm.doc.iter(function (line) { + if (line.stateAfter) { line.stateAfter = null } + if (line.styles) { line.styles = null } + }) + cm.doc.frontier = cm.doc.first + startWorker(cm, 100) + cm.state.modeGen++ + if (cm.curOp) { regChange(cm) } +} + +// DOCUMENT DATA STRUCTURE + +// By default, updates that start and end at the beginning of a line +// are treated specially, in order to make the association of line +// widgets and marker elements with the text behave more intuitive. +function isWholeLineUpdate(doc, change) { + return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" && + (!doc.cm || doc.cm.options.wholeLineUpdateBefore) +} + +// Perform a change on the document data structure. +function updateDoc(doc, change, markedSpans, estimateHeight) { + function spansFor(n) {return markedSpans ? markedSpans[n] : null} + function update(line, text, spans) { + updateLine(line, text, spans, estimateHeight) + signalLater(line, "change", line, change) + } + function linesFor(start, end) { + var result = [] + for (var i = start; i < end; ++i) + { result.push(new Line(text[i], spansFor(i), estimateHeight)) } + return result } - function postUpdateDisplay(cm, update) { - var viewport = update.viewport; + var from = change.from, to = change.to, text = change.text + var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line) + var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line + + // Adjust the line structure + if (change.full) { + doc.insert(0, linesFor(0, text.length)) + doc.remove(text.length, doc.size - text.length) + } else if (isWholeLineUpdate(doc, change)) { + // This is a whole-line replace. Treated specially to make + // sure line objects move the way they are supposed to. + var added = linesFor(0, text.length - 1) + update(lastLine, lastLine.text, lastSpans) + if (nlines) { doc.remove(from.line, nlines) } + if (added.length) { doc.insert(from.line, added) } + } else if (firstLine == lastLine) { + if (text.length == 1) { + update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans) + } else { + var added$1 = linesFor(1, text.length - 1) + added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight)) + update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)) + doc.insert(from.line + 1, added$1) + } + } else if (text.length == 1) { + update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0)) + doc.remove(from.line + 1, nlines) + } else { + update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)) + update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans) + var added$2 = linesFor(1, text.length - 1) + if (nlines > 1) { doc.remove(from.line + 1, nlines - 1) } + doc.insert(from.line + 1, added$2) + } + + signalLater(doc, "change", doc, change) +} + +// Call f for all linked documents. +function linkedDocs(doc, f, sharedHistOnly) { + function propagate(doc, skip, sharedHist) { + if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) { + var rel = doc.linked[i] + if (rel.doc == skip) { continue } + var shared = sharedHist && rel.sharedHist + if (sharedHistOnly && !shared) { continue } + f(rel.doc, shared) + propagate(rel.doc, doc, shared) + } } + } + propagate(doc, null, true) +} + +// Attach a document to an editor. +function attachDoc(cm, doc) { + if (doc.cm) { throw new Error("This document is already in use.") } + cm.doc = doc + doc.cm = cm + estimateLineHeights(cm) + loadMode(cm) + if (!cm.options.lineWrapping) { findMaxLine(cm) } + cm.options.mode = doc.modeOption + regChange(cm) +} + +function History(startGen) { + // Arrays of change events and selections. Doing something adds an + // event to done and clears undo. Undoing moves events from done + // to undone, redoing moves them in the other direction. + this.done = []; this.undone = [] + this.undoDepth = Infinity + // Used to track when changes can be merged into a single undo + // event + this.lastModTime = this.lastSelTime = 0 + this.lastOp = this.lastSelOp = null + this.lastOrigin = this.lastSelOrigin = null + // Used by the isClean() method + this.generation = this.maxGeneration = startGen || 1 +} + +// Create a history change event from an updateDoc-style change +// object. +function historyChangeFromChange(doc, change) { + var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)} + attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1) + linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true) + return histChange +} + +// Pop all selection events off the end of a history array. Stop at +// a change event. +function clearSelectionEvents(array) { + while (array.length) { + var last = lst(array) + if (last.ranges) { array.pop() } + else { break } + } +} + +// Find the top change event in the history. Pop off selection +// events that are in the way. +function lastChangeEvent(hist, force) { + if (force) { + clearSelectionEvents(hist.done) + return lst(hist.done) + } else if (hist.done.length && !lst(hist.done).ranges) { + return lst(hist.done) + } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) { + hist.done.pop() + return lst(hist.done) + } +} + +// Register a change in the history. Merges changes that are within +// a single operation, or are close together with an origin that +// allows merging (starting with "+") into a single event. +function addChangeToHistory(doc, change, selAfter, opId) { + var hist = doc.history + hist.undone.length = 0 + var time = +new Date, cur + var last + + if ((hist.lastOp == opId || + hist.lastOrigin == change.origin && change.origin && + ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) || + change.origin.charAt(0) == "*")) && + (cur = lastChangeEvent(hist, hist.lastOp == opId))) { + // Merge this change into the last event + last = lst(cur.changes) + if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) { + // Optimized case for simple insertion -- don't want to add + // new changesets for every character typed + last.to = changeEnd(change) + } else { + // Add new sub-event + cur.changes.push(historyChangeFromChange(doc, change)) + } + } else { + // Can not be merged, start a new event. + var before = lst(hist.done) + if (!before || !before.ranges) + { pushSelectionToHistory(doc.sel, hist.done) } + cur = {changes: [historyChangeFromChange(doc, change)], + generation: hist.generation} + hist.done.push(cur) + while (hist.done.length > hist.undoDepth) { + hist.done.shift() + if (!hist.done[0].ranges) { hist.done.shift() } + } + } + hist.done.push(selAfter) + hist.generation = ++hist.maxGeneration + hist.lastModTime = hist.lastSelTime = time + hist.lastOp = hist.lastSelOp = opId + hist.lastOrigin = hist.lastSelOrigin = change.origin + + if (!last) { signal(doc, "historyAdded") } +} + +function selectionEventCanBeMerged(doc, origin, prev, sel) { + var ch = origin.charAt(0) + return ch == "*" || + ch == "+" && + prev.ranges.length == sel.ranges.length && + prev.somethingSelected() == sel.somethingSelected() && + new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500) +} + +// Called whenever the selection changes, sets the new selection as +// the pending selection in the history, and pushes the old pending +// selection into the 'done' array when it was significantly +// different (in number of selected ranges, emptiness, or time). +function addSelectionToHistory(doc, sel, opId, options) { + var hist = doc.history, origin = options && options.origin + + // A new event is started when the previous origin does not match + // the current, or the origins don't allow matching. Origins + // starting with * are always merged, those starting with + are + // merged when similar and close together in time. + if (opId == hist.lastSelOp || + (origin && hist.lastSelOrigin == origin && + (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin || + selectionEventCanBeMerged(doc, origin, lst(hist.done), sel)))) + { hist.done[hist.done.length - 1] = sel } + else + { pushSelectionToHistory(sel, hist.done) } + + hist.lastSelTime = +new Date + hist.lastSelOrigin = origin + hist.lastSelOp = opId + if (options && options.clearRedo !== false) + { clearSelectionEvents(hist.undone) } +} + +function pushSelectionToHistory(sel, dest) { + var top = lst(dest) + if (!(top && top.ranges && top.equals(sel))) + { dest.push(sel) } +} + +// Used to store marked span information in the history. +function attachLocalSpans(doc, change, from, to) { + var existing = change["spans_" + doc.id], n = 0 + doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) { + if (line.markedSpans) + { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans } + ++n + }) +} + +// When un/re-doing restores text containing marked spans, those +// that have been explicitly cleared should not be restored. +function removeClearedSpans(spans) { + if (!spans) { return null } + var out + for (var i = 0; i < spans.length; ++i) { + if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i) } } + else if (out) { out.push(spans[i]) } + } + return !out ? spans : out.length ? out : null +} + +// Retrieve and filter the old marked spans stored in a change event. +function getOldSpans(doc, change) { + var found = change["spans_" + doc.id] + if (!found) { return null } + var nw = [] + for (var i = 0; i < change.text.length; ++i) + { nw.push(removeClearedSpans(found[i])) } + return nw +} + +// Used for un/re-doing changes from the history. Combines the +// result of computing the existing spans with the set of spans that +// existed in the history (so that deleting around a span and then +// undoing brings back the span). +function mergeOldSpans(doc, change) { + var old = getOldSpans(doc, change) + var stretched = stretchSpansOverChange(doc, change) + if (!old) { return stretched } + if (!stretched) { return old } + + for (var i = 0; i < old.length; ++i) { + var oldCur = old[i], stretchCur = stretched[i] + if (oldCur && stretchCur) { + spans: for (var j = 0; j < stretchCur.length; ++j) { + var span = stretchCur[j] + for (var k = 0; k < oldCur.length; ++k) + { if (oldCur[k].marker == span.marker) { continue spans } } + oldCur.push(span) + } + } else if (stretchCur) { + old[i] = stretchCur + } + } + return old +} + +// Used both to provide a JSON-safe object in .getHistory, and, when +// detaching a document, to split the history in two +function copyHistoryArray(events, newGroup, instantiateSel) { + var copy = [] + for (var i = 0; i < events.length; ++i) { + var event = events[i] + if (event.ranges) { + copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event) + continue + } + var changes = event.changes, newChanges = [] + copy.push({changes: newChanges}) + for (var j = 0; j < changes.length; ++j) { + var change = changes[j], m = void 0 + newChanges.push({from: change.from, to: change.to, text: change.text}) + if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) { + if (indexOf(newGroup, Number(m[1])) > -1) { + lst(newChanges)[prop] = change[prop] + delete change[prop] + } + } } } + } + } + return copy +} + +// The 'scroll' parameter given to many of these indicated whether +// the new cursor position should be scrolled into view after +// modifying the selection. + +// If shift is held or the extend flag is set, extends a range to +// include a given position (and optionally a second position). +// Otherwise, simply returns the range between the given positions. +// Used for cursor motion and such. +function extendRange(doc, range, head, other) { + if (doc.cm && doc.cm.display.shift || doc.extend) { + var anchor = range.anchor + if (other) { + var posBefore = cmp(head, anchor) < 0 + if (posBefore != (cmp(other, anchor) < 0)) { + anchor = head + head = other + } else if (posBefore != (cmp(head, other) < 0)) { + head = other + } + } + return new Range(anchor, head) + } else { + return new Range(other || head, head) + } +} + +// Extend the primary selection range, discard the rest. +function extendSelection(doc, head, other, options) { + setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options) +} + +// Extend all selections (pos is an array of selections with length +// equal the number of selections) +function extendSelections(doc, heads, options) { + var out = [] + for (var i = 0; i < doc.sel.ranges.length; i++) + { out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null) } + var newSel = normalizeSelection(out, doc.sel.primIndex) + setSelection(doc, newSel, options) +} + +// Updates a single range in the selection. +function replaceOneSelection(doc, i, range, options) { + var ranges = doc.sel.ranges.slice(0) + ranges[i] = range + setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options) +} + +// Reset the selection to a single range. +function setSimpleSelection(doc, anchor, head, options) { + setSelection(doc, simpleSelection(anchor, head), options) +} + +// Give beforeSelectionChange handlers a change to influence a +// selection update. +function filterSelectionChange(doc, sel, options) { + var obj = { + ranges: sel.ranges, + update: function(ranges) { + var this$1 = this; + + this.ranges = [] + for (var i = 0; i < ranges.length; i++) + { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor), + clipPos(doc, ranges[i].head)) } + }, + origin: options && options.origin + } + signal(doc, "beforeSelectionChange", doc, obj) + if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj) } + if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) } + else { return sel } +} + +function setSelectionReplaceHistory(doc, sel, options) { + var done = doc.history.done, last = lst(done) + if (last && last.ranges) { + done[done.length - 1] = sel + setSelectionNoUndo(doc, sel, options) + } else { + setSelection(doc, sel, options) + } +} + +// Set a new selection. +function setSelection(doc, sel, options) { + setSelectionNoUndo(doc, sel, options) + addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options) +} + +function setSelectionNoUndo(doc, sel, options) { + if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange")) + { sel = filterSelectionChange(doc, sel, options) } + + var bias = options && options.bias || + (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1) + setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true)) + + if (!(options && options.scroll === false) && doc.cm) + { ensureCursorVisible(doc.cm) } +} + +function setSelectionInner(doc, sel) { + if (sel.equals(doc.sel)) { return } + + doc.sel = sel + + if (doc.cm) { + doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true + signalCursorActivity(doc.cm) + } + signalLater(doc, "cursorActivity", doc) +} + +// Verify that the selection does not partially select any atomic +// marked ranges. +function reCheckSelection(doc) { + setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll) +} + +// Return a selection that does not partially select any atomic +// ranges. +function skipAtomicInSelection(doc, sel, bias, mayClear) { + var out + for (var i = 0; i < sel.ranges.length; i++) { + var range = sel.ranges[i] + var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i] + var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear) + var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear) + if (out || newAnchor != range.anchor || newHead != range.head) { + if (!out) { out = sel.ranges.slice(0, i) } + out[i] = new Range(newAnchor, newHead) + } + } + return out ? normalizeSelection(out, sel.primIndex) : sel +} + +function skipAtomicInner(doc, pos, oldPos, dir, mayClear) { + var line = getLine(doc, pos.line) + if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) { + var sp = line.markedSpans[i], m = sp.marker + if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) && + (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) { + if (mayClear) { + signal(m, "beforeCursorEnter") + if (m.explicitlyCleared) { + if (!line.markedSpans) { break } + else {--i; continue} + } + } + if (!m.atomic) { continue } + + if (oldPos) { + var near = m.find(dir < 0 ? 1 : -1), diff = void 0 + if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft) + { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null) } + if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0)) + { return skipAtomicInner(doc, near, pos, dir, mayClear) } + } + + var far = m.find(dir < 0 ? -1 : 1) + if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight) + { far = movePos(doc, far, dir, far.line == pos.line ? line : null) } + return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null + } + } } + return pos +} + +// Ensure a given position is not inside an atomic range. +function skipAtomic(doc, pos, oldPos, bias, mayClear) { + var dir = bias || 1 + var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) || + (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) || + skipAtomicInner(doc, pos, oldPos, -dir, mayClear) || + (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true)) + if (!found) { + doc.cantEdit = true + return Pos(doc.first, 0) + } + return found +} + +function movePos(doc, pos, dir, line) { + if (dir < 0 && pos.ch == 0) { + if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) } + else { return null } + } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) { + if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) } + else { return null } + } else { + return new Pos(pos.line, pos.ch + dir) + } +} + +function selectAll(cm) { + cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll) +} + +// UPDATING + +// Allow "beforeChange" event handlers to influence a change +function filterChange(doc, change, update) { + var obj = { + canceled: false, + from: change.from, + to: change.to, + text: change.text, + origin: change.origin, + cancel: function () { return obj.canceled = true; } + } + if (update) { obj.update = function (from, to, text, origin) { + if (from) { obj.from = clipPos(doc, from) } + if (to) { obj.to = clipPos(doc, to) } + if (text) { obj.text = text } + if (origin !== undefined) { obj.origin = origin } + } } + signal(doc, "beforeChange", doc, obj) + if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj) } + + if (obj.canceled) { return null } + return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin} +} + +// Apply a change to a document, and add it to the document's +// history, and propagating it to all linked documents. +function makeChange(doc, change, ignoreReadOnly) { + if (doc.cm) { + if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) } + if (doc.cm.state.suppressEdits) { return } + } + + if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { + change = filterChange(doc, change, true) + if (!change) { return } + } + + // Possibly split or suppress the update based on the presence + // of read-only spans in its range. + var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to) + if (split) { + for (var i = split.length - 1; i >= 0; --i) + { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}) } + } else { + makeChangeInner(doc, change) + } +} + +function makeChangeInner(doc, change) { + if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return } + var selAfter = computeSelAfterChange(doc, change) + addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN) + + makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change)) + var rebased = [] + + linkedDocs(doc, function (doc, sharedHist) { + if (!sharedHist && indexOf(rebased, doc.history) == -1) { + rebaseHist(doc.history, change) + rebased.push(doc.history) + } + makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change)) + }) +} + +// Revert a change stored in a document's history. +function makeChangeFromHistory(doc, type, allowSelectionOnly) { + if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return } + + var hist = doc.history, event, selAfter = doc.sel + var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done + + // Verify that there is a useable event (so that ctrl-z won't + // needlessly clear selection events) + var i = 0 + for (; i < source.length; i++) { + event = source[i] + if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges) + { break } + } + if (i == source.length) { return } + hist.lastOrigin = hist.lastSelOrigin = null + + for (;;) { + event = source.pop() + if (event.ranges) { + pushSelectionToHistory(event, dest) + if (allowSelectionOnly && !event.equals(doc.sel)) { + setSelection(doc, event, {clearRedo: false}) + return + } + selAfter = event + } + else { break } + } + + // Build up a reverse change object to add to the opposite history + // stack (redo when undoing, and vice versa). + var antiChanges = [] + pushSelectionToHistory(selAfter, dest) + dest.push({changes: antiChanges, generation: hist.generation}) + hist.generation = event.generation || ++hist.maxGeneration + + var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange") + + var loop = function ( i ) { + var change = event.changes[i] + change.origin = type + if (filter && !filterChange(doc, change, false)) { + source.length = 0 + return {} + } + + antiChanges.push(historyChangeFromChange(doc, change)) + + var after = i ? computeSelAfterChange(doc, change) : lst(source) + makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change)) + if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}) } + var rebased = [] - for (var first = true;; first = false) { - if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) { - // Clip forced viewport to actual scrollable area. - if (viewport && viewport.top != null) - viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; - // Updated line heights might result in the drawn area not - // actually covering the viewport. Keep looping until it does. - update.visible = visibleLines(cm.display, cm.doc, viewport); - if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo) - break; + // Propagate to the linked documents + linkedDocs(doc, function (doc, sharedHist) { + if (!sharedHist && indexOf(rebased, doc.history) == -1) { + rebaseHist(doc.history, change) + rebased.push(doc.history) } - if (!updateDisplayIfNeeded(cm, update)) break; - updateHeightsInViewport(cm); - var barMeasure = measureForScrollbars(cm); - updateSelection(cm); - updateScrollbars(cm, barMeasure); - setDocumentHeight(cm, barMeasure); - } - - update.signal(cm, "update", cm); - if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) { - update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo); - cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo; - } - } - - function updateDisplaySimple(cm, viewport) { - var update = new DisplayUpdate(cm, viewport); - if (updateDisplayIfNeeded(cm, update)) { - updateHeightsInViewport(cm); - postUpdateDisplay(cm, update); - var barMeasure = measureForScrollbars(cm); - updateSelection(cm); - updateScrollbars(cm, barMeasure); - setDocumentHeight(cm, barMeasure); - update.finish(); - } - } - - function setDocumentHeight(cm, measure) { - cm.display.sizer.style.minHeight = measure.docHeight + "px"; - cm.display.heightForcer.style.top = measure.docHeight + "px"; - cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px"; - } - - // Read the actual heights of the rendered lines, and update their - // stored heights to match. - function updateHeightsInViewport(cm) { - var display = cm.display; - var prevBottom = display.lineDiv.offsetTop; - for (var i = 0; i < display.view.length; i++) { - var cur = display.view[i], height; - if (cur.hidden) continue; - if (ie && ie_version < 8) { - var bot = cur.node.offsetTop + cur.node.offsetHeight; - height = bot - prevBottom; - prevBottom = bot; - } else { - var box = cur.node.getBoundingClientRect(); - height = box.bottom - box.top; + makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change)) + }) + }; + + for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) { + var returned = loop( i$1 ); + + if ( returned ) return returned.v; + } +} + +// Sub-views need their line numbers shifted when text is added +// above or below them in the parent document. +function shiftDoc(doc, distance) { + if (distance == 0) { return } + doc.first += distance + doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range( + Pos(range.anchor.line + distance, range.anchor.ch), + Pos(range.head.line + distance, range.head.ch) + ); }), doc.sel.primIndex) + if (doc.cm) { + regChange(doc.cm, doc.first, doc.first - distance, distance) + for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++) + { regLineChange(doc.cm, l, "gutter") } + } +} + +// More lower-level change function, handling only a single document +// (not linked ones). +function makeChangeSingleDoc(doc, change, selAfter, spans) { + if (doc.cm && !doc.cm.curOp) + { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) } + + if (change.to.line < doc.first) { + shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line)) + return + } + if (change.from.line > doc.lastLine()) { return } + + // Clip the change to the size of this doc + if (change.from.line < doc.first) { + var shift = change.text.length - 1 - (doc.first - change.from.line) + shiftDoc(doc, shift) + change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch), + text: [lst(change.text)], origin: change.origin} + } + var last = doc.lastLine() + if (change.to.line > last) { + change = {from: change.from, to: Pos(last, getLine(doc, last).text.length), + text: [change.text[0]], origin: change.origin} + } + + change.removed = getBetween(doc, change.from, change.to) + + if (!selAfter) { selAfter = computeSelAfterChange(doc, change) } + if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans) } + else { updateDoc(doc, change, spans) } + setSelectionNoUndo(doc, selAfter, sel_dontScroll) +} + +// Handle the interaction of a change to a document with the editor +// that this document is part of. +function makeChangeSingleDocInEditor(cm, change, spans) { + var doc = cm.doc, display = cm.display, from = change.from, to = change.to + + var recomputeMaxLength = false, checkWidthStart = from.line + if (!cm.options.lineWrapping) { + checkWidthStart = lineNo(visualLine(getLine(doc, from.line))) + doc.iter(checkWidthStart, to.line + 1, function (line) { + if (line == display.maxLine) { + recomputeMaxLength = true + return true + } + }) + } + + if (doc.sel.contains(change.from, change.to) > -1) + { signalCursorActivity(cm) } + + updateDoc(doc, change, spans, estimateHeight(cm)) + + if (!cm.options.lineWrapping) { + doc.iter(checkWidthStart, from.line + change.text.length, function (line) { + var len = lineLength(line) + if (len > display.maxLineLength) { + display.maxLine = line + display.maxLineLength = len + display.maxLineChanged = true + recomputeMaxLength = false + } + }) + if (recomputeMaxLength) { cm.curOp.updateMaxLine = true } + } + + // Adjust frontier, schedule worker + doc.frontier = Math.min(doc.frontier, from.line) + startWorker(cm, 400) + + var lendiff = change.text.length - (to.line - from.line) - 1 + // Remember that these lines changed, for updating the display + if (change.full) + { regChange(cm) } + else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) + { regLineChange(cm, from.line, "text") } + else + { regChange(cm, from.line, to.line + 1, lendiff) } + + var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change") + if (changeHandler || changesHandler) { + var obj = { + from: from, to: to, + text: change.text, + removed: change.removed, + origin: change.origin + } + if (changeHandler) { signalLater(cm, "change", cm, obj) } + if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj) } + } + cm.display.selForContextMenu = null +} + +function replaceRange(doc, code, from, to, origin) { + if (!to) { to = from } + if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp } + if (typeof code == "string") { code = doc.splitLines(code) } + makeChange(doc, {from: from, to: to, text: code, origin: origin}) +} + +// Rebasing/resetting history to deal with externally-sourced changes + +function rebaseHistSelSingle(pos, from, to, diff) { + if (to < pos.line) { + pos.line += diff + } else if (from < pos.line) { + pos.line = from + pos.ch = 0 + } +} + +// Tries to rebase an array of history events given a change in the +// document. If the change touches the same lines as the event, the +// event, and everything 'behind' it, is discarded. If the change is +// before the event, the event's positions are updated. Uses a +// copy-on-write scheme for the positions, to avoid having to +// reallocate them all on every rebase, but also avoid problems with +// shared position objects being unsafely updated. +function rebaseHistArray(array, from, to, diff) { + for (var i = 0; i < array.length; ++i) { + var sub = array[i], ok = true + if (sub.ranges) { + if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true } + for (var j = 0; j < sub.ranges.length; j++) { + rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff) + rebaseHistSelSingle(sub.ranges[j].head, from, to, diff) + } + continue + } + for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) { + var cur = sub.changes[j$1] + if (to < cur.from.line) { + cur.from = Pos(cur.from.line + diff, cur.from.ch) + cur.to = Pos(cur.to.line + diff, cur.to.ch) + } else if (from <= cur.to.line) { + ok = false + break + } + } + if (!ok) { + array.splice(0, i + 1) + i = 0 + } + } +} + +function rebaseHist(hist, change) { + var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1 + rebaseHistArray(hist.done, from, to, diff) + rebaseHistArray(hist.undone, from, to, diff) +} + +// Utility for applying a change to a line by handle or number, +// returning the number and optionally registering the line as +// changed. +function changeLine(doc, handle, changeType, op) { + var no = handle, line = handle + if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)) } + else { no = lineNo(handle) } + if (no == null) { return null } + if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType) } + return line +} + +// The document is represented as a BTree consisting of leaves, with +// chunk of lines in them, and branches, with up to ten leaves or +// other branch nodes below them. The top node is always a branch +// node, and is the document object itself (meaning it has +// additional methods and properties). +// +// All nodes have parent links. The tree is used both to go from +// line numbers to line objects, and to go from objects to numbers. +// It also indexes by height, and is used to convert between height +// and line object, and to find the total height of the document. +// +// See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html + +function LeafChunk(lines) { + var this$1 = this; + + this.lines = lines + this.parent = null + var height = 0 + for (var i = 0; i < lines.length; ++i) { + lines[i].parent = this$1 + height += lines[i].height + } + this.height = height +} + +LeafChunk.prototype = { + chunkSize: function() { return this.lines.length }, + // Remove the n lines at offset 'at'. + removeInner: function(at, n) { + var this$1 = this; + + for (var i = at, e = at + n; i < e; ++i) { + var line = this$1.lines[i] + this$1.height -= line.height + cleanUpLine(line) + signalLater(line, "delete") + } + this.lines.splice(at, n) + }, + // Helper used to collapse a small branch into a single leaf. + collapse: function(lines) { + lines.push.apply(lines, this.lines) + }, + // Insert the given array of lines at offset 'at', count them as + // having the given height. + insertInner: function(at, lines, height) { + var this$1 = this; + + this.height += height + this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at)) + for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1 } + }, + // Used to iterate over a part of the tree. + iterN: function(at, n, op) { + var this$1 = this; + + for (var e = at + n; at < e; ++at) + { if (op(this$1.lines[at])) { return true } } + } +} + +function BranchChunk(children) { + var this$1 = this; + + this.children = children + var size = 0, height = 0 + for (var i = 0; i < children.length; ++i) { + var ch = children[i] + size += ch.chunkSize(); height += ch.height + ch.parent = this$1 + } + this.size = size + this.height = height + this.parent = null +} + +BranchChunk.prototype = { + chunkSize: function() { return this.size }, + removeInner: function(at, n) { + var this$1 = this; + + this.size -= n + for (var i = 0; i < this.children.length; ++i) { + var child = this$1.children[i], sz = child.chunkSize() + if (at < sz) { + var rm = Math.min(n, sz - at), oldHeight = child.height + child.removeInner(at, rm) + this$1.height -= oldHeight - child.height + if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null } + if ((n -= rm) == 0) { break } + at = 0 + } else { at -= sz } + } + // If the result is smaller than 25 lines, ensure that it is a + // single leaf node. + if (this.size - n < 25 && + (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) { + var lines = [] + this.collapse(lines) + this.children = [new LeafChunk(lines)] + this.children[0].parent = this + } + }, + collapse: function(lines) { + var this$1 = this; + + for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines) } + }, + insertInner: function(at, lines, height) { + var this$1 = this; + + this.size += lines.length + this.height += height + for (var i = 0; i < this.children.length; ++i) { + var child = this$1.children[i], sz = child.chunkSize() + if (at <= sz) { + child.insertInner(at, lines, height) + if (child.lines && child.lines.length > 50) { + // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced. + // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest. + var remaining = child.lines.length % 25 + 25 + for (var pos = remaining; pos < child.lines.length;) { + var leaf = new LeafChunk(child.lines.slice(pos, pos += 25)) + child.height -= leaf.height + this$1.children.splice(++i, 0, leaf) + leaf.parent = this$1 + } + child.lines = child.lines.slice(0, remaining) + this$1.maybeSpill() + } + break } - var diff = cur.line.height - height; - if (height < 2) height = textHeight(display); - if (diff > .001 || diff < -.001) { - updateLineHeight(cur.line, height); - updateWidgetHeight(cur.line); - if (cur.rest) for (var j = 0; j < cur.rest.length; j++) - updateWidgetHeight(cur.rest[j]); + at -= sz + } + }, + // When a node has grown, check whether it should be split. + maybeSpill: function() { + if (this.children.length <= 10) { return } + var me = this + do { + var spilled = me.children.splice(me.children.length - 5, 5) + var sibling = new BranchChunk(spilled) + if (!me.parent) { // Become the parent node + var copy = new BranchChunk(me.children) + copy.parent = me + me.children = [copy, sibling] + me = copy + } else { + me.size -= sibling.size + me.height -= sibling.height + var myIndex = indexOf(me.parent.children, me) + me.parent.children.splice(myIndex + 1, 0, sibling) + } + sibling.parent = me.parent + } while (me.children.length > 10) + me.parent.maybeSpill() + }, + iterN: function(at, n, op) { + var this$1 = this; + + for (var i = 0; i < this.children.length; ++i) { + var child = this$1.children[i], sz = child.chunkSize() + if (at < sz) { + var used = Math.min(n, sz - at) + if (child.iterN(at, used, op)) { return true } + if ((n -= used) == 0) { break } + at = 0 + } else { at -= sz } + } + } +} + +// Line widgets are block elements displayed above or below a line. + +function LineWidget(doc, node, options) { + var this$1 = this; + + if (options) { for (var opt in options) { if (options.hasOwnProperty(opt)) + { this$1[opt] = options[opt] } } } + this.doc = doc + this.node = node +} +eventMixin(LineWidget) + +function adjustScrollWhenAboveVisible(cm, line, diff) { + if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop)) + { addToScrollPos(cm, null, diff) } +} + +LineWidget.prototype.clear = function() { + var this$1 = this; + + var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line) + if (no == null || !ws) { return } + for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1) } } + if (!ws.length) { line.widgets = null } + var height = widgetHeight(this) + updateLineHeight(line, Math.max(0, line.height - height)) + if (cm) { runInOp(cm, function () { + adjustScrollWhenAboveVisible(cm, line, -height) + regLineChange(cm, no, "widget") + }) } +} +LineWidget.prototype.changed = function() { + var oldH = this.height, cm = this.doc.cm, line = this.line + this.height = null + var diff = widgetHeight(this) - oldH + if (!diff) { return } + updateLineHeight(line, line.height + diff) + if (cm) { runInOp(cm, function () { + cm.curOp.forceUpdate = true + adjustScrollWhenAboveVisible(cm, line, diff) + }) } +} + +function addLineWidget(doc, handle, node, options) { + var widget = new LineWidget(doc, node, options) + var cm = doc.cm + if (cm && widget.noHScroll) { cm.display.alignWidgets = true } + changeLine(doc, handle, "widget", function (line) { + var widgets = line.widgets || (line.widgets = []) + if (widget.insertAt == null) { widgets.push(widget) } + else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget) } + widget.line = line + if (cm && !lineIsHidden(doc, line)) { + var aboveVisible = heightAtLine(line) < doc.scrollTop + updateLineHeight(line, line.height + widgetHeight(widget)) + if (aboveVisible) { addToScrollPos(cm, null, widget.height) } + cm.curOp.forceUpdate = true + } + return true + }) + return widget +} + +// TEXTMARKERS + +// Created with markText and setBookmark methods. A TextMarker is a +// handle that can be used to clear or find a marked position in the +// document. Line objects hold arrays (markedSpans) containing +// {from, to, marker} object pointing to such marker objects, and +// indicating that such a marker is present on that line. Multiple +// lines may point to the same marker when it spans across lines. +// The spans will have null for their from/to properties when the +// marker continues beyond the start/end of the line. Markers have +// links back to the lines they currently touch. + +// Collapsed markers have unique ids, in order to be able to order +// them, which is needed for uniquely determining an outer marker +// when they overlap (they may nest, but not partially overlap). +var nextMarkerId = 0 + +function TextMarker(doc, type) { + this.lines = [] + this.type = type + this.doc = doc + this.id = ++nextMarkerId +} +eventMixin(TextMarker) + +// Clear the marker. +TextMarker.prototype.clear = function() { + var this$1 = this; + + if (this.explicitlyCleared) { return } + var cm = this.doc.cm, withOp = cm && !cm.curOp + if (withOp) { startOperation(cm) } + if (hasHandler(this, "clear")) { + var found = this.find() + if (found) { signalLater(this, "clear", found.from, found.to) } + } + var min = null, max = null + for (var i = 0; i < this.lines.length; ++i) { + var line = this$1.lines[i] + var span = getMarkedSpanFor(line.markedSpans, this$1) + if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text") } + else if (cm) { + if (span.to != null) { max = lineNo(line) } + if (span.from != null) { min = lineNo(line) } + } + line.markedSpans = removeMarkedSpan(line.markedSpans, span) + if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm) + { updateLineHeight(line, textHeight(cm.display)) } + } + if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) { + var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual) + if (len > cm.display.maxLineLength) { + cm.display.maxLine = visual + cm.display.maxLineLength = len + cm.display.maxLineChanged = true + } + } } + + if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1) } + this.lines.length = 0 + this.explicitlyCleared = true + if (this.atomic && this.doc.cantEdit) { + this.doc.cantEdit = false + if (cm) { reCheckSelection(cm.doc) } + } + if (cm) { signalLater(cm, "markerCleared", cm, this) } + if (withOp) { endOperation(cm) } + if (this.parent) { this.parent.clear() } +} + +// Find the position of the marker in the document. Returns a {from, +// to} object by default. Side can be passed to get a specific side +// -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the +// Pos objects returned contain a line object, rather than a line +// number (used to prevent looking up the same line twice). +TextMarker.prototype.find = function(side, lineObj) { + var this$1 = this; + + if (side == null && this.type == "bookmark") { side = 1 } + var from, to + for (var i = 0; i < this.lines.length; ++i) { + var line = this$1.lines[i] + var span = getMarkedSpanFor(line.markedSpans, this$1) + if (span.from != null) { + from = Pos(lineObj ? line : lineNo(line), span.from) + if (side == -1) { return from } + } + if (span.to != null) { + to = Pos(lineObj ? line : lineNo(line), span.to) + if (side == 1) { return to } + } + } + return from && {from: from, to: to} +} + +// Signals that the marker's widget changed, and surrounding layout +// should be recomputed. +TextMarker.prototype.changed = function() { + var pos = this.find(-1, true), widget = this, cm = this.doc.cm + if (!pos || !cm) { return } + runInOp(cm, function () { + var line = pos.line, lineN = lineNo(pos.line) + var view = findViewForLine(cm, lineN) + if (view) { + clearLineMeasurementCacheFor(view) + cm.curOp.selectionChanged = cm.curOp.forceUpdate = true + } + cm.curOp.updateMaxLine = true + if (!lineIsHidden(widget.doc, line) && widget.height != null) { + var oldHeight = widget.height + widget.height = null + var dHeight = widgetHeight(widget) - oldHeight + if (dHeight) + { updateLineHeight(line, line.height + dHeight) } + } + }) +} + +TextMarker.prototype.attachLine = function(line) { + if (!this.lines.length && this.doc.cm) { + var op = this.doc.cm.curOp + if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1) + { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this) } + } + this.lines.push(line) +} +TextMarker.prototype.detachLine = function(line) { + this.lines.splice(indexOf(this.lines, line), 1) + if (!this.lines.length && this.doc.cm) { + var op = this.doc.cm.curOp + ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this) + } +} + +// Create a marker, wire it up to the right lines, and +function markText(doc, from, to, options, type) { + // Shared markers (across linked documents) are handled separately + // (markTextShared will call out to this again, once per + // document). + if (options && options.shared) { return markTextShared(doc, from, to, options, type) } + // Ensure we are in an operation. + if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) } + + var marker = new TextMarker(doc, type), diff = cmp(from, to) + if (options) { copyObj(options, marker, false) } + // Don't connect empty markers unless clearWhenEmpty is false + if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false) + { return marker } + if (marker.replacedWith) { + // Showing up as a widget implies collapsed (widget replaces text) + marker.collapsed = true + marker.widgetNode = elt("span", [marker.replacedWith], "CodeMirror-widget") + if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true") } + if (options.insertLeft) { marker.widgetNode.insertLeft = true } + } + if (marker.collapsed) { + if (conflictingCollapsedRange(doc, from.line, from, to, marker) || + from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker)) + { throw new Error("Inserting collapsed marker partially overlapping an existing one") } + seeCollapsedSpans() + } + + if (marker.addToHistory) + { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN) } + + var curLine = from.line, cm = doc.cm, updateMaxLine + doc.iter(curLine, to.line + 1, function (line) { + if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine) + { updateMaxLine = true } + if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0) } + addMarkedSpan(line, new MarkedSpan(marker, + curLine == from.line ? from.ch : null, + curLine == to.line ? to.ch : null)) + ++curLine + }) + // lineIsHidden depends on the presence of the spans, so needs a second pass + if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) { + if (lineIsHidden(doc, line)) { updateLineHeight(line, 0) } + }) } + + if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }) } + + if (marker.readOnly) { + seeReadOnlySpans() + if (doc.history.done.length || doc.history.undone.length) + { doc.clearHistory() } + } + if (marker.collapsed) { + marker.id = ++nextMarkerId + marker.atomic = true + } + if (cm) { + // Sync editor state + if (updateMaxLine) { cm.curOp.updateMaxLine = true } + if (marker.collapsed) + { regChange(cm, from.line, to.line + 1) } + else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css) + { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text") } } + if (marker.atomic) { reCheckSelection(cm.doc) } + signalLater(cm, "markerAdded", cm, marker) + } + return marker +} + +// SHARED TEXTMARKERS + +// A shared marker spans multiple linked documents. It is +// implemented as a meta-marker-object controlling multiple normal +// markers. +function SharedTextMarker(markers, primary) { + var this$1 = this; + + this.markers = markers + this.primary = primary + for (var i = 0; i < markers.length; ++i) + { markers[i].parent = this$1 } +} +eventMixin(SharedTextMarker) + +SharedTextMarker.prototype.clear = function() { + var this$1 = this; + + if (this.explicitlyCleared) { return } + this.explicitlyCleared = true + for (var i = 0; i < this.markers.length; ++i) + { this$1.markers[i].clear() } + signalLater(this, "clear") +} +SharedTextMarker.prototype.find = function(side, lineObj) { + return this.primary.find(side, lineObj) +} + +function markTextShared(doc, from, to, options, type) { + options = copyObj(options) + options.shared = false + var markers = [markText(doc, from, to, options, type)], primary = markers[0] + var widget = options.widgetNode + linkedDocs(doc, function (doc) { + if (widget) { options.widgetNode = widget.cloneNode(true) } + markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type)) + for (var i = 0; i < doc.linked.length; ++i) + { if (doc.linked[i].isParent) { return } } + primary = lst(markers) + }) + return new SharedTextMarker(markers, primary) +} + +function findSharedMarkers(doc) { + return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; }) +} + +function copySharedMarkers(doc, markers) { + for (var i = 0; i < markers.length; i++) { + var marker = markers[i], pos = marker.find() + var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to) + if (cmp(mFrom, mTo)) { + var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type) + marker.markers.push(subMark) + subMark.parent = marker + } + } +} + +function detachSharedMarkers(markers) { + var loop = function ( i ) { + var marker = markers[i], linked = [marker.primary.doc] + linkedDocs(marker.primary.doc, function (d) { return linked.push(d); }) + for (var j = 0; j < marker.markers.length; j++) { + var subMarker = marker.markers[j] + if (indexOf(linked, subMarker.doc) == -1) { + subMarker.parent = null + marker.markers.splice(j--, 1) } } - } - - // Read and store the height of line widgets associated with the - // given line. - function updateWidgetHeight(line) { - if (line.widgets) for (var i = 0; i < line.widgets.length; ++i) - line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; - } + }; - // Do a bulk-read of the DOM positions and sizes needed to draw the - // view, so that we don't interleave reading and writing to the DOM. - function getDimensions(cm) { - var d = cm.display, left = {}, width = {}; - var gutterLeft = d.gutters.clientLeft; - for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) { - left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft; - width[cm.options.gutters[i]] = n.clientWidth; + for (var i = 0; i < markers.length; i++) loop( i ); +} + +var nextDocId = 0 +var Doc = function(text, mode, firstLine, lineSep) { + if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep) } + if (firstLine == null) { firstLine = 0 } + + BranchChunk.call(this, [new LeafChunk([new Line("", null)])]) + this.first = firstLine + this.scrollTop = this.scrollLeft = 0 + this.cantEdit = false + this.cleanGeneration = 1 + this.frontier = firstLine + var start = Pos(firstLine, 0) + this.sel = simpleSelection(start) + this.history = new History(null) + this.id = ++nextDocId + this.modeOption = mode + this.lineSep = lineSep + this.extend = false + + if (typeof text == "string") { text = this.splitLines(text) } + updateDoc(this, {from: start, to: start, text: text}) + setSelection(this, simpleSelection(start), sel_dontScroll) +} + +Doc.prototype = createObj(BranchChunk.prototype, { + constructor: Doc, + // Iterate over the document. Supports two forms -- with only one + // argument, it calls that for each line in the document. With + // three, it iterates over the range given by the first two (with + // the second being non-inclusive). + iter: function(from, to, op) { + if (op) { this.iterN(from - this.first, to - from, op) } + else { this.iterN(this.first, this.first + this.size, from) } + }, + + // Non-public interface for adding and removing lines. + insert: function(at, lines) { + var height = 0 + for (var i = 0; i < lines.length; ++i) { height += lines[i].height } + this.insertInner(at - this.first, lines, height) + }, + remove: function(at, n) { this.removeInner(at - this.first, n) }, + + // From here, the methods are part of the public interface. Most + // are also available from CodeMirror (editor) instances. + + getValue: function(lineSep) { + var lines = getLines(this, this.first, this.first + this.size) + if (lineSep === false) { return lines } + return lines.join(lineSep || this.lineSeparator()) + }, + setValue: docMethodOp(function(code) { + var top = Pos(this.first, 0), last = this.first + this.size - 1 + makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length), + text: this.splitLines(code), origin: "setValue", full: true}, true) + setSelection(this, simpleSelection(top)) + }), + replaceRange: function(code, from, to, origin) { + from = clipPos(this, from) + to = to ? clipPos(this, to) : from + replaceRange(this, code, from, to, origin) + }, + getRange: function(from, to, lineSep) { + var lines = getBetween(this, clipPos(this, from), clipPos(this, to)) + if (lineSep === false) { return lines } + return lines.join(lineSep || this.lineSeparator()) + }, + + getLine: function(line) {var l = this.getLineHandle(line); return l && l.text}, + + getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }}, + getLineNumber: function(line) {return lineNo(line)}, + + getLineHandleVisualStart: function(line) { + if (typeof line == "number") { line = getLine(this, line) } + return visualLine(line) + }, + + lineCount: function() {return this.size}, + firstLine: function() {return this.first}, + lastLine: function() {return this.first + this.size - 1}, + + clipPos: function(pos) {return clipPos(this, pos)}, + + getCursor: function(start) { + var range = this.sel.primary(), pos + if (start == null || start == "head") { pos = range.head } + else if (start == "anchor") { pos = range.anchor } + else if (start == "end" || start == "to" || start === false) { pos = range.to() } + else { pos = range.from() } + return pos + }, + listSelections: function() { return this.sel.ranges }, + somethingSelected: function() {return this.sel.somethingSelected()}, + + setCursor: docMethodOp(function(line, ch, options) { + setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options) + }), + setSelection: docMethodOp(function(anchor, head, options) { + setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options) + }), + extendSelection: docMethodOp(function(head, other, options) { + extendSelection(this, clipPos(this, head), other && clipPos(this, other), options) + }), + extendSelections: docMethodOp(function(heads, options) { + extendSelections(this, clipPosArray(this, heads), options) + }), + extendSelectionsBy: docMethodOp(function(f, options) { + var heads = map(this.sel.ranges, f) + extendSelections(this, clipPosArray(this, heads), options) + }), + setSelections: docMethodOp(function(ranges, primary, options) { + var this$1 = this; + + if (!ranges.length) { return } + var out = [] + for (var i = 0; i < ranges.length; i++) + { out[i] = new Range(clipPos(this$1, ranges[i].anchor), + clipPos(this$1, ranges[i].head)) } + if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex) } + setSelection(this, normalizeSelection(out, primary), options) + }), + addSelection: docMethodOp(function(anchor, head, options) { + var ranges = this.sel.ranges.slice(0) + ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor))) + setSelection(this, normalizeSelection(ranges, ranges.length - 1), options) + }), + + getSelection: function(lineSep) { + var this$1 = this; + + var ranges = this.sel.ranges, lines + for (var i = 0; i < ranges.length; i++) { + var sel = getBetween(this$1, ranges[i].from(), ranges[i].to()) + lines = lines ? lines.concat(sel) : sel } - return {fixedPos: compensateForHScroll(d), - gutterTotalWidth: d.gutters.offsetWidth, - gutterLeft: left, - gutterWidth: width, - wrapperWidth: d.wrapper.clientWidth}; - } + if (lineSep === false) { return lines } + else { return lines.join(lineSep || this.lineSeparator()) } + }, + getSelections: function(lineSep) { + var this$1 = this; - // Sync the actual display DOM structure with display.view, removing - // nodes for lines that are no longer in view, and creating the ones - // that are not there yet, and updating the ones that are out of - // date. - function patchDisplay(cm, updateNumbersFrom, dims) { - var display = cm.display, lineNumbers = cm.options.lineNumbers; - var container = display.lineDiv, cur = container.firstChild; - - function rm(node) { - var next = node.nextSibling; - // Works around a throw-scroll bug in OS X Webkit - if (webkit && mac && cm.display.currentWheelTarget == node) - node.style.display = "none"; - else - node.parentNode.removeChild(node); - return next; - } - - var view = display.view, lineN = display.viewFrom; - // Loop over the elements in the view, syncing cur (the DOM nodes - // in display.lineDiv) with the view as we go. - for (var i = 0; i < view.length; i++) { - var lineView = view[i]; - if (lineView.hidden) { - } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet - var node = buildLineElement(cm, lineView, lineN, dims); - container.insertBefore(node, cur); - } else { // Already drawn - while (cur != lineView.node) cur = rm(cur); - var updateNumber = lineNumbers && updateNumbersFrom != null && - updateNumbersFrom <= lineN && lineView.lineNumber; - if (lineView.changes) { - if (indexOf(lineView.changes, "gutter") > -1) updateNumber = false; - updateLineForChanges(cm, lineView, lineN, dims); + var parts = [], ranges = this.sel.ranges + for (var i = 0; i < ranges.length; i++) { + var sel = getBetween(this$1, ranges[i].from(), ranges[i].to()) + if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()) } + parts[i] = sel + } + return parts + }, + replaceSelection: function(code, collapse, origin) { + var dup = [] + for (var i = 0; i < this.sel.ranges.length; i++) + { dup[i] = code } + this.replaceSelections(dup, collapse, origin || "+input") + }, + replaceSelections: docMethodOp(function(code, collapse, origin) { + var this$1 = this; + + var changes = [], sel = this.sel + for (var i = 0; i < sel.ranges.length; i++) { + var range = sel.ranges[i] + changes[i] = {from: range.from(), to: range.to(), text: this$1.splitLines(code[i]), origin: origin} + } + var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse) + for (var i$1 = changes.length - 1; i$1 >= 0; i$1--) + { makeChange(this$1, changes[i$1]) } + if (newSel) { setSelectionReplaceHistory(this, newSel) } + else if (this.cm) { ensureCursorVisible(this.cm) } + }), + undo: docMethodOp(function() {makeChangeFromHistory(this, "undo")}), + redo: docMethodOp(function() {makeChangeFromHistory(this, "redo")}), + undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true)}), + redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true)}), + + setExtending: function(val) {this.extend = val}, + getExtending: function() {return this.extend}, + + historySize: function() { + var hist = this.history, done = 0, undone = 0 + for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done } } + for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone } } + return {undo: done, redo: undone} + }, + clearHistory: function() {this.history = new History(this.history.maxGeneration)}, + + markClean: function() { + this.cleanGeneration = this.changeGeneration(true) + }, + changeGeneration: function(forceSplit) { + if (forceSplit) + { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null } + return this.history.generation + }, + isClean: function (gen) { + return this.history.generation == (gen || this.cleanGeneration) + }, + + getHistory: function() { + return {done: copyHistoryArray(this.history.done), + undone: copyHistoryArray(this.history.undone)} + }, + setHistory: function(histData) { + var hist = this.history = new History(this.history.maxGeneration) + hist.done = copyHistoryArray(histData.done.slice(0), null, true) + hist.undone = copyHistoryArray(histData.undone.slice(0), null, true) + }, + + addLineClass: docMethodOp(function(handle, where, cls) { + return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) { + var prop = where == "text" ? "textClass" + : where == "background" ? "bgClass" + : where == "gutter" ? "gutterClass" : "wrapClass" + if (!line[prop]) { line[prop] = cls } + else if (classTest(cls).test(line[prop])) { return false } + else { line[prop] += " " + cls } + return true + }) + }), + removeLineClass: docMethodOp(function(handle, where, cls) { + return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) { + var prop = where == "text" ? "textClass" + : where == "background" ? "bgClass" + : where == "gutter" ? "gutterClass" : "wrapClass" + var cur = line[prop] + if (!cur) { return false } + else if (cls == null) { line[prop] = null } + else { + var found = cur.match(classTest(cls)) + if (!found) { return false } + var end = found.index + found[0].length + line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null + } + return true + }) + }), + + addLineWidget: docMethodOp(function(handle, node, options) { + return addLineWidget(this, handle, node, options) + }), + removeLineWidget: function(widget) { widget.clear() }, + + markText: function(from, to, options) { + return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range") + }, + setBookmark: function(pos, options) { + var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options), + insertLeft: options && options.insertLeft, + clearWhenEmpty: false, shared: options && options.shared, + handleMouseEvents: options && options.handleMouseEvents} + pos = clipPos(this, pos) + return markText(this, pos, pos, realOpts, "bookmark") + }, + findMarksAt: function(pos) { + pos = clipPos(this, pos) + var markers = [], spans = getLine(this, pos.line).markedSpans + if (spans) { for (var i = 0; i < spans.length; ++i) { + var span = spans[i] + if ((span.from == null || span.from <= pos.ch) && + (span.to == null || span.to >= pos.ch)) + { markers.push(span.marker.parent || span.marker) } + } } + return markers + }, + findMarks: function(from, to, filter) { + from = clipPos(this, from); to = clipPos(this, to) + var found = [], lineNo = from.line + this.iter(from.line, to.line + 1, function (line) { + var spans = line.markedSpans + if (spans) { for (var i = 0; i < spans.length; i++) { + var span = spans[i] + if (!(span.to != null && lineNo == from.line && from.ch >= span.to || + span.from == null && lineNo != from.line || + span.from != null && lineNo == to.line && span.from >= to.ch) && + (!filter || filter(span.marker))) + { found.push(span.marker.parent || span.marker) } + } } + ++lineNo + }) + return found + }, + getAllMarks: function() { + var markers = [] + this.iter(function (line) { + var sps = line.markedSpans + if (sps) { for (var i = 0; i < sps.length; ++i) + { if (sps[i].from != null) { markers.push(sps[i].marker) } } } + }) + return markers + }, + + posFromIndex: function(off) { + var ch, lineNo = this.first, sepSize = this.lineSeparator().length + this.iter(function (line) { + var sz = line.text.length + sepSize + if (sz > off) { ch = off; return true } + off -= sz + ++lineNo + }) + return clipPos(this, Pos(lineNo, ch)) + }, + indexFromPos: function (coords) { + coords = clipPos(this, coords) + var index = coords.ch + if (coords.line < this.first || coords.ch < 0) { return 0 } + var sepSize = this.lineSeparator().length + this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value + index += line.text.length + sepSize + }) + return index + }, + + copy: function(copyHistory) { + var doc = new Doc(getLines(this, this.first, this.first + this.size), + this.modeOption, this.first, this.lineSep) + doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft + doc.sel = this.sel + doc.extend = false + if (copyHistory) { + doc.history.undoDepth = this.history.undoDepth + doc.setHistory(this.getHistory()) + } + return doc + }, + + linkedDoc: function(options) { + if (!options) { options = {} } + var from = this.first, to = this.first + this.size + if (options.from != null && options.from > from) { from = options.from } + if (options.to != null && options.to < to) { to = options.to } + var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep) + if (options.sharedHist) { copy.history = this.history + ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist}) + copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}] + copySharedMarkers(copy, findSharedMarkers(this)) + return copy + }, + unlinkDoc: function(other) { + var this$1 = this; + + if (other instanceof CodeMirror) { other = other.doc } + if (this.linked) { for (var i = 0; i < this.linked.length; ++i) { + var link = this$1.linked[i] + if (link.doc != other) { continue } + this$1.linked.splice(i, 1) + other.unlinkDoc(this$1) + detachSharedMarkers(findSharedMarkers(this$1)) + break + } } + // If the histories were shared, split them again + if (other.history == this.history) { + var splitIds = [other.id] + linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true) + other.history = new History(null) + other.history.done = copyHistoryArray(this.history.done, splitIds) + other.history.undone = copyHistoryArray(this.history.undone, splitIds) + } + }, + iterLinkedDocs: function(f) {linkedDocs(this, f)}, + + getMode: function() {return this.mode}, + getEditor: function() {return this.cm}, + + splitLines: function(str) { + if (this.lineSep) { return str.split(this.lineSep) } + return splitLinesAuto(str) + }, + lineSeparator: function() { return this.lineSep || "\n" } +}) + +// Public alias. +Doc.prototype.eachLine = Doc.prototype.iter + +// Kludge to work around strange IE behavior where it'll sometimes +// re-fire a series of drag-related events right after the drop (#1551) +var lastDrop = 0 + +function onDrop(e) { + var cm = this + clearDragCursor(cm) + if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) + { return } + e_preventDefault(e) + if (ie) { lastDrop = +new Date } + var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files + if (!pos || cm.isReadOnly()) { return } + // Might be a file drop, in which case we simply extract the text + // and insert it. + if (files && files.length && window.FileReader && window.File) { + var n = files.length, text = Array(n), read = 0 + var loadFile = function (file, i) { + if (cm.options.allowDropFileTypes && + indexOf(cm.options.allowDropFileTypes, file.type) == -1) + { return } + + var reader = new FileReader + reader.onload = operation(cm, function () { + var content = reader.result + if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = "" } + text[i] = content + if (++read == n) { + pos = clipPos(cm.doc, pos) + var change = {from: pos, to: pos, + text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())), + origin: "paste"} + makeChange(cm.doc, change) + setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change))) } - if (updateNumber) { - removeChildren(lineView.lineNumber); - lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN))); + }) + reader.readAsText(file) + } + for (var i = 0; i < n; ++i) { loadFile(files[i], i) } + } else { // Normal drop + // Don't do a replace if the drop happened inside of the selected text. + if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) { + cm.state.draggingText(e) + // Ensure the editor is re-focused + setTimeout(function () { return cm.display.input.focus(); }, 20) + return + } + try { + var text$1 = e.dataTransfer.getData("Text") + if (text$1) { + var selected + if (cm.state.draggingText && !cm.state.draggingText.copy) + { selected = cm.listSelections() } + setSelectionNoUndo(cm.doc, simpleSelection(pos, pos)) + if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1) + { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag") } } + cm.replaceSelection(text$1, "around", "paste") + cm.display.input.focus() + } + } + catch(e){} + } +} + +function onDragStart(cm, e) { + if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return } + if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return } + + e.dataTransfer.setData("Text", cm.getSelection()) + e.dataTransfer.effectAllowed = "copyMove" + + // Use dummy image instead of default browsers image. + // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there. + if (e.dataTransfer.setDragImage && !safari) { + var img = elt("img", null, null, "position: fixed; left: 0; top: 0;") + img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" + if (presto) { + img.width = img.height = 1 + cm.display.wrapper.appendChild(img) + // Force a relayout, or Opera won't use our image for some obscure reason + img._top = img.offsetTop + } + e.dataTransfer.setDragImage(img, 0, 0) + if (presto) { img.parentNode.removeChild(img) } + } +} + +function onDragOver(cm, e) { + var pos = posFromMouse(cm, e) + if (!pos) { return } + var frag = document.createDocumentFragment() + drawSelectionCursor(cm, pos, frag) + if (!cm.display.dragCursor) { + cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors") + cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv) + } + removeChildrenAndAdd(cm.display.dragCursor, frag) +} + +function clearDragCursor(cm) { + if (cm.display.dragCursor) { + cm.display.lineSpace.removeChild(cm.display.dragCursor) + cm.display.dragCursor = null + } +} + +// These must be handled carefully, because naively registering a +// handler for each editor will cause the editors to never be +// garbage collected. + +function forEachCodeMirror(f) { + if (!document.body.getElementsByClassName) { return } + var byClass = document.body.getElementsByClassName("CodeMirror") + for (var i = 0; i < byClass.length; i++) { + var cm = byClass[i].CodeMirror + if (cm) { f(cm) } + } +} + +var globalsRegistered = false +function ensureGlobalHandlers() { + if (globalsRegistered) { return } + registerGlobalHandlers() + globalsRegistered = true +} +function registerGlobalHandlers() { + // When the window resizes, we need to refresh active editors. + var resizeTimer + on(window, "resize", function () { + if (resizeTimer == null) { resizeTimer = setTimeout(function () { + resizeTimer = null + forEachCodeMirror(onResize) + }, 100) } + }) + // When the window loses focus, we want to show the editor as blurred + on(window, "blur", function () { return forEachCodeMirror(onBlur); }) +} +// Called when the window resizes +function onResize(cm) { + var d = cm.display + if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth) + { return } + // Might be a text scaling operation, clear size caches. + d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null + d.scrollbarsClipped = false + cm.setSize() +} + +var keyNames = { + 3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt", + 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", + 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert", + 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod", + 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete", + 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", + 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete", + 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert" +} + +// Number keys +for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i) } +// Alphabetic keys +for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1) } +// Function keys +for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2 } + +var keyMap = {} + +keyMap.basic = { + "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown", + "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown", + "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore", + "Tab": "defaultTab", "Shift-Tab": "indentAuto", + "Enter": "newlineAndIndent", "Insert": "toggleOverwrite", + "Esc": "singleSelection" +} +// Note that the save and find-related commands aren't defined by +// default. User code or addons can define them. Unknown commands +// are simply ignored. +keyMap.pcDefault = { + "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo", + "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown", + "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd", + "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find", + "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll", + "Ctrl-[": "indentLess", "Ctrl-]": "indentMore", + "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection", + fallthrough: "basic" +} +// Very basic readline/emacs-style bindings, which are standard on Mac. +keyMap.emacsy = { + "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown", + "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", + "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", + "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars", + "Ctrl-O": "openLine" +} +keyMap.macDefault = { + "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo", + "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft", + "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore", + "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find", + "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll", + "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight", + "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd", + fallthrough: ["basic", "emacsy"] +} +keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault + +// KEYMAP DISPATCH + +function normalizeKeyName(name) { + var parts = name.split(/-(?!$)/) + name = parts[parts.length - 1] + var alt, ctrl, shift, cmd + for (var i = 0; i < parts.length - 1; i++) { + var mod = parts[i] + if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true } + else if (/^a(lt)?$/i.test(mod)) { alt = true } + else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true } + else if (/^s(hift)?$/i.test(mod)) { shift = true } + else { throw new Error("Unrecognized modifier name: " + mod) } + } + if (alt) { name = "Alt-" + name } + if (ctrl) { name = "Ctrl-" + name } + if (cmd) { name = "Cmd-" + name } + if (shift) { name = "Shift-" + name } + return name +} + +// This is a kludge to keep keymaps mostly working as raw objects +// (backwards compatibility) while at the same time support features +// like normalization and multi-stroke key bindings. It compiles a +// new normalized keymap, and then updates the old object to reflect +// this. +function normalizeKeyMap(keymap) { + var copy = {} + for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) { + var value = keymap[keyname] + if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue } + if (value == "...") { delete keymap[keyname]; continue } + + var keys = map(keyname.split(" "), normalizeKeyName) + for (var i = 0; i < keys.length; i++) { + var val = void 0, name = void 0 + if (i == keys.length - 1) { + name = keys.join(" ") + val = value + } else { + name = keys.slice(0, i + 1).join(" ") + val = "..." + } + var prev = copy[name] + if (!prev) { copy[name] = val } + else if (prev != val) { throw new Error("Inconsistent bindings for " + name) } + } + delete keymap[keyname] + } } + for (var prop in copy) { keymap[prop] = copy[prop] } + return keymap +} + +function lookupKey(key, map, handle, context) { + map = getKeyMap(map) + var found = map.call ? map.call(key, context) : map[key] + if (found === false) { return "nothing" } + if (found === "...") { return "multi" } + if (found != null && handle(found)) { return "handled" } + + if (map.fallthrough) { + if (Object.prototype.toString.call(map.fallthrough) != "[object Array]") + { return lookupKey(key, map.fallthrough, handle, context) } + for (var i = 0; i < map.fallthrough.length; i++) { + var result = lookupKey(key, map.fallthrough[i], handle, context) + if (result) { return result } + } + } +} + +// Modifier key presses don't count as 'real' key presses for the +// purpose of keymap fallthrough. +function isModifierKey(value) { + var name = typeof value == "string" ? value : keyNames[value.keyCode] + return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod" +} + +// Look up the name of a key as indicated by an event object. +function keyName(event, noShift) { + if (presto && event.keyCode == 34 && event["char"]) { return false } + var base = keyNames[event.keyCode], name = base + if (name == null || event.altGraphKey) { return false } + if (event.altKey && base != "Alt") { name = "Alt-" + name } + if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name } + if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name } + if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name } + return name +} + +function getKeyMap(val) { + return typeof val == "string" ? keyMap[val] : val +} + +// Helper for deleting text near the selection(s), used to implement +// backspace, delete, and similar functionality. +function deleteNearSelection(cm, compute) { + var ranges = cm.doc.sel.ranges, kill = [] + // Build up a set of ranges to kill first, merging overlapping + // ranges. + for (var i = 0; i < ranges.length; i++) { + var toKill = compute(ranges[i]) + while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) { + var replaced = kill.pop() + if (cmp(replaced.from, toKill.from) < 0) { + toKill.from = replaced.from + break + } + } + kill.push(toKill) + } + // Next, remove those actual ranges. + runInOp(cm, function () { + for (var i = kill.length - 1; i >= 0; i--) + { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete") } + ensureCursorVisible(cm) + }) +} + +// Commands are parameter-less actions that can be performed on an +// editor, mostly used for keybindings. +var commands = { + selectAll: selectAll, + singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); }, + killLine: function (cm) { return deleteNearSelection(cm, function (range) { + if (range.empty()) { + var len = getLine(cm.doc, range.head.line).text.length + if (range.head.ch == len && range.head.line < cm.lastLine()) + { return {from: range.head, to: Pos(range.head.line + 1, 0)} } + else + { return {from: range.head, to: Pos(range.head.line, len)} } + } else { + return {from: range.from(), to: range.to()} + } + }); }, + deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({ + from: Pos(range.from().line, 0), + to: clipPos(cm.doc, Pos(range.to().line + 1, 0)) + }); }); }, + delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({ + from: Pos(range.from().line, 0), to: range.from() + }); }); }, + delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { + var top = cm.charCoords(range.head, "div").top + 5 + var leftPos = cm.coordsChar({left: 0, top: top}, "div") + return {from: leftPos, to: range.from()} + }); }, + delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) { + var top = cm.charCoords(range.head, "div").top + 5 + var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div") + return {from: range.from(), to: rightPos } + }); }, + undo: function (cm) { return cm.undo(); }, + redo: function (cm) { return cm.redo(); }, + undoSelection: function (cm) { return cm.undoSelection(); }, + redoSelection: function (cm) { return cm.redoSelection(); }, + goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); }, + goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); }, + goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); }, + {origin: "+move", bias: 1} + ); }, + goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); }, + {origin: "+move", bias: 1} + ); }, + goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); }, + {origin: "+move", bias: -1} + ); }, + goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) { + var top = cm.charCoords(range.head, "div").top + 5 + return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div") + }, sel_move); }, + goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) { + var top = cm.charCoords(range.head, "div").top + 5 + return cm.coordsChar({left: 0, top: top}, "div") + }, sel_move); }, + goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) { + var top = cm.charCoords(range.head, "div").top + 5 + var pos = cm.coordsChar({left: 0, top: top}, "div") + if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) } + return pos + }, sel_move); }, + goLineUp: function (cm) { return cm.moveV(-1, "line"); }, + goLineDown: function (cm) { return cm.moveV(1, "line"); }, + goPageUp: function (cm) { return cm.moveV(-1, "page"); }, + goPageDown: function (cm) { return cm.moveV(1, "page"); }, + goCharLeft: function (cm) { return cm.moveH(-1, "char"); }, + goCharRight: function (cm) { return cm.moveH(1, "char"); }, + goColumnLeft: function (cm) { return cm.moveH(-1, "column"); }, + goColumnRight: function (cm) { return cm.moveH(1, "column"); }, + goWordLeft: function (cm) { return cm.moveH(-1, "word"); }, + goGroupRight: function (cm) { return cm.moveH(1, "group"); }, + goGroupLeft: function (cm) { return cm.moveH(-1, "group"); }, + goWordRight: function (cm) { return cm.moveH(1, "word"); }, + delCharBefore: function (cm) { return cm.deleteH(-1, "char"); }, + delCharAfter: function (cm) { return cm.deleteH(1, "char"); }, + delWordBefore: function (cm) { return cm.deleteH(-1, "word"); }, + delWordAfter: function (cm) { return cm.deleteH(1, "word"); }, + delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); }, + delGroupAfter: function (cm) { return cm.deleteH(1, "group"); }, + indentAuto: function (cm) { return cm.indentSelection("smart"); }, + indentMore: function (cm) { return cm.indentSelection("add"); }, + indentLess: function (cm) { return cm.indentSelection("subtract"); }, + insertTab: function (cm) { return cm.replaceSelection("\t"); }, + insertSoftTab: function (cm) { + var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize + for (var i = 0; i < ranges.length; i++) { + var pos = ranges[i].from() + var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize) + spaces.push(spaceStr(tabSize - col % tabSize)) + } + cm.replaceSelections(spaces) + }, + defaultTab: function (cm) { + if (cm.somethingSelected()) { cm.indentSelection("add") } + else { cm.execCommand("insertTab") } + }, + // Swap the two chars left and right of each selection's head. + // Move cursor behind the two swapped characters afterwards. + // + // Doesn't consider line feeds a character. + // Doesn't scan more than one line above to find a character. + // Doesn't do anything on an empty line. + // Doesn't do anything with non-empty selections. + transposeChars: function (cm) { return runInOp(cm, function () { + var ranges = cm.listSelections(), newSel = [] + for (var i = 0; i < ranges.length; i++) { + if (!ranges[i].empty()) { continue } + var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text + if (line) { + if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1) } + if (cur.ch > 0) { + cur = new Pos(cur.line, cur.ch + 1) + cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2), + Pos(cur.line, cur.ch - 2), cur, "+transpose") + } else if (cur.line > cm.doc.first) { + var prev = getLine(cm.doc, cur.line - 1).text + if (prev) { + cur = new Pos(cur.line, 1) + cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() + + prev.charAt(prev.length - 1), + Pos(cur.line - 1, prev.length - 1), cur, "+transpose") + } } - cur = lineView.node.nextSibling; } - lineN += lineView.size; - } - while (cur) cur = rm(cur); - } - - // When an aspect of a line changes, a string is added to - // lineView.changes. This updates the relevant part of the line's - // DOM structure. - function updateLineForChanges(cm, lineView, lineN, dims) { - for (var j = 0; j < lineView.changes.length; j++) { - var type = lineView.changes[j]; - if (type == "text") updateLineText(cm, lineView); - else if (type == "gutter") updateLineGutter(cm, lineView, lineN, dims); - else if (type == "class") updateLineClasses(lineView); - else if (type == "widget") updateLineWidgets(cm, lineView, dims); - } - lineView.changes = null; - } - - // Lines with gutter elements, widgets or a background class need to - // be wrapped, and have the extra elements added to the wrapper div - function ensureLineWrapped(lineView) { - if (lineView.node == lineView.text) { - lineView.node = elt("div", null, null, "position: relative"); - if (lineView.text.parentNode) - lineView.text.parentNode.replaceChild(lineView.node, lineView.text); - lineView.node.appendChild(lineView.text); - if (ie && ie_version < 8) lineView.node.style.zIndex = 2; - } - return lineView.node; - } - - function updateLineBackground(lineView) { - var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass; - if (cls) cls += " CodeMirror-linebackground"; - if (lineView.background) { - if (cls) lineView.background.className = cls; - else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; } - } else if (cls) { - var wrap = ensureLineWrapped(lineView); - lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild); - } - } - - // Wrapper around buildLineContent which will reuse the structure - // in display.externalMeasured when possible. - function getLineContent(cm, lineView) { - var ext = cm.display.externalMeasured; - if (ext && ext.line == lineView.line) { - cm.display.externalMeasured = null; - lineView.measure = ext.measure; - return ext.built; - } - return buildLineContent(cm, lineView); - } - - // Redraw the line's text. Interacts with the background and text - // classes because the mode may output tokens that influence these - // classes. - function updateLineText(cm, lineView) { - var cls = lineView.text.className; - var built = getLineContent(cm, lineView); - if (lineView.text == lineView.node) lineView.node = built.pre; - lineView.text.parentNode.replaceChild(built.pre, lineView.text); - lineView.text = built.pre; - if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) { - lineView.bgClass = built.bgClass; - lineView.textClass = built.textClass; - updateLineClasses(lineView); - } else if (cls) { - lineView.text.className = cls; - } - } - - function updateLineClasses(lineView) { - updateLineBackground(lineView); - if (lineView.line.wrapClass) - ensureLineWrapped(lineView).className = lineView.line.wrapClass; - else if (lineView.node != lineView.text) - lineView.node.className = ""; - var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass; - lineView.text.className = textClass || ""; - } - - function updateLineGutter(cm, lineView, lineN, dims) { - if (lineView.gutter) { - lineView.node.removeChild(lineView.gutter); - lineView.gutter = null; - } - if (lineView.gutterBackground) { - lineView.node.removeChild(lineView.gutterBackground); - lineView.gutterBackground = null; - } - if (lineView.line.gutterClass) { - var wrap = ensureLineWrapped(lineView); - lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass, - "left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + - "px; width: " + dims.gutterTotalWidth + "px"); - wrap.insertBefore(lineView.gutterBackground, lineView.text); - } - var markers = lineView.line.gutterMarkers; - if (cm.options.lineNumbers || markers) { - var wrap = ensureLineWrapped(lineView); - var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", "left: " + - (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"); - cm.display.input.setUneditable(gutterWrap); - wrap.insertBefore(gutterWrap, lineView.text); - if (lineView.line.gutterClass) - gutterWrap.className += " " + lineView.line.gutterClass; - if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"])) - lineView.lineNumber = gutterWrap.appendChild( - elt("div", lineNumberFor(cm.options, lineN), - "CodeMirror-linenumber CodeMirror-gutter-elt", - "left: " + dims.gutterLeft["CodeMirror-linenumbers"] + "px; width: " - + cm.display.lineNumInnerWidth + "px")); - if (markers) for (var k = 0; k < cm.options.gutters.length; ++k) { - var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id]; - if (found) - gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", "left: " + - dims.gutterLeft[id] + "px; width: " + dims.gutterWidth[id] + "px")); + newSel.push(new Range(cur, cur)) + } + cm.setSelections(newSel) + }); }, + newlineAndIndent: function (cm) { return runInOp(cm, function () { + var sels = cm.listSelections() + for (var i = sels.length - 1; i >= 0; i--) + { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input") } + sels = cm.listSelections() + for (var i$1 = 0; i$1 < sels.length; i$1++) + { cm.indentLine(sels[i$1].from().line, null, true) } + ensureCursorVisible(cm) + }); }, + openLine: function (cm) { return cm.replaceSelection("\n", "start"); }, + toggleOverwrite: function (cm) { return cm.toggleOverwrite(); } +} + + +function lineStart(cm, lineN) { + var line = getLine(cm.doc, lineN) + var visual = visualLine(line) + if (visual != line) { lineN = lineNo(visual) } + var order = getOrder(visual) + var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual) + return Pos(lineN, ch) +} +function lineEnd(cm, lineN) { + var merged, line = getLine(cm.doc, lineN) + while (merged = collapsedSpanAtEnd(line)) { + line = merged.find(1, true).line + lineN = null + } + var order = getOrder(line) + var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line) + return Pos(lineN == null ? lineNo(line) : lineN, ch) +} +function lineStartSmart(cm, pos) { + var start = lineStart(cm, pos.line) + var line = getLine(cm.doc, start.line) + var order = getOrder(line) + if (!order || order[0].level == 0) { + var firstNonWS = Math.max(0, line.text.search(/\S/)) + var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch + return Pos(start.line, inWS ? 0 : firstNonWS) + } + return start +} + +// Run a handler that was bound to a key. +function doHandleBinding(cm, bound, dropShift) { + if (typeof bound == "string") { + bound = commands[bound] + if (!bound) { return false } + } + // Ensure previous input has been read, so that the handler sees a + // consistent view of the document + cm.display.input.ensurePolled() + var prevShift = cm.display.shift, done = false + try { + if (cm.isReadOnly()) { cm.state.suppressEdits = true } + if (dropShift) { cm.display.shift = false } + done = bound(cm) != Pass + } finally { + cm.display.shift = prevShift + cm.state.suppressEdits = false + } + return done +} + +function lookupKeyForEditor(cm, name, handle) { + for (var i = 0; i < cm.state.keyMaps.length; i++) { + var result = lookupKey(name, cm.state.keyMaps[i], handle, cm) + if (result) { return result } + } + return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm)) + || lookupKey(name, cm.options.keyMap, handle, cm) +} + +var stopSeq = new Delayed +function dispatchKey(cm, name, e, handle) { + var seq = cm.state.keySeq + if (seq) { + if (isModifierKey(name)) { return "handled" } + stopSeq.set(50, function () { + if (cm.state.keySeq == seq) { + cm.state.keySeq = null + cm.display.input.reset() + } + }) + name = seq + " " + name + } + var result = lookupKeyForEditor(cm, name, handle) + + if (result == "multi") + { cm.state.keySeq = name } + if (result == "handled") + { signalLater(cm, "keyHandled", cm, name, e) } + + if (result == "handled" || result == "multi") { + e_preventDefault(e) + restartBlink(cm) + } + + if (seq && !result && /\'$/.test(name)) { + e_preventDefault(e) + return true + } + return !!result +} + +// Handle a key from the keydown event. +function handleKeyBinding(cm, e) { + var name = keyName(e, true) + if (!name) { return false } + + if (e.shiftKey && !cm.state.keySeq) { + // First try to resolve full name (including 'Shift-'). Failing + // that, see if there is a cursor-motion command (starting with + // 'go') bound to the keyname without 'Shift-'. + return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); }) + || dispatchKey(cm, name, e, function (b) { + if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) + { return doHandleBinding(cm, b) } + }) + } else { + return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); }) + } +} + +// Handle a key from the keypress event +function handleCharBinding(cm, e, ch) { + return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); }) +} + +var lastStoppedKey = null +function onKeyDown(e) { + var cm = this + cm.curOp.focus = activeElt() + if (signalDOMEvent(cm, e)) { return } + // IE does strange things with escape. + if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false } + var code = e.keyCode + cm.display.shift = code == 16 || e.shiftKey + var handled = handleKeyBinding(cm, e) + if (presto) { + lastStoppedKey = handled ? code : null + // Opera has no cut event... we try to at least catch the key combo + if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey)) + { cm.replaceSelection("", null, "cut") } + } + + // Turn mouse into crosshair when Alt is held on Mac. + if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className)) + { showCrossHair(cm) } +} + +function showCrossHair(cm) { + var lineDiv = cm.display.lineDiv + addClass(lineDiv, "CodeMirror-crosshair") + + function up(e) { + if (e.keyCode == 18 || !e.altKey) { + rmClass(lineDiv, "CodeMirror-crosshair") + off(document, "keyup", up) + off(document, "mouseover", up) + } + } + on(document, "keyup", up) + on(document, "mouseover", up) +} + +function onKeyUp(e) { + if (e.keyCode == 16) { this.doc.sel.shift = false } + signalDOMEvent(this, e) +} + +function onKeyPress(e) { + var cm = this + if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return } + var keyCode = e.keyCode, charCode = e.charCode + if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return} + if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return } + var ch = String.fromCharCode(charCode == null ? keyCode : charCode) + // Some browsers fire keypress events for backspace + if (ch == "\x08") { return } + if (handleCharBinding(cm, e, ch)) { return } + cm.display.input.onKeyPress(e) +} + +// A mouse down can be a single click, double click, triple click, +// start of selection drag, start of text drag, new cursor +// (ctrl-click), rectangle drag (alt-drag), or xwin +// middle-click-paste. Or it might be a click on something we should +// not interfere with, such as a scrollbar or widget. +function onMouseDown(e) { + var cm = this, display = cm.display + if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return } + display.shift = e.shiftKey + + if (eventInWidget(display, e)) { + if (!webkit) { + // Briefly turn off draggability, to allow widgets to do + // normal dragging things. + display.scroller.draggable = false + setTimeout(function () { return display.scroller.draggable = true; }, 100) + } + return + } + if (clickInGutter(cm, e)) { return } + var start = posFromMouse(cm, e) + window.focus() + + switch (e_button(e)) { + case 1: + // #3261: make sure, that we're not starting a second selection + if (cm.state.selectingText) + { cm.state.selectingText(e) } + else if (start) + { leftButtonDown(cm, e, start) } + else if (e_target(e) == display.scroller) + { e_preventDefault(e) } + break + case 2: + if (webkit) { cm.state.lastMiddleDown = +new Date } + if (start) { extendSelection(cm.doc, start) } + setTimeout(function () { return display.input.focus(); }, 20) + e_preventDefault(e) + break + case 3: + if (captureRightClick) { onContextMenu(cm, e) } + else { delayBlurEvent(cm) } + break + } +} + +var lastClick; +var lastDoubleClick; +function leftButtonDown(cm, e, start) { + if (ie) { setTimeout(bind(ensureFocus, cm), 0) } + else { cm.curOp.focus = activeElt() } + + var now = +new Date, type + if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) { + type = "triple" + } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) { + type = "double" + lastDoubleClick = {time: now, pos: start} + } else { + type = "single" + lastClick = {time: now, pos: start} + } + + var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained + if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() && + type == "single" && (contained = sel.contains(start)) > -1 && + (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) && + (cmp(contained.to(), start) > 0 || start.xRel < 0)) + { leftButtonStartDrag(cm, e, start, modifier) } + else + { leftButtonSelect(cm, e, start, type, modifier) } +} + +// Start a text drag. When it ends, see if any dragging actually +// happen, and treat as a click if it didn't. +function leftButtonStartDrag(cm, e, start, modifier) { + var display = cm.display, startTime = +new Date + var dragEnd = operation(cm, function (e2) { + if (webkit) { display.scroller.draggable = false } + cm.state.draggingText = false + off(document, "mouseup", dragEnd) + off(display.scroller, "drop", dragEnd) + if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) { + e_preventDefault(e2) + if (!modifier && +new Date - 200 < startTime) + { extendSelection(cm.doc, start) } + // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081) + if (webkit || ie && ie_version == 9) + { setTimeout(function () {document.body.focus(); display.input.focus()}, 20) } + else + { display.input.focus() } + } + }) + // Let the drag handler handle this. + if (webkit) { display.scroller.draggable = true } + cm.state.draggingText = dragEnd + dragEnd.copy = mac ? e.altKey : e.ctrlKey + // IE's approach to draggable + if (display.scroller.dragDrop) { display.scroller.dragDrop() } + on(document, "mouseup", dragEnd) + on(display.scroller, "drop", dragEnd) +} + +// Normal selection, as opposed to text dragging. +function leftButtonSelect(cm, e, start, type, addNew) { + var display = cm.display, doc = cm.doc + e_preventDefault(e) + + var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges + if (addNew && !e.shiftKey) { + ourIndex = doc.sel.contains(start) + if (ourIndex > -1) + { ourRange = ranges[ourIndex] } + else + { ourRange = new Range(start, start) } + } else { + ourRange = doc.sel.primary() + ourIndex = doc.sel.primIndex + } + + if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) { + type = "rect" + if (!addNew) { ourRange = new Range(start, start) } + start = posFromMouse(cm, e, true, true) + ourIndex = -1 + } else if (type == "double") { + var word = cm.findWordAt(start) + if (cm.display.shift || doc.extend) + { ourRange = extendRange(doc, ourRange, word.anchor, word.head) } + else + { ourRange = word } + } else if (type == "triple") { + var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0))) + if (cm.display.shift || doc.extend) + { ourRange = extendRange(doc, ourRange, line.anchor, line.head) } + else + { ourRange = line } + } else { + ourRange = extendRange(doc, ourRange, start) + } + + if (!addNew) { + ourIndex = 0 + setSelection(doc, new Selection([ourRange], 0), sel_mouse) + startSel = doc.sel + } else if (ourIndex == -1) { + ourIndex = ranges.length + setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex), + {scroll: false, origin: "*mouse"}) + } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) { + setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0), + {scroll: false, origin: "*mouse"}) + startSel = doc.sel + } else { + replaceOneSelection(doc, ourIndex, ourRange, sel_mouse) + } + + var lastPos = start + function extendTo(pos) { + if (cmp(lastPos, pos) == 0) { return } + lastPos = pos + + if (type == "rect") { + var ranges = [], tabSize = cm.options.tabSize + var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize) + var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize) + var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol) + for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); + line <= end; line++) { + var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize) + if (left == right) + { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))) } + else if (text.length > leftPos) + { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))) } + } + if (!ranges.length) { ranges.push(new Range(start, start)) } + setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), + {origin: "*mouse", scroll: false}) + cm.scrollIntoView(pos) + } else { + var oldRange = ourRange + var anchor = oldRange.anchor, head = pos + if (type != "single") { + var range + if (type == "double") + { range = cm.findWordAt(pos) } + else + { range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))) } + if (cmp(range.anchor, anchor) > 0) { + head = range.head + anchor = minPos(oldRange.from(), range.anchor) + } else { + head = range.anchor + anchor = maxPos(oldRange.to(), range.head) + } } - } - } - - function updateLineWidgets(cm, lineView, dims) { - if (lineView.alignable) lineView.alignable = null; - for (var node = lineView.node.firstChild, next; node; node = next) { - var next = node.nextSibling; - if (node.className == "CodeMirror-linewidget") - lineView.node.removeChild(node); - } - insertLineWidgets(cm, lineView, dims); - } - - // Build a line's DOM representation from scratch - function buildLineElement(cm, lineView, lineN, dims) { - var built = getLineContent(cm, lineView); - lineView.text = lineView.node = built.pre; - if (built.bgClass) lineView.bgClass = built.bgClass; - if (built.textClass) lineView.textClass = built.textClass; + var ranges$1 = startSel.ranges.slice(0) + ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head) + setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse) + } + } + + var editorSize = display.wrapper.getBoundingClientRect() + // Used to ensure timeout re-tries don't fire when another extend + // happened in the meantime (clearTimeout isn't reliable -- at + // least on Chrome, the timeouts still happen even when cleared, + // if the clear happens after their scheduled firing time). + var counter = 0 + + function extend(e) { + var curCount = ++counter + var cur = posFromMouse(cm, e, true, type == "rect") + if (!cur) { return } + if (cmp(cur, lastPos) != 0) { + cm.curOp.focus = activeElt() + extendTo(cur) + var visible = visibleLines(display, doc) + if (cur.line >= visible.to || cur.line < visible.from) + { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e) }}), 150) } + } else { + var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0 + if (outside) { setTimeout(operation(cm, function () { + if (counter != curCount) { return } + display.scroller.scrollTop += outside + extend(e) + }), 50) } + } + } + + function done(e) { + cm.state.selectingText = false + counter = Infinity + e_preventDefault(e) + display.input.focus() + off(document, "mousemove", move) + off(document, "mouseup", up) + doc.history.lastSelOrigin = null + } + + var move = operation(cm, function (e) { + if (!e_button(e)) { done(e) } + else { extend(e) } + }) + var up = operation(cm, done) + cm.state.selectingText = up + on(document, "mousemove", move) + on(document, "mouseup", up) +} + + +// Determines whether an event happened in the gutter, and fires the +// handlers for the corresponding event. +function gutterEvent(cm, e, type, prevent) { + var mX, mY + try { mX = e.clientX; mY = e.clientY } + catch(e) { return false } + if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false } + if (prevent) { e_preventDefault(e) } + + var display = cm.display + var lineBox = display.lineDiv.getBoundingClientRect() + + if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) } + mY -= lineBox.top - display.viewOffset + + for (var i = 0; i < cm.options.gutters.length; ++i) { + var g = display.gutters.childNodes[i] + if (g && g.getBoundingClientRect().right >= mX) { + var line = lineAtHeight(cm.doc, mY) + var gutter = cm.options.gutters[i] + signal(cm, type, cm, line, gutter, e) + return e_defaultPrevented(e) + } + } +} + +function clickInGutter(cm, e) { + return gutterEvent(cm, e, "gutterClick", true) +} + +// CONTEXT MENU HANDLING + +// To make the context menu work, we need to briefly unhide the +// textarea (making it as unobtrusive as possible) to let the +// right-click take effect on it. +function onContextMenu(cm, e) { + if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return } + if (signalDOMEvent(cm, e, "contextmenu")) { return } + cm.display.input.onContextMenu(e) +} + +function contextMenuInGutter(cm, e) { + if (!hasHandler(cm, "gutterContextMenu")) { return false } + return gutterEvent(cm, e, "gutterContextMenu", false) +} + +function themeChanged(cm) { + cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") + + cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-") + clearCaches(cm) +} + +var Init = {toString: function(){return "CodeMirror.Init"}} + +var defaults = {} +var optionHandlers = {} + +function defineOptions(CodeMirror) { + var optionHandlers = CodeMirror.optionHandlers - updateLineClasses(lineView); - updateLineGutter(cm, lineView, lineN, dims); - insertLineWidgets(cm, lineView, dims); - return lineView.node; + function option(name, deflt, handle, notOnInit) { + CodeMirror.defaults[name] = deflt + if (handle) { optionHandlers[name] = + notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old) }} : handle } } - // A lineView may contain multiple logical lines (when merged by - // collapsed spans). The widgets for all of them need to be drawn. - function insertLineWidgets(cm, lineView, dims) { - insertLineWidgetsFor(cm, lineView.line, lineView, dims, true); - if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++) - insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); - } + CodeMirror.defineOption = option - function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) { - if (!line.widgets) return; - var wrap = ensureLineWrapped(lineView); - for (var i = 0, ws = line.widgets; i < ws.length; ++i) { - var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget"); - if (!widget.handleMouseEvents) node.setAttribute("cm-ignore-events", "true"); - positionLineWidget(widget, node, lineView, dims); - cm.display.input.setUneditable(node); - if (allowAbove && widget.above) - wrap.insertBefore(node, lineView.gutter || lineView.text); - else - wrap.appendChild(node); - signalLater(widget, "redraw"); - } - } + // Passed to option handlers when there is no old value. + CodeMirror.Init = Init - function positionLineWidget(widget, node, lineView, dims) { - if (widget.noHScroll) { - (lineView.alignable || (lineView.alignable = [])).push(node); - var width = dims.wrapperWidth; - node.style.left = dims.fixedPos + "px"; - if (!widget.coverGutter) { - width -= dims.gutterTotalWidth; - node.style.paddingLeft = dims.gutterTotalWidth + "px"; + // These two are, on init, called from the constructor because they + // have to be initialized before the editor can start at all. + option("value", "", function (cm, val) { return cm.setValue(val); }, true) + option("mode", null, function (cm, val) { + cm.doc.modeOption = val + loadMode(cm) + }, true) + + option("indentUnit", 2, loadMode, true) + option("indentWithTabs", false) + option("smartIndent", true) + option("tabSize", 4, function (cm) { + resetModeState(cm) + clearCaches(cm) + regChange(cm) + }, true) + option("lineSeparator", null, function (cm, val) { + cm.doc.lineSep = val + if (!val) { return } + var newBreaks = [], lineNo = cm.doc.first + cm.doc.iter(function (line) { + for (var pos = 0;;) { + var found = line.text.indexOf(val, pos) + if (found == -1) { break } + pos = found + val.length + newBreaks.push(Pos(lineNo, found)) } - node.style.width = width + "px"; - } - if (widget.coverGutter) { - node.style.zIndex = 5; - node.style.position = "relative"; - if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px"; + lineNo++ + }) + for (var i = newBreaks.length - 1; i >= 0; i--) + { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)) } + }) + option("specialChars", /[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g, function (cm, val, old) { + cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g") + if (old != Init) { cm.refresh() } + }) + option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true) + option("electricChars", true) + option("inputStyle", mobile ? "contenteditable" : "textarea", function () { + throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME + }, true) + option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true) + option("rtlMoveVisually", !windows) + option("wholeLineUpdateBefore", true) + + option("theme", "default", function (cm) { + themeChanged(cm) + guttersChanged(cm) + }, true) + option("keyMap", "default", function (cm, val, old) { + var next = getKeyMap(val) + var prev = old != Init && getKeyMap(old) + if (prev && prev.detach) { prev.detach(cm, next) } + if (next.attach) { next.attach(cm, prev || null) } + }) + option("extraKeys", null) + + option("lineWrapping", false, wrappingChanged, true) + option("gutters", [], function (cm) { + setGuttersForLineNumbers(cm.options) + guttersChanged(cm) + }, true) + option("fixedGutter", true, function (cm, val) { + cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0" + cm.refresh() + }, true) + option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true) + option("scrollbarStyle", "native", function (cm) { + initScrollbars(cm) + updateScrollbars(cm) + cm.display.scrollbars.setScrollTop(cm.doc.scrollTop) + cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft) + }, true) + option("lineNumbers", false, function (cm) { + setGuttersForLineNumbers(cm.options) + guttersChanged(cm) + }, true) + option("firstLineNumber", 1, guttersChanged, true) + option("lineNumberFormatter", function (integer) { return integer; }, guttersChanged, true) + option("showCursorWhenSelecting", false, updateSelection, true) + + option("resetSelectionOnContextMenu", true) + option("lineWiseCopyCut", true) + + option("readOnly", false, function (cm, val) { + if (val == "nocursor") { + onBlur(cm) + cm.display.input.blur() + cm.display.disabled = true + } else { + cm.display.disabled = false } - } - - // POSITION OBJECT - - // A Pos instance represents a position within the text. - var Pos = CodeMirror.Pos = function(line, ch) { - if (!(this instanceof Pos)) return new Pos(line, ch); - this.line = line; this.ch = ch; - }; - - // Compare two positions, return 0 if they are the same, a negative - // number when a is less, and a positive number otherwise. - var cmp = CodeMirror.cmpPos = function(a, b) { return a.line - b.line || a.ch - b.ch; }; + cm.display.input.readOnlyChanged(val) + }) + option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset() }}, true) + option("dragDrop", true, dragDropChanged) + option("allowDropFileTypes", null) + + option("cursorBlinkRate", 530) + option("cursorScrollMargin", 0) + option("cursorHeight", 1, updateSelection, true) + option("singleCursorHeightPerLine", true, updateSelection, true) + option("workTime", 100) + option("workDelay", 100) + option("flattenSpans", true, resetModeState, true) + option("addModeClass", false, resetModeState, true) + option("pollInterval", 100) + option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; }) + option("historyEventDelay", 1250) + option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true) + option("maxHighlightLength", 10000, resetModeState, true) + option("moveInputWithCursor", true, function (cm, val) { + if (!val) { cm.display.input.resetPosition() } + }) + + option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; }) + option("autofocus", null) +} + +function guttersChanged(cm) { + updateGutters(cm) + regChange(cm) + setTimeout(function () { return alignHorizontally(cm); }, 20) +} + +function dragDropChanged(cm, value, old) { + var wasOn = old && old != Init + if (!value != !wasOn) { + var funcs = cm.display.dragFunctions + var toggle = value ? on : off + toggle(cm.display.scroller, "dragstart", funcs.start) + toggle(cm.display.scroller, "dragenter", funcs.enter) + toggle(cm.display.scroller, "dragover", funcs.over) + toggle(cm.display.scroller, "dragleave", funcs.leave) + toggle(cm.display.scroller, "drop", funcs.drop) + } +} + +function wrappingChanged(cm) { + if (cm.options.lineWrapping) { + addClass(cm.display.wrapper, "CodeMirror-wrap") + cm.display.sizer.style.minWidth = "" + cm.display.sizerWidth = null + } else { + rmClass(cm.display.wrapper, "CodeMirror-wrap") + findMaxLine(cm) + } + estimateLineHeights(cm) + regChange(cm) + clearCaches(cm) + setTimeout(function () { return updateScrollbars(cm); }, 100) +} + +// A CodeMirror instance represents an editor. This is the object +// that user code is usually dealing with. + +function CodeMirror(place, options) { + var this$1 = this; + + if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) } + + this.options = options = options ? copyObj(options) : {} + // Determine effective options based on given values and defaults. + copyObj(defaults, options, false) + setGuttersForLineNumbers(options) + + var doc = options.value + if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator) } + this.doc = doc + + var input = new CodeMirror.inputStyles[options.inputStyle](this) + var display = this.display = new Display(place, doc, input) + display.wrapper.CodeMirror = this + updateGutters(this) + themeChanged(this) + if (options.lineWrapping) + { this.display.wrapper.className += " CodeMirror-wrap" } + if (options.autofocus && !mobile) { display.input.focus() } + initScrollbars(this) + + this.state = { + keyMaps: [], // stores maps added by addKeyMap + overlays: [], // highlighting overlays, as added by addOverlay + modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info + overwrite: false, + delayingBlurEvent: false, + focused: false, + suppressEdits: false, // used to disable editing during key handlers when in readOnly mode + pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll + selectingText: false, + draggingText: false, + highlight: new Delayed(), // stores highlight worker timeout + keySeq: null, // Unfinished key sequence + specialChars: null + } + + // Override magic textarea content restore that IE sometimes does + // on our hidden textarea on reload + if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20) } + + registerEventHandlers(this) + ensureGlobalHandlers() + + startOperation(this) + this.curOp.forceUpdate = true + attachDoc(this, doc) + + if ((options.autofocus && !mobile) || this.hasFocus()) + { setTimeout(bind(onFocus, this), 20) } + else + { onBlur(this) } + + for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt)) + { optionHandlers[opt](this$1, options[opt], Init) } } + maybeUpdateLineNumberWidth(this) + if (options.finishInit) { options.finishInit(this) } + for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1) } + endOperation(this) + // Suppress optimizelegibility in Webkit, since it breaks text + // measuring on line wrapping boundaries. + if (webkit && options.lineWrapping && + getComputedStyle(display.lineDiv).textRendering == "optimizelegibility") + { display.lineDiv.style.textRendering = "auto" } +} + +// The default configuration options. +CodeMirror.defaults = defaults +// Functions to run when options are changed. +CodeMirror.optionHandlers = optionHandlers + +// Attach the necessary event handlers when initializing the editor +function registerEventHandlers(cm) { + var d = cm.display + on(d.scroller, "mousedown", operation(cm, onMouseDown)) + // Older IE's will not fire a second mousedown for a double click + if (ie && ie_version < 11) + { on(d.scroller, "dblclick", operation(cm, function (e) { + if (signalDOMEvent(cm, e)) { return } + var pos = posFromMouse(cm, e) + if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return } + e_preventDefault(e) + var word = cm.findWordAt(pos) + extendSelection(cm.doc, word.anchor, word.head) + })) } + else + { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }) } + // Some browsers fire contextmenu *after* opening the menu, at + // which point we can't mess with it anymore. Context menu is + // handled in onMouseDown for these browsers. + if (!captureRightClick) { on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }) } + + // Used to suppress mouse event handling when a touch happens + var touchFinished, prevTouch = {end: 0} + function finishTouch() { + if (d.activeTouch) { + touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000) + prevTouch = d.activeTouch + prevTouch.end = +new Date + } + } + function isMouseLikeTouchEvent(e) { + if (e.touches.length != 1) { return false } + var touch = e.touches[0] + return touch.radiusX <= 1 && touch.radiusY <= 1 + } + function farAway(touch, other) { + if (other.left == null) { return true } + var dx = other.left - touch.left, dy = other.top - touch.top + return dx * dx + dy * dy > 20 * 20 + } + on(d.scroller, "touchstart", function (e) { + if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) { + clearTimeout(touchFinished) + var now = +new Date + d.activeTouch = {start: now, moved: false, + prev: now - prevTouch.end <= 300 ? prevTouch : null} + if (e.touches.length == 1) { + d.activeTouch.left = e.touches[0].pageX + d.activeTouch.top = e.touches[0].pageY + } + } + }) + on(d.scroller, "touchmove", function () { + if (d.activeTouch) { d.activeTouch.moved = true } + }) + on(d.scroller, "touchend", function (e) { + var touch = d.activeTouch + if (touch && !eventInWidget(d, e) && touch.left != null && + !touch.moved && new Date - touch.start < 300) { + var pos = cm.coordsChar(d.activeTouch, "page"), range + if (!touch.prev || farAway(touch, touch.prev)) // Single tap + { range = new Range(pos, pos) } + else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap + { range = cm.findWordAt(pos) } + else // Triple tap + { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) } + cm.setSelection(range.anchor, range.head) + cm.focus() + e_preventDefault(e) + } + finishTouch() + }) + on(d.scroller, "touchcancel", finishTouch) + + // Sync scrolling between fake scrollbars and real scrollable + // area, ensure viewport is updated when scrolling. + on(d.scroller, "scroll", function () { + if (d.scroller.clientHeight) { + setScrollTop(cm, d.scroller.scrollTop) + setScrollLeft(cm, d.scroller.scrollLeft, true) + signal(cm, "scroll", cm) + } + }) + + // Listen to wheel events in order to try and update the viewport on time. + on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); }) + on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); }) + + // Prevent wrapper from ever scrolling + on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; }) + + d.dragFunctions = { + enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e) }}, + over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e) }}, + start: function (e) { return onDragStart(cm, e); }, + drop: operation(cm, onDrop), + leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm) }} + } + + var inp = d.input.getField() + on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); }) + on(inp, "keydown", operation(cm, onKeyDown)) + on(inp, "keypress", operation(cm, onKeyPress)) + on(inp, "focus", function (e) { return onFocus(cm, e); }) + on(inp, "blur", function (e) { return onBlur(cm, e); }) +} + +var initHooks = [] +CodeMirror.defineInitHook = function (f) { return initHooks.push(f); } + +// Indent the given line. The how parameter can be "smart", +// "add"/null, "subtract", or "prev". When aggressive is false +// (typically set to true for forced single-line indents), empty +// lines are not indented, and places where the mode returns Pass +// are left alone. +function indentLine(cm, n, how, aggressive) { + var doc = cm.doc, state + if (how == null) { how = "add" } + if (how == "smart") { + // Fall back to "prev" when the mode doesn't have an indentation + // method. + if (!doc.mode.indent) { how = "prev" } + else { state = getStateBefore(cm, n) } + } + + var tabSize = cm.options.tabSize + var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize) + if (line.stateAfter) { line.stateAfter = null } + var curSpaceString = line.text.match(/^\s*/)[0], indentation + if (!aggressive && !/\S/.test(line.text)) { + indentation = 0 + how = "not" + } else if (how == "smart") { + indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text) + if (indentation == Pass || indentation > 150) { + if (!aggressive) { return } + how = "prev" + } + } + if (how == "prev") { + if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize) } + else { indentation = 0 } + } else if (how == "add") { + indentation = curSpace + cm.options.indentUnit + } else if (how == "subtract") { + indentation = curSpace - cm.options.indentUnit + } else if (typeof how == "number") { + indentation = curSpace + how + } + indentation = Math.max(0, indentation) + + var indentString = "", pos = 0 + if (cm.options.indentWithTabs) + { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t"} } + if (pos < indentation) { indentString += spaceStr(indentation - pos) } + + if (indentString != curSpaceString) { + replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input") + line.stateAfter = null + return true + } else { + // Ensure that, if the cursor was in the whitespace at the start + // of the line, it is moved to the end of that space. + for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) { + var range = doc.sel.ranges[i$1] + if (range.head.line == n && range.head.ch < curSpaceString.length) { + var pos$1 = Pos(n, curSpaceString.length) + replaceOneSelection(doc, i$1, new Range(pos$1, pos$1)) + break + } + } + } +} + +// This will be set to a {lineWise: bool, text: [string]} object, so +// that, when pasting, we know what kind of selections the copied +// text was made out of. +var lastCopied = null + +function setLastCopied(newLastCopied) { + lastCopied = newLastCopied +} + +function applyTextInput(cm, inserted, deleted, sel, origin) { + var doc = cm.doc + cm.display.shift = false + if (!sel) { sel = doc.sel } + + var paste = cm.state.pasteIncoming || origin == "paste" + var textLines = splitLinesAuto(inserted), multiPaste = null + // When pasing N lines into N selections, insert one line per selection + if (paste && sel.ranges.length > 1) { + if (lastCopied && lastCopied.text.join("\n") == inserted) { + if (sel.ranges.length % lastCopied.text.length == 0) { + multiPaste = [] + for (var i = 0; i < lastCopied.text.length; i++) + { multiPaste.push(doc.splitLines(lastCopied.text[i])) } + } + } else if (textLines.length == sel.ranges.length) { + multiPaste = map(textLines, function (l) { return [l]; }) + } + } + + var updateInput + // Normal behavior is to insert the new text into every selection + for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) { + var range = sel.ranges[i$1] + var from = range.from(), to = range.to() + if (range.empty()) { + if (deleted && deleted > 0) // Handle deletion + { from = Pos(from.line, from.ch - deleted) } + else if (cm.state.overwrite && !paste) // Handle overwrite + { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)) } + else if (lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted) + { from = to = Pos(from.line, 0) } + } + updateInput = cm.curOp.updateInput + var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines, + origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")} + makeChange(cm.doc, changeEvent) + signalLater(cm, "inputRead", cm, changeEvent) + } + if (inserted && !paste) + { triggerElectric(cm, inserted) } + + ensureCursorVisible(cm) + cm.curOp.updateInput = updateInput + cm.curOp.typing = true + cm.state.pasteIncoming = cm.state.cutIncoming = false +} + +function handlePaste(e, cm) { + var pasted = e.clipboardData && e.clipboardData.getData("Text") + if (pasted) { + e.preventDefault() + if (!cm.isReadOnly() && !cm.options.disableInput) + { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }) } + return true + } +} + +function triggerElectric(cm, inserted) { + // When an 'electric' character is inserted, immediately trigger a reindent + if (!cm.options.electricChars || !cm.options.smartIndent) { return } + var sel = cm.doc.sel + + for (var i = sel.ranges.length - 1; i >= 0; i--) { + var range = sel.ranges[i] + if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue } + var mode = cm.getModeAt(range.head) + var indented = false + if (mode.electricChars) { + for (var j = 0; j < mode.electricChars.length; j++) + { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) { + indented = indentLine(cm, range.head.line, "smart") + break + } } + } else if (mode.electricInput) { + if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch))) + { indented = indentLine(cm, range.head.line, "smart") } + } + if (indented) { signalLater(cm, "electricInput", cm, range.head.line) } + } +} + +function copyableRanges(cm) { + var text = [], ranges = [] + for (var i = 0; i < cm.doc.sel.ranges.length; i++) { + var line = cm.doc.sel.ranges[i].head.line + var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)} + ranges.push(lineRange) + text.push(cm.getRange(lineRange.anchor, lineRange.head)) + } + return {text: text, ranges: ranges} +} + +function disableBrowserMagic(field, spellcheck) { + field.setAttribute("autocorrect", "off") + field.setAttribute("autocapitalize", "off") + field.setAttribute("spellcheck", !!spellcheck) +} + +function hiddenTextarea() { + var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none") + var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;") + // The textarea is kept positioned near the cursor to prevent the + // fact that it'll be scrolled into view on input from scrolling + // our fake cursor out of view. On webkit, when wrap=off, paste is + // very slow. So make the area wide instead. + if (webkit) { te.style.width = "1000px" } + else { te.setAttribute("wrap", "off") } + // If border: 0; -- iOS fails to open keyboard (issue #1287) + if (ios) { te.style.border = "1px solid black" } + disableBrowserMagic(te) + return div +} + +// The publicly visible API. Note that methodOp(f) means +// 'wrap f in an operation, performed on its `this` parameter'. + +// This is not the complete set of editor methods. Most of the +// methods defined on the Doc type are also injected into +// CodeMirror.prototype, for backwards compatibility and +// convenience. + +function addEditorMethods(CodeMirror) { + var optionHandlers = CodeMirror.optionHandlers + + var helpers = CodeMirror.helpers = {} - function copyPos(x) {return Pos(x.line, x.ch);} - function maxPos(a, b) { return cmp(a, b) < 0 ? b : a; } - function minPos(a, b) { return cmp(a, b) < 0 ? a : b; } + CodeMirror.prototype = { + constructor: CodeMirror, + focus: function(){window.focus(); this.display.input.focus()}, - // INPUT HANDLING + setOption: function(option, value) { + var options = this.options, old = options[option] + if (options[option] == value && option != "mode") { return } + options[option] = value + if (optionHandlers.hasOwnProperty(option)) + { operation(this, optionHandlers[option])(this, value, old) } + }, - function ensureFocus(cm) { - if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); } - } + getOption: function(option) {return this.options[option]}, + getDoc: function() {return this.doc}, - // This will be set to a {lineWise: bool, text: [string]} object, so - // that, when pasting, we know what kind of selections the copied - // text was made out of. - var lastCopied = null; + addKeyMap: function(map, bottom) { + this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map)) + }, + removeKeyMap: function(map) { + var maps = this.state.keyMaps + for (var i = 0; i < maps.length; ++i) + { if (maps[i] == map || maps[i].name == map) { + maps.splice(i, 1) + return true + } } + }, - function applyTextInput(cm, inserted, deleted, sel, origin) { - var doc = cm.doc; - cm.display.shift = false; - if (!sel) sel = doc.sel; + addOverlay: methodOp(function(spec, options) { + var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec) + if (mode.startState) { throw new Error("Overlays may not be stateful.") } + insertSorted(this.state.overlays, + {mode: mode, modeSpec: spec, opaque: options && options.opaque, + priority: (options && options.priority) || 0}, + function (overlay) { return overlay.priority; }) + this.state.modeGen++ + regChange(this) + }), + removeOverlay: methodOp(function(spec) { + var this$1 = this; - var paste = cm.state.pasteIncoming || origin == "paste"; - var textLines = doc.splitLines(inserted), multiPaste = null - // When pasing N lines into N selections, insert one line per selection - if (paste && sel.ranges.length > 1) { - if (lastCopied && lastCopied.text.join("\n") == inserted) { - if (sel.ranges.length % lastCopied.text.length == 0) { - multiPaste = []; - for (var i = 0; i < lastCopied.text.length; i++) - multiPaste.push(doc.splitLines(lastCopied.text[i])); + var overlays = this.state.overlays + for (var i = 0; i < overlays.length; ++i) { + var cur = overlays[i].modeSpec + if (cur == spec || typeof spec == "string" && cur.name == spec) { + overlays.splice(i, 1) + this$1.state.modeGen++ + regChange(this$1) + return } - } else if (textLines.length == sel.ranges.length) { - multiPaste = map(textLines, function(l) { return [l]; }); } - } + }), - // Normal behavior is to insert the new text into every selection - for (var i = sel.ranges.length - 1; i >= 0; i--) { - var range = sel.ranges[i]; - var from = range.from(), to = range.to(); - if (range.empty()) { - if (deleted && deleted > 0) // Handle deletion - from = Pos(from.line, from.ch - deleted); - else if (cm.state.overwrite && !paste) // Handle overwrite - to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); - else if (lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted) - from = to = Pos(from.line, 0) - } - var updateInput = cm.curOp.updateInput; - var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines, - origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")}; - makeChange(cm.doc, changeEvent); - signalLater(cm, "inputRead", cm, changeEvent); - } - if (inserted && !paste) - triggerElectric(cm, inserted); - - ensureCursorVisible(cm); - cm.curOp.updateInput = updateInput; - cm.curOp.typing = true; - cm.state.pasteIncoming = cm.state.cutIncoming = false; - } - - function handlePaste(e, cm) { - var pasted = e.clipboardData && e.clipboardData.getData("Text"); - if (pasted) { - e.preventDefault(); - if (!cm.isReadOnly() && !cm.options.disableInput) - runInOp(cm, function() { applyTextInput(cm, pasted, 0, null, "paste"); }); - return true; - } - } - - function triggerElectric(cm, inserted) { - // When an 'electric' character is inserted, immediately trigger a reindent - if (!cm.options.electricChars || !cm.options.smartIndent) return; - var sel = cm.doc.sel; - - for (var i = sel.ranges.length - 1; i >= 0; i--) { - var range = sel.ranges[i]; - if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) continue; - var mode = cm.getModeAt(range.head); - var indented = false; - if (mode.electricChars) { - for (var j = 0; j < mode.electricChars.length; j++) - if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) { - indented = indentLine(cm, range.head.line, "smart"); - break; - } - } else if (mode.electricInput) { - if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch))) - indented = indentLine(cm, range.head.line, "smart"); + indentLine: methodOp(function(n, dir, aggressive) { + if (typeof dir != "string" && typeof dir != "number") { + if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev" } + else { dir = dir ? "add" : "subtract" } } - if (indented) signalLater(cm, "electricInput", cm, range.head.line); - } - } - - function copyableRanges(cm) { - var text = [], ranges = []; - for (var i = 0; i < cm.doc.sel.ranges.length; i++) { - var line = cm.doc.sel.ranges[i].head.line; - var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)}; - ranges.push(lineRange); - text.push(cm.getRange(lineRange.anchor, lineRange.head)); - } - return {text: text, ranges: ranges}; - } - - function disableBrowserMagic(field, spellcheck) { - field.setAttribute("autocorrect", "off"); - field.setAttribute("autocapitalize", "off"); - field.setAttribute("spellcheck", !!spellcheck); - } - - // TEXTAREA INPUT STYLE - - function TextareaInput(cm) { - this.cm = cm; - // See input.poll and input.reset - this.prevInput = ""; - - // Flag that indicates whether we expect input to appear real soon - // now (after some event like 'keypress' or 'input') and are - // polling intensively. - this.pollingFast = false; - // Self-resetting timeout for the poller - this.polling = new Delayed(); - // Tracks when input.reset has punted to just putting a short - // string into the textarea instead of the full selection. - this.inaccurateSelection = false; - // Used to work around IE issue with selection being forgotten when focus moves away from textarea - this.hasSelection = false; - this.composing = null; - }; + if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive) } + }), + indentSelection: methodOp(function(how) { + var this$1 = this; - function hiddenTextarea() { - var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"); - var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); - // The textarea is kept positioned near the cursor to prevent the - // fact that it'll be scrolled into view on input from scrolling - // our fake cursor out of view. On webkit, when wrap=off, paste is - // very slow. So make the area wide instead. - if (webkit) te.style.width = "1000px"; - else te.setAttribute("wrap", "off"); - // If border: 0; -- iOS fails to open keyboard (issue #1287) - if (ios) te.style.border = "1px solid black"; - disableBrowserMagic(te); - return div; - } - - TextareaInput.prototype = copyObj({ - init: function(display) { - var input = this, cm = this.cm; - - // Wraps and hides input textarea - var div = this.wrapper = hiddenTextarea(); - // The semihidden textarea that is focused when the editor is - // focused, and receives input. - var te = this.textarea = div.firstChild; - display.wrapper.insertBefore(div, display.wrapper.firstChild); - - // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore) - if (ios) te.style.width = "0px"; - - on(te, "input", function() { - if (ie && ie_version >= 9 && input.hasSelection) input.hasSelection = null; - input.poll(); - }); - - on(te, "paste", function(e) { - if (signalDOMEvent(cm, e) || handlePaste(e, cm)) return - - cm.state.pasteIncoming = true; - input.fastPoll(); - }); - - function prepareCopyCut(e) { - if (signalDOMEvent(cm, e)) return - if (cm.somethingSelected()) { - lastCopied = {lineWise: false, text: cm.getSelections()}; - if (input.inaccurateSelection) { - input.prevInput = ""; - input.inaccurateSelection = false; - te.value = lastCopied.text.join("\n"); - selectInput(te); - } - } else if (!cm.options.lineWiseCopyCut) { - return; - } else { - var ranges = copyableRanges(cm); - lastCopied = {lineWise: true, text: ranges.text}; - if (e.type == "cut") { - cm.setSelections(ranges.ranges, null, sel_dontScroll); - } else { - input.prevInput = ""; - te.value = ranges.text.join("\n"); - selectInput(te); - } - } - if (e.type == "cut") cm.state.cutIncoming = true; - } - on(te, "cut", prepareCopyCut); - on(te, "copy", prepareCopyCut); - - on(display.scroller, "paste", function(e) { - if (eventInWidget(display, e) || signalDOMEvent(cm, e)) return; - cm.state.pasteIncoming = true; - input.focus(); - }); - - // Prevent normal selection in the editor (we handle our own) - on(display.lineSpace, "selectstart", function(e) { - if (!eventInWidget(display, e)) e_preventDefault(e); - }); - - on(te, "compositionstart", function() { - var start = cm.getCursor("from"); - if (input.composing) input.composing.range.clear() - input.composing = { - start: start, - range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"}) - }; - }); - on(te, "compositionend", function() { - if (input.composing) { - input.poll(); - input.composing.range.clear(); - input.composing = null; + var ranges = this.doc.sel.ranges, end = -1 + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i] + if (!range.empty()) { + var from = range.from(), to = range.to() + var start = Math.max(end, from.line) + end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1 + for (var j = start; j < end; ++j) + { indentLine(this$1, j, how) } + var newRanges = this$1.doc.sel.ranges + if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0) + { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll) } + } else if (range.head.line > end) { + indentLine(this$1, range.head.line, how, true) + end = range.head.line + if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1) } } - }); - }, - - prepareSelection: function() { - // Redraw the selection and/or cursor - var cm = this.cm, display = cm.display, doc = cm.doc; - var result = prepareSelection(cm); - - // Move the hidden textarea near the cursor to prevent scrolling artifacts - if (cm.options.moveInputWithCursor) { - var headPos = cursorCoords(cm, doc.sel.primary().head, "div"); - var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect(); - result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10, - headPos.top + lineOff.top - wrapOff.top)); - result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10, - headPos.left + lineOff.left - wrapOff.left)); } + }), - return result; + // Fetch the parser token for a given character. Useful for hacks + // that want to inspect the mode state (say, for completion). + getTokenAt: function(pos, precise) { + return takeToken(this, pos, precise) }, - showSelection: function(drawn) { - var cm = this.cm, display = cm.display; - removeChildrenAndAdd(display.cursorDiv, drawn.cursors); - removeChildrenAndAdd(display.selectionDiv, drawn.selection); - if (drawn.teTop != null) { - this.wrapper.style.top = drawn.teTop + "px"; - this.wrapper.style.left = drawn.teLeft + "px"; - } + getLineTokens: function(line, precise) { + return takeToken(this, Pos(line), precise, true) }, - // Reset the input to correspond to the selection (or to be empty, - // when not typing and nothing is selected) - reset: function(typing) { - if (this.contextMenuPending) return; - var minimal, selected, cm = this.cm, doc = cm.doc; - if (cm.somethingSelected()) { - this.prevInput = ""; - var range = doc.sel.primary(); - minimal = hasCopyEvent && - (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000); - var content = minimal ? "-" : selected || cm.getSelection(); - this.textarea.value = content; - if (cm.state.focused) selectInput(this.textarea); - if (ie && ie_version >= 9) this.hasSelection = content; - } else if (!typing) { - this.prevInput = this.textarea.value = ""; - if (ie && ie_version >= 9) this.hasSelection = null; - } - this.inaccurateSelection = minimal; + getTokenTypeAt: function(pos) { + pos = clipPos(this.doc, pos) + var styles = getLineStyles(this, getLine(this.doc, pos.line)) + var before = 0, after = (styles.length - 1) / 2, ch = pos.ch + var type + if (ch == 0) { type = styles[2] } + else { for (;;) { + var mid = (before + after) >> 1 + if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid } + else if (styles[mid * 2 + 1] < ch) { before = mid + 1 } + else { type = styles[mid * 2 + 2]; break } + } } + var cut = type ? type.indexOf("overlay ") : -1 + return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1) }, - getField: function() { return this.textarea; }, - - supportsTouch: function() { return false; }, - - focus: function() { - if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) { - try { this.textarea.focus(); } - catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM - } + getModeAt: function(pos) { + var mode = this.doc.mode + if (!mode.innerMode) { return mode } + return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode }, - blur: function() { this.textarea.blur(); }, - - resetPosition: function() { - this.wrapper.style.top = this.wrapper.style.left = 0; + getHelper: function(pos, type) { + return this.getHelpers(pos, type)[0] }, - receivedFocus: function() { this.slowPoll(); }, - - // Poll for input changes, using the normal rate of polling. This - // runs as long as the editor is focused. - slowPoll: function() { - var input = this; - if (input.pollingFast) return; - input.polling.set(this.cm.options.pollInterval, function() { - input.poll(); - if (input.cm.state.focused) input.slowPoll(); - }); - }, + getHelpers: function(pos, type) { + var this$1 = this; - // When an event has just come in that is likely to add or change - // something in the input textarea, we poll faster, to ensure that - // the change appears on the screen quickly. - fastPoll: function() { - var missed = false, input = this; - input.pollingFast = true; - function p() { - var changed = input.poll(); - if (!changed && !missed) {missed = true; input.polling.set(60, p);} - else {input.pollingFast = false; input.slowPoll();} + var found = [] + if (!helpers.hasOwnProperty(type)) { return found } + var help = helpers[type], mode = this.getModeAt(pos) + if (typeof mode[type] == "string") { + if (help[mode[type]]) { found.push(help[mode[type]]) } + } else if (mode[type]) { + for (var i = 0; i < mode[type].length; i++) { + var val = help[mode[type][i]] + if (val) { found.push(val) } + } + } else if (mode.helperType && help[mode.helperType]) { + found.push(help[mode.helperType]) + } else if (help[mode.name]) { + found.push(help[mode.name]) } - input.polling.set(20, p); - }, - - // Read input from the textarea, and update the document to match. - // When something is selected, it is present in the textarea, and - // selected (unless it is huge, in which case a placeholder is - // used). When nothing is selected, the cursor sits after previously - // seen text (can be empty), which is stored in prevInput (we must - // not reset the textarea when typing, because that breaks IME). - poll: function() { - var cm = this.cm, input = this.textarea, prevInput = this.prevInput; - // Since this is called a *lot*, try to bail out as cheaply as - // possible when it is clear that nothing happened. hasSelection - // will be the case when there is a lot of text in the textarea, - // in which case reading its value would be expensive. - if (this.contextMenuPending || !cm.state.focused || - (hasSelection(input) && !prevInput && !this.composing) || - cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq) - return false; - - var text = input.value; - // If nothing changed, bail. - if (text == prevInput && !cm.somethingSelected()) return false; - // Work around nonsensical selection resetting in IE9/10, and - // inexplicable appearance of private area unicode characters on - // some key combos in Mac (#2689). - if (ie && ie_version >= 9 && this.hasSelection === text || - mac && /[\uf700-\uf7ff]/.test(text)) { - cm.display.input.reset(); - return false; + for (var i$1 = 0; i$1 < help._global.length; i$1++) { + var cur = help._global[i$1] + if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1) + { found.push(cur.val) } } + return found + }, - if (cm.doc.sel == cm.display.selForContextMenu) { - var first = text.charCodeAt(0); - if (first == 0x200b && !prevInput) prevInput = "\u200b"; - if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo"); } - } - // Find the part of the input that is actually new - var same = 0, l = Math.min(prevInput.length, text.length); - while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same; - - var self = this; - runInOp(cm, function() { - applyTextInput(cm, text.slice(same), prevInput.length - same, - null, self.composing ? "*compose" : null); - - // Don't leave long text in the textarea, since it makes further polling slow - if (text.length > 1000 || text.indexOf("\n") > -1) input.value = self.prevInput = ""; - else self.prevInput = text; - - if (self.composing) { - self.composing.range.clear(); - self.composing.range = cm.markText(self.composing.start, cm.getCursor("to"), - {className: "CodeMirror-composing"}); - } - }); - return true; + getStateAfter: function(line, precise) { + var doc = this.doc + line = clipLine(doc, line == null ? doc.first + doc.size - 1: line) + return getStateBefore(this, line + 1, precise) }, - ensurePolled: function() { - if (this.pollingFast && this.poll()) this.pollingFast = false; + cursorCoords: function(start, mode) { + var pos, range = this.doc.sel.primary() + if (start == null) { pos = range.head } + else if (typeof start == "object") { pos = clipPos(this.doc, start) } + else { pos = start ? range.from() : range.to() } + return cursorCoords(this, pos, mode || "page") }, - onKeyPress: function() { - if (ie && ie_version >= 9) this.hasSelection = null; - this.fastPoll(); + charCoords: function(pos, mode) { + return charCoords(this, clipPos(this.doc, pos), mode || "page") }, - onContextMenu: function(e) { - var input = this, cm = input.cm, display = cm.display, te = input.textarea; - var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop; - if (!pos || presto) return; // Opera is difficult. - - // Reset the current text selection only if the click is done outside of the selection - // and 'resetSelectionOnContextMenu' option is true. - var reset = cm.options.resetSelectionOnContextMenu; - if (reset && cm.doc.sel.contains(pos) == -1) - operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); - - var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText; - input.wrapper.style.cssText = "position: absolute" - var wrapperBox = input.wrapper.getBoundingClientRect() - te.style.cssText = "position: absolute; width: 30px; height: 30px; top: " + (e.clientY - wrapperBox.top - 5) + - "px; left: " + (e.clientX - wrapperBox.left - 5) + "px; z-index: 1000; background: " + - (ie ? "rgba(255, 255, 255, .05)" : "transparent") + - "; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; - if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712) - display.input.focus(); - if (webkit) window.scrollTo(null, oldScrollY); - display.input.reset(); - // Adds "Select all" to context menu in FF - if (!cm.somethingSelected()) te.value = input.prevInput = " "; - input.contextMenuPending = true; - display.selForContextMenu = cm.doc.sel; - clearTimeout(display.detectingSelectAll); - - // Select-all will be greyed out if there's nothing to select, so - // this adds a zero-width space so that we can later check whether - // it got selected. - function prepareSelectAllHack() { - if (te.selectionStart != null) { - var selected = cm.somethingSelected(); - var extval = "\u200b" + (selected ? te.value : ""); - te.value = "\u21da"; // Used to catch context-menu undo - te.value = extval; - input.prevInput = selected ? "" : "\u200b"; - te.selectionStart = 1; te.selectionEnd = extval.length; - // Re-set this, in case some other handler touched the - // selection in the meantime. - display.selForContextMenu = cm.doc.sel; - } - } - function rehide() { - input.contextMenuPending = false; - input.wrapper.style.cssText = oldWrapperCSS - te.style.cssText = oldCSS; - if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); - - // Try to detect the user choosing select-all - if (te.selectionStart != null) { - if (!ie || (ie && ie_version < 9)) prepareSelectAllHack(); - var i = 0, poll = function() { - if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 && - te.selectionEnd > 0 && input.prevInput == "\u200b") - operation(cm, commands.selectAll)(cm); - else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500); - else display.input.reset(); - }; - display.detectingSelectAll = setTimeout(poll, 200); - } - } + coordsChar: function(coords, mode) { + coords = fromCoordSystem(this, coords, mode || "page") + return coordsChar(this, coords.left, coords.top) + }, - if (ie && ie_version >= 9) prepareSelectAllHack(); - if (captureRightClick) { - e_stop(e); - var mouseup = function() { - off(window, "mouseup", mouseup); - setTimeout(rehide, 20); - }; - on(window, "mouseup", mouseup); + lineAtHeight: function(height, mode) { + height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top + return lineAtHeight(this.doc, height + this.display.viewOffset) + }, + heightAtLine: function(line, mode) { + var end = false, lineObj + if (typeof line == "number") { + var last = this.doc.first + this.doc.size - 1 + if (line < this.doc.first) { line = this.doc.first } + else if (line > last) { line = last; end = true } + lineObj = getLine(this.doc, line) } else { - setTimeout(rehide, 50); + lineObj = line } + return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page").top + + (end ? this.doc.height - heightAtLine(lineObj) : 0) }, - readOnlyChanged: function(val) { - if (!val) this.reset(); - }, + defaultTextHeight: function() { return textHeight(this.display) }, + defaultCharWidth: function() { return charWidth(this.display) }, - setUneditable: nothing, + setGutterMarker: methodOp(function(line, gutterID, value) { + return changeLine(this.doc, line, "gutter", function (line) { + var markers = line.gutterMarkers || (line.gutterMarkers = {}) + markers[gutterID] = value + if (!value && isEmpty(markers)) { line.gutterMarkers = null } + return true + }) + }), - needsContentAttribute: false - }, TextareaInput.prototype); - - // CONTENTEDITABLE INPUT STYLE - - function ContentEditableInput(cm) { - this.cm = cm; - this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null; - this.polling = new Delayed(); - this.gracePeriod = false; - } - - ContentEditableInput.prototype = copyObj({ - init: function(display) { - var input = this, cm = input.cm; - var div = input.div = display.lineDiv; - disableBrowserMagic(div, cm.options.spellcheck); + clearGutter: methodOp(function(gutterID) { + var this$1 = this; - on(div, "paste", function(e) { - if (signalDOMEvent(cm, e) || handlePaste(e, cm)) return - // IE doesn't fire input events, so we schedule a read for the pasted content in this way - if (ie_version <= 11) setTimeout(operation(cm, function() { - if (!input.pollContent()) regChange(cm); - }), 20) + var doc = this.doc, i = doc.first + doc.iter(function (line) { + if (line.gutterMarkers && line.gutterMarkers[gutterID]) { + line.gutterMarkers[gutterID] = null + regLineChange(this$1, i, "gutter") + if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null } + } + ++i }) + }), - on(div, "compositionstart", function(e) { - var data = e.data; - input.composing = {sel: cm.doc.sel, data: data, startData: data}; - if (!data) return; - var prim = cm.doc.sel.primary(); - var line = cm.getLine(prim.head.line); - var found = line.indexOf(data, Math.max(0, prim.head.ch - data.length)); - if (found > -1 && found <= prim.head.ch) - input.composing.sel = simpleSelection(Pos(prim.head.line, found), - Pos(prim.head.line, found + data.length)); - }); - on(div, "compositionupdate", function(e) { - input.composing.data = e.data; - }); - on(div, "compositionend", function(e) { - var ours = input.composing; - if (!ours) return; - if (e.data != ours.startData && !/\u200b/.test(e.data)) - ours.data = e.data; - // Need a small delay to prevent other code (input event, - // selection polling) from doing damage when fired right after - // compositionend. - setTimeout(function() { - if (!ours.handled) - input.applyComposition(ours); - if (input.composing == ours) - input.composing = null; - }, 50); - }); - - on(div, "touchstart", function() { - input.forceCompositionEnd(); - }); - - on(div, "input", function() { - if (input.composing) return; - if (cm.isReadOnly() || !input.pollContent()) - runInOp(input.cm, function() {regChange(cm);}); - }); - - function onCopyCut(e) { - if (signalDOMEvent(cm, e)) return - if (cm.somethingSelected()) { - lastCopied = {lineWise: false, text: cm.getSelections()}; - if (e.type == "cut") cm.replaceSelection("", null, "cut"); - } else if (!cm.options.lineWiseCopyCut) { - return; - } else { - var ranges = copyableRanges(cm); - lastCopied = {lineWise: true, text: ranges.text}; - if (e.type == "cut") { - cm.operation(function() { - cm.setSelections(ranges.ranges, 0, sel_dontScroll); - cm.replaceSelection("", null, "cut"); - }); - } - } - if (e.clipboardData) { - e.clipboardData.clearData(); - var content = lastCopied.text.join("\n") - // iOS exposes the clipboard API, but seems to discard content inserted into it - e.clipboardData.setData("Text", content); - if (e.clipboardData.getData("Text") == content) { - e.preventDefault(); - return - } - } - // Old-fashioned briefly-focus-a-textarea hack - var kludge = hiddenTextarea(), te = kludge.firstChild; - cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild); - te.value = lastCopied.text.join("\n"); - var hadFocus = document.activeElement; - selectInput(te); - setTimeout(function() { - cm.display.lineSpace.removeChild(kludge); - hadFocus.focus(); - if (hadFocus == div) input.showPrimarySelection() - }, 50); + lineInfo: function(line) { + var n + if (typeof line == "number") { + if (!isLine(this.doc, line)) { return null } + n = line + line = getLine(this.doc, line) + if (!line) { return null } + } else { + n = lineNo(line) + if (n == null) { return null } } - on(div, "copy", onCopyCut); - on(div, "cut", onCopyCut); - }, - - prepareSelection: function() { - var result = prepareSelection(this.cm, false); - result.focus = this.cm.state.focused; - return result; + return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers, + textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass, + widgets: line.widgets} }, - showSelection: function(info, takeFocus) { - if (!info || !this.cm.display.view.length) return; - if (info.focus || takeFocus) this.showPrimarySelection(); - this.showMultipleSelections(info); - }, + getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}}, - showPrimarySelection: function() { - var sel = window.getSelection(), prim = this.cm.doc.sel.primary(); - var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset); - var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset); - if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad && - cmp(minPos(curAnchor, curFocus), prim.from()) == 0 && - cmp(maxPos(curAnchor, curFocus), prim.to()) == 0) - return; - - var start = posToDOM(this.cm, prim.from()); - var end = posToDOM(this.cm, prim.to()); - if (!start && !end) return; - - var view = this.cm.display.view; - var old = sel.rangeCount && sel.getRangeAt(0); - if (!start) { - start = {node: view[0].measure.map[2], offset: 0}; - } else if (!end) { // FIXME dangerously hacky - var measure = view[view.length - 1].measure; - var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map; - end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]}; + addWidget: function(pos, node, scroll, vert, horiz) { + var display = this.display + pos = cursorCoords(this, clipPos(this.doc, pos)) + var top = pos.bottom, left = pos.left + node.style.position = "absolute" + node.setAttribute("cm-ignore-events", "true") + this.display.input.setUneditable(node) + display.sizer.appendChild(node) + if (vert == "over") { + top = pos.top + } else if (vert == "above" || vert == "near") { + var vspace = Math.max(display.wrapper.clientHeight, this.doc.height), + hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth) + // Default to positioning above (if specified and possible); otherwise default to positioning below + if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) + { top = pos.top - node.offsetHeight } + else if (pos.bottom + node.offsetHeight <= vspace) + { top = pos.bottom } + if (left + node.offsetWidth > hspace) + { left = hspace - node.offsetWidth } } - - try { var rng = range(start.node, start.offset, end.offset, end.node); } - catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible - if (rng) { - if (!gecko && this.cm.state.focused) { - sel.collapse(start.node, start.offset); - if (!rng.collapsed) sel.addRange(rng); - } else { - sel.removeAllRanges(); - sel.addRange(rng); - } - if (old && sel.anchorNode == null) sel.addRange(old); - else if (gecko) this.startGracePeriod(); + node.style.top = top + "px" + node.style.left = node.style.right = "" + if (horiz == "right") { + left = display.sizer.clientWidth - node.offsetWidth + node.style.right = "0px" + } else { + if (horiz == "left") { left = 0 } + else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2 } + node.style.left = left + "px" } - this.rememberSelection(); + if (scroll) + { scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight) } }, - startGracePeriod: function() { - var input = this; - clearTimeout(this.gracePeriod); - this.gracePeriod = setTimeout(function() { - input.gracePeriod = false; - if (input.selectionChanged()) - input.cm.operation(function() { input.cm.curOp.selectionChanged = true; }); - }, 20); - }, + triggerOnKeyDown: methodOp(onKeyDown), + triggerOnKeyPress: methodOp(onKeyPress), + triggerOnKeyUp: onKeyUp, - showMultipleSelections: function(info) { - removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors); - removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection); + execCommand: function(cmd) { + if (commands.hasOwnProperty(cmd)) + { return commands[cmd].call(null, this) } }, - rememberSelection: function() { - var sel = window.getSelection(); - this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset; - this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset; - }, + triggerElectric: methodOp(function(text) { triggerElectric(this, text) }), - selectionInEditor: function() { - var sel = window.getSelection(); - if (!sel.rangeCount) return false; - var node = sel.getRangeAt(0).commonAncestorContainer; - return contains(this.div, node); - }, + findPosH: function(from, amount, unit, visually) { + var this$1 = this; - focus: function() { - if (this.cm.options.readOnly != "nocursor") this.div.focus(); + var dir = 1 + if (amount < 0) { dir = -1; amount = -amount } + var cur = clipPos(this.doc, from) + for (var i = 0; i < amount; ++i) { + cur = findPosH(this$1.doc, cur, dir, unit, visually) + if (cur.hitSide) { break } + } + return cur }, - blur: function() { this.div.blur(); }, - getField: function() { return this.div; }, - - supportsTouch: function() { return true; }, - receivedFocus: function() { - var input = this; - if (this.selectionInEditor()) - this.pollSelection(); - else - runInOp(this.cm, function() { input.cm.curOp.selectionChanged = true; }); + moveH: methodOp(function(dir, unit) { + var this$1 = this; - function poll() { - if (input.cm.state.focused) { - input.pollSelection(); - input.polling.set(input.cm.options.pollInterval, poll); - } - } - this.polling.set(this.cm.options.pollInterval, poll); - }, + this.extendSelectionsBy(function (range) { + if (this$1.display.shift || this$1.doc.extend || range.empty()) + { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) } + else + { return dir < 0 ? range.from() : range.to() } + }, sel_move) + }), - selectionChanged: function() { - var sel = window.getSelection(); - return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset || - sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset; - }, + deleteH: methodOp(function(dir, unit) { + var sel = this.doc.sel, doc = this.doc + if (sel.somethingSelected()) + { doc.replaceSelection("", null, "+delete") } + else + { deleteNearSelection(this, function (range) { + var other = findPosH(doc, range.head, dir, unit, false) + return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other} + }) } + }), - pollSelection: function() { - if (!this.composing && !this.gracePeriod && this.selectionChanged()) { - var sel = window.getSelection(), cm = this.cm; - this.rememberSelection(); - var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset); - var head = domToPos(cm, sel.focusNode, sel.focusOffset); - if (anchor && head) runInOp(cm, function() { - setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll); - if (anchor.bad || head.bad) cm.curOp.selectionChanged = true; - }); - } + findPosV: function(from, amount, unit, goalColumn) { + var this$1 = this; + + var dir = 1, x = goalColumn + if (amount < 0) { dir = -1; amount = -amount } + var cur = clipPos(this.doc, from) + for (var i = 0; i < amount; ++i) { + var coords = cursorCoords(this$1, cur, "div") + if (x == null) { x = coords.left } + else { coords.left = x } + cur = findPosV(this$1, coords, dir, unit) + if (cur.hitSide) { break } + } + return cur }, - pollContent: function() { - var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary(); - var from = sel.from(), to = sel.to(); - if (from.line < display.viewFrom || to.line > display.viewTo - 1) return false; - - var fromIndex; - if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) { - var fromLine = lineNo(display.view[0].line); - var fromNode = display.view[0].node; - } else { - var fromLine = lineNo(display.view[fromIndex].line); - var fromNode = display.view[fromIndex - 1].node.nextSibling; - } - var toIndex = findViewIndex(cm, to.line); - if (toIndex == display.view.length - 1) { - var toLine = display.viewTo - 1; - var toNode = display.lineDiv.lastChild; - } else { - var toLine = lineNo(display.view[toIndex + 1].line) - 1; - var toNode = display.view[toIndex + 1].node.previousSibling; - } + moveV: methodOp(function(dir, unit) { + var this$1 = this; - var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine)); - var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length)); - while (newText.length > 1 && oldText.length > 1) { - if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; } - else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; } - else break; - } + var doc = this.doc, goals = [] + var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected() + doc.extendSelectionsBy(function (range) { + if (collapse) + { return dir < 0 ? range.from() : range.to() } + var headPos = cursorCoords(this$1, range.head, "div") + if (range.goalColumn != null) { headPos.left = range.goalColumn } + goals.push(headPos.left) + var pos = findPosV(this$1, headPos, dir, unit) + if (unit == "page" && range == doc.sel.primary()) + { addToScrollPos(this$1, null, charCoords(this$1, pos, "div").top - headPos.top) } + return pos + }, sel_move) + if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++) + { doc.sel.ranges[i].goalColumn = goals[i] } } + }), - var cutFront = 0, cutEnd = 0; - var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length); - while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront)) - ++cutFront; - var newBot = lst(newText), oldBot = lst(oldText); - var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0), - oldBot.length - (oldText.length == 1 ? cutFront : 0)); - while (cutEnd < maxCutEnd && - newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) - ++cutEnd; - - newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd); - newText[0] = newText[0].slice(cutFront); - - var chFrom = Pos(fromLine, cutFront); - var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0); - if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) { - replaceRange(cm.doc, newText, chFrom, chTo, "+input"); - return true; + // Find the word at the given position (as returned by coordsChar). + findWordAt: function(pos) { + var doc = this.doc, line = getLine(doc, pos.line).text + var start = pos.ch, end = pos.ch + if (line) { + var helper = this.getHelper(pos, "wordChars") + if ((pos.xRel < 0 || end == line.length) && start) { --start; } else { ++end } + var startChar = line.charAt(start) + var check = isWordChar(startChar, helper) + ? function (ch) { return isWordChar(ch, helper); } + : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); } + : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); } + while (start > 0 && check(line.charAt(start - 1))) { --start } + while (end < line.length && check(line.charAt(end))) { ++end } } + return new Range(Pos(pos.line, start), Pos(pos.line, end)) }, - ensurePolled: function() { - this.forceCompositionEnd(); - }, - reset: function() { - this.forceCompositionEnd(); - }, - forceCompositionEnd: function() { - if (!this.composing || this.composing.handled) return; - this.applyComposition(this.composing); - this.composing.handled = true; - this.div.blur(); - this.div.focus(); - }, - applyComposition: function(composing) { - if (this.cm.isReadOnly()) - operation(this.cm, regChange)(this.cm) - else if (composing.data && composing.data != composing.startData) - operation(this.cm, applyTextInput)(this.cm, composing.data, 0, composing.sel); - }, - - setUneditable: function(node) { - node.contentEditable = "false" - }, + toggleOverwrite: function(value) { + if (value != null && value == this.state.overwrite) { return } + if (this.state.overwrite = !this.state.overwrite) + { addClass(this.display.cursorDiv, "CodeMirror-overwrite") } + else + { rmClass(this.display.cursorDiv, "CodeMirror-overwrite") } - onKeyPress: function(e) { - e.preventDefault(); - if (!this.cm.isReadOnly()) - operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); + signal(this, "overwriteToggle", this, this.state.overwrite) }, + hasFocus: function() { return this.display.input.getField() == activeElt() }, + isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) }, - readOnlyChanged: function(val) { - this.div.contentEditable = String(val != "nocursor") + scrollTo: methodOp(function(x, y) { + if (x != null || y != null) { resolveScrollToPos(this) } + if (x != null) { this.curOp.scrollLeft = x } + if (y != null) { this.curOp.scrollTop = y } + }), + getScrollInfo: function() { + var scroller = this.display.scroller + return {left: scroller.scrollLeft, top: scroller.scrollTop, + height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight, + width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth, + clientHeight: displayHeight(this), clientWidth: displayWidth(this)} }, - onContextMenu: nothing, - resetPosition: nothing, - - needsContentAttribute: true - }, ContentEditableInput.prototype); - - function posToDOM(cm, pos) { - var view = findViewForLine(cm, pos.line); - if (!view || view.hidden) return null; - var line = getLine(cm.doc, pos.line); - var info = mapFromLineView(view, line, pos.line); - - var order = getOrder(line), side = "left"; - if (order) { - var partPos = getBidiPartAt(order, pos.ch); - side = partPos % 2 ? "right" : "left"; - } - var result = nodeAndOffsetInLineMap(info.map, pos.ch, side); - result.offset = result.collapse == "right" ? result.end : result.start; - return result; - } - - function badPos(pos, bad) { if (bad) pos.bad = true; return pos; } - - function domToPos(cm, node, offset) { - var lineNode; - if (node == cm.display.lineDiv) { - lineNode = cm.display.lineDiv.childNodes[offset]; - if (!lineNode) return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true); - node = null; offset = 0; - } else { - for (lineNode = node;; lineNode = lineNode.parentNode) { - if (!lineNode || lineNode == cm.display.lineDiv) return null; - if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) break; - } - } - for (var i = 0; i < cm.display.view.length; i++) { - var lineView = cm.display.view[i]; - if (lineView.node == lineNode) - return locateNodeInLineView(lineView, node, offset); - } - } - - function locateNodeInLineView(lineView, node, offset) { - var wrapper = lineView.text.firstChild, bad = false; - if (!node || !contains(wrapper, node)) return badPos(Pos(lineNo(lineView.line), 0), true); - if (node == wrapper) { - bad = true; - node = wrapper.childNodes[offset]; - offset = 0; - if (!node) { - var line = lineView.rest ? lst(lineView.rest) : lineView.line; - return badPos(Pos(lineNo(line), line.text.length), bad); + scrollIntoView: methodOp(function(range, margin) { + if (range == null) { + range = {from: this.doc.sel.primary().head, to: null} + if (margin == null) { margin = this.options.cursorScrollMargin } + } else if (typeof range == "number") { + range = {from: Pos(range, 0), to: null} + } else if (range.from == null) { + range = {from: range, to: null} } - } + if (!range.to) { range.to = range.from } + range.margin = margin || 0 - var textNode = node.nodeType == 3 ? node : null, topNode = node; - if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) { - textNode = node.firstChild; - if (offset) offset = textNode.nodeValue.length; - } - while (topNode.parentNode != wrapper) topNode = topNode.parentNode; - var measure = lineView.measure, maps = measure.maps; - - function find(textNode, topNode, offset) { - for (var i = -1; i < (maps ? maps.length : 0); i++) { - var map = i < 0 ? measure.map : maps[i]; - for (var j = 0; j < map.length; j += 3) { - var curNode = map[j + 2]; - if (curNode == textNode || curNode == topNode) { - var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]); - var ch = map[j] + offset; - if (offset < 0 || curNode != textNode) ch = map[j + (offset ? 1 : 0)]; - return Pos(line, ch); - } - } + if (range.from.line != null) { + resolveScrollToPos(this) + this.curOp.scrollToPos = range + } else { + var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left), + Math.min(range.from.top, range.to.top) - range.margin, + Math.max(range.from.right, range.to.right), + Math.max(range.from.bottom, range.to.bottom) + range.margin) + this.scrollTo(sPos.scrollLeft, sPos.scrollTop) } - } - var found = find(textNode, topNode, offset); - if (found) return badPos(found, bad); + }), - // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems - for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) { - found = find(after, after.firstChild, 0); - if (found) - return badPos(Pos(found.line, found.ch - dist), bad); - else - dist += after.textContent.length; - } - for (var before = topNode.previousSibling, dist = offset; before; before = before.previousSibling) { - found = find(before, before.firstChild, -1); - if (found) - return badPos(Pos(found.line, found.ch + dist), bad); - else - dist += before.textContent.length; - } - } + setSize: methodOp(function(width, height) { + var this$1 = this; + + var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; } + if (width != null) { this.display.wrapper.style.width = interpret(width) } + if (height != null) { this.display.wrapper.style.height = interpret(height) } + if (this.options.lineWrapping) { clearLineMeasurementCache(this) } + var lineNo = this.display.viewFrom + this.doc.iter(lineNo, this.display.viewTo, function (line) { + if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) + { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, "widget"); break } } } + ++lineNo + }) + this.curOp.forceUpdate = true + signal(this, "refresh", this) + }), - function domTextBetween(cm, from, to, fromLine, toLine) { - var text = "", closing = false, lineSep = cm.doc.lineSeparator(); - function recognizeMarker(id) { return function(marker) { return marker.id == id; }; } - function walk(node) { - if (node.nodeType == 1) { - var cmText = node.getAttribute("cm-text"); - if (cmText != null) { - if (cmText == "") cmText = node.textContent.replace(/\u200b/g, ""); - text += cmText; - return; - } - var markerID = node.getAttribute("cm-marker"), range; - if (markerID) { - var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID)); - if (found.length && (range = found[0].find())) - text += getBetween(cm.doc, range.from, range.to).join(lineSep); - return; - } - if (node.getAttribute("contenteditable") == "false") return; - for (var i = 0; i < node.childNodes.length; i++) - walk(node.childNodes[i]); - if (/^(pre|div|p)$/i.test(node.nodeName)) - closing = true; - } else if (node.nodeType == 3) { - var val = node.nodeValue; - if (!val) return; - if (closing) { - text += lineSep; - closing = false; - } - text += val; - } - } - for (;;) { - walk(from); - if (from == to) break; - from = from.nextSibling; - } - return text; - } + operation: function(f){return runInOp(this, f)}, - CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput}; + refresh: methodOp(function() { + var oldHeight = this.display.cachedTextHeight + regChange(this) + this.curOp.forceUpdate = true + clearCaches(this) + this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop) + updateGutterSpace(this) + if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5) + { estimateLineHeights(this) } + signal(this, "refresh", this) + }), - // SELECTION / CURSOR + swapDoc: methodOp(function(doc) { + var old = this.doc + old.cm = null + attachDoc(this, doc) + clearCaches(this) + this.display.input.reset() + this.scrollTo(doc.scrollLeft, doc.scrollTop) + this.curOp.forceScroll = true + signalLater(this, "swapDoc", this, old) + return old + }), - // Selection objects are immutable. A new one is created every time - // the selection changes. A selection is one or more non-overlapping - // (and non-touching) ranges, sorted, and an integer that indicates - // which one is the primary selection (the one that's scrolled into - // view, that getCursor returns, etc). - function Selection(ranges, primIndex) { - this.ranges = ranges; - this.primIndex = primIndex; + getInputField: function(){return this.display.input.getField()}, + getWrapperElement: function(){return this.display.wrapper}, + getScrollerElement: function(){return this.display.scroller}, + getGutterElement: function(){return this.display.gutters} } + eventMixin(CodeMirror) - Selection.prototype = { - primary: function() { return this.ranges[this.primIndex]; }, - equals: function(other) { - if (other == this) return true; - if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) return false; - for (var i = 0; i < this.ranges.length; i++) { - var here = this.ranges[i], there = other.ranges[i]; - if (cmp(here.anchor, there.anchor) != 0 || cmp(here.head, there.head) != 0) return false; - } - return true; - }, - deepCopy: function() { - for (var out = [], i = 0; i < this.ranges.length; i++) - out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); - return new Selection(out, this.primIndex); - }, - somethingSelected: function() { - for (var i = 0; i < this.ranges.length; i++) - if (!this.ranges[i].empty()) return true; - return false; - }, - contains: function(pos, end) { - if (!end) end = pos; - for (var i = 0; i < this.ranges.length; i++) { - var range = this.ranges[i]; - if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0) - return i; - } - return -1; - } - }; - - function Range(anchor, head) { - this.anchor = anchor; this.head = head; + CodeMirror.registerHelper = function(type, name, value) { + if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []} } + helpers[type][name] = value } - - Range.prototype = { - from: function() { return minPos(this.anchor, this.head); }, - to: function() { return maxPos(this.anchor, this.head); }, - empty: function() { - return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch; - } - }; - - // Take an unsorted, potentially overlapping set of ranges, and - // build a selection out of it. 'Consumes' ranges array (modifying - // it). - function normalizeSelection(ranges, primIndex) { - var prim = ranges[primIndex]; - ranges.sort(function(a, b) { return cmp(a.from(), b.from()); }); - primIndex = indexOf(ranges, prim); - for (var i = 1; i < ranges.length; i++) { - var cur = ranges[i], prev = ranges[i - 1]; - if (cmp(prev.to(), cur.from()) >= 0) { - var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to()); - var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head; - if (i <= primIndex) --primIndex; - ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to)); + CodeMirror.registerGlobalHelper = function(type, name, predicate, value) { + CodeMirror.registerHelper(type, name, value) + helpers[type]._global.push({pred: predicate, val: value}) + } +} + +// Used for horizontal relative motion. Dir is -1 or 1 (left or +// right), unit can be "char", "column" (like char, but doesn't +// cross line boundaries), "word" (across next word), or "group" (to +// the start of next group of word or non-word-non-whitespace +// chars). The visually param controls whether, in right-to-left +// text, direction 1 means to move towards the next index in the +// string, or towards the character to the right of the current +// position. The resulting position will have a hitSide=true +// property if it reached the end of the document. +function findPosH(doc, pos, dir, unit, visually) { + var line = pos.line, ch = pos.ch, origDir = dir + var lineObj = getLine(doc, line) + function findNextLine() { + var l = line + dir + if (l < doc.first || l >= doc.first + doc.size) { return false } + line = l + return lineObj = getLine(doc, l) + } + function moveOnce(boundToLine) { + var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true) + if (next == null) { + if (!boundToLine && findNextLine()) { + if (visually) { ch = (dir < 0 ? lineRight : lineLeft)(lineObj) } + else { ch = dir < 0 ? lineObj.text.length : 0 } + } else { return false } + } else { ch = next } + return true + } + + if (unit == "char") { + moveOnce() + } else if (unit == "column") { + moveOnce(true) + } else if (unit == "word" || unit == "group") { + var sawType = null, group = unit == "group" + var helper = doc.cm && doc.cm.getHelper(pos, "wordChars") + for (var first = true;; first = false) { + if (dir < 0 && !moveOnce(!first)) { break } + var cur = lineObj.text.charAt(ch) || "\n" + var type = isWordChar(cur, helper) ? "w" + : group && cur == "\n" ? "n" + : !group || /\s/.test(cur) ? null + : "p" + if (group && !first && !type) { type = "s" } + if (sawType && sawType != type) { + if (dir < 0) {dir = 1; moveOnce()} + break + } + + if (type) { sawType = type } + if (dir > 0 && !moveOnce(!first)) { break } + } + } + var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true) + if (!cmp(pos, result)) { result.hitSide = true } + return result +} + +// For relative vertical movement. Dir may be -1 or 1. Unit can be +// "page" or "line". The resulting position will have a hitSide=true +// property if it reached the end of the document. +function findPosV(cm, pos, dir, unit) { + var doc = cm.doc, x = pos.left, y + if (unit == "page") { + var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight) + var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3) + y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount + + } else if (unit == "line") { + y = dir > 0 ? pos.bottom + 3 : pos.top - 3 + } + var target + for (;;) { + target = coordsChar(cm, x, y) + if (!target.outside) { break } + if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break } + y += dir * 5 + } + return target +} + +// CONTENTEDITABLE INPUT STYLE + +function ContentEditableInput(cm) { + this.cm = cm + this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null + this.polling = new Delayed() + this.gracePeriod = false +} + +ContentEditableInput.prototype = copyObj({ + init: function(display) { + var input = this, cm = input.cm + var div = input.div = display.lineDiv + disableBrowserMagic(div, cm.options.spellcheck) + + on(div, "paste", function (e) { + if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return } + // IE doesn't fire input events, so we schedule a read for the pasted content in this way + if (ie_version <= 11) { setTimeout(operation(cm, function () { + if (!input.pollContent()) { regChange(cm) } + }), 20) } + }) + + on(div, "compositionstart", function (e) { + var data = e.data + input.composing = {sel: cm.doc.sel, data: data, startData: data} + if (!data) { return } + var prim = cm.doc.sel.primary() + var line = cm.getLine(prim.head.line) + var found = line.indexOf(data, Math.max(0, prim.head.ch - data.length)) + if (found > -1 && found <= prim.head.ch) + { input.composing.sel = simpleSelection(Pos(prim.head.line, found), + Pos(prim.head.line, found + data.length)) } + }) + on(div, "compositionupdate", function (e) { return input.composing.data = e.data; }) + on(div, "compositionend", function (e) { + var ours = input.composing + if (!ours) { return } + if (e.data != ours.startData && !/\u200b/.test(e.data)) + { ours.data = e.data } + // Need a small delay to prevent other code (input event, + // selection polling) from doing damage when fired right after + // compositionend. + setTimeout(function () { + if (!ours.handled) + { input.applyComposition(ours) } + if (input.composing == ours) + { input.composing = null } + }, 50) + }) + + on(div, "touchstart", function () { return input.forceCompositionEnd(); }) + + on(div, "input", function () { + if (input.composing) { return } + if (cm.isReadOnly() || !input.pollContent()) + { runInOp(input.cm, function () { return regChange(cm); }) } + }) + + function onCopyCut(e) { + if (signalDOMEvent(cm, e)) { return } + if (cm.somethingSelected()) { + setLastCopied({lineWise: false, text: cm.getSelections()}) + if (e.type == "cut") { cm.replaceSelection("", null, "cut") } + } else if (!cm.options.lineWiseCopyCut) { + return + } else { + var ranges = copyableRanges(cm) + setLastCopied({lineWise: true, text: ranges.text}) + if (e.type == "cut") { + cm.operation(function () { + cm.setSelections(ranges.ranges, 0, sel_dontScroll) + cm.replaceSelection("", null, "cut") + }) + } } - } - return new Selection(ranges, primIndex); - } - - function simpleSelection(anchor, head) { - return new Selection([new Range(anchor, head || anchor)], 0); - } - - // Most of the external API clips given positions to make sure they - // actually exist within the document. - function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));} - function clipPos(doc, pos) { - if (pos.line < doc.first) return Pos(doc.first, 0); - var last = doc.first + doc.size - 1; - if (pos.line > last) return Pos(last, getLine(doc, last).text.length); - return clipToLen(pos, getLine(doc, pos.line).text.length); - } - function clipToLen(pos, linelen) { - var ch = pos.ch; - if (ch == null || ch > linelen) return Pos(pos.line, linelen); - else if (ch < 0) return Pos(pos.line, 0); - else return pos; - } - function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;} - function clipPosArray(doc, array) { - for (var out = [], i = 0; i < array.length; i++) out[i] = clipPos(doc, array[i]); - return out; - } - - // SELECTION UPDATES - - // The 'scroll' parameter given to many of these indicated whether - // the new cursor position should be scrolled into view after - // modifying the selection. - - // If shift is held or the extend flag is set, extends a range to - // include a given position (and optionally a second position). - // Otherwise, simply returns the range between the given positions. - // Used for cursor motion and such. - function extendRange(doc, range, head, other) { - if (doc.cm && doc.cm.display.shift || doc.extend) { - var anchor = range.anchor; - if (other) { - var posBefore = cmp(head, anchor) < 0; - if (posBefore != (cmp(other, anchor) < 0)) { - anchor = head; - head = other; - } else if (posBefore != (cmp(head, other) < 0)) { - head = other; + if (e.clipboardData) { + e.clipboardData.clearData() + var content = lastCopied.text.join("\n") + // iOS exposes the clipboard API, but seems to discard content inserted into it + e.clipboardData.setData("Text", content) + if (e.clipboardData.getData("Text") == content) { + e.preventDefault() + return } } - return new Range(anchor, head); + // Old-fashioned briefly-focus-a-textarea hack + var kludge = hiddenTextarea(), te = kludge.firstChild + cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild) + te.value = lastCopied.text.join("\n") + var hadFocus = document.activeElement + selectInput(te) + setTimeout(function () { + cm.display.lineSpace.removeChild(kludge) + hadFocus.focus() + if (hadFocus == div) { input.showPrimarySelection() } + }, 50) + } + on(div, "copy", onCopyCut) + on(div, "cut", onCopyCut) + }, + + prepareSelection: function() { + var result = prepareSelection(this.cm, false) + result.focus = this.cm.state.focused + return result + }, + + showSelection: function(info, takeFocus) { + if (!info || !this.cm.display.view.length) { return } + if (info.focus || takeFocus) { this.showPrimarySelection() } + this.showMultipleSelections(info) + }, + + showPrimarySelection: function() { + var sel = window.getSelection(), prim = this.cm.doc.sel.primary() + var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset) + var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset) + if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad && + cmp(minPos(curAnchor, curFocus), prim.from()) == 0 && + cmp(maxPos(curAnchor, curFocus), prim.to()) == 0) + { return } + + var start = posToDOM(this.cm, prim.from()) + var end = posToDOM(this.cm, prim.to()) + if (!start && !end) { return } + + var view = this.cm.display.view + var old = sel.rangeCount && sel.getRangeAt(0) + if (!start) { + start = {node: view[0].measure.map[2], offset: 0} + } else if (!end) { // FIXME dangerously hacky + var measure = view[view.length - 1].measure + var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map + end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]} + } + + var rng + try { rng = range(start.node, start.offset, end.offset, end.node) } + catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible + if (rng) { + if (!gecko && this.cm.state.focused) { + sel.collapse(start.node, start.offset) + if (!rng.collapsed) { + sel.removeAllRanges() + sel.addRange(rng) + } + } else { + sel.removeAllRanges() + sel.addRange(rng) + } + if (old && sel.anchorNode == null) { sel.addRange(old) } + else if (gecko) { this.startGracePeriod() } + } + this.rememberSelection() + }, + + startGracePeriod: function() { + var this$1 = this; + + clearTimeout(this.gracePeriod) + this.gracePeriod = setTimeout(function () { + this$1.gracePeriod = false + if (this$1.selectionChanged()) + { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }) } + }, 20) + }, + + showMultipleSelections: function(info) { + removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors) + removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection) + }, + + rememberSelection: function() { + var sel = window.getSelection() + this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset + this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset + }, + + selectionInEditor: function() { + var sel = window.getSelection() + if (!sel.rangeCount) { return false } + var node = sel.getRangeAt(0).commonAncestorContainer + return contains(this.div, node) + }, + + focus: function() { + if (this.cm.options.readOnly != "nocursor") { this.div.focus() } + }, + blur: function() { this.div.blur() }, + getField: function() { return this.div }, + + supportsTouch: function() { return true }, + + receivedFocus: function() { + var input = this + if (this.selectionInEditor()) + { this.pollSelection() } + else + { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }) } + + function poll() { + if (input.cm.state.focused) { + input.pollSelection() + input.polling.set(input.cm.options.pollInterval, poll) + } + } + this.polling.set(this.cm.options.pollInterval, poll) + }, + + selectionChanged: function() { + var sel = window.getSelection() + return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset || + sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset + }, + + pollSelection: function() { + if (!this.composing && !this.gracePeriod && this.selectionChanged()) { + var sel = window.getSelection(), cm = this.cm + this.rememberSelection() + var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset) + var head = domToPos(cm, sel.focusNode, sel.focusOffset) + if (anchor && head) { runInOp(cm, function () { + setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll) + if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true } + }) } + } + }, + + pollContent: function() { + var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary() + var from = sel.from(), to = sel.to() + if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false } + + var fromIndex, fromLine, fromNode + if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) { + fromLine = lineNo(display.view[0].line) + fromNode = display.view[0].node } else { - return new Range(other || head, head); - } - } - - // Extend the primary selection range, discard the rest. - function extendSelection(doc, head, other, options) { - setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options); - } - - // Extend all selections (pos is an array of selections with length - // equal the number of selections) - function extendSelections(doc, heads, options) { - for (var out = [], i = 0; i < doc.sel.ranges.length; i++) - out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null); - var newSel = normalizeSelection(out, doc.sel.primIndex); - setSelection(doc, newSel, options); - } - - // Updates a single range in the selection. - function replaceOneSelection(doc, i, range, options) { - var ranges = doc.sel.ranges.slice(0); - ranges[i] = range; - setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options); - } - - // Reset the selection to a single range. - function setSimpleSelection(doc, anchor, head, options) { - setSelection(doc, simpleSelection(anchor, head), options); - } - - // Give beforeSelectionChange handlers a change to influence a - // selection update. - function filterSelectionChange(doc, sel, options) { - var obj = { - ranges: sel.ranges, - update: function(ranges) { - this.ranges = []; - for (var i = 0; i < ranges.length; i++) - this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor), - clipPos(doc, ranges[i].head)); - }, - origin: options && options.origin - }; - signal(doc, "beforeSelectionChange", doc, obj); - if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj); - if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1); - else return sel; - } - - function setSelectionReplaceHistory(doc, sel, options) { - var done = doc.history.done, last = lst(done); - if (last && last.ranges) { - done[done.length - 1] = sel; - setSelectionNoUndo(doc, sel, options); + fromLine = lineNo(display.view[fromIndex].line) + fromNode = display.view[fromIndex - 1].node.nextSibling + } + var toIndex = findViewIndex(cm, to.line) + var toLine, toNode + if (toIndex == display.view.length - 1) { + toLine = display.viewTo - 1 + toNode = display.lineDiv.lastChild } else { - setSelection(doc, sel, options); - } - } - - // Set a new selection. - function setSelection(doc, sel, options) { - setSelectionNoUndo(doc, sel, options); - addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options); - } - - function setSelectionNoUndo(doc, sel, options) { - if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange")) - sel = filterSelectionChange(doc, sel, options); - - var bias = options && options.bias || - (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1); - setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true)); - - if (!(options && options.scroll === false) && doc.cm) - ensureCursorVisible(doc.cm); - } - - function setSelectionInner(doc, sel) { - if (sel.equals(doc.sel)) return; - - doc.sel = sel; - - if (doc.cm) { - doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true; - signalCursorActivity(doc.cm); - } - signalLater(doc, "cursorActivity", doc); - } - - // Verify that the selection does not partially select any atomic - // marked ranges. - function reCheckSelection(doc) { - setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll); - } - - // Return a selection that does not partially select any atomic - // ranges. - function skipAtomicInSelection(doc, sel, bias, mayClear) { - var out; - for (var i = 0; i < sel.ranges.length; i++) { - var range = sel.ranges[i]; - var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]; - var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear); - var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear); - if (out || newAnchor != range.anchor || newHead != range.head) { - if (!out) out = sel.ranges.slice(0, i); - out[i] = new Range(newAnchor, newHead); - } - } - return out ? normalizeSelection(out, sel.primIndex) : sel; - } - - function skipAtomicInner(doc, pos, oldPos, dir, mayClear) { - var line = getLine(doc, pos.line); - if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) { - var sp = line.markedSpans[i], m = sp.marker; - if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) && - (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) { - if (mayClear) { - signal(m, "beforeCursorEnter"); - if (m.explicitlyCleared) { - if (!line.markedSpans) break; - else {--i; continue;} - } - } - if (!m.atomic) continue; - - if (oldPos) { - var near = m.find(dir < 0 ? 1 : -1), diff; - if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft) - near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); - if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0)) - return skipAtomicInner(doc, near, pos, dir, mayClear); + toLine = lineNo(display.view[toIndex + 1].line) - 1 + toNode = display.view[toIndex + 1].node.previousSibling + } + + var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine)) + var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length)) + while (newText.length > 1 && oldText.length > 1) { + if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine-- } + else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++ } + else { break } + } + + var cutFront = 0, cutEnd = 0 + var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length) + while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront)) + { ++cutFront } + var newBot = lst(newText), oldBot = lst(oldText) + var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0), + oldBot.length - (oldText.length == 1 ? cutFront : 0)) + while (cutEnd < maxCutEnd && + newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) + { ++cutEnd } + + newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd) + newText[0] = newText[0].slice(cutFront) + + var chFrom = Pos(fromLine, cutFront) + var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0) + if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) { + replaceRange(cm.doc, newText, chFrom, chTo, "+input") + return true + } + }, + + ensurePolled: function() { + this.forceCompositionEnd() + }, + reset: function() { + this.forceCompositionEnd() + }, + forceCompositionEnd: function() { + if (!this.composing || this.composing.handled) { return } + this.applyComposition(this.composing) + this.composing.handled = true + this.div.blur() + this.div.focus() + }, + applyComposition: function(composing) { + if (this.cm.isReadOnly()) + { operation(this.cm, regChange)(this.cm) } + else if (composing.data && composing.data != composing.startData) + { operation(this.cm, applyTextInput)(this.cm, composing.data, 0, composing.sel) } + }, + + setUneditable: function(node) { + node.contentEditable = "false" + }, + + onKeyPress: function(e) { + e.preventDefault() + if (!this.cm.isReadOnly()) + { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0) } + }, + + readOnlyChanged: function(val) { + this.div.contentEditable = String(val != "nocursor") + }, + + onContextMenu: nothing, + resetPosition: nothing, + + needsContentAttribute: true + }, ContentEditableInput.prototype) + +function posToDOM(cm, pos) { + var view = findViewForLine(cm, pos.line) + if (!view || view.hidden) { return null } + var line = getLine(cm.doc, pos.line) + var info = mapFromLineView(view, line, pos.line) + + var order = getOrder(line), side = "left" + if (order) { + var partPos = getBidiPartAt(order, pos.ch) + side = partPos % 2 ? "right" : "left" + } + var result = nodeAndOffsetInLineMap(info.map, pos.ch, side) + result.offset = result.collapse == "right" ? result.end : result.start + return result +} + +function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos } + +function domTextBetween(cm, from, to, fromLine, toLine) { + var text = "", closing = false, lineSep = cm.doc.lineSeparator() + function recognizeMarker(id) { return function (marker) { return marker.id == id; } } + function walk(node) { + if (node.nodeType == 1) { + var cmText = node.getAttribute("cm-text") + if (cmText != null) { + if (cmText == "") { cmText = node.textContent.replace(/\u200b/g, "") } + text += cmText + return + } + var markerID = node.getAttribute("cm-marker"), range + if (markerID) { + var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID)) + if (found.length && (range = found[0].find())) + { text += getBetween(cm.doc, range.from, range.to).join(lineSep) } + return + } + if (node.getAttribute("contenteditable") == "false") { return } + for (var i = 0; i < node.childNodes.length; i++) + { walk(node.childNodes[i]) } + if (/^(pre|div|p)$/i.test(node.nodeName)) + { closing = true } + } else if (node.nodeType == 3) { + var val = node.nodeValue + if (!val) { return } + if (closing) { + text += lineSep + closing = false + } + text += val + } + } + for (;;) { + walk(from) + if (from == to) { break } + from = from.nextSibling + } + return text +} + +function domToPos(cm, node, offset) { + var lineNode + if (node == cm.display.lineDiv) { + lineNode = cm.display.lineDiv.childNodes[offset] + if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) } + node = null; offset = 0 + } else { + for (lineNode = node;; lineNode = lineNode.parentNode) { + if (!lineNode || lineNode == cm.display.lineDiv) { return null } + if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break } + } + } + for (var i = 0; i < cm.display.view.length; i++) { + var lineView = cm.display.view[i] + if (lineView.node == lineNode) + { return locateNodeInLineView(lineView, node, offset) } + } +} + +function locateNodeInLineView(lineView, node, offset) { + var wrapper = lineView.text.firstChild, bad = false + if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) } + if (node == wrapper) { + bad = true + node = wrapper.childNodes[offset] + offset = 0 + if (!node) { + var line = lineView.rest ? lst(lineView.rest) : lineView.line + return badPos(Pos(lineNo(line), line.text.length), bad) + } + } + + var textNode = node.nodeType == 3 ? node : null, topNode = node + if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) { + textNode = node.firstChild + if (offset) { offset = textNode.nodeValue.length } + } + while (topNode.parentNode != wrapper) { topNode = topNode.parentNode } + var measure = lineView.measure, maps = measure.maps + + function find(textNode, topNode, offset) { + for (var i = -1; i < (maps ? maps.length : 0); i++) { + var map = i < 0 ? measure.map : maps[i] + for (var j = 0; j < map.length; j += 3) { + var curNode = map[j + 2] + if (curNode == textNode || curNode == topNode) { + var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]) + var ch = map[j] + offset + if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)] } + return Pos(line, ch) } - - var far = m.find(dir < 0 ? -1 : 1); - if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight) - far = movePos(doc, far, dir, far.line == pos.line ? line : null); - return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null; } } - return pos; - } - - // Ensure a given position is not inside an atomic range. - function skipAtomic(doc, pos, oldPos, bias, mayClear) { - var dir = bias || 1; - var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) || - (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) || - skipAtomicInner(doc, pos, oldPos, -dir, mayClear) || - (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true)); - if (!found) { - doc.cantEdit = true; - return Pos(doc.first, 0); - } - return found; - } - - function movePos(doc, pos, dir, line) { - if (dir < 0 && pos.ch == 0) { - if (pos.line > doc.first) return clipPos(doc, Pos(pos.line - 1)); - else return null; - } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) { - if (pos.line < doc.first + doc.size - 1) return Pos(pos.line + 1, 0); - else return null; - } else { - return new Pos(pos.line, pos.ch + dir); - } - } - - // SELECTION DRAWING - - function updateSelection(cm) { - cm.display.input.showSelection(cm.display.input.prepareSelection()); - } - - function prepareSelection(cm, primary) { - var doc = cm.doc, result = {}; - var curFragment = result.cursors = document.createDocumentFragment(); - var selFragment = result.selection = document.createDocumentFragment(); - - for (var i = 0; i < doc.sel.ranges.length; i++) { - if (primary === false && i == doc.sel.primIndex) continue; - var range = doc.sel.ranges[i]; - if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) continue; - var collapsed = range.empty(); - if (collapsed || cm.options.showCursorWhenSelecting) - drawSelectionCursor(cm, range.head, curFragment); - if (!collapsed) - drawSelectionRange(cm, range, selFragment); - } - return result; } + var found = find(textNode, topNode, offset) + if (found) { return badPos(found, bad) } - // Draws a cursor for the given range - function drawSelectionCursor(cm, head, output) { - var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine); - - var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor")); - cursor.style.left = pos.left + "px"; - cursor.style.top = pos.top + "px"; - cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"; - - if (pos.other) { - // Secondary cursor, shown when on a 'jump' in bi-directional text - var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")); - otherCursor.style.display = ""; - otherCursor.style.left = pos.other.left + "px"; - otherCursor.style.top = pos.other.top + "px"; - otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px"; - } + // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems + for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) { + found = find(after, after.firstChild, 0) + if (found) + { return badPos(Pos(found.line, found.ch - dist), bad) } + else + { dist += after.textContent.length } } - - // Draws the given range as a highlighted selection - function drawSelectionRange(cm, range, output) { - var display = cm.display, doc = cm.doc; - var fragment = document.createDocumentFragment(); - var padding = paddingH(cm.display), leftSide = padding.left; - var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right; - - function add(left, top, width, bottom) { - if (top < 0) top = 0; - top = Math.round(top); - bottom = Math.round(bottom); - fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left + - "px; top: " + top + "px; width: " + (width == null ? rightSide - left : width) + - "px; height: " + (bottom - top) + "px")); - } - - function drawForLine(line, fromArg, toArg) { - var lineObj = getLine(doc, line); - var lineLen = lineObj.text.length; - var start, end; - function coords(ch, bias) { - return charCoords(cm, Pos(line, ch), "div", lineObj, bias); - } - - iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) { - var leftPos = coords(from, "left"), rightPos, left, right; - if (from == to) { - rightPos = leftPos; - left = right = leftPos.left; - } else { - rightPos = coords(to - 1, "right"); - if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; } - left = leftPos.left; - right = rightPos.right; - } - if (fromArg == null && from == 0) left = leftSide; - if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part - add(left, leftPos.top, null, leftPos.bottom); - left = leftSide; - if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top); + for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) { + found = find(before, before.firstChild, -1) + if (found) + { return badPos(Pos(found.line, found.ch + dist$1), bad) } + else + { dist$1 += before.textContent.length } + } +} + +// TEXTAREA INPUT STYLE + +function TextareaInput(cm) { + this.cm = cm + // See input.poll and input.reset + this.prevInput = "" + + // Flag that indicates whether we expect input to appear real soon + // now (after some event like 'keypress' or 'input') and are + // polling intensively. + this.pollingFast = false + // Self-resetting timeout for the poller + this.polling = new Delayed() + // Tracks when input.reset has punted to just putting a short + // string into the textarea instead of the full selection. + this.inaccurateSelection = false + // Used to work around IE issue with selection being forgotten when focus moves away from textarea + this.hasSelection = false + this.composing = null +} + +TextareaInput.prototype = copyObj({ + init: function(display) { + var this$1 = this; + + var input = this, cm = this.cm + + // Wraps and hides input textarea + var div = this.wrapper = hiddenTextarea() + // The semihidden textarea that is focused when the editor is + // focused, and receives input. + var te = this.textarea = div.firstChild + display.wrapper.insertBefore(div, display.wrapper.firstChild) + + // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore) + if (ios) { te.style.width = "0px" } + + on(te, "input", function () { + if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null } + input.poll() + }) + + on(te, "paste", function (e) { + if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return } + + cm.state.pasteIncoming = true + input.fastPoll() + }) + + function prepareCopyCut(e) { + if (signalDOMEvent(cm, e)) { return } + if (cm.somethingSelected()) { + setLastCopied({lineWise: false, text: cm.getSelections()}) + if (input.inaccurateSelection) { + input.prevInput = "" + input.inaccurateSelection = false + te.value = lastCopied.text.join("\n") + selectInput(te) } - if (toArg == null && to == lineLen) right = rightSide; - if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left) - start = leftPos; - if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right) - end = rightPos; - if (left < leftSide + 1) left = leftSide; - add(left, rightPos.top, right - left, rightPos.bottom); - }); - return {start: start, end: end}; - } - - var sFrom = range.from(), sTo = range.to(); - if (sFrom.line == sTo.line) { - drawForLine(sFrom.line, sFrom.ch, sTo.ch); - } else { - var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line); - var singleVLine = visualLine(fromLine) == visualLine(toLine); - var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end; - var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start; - if (singleVLine) { - if (leftEnd.top < rightStart.top - 2) { - add(leftEnd.right, leftEnd.top, null, leftEnd.bottom); - add(leftSide, rightStart.top, rightStart.left, rightStart.bottom); + } else if (!cm.options.lineWiseCopyCut) { + return + } else { + var ranges = copyableRanges(cm) + setLastCopied({lineWise: true, text: ranges.text}) + if (e.type == "cut") { + cm.setSelections(ranges.ranges, null, sel_dontScroll) } else { - add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom); + input.prevInput = "" + te.value = ranges.text.join("\n") + selectInput(te) } } - if (leftEnd.bottom < rightStart.top) - add(leftSide, leftEnd.bottom, null, rightStart.top); - } - - output.appendChild(fragment); - } - - // Cursor-blinking - function restartBlink(cm) { - if (!cm.state.focused) return; - var display = cm.display; - clearInterval(display.blinker); - var on = true; - display.cursorDiv.style.visibility = ""; - if (cm.options.cursorBlinkRate > 0) - display.blinker = setInterval(function() { - display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; - }, cm.options.cursorBlinkRate); - else if (cm.options.cursorBlinkRate < 0) - display.cursorDiv.style.visibility = "hidden"; - } - - // HIGHLIGHT WORKER - - function startWorker(cm, time) { - if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo) - cm.state.highlight.set(time, bind(highlightWorker, cm)); - } - - function highlightWorker(cm) { - var doc = cm.doc; - if (doc.frontier < doc.first) doc.frontier = doc.first; - if (doc.frontier >= cm.display.viewTo) return; - var end = +new Date + cm.options.workTime; - var state = copyState(doc.mode, getStateBefore(cm, doc.frontier)); - var changedLines = []; - - doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(line) { - if (doc.frontier >= cm.display.viewFrom) { // Visible - var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength; - var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true); - line.styles = highlighted.styles; - var oldCls = line.styleClasses, newCls = highlighted.classes; - if (newCls) line.styleClasses = newCls; - else if (oldCls) line.styleClasses = null; - var ischange = !oldStyles || oldStyles.length != line.styles.length || - oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass); - for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i]; - if (ischange) changedLines.push(doc.frontier); - line.stateAfter = tooLong ? state : copyState(doc.mode, state); - } else { - if (line.text.length <= cm.options.maxHighlightLength) - processLine(cm, line.text, state); - line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null; - } - ++doc.frontier; - if (+new Date > end) { - startWorker(cm, cm.options.workDelay); - return true; - } - }); - if (changedLines.length) runInOp(cm, function() { - for (var i = 0; i < changedLines.length; i++) - regLineChange(cm, changedLines[i], "text"); - }); - } - - // Finds the line to start with when starting a parse. Tries to - // find a line with a stateAfter, so that it can start with a - // valid state. If that fails, it returns the line with the - // smallest indentation, which tends to need the least context to - // parse correctly. - function findStartLine(cm, n, precise) { - var minindent, minline, doc = cm.doc; - var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100); - for (var search = n; search > lim; --search) { - if (search <= doc.first) return doc.first; - var line = getLine(doc, search - 1); - if (line.stateAfter && (!precise || search <= doc.frontier)) return search; - var indented = countColumn(line.text, null, cm.options.tabSize); - if (minline == null || minindent > indented) { - minline = search - 1; - minindent = indented; - } + if (e.type == "cut") { cm.state.cutIncoming = true } + } + on(te, "cut", prepareCopyCut) + on(te, "copy", prepareCopyCut) + + on(display.scroller, "paste", function (e) { + if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return } + cm.state.pasteIncoming = true + input.focus() + }) + + // Prevent normal selection in the editor (we handle our own) + on(display.lineSpace, "selectstart", function (e) { + if (!eventInWidget(display, e)) { e_preventDefault(e) } + }) + + on(te, "compositionstart", function () { + var start = cm.getCursor("from") + if (input.composing) { input.composing.range.clear() } + input.composing = { + start: start, + range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"}) + } + }) + on(te, "compositionend", function () { + if (input.composing) { + input.poll() + input.composing.range.clear() + input.composing = null + } + }) + }, + + prepareSelection: function() { + // Redraw the selection and/or cursor + var cm = this.cm, display = cm.display, doc = cm.doc + var result = prepareSelection(cm) + + // Move the hidden textarea near the cursor to prevent scrolling artifacts + if (cm.options.moveInputWithCursor) { + var headPos = cursorCoords(cm, doc.sel.primary().head, "div") + var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect() + result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10, + headPos.top + lineOff.top - wrapOff.top)) + result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10, + headPos.left + lineOff.left - wrapOff.left)) } - return minline; - } - - function getStateBefore(cm, n, precise) { - var doc = cm.doc, display = cm.display; - if (!doc.mode.startState) return true; - var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter; - if (!state) state = startState(doc.mode); - else state = copyState(doc.mode, state); - doc.iter(pos, n, function(line) { - processLine(cm, line.text, state); - var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo; - line.stateAfter = save ? copyState(doc.mode, state) : null; - ++pos; - }); - if (precise) doc.frontier = pos; - return state; - } - - // POSITION MEASUREMENT - - function paddingTop(display) {return display.lineSpace.offsetTop;} - function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;} - function paddingH(display) { - if (display.cachedPaddingH) return display.cachedPaddingH; - var e = removeChildrenAndAdd(display.measure, elt("pre", "x")); - var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle; - var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)}; - if (!isNaN(data.left) && !isNaN(data.right)) display.cachedPaddingH = data; - return data; - } - - function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth; } - function displayWidth(cm) { - return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth; - } - function displayHeight(cm) { - return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight; - } - - // Ensure the lineView.wrapping.heights array is populated. This is - // an array of bottom offsets for the lines that make up a drawn - // line. When lineWrapping is on, there might be more than one - // height. - function ensureLineHeights(cm, lineView, rect) { - var wrapping = cm.options.lineWrapping; - var curWidth = wrapping && displayWidth(cm); - if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) { - var heights = lineView.measure.heights = []; - if (wrapping) { - lineView.measure.width = curWidth; - var rects = lineView.text.firstChild.getClientRects(); - for (var i = 0; i < rects.length - 1; i++) { - var cur = rects[i], next = rects[i + 1]; - if (Math.abs(cur.bottom - next.bottom) > 2) - heights.push((cur.bottom + next.top) / 2 - rect.top); + + return result + }, + + showSelection: function(drawn) { + var cm = this.cm, display = cm.display + removeChildrenAndAdd(display.cursorDiv, drawn.cursors) + removeChildrenAndAdd(display.selectionDiv, drawn.selection) + if (drawn.teTop != null) { + this.wrapper.style.top = drawn.teTop + "px" + this.wrapper.style.left = drawn.teLeft + "px" + } + }, + + // Reset the input to correspond to the selection (or to be empty, + // when not typing and nothing is selected) + reset: function(typing) { + if (this.contextMenuPending) { return } + var minimal, selected, cm = this.cm, doc = cm.doc + if (cm.somethingSelected()) { + this.prevInput = "" + var range = doc.sel.primary() + minimal = hasCopyEvent && + (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000) + var content = minimal ? "-" : selected || cm.getSelection() + this.textarea.value = content + if (cm.state.focused) { selectInput(this.textarea) } + if (ie && ie_version >= 9) { this.hasSelection = content } + } else if (!typing) { + this.prevInput = this.textarea.value = "" + if (ie && ie_version >= 9) { this.hasSelection = null } + } + this.inaccurateSelection = minimal + }, + + getField: function() { return this.textarea }, + + supportsTouch: function() { return false }, + + focus: function() { + if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) { + try { this.textarea.focus() } + catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM + } + }, + + blur: function() { this.textarea.blur() }, + + resetPosition: function() { + this.wrapper.style.top = this.wrapper.style.left = 0 + }, + + receivedFocus: function() { this.slowPoll() }, + + // Poll for input changes, using the normal rate of polling. This + // runs as long as the editor is focused. + slowPoll: function() { + var this$1 = this; + + if (this.pollingFast) { return } + this.polling.set(this.cm.options.pollInterval, function () { + this$1.poll() + if (this$1.cm.state.focused) { this$1.slowPoll() } + }) + }, + + // When an event has just come in that is likely to add or change + // something in the input textarea, we poll faster, to ensure that + // the change appears on the screen quickly. + fastPoll: function() { + var missed = false, input = this + input.pollingFast = true + function p() { + var changed = input.poll() + if (!changed && !missed) {missed = true; input.polling.set(60, p)} + else {input.pollingFast = false; input.slowPoll()} + } + input.polling.set(20, p) + }, + + // Read input from the textarea, and update the document to match. + // When something is selected, it is present in the textarea, and + // selected (unless it is huge, in which case a placeholder is + // used). When nothing is selected, the cursor sits after previously + // seen text (can be empty), which is stored in prevInput (we must + // not reset the textarea when typing, because that breaks IME). + poll: function() { + var this$1 = this; + + var cm = this.cm, input = this.textarea, prevInput = this.prevInput + // Since this is called a *lot*, try to bail out as cheaply as + // possible when it is clear that nothing happened. hasSelection + // will be the case when there is a lot of text in the textarea, + // in which case reading its value would be expensive. + if (this.contextMenuPending || !cm.state.focused || + (hasSelection(input) && !prevInput && !this.composing) || + cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq) + { return false } + + var text = input.value + // If nothing changed, bail. + if (text == prevInput && !cm.somethingSelected()) { return false } + // Work around nonsensical selection resetting in IE9/10, and + // inexplicable appearance of private area unicode characters on + // some key combos in Mac (#2689). + if (ie && ie_version >= 9 && this.hasSelection === text || + mac && /[\uf700-\uf7ff]/.test(text)) { + cm.display.input.reset() + return false + } + + if (cm.doc.sel == cm.display.selForContextMenu) { + var first = text.charCodeAt(0) + if (first == 0x200b && !prevInput) { prevInput = "\u200b" } + if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") } + } + // Find the part of the input that is actually new + var same = 0, l = Math.min(prevInput.length, text.length) + while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same } + + runInOp(cm, function () { + applyTextInput(cm, text.slice(same), prevInput.length - same, + null, this$1.composing ? "*compose" : null) + + // Don't leave long text in the textarea, since it makes further polling slow + if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = "" } + else { this$1.prevInput = text } + + if (this$1.composing) { + this$1.composing.range.clear() + this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"), + {className: "CodeMirror-composing"}) + } + }) + return true + }, + + ensurePolled: function() { + if (this.pollingFast && this.poll()) { this.pollingFast = false } + }, + + onKeyPress: function() { + if (ie && ie_version >= 9) { this.hasSelection = null } + this.fastPoll() + }, + + onContextMenu: function(e) { + var input = this, cm = input.cm, display = cm.display, te = input.textarea + var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop + if (!pos || presto) { return } // Opera is difficult. + + // Reset the current text selection only if the click is done outside of the selection + // and 'resetSelectionOnContextMenu' option is true. + var reset = cm.options.resetSelectionOnContextMenu + if (reset && cm.doc.sel.contains(pos) == -1) + { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll) } + + var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText + input.wrapper.style.cssText = "position: absolute" + var wrapperBox = input.wrapper.getBoundingClientRect() + te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);" + var oldScrollY + if (webkit) { oldScrollY = window.scrollY } // Work around Chrome issue (#2712) + display.input.focus() + if (webkit) { window.scrollTo(null, oldScrollY) } + display.input.reset() + // Adds "Select all" to context menu in FF + if (!cm.somethingSelected()) { te.value = input.prevInput = " " } + input.contextMenuPending = true + display.selForContextMenu = cm.doc.sel + clearTimeout(display.detectingSelectAll) + + // Select-all will be greyed out if there's nothing to select, so + // this adds a zero-width space so that we can later check whether + // it got selected. + function prepareSelectAllHack() { + if (te.selectionStart != null) { + var selected = cm.somethingSelected() + var extval = "\u200b" + (selected ? te.value : "") + te.value = "\u21da" // Used to catch context-menu undo + te.value = extval + input.prevInput = selected ? "" : "\u200b" + te.selectionStart = 1; te.selectionEnd = extval.length + // Re-set this, in case some other handler touched the + // selection in the meantime. + display.selForContextMenu = cm.doc.sel + } + } + function rehide() { + input.contextMenuPending = false + input.wrapper.style.cssText = oldWrapperCSS + te.style.cssText = oldCSS + if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos) } + + // Try to detect the user choosing select-all + if (te.selectionStart != null) { + if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack() } + var i = 0, poll = function () { + if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 && + te.selectionEnd > 0 && input.prevInput == "\u200b") + { operation(cm, selectAll)(cm) } + else if (i++ < 10) { display.detectingSelectAll = setTimeout(poll, 500) } + else { display.input.reset() } } + display.detectingSelectAll = setTimeout(poll, 200) } - heights.push(rect.bottom - rect.top); - } - } - - // Find a line map (mapping character offsets to text nodes) and a - // measurement cache for the given line number. (A line view might - // contain multiple lines when collapsed ranges are present.) - function mapFromLineView(lineView, line, lineN) { - if (lineView.line == line) - return {map: lineView.measure.map, cache: lineView.measure.cache}; - for (var i = 0; i < lineView.rest.length; i++) - if (lineView.rest[i] == line) - return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]}; - for (var i = 0; i < lineView.rest.length; i++) - if (lineNo(lineView.rest[i]) > lineN) - return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true}; - } - - // Render a line into the hidden node display.externalMeasured. Used - // when measurement is needed for a line that's not in the viewport. - function updateExternalMeasurement(cm, line) { - line = visualLine(line); - var lineN = lineNo(line); - var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN); - view.lineN = lineN; - var built = view.built = buildLineContent(cm, view); - view.text = built.pre; - removeChildrenAndAdd(cm.display.lineMeasure, built.pre); - return view; - } - - // Get a {top, bottom, left, right} box (in line-local coordinates) - // for a given character. - function measureChar(cm, line, ch, bias) { - return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias); - } - - // Find a line view that corresponds to the given line number. - function findViewForLine(cm, lineN) { - if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) - return cm.display.view[findViewIndex(cm, lineN)]; - var ext = cm.display.externalMeasured; - if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) - return ext; - } - - // Measurement can be split in two steps, the set-up work that - // applies to the whole line, and the measurement of the actual - // character. Functions like coordsChar, that need to do a lot of - // measurements in a row, can thus ensure that the set-up work is - // only done once. - function prepareMeasureForLine(cm, line) { - var lineN = lineNo(line); - var view = findViewForLine(cm, lineN); - if (view && !view.text) { - view = null; - } else if (view && view.changes) { - updateLineForChanges(cm, view, lineN, getDimensions(cm)); - cm.curOp.forceUpdate = true; - } - if (!view) - view = updateExternalMeasurement(cm, line); - - var info = mapFromLineView(view, line, lineN); - return { - line: line, view: view, rect: null, - map: info.map, cache: info.cache, before: info.before, - hasHeights: false - }; - } - - // Given a prepared measurement object, measures the position of an - // actual character (or fetches it from the cache). - function measureCharPrepared(cm, prepared, ch, bias, varHeight) { - if (prepared.before) ch = -1; - var key = ch + (bias || ""), found; - if (prepared.cache.hasOwnProperty(key)) { - found = prepared.cache[key]; - } else { - if (!prepared.rect) - prepared.rect = prepared.view.text.getBoundingClientRect(); - if (!prepared.hasHeights) { - ensureLineHeights(cm, prepared.view, prepared.rect); - prepared.hasHeights = true; - } - found = measureCharInner(cm, prepared, ch, bias); - if (!found.bogus) prepared.cache[key] = found; - } - return {left: found.left, right: found.right, - top: varHeight ? found.rtop : found.top, - bottom: varHeight ? found.rbottom : found.bottom}; - } - - var nullRect = {left: 0, right: 0, top: 0, bottom: 0}; - - function nodeAndOffsetInLineMap(map, ch, bias) { - var node, start, end, collapse; - // First, search the line map for the text node corresponding to, - // or closest to, the target character. - for (var i = 0; i < map.length; i += 3) { - var mStart = map[i], mEnd = map[i + 1]; - if (ch < mStart) { - start = 0; end = 1; - collapse = "left"; - } else if (ch < mEnd) { - start = ch - mStart; - end = start + 1; - } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) { - end = mEnd - mStart; - start = end - 1; - if (ch >= mEnd) collapse = "right"; - } - if (start != null) { - node = map[i + 2]; - if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right")) - collapse = bias; - if (bias == "left" && start == 0) - while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) { - node = map[(i -= 3) + 2]; - collapse = "left"; - } - if (bias == "right" && start == mEnd - mStart) - while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) { - node = map[(i += 3) + 2]; - collapse = "right"; - } - break; - } - } - return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}; - } - - function getUsefulRect(rects, bias) { - var rect = nullRect - if (bias == "left") for (var i = 0; i < rects.length; i++) { - if ((rect = rects[i]).left != rect.right) break - } else for (var i = rects.length - 1; i >= 0; i--) { - if ((rect = rects[i]).left != rect.right) break } - return rect - } - - function measureCharInner(cm, prepared, ch, bias) { - var place = nodeAndOffsetInLineMap(prepared.map, ch, bias); - var node = place.node, start = place.start, end = place.end, collapse = place.collapse; - var rect; - if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates. - for (var i = 0; i < 4; i++) { // Retry a maximum of 4 times when nonsense rectangles are returned - while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) --start; - while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) ++end; - if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) - rect = node.parentNode.getBoundingClientRect(); - else - rect = getUsefulRect(range(node, start, end).getClientRects(), bias) - if (rect.left || rect.right || start == 0) break; - end = start; - start = start - 1; - collapse = "right"; - } - if (ie && ie_version < 11) rect = maybeUpdateRectForZooming(cm.display.measure, rect); - } else { // If it is a widget, simply get the box for the whole widget. - if (start > 0) collapse = bias = "right"; - var rects; - if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1) - rect = rects[bias == "right" ? rects.length - 1 : 0]; - else - rect = node.getBoundingClientRect(); - } - if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) { - var rSpan = node.parentNode.getClientRects()[0]; - if (rSpan) - rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; - else - rect = nullRect; - } - - var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top; - var mid = (rtop + rbot) / 2; - var heights = prepared.view.measure.heights; - for (var i = 0; i < heights.length - 1; i++) - if (mid < heights[i]) break; - var top = i ? heights[i - 1] : 0, bot = heights[i]; - var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left, - right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left, - top: top, bottom: bot}; - if (!rect.left && !rect.right) result.bogus = true; - if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; } - - return result; - } - - // Work around problem with bounding client rects on ranges being - // returned incorrectly when zoomed on IE10 and below. - function maybeUpdateRectForZooming(measure, rect) { - if (!window.screen || screen.logicalXDPI == null || - screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure)) - return rect; - var scaleX = screen.logicalXDPI / screen.deviceXDPI; - var scaleY = screen.logicalYDPI / screen.deviceYDPI; - return {left: rect.left * scaleX, right: rect.right * scaleX, - top: rect.top * scaleY, bottom: rect.bottom * scaleY}; - } - - function clearLineMeasurementCacheFor(lineView) { - if (lineView.measure) { - lineView.measure.cache = {}; - lineView.measure.heights = null; - if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++) - lineView.measure.caches[i] = {}; - } - } - - function clearLineMeasurementCache(cm) { - cm.display.externalMeasure = null; - removeChildren(cm.display.lineMeasure); - for (var i = 0; i < cm.display.view.length; i++) - clearLineMeasurementCacheFor(cm.display.view[i]); - } - - function clearCaches(cm) { - clearLineMeasurementCache(cm); - cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null; - if (!cm.options.lineWrapping) cm.display.maxLineChanged = true; - cm.display.lineNumChars = null; - } - - function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft; } - function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop; } - - // Converts a {top, bottom, left, right} box from line-local - // coordinates into another coordinate system. Context may be one of - // "line", "div" (display.lineDiv), "local"/null (editor), "window", - // or "page". - function intoCoordSystem(cm, lineObj, rect, context) { - if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) { - var size = widgetHeight(lineObj.widgets[i]); - rect.top += size; rect.bottom += size; - } - if (context == "line") return rect; - if (!context) context = "local"; - var yOff = heightAtLine(lineObj); - if (context == "local") yOff += paddingTop(cm.display); - else yOff -= cm.display.viewOffset; - if (context == "page" || context == "window") { - var lOff = cm.display.lineSpace.getBoundingClientRect(); - yOff += lOff.top + (context == "window" ? 0 : pageScrollY()); - var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()); - rect.left += xOff; rect.right += xOff; - } - rect.top += yOff; rect.bottom += yOff; - return rect; - } - - // Coverts a box from "div" coords to another coordinate system. - // Context may be "window", "page", "div", or "local"/null. - function fromCoordSystem(cm, coords, context) { - if (context == "div") return coords; - var left = coords.left, top = coords.top; - // First move into "page" coordinate system - if (context == "page") { - left -= pageScrollX(); - top -= pageScrollY(); - } else if (context == "local" || !context) { - var localBox = cm.display.sizer.getBoundingClientRect(); - left += localBox.left; - top += localBox.top; - } - - var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect(); - return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}; - } - - function charCoords(cm, pos, context, lineObj, bias) { - if (!lineObj) lineObj = getLine(cm.doc, pos.line); - return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context); - } - - // Returns a box for a given cursor position, which may have an - // 'other' property containing the position of the secondary cursor - // on a bidi boundary. - function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) { - lineObj = lineObj || getLine(cm.doc, pos.line); - if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj); - function get(ch, right) { - var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight); - if (right) m.left = m.right; else m.right = m.left; - return intoCoordSystem(cm, lineObj, m, context); - } - function getBidi(ch, partPos) { - var part = order[partPos], right = part.level % 2; - if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) { - part = order[--partPos]; - ch = bidiRight(part) - (part.level % 2 ? 0 : 1); - right = true; - } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) { - part = order[++partPos]; - ch = bidiLeft(part) - part.level % 2; - right = false; + if (ie && ie_version >= 9) { prepareSelectAllHack() } + if (captureRightClick) { + e_stop(e) + var mouseup = function () { + off(window, "mouseup", mouseup) + setTimeout(rehide, 20) } - if (right && ch == part.to && ch > part.from) return get(ch - 1); - return get(ch, right); - } - var order = getOrder(lineObj), ch = pos.ch; - if (!order) return get(ch); - var partPos = getBidiPartAt(order, ch); - var val = getBidi(ch, partPos); - if (bidiOther != null) val.other = getBidi(ch, bidiOther); - return val; - } - - // Used to cheaply estimate the coordinates for a position. Used for - // intermediate scroll updates. - function estimateCoords(cm, pos) { - var left = 0, pos = clipPos(cm.doc, pos); - if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch; - var lineObj = getLine(cm.doc, pos.line); - var top = heightAtLine(lineObj) + paddingTop(cm.display); - return {left: left, right: left, top: top, bottom: top + lineObj.height}; - } - - // Positions returned by coordsChar contain some extra information. - // xRel is the relative x position of the input coordinates compared - // to the found position (so xRel > 0 means the coordinates are to - // the right of the character position, for example). When outside - // is true, that means the coordinates lie outside the line's - // vertical range. - function PosWithInfo(line, ch, outside, xRel) { - var pos = Pos(line, ch); - pos.xRel = xRel; - if (outside) pos.outside = true; - return pos; - } - - // Compute the character position closest to the given coordinates. - // Input must be lineSpace-local ("div" coordinate system). - function coordsChar(cm, x, y) { - var doc = cm.doc; - y += cm.display.viewOffset; - if (y < 0) return PosWithInfo(doc.first, 0, true, -1); - var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1; - if (lineN > last) - return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1); - if (x < 0) x = 0; - - var lineObj = getLine(doc, lineN); - for (;;) { - var found = coordsCharInner(cm, lineObj, lineN, x, y); - var merged = collapsedSpanAtEnd(lineObj); - var mergedPos = merged && merged.find(0, true); - if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0)) - lineN = lineNo(lineObj = mergedPos.to.line); - else - return found; - } - } - - function coordsCharInner(cm, lineObj, lineNo, x, y) { - var innerOff = y - heightAtLine(lineObj); - var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth; - var preparedMeasure = prepareMeasureForLine(cm, lineObj); - - function getX(ch) { - var sp = cursorCoords(cm, Pos(lineNo, ch), "line", lineObj, preparedMeasure); - wrongLine = true; - if (innerOff > sp.bottom) return sp.left - adjust; - else if (innerOff < sp.top) return sp.left + adjust; - else wrongLine = false; - return sp.left; - } - - var bidi = getOrder(lineObj), dist = lineObj.text.length; - var from = lineLeft(lineObj), to = lineRight(lineObj); - var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine; - - if (x > toX) return PosWithInfo(lineNo, to, toOutside, 1); - // Do a binary search between these bounds. - for (;;) { - if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) { - var ch = x < fromX || x - fromX <= toX - x ? from : to; - var outside = ch == from ? fromOutside : toOutside - var xDiff = x - (ch == from ? fromX : toX); - // This is a kludge to handle the case where the coordinates - // are after a line-wrapped line. We should replace it with a - // more general handling of cursor positions around line - // breaks. (Issue #4078) - if (toOutside && !bidi && !/\s/.test(lineObj.text.charAt(ch)) && xDiff > 0 && - ch < lineObj.text.length && preparedMeasure.view.measure.heights.length > 1) { - var charSize = measureCharPrepared(cm, preparedMeasure, ch, "right"); - if (innerOff <= charSize.bottom && innerOff >= charSize.top && Math.abs(x - charSize.right) < xDiff) { - outside = false - ch++ - xDiff = x - charSize.right - } - } - while (isExtendingChar(lineObj.text.charAt(ch))) ++ch; - var pos = PosWithInfo(lineNo, ch, outside, xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0); - return pos; - } - var step = Math.ceil(dist / 2), middle = from + step; - if (bidi) { - middle = from; - for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1); - } - var middleX = getX(middle); - if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) toX += 1000; dist = step;} - else {from = middle; fromX = middleX; fromOutside = wrongLine; dist -= step;} - } - } - - var measureText; - // Compute the default text height. - function textHeight(display) { - if (display.cachedTextHeight != null) return display.cachedTextHeight; - if (measureText == null) { - measureText = elt("pre"); - // Measure a bunch of lines, for browsers that compute - // fractional heights. - for (var i = 0; i < 49; ++i) { - measureText.appendChild(document.createTextNode("x")); - measureText.appendChild(elt("br")); - } - measureText.appendChild(document.createTextNode("x")); - } - removeChildrenAndAdd(display.measure, measureText); - var height = measureText.offsetHeight / 50; - if (height > 3) display.cachedTextHeight = height; - removeChildren(display.measure); - return height || 1; - } - - // Compute the default character width. - function charWidth(display) { - if (display.cachedCharWidth != null) return display.cachedCharWidth; - var anchor = elt("span", "xxxxxxxxxx"); - var pre = elt("pre", [anchor]); - removeChildrenAndAdd(display.measure, pre); - var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10; - if (width > 2) display.cachedCharWidth = width; - return width || 10; - } - - // OPERATIONS - - // Operations are used to wrap a series of changes to the editor - // state in such a way that each change won't have to update the - // cursor and display (which would be awkward, slow, and - // error-prone). Instead, display updates are batched and then all - // combined and executed at once. - - var operationGroup = null; - - var nextOpId = 0; - // Start a new operation. - function startOperation(cm) { - cm.curOp = { - cm: cm, - viewChanged: false, // Flag that indicates that lines might need to be redrawn - startHeight: cm.doc.height, // Used to detect need to update scrollbar - forceUpdate: false, // Used to force a redraw - updateInput: null, // Whether to reset the input textarea - typing: false, // Whether this reset should be careful to leave existing text (for compositing) - changeObjs: null, // Accumulated changes, for firing change events - cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on - cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already - selectionChanged: false, // Whether the selection needs to be redrawn - updateMaxLine: false, // Set when the widest line needs to be determined anew - scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet - scrollToPos: null, // Used to scroll to a specific position - focus: false, - id: ++nextOpId // Unique ID - }; - if (operationGroup) { - operationGroup.ops.push(cm.curOp); - } else { - cm.curOp.ownsGroup = operationGroup = { - ops: [cm.curOp], - delayedCallbacks: [] - }; - } - } - - function fireCallbacksForOps(group) { - // Calls delayed callbacks and cursorActivity handlers until no - // new ones appear - var callbacks = group.delayedCallbacks, i = 0; - do { - for (; i < callbacks.length; i++) - callbacks[i].call(null); - for (var j = 0; j < group.ops.length; j++) { - var op = group.ops[j]; - if (op.cursorActivityHandlers) - while (op.cursorActivityCalled < op.cursorActivityHandlers.length) - op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); - } - } while (i < callbacks.length); - } - - // Finish an operation, updating the display and signalling delayed events - function endOperation(cm) { - var op = cm.curOp, group = op.ownsGroup; - if (!group) return; - - try { fireCallbacksForOps(group); } - finally { - operationGroup = null; - for (var i = 0; i < group.ops.length; i++) - group.ops[i].cm.curOp = null; - endOperations(group); - } - } - - // The DOM updates done when an operation finishes are batched so - // that the minimum number of relayouts are required. - function endOperations(group) { - var ops = group.ops; - for (var i = 0; i < ops.length; i++) // Read DOM - endOperation_R1(ops[i]); - for (var i = 0; i < ops.length; i++) // Write DOM (maybe) - endOperation_W1(ops[i]); - for (var i = 0; i < ops.length; i++) // Read DOM - endOperation_R2(ops[i]); - for (var i = 0; i < ops.length; i++) // Write DOM (maybe) - endOperation_W2(ops[i]); - for (var i = 0; i < ops.length; i++) // Read DOM - endOperation_finish(ops[i]); - } - - function endOperation_R1(op) { - var cm = op.cm, display = cm.display; - maybeClipScrollbars(cm); - if (op.updateMaxLine) findMaxLine(cm); - - op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null || - op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom || - op.scrollToPos.to.line >= display.viewTo) || - display.maxLineChanged && cm.options.lineWrapping; - op.update = op.mustUpdate && - new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate); - } - - function endOperation_W1(op) { - op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update); - } - - function endOperation_R2(op) { - var cm = op.cm, display = cm.display; - if (op.updatedDisplay) updateHeightsInViewport(cm); - - op.barMeasure = measureForScrollbars(cm); - - // If the max line changed since it was last measured, measure it, - // and ensure the document's width matches it. - // updateDisplay_W2 will use these properties to do the actual resizing - if (display.maxLineChanged && !cm.options.lineWrapping) { - op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3; - cm.display.sizerWidth = op.adjustWidthTo; - op.barMeasure.scrollWidth = - Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth); - op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm)); - } - - if (op.updatedDisplay || op.selectionChanged) - op.preparedSelection = display.input.prepareSelection(op.focus); - } - - function endOperation_W2(op) { - var cm = op.cm; - - if (op.adjustWidthTo != null) { - cm.display.sizer.style.minWidth = op.adjustWidthTo + "px"; - if (op.maxScrollLeft < cm.doc.scrollLeft) - setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); - cm.display.maxLineChanged = false; - } - - var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus()) - if (op.preparedSelection) - cm.display.input.showSelection(op.preparedSelection, takeFocus); - if (op.updatedDisplay || op.startHeight != cm.doc.height) - updateScrollbars(cm, op.barMeasure); - if (op.updatedDisplay) - setDocumentHeight(cm, op.barMeasure); - - if (op.selectionChanged) restartBlink(cm); - - if (cm.state.focused && op.updateInput) - cm.display.input.reset(op.typing); - if (takeFocus) ensureFocus(op.cm); - } - - function endOperation_finish(op) { - var cm = op.cm, display = cm.display, doc = cm.doc; - - if (op.updatedDisplay) postUpdateDisplay(cm, op.update); - - // Abort mouse wheel delta measurement, when scrolling explicitly - if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos)) - display.wheelStartX = display.wheelStartY = null; - - // Propagate the scroll position to the actual DOM scroller - if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) { - doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop)); - display.scrollbars.setScrollTop(doc.scrollTop); - display.scroller.scrollTop = doc.scrollTop; - } - if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) { - doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft)); - display.scrollbars.setScrollLeft(doc.scrollLeft); - display.scroller.scrollLeft = doc.scrollLeft; - alignHorizontally(cm); - } - // If we need to scroll a specific position into view, do so. - if (op.scrollToPos) { - var coords = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from), - clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin); - if (op.scrollToPos.isCursor && cm.state.focused) maybeScrollWindow(cm, coords); - } - - // Fire events for markers that are hidden/unidden by editing or - // undoing - var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers; - if (hidden) for (var i = 0; i < hidden.length; ++i) - if (!hidden[i].lines.length) signal(hidden[i], "hide"); - if (unhidden) for (var i = 0; i < unhidden.length; ++i) - if (unhidden[i].lines.length) signal(unhidden[i], "unhide"); - - if (display.wrapper.offsetHeight) - doc.scrollTop = cm.display.scroller.scrollTop; - - // Fire change events, and delayed event handlers - if (op.changeObjs) - signal(cm, "changes", cm, op.changeObjs); - if (op.update) - op.update.finish(); - } - - // Run the given function in an operation - function runInOp(cm, f) { - if (cm.curOp) return f(); - startOperation(cm); - try { return f(); } - finally { endOperation(cm); } - } - // Wraps a function in an operation. Returns the wrapped function. - function operation(cm, f) { - return function() { - if (cm.curOp) return f.apply(cm, arguments); - startOperation(cm); - try { return f.apply(cm, arguments); } - finally { endOperation(cm); } - }; - } - // Used to add methods to editor and doc instances, wrapping them in - // operations. - function methodOp(f) { - return function() { - if (this.curOp) return f.apply(this, arguments); - startOperation(this); - try { return f.apply(this, arguments); } - finally { endOperation(this); } - }; - } - function docMethodOp(f) { - return function() { - var cm = this.cm; - if (!cm || cm.curOp) return f.apply(this, arguments); - startOperation(cm); - try { return f.apply(this, arguments); } - finally { endOperation(cm); } - }; - } - - // VIEW TRACKING - - // These objects are used to represent the visible (currently drawn) - // part of the document. A LineView may correspond to multiple - // logical lines, if those are connected by collapsed ranges. - function LineView(doc, line, lineN) { - // The starting line - this.line = line; - // Continuing lines, if any - this.rest = visualLineContinued(line); - // Number of logical lines in this visual line - this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1; - this.node = this.text = null; - this.hidden = lineIsHidden(doc, line); - } - - // Create a range of LineView objects for the given lines. - function buildViewArray(cm, from, to) { - var array = [], nextPos; - for (var pos = from; pos < to; pos = nextPos) { - var view = new LineView(cm.doc, getLine(cm.doc, pos), pos); - nextPos = pos + view.size; - array.push(view); - } - return array; - } - - // Updates the display.view data structure for a given change to the - // document. From and to are in pre-change coordinates. Lendiff is - // the amount of lines added or subtracted by the change. This is - // used for changes that span multiple lines, or change the way - // lines are divided into visual lines. regLineChange (below) - // registers single-line changes. - function regChange(cm, from, to, lendiff) { - if (from == null) from = cm.doc.first; - if (to == null) to = cm.doc.first + cm.doc.size; - if (!lendiff) lendiff = 0; - - var display = cm.display; - if (lendiff && to < display.viewTo && - (display.updateLineNumbers == null || display.updateLineNumbers > from)) - display.updateLineNumbers = from; - - cm.curOp.viewChanged = true; - - if (from >= display.viewTo) { // Change after - if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo) - resetView(cm); - } else if (to <= display.viewFrom) { // Change before - if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) { - resetView(cm); - } else { - display.viewFrom += lendiff; - display.viewTo += lendiff; - } - } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap - resetView(cm); - } else if (from <= display.viewFrom) { // Top overlap - var cut = viewCuttingPoint(cm, to, to + lendiff, 1); - if (cut) { - display.view = display.view.slice(cut.index); - display.viewFrom = cut.lineN; - display.viewTo += lendiff; - } else { - resetView(cm); - } - } else if (to >= display.viewTo) { // Bottom overlap - var cut = viewCuttingPoint(cm, from, from, -1); - if (cut) { - display.view = display.view.slice(0, cut.index); - display.viewTo = cut.lineN; - } else { - resetView(cm); - } - } else { // Gap in the middle - var cutTop = viewCuttingPoint(cm, from, from, -1); - var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1); - if (cutTop && cutBot) { - display.view = display.view.slice(0, cutTop.index) - .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN)) - .concat(display.view.slice(cutBot.index)); - display.viewTo += lendiff; - } else { - resetView(cm); - } - } - - var ext = display.externalMeasured; - if (ext) { - if (to < ext.lineN) - ext.lineN += lendiff; - else if (from < ext.lineN + ext.size) - display.externalMeasured = null; - } - } - - // Register a change to a single line. Type must be one of "text", - // "gutter", "class", "widget" - function regLineChange(cm, line, type) { - cm.curOp.viewChanged = true; - var display = cm.display, ext = cm.display.externalMeasured; - if (ext && line >= ext.lineN && line < ext.lineN + ext.size) - display.externalMeasured = null; - - if (line < display.viewFrom || line >= display.viewTo) return; - var lineView = display.view[findViewIndex(cm, line)]; - if (lineView.node == null) return; - var arr = lineView.changes || (lineView.changes = []); - if (indexOf(arr, type) == -1) arr.push(type); - } - - // Clear the view. - function resetView(cm) { - cm.display.viewFrom = cm.display.viewTo = cm.doc.first; - cm.display.view = []; - cm.display.viewOffset = 0; - } - - // Find the view element corresponding to a given line. Return null - // when the line isn't visible. - function findViewIndex(cm, n) { - if (n >= cm.display.viewTo) return null; - n -= cm.display.viewFrom; - if (n < 0) return null; - var view = cm.display.view; - for (var i = 0; i < view.length; i++) { - n -= view[i].size; - if (n < 0) return i; - } - } - - function viewCuttingPoint(cm, oldN, newN, dir) { - var index = findViewIndex(cm, oldN), diff, view = cm.display.view; - if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size) - return {index: index, lineN: newN}; - for (var i = 0, n = cm.display.viewFrom; i < index; i++) - n += view[i].size; - if (n != oldN) { - if (dir > 0) { - if (index == view.length - 1) return null; - diff = (n + view[index].size) - oldN; - index++; - } else { - diff = n - oldN; - } - oldN += diff; newN += diff; - } - while (visualLineNo(cm.doc, newN) != newN) { - if (index == (dir < 0 ? 0 : view.length - 1)) return null; - newN += dir * view[index - (dir < 0 ? 1 : 0)].size; - index += dir; - } - return {index: index, lineN: newN}; - } - - // Force the view to cover a given range, adding empty view element - // or clipping off existing ones as needed. - function adjustView(cm, from, to) { - var display = cm.display, view = display.view; - if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) { - display.view = buildViewArray(cm, from, to); - display.viewFrom = from; - } else { - if (display.viewFrom > from) - display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); - else if (display.viewFrom < from) - display.view = display.view.slice(findViewIndex(cm, from)); - display.viewFrom = from; - if (display.viewTo < to) - display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); - else if (display.viewTo > to) - display.view = display.view.slice(0, findViewIndex(cm, to)); - } - display.viewTo = to; - } - - // Count the number of lines in the view whose DOM representation is - // out of date (or nonexistent). - function countDirtyView(cm) { - var view = cm.display.view, dirty = 0; - for (var i = 0; i < view.length; i++) { - var lineView = view[i]; - if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty; - } - return dirty; - } - - // EVENT HANDLERS - - // Attach the necessary event handlers when initializing the editor - function registerEventHandlers(cm) { - var d = cm.display; - on(d.scroller, "mousedown", operation(cm, onMouseDown)); - // Older IE's will not fire a second mousedown for a double click - if (ie && ie_version < 11) - on(d.scroller, "dblclick", operation(cm, function(e) { - if (signalDOMEvent(cm, e)) return; - var pos = posFromMouse(cm, e); - if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return; - e_preventDefault(e); - var word = cm.findWordAt(pos); - extendSelection(cm.doc, word.anchor, word.head); - })); - else - on(d.scroller, "dblclick", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); }); - // Some browsers fire contextmenu *after* opening the menu, at - // which point we can't mess with it anymore. Context menu is - // handled in onMouseDown for these browsers. - if (!captureRightClick) on(d.scroller, "contextmenu", function(e) {onContextMenu(cm, e);}); - - // Used to suppress mouse event handling when a touch happens - var touchFinished, prevTouch = {end: 0}; - function finishTouch() { - if (d.activeTouch) { - touchFinished = setTimeout(function() {d.activeTouch = null;}, 1000); - prevTouch = d.activeTouch; - prevTouch.end = +new Date; - } - }; - function isMouseLikeTouchEvent(e) { - if (e.touches.length != 1) return false; - var touch = e.touches[0]; - return touch.radiusX <= 1 && touch.radiusY <= 1; - } - function farAway(touch, other) { - if (other.left == null) return true; - var dx = other.left - touch.left, dy = other.top - touch.top; - return dx * dx + dy * dy > 20 * 20; - } - on(d.scroller, "touchstart", function(e) { - if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) { - clearTimeout(touchFinished); - var now = +new Date; - d.activeTouch = {start: now, moved: false, - prev: now - prevTouch.end <= 300 ? prevTouch : null}; - if (e.touches.length == 1) { - d.activeTouch.left = e.touches[0].pageX; - d.activeTouch.top = e.touches[0].pageY; - } - } - }); - on(d.scroller, "touchmove", function() { - if (d.activeTouch) d.activeTouch.moved = true; - }); - on(d.scroller, "touchend", function(e) { - var touch = d.activeTouch; - if (touch && !eventInWidget(d, e) && touch.left != null && - !touch.moved && new Date - touch.start < 300) { - var pos = cm.coordsChar(d.activeTouch, "page"), range; - if (!touch.prev || farAway(touch, touch.prev)) // Single tap - range = new Range(pos, pos); - else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap - range = cm.findWordAt(pos); - else // Triple tap - range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); - cm.setSelection(range.anchor, range.head); - cm.focus(); - e_preventDefault(e); - } - finishTouch(); - }); - on(d.scroller, "touchcancel", finishTouch); - - // Sync scrolling between fake scrollbars and real scrollable - // area, ensure viewport is updated when scrolling. - on(d.scroller, "scroll", function() { - if (d.scroller.clientHeight) { - setScrollTop(cm, d.scroller.scrollTop); - setScrollLeft(cm, d.scroller.scrollLeft, true); - signal(cm, "scroll", cm); - } - }); - - // Listen to wheel events in order to try and update the viewport on time. - on(d.scroller, "mousewheel", function(e){onScrollWheel(cm, e);}); - on(d.scroller, "DOMMouseScroll", function(e){onScrollWheel(cm, e);}); - - // Prevent wrapper from ever scrolling - on(d.wrapper, "scroll", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; }); - - d.dragFunctions = { - enter: function(e) {if (!signalDOMEvent(cm, e)) e_stop(e);}, - over: function(e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }}, - start: function(e){onDragStart(cm, e);}, - drop: operation(cm, onDrop), - leave: function(e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }} - }; - - var inp = d.input.getField(); - on(inp, "keyup", function(e) { onKeyUp.call(cm, e); }); - on(inp, "keydown", operation(cm, onKeyDown)); - on(inp, "keypress", operation(cm, onKeyPress)); - on(inp, "focus", function (e) { onFocus(cm, e); }); - on(inp, "blur", function (e) { onBlur(cm, e); }); - } - - function dragDropChanged(cm, value, old) { - var wasOn = old && old != CodeMirror.Init; - if (!value != !wasOn) { - var funcs = cm.display.dragFunctions; - var toggle = value ? on : off; - toggle(cm.display.scroller, "dragstart", funcs.start); - toggle(cm.display.scroller, "dragenter", funcs.enter); - toggle(cm.display.scroller, "dragover", funcs.over); - toggle(cm.display.scroller, "dragleave", funcs.leave); - toggle(cm.display.scroller, "drop", funcs.drop); - } - } - - // Called when the window resizes - function onResize(cm) { - var d = cm.display; - if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth) - return; - // Might be a text scaling operation, clear size caches. - d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null; - d.scrollbarsClipped = false; - cm.setSize(); - } - - // MOUSE EVENTS - - // Return true when the given mouse event happened in a widget - function eventInWidget(display, e) { - for (var n = e_target(e); n != display.wrapper; n = n.parentNode) { - if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") || - (n.parentNode == display.sizer && n != display.mover)) - return true; - } - } - - // Given a mouse event, find the corresponding position. If liberal - // is false, it checks whether a gutter or scrollbar was clicked, - // and returns null if it was. forRect is used by rectangular - // selections, and tries to estimate a character position even for - // coordinates beyond the right of the text. - function posFromMouse(cm, e, liberal, forRect) { - var display = cm.display; - if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") return null; - - var x, y, space = display.lineSpace.getBoundingClientRect(); - // Fails unpredictably on IE[67] when mouse is dragged around quickly. - try { x = e.clientX - space.left; y = e.clientY - space.top; } - catch (e) { return null; } - var coords = coordsChar(cm, x, y), line; - if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) { - var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length; - coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff)); - } - return coords; - } - - // A mouse down can be a single click, double click, triple click, - // start of selection drag, start of text drag, new cursor - // (ctrl-click), rectangle drag (alt-drag), or xwin - // middle-click-paste. Or it might be a click on something we should - // not interfere with, such as a scrollbar or widget. - function onMouseDown(e) { - var cm = this, display = cm.display; - if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return; - display.shift = e.shiftKey; - - if (eventInWidget(display, e)) { - if (!webkit) { - // Briefly turn off draggability, to allow widgets to do - // normal dragging things. - display.scroller.draggable = false; - setTimeout(function(){display.scroller.draggable = true;}, 100); - } - return; - } - if (clickInGutter(cm, e)) return; - var start = posFromMouse(cm, e); - window.focus(); - - switch (e_button(e)) { - case 1: - // #3261: make sure, that we're not starting a second selection - if (cm.state.selectingText) - cm.state.selectingText(e); - else if (start) - leftButtonDown(cm, e, start); - else if (e_target(e) == display.scroller) - e_preventDefault(e); - break; - case 2: - if (webkit) cm.state.lastMiddleDown = +new Date; - if (start) extendSelection(cm.doc, start); - setTimeout(function() {display.input.focus();}, 20); - e_preventDefault(e); - break; - case 3: - if (captureRightClick) onContextMenu(cm, e); - else delayBlurEvent(cm); - break; - } - } - - var lastClick, lastDoubleClick; - function leftButtonDown(cm, e, start) { - if (ie) setTimeout(bind(ensureFocus, cm), 0); - else cm.curOp.focus = activeElt(); - - var now = +new Date, type; - if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) { - type = "triple"; - } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) { - type = "double"; - lastDoubleClick = {time: now, pos: start}; - } else { - type = "single"; - lastClick = {time: now, pos: start}; - } - - var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained; - if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() && - type == "single" && (contained = sel.contains(start)) > -1 && - (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) && - (cmp(contained.to(), start) > 0 || start.xRel < 0)) - leftButtonStartDrag(cm, e, start, modifier); - else - leftButtonSelect(cm, e, start, type, modifier); - } - - // Start a text drag. When it ends, see if any dragging actually - // happen, and treat as a click if it didn't. - function leftButtonStartDrag(cm, e, start, modifier) { - var display = cm.display, startTime = +new Date; - var dragEnd = operation(cm, function(e2) { - if (webkit) display.scroller.draggable = false; - cm.state.draggingText = false; - off(document, "mouseup", dragEnd); - off(display.scroller, "drop", dragEnd); - if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) { - e_preventDefault(e2); - if (!modifier && +new Date - 200 < startTime) - extendSelection(cm.doc, start); - // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081) - if (webkit || ie && ie_version == 9) - setTimeout(function() {document.body.focus(); display.input.focus();}, 20); - else - display.input.focus(); - } - }); - // Let the drag handler handle this. - if (webkit) display.scroller.draggable = true; - cm.state.draggingText = dragEnd; - dragEnd.copy = mac ? e.altKey : e.ctrlKey - // IE's approach to draggable - if (display.scroller.dragDrop) display.scroller.dragDrop(); - on(document, "mouseup", dragEnd); - on(display.scroller, "drop", dragEnd); - } - - // Normal selection, as opposed to text dragging. - function leftButtonSelect(cm, e, start, type, addNew) { - var display = cm.display, doc = cm.doc; - e_preventDefault(e); - - var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges; - if (addNew && !e.shiftKey) { - ourIndex = doc.sel.contains(start); - if (ourIndex > -1) - ourRange = ranges[ourIndex]; - else - ourRange = new Range(start, start); - } else { - ourRange = doc.sel.primary(); - ourIndex = doc.sel.primIndex; - } - - if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) { - type = "rect"; - if (!addNew) ourRange = new Range(start, start); - start = posFromMouse(cm, e, true, true); - ourIndex = -1; - } else if (type == "double") { - var word = cm.findWordAt(start); - if (cm.display.shift || doc.extend) - ourRange = extendRange(doc, ourRange, word.anchor, word.head); - else - ourRange = word; - } else if (type == "triple") { - var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0))); - if (cm.display.shift || doc.extend) - ourRange = extendRange(doc, ourRange, line.anchor, line.head); - else - ourRange = line; + on(window, "mouseup", mouseup) } else { - ourRange = extendRange(doc, ourRange, start); - } - - if (!addNew) { - ourIndex = 0; - setSelection(doc, new Selection([ourRange], 0), sel_mouse); - startSel = doc.sel; - } else if (ourIndex == -1) { - ourIndex = ranges.length; - setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex), - {scroll: false, origin: "*mouse"}); - } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) { - setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0), - {scroll: false, origin: "*mouse"}); - startSel = doc.sel; - } else { - replaceOneSelection(doc, ourIndex, ourRange, sel_mouse); - } - - var lastPos = start; - function extendTo(pos) { - if (cmp(lastPos, pos) == 0) return; - lastPos = pos; - - if (type == "rect") { - var ranges = [], tabSize = cm.options.tabSize; - var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize); - var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize); - var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol); - for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); - line <= end; line++) { - var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize); - if (left == right) - ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); - else if (text.length > leftPos) - ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); - } - if (!ranges.length) ranges.push(new Range(start, start)); - setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), - {origin: "*mouse", scroll: false}); - cm.scrollIntoView(pos); - } else { - var oldRange = ourRange; - var anchor = oldRange.anchor, head = pos; - if (type != "single") { - if (type == "double") - var range = cm.findWordAt(pos); - else - var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))); - if (cmp(range.anchor, anchor) > 0) { - head = range.head; - anchor = minPos(oldRange.from(), range.anchor); - } else { - head = range.anchor; - anchor = maxPos(oldRange.to(), range.head); - } - } - var ranges = startSel.ranges.slice(0); - ranges[ourIndex] = new Range(clipPos(doc, anchor), head); - setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse); - } - } - - var editorSize = display.wrapper.getBoundingClientRect(); - // Used to ensure timeout re-tries don't fire when another extend - // happened in the meantime (clearTimeout isn't reliable -- at - // least on Chrome, the timeouts still happen even when cleared, - // if the clear happens after their scheduled firing time). - var counter = 0; - - function extend(e) { - var curCount = ++counter; - var cur = posFromMouse(cm, e, true, type == "rect"); - if (!cur) return; - if (cmp(cur, lastPos) != 0) { - cm.curOp.focus = activeElt(); - extendTo(cur); - var visible = visibleLines(display, doc); - if (cur.line >= visible.to || cur.line < visible.from) - setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150); - } else { - var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0; - if (outside) setTimeout(operation(cm, function() { - if (counter != curCount) return; - display.scroller.scrollTop += outside; - extend(e); - }), 50); - } - } - - function done(e) { - cm.state.selectingText = false; - counter = Infinity; - e_preventDefault(e); - display.input.focus(); - off(document, "mousemove", move); - off(document, "mouseup", up); - doc.history.lastSelOrigin = null; - } - - var move = operation(cm, function(e) { - if (!e_button(e)) done(e); - else extend(e); - }); - var up = operation(cm, done); - cm.state.selectingText = up; - on(document, "mousemove", move); - on(document, "mouseup", up); - } - - // Determines whether an event happened in the gutter, and fires the - // handlers for the corresponding event. - function gutterEvent(cm, e, type, prevent) { - try { var mX = e.clientX, mY = e.clientY; } - catch(e) { return false; } - if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false; - if (prevent) e_preventDefault(e); - - var display = cm.display; - var lineBox = display.lineDiv.getBoundingClientRect(); - - if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e); - mY -= lineBox.top - display.viewOffset; - - for (var i = 0; i < cm.options.gutters.length; ++i) { - var g = display.gutters.childNodes[i]; - if (g && g.getBoundingClientRect().right >= mX) { - var line = lineAtHeight(cm.doc, mY); - var gutter = cm.options.gutters[i]; - signal(cm, type, cm, line, gutter, e); - return e_defaultPrevented(e); - } - } - } - - function clickInGutter(cm, e) { - return gutterEvent(cm, e, "gutterClick", true); - } - - // Kludge to work around strange IE behavior where it'll sometimes - // re-fire a series of drag-related events right after the drop (#1551) - var lastDrop = 0; - - function onDrop(e) { - var cm = this; - clearDragCursor(cm); - if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) - return; - e_preventDefault(e); - if (ie) lastDrop = +new Date; - var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files; - if (!pos || cm.isReadOnly()) return; - // Might be a file drop, in which case we simply extract the text - // and insert it. - if (files && files.length && window.FileReader && window.File) { - var n = files.length, text = Array(n), read = 0; - var loadFile = function(file, i) { - if (cm.options.allowDropFileTypes && - indexOf(cm.options.allowDropFileTypes, file.type) == -1) - return; - - var reader = new FileReader; - reader.onload = operation(cm, function() { - var content = reader.result; - if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) content = ""; - text[i] = content; - if (++read == n) { - pos = clipPos(cm.doc, pos); - var change = {from: pos, to: pos, - text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())), - origin: "paste"}; - makeChange(cm.doc, change); - setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change))); - } - }); - reader.readAsText(file); - }; - for (var i = 0; i < n; ++i) loadFile(files[i], i); - } else { // Normal drop - // Don't do a replace if the drop happened inside of the selected text. - if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) { - cm.state.draggingText(e); - // Ensure the editor is re-focused - setTimeout(function() {cm.display.input.focus();}, 20); - return; - } + setTimeout(rehide, 50) + } + }, + + readOnlyChanged: function(val) { + if (!val) { this.reset() } + }, + + setUneditable: nothing, + + needsContentAttribute: false +}, TextareaInput.prototype) + +function fromTextArea(textarea, options) { + options = options ? copyObj(options) : {} + options.value = textarea.value + if (!options.tabindex && textarea.tabIndex) + { options.tabindex = textarea.tabIndex } + if (!options.placeholder && textarea.placeholder) + { options.placeholder = textarea.placeholder } + // Set autofocus to true if this textarea is focused, or if it has + // autofocus and no other element is focused. + if (options.autofocus == null) { + var hasFocus = activeElt() + options.autofocus = hasFocus == textarea || + textarea.getAttribute("autofocus") != null && hasFocus == document.body + } + + function save() {textarea.value = cm.getValue()} + + var realSubmit + if (textarea.form) { + on(textarea.form, "submit", save) + // Deplorable hack to make the submit method do the right thing. + if (!options.leaveSubmitMethodAlone) { + var form = textarea.form + realSubmit = form.submit try { - var text = e.dataTransfer.getData("Text"); - if (text) { - if (cm.state.draggingText && !cm.state.draggingText.copy) - var selected = cm.listSelections(); - setSelectionNoUndo(cm.doc, simpleSelection(pos, pos)); - if (selected) for (var i = 0; i < selected.length; ++i) - replaceRange(cm.doc, "", selected[i].anchor, selected[i].head, "drag"); - cm.replaceSelection(text, "around", "paste"); - cm.display.input.focus(); - } - } - catch(e){} - } - } - - function onDragStart(cm, e) { - if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; } - if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return; - - e.dataTransfer.setData("Text", cm.getSelection()); - e.dataTransfer.effectAllowed = "copyMove" - - // Use dummy image instead of default browsers image. - // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there. - if (e.dataTransfer.setDragImage && !safari) { - var img = elt("img", null, null, "position: fixed; left: 0; top: 0;"); - img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; - if (presto) { - img.width = img.height = 1; - cm.display.wrapper.appendChild(img); - // Force a relayout, or Opera won't use our image for some obscure reason - img._top = img.offsetTop; - } - e.dataTransfer.setDragImage(img, 0, 0); - if (presto) img.parentNode.removeChild(img); - } - } - - function onDragOver(cm, e) { - var pos = posFromMouse(cm, e); - if (!pos) return; - var frag = document.createDocumentFragment(); - drawSelectionCursor(cm, pos, frag); - if (!cm.display.dragCursor) { - cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors"); - cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv); - } - removeChildrenAndAdd(cm.display.dragCursor, frag); - } - - function clearDragCursor(cm) { - if (cm.display.dragCursor) { - cm.display.lineSpace.removeChild(cm.display.dragCursor); - cm.display.dragCursor = null; - } - } - - // SCROLL EVENTS - - // Sync the scrollable area and scrollbars, ensure the viewport - // covers the visible area. - function setScrollTop(cm, val) { - if (Math.abs(cm.doc.scrollTop - val) < 2) return; - cm.doc.scrollTop = val; - if (!gecko) updateDisplaySimple(cm, {top: val}); - if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val; - cm.display.scrollbars.setScrollTop(val); - if (gecko) updateDisplaySimple(cm); - startWorker(cm, 100); - } - // Sync scroller and scrollbar, ensure the gutter elements are - // aligned. - function setScrollLeft(cm, val, isScroller) { - if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return; - val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth); - cm.doc.scrollLeft = val; - alignHorizontally(cm); - if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val; - cm.display.scrollbars.setScrollLeft(val); - } - - // Since the delta values reported on mouse wheel events are - // unstandardized between browsers and even browser versions, and - // generally horribly unpredictable, this code starts by measuring - // the scroll effect that the first few mouse wheel events have, - // and, from that, detects the way it can convert deltas to pixel - // offsets afterwards. - // - // The reason we want to know the amount a wheel event will scroll - // is that it gives us a chance to update the display before the - // actual scrolling happens, reducing flickering. - - var wheelSamples = 0, wheelPixelsPerUnit = null; - // Fill in a browser-detected starting value on browsers where we - // know one. These don't have to be accurate -- the result of them - // being wrong would just be a slight flicker on the first wheel - // scroll (if it is large enough). - if (ie) wheelPixelsPerUnit = -.53; - else if (gecko) wheelPixelsPerUnit = 15; - else if (chrome) wheelPixelsPerUnit = -.7; - else if (safari) wheelPixelsPerUnit = -1/3; - - var wheelEventDelta = function(e) { - var dx = e.wheelDeltaX, dy = e.wheelDeltaY; - if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail; - if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail; - else if (dy == null) dy = e.wheelDelta; - return {x: dx, y: dy}; - }; - CodeMirror.wheelEventPixels = function(e) { - var delta = wheelEventDelta(e); - delta.x *= wheelPixelsPerUnit; - delta.y *= wheelPixelsPerUnit; - return delta; - }; - - function onScrollWheel(cm, e) { - var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y; - - var display = cm.display, scroll = display.scroller; - // Quit if there's nothing to scroll here - var canScrollX = scroll.scrollWidth > scroll.clientWidth; - var canScrollY = scroll.scrollHeight > scroll.clientHeight; - if (!(dx && canScrollX || dy && canScrollY)) return; - - // Webkit browsers on OS X abort momentum scrolls when the target - // of the scroll event is removed from the scrollable element. - // This hack (see related code in patchDisplay) makes sure the - // element is kept around. - if (dy && mac && webkit) { - outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) { - for (var i = 0; i < view.length; i++) { - if (view[i].node == cur) { - cm.display.currentWheelTarget = cur; - break outer; - } - } - } - } - - // On some browsers, horizontal scrolling will cause redraws to - // happen before the gutter has been realigned, causing it to - // wriggle around in a most unseemly way. When we have an - // estimated pixels/delta value, we just handle horizontal - // scrolling entirely here. It'll be slightly off from native, but - // better than glitching out. - if (dx && !gecko && !presto && wheelPixelsPerUnit != null) { - if (dy && canScrollY) - setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))); - setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth))); - // Only prevent default scrolling if vertical scrolling is - // actually possible. Otherwise, it causes vertical scroll - // jitter on OSX trackpads when deltaX is small and deltaY - // is large (issue #3579) - if (!dy || (dy && canScrollY)) - e_preventDefault(e); - display.wheelStartX = null; // Abort measurement, if in progress - return; - } - - // 'Project' the visible viewport to cover the area that is being - // scrolled into view (if we know enough to estimate it). - if (dy && wheelPixelsPerUnit != null) { - var pixels = dy * wheelPixelsPerUnit; - var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight; - if (pixels < 0) top = Math.max(0, top + pixels - 50); - else bot = Math.min(cm.doc.height, bot + pixels + 50); - updateDisplaySimple(cm, {top: top, bottom: bot}); - } - - if (wheelSamples < 20) { - if (display.wheelStartX == null) { - display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop; - display.wheelDX = dx; display.wheelDY = dy; - setTimeout(function() { - if (display.wheelStartX == null) return; - var movedX = scroll.scrollLeft - display.wheelStartX; - var movedY = scroll.scrollTop - display.wheelStartY; - var sample = (movedY && display.wheelDY && movedY / display.wheelDY) || - (movedX && display.wheelDX && movedX / display.wheelDX); - display.wheelStartX = display.wheelStartY = null; - if (!sample) return; - wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1); - ++wheelSamples; - }, 200); - } else { - display.wheelDX += dx; display.wheelDY += dy; - } - } - } - - // KEY EVENTS - - // Run a handler that was bound to a key. - function doHandleBinding(cm, bound, dropShift) { - if (typeof bound == "string") { - bound = commands[bound]; - if (!bound) return false; - } - // Ensure previous input has been read, so that the handler sees a - // consistent view of the document - cm.display.input.ensurePolled(); - var prevShift = cm.display.shift, done = false; - try { - if (cm.isReadOnly()) cm.state.suppressEdits = true; - if (dropShift) cm.display.shift = false; - done = bound(cm) != Pass; - } finally { - cm.display.shift = prevShift; - cm.state.suppressEdits = false; - } - return done; - } - - function lookupKeyForEditor(cm, name, handle) { - for (var i = 0; i < cm.state.keyMaps.length; i++) { - var result = lookupKey(name, cm.state.keyMaps[i], handle, cm); - if (result) return result; - } - return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm)) - || lookupKey(name, cm.options.keyMap, handle, cm); - } - - var stopSeq = new Delayed; - function dispatchKey(cm, name, e, handle) { - var seq = cm.state.keySeq; - if (seq) { - if (isModifierKey(name)) return "handled"; - stopSeq.set(50, function() { - if (cm.state.keySeq == seq) { - cm.state.keySeq = null; - cm.display.input.reset(); - } - }); - name = seq + " " + name; - } - var result = lookupKeyForEditor(cm, name, handle); - - if (result == "multi") - cm.state.keySeq = name; - if (result == "handled") - signalLater(cm, "keyHandled", cm, name, e); - - if (result == "handled" || result == "multi") { - e_preventDefault(e); - restartBlink(cm); - } - - if (seq && !result && /\'$/.test(name)) { - e_preventDefault(e); - return true; - } - return !!result; - } - - // Handle a key from the keydown event. - function handleKeyBinding(cm, e) { - var name = keyName(e, true); - if (!name) return false; - - if (e.shiftKey && !cm.state.keySeq) { - // First try to resolve full name (including 'Shift-'). Failing - // that, see if there is a cursor-motion command (starting with - // 'go') bound to the keyname without 'Shift-'. - return dispatchKey(cm, "Shift-" + name, e, function(b) {return doHandleBinding(cm, b, true);}) - || dispatchKey(cm, name, e, function(b) { - if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) - return doHandleBinding(cm, b); - }); - } else { - return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); }); - } - } - - // Handle a key from the keypress event - function handleCharBinding(cm, e, ch) { - return dispatchKey(cm, "'" + ch + "'", e, - function(b) { return doHandleBinding(cm, b, true); }); - } - - var lastStoppedKey = null; - function onKeyDown(e) { - var cm = this; - cm.curOp.focus = activeElt(); - if (signalDOMEvent(cm, e)) return; - // IE does strange things with escape. - if (ie && ie_version < 11 && e.keyCode == 27) e.returnValue = false; - var code = e.keyCode; - cm.display.shift = code == 16 || e.shiftKey; - var handled = handleKeyBinding(cm, e); - if (presto) { - lastStoppedKey = handled ? code : null; - // Opera has no cut event... we try to at least catch the key combo - if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey)) - cm.replaceSelection("", null, "cut"); - } - - // Turn mouse into crosshair when Alt is held on Mac. - if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className)) - showCrossHair(cm); - } - - function showCrossHair(cm) { - var lineDiv = cm.display.lineDiv; - addClass(lineDiv, "CodeMirror-crosshair"); - - function up(e) { - if (e.keyCode == 18 || !e.altKey) { - rmClass(lineDiv, "CodeMirror-crosshair"); - off(document, "keyup", up); - off(document, "mouseover", up); - } - } - on(document, "keyup", up); - on(document, "mouseover", up); - } - - function onKeyUp(e) { - if (e.keyCode == 16) this.doc.sel.shift = false; - signalDOMEvent(this, e); - } - - function onKeyPress(e) { - var cm = this; - if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) return; - var keyCode = e.keyCode, charCode = e.charCode; - if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;} - if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) return; - var ch = String.fromCharCode(charCode == null ? keyCode : charCode); - if (handleCharBinding(cm, e, ch)) return; - cm.display.input.onKeyPress(e); - } - - // FOCUS/BLUR EVENTS - - function delayBlurEvent(cm) { - cm.state.delayingBlurEvent = true; - setTimeout(function() { - if (cm.state.delayingBlurEvent) { - cm.state.delayingBlurEvent = false; - onBlur(cm); - } - }, 100); - } - - function onFocus(cm, e) { - if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false; - - if (cm.options.readOnly == "nocursor") return; - if (!cm.state.focused) { - signal(cm, "focus", cm, e); - cm.state.focused = true; - addClass(cm.display.wrapper, "CodeMirror-focused"); - // This test prevents this from firing when a context - // menu is closed (since the input reset would kill the - // select-all detection hack) - if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) { - cm.display.input.reset(); - if (webkit) setTimeout(function() { cm.display.input.reset(true); }, 20); // Issue #1730 - } - cm.display.input.receivedFocus(); - } - restartBlink(cm); - } - function onBlur(cm, e) { - if (cm.state.delayingBlurEvent) return; - - if (cm.state.focused) { - signal(cm, "blur", cm, e); - cm.state.focused = false; - rmClass(cm.display.wrapper, "CodeMirror-focused"); - } - clearInterval(cm.display.blinker); - setTimeout(function() {if (!cm.state.focused) cm.display.shift = false;}, 150); - } - - // CONTEXT MENU HANDLING - - // To make the context menu work, we need to briefly unhide the - // textarea (making it as unobtrusive as possible) to let the - // right-click take effect on it. - function onContextMenu(cm, e) { - if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return; - if (signalDOMEvent(cm, e, "contextmenu")) return; - cm.display.input.onContextMenu(e); - } - - function contextMenuInGutter(cm, e) { - if (!hasHandler(cm, "gutterContextMenu")) return false; - return gutterEvent(cm, e, "gutterContextMenu", false); - } - - // UPDATING - - // Compute the position of the end of a change (its 'to' property - // refers to the pre-change end). - var changeEnd = CodeMirror.changeEnd = function(change) { - if (!change.text) return change.to; - return Pos(change.from.line + change.text.length - 1, - lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0)); - }; - - // Adjust a position to refer to the post-change position of the - // same text, or the end of the change if the change covers it. - function adjustForChange(pos, change) { - if (cmp(pos, change.from) < 0) return pos; - if (cmp(pos, change.to) <= 0) return changeEnd(change); - - var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch; - if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch; - return Pos(line, ch); - } - - function computeSelAfterChange(doc, change) { - var out = []; - for (var i = 0; i < doc.sel.ranges.length; i++) { - var range = doc.sel.ranges[i]; - out.push(new Range(adjustForChange(range.anchor, change), - adjustForChange(range.head, change))); - } - return normalizeSelection(out, doc.sel.primIndex); - } - - function offsetPos(pos, old, nw) { - if (pos.line == old.line) - return Pos(nw.line, pos.ch - old.ch + nw.ch); - else - return Pos(nw.line + (pos.line - old.line), pos.ch); - } - - // Used by replaceSelections to allow moving the selection to the - // start or around the replaced test. Hint may be "start" or "around". - function computeReplacedSel(doc, changes, hint) { - var out = []; - var oldPrev = Pos(doc.first, 0), newPrev = oldPrev; - for (var i = 0; i < changes.length; i++) { - var change = changes[i]; - var from = offsetPos(change.from, oldPrev, newPrev); - var to = offsetPos(changeEnd(change), oldPrev, newPrev); - oldPrev = change.to; - newPrev = to; - if (hint == "around") { - var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0; - out[i] = new Range(inv ? to : from, inv ? from : to); - } else { - out[i] = new Range(from, from); - } - } - return new Selection(out, doc.sel.primIndex); - } - - // Allow "beforeChange" event handlers to influence a change - function filterChange(doc, change, update) { - var obj = { - canceled: false, - from: change.from, - to: change.to, - text: change.text, - origin: change.origin, - cancel: function() { this.canceled = true; } - }; - if (update) obj.update = function(from, to, text, origin) { - if (from) this.from = clipPos(doc, from); - if (to) this.to = clipPos(doc, to); - if (text) this.text = text; - if (origin !== undefined) this.origin = origin; - }; - signal(doc, "beforeChange", doc, obj); - if (doc.cm) signal(doc.cm, "beforeChange", doc.cm, obj); - - if (obj.canceled) return null; - return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}; - } - - // Apply a change to a document, and add it to the document's - // history, and propagating it to all linked documents. - function makeChange(doc, change, ignoreReadOnly) { - if (doc.cm) { - if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly); - if (doc.cm.state.suppressEdits) return; - } - - if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { - change = filterChange(doc, change, true); - if (!change) return; - } - - // Possibly split or suppress the update based on the presence - // of read-only spans in its range. - var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to); - if (split) { - for (var i = split.length - 1; i >= 0; --i) - makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}); - } else { - makeChangeInner(doc, change); - } - } - - function makeChangeInner(doc, change) { - if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return; - var selAfter = computeSelAfterChange(doc, change); - addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN); - - makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change)); - var rebased = []; - - linkedDocs(doc, function(doc, sharedHist) { - if (!sharedHist && indexOf(rebased, doc.history) == -1) { - rebaseHist(doc.history, change); - rebased.push(doc.history); - } - makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change)); - }); - } - - // Revert a change stored in a document's history. - function makeChangeFromHistory(doc, type, allowSelectionOnly) { - if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) return; - - var hist = doc.history, event, selAfter = doc.sel; - var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done; - - // Verify that there is a useable event (so that ctrl-z won't - // needlessly clear selection events) - for (var i = 0; i < source.length; i++) { - event = source[i]; - if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges) - break; - } - if (i == source.length) return; - hist.lastOrigin = hist.lastSelOrigin = null; - - for (;;) { - event = source.pop(); - if (event.ranges) { - pushSelectionToHistory(event, dest); - if (allowSelectionOnly && !event.equals(doc.sel)) { - setSelection(doc, event, {clearRedo: false}); - return; - } - selAfter = event; - } - else break; - } - - // Build up a reverse change object to add to the opposite history - // stack (redo when undoing, and vice versa). - var antiChanges = []; - pushSelectionToHistory(selAfter, dest); - dest.push({changes: antiChanges, generation: hist.generation}); - hist.generation = event.generation || ++hist.maxGeneration; - - var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange"); - - for (var i = event.changes.length - 1; i >= 0; --i) { - var change = event.changes[i]; - change.origin = type; - if (filter && !filterChange(doc, change, false)) { - source.length = 0; - return; - } - - antiChanges.push(historyChangeFromChange(doc, change)); - - var after = i ? computeSelAfterChange(doc, change) : lst(source); - makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change)); - if (!i && doc.cm) doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); - var rebased = []; - - // Propagate to the linked documents - linkedDocs(doc, function(doc, sharedHist) { - if (!sharedHist && indexOf(rebased, doc.history) == -1) { - rebaseHist(doc.history, change); - rebased.push(doc.history); - } - makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change)); - }); - } - } - - // Sub-views need their line numbers shifted when text is added - // above or below them in the parent document. - function shiftDoc(doc, distance) { - if (distance == 0) return; - doc.first += distance; - doc.sel = new Selection(map(doc.sel.ranges, function(range) { - return new Range(Pos(range.anchor.line + distance, range.anchor.ch), - Pos(range.head.line + distance, range.head.ch)); - }), doc.sel.primIndex); - if (doc.cm) { - regChange(doc.cm, doc.first, doc.first - distance, distance); - for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++) - regLineChange(doc.cm, l, "gutter"); - } - } - - // More lower-level change function, handling only a single document - // (not linked ones). - function makeChangeSingleDoc(doc, change, selAfter, spans) { - if (doc.cm && !doc.cm.curOp) - return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans); - - if (change.to.line < doc.first) { - shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line)); - return; - } - if (change.from.line > doc.lastLine()) return; - - // Clip the change to the size of this doc - if (change.from.line < doc.first) { - var shift = change.text.length - 1 - (doc.first - change.from.line); - shiftDoc(doc, shift); - change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch), - text: [lst(change.text)], origin: change.origin}; - } - var last = doc.lastLine(); - if (change.to.line > last) { - change = {from: change.from, to: Pos(last, getLine(doc, last).text.length), - text: [change.text[0]], origin: change.origin}; - } - - change.removed = getBetween(doc, change.from, change.to); - - if (!selAfter) selAfter = computeSelAfterChange(doc, change); - if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans); - else updateDoc(doc, change, spans); - setSelectionNoUndo(doc, selAfter, sel_dontScroll); - } - - // Handle the interaction of a change to a document with the editor - // that this document is part of. - function makeChangeSingleDocInEditor(cm, change, spans) { - var doc = cm.doc, display = cm.display, from = change.from, to = change.to; - - var recomputeMaxLength = false, checkWidthStart = from.line; - if (!cm.options.lineWrapping) { - checkWidthStart = lineNo(visualLine(getLine(doc, from.line))); - doc.iter(checkWidthStart, to.line + 1, function(line) { - if (line == display.maxLine) { - recomputeMaxLength = true; - return true; - } - }); - } - - if (doc.sel.contains(change.from, change.to) > -1) - signalCursorActivity(cm); - - updateDoc(doc, change, spans, estimateHeight(cm)); - - if (!cm.options.lineWrapping) { - doc.iter(checkWidthStart, from.line + change.text.length, function(line) { - var len = lineLength(line); - if (len > display.maxLineLength) { - display.maxLine = line; - display.maxLineLength = len; - display.maxLineChanged = true; - recomputeMaxLength = false; - } - }); - if (recomputeMaxLength) cm.curOp.updateMaxLine = true; - } - - // Adjust frontier, schedule worker - doc.frontier = Math.min(doc.frontier, from.line); - startWorker(cm, 400); - - var lendiff = change.text.length - (to.line - from.line) - 1; - // Remember that these lines changed, for updating the display - if (change.full) - regChange(cm); - else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) - regLineChange(cm, from.line, "text"); - else - regChange(cm, from.line, to.line + 1, lendiff); - - var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change"); - if (changeHandler || changesHandler) { - var obj = { - from: from, to: to, - text: change.text, - removed: change.removed, - origin: change.origin - }; - if (changeHandler) signalLater(cm, "change", cm, obj); - if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); - } - cm.display.selForContextMenu = null; - } - - function replaceRange(doc, code, from, to, origin) { - if (!to) to = from; - if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; } - if (typeof code == "string") code = doc.splitLines(code); - makeChange(doc, {from: from, to: to, text: code, origin: origin}); - } - - // SCROLLING THINGS INTO VIEW - - // If an editor sits on the top or bottom of the window, partially - // scrolled out of view, this ensures that the cursor is visible. - function maybeScrollWindow(cm, coords) { - if (signalDOMEvent(cm, "scrollCursorIntoView")) return; - - var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null; - if (coords.top + box.top < 0) doScroll = true; - else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false; - if (doScroll != null && !phantom) { - var scrollNode = elt("div", "\u200b", null, "position: absolute; top: " + - (coords.top - display.viewOffset - paddingTop(cm.display)) + "px; height: " + - (coords.bottom - coords.top + scrollGap(cm) + display.barHeight) + "px; left: " + - coords.left + "px; width: 2px;"); - cm.display.lineSpace.appendChild(scrollNode); - scrollNode.scrollIntoView(doScroll); - cm.display.lineSpace.removeChild(scrollNode); - } - } - - // Scroll a given position into view (immediately), verifying that - // it actually became visible (as line heights are accurately - // measured, the position of something may 'drift' during drawing). - function scrollPosIntoView(cm, pos, end, margin) { - if (margin == null) margin = 0; - for (var limit = 0; limit < 5; limit++) { - var changed = false, coords = cursorCoords(cm, pos); - var endCoords = !end || end == pos ? coords : cursorCoords(cm, end); - var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left), - Math.min(coords.top, endCoords.top) - margin, - Math.max(coords.left, endCoords.left), - Math.max(coords.bottom, endCoords.bottom) + margin); - var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft; - if (scrollPos.scrollTop != null) { - setScrollTop(cm, scrollPos.scrollTop); - if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true; - } - if (scrollPos.scrollLeft != null) { - setScrollLeft(cm, scrollPos.scrollLeft); - if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true; - } - if (!changed) break; - } - return coords; - } - - // Scroll a given set of coordinates into view (immediately). - function scrollIntoView(cm, x1, y1, x2, y2) { - var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2); - if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop); - if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft); - } - - // Calculate a new scroll position needed to scroll the given - // rectangle into view. Returns an object with scrollTop and - // scrollLeft properties. When these are undefined, the - // vertical/horizontal position does not need to be adjusted. - function calculateScrollPos(cm, x1, y1, x2, y2) { - var display = cm.display, snapMargin = textHeight(cm.display); - if (y1 < 0) y1 = 0; - var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop; - var screen = displayHeight(cm), result = {}; - if (y2 - y1 > screen) y2 = y1 + screen; - var docBottom = cm.doc.height + paddingVert(display); - var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin; - if (y1 < screentop) { - result.scrollTop = atTop ? 0 : y1; - } else if (y2 > screentop + screen) { - var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen); - if (newTop != screentop) result.scrollTop = newTop; - } - - var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft; - var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0); - var tooWide = x2 - x1 > screenw; - if (tooWide) x2 = x1 + screenw; - if (x1 < 10) - result.scrollLeft = 0; - else if (x1 < screenleft) - result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10)); - else if (x2 > screenw + screenleft - 3) - result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw; - return result; - } - - // Store a relative adjustment to the scroll position in the current - // operation (to be applied when the operation finishes). - function addToScrollPos(cm, left, top) { - if (left != null || top != null) resolveScrollToPos(cm); - if (left != null) - cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left; - if (top != null) - cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top; - } - - // Make sure that at the end of the operation the current cursor is - // shown. - function ensureCursorVisible(cm) { - resolveScrollToPos(cm); - var cur = cm.getCursor(), from = cur, to = cur; - if (!cm.options.lineWrapping) { - from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur; - to = Pos(cur.line, cur.ch + 1); - } - cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true}; - } - - // When an operation has its scrollToPos property set, and another - // scroll action is applied before the end of the operation, this - // 'simulates' scrolling that position into view in a cheap way, so - // that the effect of intermediate scroll commands is not ignored. - function resolveScrollToPos(cm) { - var range = cm.curOp.scrollToPos; - if (range) { - cm.curOp.scrollToPos = null; - var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to); - var sPos = calculateScrollPos(cm, Math.min(from.left, to.left), - Math.min(from.top, to.top) - range.margin, - Math.max(from.right, to.right), - Math.max(from.bottom, to.bottom) + range.margin); - cm.scrollTo(sPos.scrollLeft, sPos.scrollTop); - } - } - - // API UTILITIES - - // Indent the given line. The how parameter can be "smart", - // "add"/null, "subtract", or "prev". When aggressive is false - // (typically set to true for forced single-line indents), empty - // lines are not indented, and places where the mode returns Pass - // are left alone. - function indentLine(cm, n, how, aggressive) { - var doc = cm.doc, state; - if (how == null) how = "add"; - if (how == "smart") { - // Fall back to "prev" when the mode doesn't have an indentation - // method. - if (!doc.mode.indent) how = "prev"; - else state = getStateBefore(cm, n); - } - - var tabSize = cm.options.tabSize; - var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize); - if (line.stateAfter) line.stateAfter = null; - var curSpaceString = line.text.match(/^\s*/)[0], indentation; - if (!aggressive && !/\S/.test(line.text)) { - indentation = 0; - how = "not"; - } else if (how == "smart") { - indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text); - if (indentation == Pass || indentation > 150) { - if (!aggressive) return; - how = "prev"; - } - } - if (how == "prev") { - if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize); - else indentation = 0; - } else if (how == "add") { - indentation = curSpace + cm.options.indentUnit; - } else if (how == "subtract") { - indentation = curSpace - cm.options.indentUnit; - } else if (typeof how == "number") { - indentation = curSpace + how; - } - indentation = Math.max(0, indentation); - - var indentString = "", pos = 0; - if (cm.options.indentWithTabs) - for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} - if (pos < indentation) indentString += spaceStr(indentation - pos); - - if (indentString != curSpaceString) { - replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input"); - line.stateAfter = null; - return true; - } else { - // Ensure that, if the cursor was in the whitespace at the start - // of the line, it is moved to the end of that space. - for (var i = 0; i < doc.sel.ranges.length; i++) { - var range = doc.sel.ranges[i]; - if (range.head.line == n && range.head.ch < curSpaceString.length) { - var pos = Pos(n, curSpaceString.length); - replaceOneSelection(doc, i, new Range(pos, pos)); - break; - } - } - } - } - - // Utility for applying a change to a line by handle or number, - // returning the number and optionally registering the line as - // changed. - function changeLine(doc, handle, changeType, op) { - var no = handle, line = handle; - if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle)); - else no = lineNo(handle); - if (no == null) return null; - if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType); - return line; - } - - // Helper for deleting text near the selection(s), used to implement - // backspace, delete, and similar functionality. - function deleteNearSelection(cm, compute) { - var ranges = cm.doc.sel.ranges, kill = []; - // Build up a set of ranges to kill first, merging overlapping - // ranges. - for (var i = 0; i < ranges.length; i++) { - var toKill = compute(ranges[i]); - while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) { - var replaced = kill.pop(); - if (cmp(replaced.from, toKill.from) < 0) { - toKill.from = replaced.from; - break; - } - } - kill.push(toKill); - } - // Next, remove those actual ranges. - runInOp(cm, function() { - for (var i = kill.length - 1; i >= 0; i--) - replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); - ensureCursorVisible(cm); - }); - } - - // Used for horizontal relative motion. Dir is -1 or 1 (left or - // right), unit can be "char", "column" (like char, but doesn't - // cross line boundaries), "word" (across next word), or "group" (to - // the start of next group of word or non-word-non-whitespace - // chars). The visually param controls whether, in right-to-left - // text, direction 1 means to move towards the next index in the - // string, or towards the character to the right of the current - // position. The resulting position will have a hitSide=true - // property if it reached the end of the document. - function findPosH(doc, pos, dir, unit, visually) { - var line = pos.line, ch = pos.ch, origDir = dir; - var lineObj = getLine(doc, line); - function findNextLine() { - var l = line + dir; - if (l < doc.first || l >= doc.first + doc.size) return false - line = l; - return lineObj = getLine(doc, l); - } - function moveOnce(boundToLine) { - var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true); - if (next == null) { - if (!boundToLine && findNextLine()) { - if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj); - else ch = dir < 0 ? lineObj.text.length : 0; - } else return false - } else ch = next; - return true; - } - - if (unit == "char") { - moveOnce() - } else if (unit == "column") { - moveOnce(true) - } else if (unit == "word" || unit == "group") { - var sawType = null, group = unit == "group"; - var helper = doc.cm && doc.cm.getHelper(pos, "wordChars"); - for (var first = true;; first = false) { - if (dir < 0 && !moveOnce(!first)) break; - var cur = lineObj.text.charAt(ch) || "\n"; - var type = isWordChar(cur, helper) ? "w" - : group && cur == "\n" ? "n" - : !group || /\s/.test(cur) ? null - : "p"; - if (group && !first && !type) type = "s"; - if (sawType && sawType != type) { - if (dir < 0) {dir = 1; moveOnce();} - break; + var wrappedSubmit = form.submit = function () { + save() + form.submit = realSubmit + form.submit() + form.submit = wrappedSubmit } - - if (type) sawType = type; - if (dir > 0 && !moveOnce(!first)) break; - } - } - var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true); - if (!cmp(pos, result)) result.hitSide = true; - return result; - } - - // For relative vertical movement. Dir may be -1 or 1. Unit can be - // "page" or "line". The resulting position will have a hitSide=true - // property if it reached the end of the document. - function findPosV(cm, pos, dir, unit) { - var doc = cm.doc, x = pos.left, y; - if (unit == "page") { - var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); - var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3); - y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount; - } else if (unit == "line") { - y = dir > 0 ? pos.bottom + 3 : pos.top - 3; - } - for (;;) { - var target = coordsChar(cm, x, y); - if (!target.outside) break; - if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; } - y += dir * 5; - } - return target; - } - - // EDITOR METHODS - - // The publicly visible API. Note that methodOp(f) means - // 'wrap f in an operation, performed on its `this` parameter'. - - // This is not the complete set of editor methods. Most of the - // methods defined on the Doc type are also injected into - // CodeMirror.prototype, for backwards compatibility and - // convenience. - - CodeMirror.prototype = { - constructor: CodeMirror, - focus: function(){window.focus(); this.display.input.focus();}, - - setOption: function(option, value) { - var options = this.options, old = options[option]; - if (options[option] == value && option != "mode") return; - options[option] = value; - if (optionHandlers.hasOwnProperty(option)) - operation(this, optionHandlers[option])(this, value, old); - }, - - getOption: function(option) {return this.options[option];}, - getDoc: function() {return this.doc;}, - - addKeyMap: function(map, bottom) { - this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map)); - }, - removeKeyMap: function(map) { - var maps = this.state.keyMaps; - for (var i = 0; i < maps.length; ++i) - if (maps[i] == map || maps[i].name == map) { - maps.splice(i, 1); - return true; - } - }, - - addOverlay: methodOp(function(spec, options) { - var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec); - if (mode.startState) throw new Error("Overlays may not be stateful."); - insertSorted(this.state.overlays, - {mode: mode, modeSpec: spec, opaque: options && options.opaque, - priority: (options && options.priority) || 0}, - function(overlay) { return overlay.priority }) - this.state.modeGen++; - regChange(this); - }), - removeOverlay: methodOp(function(spec) { - var overlays = this.state.overlays; - for (var i = 0; i < overlays.length; ++i) { - var cur = overlays[i].modeSpec; - if (cur == spec || typeof spec == "string" && cur.name == spec) { - overlays.splice(i, 1); - this.state.modeGen++; - regChange(this); - return; - } - } - }), - - indentLine: methodOp(function(n, dir, aggressive) { - if (typeof dir != "string" && typeof dir != "number") { - if (dir == null) dir = this.options.smartIndent ? "smart" : "prev"; - else dir = dir ? "add" : "subtract"; - } - if (isLine(this.doc, n)) indentLine(this, n, dir, aggressive); - }), - indentSelection: methodOp(function(how) { - var ranges = this.doc.sel.ranges, end = -1; - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - if (!range.empty()) { - var from = range.from(), to = range.to(); - var start = Math.max(end, from.line); - end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1; - for (var j = start; j < end; ++j) - indentLine(this, j, how); - var newRanges = this.doc.sel.ranges; - if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0) - replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); - } else if (range.head.line > end) { - indentLine(this, range.head.line, how, true); - end = range.head.line; - if (i == this.doc.sel.primIndex) ensureCursorVisible(this); - } - } - }), - - // Fetch the parser token for a given character. Useful for hacks - // that want to inspect the mode state (say, for completion). - getTokenAt: function(pos, precise) { - return takeToken(this, pos, precise); - }, - - getLineTokens: function(line, precise) { - return takeToken(this, Pos(line), precise, true); - }, - - getTokenTypeAt: function(pos) { - pos = clipPos(this.doc, pos); - var styles = getLineStyles(this, getLine(this.doc, pos.line)); - var before = 0, after = (styles.length - 1) / 2, ch = pos.ch; - var type; - if (ch == 0) type = styles[2]; - else for (;;) { - var mid = (before + after) >> 1; - if ((mid ? styles[mid * 2 - 1] : 0) >= ch) after = mid; - else if (styles[mid * 2 + 1] < ch) before = mid + 1; - else { type = styles[mid * 2 + 2]; break; } - } - var cut = type ? type.indexOf("cm-overlay ") : -1; - return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1); - }, - - getModeAt: function(pos) { - var mode = this.doc.mode; - if (!mode.innerMode) return mode; - return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode; - }, - - getHelper: function(pos, type) { - return this.getHelpers(pos, type)[0]; - }, - - getHelpers: function(pos, type) { - var found = []; - if (!helpers.hasOwnProperty(type)) return found; - var help = helpers[type], mode = this.getModeAt(pos); - if (typeof mode[type] == "string") { - if (help[mode[type]]) found.push(help[mode[type]]); - } else if (mode[type]) { - for (var i = 0; i < mode[type].length; i++) { - var val = help[mode[type][i]]; - if (val) found.push(val); - } - } else if (mode.helperType && help[mode.helperType]) { - found.push(help[mode.helperType]); - } else if (help[mode.name]) { - found.push(help[mode.name]); - } - for (var i = 0; i < help._global.length; i++) { - var cur = help._global[i]; - if (cur.pred(mode, this) && indexOf(found, cur.val) == -1) - found.push(cur.val); - } - return found; - }, - - getStateAfter: function(line, precise) { - var doc = this.doc; - line = clipLine(doc, line == null ? doc.first + doc.size - 1: line); - return getStateBefore(this, line + 1, precise); - }, - - cursorCoords: function(start, mode) { - var pos, range = this.doc.sel.primary(); - if (start == null) pos = range.head; - else if (typeof start == "object") pos = clipPos(this.doc, start); - else pos = start ? range.from() : range.to(); - return cursorCoords(this, pos, mode || "page"); - }, - - charCoords: function(pos, mode) { - return charCoords(this, clipPos(this.doc, pos), mode || "page"); - }, - - coordsChar: function(coords, mode) { - coords = fromCoordSystem(this, coords, mode || "page"); - return coordsChar(this, coords.left, coords.top); - }, - - lineAtHeight: function(height, mode) { - height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top; - return lineAtHeight(this.doc, height + this.display.viewOffset); - }, - heightAtLine: function(line, mode) { - var end = false, lineObj; - if (typeof line == "number") { - var last = this.doc.first + this.doc.size - 1; - if (line < this.doc.first) line = this.doc.first; - else if (line > last) { line = last; end = true; } - lineObj = getLine(this.doc, line); - } else { - lineObj = line; - } - return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page").top + - (end ? this.doc.height - heightAtLine(lineObj) : 0); - }, - - defaultTextHeight: function() { return textHeight(this.display); }, - defaultCharWidth: function() { return charWidth(this.display); }, - - setGutterMarker: methodOp(function(line, gutterID, value) { - return changeLine(this.doc, line, "gutter", function(line) { - var markers = line.gutterMarkers || (line.gutterMarkers = {}); - markers[gutterID] = value; - if (!value && isEmpty(markers)) line.gutterMarkers = null; - return true; - }); - }), - - clearGutter: methodOp(function(gutterID) { - var cm = this, doc = cm.doc, i = doc.first; - doc.iter(function(line) { - if (line.gutterMarkers && line.gutterMarkers[gutterID]) { - line.gutterMarkers[gutterID] = null; - regLineChange(cm, i, "gutter"); - if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null; - } - ++i; - }); - }), - - lineInfo: function(line) { - if (typeof line == "number") { - if (!isLine(this.doc, line)) return null; - var n = line; - line = getLine(this.doc, line); - if (!line) return null; - } else { - var n = lineNo(line); - if (n == null) return null; - } - return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers, - textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass, - widgets: line.widgets}; - }, - - getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo};}, - - addWidget: function(pos, node, scroll, vert, horiz) { - var display = this.display; - pos = cursorCoords(this, clipPos(this.doc, pos)); - var top = pos.bottom, left = pos.left; - node.style.position = "absolute"; - node.setAttribute("cm-ignore-events", "true"); - this.display.input.setUneditable(node); - display.sizer.appendChild(node); - if (vert == "over") { - top = pos.top; - } else if (vert == "above" || vert == "near") { - var vspace = Math.max(display.wrapper.clientHeight, this.doc.height), - hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth); - // Default to positioning above (if specified and possible); otherwise default to positioning below - if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) - top = pos.top - node.offsetHeight; - else if (pos.bottom + node.offsetHeight <= vspace) - top = pos.bottom; - if (left + node.offsetWidth > hspace) - left = hspace - node.offsetWidth; - } - node.style.top = top + "px"; - node.style.left = node.style.right = ""; - if (horiz == "right") { - left = display.sizer.clientWidth - node.offsetWidth; - node.style.right = "0px"; - } else { - if (horiz == "left") left = 0; - else if (horiz == "middle") left = (display.sizer.clientWidth - node.offsetWidth) / 2; - node.style.left = left + "px"; - } - if (scroll) - scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight); - }, - - triggerOnKeyDown: methodOp(onKeyDown), - triggerOnKeyPress: methodOp(onKeyPress), - triggerOnKeyUp: onKeyUp, - - execCommand: function(cmd) { - if (commands.hasOwnProperty(cmd)) - return commands[cmd].call(null, this); - }, - - triggerElectric: methodOp(function(text) { triggerElectric(this, text); }), - - findPosH: function(from, amount, unit, visually) { - var dir = 1; - if (amount < 0) { dir = -1; amount = -amount; } - for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) { - cur = findPosH(this.doc, cur, dir, unit, visually); - if (cur.hitSide) break; - } - return cur; - }, - - moveH: methodOp(function(dir, unit) { - var cm = this; - cm.extendSelectionsBy(function(range) { - if (cm.display.shift || cm.doc.extend || range.empty()) - return findPosH(cm.doc, range.head, dir, unit, cm.options.rtlMoveVisually); - else - return dir < 0 ? range.from() : range.to(); - }, sel_move); - }), - - deleteH: methodOp(function(dir, unit) { - var sel = this.doc.sel, doc = this.doc; - if (sel.somethingSelected()) - doc.replaceSelection("", null, "+delete"); - else - deleteNearSelection(this, function(range) { - var other = findPosH(doc, range.head, dir, unit, false); - return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}; - }); - }), - - findPosV: function(from, amount, unit, goalColumn) { - var dir = 1, x = goalColumn; - if (amount < 0) { dir = -1; amount = -amount; } - for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) { - var coords = cursorCoords(this, cur, "div"); - if (x == null) x = coords.left; - else coords.left = x; - cur = findPosV(this, coords, dir, unit); - if (cur.hitSide) break; - } - return cur; - }, - - moveV: methodOp(function(dir, unit) { - var cm = this, doc = this.doc, goals = []; - var collapse = !cm.display.shift && !doc.extend && doc.sel.somethingSelected(); - doc.extendSelectionsBy(function(range) { - if (collapse) - return dir < 0 ? range.from() : range.to(); - var headPos = cursorCoords(cm, range.head, "div"); - if (range.goalColumn != null) headPos.left = range.goalColumn; - goals.push(headPos.left); - var pos = findPosV(cm, headPos, dir, unit); - if (unit == "page" && range == doc.sel.primary()) - addToScrollPos(cm, null, charCoords(cm, pos, "div").top - headPos.top); - return pos; - }, sel_move); - if (goals.length) for (var i = 0; i < doc.sel.ranges.length; i++) - doc.sel.ranges[i].goalColumn = goals[i]; - }), - - // Find the word at the given position (as returned by coordsChar). - findWordAt: function(pos) { - var doc = this.doc, line = getLine(doc, pos.line).text; - var start = pos.ch, end = pos.ch; - if (line) { - var helper = this.getHelper(pos, "wordChars"); - if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end; - var startChar = line.charAt(start); - var check = isWordChar(startChar, helper) - ? function(ch) { return isWordChar(ch, helper); } - : /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} - : function(ch) {return !/\s/.test(ch) && !isWordChar(ch);}; - while (start > 0 && check(line.charAt(start - 1))) --start; - while (end < line.length && check(line.charAt(end))) ++end; - } - return new Range(Pos(pos.line, start), Pos(pos.line, end)); - }, - - toggleOverwrite: function(value) { - if (value != null && value == this.state.overwrite) return; - if (this.state.overwrite = !this.state.overwrite) - addClass(this.display.cursorDiv, "CodeMirror-overwrite"); - else - rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); - - signal(this, "overwriteToggle", this, this.state.overwrite); - }, - hasFocus: function() { return this.display.input.getField() == activeElt(); }, - isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit); }, - - scrollTo: methodOp(function(x, y) { - if (x != null || y != null) resolveScrollToPos(this); - if (x != null) this.curOp.scrollLeft = x; - if (y != null) this.curOp.scrollTop = y; - }), - getScrollInfo: function() { - var scroller = this.display.scroller; - return {left: scroller.scrollLeft, top: scroller.scrollTop, - height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight, - width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth, - clientHeight: displayHeight(this), clientWidth: displayWidth(this)}; - }, - - scrollIntoView: methodOp(function(range, margin) { - if (range == null) { - range = {from: this.doc.sel.primary().head, to: null}; - if (margin == null) margin = this.options.cursorScrollMargin; - } else if (typeof range == "number") { - range = {from: Pos(range, 0), to: null}; - } else if (range.from == null) { - range = {from: range, to: null}; - } - if (!range.to) range.to = range.from; - range.margin = margin || 0; - - if (range.from.line != null) { - resolveScrollToPos(this); - this.curOp.scrollToPos = range; - } else { - var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left), - Math.min(range.from.top, range.to.top) - range.margin, - Math.max(range.from.right, range.to.right), - Math.max(range.from.bottom, range.to.bottom) + range.margin); - this.scrollTo(sPos.scrollLeft, sPos.scrollTop); - } - }), - - setSize: methodOp(function(width, height) { - var cm = this; - function interpret(val) { - return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; - } - if (width != null) cm.display.wrapper.style.width = interpret(width); - if (height != null) cm.display.wrapper.style.height = interpret(height); - if (cm.options.lineWrapping) clearLineMeasurementCache(this); - var lineNo = cm.display.viewFrom; - cm.doc.iter(lineNo, cm.display.viewTo, function(line) { - if (line.widgets) for (var i = 0; i < line.widgets.length; i++) - if (line.widgets[i].noHScroll) { regLineChange(cm, lineNo, "widget"); break; } - ++lineNo; - }); - cm.curOp.forceUpdate = true; - signal(cm, "refresh", this); - }), - - operation: function(f){return runInOp(this, f);}, - - refresh: methodOp(function() { - var oldHeight = this.display.cachedTextHeight; - regChange(this); - this.curOp.forceUpdate = true; - clearCaches(this); - this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop); - updateGutterSpace(this); - if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5) - estimateLineHeights(this); - signal(this, "refresh", this); - }), - - swapDoc: methodOp(function(doc) { - var old = this.doc; - old.cm = null; - attachDoc(this, doc); - clearCaches(this); - this.display.input.reset(); - this.scrollTo(doc.scrollLeft, doc.scrollTop); - this.curOp.forceScroll = true; - signalLater(this, "swapDoc", this, old); - return old; - }), - - getInputField: function(){return this.display.input.getField();}, - getWrapperElement: function(){return this.display.wrapper;}, - getScrollerElement: function(){return this.display.scroller;}, - getGutterElement: function(){return this.display.gutters;} - }; - eventMixin(CodeMirror); - - // OPTION DEFAULTS - - // The default configuration options. - var defaults = CodeMirror.defaults = {}; - // Functions to run when options are changed. - var optionHandlers = CodeMirror.optionHandlers = {}; - - function option(name, deflt, handle, notOnInit) { - CodeMirror.defaults[name] = deflt; - if (handle) optionHandlers[name] = - notOnInit ? function(cm, val, old) {if (old != Init) handle(cm, val, old);} : handle; - } - - // Passed to option handlers when there is no old value. - var Init = CodeMirror.Init = {toString: function(){return "CodeMirror.Init";}}; - - // These two are, on init, called from the constructor because they - // have to be initialized before the editor can start at all. - option("value", "", function(cm, val) { - cm.setValue(val); - }, true); - option("mode", null, function(cm, val) { - cm.doc.modeOption = val; - loadMode(cm); - }, true); - - option("indentUnit", 2, loadMode, true); - option("indentWithTabs", false); - option("smartIndent", true); - option("tabSize", 4, function(cm) { - resetModeState(cm); - clearCaches(cm); - regChange(cm); - }, true); - option("lineSeparator", null, function(cm, val) { - cm.doc.lineSep = val; - if (!val) return; - var newBreaks = [], lineNo = cm.doc.first; - cm.doc.iter(function(line) { - for (var pos = 0;;) { - var found = line.text.indexOf(val, pos); - if (found == -1) break; - pos = found + val.length; - newBreaks.push(Pos(lineNo, found)); - } - lineNo++; - }); - for (var i = newBreaks.length - 1; i >= 0; i--) - replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)) - }); - option("specialChars", /[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g, function(cm, val, old) { - cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g"); - if (old != CodeMirror.Init) cm.refresh(); - }); - option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function(cm) {cm.refresh();}, true); - option("electricChars", true); - option("inputStyle", mobile ? "contenteditable" : "textarea", function() { - throw new Error("inputStyle can not (yet) be changed in a running editor"); // FIXME - }, true); - option("spellcheck", false, function(cm, val) { - cm.getInputField().spellcheck = val - }, true); - option("rtlMoveVisually", !windows); - option("wholeLineUpdateBefore", true); - - option("theme", "default", function(cm) { - themeChanged(cm); - guttersChanged(cm); - }, true); - option("keyMap", "default", function(cm, val, old) { - var next = getKeyMap(val); - var prev = old != CodeMirror.Init && getKeyMap(old); - if (prev && prev.detach) prev.detach(cm, next); - if (next.attach) next.attach(cm, prev || null); - }); - option("extraKeys", null); - - option("lineWrapping", false, wrappingChanged, true); - option("gutters", [], function(cm) { - setGuttersForLineNumbers(cm.options); - guttersChanged(cm); - }, true); - option("fixedGutter", true, function(cm, val) { - cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0"; - cm.refresh(); - }, true); - option("coverGutterNextToScrollbar", false, function(cm) {updateScrollbars(cm);}, true); - option("scrollbarStyle", "native", function(cm) { - initScrollbars(cm); - updateScrollbars(cm); - cm.display.scrollbars.setScrollTop(cm.doc.scrollTop); - cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft); - }, true); - option("lineNumbers", false, function(cm) { - setGuttersForLineNumbers(cm.options); - guttersChanged(cm); - }, true); - option("firstLineNumber", 1, guttersChanged, true); - option("lineNumberFormatter", function(integer) {return integer;}, guttersChanged, true); - option("showCursorWhenSelecting", false, updateSelection, true); - - option("resetSelectionOnContextMenu", true); - option("lineWiseCopyCut", true); - - option("readOnly", false, function(cm, val) { - if (val == "nocursor") { - onBlur(cm); - cm.display.input.blur(); - cm.display.disabled = true; - } else { - cm.display.disabled = false; - } - cm.display.input.readOnlyChanged(val) - }); - option("disableInput", false, function(cm, val) {if (!val) cm.display.input.reset();}, true); - option("dragDrop", true, dragDropChanged); - option("allowDropFileTypes", null); - - option("cursorBlinkRate", 530); - option("cursorScrollMargin", 0); - option("cursorHeight", 1, updateSelection, true); - option("singleCursorHeightPerLine", true, updateSelection, true); - option("workTime", 100); - option("workDelay", 100); - option("flattenSpans", true, resetModeState, true); - option("addModeClass", false, resetModeState, true); - option("pollInterval", 100); - option("undoDepth", 200, function(cm, val){cm.doc.history.undoDepth = val;}); - option("historyEventDelay", 1250); - option("viewportMargin", 10, function(cm){cm.refresh();}, true); - option("maxHighlightLength", 10000, resetModeState, true); - option("moveInputWithCursor", true, function(cm, val) { - if (!val) cm.display.input.resetPosition(); - }); - - option("tabindex", null, function(cm, val) { - cm.display.input.getField().tabIndex = val || ""; - }); - option("autofocus", null); - - // MODE DEFINITION AND QUERYING - - // Known modes, by name and by MIME - var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {}; - - // Extra arguments are stored as the mode's dependencies, which is - // used by (legacy) mechanisms like loadmode.js to automatically - // load a mode. (Preferred mechanism is the require/define calls.) - CodeMirror.defineMode = function(name, mode) { - if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name; - if (arguments.length > 2) - mode.dependencies = Array.prototype.slice.call(arguments, 2); - modes[name] = mode; - }; - - CodeMirror.defineMIME = function(mime, spec) { - mimeModes[mime] = spec; - }; - - // Given a MIME type, a {name, ...options} config object, or a name - // string, return a mode config object. - CodeMirror.resolveMode = function(spec) { - if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) { - spec = mimeModes[spec]; - } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) { - var found = mimeModes[spec.name]; - if (typeof found == "string") found = {name: found}; - spec = createObj(found, spec); - spec.name = found.name; - } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) { - return CodeMirror.resolveMode("application/xml"); - } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) { - return CodeMirror.resolveMode("application/json"); - } - if (typeof spec == "string") return {name: spec}; - else return spec || {name: "null"}; - }; - - // Given a mode spec (anything that resolveMode accepts), find and - // initialize an actual mode object. - CodeMirror.getMode = function(options, spec) { - var spec = CodeMirror.resolveMode(spec); - var mfactory = modes[spec.name]; - if (!mfactory) return CodeMirror.getMode(options, "text/plain"); - var modeObj = mfactory(options, spec); - if (modeExtensions.hasOwnProperty(spec.name)) { - var exts = modeExtensions[spec.name]; - for (var prop in exts) { - if (!exts.hasOwnProperty(prop)) continue; - if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop]; - modeObj[prop] = exts[prop]; - } - } - modeObj.name = spec.name; - if (spec.helperType) modeObj.helperType = spec.helperType; - if (spec.modeProps) for (var prop in spec.modeProps) - modeObj[prop] = spec.modeProps[prop]; - - return modeObj; - }; - - // Minimal default mode. - CodeMirror.defineMode("null", function() { - return {token: function(stream) {stream.skipToEnd();}}; - }); - CodeMirror.defineMIME("text/plain", "null"); - - // This can be used to attach properties to mode objects from - // outside the actual mode definition. - var modeExtensions = CodeMirror.modeExtensions = {}; - CodeMirror.extendMode = function(mode, properties) { - var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {}); - copyObj(properties, exts); - }; - - // EXTENSIONS - - CodeMirror.defineExtension = function(name, func) { - CodeMirror.prototype[name] = func; - }; - CodeMirror.defineDocExtension = function(name, func) { - Doc.prototype[name] = func; - }; - CodeMirror.defineOption = option; - - var initHooks = []; - CodeMirror.defineInitHook = function(f) {initHooks.push(f);}; - - var helpers = CodeMirror.helpers = {}; - CodeMirror.registerHelper = function(type, name, value) { - if (!helpers.hasOwnProperty(type)) helpers[type] = CodeMirror[type] = {_global: []}; - helpers[type][name] = value; - }; - CodeMirror.registerGlobalHelper = function(type, name, predicate, value) { - CodeMirror.registerHelper(type, name, value); - helpers[type]._global.push({pred: predicate, val: value}); - }; - - // MODE STATE HANDLING - - // Utility functions for working with state. Exported because nested - // modes need to do this for their inner modes. - - var copyState = CodeMirror.copyState = function(mode, state) { - if (state === true) return state; - if (mode.copyState) return mode.copyState(state); - var nstate = {}; - for (var n in state) { - var val = state[n]; - if (val instanceof Array) val = val.concat([]); - nstate[n] = val; - } - return nstate; - }; - - var startState = CodeMirror.startState = function(mode, a1, a2) { - return mode.startState ? mode.startState(a1, a2) : true; - }; - - // Given a mode and a state (for that mode), find the inner mode and - // state at the position that the state refers to. - CodeMirror.innerMode = function(mode, state) { - while (mode.innerMode) { - var info = mode.innerMode(state); - if (!info || info.mode == mode) break; - state = info.state; - mode = info.mode; - } - return info || {mode: mode, state: state}; - }; - - // STANDARD COMMANDS - - // Commands are parameter-less actions that can be performed on an - // editor, mostly used for keybindings. - var commands = CodeMirror.commands = { - selectAll: function(cm) {cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);}, - singleSelection: function(cm) { - cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); - }, - killLine: function(cm) { - deleteNearSelection(cm, function(range) { - if (range.empty()) { - var len = getLine(cm.doc, range.head.line).text.length; - if (range.head.ch == len && range.head.line < cm.lastLine()) - return {from: range.head, to: Pos(range.head.line + 1, 0)}; - else - return {from: range.head, to: Pos(range.head.line, len)}; - } else { - return {from: range.from(), to: range.to()}; - } - }); - }, - deleteLine: function(cm) { - deleteNearSelection(cm, function(range) { - return {from: Pos(range.from().line, 0), - to: clipPos(cm.doc, Pos(range.to().line + 1, 0))}; - }); - }, - delLineLeft: function(cm) { - deleteNearSelection(cm, function(range) { - return {from: Pos(range.from().line, 0), to: range.from()}; - }); - }, - delWrappedLineLeft: function(cm) { - deleteNearSelection(cm, function(range) { - var top = cm.charCoords(range.head, "div").top + 5; - var leftPos = cm.coordsChar({left: 0, top: top}, "div"); - return {from: leftPos, to: range.from()}; - }); - }, - delWrappedLineRight: function(cm) { - deleteNearSelection(cm, function(range) { - var top = cm.charCoords(range.head, "div").top + 5; - var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div"); - return {from: range.from(), to: rightPos }; - }); - }, - undo: function(cm) {cm.undo();}, - redo: function(cm) {cm.redo();}, - undoSelection: function(cm) {cm.undoSelection();}, - redoSelection: function(cm) {cm.redoSelection();}, - goDocStart: function(cm) {cm.extendSelection(Pos(cm.firstLine(), 0));}, - goDocEnd: function(cm) {cm.extendSelection(Pos(cm.lastLine()));}, - goLineStart: function(cm) { - cm.extendSelectionsBy(function(range) { return lineStart(cm, range.head.line); }, - {origin: "+move", bias: 1}); - }, - goLineStartSmart: function(cm) { - cm.extendSelectionsBy(function(range) { - return lineStartSmart(cm, range.head); - }, {origin: "+move", bias: 1}); - }, - goLineEnd: function(cm) { - cm.extendSelectionsBy(function(range) { return lineEnd(cm, range.head.line); }, - {origin: "+move", bias: -1}); - }, - goLineRight: function(cm) { - cm.extendSelectionsBy(function(range) { - var top = cm.charCoords(range.head, "div").top + 5; - return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div"); - }, sel_move); - }, - goLineLeft: function(cm) { - cm.extendSelectionsBy(function(range) { - var top = cm.charCoords(range.head, "div").top + 5; - return cm.coordsChar({left: 0, top: top}, "div"); - }, sel_move); - }, - goLineLeftSmart: function(cm) { - cm.extendSelectionsBy(function(range) { - var top = cm.charCoords(range.head, "div").top + 5; - var pos = cm.coordsChar({left: 0, top: top}, "div"); - if (pos.ch < cm.getLine(pos.line).search(/\S/)) return lineStartSmart(cm, range.head); - return pos; - }, sel_move); - }, - goLineUp: function(cm) {cm.moveV(-1, "line");}, - goLineDown: function(cm) {cm.moveV(1, "line");}, - goPageUp: function(cm) {cm.moveV(-1, "page");}, - goPageDown: function(cm) {cm.moveV(1, "page");}, - goCharLeft: function(cm) {cm.moveH(-1, "char");}, - goCharRight: function(cm) {cm.moveH(1, "char");}, - goColumnLeft: function(cm) {cm.moveH(-1, "column");}, - goColumnRight: function(cm) {cm.moveH(1, "column");}, - goWordLeft: function(cm) {cm.moveH(-1, "word");}, - goGroupRight: function(cm) {cm.moveH(1, "group");}, - goGroupLeft: function(cm) {cm.moveH(-1, "group");}, - goWordRight: function(cm) {cm.moveH(1, "word");}, - delCharBefore: function(cm) {cm.deleteH(-1, "char");}, - delCharAfter: function(cm) {cm.deleteH(1, "char");}, - delWordBefore: function(cm) {cm.deleteH(-1, "word");}, - delWordAfter: function(cm) {cm.deleteH(1, "word");}, - delGroupBefore: function(cm) {cm.deleteH(-1, "group");}, - delGroupAfter: function(cm) {cm.deleteH(1, "group");}, - indentAuto: function(cm) {cm.indentSelection("smart");}, - indentMore: function(cm) {cm.indentSelection("add");}, - indentLess: function(cm) {cm.indentSelection("subtract");}, - insertTab: function(cm) {cm.replaceSelection("\t");}, - insertSoftTab: function(cm) { - var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize; - for (var i = 0; i < ranges.length; i++) { - var pos = ranges[i].from(); - var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize); - spaces.push(spaceStr(tabSize - col % tabSize)); - } - cm.replaceSelections(spaces); - }, - defaultTab: function(cm) { - if (cm.somethingSelected()) cm.indentSelection("add"); - else cm.execCommand("insertTab"); - }, - transposeChars: function(cm) { - runInOp(cm, function() { - var ranges = cm.listSelections(), newSel = []; - for (var i = 0; i < ranges.length; i++) { - var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text; - if (line) { - if (cur.ch == line.length) cur = new Pos(cur.line, cur.ch - 1); - if (cur.ch > 0) { - cur = new Pos(cur.line, cur.ch + 1); - cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2), - Pos(cur.line, cur.ch - 2), cur, "+transpose"); - } else if (cur.line > cm.doc.first) { - var prev = getLine(cm.doc, cur.line - 1).text; - if (prev) - cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() + - prev.charAt(prev.length - 1), - Pos(cur.line - 1, prev.length - 1), Pos(cur.line, 1), "+transpose"); - } - } - newSel.push(new Range(cur, cur)); - } - cm.setSelections(newSel); - }); - }, - newlineAndIndent: function(cm) { - runInOp(cm, function() { - var len = cm.listSelections().length; - for (var i = 0; i < len; i++) { - var range = cm.listSelections()[i]; - cm.replaceRange(cm.doc.lineSeparator(), range.anchor, range.head, "+input"); - cm.indentLine(range.from().line + 1, null, true); - } - ensureCursorVisible(cm); - }); - }, - openLine: function(cm) {cm.replaceSelection("\n", "start")}, - toggleOverwrite: function(cm) {cm.toggleOverwrite();} - }; - - - // STANDARD KEYMAPS - - var keyMap = CodeMirror.keyMap = {}; - - keyMap.basic = { - "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown", - "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown", - "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore", - "Tab": "defaultTab", "Shift-Tab": "indentAuto", - "Enter": "newlineAndIndent", "Insert": "toggleOverwrite", - "Esc": "singleSelection" - }; - // Note that the save and find-related commands aren't defined by - // default. User code or addons can define them. Unknown commands - // are simply ignored. - keyMap.pcDefault = { - "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo", - "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown", - "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd", - "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find", - "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll", - "Ctrl-[": "indentLess", "Ctrl-]": "indentMore", - "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection", - fallthrough: "basic" - }; - // Very basic readline/emacs-style bindings, which are standard on Mac. - keyMap.emacsy = { - "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown", - "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", - "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", - "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars", - "Ctrl-O": "openLine" - }; - keyMap.macDefault = { - "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo", - "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft", - "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore", - "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find", - "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll", - "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight", - "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd", - fallthrough: ["basic", "emacsy"] - }; - keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault; - - // KEYMAP DISPATCH - - function normalizeKeyName(name) { - var parts = name.split(/-(?!$)/), name = parts[parts.length - 1]; - var alt, ctrl, shift, cmd; - for (var i = 0; i < parts.length - 1; i++) { - var mod = parts[i]; - if (/^(cmd|meta|m)$/i.test(mod)) cmd = true; - else if (/^a(lt)?$/i.test(mod)) alt = true; - else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true; - else if (/^s(hift)$/i.test(mod)) shift = true; - else throw new Error("Unrecognized modifier name: " + mod); - } - if (alt) name = "Alt-" + name; - if (ctrl) name = "Ctrl-" + name; - if (cmd) name = "Cmd-" + name; - if (shift) name = "Shift-" + name; - return name; - } - - // This is a kludge to keep keymaps mostly working as raw objects - // (backwards compatibility) while at the same time support features - // like normalization and multi-stroke key bindings. It compiles a - // new normalized keymap, and then updates the old object to reflect - // this. - CodeMirror.normalizeKeyMap = function(keymap) { - var copy = {}; - for (var keyname in keymap) if (keymap.hasOwnProperty(keyname)) { - var value = keymap[keyname]; - if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) continue; - if (value == "...") { delete keymap[keyname]; continue; } - - var keys = map(keyname.split(" "), normalizeKeyName); - for (var i = 0; i < keys.length; i++) { - var val, name; - if (i == keys.length - 1) { - name = keys.join(" "); - val = value; - } else { - name = keys.slice(0, i + 1).join(" "); - val = "..."; - } - var prev = copy[name]; - if (!prev) copy[name] = val; - else if (prev != val) throw new Error("Inconsistent bindings for " + name); - } - delete keymap[keyname]; - } - for (var prop in copy) keymap[prop] = copy[prop]; - return keymap; - }; - - var lookupKey = CodeMirror.lookupKey = function(key, map, handle, context) { - map = getKeyMap(map); - var found = map.call ? map.call(key, context) : map[key]; - if (found === false) return "nothing"; - if (found === "...") return "multi"; - if (found != null && handle(found)) return "handled"; - - if (map.fallthrough) { - if (Object.prototype.toString.call(map.fallthrough) != "[object Array]") - return lookupKey(key, map.fallthrough, handle, context); - for (var i = 0; i < map.fallthrough.length; i++) { - var result = lookupKey(key, map.fallthrough[i], handle, context); - if (result) return result; - } - } - }; - - // Modifier key presses don't count as 'real' key presses for the - // purpose of keymap fallthrough. - var isModifierKey = CodeMirror.isModifierKey = function(value) { - var name = typeof value == "string" ? value : keyNames[value.keyCode]; - return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"; - }; - - // Look up the name of a key as indicated by an event object. - var keyName = CodeMirror.keyName = function(event, noShift) { - if (presto && event.keyCode == 34 && event["char"]) return false; - var base = keyNames[event.keyCode], name = base; - if (name == null || event.altGraphKey) return false; - if (event.altKey && base != "Alt") name = "Alt-" + name; - if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") name = "Ctrl-" + name; - if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") name = "Cmd-" + name; - if (!noShift && event.shiftKey && base != "Shift") name = "Shift-" + name; - return name; - }; - - function getKeyMap(val) { - return typeof val == "string" ? keyMap[val] : val; - } - - // FROMTEXTAREA - - CodeMirror.fromTextArea = function(textarea, options) { - options = options ? copyObj(options) : {}; - options.value = textarea.value; - if (!options.tabindex && textarea.tabIndex) - options.tabindex = textarea.tabIndex; - if (!options.placeholder && textarea.placeholder) - options.placeholder = textarea.placeholder; - // Set autofocus to true if this textarea is focused, or if it has - // autofocus and no other element is focused. - if (options.autofocus == null) { - var hasFocus = activeElt(); - options.autofocus = hasFocus == textarea || - textarea.getAttribute("autofocus") != null && hasFocus == document.body; - } - - function save() {textarea.value = cm.getValue();} - if (textarea.form) { - on(textarea.form, "submit", save); - // Deplorable hack to make the submit method do the right thing. - if (!options.leaveSubmitMethodAlone) { - var form = textarea.form, realSubmit = form.submit; - try { - var wrappedSubmit = form.submit = function() { - save(); - form.submit = realSubmit; - form.submit(); - form.submit = wrappedSubmit; - }; - } catch(e) {} - } - } - - options.finishInit = function(cm) { - cm.save = save; - cm.getTextArea = function() { return textarea; }; - cm.toTextArea = function() { - cm.toTextArea = isNaN; // Prevent this from being ran twice - save(); - textarea.parentNode.removeChild(cm.getWrapperElement()); - textarea.style.display = ""; - if (textarea.form) { - off(textarea.form, "submit", save); - if (typeof textarea.form.submit == "function") - textarea.form.submit = realSubmit; - } - }; - }; - - textarea.style.display = "none"; - var cm = CodeMirror(function(node) { - textarea.parentNode.insertBefore(node, textarea.nextSibling); - }, options); - return cm; - }; - - // STRING STREAM - - // Fed to the mode parsers, provides helper functions to make - // parsers more succinct. - - var StringStream = CodeMirror.StringStream = function(string, tabSize) { - this.pos = this.start = 0; - this.string = string; - this.tabSize = tabSize || 8; - this.lastColumnPos = this.lastColumnValue = 0; - this.lineStart = 0; - }; - - StringStream.prototype = { - eol: function() {return this.pos >= this.string.length;}, - sol: function() {return this.pos == this.lineStart;}, - peek: function() {return this.string.charAt(this.pos) || undefined;}, - next: function() { - if (this.pos < this.string.length) - return this.string.charAt(this.pos++); - }, - eat: function(match) { - var ch = this.string.charAt(this.pos); - if (typeof match == "string") var ok = ch == match; - else var ok = ch && (match.test ? match.test(ch) : match(ch)); - if (ok) {++this.pos; return ch;} - }, - eatWhile: function(match) { - var start = this.pos; - while (this.eat(match)){} - return this.pos > start; - }, - eatSpace: function() { - var start = this.pos; - while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos; - return this.pos > start; - }, - skipToEnd: function() {this.pos = this.string.length;}, - skipTo: function(ch) { - var found = this.string.indexOf(ch, this.pos); - if (found > -1) {this.pos = found; return true;} - }, - backUp: function(n) {this.pos -= n;}, - column: function() { - if (this.lastColumnPos < this.start) { - this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue); - this.lastColumnPos = this.start; - } - return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0); - }, - indentation: function() { - return countColumn(this.string, null, this.tabSize) - - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0); - }, - match: function(pattern, consume, caseInsensitive) { - if (typeof pattern == "string") { - var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;}; - var substr = this.string.substr(this.pos, pattern.length); - if (cased(substr) == cased(pattern)) { - if (consume !== false) this.pos += pattern.length; - return true; - } - } else { - var match = this.string.slice(this.pos).match(pattern); - if (match && match.index > 0) return null; - if (match && consume !== false) this.pos += match[0].length; - return match; - } - }, - current: function(){return this.string.slice(this.start, this.pos);}, - hideFirstChars: function(n, inner) { - this.lineStart += n; - try { return inner(); } - finally { this.lineStart -= n; } - } - }; - - // TEXTMARKERS - - // Created with markText and setBookmark methods. A TextMarker is a - // handle that can be used to clear or find a marked position in the - // document. Line objects hold arrays (markedSpans) containing - // {from, to, marker} object pointing to such marker objects, and - // indicating that such a marker is present on that line. Multiple - // lines may point to the same marker when it spans across lines. - // The spans will have null for their from/to properties when the - // marker continues beyond the start/end of the line. Markers have - // links back to the lines they currently touch. - - var nextMarkerId = 0; - - var TextMarker = CodeMirror.TextMarker = function(doc, type) { - this.lines = []; - this.type = type; - this.doc = doc; - this.id = ++nextMarkerId; - }; - eventMixin(TextMarker); - - // Clear the marker. - TextMarker.prototype.clear = function() { - if (this.explicitlyCleared) return; - var cm = this.doc.cm, withOp = cm && !cm.curOp; - if (withOp) startOperation(cm); - if (hasHandler(this, "clear")) { - var found = this.find(); - if (found) signalLater(this, "clear", found.from, found.to); - } - var min = null, max = null; - for (var i = 0; i < this.lines.length; ++i) { - var line = this.lines[i]; - var span = getMarkedSpanFor(line.markedSpans, this); - if (cm && !this.collapsed) regLineChange(cm, lineNo(line), "text"); - else if (cm) { - if (span.to != null) max = lineNo(line); - if (span.from != null) min = lineNo(line); - } - line.markedSpans = removeMarkedSpan(line.markedSpans, span); - if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm) - updateLineHeight(line, textHeight(cm.display)); - } - if (cm && this.collapsed && !cm.options.lineWrapping) for (var i = 0; i < this.lines.length; ++i) { - var visual = visualLine(this.lines[i]), len = lineLength(visual); - if (len > cm.display.maxLineLength) { - cm.display.maxLine = visual; - cm.display.maxLineLength = len; - cm.display.maxLineChanged = true; - } - } - - if (min != null && cm && this.collapsed) regChange(cm, min, max + 1); - this.lines.length = 0; - this.explicitlyCleared = true; - if (this.atomic && this.doc.cantEdit) { - this.doc.cantEdit = false; - if (cm) reCheckSelection(cm.doc); - } - if (cm) signalLater(cm, "markerCleared", cm, this); - if (withOp) endOperation(cm); - if (this.parent) this.parent.clear(); - }; - - // Find the position of the marker in the document. Returns a {from, - // to} object by default. Side can be passed to get a specific side - // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the - // Pos objects returned contain a line object, rather than a line - // number (used to prevent looking up the same line twice). - TextMarker.prototype.find = function(side, lineObj) { - if (side == null && this.type == "bookmark") side = 1; - var from, to; - for (var i = 0; i < this.lines.length; ++i) { - var line = this.lines[i]; - var span = getMarkedSpanFor(line.markedSpans, this); - if (span.from != null) { - from = Pos(lineObj ? line : lineNo(line), span.from); - if (side == -1) return from; - } - if (span.to != null) { - to = Pos(lineObj ? line : lineNo(line), span.to); - if (side == 1) return to; - } - } - return from && {from: from, to: to}; - }; - - // Signals that the marker's widget changed, and surrounding layout - // should be recomputed. - TextMarker.prototype.changed = function() { - var pos = this.find(-1, true), widget = this, cm = this.doc.cm; - if (!pos || !cm) return; - runInOp(cm, function() { - var line = pos.line, lineN = lineNo(pos.line); - var view = findViewForLine(cm, lineN); - if (view) { - clearLineMeasurementCacheFor(view); - cm.curOp.selectionChanged = cm.curOp.forceUpdate = true; - } - cm.curOp.updateMaxLine = true; - if (!lineIsHidden(widget.doc, line) && widget.height != null) { - var oldHeight = widget.height; - widget.height = null; - var dHeight = widgetHeight(widget) - oldHeight; - if (dHeight) - updateLineHeight(line, line.height + dHeight); - } - }); - }; - - TextMarker.prototype.attachLine = function(line) { - if (!this.lines.length && this.doc.cm) { - var op = this.doc.cm.curOp; - if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1) - (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); - } - this.lines.push(line); - }; - TextMarker.prototype.detachLine = function(line) { - this.lines.splice(indexOf(this.lines, line), 1); - if (!this.lines.length && this.doc.cm) { - var op = this.doc.cm.curOp; - (op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this); - } - }; - - // Collapsed markers have unique ids, in order to be able to order - // them, which is needed for uniquely determining an outer marker - // when they overlap (they may nest, but not partially overlap). - var nextMarkerId = 0; - - // Create a marker, wire it up to the right lines, and - function markText(doc, from, to, options, type) { - // Shared markers (across linked documents) are handled separately - // (markTextShared will call out to this again, once per - // document). - if (options && options.shared) return markTextShared(doc, from, to, options, type); - // Ensure we are in an operation. - if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type); - - var marker = new TextMarker(doc, type), diff = cmp(from, to); - if (options) copyObj(options, marker, false); - // Don't connect empty markers unless clearWhenEmpty is false - if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false) - return marker; - if (marker.replacedWith) { - // Showing up as a widget implies collapsed (widget replaces text) - marker.collapsed = true; - marker.widgetNode = elt("span", [marker.replacedWith], "CodeMirror-widget"); - if (!options.handleMouseEvents) marker.widgetNode.setAttribute("cm-ignore-events", "true"); - if (options.insertLeft) marker.widgetNode.insertLeft = true; - } - if (marker.collapsed) { - if (conflictingCollapsedRange(doc, from.line, from, to, marker) || - from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker)) - throw new Error("Inserting collapsed marker partially overlapping an existing one"); - sawCollapsedSpans = true; - } - - if (marker.addToHistory) - addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); - - var curLine = from.line, cm = doc.cm, updateMaxLine; - doc.iter(curLine, to.line + 1, function(line) { - if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine) - updateMaxLine = true; - if (marker.collapsed && curLine != from.line) updateLineHeight(line, 0); - addMarkedSpan(line, new MarkedSpan(marker, - curLine == from.line ? from.ch : null, - curLine == to.line ? to.ch : null)); - ++curLine; - }); - // lineIsHidden depends on the presence of the spans, so needs a second pass - if (marker.collapsed) doc.iter(from.line, to.line + 1, function(line) { - if (lineIsHidden(doc, line)) updateLineHeight(line, 0); - }); - - if (marker.clearOnEnter) on(marker, "beforeCursorEnter", function() { marker.clear(); }); - - if (marker.readOnly) { - sawReadOnlySpans = true; - if (doc.history.done.length || doc.history.undone.length) - doc.clearHistory(); - } - if (marker.collapsed) { - marker.id = ++nextMarkerId; - marker.atomic = true; - } - if (cm) { - // Sync editor state - if (updateMaxLine) cm.curOp.updateMaxLine = true; - if (marker.collapsed) - regChange(cm, from.line, to.line + 1); - else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css) - for (var i = from.line; i <= to.line; i++) regLineChange(cm, i, "text"); - if (marker.atomic) reCheckSelection(cm.doc); - signalLater(cm, "markerAdded", cm, marker); - } - return marker; - } - - // SHARED TEXTMARKERS - - // A shared marker spans multiple linked documents. It is - // implemented as a meta-marker-object controlling multiple normal - // markers. - var SharedTextMarker = CodeMirror.SharedTextMarker = function(markers, primary) { - this.markers = markers; - this.primary = primary; - for (var i = 0; i < markers.length; ++i) - markers[i].parent = this; - }; - eventMixin(SharedTextMarker); - - SharedTextMarker.prototype.clear = function() { - if (this.explicitlyCleared) return; - this.explicitlyCleared = true; - for (var i = 0; i < this.markers.length; ++i) - this.markers[i].clear(); - signalLater(this, "clear"); - }; - SharedTextMarker.prototype.find = function(side, lineObj) { - return this.primary.find(side, lineObj); - }; - - function markTextShared(doc, from, to, options, type) { - options = copyObj(options); - options.shared = false; - var markers = [markText(doc, from, to, options, type)], primary = markers[0]; - var widget = options.widgetNode; - linkedDocs(doc, function(doc) { - if (widget) options.widgetNode = widget.cloneNode(true); - markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type)); - for (var i = 0; i < doc.linked.length; ++i) - if (doc.linked[i].isParent) return; - primary = lst(markers); - }); - return new SharedTextMarker(markers, primary); - } - - function findSharedMarkers(doc) { - return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), - function(m) { return m.parent; }); - } - - function copySharedMarkers(doc, markers) { - for (var i = 0; i < markers.length; i++) { - var marker = markers[i], pos = marker.find(); - var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to); - if (cmp(mFrom, mTo)) { - var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type); - marker.markers.push(subMark); - subMark.parent = marker; - } - } - } - - function detachSharedMarkers(markers) { - for (var i = 0; i < markers.length; i++) { - var marker = markers[i], linked = [marker.primary.doc];; - linkedDocs(marker.primary.doc, function(d) { linked.push(d); }); - for (var j = 0; j < marker.markers.length; j++) { - var subMarker = marker.markers[j]; - if (indexOf(linked, subMarker.doc) == -1) { - subMarker.parent = null; - marker.markers.splice(j--, 1); - } - } - } - } - - // TEXTMARKER SPANS - - function MarkedSpan(marker, from, to) { - this.marker = marker; - this.from = from; this.to = to; - } - - // Search an array of spans for a span matching the given marker. - function getMarkedSpanFor(spans, marker) { - if (spans) for (var i = 0; i < spans.length; ++i) { - var span = spans[i]; - if (span.marker == marker) return span; - } - } - // Remove a span from an array, returning undefined if no spans are - // left (we don't store arrays for lines without spans). - function removeMarkedSpan(spans, span) { - for (var r, i = 0; i < spans.length; ++i) - if (spans[i] != span) (r || (r = [])).push(spans[i]); - return r; - } - // Add a span to a line. - function addMarkedSpan(line, span) { - line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; - span.marker.attachLine(line); - } - - // Used for the algorithm that adjusts markers for a change in the - // document. These functions cut an array of spans at a given - // character position, returning an array of remaining chunks (or - // undefined if nothing remains). - function markedSpansBefore(old, startCh, isInsert) { - if (old) for (var i = 0, nw; i < old.length; ++i) { - var span = old[i], marker = span.marker; - var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh); - if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) { - var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh); - (nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to)); - } - } - return nw; - } - function markedSpansAfter(old, endCh, isInsert) { - if (old) for (var i = 0, nw; i < old.length; ++i) { - var span = old[i], marker = span.marker; - var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh); - if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) { - var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh); - (nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh, - span.to == null ? null : span.to - endCh)); - } - } - return nw; - } - - // Given a change object, compute the new set of marker spans that - // cover the line in which the change took place. Removes spans - // entirely within the change, reconnects spans belonging to the - // same marker that appear on both sides of the change, and cuts off - // spans partially within the change. Returns an array of span - // arrays with one element for each line in (after) the change. - function stretchSpansOverChange(doc, change) { - if (change.full) return null; - var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans; - var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans; - if (!oldFirst && !oldLast) return null; - - var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0; - // Get the spans that 'stick out' on both sides - var first = markedSpansBefore(oldFirst, startCh, isInsert); - var last = markedSpansAfter(oldLast, endCh, isInsert); - - // Next, merge those two ends - var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0); - if (first) { - // Fix up .to properties of first - for (var i = 0; i < first.length; ++i) { - var span = first[i]; - if (span.to == null) { - var found = getMarkedSpanFor(last, span.marker); - if (!found) span.to = startCh; - else if (sameLine) span.to = found.to == null ? null : found.to + offset; - } - } - } - if (last) { - // Fix up .from in last (or move them into first in case of sameLine) - for (var i = 0; i < last.length; ++i) { - var span = last[i]; - if (span.to != null) span.to += offset; - if (span.from == null) { - var found = getMarkedSpanFor(first, span.marker); - if (!found) { - span.from = offset; - if (sameLine) (first || (first = [])).push(span); - } - } else { - span.from += offset; - if (sameLine) (first || (first = [])).push(span); - } - } - } - // Make sure we didn't create any zero-length spans - if (first) first = clearEmptySpans(first); - if (last && last != first) last = clearEmptySpans(last); - - var newMarkers = [first]; - if (!sameLine) { - // Fill gap with whole-line-spans - var gap = change.text.length - 2, gapMarkers; - if (gap > 0 && first) - for (var i = 0; i < first.length; ++i) - if (first[i].to == null) - (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i].marker, null, null)); - for (var i = 0; i < gap; ++i) - newMarkers.push(gapMarkers); - newMarkers.push(last); - } - return newMarkers; - } - - // Remove spans that are empty and don't have a clearWhenEmpty - // option of false. - function clearEmptySpans(spans) { - for (var i = 0; i < spans.length; ++i) { - var span = spans[i]; - if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) - spans.splice(i--, 1); - } - if (!spans.length) return null; - return spans; - } - - // Used for un/re-doing changes from the history. Combines the - // result of computing the existing spans with the set of spans that - // existed in the history (so that deleting around a span and then - // undoing brings back the span). - function mergeOldSpans(doc, change) { - var old = getOldSpans(doc, change); - var stretched = stretchSpansOverChange(doc, change); - if (!old) return stretched; - if (!stretched) return old; - - for (var i = 0; i < old.length; ++i) { - var oldCur = old[i], stretchCur = stretched[i]; - if (oldCur && stretchCur) { - spans: for (var j = 0; j < stretchCur.length; ++j) { - var span = stretchCur[j]; - for (var k = 0; k < oldCur.length; ++k) - if (oldCur[k].marker == span.marker) continue spans; - oldCur.push(span); - } - } else if (stretchCur) { - old[i] = stretchCur; - } - } - return old; - } - - // Used to 'clip' out readOnly ranges when making a change. - function removeReadOnlyRanges(doc, from, to) { - var markers = null; - doc.iter(from.line, to.line + 1, function(line) { - if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) { - var mark = line.markedSpans[i].marker; - if (mark.readOnly && (!markers || indexOf(markers, mark) == -1)) - (markers || (markers = [])).push(mark); - } - }); - if (!markers) return null; - var parts = [{from: from, to: to}]; - for (var i = 0; i < markers.length; ++i) { - var mk = markers[i], m = mk.find(0); - for (var j = 0; j < parts.length; ++j) { - var p = parts[j]; - if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) continue; - var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to); - if (dfrom < 0 || !mk.inclusiveLeft && !dfrom) - newParts.push({from: p.from, to: m.from}); - if (dto > 0 || !mk.inclusiveRight && !dto) - newParts.push({from: m.to, to: p.to}); - parts.splice.apply(parts, newParts); - j += newParts.length - 1; - } - } - return parts; - } - - // Connect or disconnect spans from a line. - function detachMarkedSpans(line) { - var spans = line.markedSpans; - if (!spans) return; - for (var i = 0; i < spans.length; ++i) - spans[i].marker.detachLine(line); - line.markedSpans = null; - } - function attachMarkedSpans(line, spans) { - if (!spans) return; - for (var i = 0; i < spans.length; ++i) - spans[i].marker.attachLine(line); - line.markedSpans = spans; - } - - // Helpers used when computing which overlapping collapsed span - // counts as the larger one. - function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0; } - function extraRight(marker) { return marker.inclusiveRight ? 1 : 0; } - - // Returns a number indicating which of two overlapping collapsed - // spans is larger (and thus includes the other). Falls back to - // comparing ids when the spans cover exactly the same range. - function compareCollapsedMarkers(a, b) { - var lenDiff = a.lines.length - b.lines.length; - if (lenDiff != 0) return lenDiff; - var aPos = a.find(), bPos = b.find(); - var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b); - if (fromCmp) return -fromCmp; - var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b); - if (toCmp) return toCmp; - return b.id - a.id; - } - - // Find out whether a line ends or starts in a collapsed span. If - // so, return the marker for that span. - function collapsedSpanAtSide(line, start) { - var sps = sawCollapsedSpans && line.markedSpans, found; - if (sps) for (var sp, i = 0; i < sps.length; ++i) { - sp = sps[i]; - if (sp.marker.collapsed && (start ? sp.from : sp.to) == null && - (!found || compareCollapsedMarkers(found, sp.marker) < 0)) - found = sp.marker; - } - return found; - } - function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true); } - function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false); } - - // Test whether there exists a collapsed span that partially - // overlaps (covers the start or end, but not both) of a new span. - // Such overlap is not allowed. - function conflictingCollapsedRange(doc, lineNo, from, to, marker) { - var line = getLine(doc, lineNo); - var sps = sawCollapsedSpans && line.markedSpans; - if (sps) for (var i = 0; i < sps.length; ++i) { - var sp = sps[i]; - if (!sp.marker.collapsed) continue; - var found = sp.marker.find(0); - var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker); - var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker); - if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) continue; - if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) || - fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0)) - return true; - } - } - - // A visual line is a line as drawn on the screen. Folding, for - // example, can cause multiple logical lines to appear on the same - // visual line. This finds the start of the visual line that the - // given line is part of (usually that is the line itself). - function visualLine(line) { - var merged; - while (merged = collapsedSpanAtStart(line)) - line = merged.find(-1, true).line; - return line; - } - - // Returns an array of logical lines that continue the visual line - // started by the argument, or undefined if there are no such lines. - function visualLineContinued(line) { - var merged, lines; - while (merged = collapsedSpanAtEnd(line)) { - line = merged.find(1, true).line; - (lines || (lines = [])).push(line); - } - return lines; - } - - // Get the line number of the start of the visual line that the - // given line number is part of. - function visualLineNo(doc, lineN) { - var line = getLine(doc, lineN), vis = visualLine(line); - if (line == vis) return lineN; - return lineNo(vis); - } - // Get the line number of the start of the next visual line after - // the given line. - function visualLineEndNo(doc, lineN) { - if (lineN > doc.lastLine()) return lineN; - var line = getLine(doc, lineN), merged; - if (!lineIsHidden(doc, line)) return lineN; - while (merged = collapsedSpanAtEnd(line)) - line = merged.find(1, true).line; - return lineNo(line) + 1; - } - - // Compute whether a line is hidden. Lines count as hidden when they - // are part of a visual line that starts with another line, or when - // they are entirely covered by collapsed, non-widget span. - function lineIsHidden(doc, line) { - var sps = sawCollapsedSpans && line.markedSpans; - if (sps) for (var sp, i = 0; i < sps.length; ++i) { - sp = sps[i]; - if (!sp.marker.collapsed) continue; - if (sp.from == null) return true; - if (sp.marker.widgetNode) continue; - if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp)) - return true; - } - } - function lineIsHiddenInner(doc, line, span) { - if (span.to == null) { - var end = span.marker.find(1, true); - return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker)); - } - if (span.marker.inclusiveRight && span.to == line.text.length) - return true; - for (var sp, i = 0; i < line.markedSpans.length; ++i) { - sp = line.markedSpans[i]; - if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to && - (sp.to == null || sp.to != span.from) && - (sp.marker.inclusiveLeft || span.marker.inclusiveRight) && - lineIsHiddenInner(doc, line, sp)) return true; - } - } - - // LINE WIDGETS - - // Line widgets are block elements displayed above or below a line. - - var LineWidget = CodeMirror.LineWidget = function(doc, node, options) { - if (options) for (var opt in options) if (options.hasOwnProperty(opt)) - this[opt] = options[opt]; - this.doc = doc; - this.node = node; - }; - eventMixin(LineWidget); - - function adjustScrollWhenAboveVisible(cm, line, diff) { - if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop)) - addToScrollPos(cm, null, diff); - } - - LineWidget.prototype.clear = function() { - var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line); - if (no == null || !ws) return; - for (var i = 0; i < ws.length; ++i) if (ws[i] == this) ws.splice(i--, 1); - if (!ws.length) line.widgets = null; - var height = widgetHeight(this); - updateLineHeight(line, Math.max(0, line.height - height)); - if (cm) runInOp(cm, function() { - adjustScrollWhenAboveVisible(cm, line, -height); - regLineChange(cm, no, "widget"); - }); - }; - LineWidget.prototype.changed = function() { - var oldH = this.height, cm = this.doc.cm, line = this.line; - this.height = null; - var diff = widgetHeight(this) - oldH; - if (!diff) return; - updateLineHeight(line, line.height + diff); - if (cm) runInOp(cm, function() { - cm.curOp.forceUpdate = true; - adjustScrollWhenAboveVisible(cm, line, diff); - }); - }; - - function widgetHeight(widget) { - if (widget.height != null) return widget.height; - var cm = widget.doc.cm; - if (!cm) return 0; - if (!contains(document.body, widget.node)) { - var parentStyle = "position: relative;"; - if (widget.coverGutter) - parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; - if (widget.noHScroll) - parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; - removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle)); - } - return widget.height = widget.node.parentNode.offsetHeight; - } - - function addLineWidget(doc, handle, node, options) { - var widget = new LineWidget(doc, node, options); - var cm = doc.cm; - if (cm && widget.noHScroll) cm.display.alignWidgets = true; - changeLine(doc, handle, "widget", function(line) { - var widgets = line.widgets || (line.widgets = []); - if (widget.insertAt == null) widgets.push(widget); - else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); - widget.line = line; - if (cm && !lineIsHidden(doc, line)) { - var aboveVisible = heightAtLine(line) < doc.scrollTop; - updateLineHeight(line, line.height + widgetHeight(widget)); - if (aboveVisible) addToScrollPos(cm, null, widget.height); - cm.curOp.forceUpdate = true; - } - return true; - }); - return widget; - } - - // LINE DATA STRUCTURE - - // Line objects. These hold state related to a line, including - // highlighting info (the styles array). - var Line = CodeMirror.Line = function(text, markedSpans, estimateHeight) { - this.text = text; - attachMarkedSpans(this, markedSpans); - this.height = estimateHeight ? estimateHeight(this) : 1; - }; - eventMixin(Line); - Line.prototype.lineNo = function() { return lineNo(this); }; - - // Change the content (text, markers) of a line. Automatically - // invalidates cached information and tries to re-estimate the - // line's height. - function updateLine(line, text, markedSpans, estimateHeight) { - line.text = text; - if (line.stateAfter) line.stateAfter = null; - if (line.styles) line.styles = null; - if (line.order != null) line.order = null; - detachMarkedSpans(line); - attachMarkedSpans(line, markedSpans); - var estHeight = estimateHeight ? estimateHeight(line) : 1; - if (estHeight != line.height) updateLineHeight(line, estHeight); - } - - // Detach a line from the document tree and its markers. - function cleanUpLine(line) { - line.parent = null; - detachMarkedSpans(line); - } - - function extractLineClasses(type, output) { - if (type) for (;;) { - var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/); - if (!lineClass) break; - type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length); - var prop = lineClass[1] ? "bgClass" : "textClass"; - if (output[prop] == null) - output[prop] = lineClass[2]; - else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop])) - output[prop] += " " + lineClass[2]; - } - return type; - } - - function callBlankLine(mode, state) { - if (mode.blankLine) return mode.blankLine(state); - if (!mode.innerMode) return; - var inner = CodeMirror.innerMode(mode, state); - if (inner.mode.blankLine) return inner.mode.blankLine(inner.state); - } - - function readToken(mode, stream, state, inner) { - for (var i = 0; i < 10; i++) { - if (inner) inner[0] = CodeMirror.innerMode(mode, state).mode; - var style = mode.token(stream, state); - if (stream.pos > stream.start) return style; - } - throw new Error("Mode " + mode.name + " failed to advance stream."); - } - - // Utility for getTokenAt and getLineTokens - function takeToken(cm, pos, precise, asArray) { - function getObj(copy) { - return {start: stream.start, end: stream.pos, - string: stream.current(), - type: style || null, - state: copy ? copyState(doc.mode, state) : state}; - } - - var doc = cm.doc, mode = doc.mode, style; - pos = clipPos(doc, pos); - var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise); - var stream = new StringStream(line.text, cm.options.tabSize), tokens; - if (asArray) tokens = []; - while ((asArray || stream.pos < pos.ch) && !stream.eol()) { - stream.start = stream.pos; - style = readToken(mode, stream, state); - if (asArray) tokens.push(getObj(true)); - } - return asArray ? tokens : getObj(); - } - - // Run the given mode's parser over a line, calling f for each token. - function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) { - var flattenSpans = mode.flattenSpans; - if (flattenSpans == null) flattenSpans = cm.options.flattenSpans; - var curStart = 0, curStyle = null; - var stream = new StringStream(text, cm.options.tabSize), style; - var inner = cm.options.addModeClass && [null]; - if (text == "") extractLineClasses(callBlankLine(mode, state), lineClasses); - while (!stream.eol()) { - if (stream.pos > cm.options.maxHighlightLength) { - flattenSpans = false; - if (forceToEnd) processLine(cm, text, state, stream.pos); - stream.pos = text.length; - style = null; - } else { - style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses); - } - if (inner) { - var mName = inner[0].name; - if (mName) style = "m-" + (style ? mName + " " + style : mName); - } - if (!flattenSpans || curStyle != style) { - while (curStart < stream.start) { - curStart = Math.min(stream.start, curStart + 5000); - f(curStart, curStyle); - } - curStyle = style; - } - stream.start = stream.pos; - } - while (curStart < stream.pos) { - // Webkit seems to refuse to render text nodes longer than 57444 - // characters, and returns inaccurate measurements in nodes - // starting around 5000 chars. - var pos = Math.min(stream.pos, curStart + 5000); - f(pos, curStyle); - curStart = pos; - } - } - - // Compute a style array (an array starting with a mode generation - // -- for invalidation -- followed by pairs of end positions and - // style strings), which is used to highlight the tokens on the - // line. - function highlightLine(cm, line, state, forceToEnd) { - // A styles array always starts with a number identifying the - // mode/overlays that it is based on (for easy invalidation). - var st = [cm.state.modeGen], lineClasses = {}; - // Compute the base array of styles - runMode(cm, line.text, cm.doc.mode, state, function(end, style) { - st.push(end, style); - }, lineClasses, forceToEnd); - - // Run overlays, adjust style array. - for (var o = 0; o < cm.state.overlays.length; ++o) { - var overlay = cm.state.overlays[o], i = 1, at = 0; - runMode(cm, line.text, overlay.mode, true, function(end, style) { - var start = i; - // Ensure there's a token end at the current position, and that i points at it - while (at < end) { - var i_end = st[i]; - if (i_end > end) - st.splice(i, 1, end, st[i+1], i_end); - i += 2; - at = Math.min(end, i_end); - } - if (!style) return; - if (overlay.opaque) { - st.splice(start, i - start, end, "cm-overlay " + style); - i = start + 2; - } else { - for (; start < i; start += 2) { - var cur = st[start+1]; - st[start+1] = (cur ? cur + " " : "") + "cm-overlay " + style; - } - } - }, lineClasses); - } - - return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}; - } - - function getLineStyles(cm, line, updateFrontier) { - if (!line.styles || line.styles[0] != cm.state.modeGen) { - var state = getStateBefore(cm, lineNo(line)); - var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state); - line.stateAfter = state; - line.styles = result.styles; - if (result.classes) line.styleClasses = result.classes; - else if (line.styleClasses) line.styleClasses = null; - if (updateFrontier === cm.doc.frontier) cm.doc.frontier++; - } - return line.styles; - } - - // Lightweight form of highlight -- proceed over this line and - // update state, but don't save a style array. Used for lines that - // aren't currently visible. - function processLine(cm, text, state, startAt) { - var mode = cm.doc.mode; - var stream = new StringStream(text, cm.options.tabSize); - stream.start = stream.pos = startAt || 0; - if (text == "") callBlankLine(mode, state); - while (!stream.eol()) { - readToken(mode, stream, state); - stream.start = stream.pos; - } - } - - // Convert a style as returned by a mode (either null, or a string - // containing one or more styles) to a CSS style. This is cached, - // and also looks for line-wide styles. - var styleToClassCache = {}, styleToClassCacheWithMode = {}; - function interpretTokenStyle(style, options) { - if (!style || /^\s*$/.test(style)) return null; - var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache; - return cache[style] || - (cache[style] = style.replace(/\S+/g, "cm-$&")); - } - - // Render the DOM representation of the text of a line. Also builds - // up a 'line map', which points at the DOM nodes that represent - // specific stretches of text, and is used by the measuring code. - // The returned object contains the DOM node, this map, and - // information about line-wide styles that were set by the mode. - function buildLineContent(cm, lineView) { - // The padding-right forces the element to have a 'border', which - // is needed on Webkit to be able to get line-level bounding - // rectangles for it (in measureChar). - var content = elt("span", null, null, webkit ? "padding-right: .1px" : null); - var builder = {pre: elt("pre", [content], "CodeMirror-line"), content: content, - col: 0, pos: 0, cm: cm, - trailingSpace: false, - splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")}; - lineView.measure = {}; - - // Iterate over the logical lines that make up this visual line. - for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) { - var line = i ? lineView.rest[i - 1] : lineView.line, order; - builder.pos = 0; - builder.addToken = buildToken; - // Optionally wire in some hacks into the token-rendering - // algorithm, to deal with browser quirks. - if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line))) - builder.addToken = buildTokenBadBidi(builder.addToken, order); - builder.map = []; - var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line); - insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate)); - if (line.styleClasses) { - if (line.styleClasses.bgClass) - builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); - if (line.styleClasses.textClass) - builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); - } - - // Ensure at least a single node is present, for measuring. - if (builder.map.length == 0) - builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); - - // Store the map and a cache object for the current logical line - if (i == 0) { - lineView.measure.map = builder.map; - lineView.measure.cache = {}; - } else { - (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map); - (lineView.measure.caches || (lineView.measure.caches = [])).push({}); - } - } - - // See issue #2901 - if (webkit) { - var last = builder.content.lastChild - if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab"))) - builder.content.className = "cm-tab-wrap-hack"; - } - - signal(cm, "renderLine", cm, lineView.line, builder.pre); - if (builder.pre.className) - builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); - - return builder; - } - - function defaultSpecialCharPlaceholder(ch) { - var token = elt("span", "\u2022", "cm-invalidchar"); - token.title = "\\u" + ch.charCodeAt(0).toString(16); - token.setAttribute("aria-label", token.title); - return token; - } - - // Build up the DOM representation for a single token, and add it to - // the line map. Takes care to render special characters separately. - function buildToken(builder, text, style, startStyle, endStyle, title, css) { - if (!text) return; - var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text - var special = builder.cm.state.specialChars, mustWrap = false; - if (!special.test(text)) { - builder.col += text.length; - var content = document.createTextNode(displayText); - builder.map.push(builder.pos, builder.pos + text.length, content); - if (ie && ie_version < 9) mustWrap = true; - builder.pos += text.length; - } else { - var content = document.createDocumentFragment(), pos = 0; - while (true) { - special.lastIndex = pos; - var m = special.exec(text); - var skipped = m ? m.index - pos : text.length - pos; - if (skipped) { - var txt = document.createTextNode(displayText.slice(pos, pos + skipped)); - if (ie && ie_version < 9) content.appendChild(elt("span", [txt])); - else content.appendChild(txt); - builder.map.push(builder.pos, builder.pos + skipped, txt); - builder.col += skipped; - builder.pos += skipped; - } - if (!m) break; - pos += skipped + 1; - if (m[0] == "\t") { - var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize; - var txt = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab")); - txt.setAttribute("role", "presentation"); - txt.setAttribute("cm-text", "\t"); - builder.col += tabWidth; - } else if (m[0] == "\r" || m[0] == "\n") { - var txt = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar")); - txt.setAttribute("cm-text", m[0]); - builder.col += 1; - } else { - var txt = builder.cm.options.specialCharPlaceholder(m[0]); - txt.setAttribute("cm-text", m[0]); - if (ie && ie_version < 9) content.appendChild(elt("span", [txt])); - else content.appendChild(txt); - builder.col += 1; - } - builder.map.push(builder.pos, builder.pos + 1, txt); - builder.pos++; - } - } - builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32 - if (style || startStyle || endStyle || mustWrap || css) { - var fullStyle = style || ""; - if (startStyle) fullStyle += startStyle; - if (endStyle) fullStyle += endStyle; - var token = elt("span", [content], fullStyle, css); - if (title) token.title = title; - return builder.content.appendChild(token); - } - builder.content.appendChild(content); - } - - function splitSpaces(text, trailingBefore) { - if (text.length > 1 && !/ /.test(text)) return text - var spaceBefore = trailingBefore, result = "" - for (var i = 0; i < text.length; i++) { - var ch = text.charAt(i) - if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32)) - ch = "\u00a0" - result += ch - spaceBefore = ch == " " - } - return result - } - - // Work around nonsense dimensions being reported for stretches of - // right-to-left text. - function buildTokenBadBidi(inner, order) { - return function(builder, text, style, startStyle, endStyle, title, css) { - style = style ? style + " cm-force-border" : "cm-force-border"; - var start = builder.pos, end = start + text.length; - for (;;) { - // Find the part that overlaps with the start of this text - for (var i = 0; i < order.length; i++) { - var part = order[i]; - if (part.to > start && part.from <= start) break; - } - if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, title, css); - inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css); - startStyle = null; - text = text.slice(part.to - start); - start = part.to; - } - }; - } - - function buildCollapsedSpan(builder, size, marker, ignoreWidget) { - var widget = !ignoreWidget && marker.widgetNode; - if (widget) builder.map.push(builder.pos, builder.pos + size, widget); - if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) { - if (!widget) - widget = builder.content.appendChild(document.createElement("span")); - widget.setAttribute("cm-marker", marker.id); - } - if (widget) { - builder.cm.display.input.setUneditable(widget); - builder.content.appendChild(widget); - } - builder.pos += size; - builder.trailingSpace = false - } - - // Outputs a number of spans to make up a line, taking highlighting - // and marked text into account. - function insertLineContent(line, builder, styles) { - var spans = line.markedSpans, allText = line.text, at = 0; - if (!spans) { - for (var i = 1; i < styles.length; i+=2) - builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options)); - return; - } - - var len = allText.length, pos = 0, i = 1, text = "", style, css; - var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed; - for (;;) { - if (nextChange == pos) { // Update current marker set - spanStyle = spanEndStyle = spanStartStyle = title = css = ""; - collapsed = null; nextChange = Infinity; - var foundBookmarks = [], endStyles - for (var j = 0; j < spans.length; ++j) { - var sp = spans[j], m = sp.marker; - if (m.type == "bookmark" && sp.from == pos && m.widgetNode) { - foundBookmarks.push(m); - } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) { - if (sp.to != null && sp.to != pos && nextChange > sp.to) { - nextChange = sp.to; - spanEndStyle = ""; - } - if (m.className) spanStyle += " " + m.className; - if (m.css) css = (css ? css + ";" : "") + m.css; - if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle; - if (m.endStyle && sp.to == nextChange) (endStyles || (endStyles = [])).push(m.endStyle, sp.to) - if (m.title && !title) title = m.title; - if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) - collapsed = sp; - } else if (sp.from > pos && nextChange > sp.from) { - nextChange = sp.from; - } - } - if (endStyles) for (var j = 0; j < endStyles.length; j += 2) - if (endStyles[j + 1] == nextChange) spanEndStyle += " " + endStyles[j] - - if (!collapsed || collapsed.from == pos) for (var j = 0; j < foundBookmarks.length; ++j) - buildCollapsedSpan(builder, 0, foundBookmarks[j]); - if (collapsed && (collapsed.from || 0) == pos) { - buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos, - collapsed.marker, collapsed.from == null); - if (collapsed.to == null) return; - if (collapsed.to == pos) collapsed = false; - } - } - if (pos >= len) break; - - var upto = Math.min(len, nextChange); - while (true) { - if (text) { - var end = pos + text.length; - if (!collapsed) { - var tokenText = end > upto ? text.slice(0, upto - pos) : text; - builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle, - spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css); - } - if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;} - pos = end; - spanStartStyle = ""; - } - text = allText.slice(at, at = styles[i++]); - style = interpretTokenStyle(styles[i++], builder.cm.options); - } - } - } - - // DOCUMENT DATA STRUCTURE - - // By default, updates that start and end at the beginning of a line - // are treated specially, in order to make the association of line - // widgets and marker elements with the text behave more intuitive. - function isWholeLineUpdate(doc, change) { - return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" && - (!doc.cm || doc.cm.options.wholeLineUpdateBefore); - } - - // Perform a change on the document data structure. - function updateDoc(doc, change, markedSpans, estimateHeight) { - function spansFor(n) {return markedSpans ? markedSpans[n] : null;} - function update(line, text, spans) { - updateLine(line, text, spans, estimateHeight); - signalLater(line, "change", line, change); - } - function linesFor(start, end) { - for (var i = start, result = []; i < end; ++i) - result.push(new Line(text[i], spansFor(i), estimateHeight)); - return result; - } - - var from = change.from, to = change.to, text = change.text; - var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line); - var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line; - - // Adjust the line structure - if (change.full) { - doc.insert(0, linesFor(0, text.length)); - doc.remove(text.length, doc.size - text.length); - } else if (isWholeLineUpdate(doc, change)) { - // This is a whole-line replace. Treated specially to make - // sure line objects move the way they are supposed to. - var added = linesFor(0, text.length - 1); - update(lastLine, lastLine.text, lastSpans); - if (nlines) doc.remove(from.line, nlines); - if (added.length) doc.insert(from.line, added); - } else if (firstLine == lastLine) { - if (text.length == 1) { - update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans); - } else { - var added = linesFor(1, text.length - 1); - added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight)); - update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); - doc.insert(from.line + 1, added); - } - } else if (text.length == 1) { - update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0)); - doc.remove(from.line + 1, nlines); - } else { - update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); - update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans); - var added = linesFor(1, text.length - 1); - if (nlines > 1) doc.remove(from.line + 1, nlines - 1); - doc.insert(from.line + 1, added); - } - - signalLater(doc, "change", doc, change); - } - - // The document is represented as a BTree consisting of leaves, with - // chunk of lines in them, and branches, with up to ten leaves or - // other branch nodes below them. The top node is always a branch - // node, and is the document object itself (meaning it has - // additional methods and properties). - // - // All nodes have parent links. The tree is used both to go from - // line numbers to line objects, and to go from objects to numbers. - // It also indexes by height, and is used to convert between height - // and line object, and to find the total height of the document. - // - // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html - - function LeafChunk(lines) { - this.lines = lines; - this.parent = null; - for (var i = 0, height = 0; i < lines.length; ++i) { - lines[i].parent = this; - height += lines[i].height; - } - this.height = height; - } - - LeafChunk.prototype = { - chunkSize: function() { return this.lines.length; }, - // Remove the n lines at offset 'at'. - removeInner: function(at, n) { - for (var i = at, e = at + n; i < e; ++i) { - var line = this.lines[i]; - this.height -= line.height; - cleanUpLine(line); - signalLater(line, "delete"); - } - this.lines.splice(at, n); - }, - // Helper used to collapse a small branch into a single leaf. - collapse: function(lines) { - lines.push.apply(lines, this.lines); - }, - // Insert the given array of lines at offset 'at', count them as - // having the given height. - insertInner: function(at, lines, height) { - this.height += height; - this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at)); - for (var i = 0; i < lines.length; ++i) lines[i].parent = this; - }, - // Used to iterate over a part of the tree. - iterN: function(at, n, op) { - for (var e = at + n; at < e; ++at) - if (op(this.lines[at])) return true; - } - }; - - function BranchChunk(children) { - this.children = children; - var size = 0, height = 0; - for (var i = 0; i < children.length; ++i) { - var ch = children[i]; - size += ch.chunkSize(); height += ch.height; - ch.parent = this; - } - this.size = size; - this.height = height; - this.parent = null; - } - - BranchChunk.prototype = { - chunkSize: function() { return this.size; }, - removeInner: function(at, n) { - this.size -= n; - for (var i = 0; i < this.children.length; ++i) { - var child = this.children[i], sz = child.chunkSize(); - if (at < sz) { - var rm = Math.min(n, sz - at), oldHeight = child.height; - child.removeInner(at, rm); - this.height -= oldHeight - child.height; - if (sz == rm) { this.children.splice(i--, 1); child.parent = null; } - if ((n -= rm) == 0) break; - at = 0; - } else at -= sz; - } - // If the result is smaller than 25 lines, ensure that it is a - // single leaf node. - if (this.size - n < 25 && - (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) { - var lines = []; - this.collapse(lines); - this.children = [new LeafChunk(lines)]; - this.children[0].parent = this; - } - }, - collapse: function(lines) { - for (var i = 0; i < this.children.length; ++i) this.children[i].collapse(lines); - }, - insertInner: function(at, lines, height) { - this.size += lines.length; - this.height += height; - for (var i = 0; i < this.children.length; ++i) { - var child = this.children[i], sz = child.chunkSize(); - if (at <= sz) { - child.insertInner(at, lines, height); - if (child.lines && child.lines.length > 50) { - // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced. - // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest. - var remaining = child.lines.length % 25 + 25 - for (var pos = remaining; pos < child.lines.length;) { - var leaf = new LeafChunk(child.lines.slice(pos, pos += 25)); - child.height -= leaf.height; - this.children.splice(++i, 0, leaf); - leaf.parent = this; - } - child.lines = child.lines.slice(0, remaining); - this.maybeSpill(); - } - break; - } - at -= sz; - } - }, - // When a node has grown, check whether it should be split. - maybeSpill: function() { - if (this.children.length <= 10) return; - var me = this; - do { - var spilled = me.children.splice(me.children.length - 5, 5); - var sibling = new BranchChunk(spilled); - if (!me.parent) { // Become the parent node - var copy = new BranchChunk(me.children); - copy.parent = me; - me.children = [copy, sibling]; - me = copy; - } else { - me.size -= sibling.size; - me.height -= sibling.height; - var myIndex = indexOf(me.parent.children, me); - me.parent.children.splice(myIndex + 1, 0, sibling); - } - sibling.parent = me.parent; - } while (me.children.length > 10); - me.parent.maybeSpill(); - }, - iterN: function(at, n, op) { - for (var i = 0; i < this.children.length; ++i) { - var child = this.children[i], sz = child.chunkSize(); - if (at < sz) { - var used = Math.min(n, sz - at); - if (child.iterN(at, used, op)) return true; - if ((n -= used) == 0) break; - at = 0; - } else at -= sz; - } - } - }; - - var nextDocId = 0; - var Doc = CodeMirror.Doc = function(text, mode, firstLine, lineSep) { - if (!(this instanceof Doc)) return new Doc(text, mode, firstLine, lineSep); - if (firstLine == null) firstLine = 0; - - BranchChunk.call(this, [new LeafChunk([new Line("", null)])]); - this.first = firstLine; - this.scrollTop = this.scrollLeft = 0; - this.cantEdit = false; - this.cleanGeneration = 1; - this.frontier = firstLine; - var start = Pos(firstLine, 0); - this.sel = simpleSelection(start); - this.history = new History(null); - this.id = ++nextDocId; - this.modeOption = mode; - this.lineSep = lineSep; - this.extend = false; - - if (typeof text == "string") text = this.splitLines(text); - updateDoc(this, {from: start, to: start, text: text}); - setSelection(this, simpleSelection(start), sel_dontScroll); - }; - - Doc.prototype = createObj(BranchChunk.prototype, { - constructor: Doc, - // Iterate over the document. Supports two forms -- with only one - // argument, it calls that for each line in the document. With - // three, it iterates over the range given by the first two (with - // the second being non-inclusive). - iter: function(from, to, op) { - if (op) this.iterN(from - this.first, to - from, op); - else this.iterN(this.first, this.first + this.size, from); - }, - - // Non-public interface for adding and removing lines. - insert: function(at, lines) { - var height = 0; - for (var i = 0; i < lines.length; ++i) height += lines[i].height; - this.insertInner(at - this.first, lines, height); - }, - remove: function(at, n) { this.removeInner(at - this.first, n); }, - - // From here, the methods are part of the public interface. Most - // are also available from CodeMirror (editor) instances. - - getValue: function(lineSep) { - var lines = getLines(this, this.first, this.first + this.size); - if (lineSep === false) return lines; - return lines.join(lineSep || this.lineSeparator()); - }, - setValue: docMethodOp(function(code) { - var top = Pos(this.first, 0), last = this.first + this.size - 1; - makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length), - text: this.splitLines(code), origin: "setValue", full: true}, true); - setSelection(this, simpleSelection(top)); - }), - replaceRange: function(code, from, to, origin) { - from = clipPos(this, from); - to = to ? clipPos(this, to) : from; - replaceRange(this, code, from, to, origin); - }, - getRange: function(from, to, lineSep) { - var lines = getBetween(this, clipPos(this, from), clipPos(this, to)); - if (lineSep === false) return lines; - return lines.join(lineSep || this.lineSeparator()); - }, - - getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;}, - - getLineHandle: function(line) {if (isLine(this, line)) return getLine(this, line);}, - getLineNumber: function(line) {return lineNo(line);}, - - getLineHandleVisualStart: function(line) { - if (typeof line == "number") line = getLine(this, line); - return visualLine(line); - }, - - lineCount: function() {return this.size;}, - firstLine: function() {return this.first;}, - lastLine: function() {return this.first + this.size - 1;}, - - clipPos: function(pos) {return clipPos(this, pos);}, - - getCursor: function(start) { - var range = this.sel.primary(), pos; - if (start == null || start == "head") pos = range.head; - else if (start == "anchor") pos = range.anchor; - else if (start == "end" || start == "to" || start === false) pos = range.to(); - else pos = range.from(); - return pos; - }, - listSelections: function() { return this.sel.ranges; }, - somethingSelected: function() {return this.sel.somethingSelected();}, - - setCursor: docMethodOp(function(line, ch, options) { - setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options); - }), - setSelection: docMethodOp(function(anchor, head, options) { - setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options); - }), - extendSelection: docMethodOp(function(head, other, options) { - extendSelection(this, clipPos(this, head), other && clipPos(this, other), options); - }), - extendSelections: docMethodOp(function(heads, options) { - extendSelections(this, clipPosArray(this, heads), options); - }), - extendSelectionsBy: docMethodOp(function(f, options) { - var heads = map(this.sel.ranges, f); - extendSelections(this, clipPosArray(this, heads), options); - }), - setSelections: docMethodOp(function(ranges, primary, options) { - if (!ranges.length) return; - for (var i = 0, out = []; i < ranges.length; i++) - out[i] = new Range(clipPos(this, ranges[i].anchor), - clipPos(this, ranges[i].head)); - if (primary == null) primary = Math.min(ranges.length - 1, this.sel.primIndex); - setSelection(this, normalizeSelection(out, primary), options); - }), - addSelection: docMethodOp(function(anchor, head, options) { - var ranges = this.sel.ranges.slice(0); - ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor))); - setSelection(this, normalizeSelection(ranges, ranges.length - 1), options); - }), - - getSelection: function(lineSep) { - var ranges = this.sel.ranges, lines; - for (var i = 0; i < ranges.length; i++) { - var sel = getBetween(this, ranges[i].from(), ranges[i].to()); - lines = lines ? lines.concat(sel) : sel; - } - if (lineSep === false) return lines; - else return lines.join(lineSep || this.lineSeparator()); - }, - getSelections: function(lineSep) { - var parts = [], ranges = this.sel.ranges; - for (var i = 0; i < ranges.length; i++) { - var sel = getBetween(this, ranges[i].from(), ranges[i].to()); - if (lineSep !== false) sel = sel.join(lineSep || this.lineSeparator()); - parts[i] = sel; - } - return parts; - }, - replaceSelection: function(code, collapse, origin) { - var dup = []; - for (var i = 0; i < this.sel.ranges.length; i++) - dup[i] = code; - this.replaceSelections(dup, collapse, origin || "+input"); - }, - replaceSelections: docMethodOp(function(code, collapse, origin) { - var changes = [], sel = this.sel; - for (var i = 0; i < sel.ranges.length; i++) { - var range = sel.ranges[i]; - changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin}; - } - var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse); - for (var i = changes.length - 1; i >= 0; i--) - makeChange(this, changes[i]); - if (newSel) setSelectionReplaceHistory(this, newSel); - else if (this.cm) ensureCursorVisible(this.cm); - }), - undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}), - redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}), - undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}), - redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}), - - setExtending: function(val) {this.extend = val;}, - getExtending: function() {return this.extend;}, - - historySize: function() { - var hist = this.history, done = 0, undone = 0; - for (var i = 0; i < hist.done.length; i++) if (!hist.done[i].ranges) ++done; - for (var i = 0; i < hist.undone.length; i++) if (!hist.undone[i].ranges) ++undone; - return {undo: done, redo: undone}; - }, - clearHistory: function() {this.history = new History(this.history.maxGeneration);}, - - markClean: function() { - this.cleanGeneration = this.changeGeneration(true); - }, - changeGeneration: function(forceSplit) { - if (forceSplit) - this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; - return this.history.generation; - }, - isClean: function (gen) { - return this.history.generation == (gen || this.cleanGeneration); - }, - - getHistory: function() { - return {done: copyHistoryArray(this.history.done), - undone: copyHistoryArray(this.history.undone)}; - }, - setHistory: function(histData) { - var hist = this.history = new History(this.history.maxGeneration); - hist.done = copyHistoryArray(histData.done.slice(0), null, true); - hist.undone = copyHistoryArray(histData.undone.slice(0), null, true); - }, - - addLineClass: docMethodOp(function(handle, where, cls) { - return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function(line) { - var prop = where == "text" ? "textClass" - : where == "background" ? "bgClass" - : where == "gutter" ? "gutterClass" : "wrapClass"; - if (!line[prop]) line[prop] = cls; - else if (classTest(cls).test(line[prop])) return false; - else line[prop] += " " + cls; - return true; - }); - }), - removeLineClass: docMethodOp(function(handle, where, cls) { - return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function(line) { - var prop = where == "text" ? "textClass" - : where == "background" ? "bgClass" - : where == "gutter" ? "gutterClass" : "wrapClass"; - var cur = line[prop]; - if (!cur) return false; - else if (cls == null) line[prop] = null; - else { - var found = cur.match(classTest(cls)); - if (!found) return false; - var end = found.index + found[0].length; - line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null; - } - return true; - }); - }), - - addLineWidget: docMethodOp(function(handle, node, options) { - return addLineWidget(this, handle, node, options); - }), - removeLineWidget: function(widget) { widget.clear(); }, - - markText: function(from, to, options) { - return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range"); - }, - setBookmark: function(pos, options) { - var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options), - insertLeft: options && options.insertLeft, - clearWhenEmpty: false, shared: options && options.shared, - handleMouseEvents: options && options.handleMouseEvents}; - pos = clipPos(this, pos); - return markText(this, pos, pos, realOpts, "bookmark"); - }, - findMarksAt: function(pos) { - pos = clipPos(this, pos); - var markers = [], spans = getLine(this, pos.line).markedSpans; - if (spans) for (var i = 0; i < spans.length; ++i) { - var span = spans[i]; - if ((span.from == null || span.from <= pos.ch) && - (span.to == null || span.to >= pos.ch)) - markers.push(span.marker.parent || span.marker); - } - return markers; - }, - findMarks: function(from, to, filter) { - from = clipPos(this, from); to = clipPos(this, to); - var found = [], lineNo = from.line; - this.iter(from.line, to.line + 1, function(line) { - var spans = line.markedSpans; - if (spans) for (var i = 0; i < spans.length; i++) { - var span = spans[i]; - if (!(span.to != null && lineNo == from.line && from.ch >= span.to || - span.from == null && lineNo != from.line || - span.from != null && lineNo == to.line && span.from >= to.ch) && - (!filter || filter(span.marker))) - found.push(span.marker.parent || span.marker); - } - ++lineNo; - }); - return found; - }, - getAllMarks: function() { - var markers = []; - this.iter(function(line) { - var sps = line.markedSpans; - if (sps) for (var i = 0; i < sps.length; ++i) - if (sps[i].from != null) markers.push(sps[i].marker); - }); - return markers; - }, - - posFromIndex: function(off) { - var ch, lineNo = this.first, sepSize = this.lineSeparator().length; - this.iter(function(line) { - var sz = line.text.length + sepSize; - if (sz > off) { ch = off; return true; } - off -= sz; - ++lineNo; - }); - return clipPos(this, Pos(lineNo, ch)); - }, - indexFromPos: function (coords) { - coords = clipPos(this, coords); - var index = coords.ch; - if (coords.line < this.first || coords.ch < 0) return 0; - var sepSize = this.lineSeparator().length; - this.iter(this.first, coords.line, function (line) { - index += line.text.length + sepSize; - }); - return index; - }, - - copy: function(copyHistory) { - var doc = new Doc(getLines(this, this.first, this.first + this.size), - this.modeOption, this.first, this.lineSep); - doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft; - doc.sel = this.sel; - doc.extend = false; - if (copyHistory) { - doc.history.undoDepth = this.history.undoDepth; - doc.setHistory(this.getHistory()); - } - return doc; - }, - - linkedDoc: function(options) { - if (!options) options = {}; - var from = this.first, to = this.first + this.size; - if (options.from != null && options.from > from) from = options.from; - if (options.to != null && options.to < to) to = options.to; - var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep); - if (options.sharedHist) copy.history = this.history; - (this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist}); - copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}]; - copySharedMarkers(copy, findSharedMarkers(this)); - return copy; - }, - unlinkDoc: function(other) { - if (other instanceof CodeMirror) other = other.doc; - if (this.linked) for (var i = 0; i < this.linked.length; ++i) { - var link = this.linked[i]; - if (link.doc != other) continue; - this.linked.splice(i, 1); - other.unlinkDoc(this); - detachSharedMarkers(findSharedMarkers(this)); - break; - } - // If the histories were shared, split them again - if (other.history == this.history) { - var splitIds = [other.id]; - linkedDocs(other, function(doc) {splitIds.push(doc.id);}, true); - other.history = new History(null); - other.history.done = copyHistoryArray(this.history.done, splitIds); - other.history.undone = copyHistoryArray(this.history.undone, splitIds); - } - }, - iterLinkedDocs: function(f) {linkedDocs(this, f);}, - - getMode: function() {return this.mode;}, - getEditor: function() {return this.cm;}, - - splitLines: function(str) { - if (this.lineSep) return str.split(this.lineSep); - return splitLinesAuto(str); - }, - lineSeparator: function() { return this.lineSep || "\n"; } - }); - - // Public alias. - Doc.prototype.eachLine = Doc.prototype.iter; - - // Set up methods on CodeMirror's prototype to redirect to the editor's document. - var dontDelegate = "iter insert remove copy getEditor constructor".split(" "); - for (var prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0) - CodeMirror.prototype[prop] = (function(method) { - return function() {return method.apply(this.doc, arguments);}; - })(Doc.prototype[prop]); - - eventMixin(Doc); - - // Call f for all linked documents. - function linkedDocs(doc, f, sharedHistOnly) { - function propagate(doc, skip, sharedHist) { - if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) { - var rel = doc.linked[i]; - if (rel.doc == skip) continue; - var shared = sharedHist && rel.sharedHist; - if (sharedHistOnly && !shared) continue; - f(rel.doc, shared); - propagate(rel.doc, doc, shared); - } - } - propagate(doc, null, true); - } - - // Attach a document to an editor. - function attachDoc(cm, doc) { - if (doc.cm) throw new Error("This document is already in use."); - cm.doc = doc; - doc.cm = cm; - estimateLineHeights(cm); - loadMode(cm); - if (!cm.options.lineWrapping) findMaxLine(cm); - cm.options.mode = doc.modeOption; - regChange(cm); - } - - // LINE UTILITIES - - // Find the line object corresponding to the given line number. - function getLine(doc, n) { - n -= doc.first; - if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document."); - for (var chunk = doc; !chunk.lines;) { - for (var i = 0;; ++i) { - var child = chunk.children[i], sz = child.chunkSize(); - if (n < sz) { chunk = child; break; } - n -= sz; - } - } - return chunk.lines[n]; - } - - // Get the part of a document between two positions, as an array of - // strings. - function getBetween(doc, start, end) { - var out = [], n = start.line; - doc.iter(start.line, end.line + 1, function(line) { - var text = line.text; - if (n == end.line) text = text.slice(0, end.ch); - if (n == start.line) text = text.slice(start.ch); - out.push(text); - ++n; - }); - return out; - } - // Get the lines between from and to, as array of strings. - function getLines(doc, from, to) { - var out = []; - doc.iter(from, to, function(line) { out.push(line.text); }); - return out; - } - - // Update the height of a line, propagating the height change - // upwards to parent nodes. - function updateLineHeight(line, height) { - var diff = height - line.height; - if (diff) for (var n = line; n; n = n.parent) n.height += diff; - } - - // Given a line object, find its line number by walking up through - // its parent links. - function lineNo(line) { - if (line.parent == null) return null; - var cur = line.parent, no = indexOf(cur.lines, line); - for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { - for (var i = 0;; ++i) { - if (chunk.children[i] == cur) break; - no += chunk.children[i].chunkSize(); - } - } - return no + cur.first; - } - - // Find the line at the given vertical position, using the height - // information in the document tree. - function lineAtHeight(chunk, h) { - var n = chunk.first; - outer: do { - for (var i = 0; i < chunk.children.length; ++i) { - var child = chunk.children[i], ch = child.height; - if (h < ch) { chunk = child; continue outer; } - h -= ch; - n += child.chunkSize(); - } - return n; - } while (!chunk.lines); - for (var i = 0; i < chunk.lines.length; ++i) { - var line = chunk.lines[i], lh = line.height; - if (h < lh) break; - h -= lh; - } - return n + i; - } - - - // Find the height above the given line. - function heightAtLine(lineObj) { - lineObj = visualLine(lineObj); - - var h = 0, chunk = lineObj.parent; - for (var i = 0; i < chunk.lines.length; ++i) { - var line = chunk.lines[i]; - if (line == lineObj) break; - else h += line.height; - } - for (var p = chunk.parent; p; chunk = p, p = chunk.parent) { - for (var i = 0; i < p.children.length; ++i) { - var cur = p.children[i]; - if (cur == chunk) break; - else h += cur.height; - } - } - return h; - } - - // Get the bidi ordering for the given line (and cache it). Returns - // false for lines that are fully left-to-right, and an array of - // BidiSpan objects otherwise. - function getOrder(line) { - var order = line.order; - if (order == null) order = line.order = bidiOrdering(line.text); - return order; - } - - // HISTORY - - function History(startGen) { - // Arrays of change events and selections. Doing something adds an - // event to done and clears undo. Undoing moves events from done - // to undone, redoing moves them in the other direction. - this.done = []; this.undone = []; - this.undoDepth = Infinity; - // Used to track when changes can be merged into a single undo - // event - this.lastModTime = this.lastSelTime = 0; - this.lastOp = this.lastSelOp = null; - this.lastOrigin = this.lastSelOrigin = null; - // Used by the isClean() method - this.generation = this.maxGeneration = startGen || 1; - } - - // Create a history change event from an updateDoc-style change - // object. - function historyChangeFromChange(doc, change) { - var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}; - attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); - linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true); - return histChange; - } - - // Pop all selection events off the end of a history array. Stop at - // a change event. - function clearSelectionEvents(array) { - while (array.length) { - var last = lst(array); - if (last.ranges) array.pop(); - else break; - } - } - - // Find the top change event in the history. Pop off selection - // events that are in the way. - function lastChangeEvent(hist, force) { - if (force) { - clearSelectionEvents(hist.done); - return lst(hist.done); - } else if (hist.done.length && !lst(hist.done).ranges) { - return lst(hist.done); - } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) { - hist.done.pop(); - return lst(hist.done); - } - } - - // Register a change in the history. Merges changes that are within - // a single operation, or are close together with an origin that - // allows merging (starting with "+") into a single event. - function addChangeToHistory(doc, change, selAfter, opId) { - var hist = doc.history; - hist.undone.length = 0; - var time = +new Date, cur; - - if ((hist.lastOp == opId || - hist.lastOrigin == change.origin && change.origin && - ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) || - change.origin.charAt(0) == "*")) && - (cur = lastChangeEvent(hist, hist.lastOp == opId))) { - // Merge this change into the last event - var last = lst(cur.changes); - if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) { - // Optimized case for simple insertion -- don't want to add - // new changesets for every character typed - last.to = changeEnd(change); - } else { - // Add new sub-event - cur.changes.push(historyChangeFromChange(doc, change)); - } - } else { - // Can not be merged, start a new event. - var before = lst(hist.done); - if (!before || !before.ranges) - pushSelectionToHistory(doc.sel, hist.done); - cur = {changes: [historyChangeFromChange(doc, change)], - generation: hist.generation}; - hist.done.push(cur); - while (hist.done.length > hist.undoDepth) { - hist.done.shift(); - if (!hist.done[0].ranges) hist.done.shift(); - } - } - hist.done.push(selAfter); - hist.generation = ++hist.maxGeneration; - hist.lastModTime = hist.lastSelTime = time; - hist.lastOp = hist.lastSelOp = opId; - hist.lastOrigin = hist.lastSelOrigin = change.origin; - - if (!last) signal(doc, "historyAdded"); - } - - function selectionEventCanBeMerged(doc, origin, prev, sel) { - var ch = origin.charAt(0); - return ch == "*" || - ch == "+" && - prev.ranges.length == sel.ranges.length && - prev.somethingSelected() == sel.somethingSelected() && - new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500); - } - - // Called whenever the selection changes, sets the new selection as - // the pending selection in the history, and pushes the old pending - // selection into the 'done' array when it was significantly - // different (in number of selected ranges, emptiness, or time). - function addSelectionToHistory(doc, sel, opId, options) { - var hist = doc.history, origin = options && options.origin; - - // A new event is started when the previous origin does not match - // the current, or the origins don't allow matching. Origins - // starting with * are always merged, those starting with + are - // merged when similar and close together in time. - if (opId == hist.lastSelOp || - (origin && hist.lastSelOrigin == origin && - (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin || - selectionEventCanBeMerged(doc, origin, lst(hist.done), sel)))) - hist.done[hist.done.length - 1] = sel; - else - pushSelectionToHistory(sel, hist.done); - - hist.lastSelTime = +new Date; - hist.lastSelOrigin = origin; - hist.lastSelOp = opId; - if (options && options.clearRedo !== false) - clearSelectionEvents(hist.undone); - } - - function pushSelectionToHistory(sel, dest) { - var top = lst(dest); - if (!(top && top.ranges && top.equals(sel))) - dest.push(sel); - } - - // Used to store marked span information in the history. - function attachLocalSpans(doc, change, from, to) { - var existing = change["spans_" + doc.id], n = 0; - doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) { - if (line.markedSpans) - (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; - ++n; - }); - } - - // When un/re-doing restores text containing marked spans, those - // that have been explicitly cleared should not be restored. - function removeClearedSpans(spans) { - if (!spans) return null; - for (var i = 0, out; i < spans.length; ++i) { - if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); } - else if (out) out.push(spans[i]); - } - return !out ? spans : out.length ? out : null; - } - - // Retrieve and filter the old marked spans stored in a change event. - function getOldSpans(doc, change) { - var found = change["spans_" + doc.id]; - if (!found) return null; - for (var i = 0, nw = []; i < change.text.length; ++i) - nw.push(removeClearedSpans(found[i])); - return nw; - } - - // Used both to provide a JSON-safe object in .getHistory, and, when - // detaching a document, to split the history in two - function copyHistoryArray(events, newGroup, instantiateSel) { - for (var i = 0, copy = []; i < events.length; ++i) { - var event = events[i]; - if (event.ranges) { - copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event); - continue; - } - var changes = event.changes, newChanges = []; - copy.push({changes: newChanges}); - for (var j = 0; j < changes.length; ++j) { - var change = changes[j], m; - newChanges.push({from: change.from, to: change.to, text: change.text}); - if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\d+)$/)) { - if (indexOf(newGroup, Number(m[1])) > -1) { - lst(newChanges)[prop] = change[prop]; - delete change[prop]; - } - } - } - } - return copy; - } - - // Rebasing/resetting history to deal with externally-sourced changes - - function rebaseHistSelSingle(pos, from, to, diff) { - if (to < pos.line) { - pos.line += diff; - } else if (from < pos.line) { - pos.line = from; - pos.ch = 0; - } - } - - // Tries to rebase an array of history events given a change in the - // document. If the change touches the same lines as the event, the - // event, and everything 'behind' it, is discarded. If the change is - // before the event, the event's positions are updated. Uses a - // copy-on-write scheme for the positions, to avoid having to - // reallocate them all on every rebase, but also avoid problems with - // shared position objects being unsafely updated. - function rebaseHistArray(array, from, to, diff) { - for (var i = 0; i < array.length; ++i) { - var sub = array[i], ok = true; - if (sub.ranges) { - if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; } - for (var j = 0; j < sub.ranges.length; j++) { - rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff); - rebaseHistSelSingle(sub.ranges[j].head, from, to, diff); - } - continue; - } - for (var j = 0; j < sub.changes.length; ++j) { - var cur = sub.changes[j]; - if (to < cur.from.line) { - cur.from = Pos(cur.from.line + diff, cur.from.ch); - cur.to = Pos(cur.to.line + diff, cur.to.ch); - } else if (from <= cur.to.line) { - ok = false; - break; - } - } - if (!ok) { - array.splice(0, i + 1); - i = 0; - } - } - } - - function rebaseHist(hist, change) { - var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1; - rebaseHistArray(hist.done, from, to, diff); - rebaseHistArray(hist.undone, from, to, diff); - } - - // EVENT UTILITIES - - // Due to the fact that we still support jurassic IE versions, some - // compatibility wrappers are needed. - - var e_preventDefault = CodeMirror.e_preventDefault = function(e) { - if (e.preventDefault) e.preventDefault(); - else e.returnValue = false; - }; - var e_stopPropagation = CodeMirror.e_stopPropagation = function(e) { - if (e.stopPropagation) e.stopPropagation(); - else e.cancelBubble = true; - }; - function e_defaultPrevented(e) { - return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false; - } - var e_stop = CodeMirror.e_stop = function(e) {e_preventDefault(e); e_stopPropagation(e);}; - - function e_target(e) {return e.target || e.srcElement;} - function e_button(e) { - var b = e.which; - if (b == null) { - if (e.button & 1) b = 1; - else if (e.button & 2) b = 3; - else if (e.button & 4) b = 2; - } - if (mac && e.ctrlKey && b == 1) b = 3; - return b; - } - - // EVENT HANDLING - - // Lightweight event framework. on/off also work on DOM nodes, - // registering native DOM handlers. - - var on = CodeMirror.on = function(emitter, type, f) { - if (emitter.addEventListener) - emitter.addEventListener(type, f, false); - else if (emitter.attachEvent) - emitter.attachEvent("on" + type, f); - else { - var map = emitter._handlers || (emitter._handlers = {}); - var arr = map[type] || (map[type] = []); - arr.push(f); - } - }; - - var noHandlers = [] - function getHandlers(emitter, type, copy) { - var arr = emitter._handlers && emitter._handlers[type] - if (copy) return arr && arr.length > 0 ? arr.slice() : noHandlers - else return arr || noHandlers - } - - var off = CodeMirror.off = function(emitter, type, f) { - if (emitter.removeEventListener) - emitter.removeEventListener(type, f, false); - else if (emitter.detachEvent) - emitter.detachEvent("on" + type, f); - else { - var handlers = getHandlers(emitter, type, false) - for (var i = 0; i < handlers.length; ++i) - if (handlers[i] == f) { handlers.splice(i, 1); break; } - } - }; - - var signal = CodeMirror.signal = function(emitter, type /*, values...*/) { - var handlers = getHandlers(emitter, type, true) - if (!handlers.length) return; - var args = Array.prototype.slice.call(arguments, 2); - for (var i = 0; i < handlers.length; ++i) handlers[i].apply(null, args); - }; - - var orphanDelayedCallbacks = null; - - // Often, we want to signal events at a point where we are in the - // middle of some work, but don't want the handler to start calling - // other methods on the editor, which might be in an inconsistent - // state or simply not expect any other events to happen. - // signalLater looks whether there are any handlers, and schedules - // them to be executed when the last operation ends, or, if no - // operation is active, when a timeout fires. - function signalLater(emitter, type /*, values...*/) { - var arr = getHandlers(emitter, type, false) - if (!arr.length) return; - var args = Array.prototype.slice.call(arguments, 2), list; - if (operationGroup) { - list = operationGroup.delayedCallbacks; - } else if (orphanDelayedCallbacks) { - list = orphanDelayedCallbacks; - } else { - list = orphanDelayedCallbacks = []; - setTimeout(fireOrphanDelayed, 0); - } - function bnd(f) {return function(){f.apply(null, args);};}; - for (var i = 0; i < arr.length; ++i) - list.push(bnd(arr[i])); - } - - function fireOrphanDelayed() { - var delayed = orphanDelayedCallbacks; - orphanDelayedCallbacks = null; - for (var i = 0; i < delayed.length; ++i) delayed[i](); - } - - // The DOM events that CodeMirror handles can be overridden by - // registering a (non-DOM) handler on the editor for the event name, - // and preventDefault-ing the event in that handler. - function signalDOMEvent(cm, e, override) { - if (typeof e == "string") - e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; - signal(cm, override || e.type, cm, e); - return e_defaultPrevented(e) || e.codemirrorIgnore; - } - - function signalCursorActivity(cm) { - var arr = cm._handlers && cm._handlers.cursorActivity; - if (!arr) return; - var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []); - for (var i = 0; i < arr.length; ++i) if (indexOf(set, arr[i]) == -1) - set.push(arr[i]); - } - - function hasHandler(emitter, type) { - return getHandlers(emitter, type).length > 0 - } - - // Add on and off methods to a constructor's prototype, to make - // registering events on such objects more convenient. - function eventMixin(ctor) { - ctor.prototype.on = function(type, f) {on(this, type, f);}; - ctor.prototype.off = function(type, f) {off(this, type, f);}; - } - - // MISC UTILITIES - - // Number of pixels added to scroller and sizer to hide scrollbar - var scrollerGap = 30; - - // Returned or thrown by various protocols to signal 'I'm not - // handling this'. - var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}}; - - // Reused option objects for setSelection & friends - var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"}; - - function Delayed() {this.id = null;} - Delayed.prototype.set = function(ms, f) { - clearTimeout(this.id); - this.id = setTimeout(f, ms); - }; - - // Counts the column offset in a string, taking tabs into account. - // Used mostly to find indentation. - var countColumn = CodeMirror.countColumn = function(string, end, tabSize, startIndex, startValue) { - if (end == null) { - end = string.search(/[^\s\u00a0]/); - if (end == -1) end = string.length; - } - for (var i = startIndex || 0, n = startValue || 0;;) { - var nextTab = string.indexOf("\t", i); - if (nextTab < 0 || nextTab >= end) - return n + (end - i); - n += nextTab - i; - n += tabSize - (n % tabSize); - i = nextTab + 1; - } - }; - - // The inverse of countColumn -- find the offset that corresponds to - // a particular column. - var findColumn = CodeMirror.findColumn = function(string, goal, tabSize) { - for (var pos = 0, col = 0;;) { - var nextTab = string.indexOf("\t", pos); - if (nextTab == -1) nextTab = string.length; - var skipped = nextTab - pos; - if (nextTab == string.length || col + skipped >= goal) - return pos + Math.min(skipped, goal - col); - col += nextTab - pos; - col += tabSize - (col % tabSize); - pos = nextTab + 1; - if (col >= goal) return pos; - } - } - - var spaceStrs = [""]; - function spaceStr(n) { - while (spaceStrs.length <= n) - spaceStrs.push(lst(spaceStrs) + " "); - return spaceStrs[n]; - } - - function lst(arr) { return arr[arr.length-1]; } - - var selectInput = function(node) { node.select(); }; - if (ios) // Mobile Safari apparently has a bug where select() is broken. - selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; - else if (ie) // Suppress mysterious IE10 errors - selectInput = function(node) { try { node.select(); } catch(_e) {} }; - - function indexOf(array, elt) { - for (var i = 0; i < array.length; ++i) - if (array[i] == elt) return i; - return -1; - } - function map(array, f) { - var out = []; - for (var i = 0; i < array.length; i++) out[i] = f(array[i], i); - return out; - } - - function insertSorted(array, value, score) { - var pos = 0, priority = score(value) - while (pos < array.length && score(array[pos]) <= priority) pos++ - array.splice(pos, 0, value) - } - - function nothing() {} - - function createObj(base, props) { - var inst; - if (Object.create) { - inst = Object.create(base); - } else { - nothing.prototype = base; - inst = new nothing(); - } - if (props) copyObj(props, inst); - return inst; - }; - - function copyObj(obj, target, overwrite) { - if (!target) target = {}; - for (var prop in obj) - if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop))) - target[prop] = obj[prop]; - return target; - } - - function bind(f) { - var args = Array.prototype.slice.call(arguments, 1); - return function(){return f.apply(null, args);}; - } - - var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; - var isWordCharBasic = CodeMirror.isWordChar = function(ch) { - return /\w/.test(ch) || ch > "\x80" && - (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch)); - }; - function isWordChar(ch, helper) { - if (!helper) return isWordCharBasic(ch); - if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) return true; - return helper.test(ch); - } - - function isEmpty(obj) { - for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false; - return true; - } - - // Extending unicode characters. A series of a non-extending char + - // any number of extending chars is treated as a single unit as far - // as editing and measuring is concerned. This is not fully correct, - // since some scripts/fonts/browsers also treat other configurations - // of code points as a group. - var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/; - function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch); } - - // DOM UTILITIES - - function elt(tag, content, className, style) { - var e = document.createElement(tag); - if (className) e.className = className; - if (style) e.style.cssText = style; - if (typeof content == "string") e.appendChild(document.createTextNode(content)); - else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]); - return e; - } - - var range; - if (document.createRange) range = function(node, start, end, endNode) { - var r = document.createRange(); - r.setEnd(endNode || node, end); - r.setStart(node, start); - return r; - }; - else range = function(node, start, end) { - var r = document.body.createTextRange(); - try { r.moveToElementText(node.parentNode); } - catch(e) { return r; } - r.collapse(true); - r.moveEnd("character", end); - r.moveStart("character", start); - return r; - }; - - function removeChildren(e) { - for (var count = e.childNodes.length; count > 0; --count) - e.removeChild(e.firstChild); - return e; - } - - function removeChildrenAndAdd(parent, e) { - return removeChildren(parent).appendChild(e); - } - - var contains = CodeMirror.contains = function(parent, child) { - if (child.nodeType == 3) // Android browser always returns false when child is a textnode - child = child.parentNode; - if (parent.contains) - return parent.contains(child); - do { - if (child.nodeType == 11) child = child.host; - if (child == parent) return true; - } while (child = child.parentNode); - }; - - function activeElt() { - var activeElement = document.activeElement; - while (activeElement && activeElement.root && activeElement.root.activeElement) - activeElement = activeElement.root.activeElement; - return activeElement; - } - // Older versions of IE throws unspecified error when touching - // document.activeElement in some cases (during loading, in iframe) - if (ie && ie_version < 11) activeElt = function() { - try { return document.activeElement; } - catch(e) { return document.body; } - }; - - function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*"); } - var rmClass = CodeMirror.rmClass = function(node, cls) { - var current = node.className; - var match = classTest(cls).exec(current); - if (match) { - var after = current.slice(match.index + match[0].length); - node.className = current.slice(0, match.index) + (after ? match[1] + after : ""); - } - }; - var addClass = CodeMirror.addClass = function(node, cls) { - var current = node.className; - if (!classTest(cls).test(current)) node.className += (current ? " " : "") + cls; - }; - function joinClasses(a, b) { - var as = a.split(" "); - for (var i = 0; i < as.length; i++) - if (as[i] && !classTest(as[i]).test(b)) b += " " + as[i]; - return b; - } - - // WINDOW-WIDE EVENTS - - // These must be handled carefully, because naively registering a - // handler for each editor will cause the editors to never be - // garbage collected. - - function forEachCodeMirror(f) { - if (!document.body.getElementsByClassName) return; - var byClass = document.body.getElementsByClassName("CodeMirror"); - for (var i = 0; i < byClass.length; i++) { - var cm = byClass[i].CodeMirror; - if (cm) f(cm); - } - } - - var globalsRegistered = false; - function ensureGlobalHandlers() { - if (globalsRegistered) return; - registerGlobalHandlers(); - globalsRegistered = true; - } - function registerGlobalHandlers() { - // When the window resizes, we need to refresh active editors. - var resizeTimer; - on(window, "resize", function() { - if (resizeTimer == null) resizeTimer = setTimeout(function() { - resizeTimer = null; - forEachCodeMirror(onResize); - }, 100); - }); - // When the window loses focus, we want to show the editor as blurred - on(window, "blur", function() { - forEachCodeMirror(onBlur); - }); - } - - // FEATURE DETECTION - - // Detect drag-and-drop - var dragAndDrop = function() { - // There is *some* kind of drag-and-drop support in IE6-8, but I - // couldn't get it to work yet. - if (ie && ie_version < 9) return false; - var div = elt('div'); - return "draggable" in div || "dragDrop" in div; - }(); - - var zwspSupported; - function zeroWidthElement(measure) { - if (zwspSupported == null) { - var test = elt("span", "\u200b"); - removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")])); - if (measure.firstChild.offsetHeight != 0) - zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); - } - var node = zwspSupported ? elt("span", "\u200b") : - elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px"); - node.setAttribute("cm-text", ""); - return node; - } - - // Feature-detect IE's crummy client rect reporting for bidi text - var badBidiRects; - function hasBadBidiRects(measure) { - if (badBidiRects != null) return badBidiRects; - var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA")); - var r0 = range(txt, 0, 1).getBoundingClientRect(); - var r1 = range(txt, 1, 2).getBoundingClientRect(); - removeChildren(measure); - if (!r0 || r0.left == r0.right) return false; // Safari returns null in some cases (#2780) - return badBidiRects = (r1.right - r0.right < 3); - } - - // See if "".split is the broken IE version, if so, provide an - // alternative way to split lines. - var splitLinesAuto = CodeMirror.splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) { - var pos = 0, result = [], l = string.length; - while (pos <= l) { - var nl = string.indexOf("\n", pos); - if (nl == -1) nl = string.length; - var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl); - var rt = line.indexOf("\r"); - if (rt != -1) { - result.push(line.slice(0, rt)); - pos += rt + 1; - } else { - result.push(line); - pos = nl + 1; - } - } - return result; - } : function(string){return string.split(/\r\n?|\n/);}; - - var hasSelection = window.getSelection ? function(te) { - try { return te.selectionStart != te.selectionEnd; } - catch(e) { return false; } - } : function(te) { - try {var range = te.ownerDocument.selection.createRange();} - catch(e) {} - if (!range || range.parentElement() != te) return false; - return range.compareEndPoints("StartToEnd", range) != 0; - }; - - var hasCopyEvent = (function() { - var e = elt("div"); - if ("oncopy" in e) return true; - e.setAttribute("oncopy", "return;"); - return typeof e.oncopy == "function"; - })(); - - var badZoomedRects = null; - function hasBadZoomedRects(measure) { - if (badZoomedRects != null) return badZoomedRects; - var node = removeChildrenAndAdd(measure, elt("span", "x")); - var normal = node.getBoundingClientRect(); - var fromRange = range(node, 0, 1).getBoundingClientRect(); - return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1; - } - - // KEY NAMES - - var keyNames = CodeMirror.keyNames = { - 3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt", - 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", - 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert", - 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod", - 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete", - 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", - 221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete", - 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert" - }; - (function() { - // Number keys - for (var i = 0; i < 10; i++) keyNames[i + 48] = keyNames[i + 96] = String(i); - // Alphabetic keys - for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i); - // Function keys - for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i; - })(); - - // BIDI HELPERS - - function iterateBidiSections(order, from, to, f) { - if (!order) return f(from, to, "ltr"); - var found = false; - for (var i = 0; i < order.length; ++i) { - var part = order[i]; - if (part.from < to && part.to > from || from == to && part.to == from) { - f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr"); - found = true; - } - } - if (!found) f(from, to, "ltr"); - } - - function bidiLeft(part) { return part.level % 2 ? part.to : part.from; } - function bidiRight(part) { return part.level % 2 ? part.from : part.to; } - - function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0; } - function lineRight(line) { - var order = getOrder(line); - if (!order) return line.text.length; - return bidiRight(lst(order)); - } - - function lineStart(cm, lineN) { - var line = getLine(cm.doc, lineN); - var visual = visualLine(line); - if (visual != line) lineN = lineNo(visual); - var order = getOrder(visual); - var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual); - return Pos(lineN, ch); - } - function lineEnd(cm, lineN) { - var merged, line = getLine(cm.doc, lineN); - while (merged = collapsedSpanAtEnd(line)) { - line = merged.find(1, true).line; - lineN = null; - } - var order = getOrder(line); - var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line); - return Pos(lineN == null ? lineNo(line) : lineN, ch); - } - function lineStartSmart(cm, pos) { - var start = lineStart(cm, pos.line); - var line = getLine(cm.doc, start.line); - var order = getOrder(line); - if (!order || order[0].level == 0) { - var firstNonWS = Math.max(0, line.text.search(/\S/)); - var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch; - return Pos(start.line, inWS ? 0 : firstNonWS); - } - return start; - } - - function compareBidiLevel(order, a, b) { - var linedir = order[0].level; - if (a == linedir) return true; - if (b == linedir) return false; - return a < b; - } - var bidiOther; - function getBidiPartAt(order, pos) { - bidiOther = null; - for (var i = 0, found; i < order.length; ++i) { - var cur = order[i]; - if (cur.from < pos && cur.to > pos) return i; - if ((cur.from == pos || cur.to == pos)) { - if (found == null) { - found = i; - } else if (compareBidiLevel(order, cur.level, order[found].level)) { - if (cur.from != cur.to) bidiOther = found; - return i; - } else { - if (cur.from != cur.to) bidiOther = i; - return found; - } - } - } - return found; - } - - function moveInLine(line, pos, dir, byUnit) { - if (!byUnit) return pos + dir; - do pos += dir; - while (pos > 0 && isExtendingChar(line.text.charAt(pos))); - return pos; - } - - // This is needed in order to move 'visually' through bi-directional - // text -- i.e., pressing left should make the cursor go left, even - // when in RTL text. The tricky part is the 'jumps', where RTL and - // LTR text touch each other. This often requires the cursor offset - // to move more than one unit, in order to visually move one unit. - function moveVisually(line, start, dir, byUnit) { - var bidi = getOrder(line); - if (!bidi) return moveLogically(line, start, dir, byUnit); - var pos = getBidiPartAt(bidi, start), part = bidi[pos]; - var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit); - - for (;;) { - if (target > part.from && target < part.to) return target; - if (target == part.from || target == part.to) { - if (getBidiPartAt(bidi, target) == pos) return target; - part = bidi[pos += dir]; - return (dir > 0) == part.level % 2 ? part.to : part.from; - } else { - part = bidi[pos += dir]; - if (!part) return null; - if ((dir > 0) == part.level % 2) - target = moveInLine(line, part.to, -1, byUnit); - else - target = moveInLine(line, part.from, 1, byUnit); - } - } - } - - function moveLogically(line, start, dir, byUnit) { - var target = start + dir; - if (byUnit) while (target > 0 && isExtendingChar(line.text.charAt(target))) target += dir; - return target < 0 || target > line.text.length ? null : target; - } - - // Bidirectional ordering algorithm - // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm - // that this (partially) implements. - - // One-char codes used for character types: - // L (L): Left-to-Right - // R (R): Right-to-Left - // r (AL): Right-to-Left Arabic - // 1 (EN): European Number - // + (ES): European Number Separator - // % (ET): European Number Terminator - // n (AN): Arabic Number - // , (CS): Common Number Separator - // m (NSM): Non-Spacing Mark - // b (BN): Boundary Neutral - // s (B): Paragraph Separator - // t (S): Segment Separator - // w (WS): Whitespace - // N (ON): Other Neutrals - - // Returns null if characters are ordered as they appear - // (left-to-right), or an array of sections ({from, to, level} - // objects) in the order in which they occur visually. - var bidiOrdering = (function() { - // Character types for codepoints 0 to 0xff - var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN"; - // Character types for codepoints 0x600 to 0x6ff - var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm"; - function charType(code) { - if (code <= 0xf7) return lowTypes.charAt(code); - else if (0x590 <= code && code <= 0x5f4) return "R"; - else if (0x600 <= code && code <= 0x6ed) return arabicTypes.charAt(code - 0x600); - else if (0x6ee <= code && code <= 0x8ac) return "r"; - else if (0x2000 <= code && code <= 0x200b) return "w"; - else if (code == 0x200c) return "b"; - else return "L"; - } - - var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/; - var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/; - // Browsers seem to always treat the boundaries of block elements as being L. - var outerType = "L"; - - function BidiSpan(level, from, to) { - this.level = level; - this.from = from; this.to = to; - } - - return function(str) { - if (!bidiRE.test(str)) return false; - var len = str.length, types = []; - for (var i = 0, type; i < len; ++i) - types.push(type = charType(str.charCodeAt(i))); - - // W1. Examine each non-spacing mark (NSM) in the level run, and - // change the type of the NSM to the type of the previous - // character. If the NSM is at the start of the level run, it will - // get the type of sor. - for (var i = 0, prev = outerType; i < len; ++i) { - var type = types[i]; - if (type == "m") types[i] = prev; - else prev = type; - } - - // W2. Search backwards from each instance of a European number - // until the first strong type (R, L, AL, or sor) is found. If an - // AL is found, change the type of the European number to Arabic - // number. - // W3. Change all ALs to R. - for (var i = 0, cur = outerType; i < len; ++i) { - var type = types[i]; - if (type == "1" && cur == "r") types[i] = "n"; - else if (isStrong.test(type)) { cur = type; if (type == "r") types[i] = "R"; } - } - - // W4. A single European separator between two European numbers - // changes to a European number. A single common separator between - // two numbers of the same type changes to that type. - for (var i = 1, prev = types[0]; i < len - 1; ++i) { - var type = types[i]; - if (type == "+" && prev == "1" && types[i+1] == "1") types[i] = "1"; - else if (type == "," && prev == types[i+1] && - (prev == "1" || prev == "n")) types[i] = prev; - prev = type; - } - - // W5. A sequence of European terminators adjacent to European - // numbers changes to all European numbers. - // W6. Otherwise, separators and terminators change to Other - // Neutral. - for (var i = 0; i < len; ++i) { - var type = types[i]; - if (type == ",") types[i] = "N"; - else if (type == "%") { - for (var end = i + 1; end < len && types[end] == "%"; ++end) {} - var replace = (i && types[i-1] == "!") || (end < len && types[end] == "1") ? "1" : "N"; - for (var j = i; j < end; ++j) types[j] = replace; - i = end - 1; - } - } - - // W7. Search backwards from each instance of a European number - // until the first strong type (R, L, or sor) is found. If an L is - // found, then change the type of the European number to L. - for (var i = 0, cur = outerType; i < len; ++i) { - var type = types[i]; - if (cur == "L" && type == "1") types[i] = "L"; - else if (isStrong.test(type)) cur = type; - } - - // N1. A sequence of neutrals takes the direction of the - // surrounding strong text if the text on both sides has the same - // direction. European and Arabic numbers act as if they were R in - // terms of their influence on neutrals. Start-of-level-run (sor) - // and end-of-level-run (eor) are used at level run boundaries. - // N2. Any remaining neutrals take the embedding direction. - for (var i = 0; i < len; ++i) { - if (isNeutral.test(types[i])) { - for (var end = i + 1; end < len && isNeutral.test(types[end]); ++end) {} - var before = (i ? types[i-1] : outerType) == "L"; - var after = (end < len ? types[end] : outerType) == "L"; - var replace = before || after ? "L" : "R"; - for (var j = i; j < end; ++j) types[j] = replace; - i = end - 1; - } - } - - // Here we depart from the documented algorithm, in order to avoid - // building up an actual levels array. Since there are only three - // levels (0, 1, 2) in an implementation that doesn't take - // explicit embedding into account, we can build up the order on - // the fly, without following the level-based algorithm. - var order = [], m; - for (var i = 0; i < len;) { - if (countsAsLeft.test(types[i])) { - var start = i; - for (++i; i < len && countsAsLeft.test(types[i]); ++i) {} - order.push(new BidiSpan(0, start, i)); - } else { - var pos = i, at = order.length; - for (++i; i < len && types[i] != "L"; ++i) {} - for (var j = pos; j < i;) { - if (countsAsNum.test(types[j])) { - if (pos < j) order.splice(at, 0, new BidiSpan(1, pos, j)); - var nstart = j; - for (++j; j < i && countsAsNum.test(types[j]); ++j) {} - order.splice(at, 0, new BidiSpan(2, nstart, j)); - pos = j; - } else ++j; - } - if (pos < i) order.splice(at, 0, new BidiSpan(1, pos, i)); - } - } - if (order[0].level == 1 && (m = str.match(/^\s+/))) { - order[0].from = m[0].length; - order.unshift(new BidiSpan(0, 0, m[0].length)); - } - if (lst(order).level == 1 && (m = str.match(/\s+$/))) { - lst(order).to -= m[0].length; - order.push(new BidiSpan(0, len - m[0].length, len)); - } - if (order[0].level == 2) - order.unshift(new BidiSpan(1, order[0].to, order[0].to)); - if (order[0].level != lst(order).level) - order.push(new BidiSpan(order[0].level, len, len)); - - return order; - }; - })(); - - // THE END - - CodeMirror.version = "5.19.0"; - - return CodeMirror; -}); + } catch(e) {} + } + } + + options.finishInit = function (cm) { + cm.save = save + cm.getTextArea = function () { return textarea; } + cm.toTextArea = function () { + cm.toTextArea = isNaN // Prevent this from being ran twice + save() + textarea.parentNode.removeChild(cm.getWrapperElement()) + textarea.style.display = "" + if (textarea.form) { + off(textarea.form, "submit", save) + if (typeof textarea.form.submit == "function") + { textarea.form.submit = realSubmit } + } + } + } + + textarea.style.display = "none" + var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); }, + options) + return cm +} + +function addLegacyProps(CodeMirror) { + CodeMirror.off = off + CodeMirror.on = on + CodeMirror.wheelEventPixels = wheelEventPixels + CodeMirror.Doc = Doc + CodeMirror.splitLines = splitLinesAuto + CodeMirror.countColumn = countColumn + CodeMirror.findColumn = findColumn + CodeMirror.isWordChar = isWordCharBasic + CodeMirror.Pass = Pass + CodeMirror.signal = signal + CodeMirror.Line = Line + CodeMirror.changeEnd = changeEnd + CodeMirror.scrollbarModel = scrollbarModel + CodeMirror.Pos = Pos + CodeMirror.cmpPos = cmp + CodeMirror.modes = modes + CodeMirror.mimeModes = mimeModes + CodeMirror.resolveMode = resolveMode + CodeMirror.getMode = getMode + CodeMirror.modeExtensions = modeExtensions + CodeMirror.extendMode = extendMode + CodeMirror.copyState = copyState + CodeMirror.startState = startState + CodeMirror.innerMode = innerMode + CodeMirror.commands = commands + CodeMirror.keyMap = keyMap + CodeMirror.keyName = keyName + CodeMirror.isModifierKey = isModifierKey + CodeMirror.lookupKey = lookupKey + CodeMirror.normalizeKeyMap = normalizeKeyMap + CodeMirror.StringStream = StringStream + CodeMirror.SharedTextMarker = SharedTextMarker + CodeMirror.TextMarker = TextMarker + CodeMirror.LineWidget = LineWidget + CodeMirror.e_preventDefault = e_preventDefault + CodeMirror.e_stopPropagation = e_stopPropagation + CodeMirror.e_stop = e_stop + CodeMirror.addClass = addClass + CodeMirror.contains = contains + CodeMirror.rmClass = rmClass + CodeMirror.keyNames = keyNames +} + +// EDITOR CONSTRUCTOR + +defineOptions(CodeMirror) + +addEditorMethods(CodeMirror) + +// Set up methods on CodeMirror's prototype to redirect to the editor's document. +var dontDelegate = "iter insert remove copy getEditor constructor".split(" ") +for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0) + { CodeMirror.prototype[prop] = (function(method) { + return function() {return method.apply(this.doc, arguments)} + })(Doc.prototype[prop]) } } + +eventMixin(Doc) + +// INPUT HANDLING + +CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput} + +// MODE DEFINITION AND QUERYING + +// Extra arguments are stored as the mode's dependencies, which is +// used by (legacy) mechanisms like loadmode.js to automatically +// load a mode. (Preferred mechanism is the require/define calls.) +CodeMirror.defineMode = function(name/*, mode, …*/) { + if (!CodeMirror.defaults.mode && name != "null") { CodeMirror.defaults.mode = name } + defineMode.apply(this, arguments) +} + +CodeMirror.defineMIME = defineMIME + +// Minimal default mode. +CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); }) +CodeMirror.defineMIME("text/plain", "null") + +// EXTENSIONS + +CodeMirror.defineExtension = function (name, func) { + CodeMirror.prototype[name] = func +} +CodeMirror.defineDocExtension = function (name, func) { + Doc.prototype[name] = func +} + +CodeMirror.fromTextArea = fromTextArea + +addLegacyProps(CodeMirror) + +CodeMirror.version = "5.20.2" + +return CodeMirror; + +}))); \ No newline at end of file diff --git a/media/editors/codemirror/lib/codemirror.min.js b/media/editors/codemirror/lib/codemirror.min.js index 8078d72dadfb2..8642a329b2431 100644 --- a/media/editors/codemirror/lib/codemirror.min.js +++ b/media/editors/codemirror/lib/codemirror.min.js @@ -1,5 +1,5 @@ -!(function(a){if("object"==typeof exports&&"object"==typeof module)module.exports=a();else{if("function"==typeof define&&define.amd)return define([],a);(this||window).CodeMirror=a()}})((function(){"use strict";function a(c,d){if(!(this instanceof a))return new a(c,d);this.options=d=d?Me(d):{},Me(bg,d,!1),n(d);var e=d.value;"string"==typeof e&&(e=new zg(e,d.mode,null,d.lineSeparator)),this.doc=e;var f=new a.inputStyles[d.inputStyle](this),g=this.display=new b(c,e,f);g.wrapper.CodeMirror=this,j(this),h(this),d.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),d.autofocus&&!Ef&&g.input.focus(),r(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Ee,keySeq:null,specialChars:null};var i=this;uf&&vf<11&&setTimeout((function(){i.display.input.reset(!0)}),20),Rb(this),Ye(),vb(this),this.curOp.forceUpdate=!0,Yd(this,e),d.autofocus&&!Ef||i.hasFocus()?setTimeout(Ne(rc,this),20):sc(this);for(var k in cg)cg.hasOwnProperty(k)&&cg[k](this,d[k],dg);w(this),d.finishInit&&d.finishInit(this);for(var l=0;lb.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)}))}function n(a){var b=He(a.gutters,"CodeMirror-linenumbers");b==-1&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):b>-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function o(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+Sa(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+Ua(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function p(a,b,c){this.cm=c;var d=this.vert=Re("div",[Re("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=Re("div",[Re("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(d),a(e),Fg(d,"scroll",(function(){d.clientHeight&&b(d.scrollTop,"vertical")})),Fg(e,"scroll",(function(){e.clientWidth&&b(e.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,uf&&vf<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function q(){}function r(b){b.display.scrollbars&&(b.display.scrollbars.clear(),b.display.scrollbars.addClass&&$g(b.display.wrapper,b.display.scrollbars.addClass)),b.display.scrollbars=new a.scrollbarModel[b.options.scrollbarStyle](function(a){b.display.wrapper.insertBefore(a,b.display.scrollbarFiller),Fg(a,"mousedown",(function(){b.state.focused&&setTimeout((function(){b.display.input.focus()}),0)})),a.setAttribute("cm-not-content","true")},function(a,c){"horizontal"==c?fc(b,a):ec(b,a)},b),b.display.scrollbars.addClass&&_g(b.display.wrapper,b.display.scrollbars.addClass)}function s(a,b){b||(b=o(a));var c=a.display.barWidth,d=a.display.barHeight;t(a,b);for(var e=0;e<4&&c!=a.display.barWidth||d!=a.display.barHeight;e++)c!=a.display.barWidth&&a.options.lineWrapping&&F(a),t(a,o(a)),c=a.display.barWidth,d=a.display.barHeight}function t(a,b){var c=a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px",c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px",c.heightForcer.style.borderBottom=d.bottom+"px solid transparent",d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="",d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function u(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-Ra(a));var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,f=ce(b,d),g=ce(b,e);if(c&&c.ensure){var h=c.ensure.from.line,i=c.ensure.to.line;h=g&&(f=ce(b,de(Zd(b,i))-a.wrapper.clientHeight),g=i)}return{from:f,to:Math.max(g,f+1)}}function v(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=y(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g=c.viewFrom&&b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&0==Qb(a))return!1;w(a)&&(Mb(a),b.dims=H(a));var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFromg&&c.viewTo-g<20&&(g=Math.min(e,c.viewTo)),Mf&&(f=ud(a.doc,f),g=vd(a.doc,g));var h=f!=c.viewFrom||g!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;Pb(a,f,g),c.viewOffset=de(Zd(a.doc,c.viewFrom)),a.display.mover.style.top=c.viewOffset+"px";var i=Qb(a);if(!h&&0==i&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;var j=Ue();return i>4&&(c.lineDiv.style.display="none"),I(a,c.updateLineNumbers,b.dims),i>4&&(c.lineDiv.style.display=""),c.renderedView=c.view,j&&Ue()!=j&&j.offsetHeight&&j.focus(),Se(c.cursorDiv),Se(c.selectionDiv),c.gutters.style.height=c.sizer.style.minHeight=0,h&&(c.lastWrapHeight=b.wrapperHeight,c.lastWrapWidth=b.wrapperWidth,Na(a,400)),c.updateLineNumbers=null,!0}function C(a,b){for(var c=b.viewport,d=!0;(d&&a.options.lineWrapping&&b.oldDisplayWidth!=Va(a)||(c&&null!=c.top&&(c={top:Math.min(a.doc.height+Sa(a.display)-Wa(a),c.top)}),b.visible=u(a.display,a.doc,c),!(b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)))&&B(a,b);d=!1){F(a);var e=o(a);Ia(a),s(a,e),E(a,e)}b.signal(a,"update",a),a.display.viewFrom==a.display.reportedViewFrom&&a.display.viewTo==a.display.reportedViewTo||(b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo)}function D(a,b){var c=new z(a,b);if(B(a,c)){F(a),C(a,c);var d=o(a);Ia(a),s(a,d),E(a,d),c.finish()}}function E(a,b){a.display.sizer.style.minHeight=b.docHeight+"px",a.display.heightForcer.style.top=b.docHeight+"px",a.display.gutters.style.height=b.docHeight+a.display.barHeight+Ua(a)+"px"}function F(a){for(var b=a.display,c=b.lineDiv.offsetTop,d=0;d.001||i<-.001)&&(ae(f.line,e),G(f.line),f.rest))for(var j=0;j-1&&(m=!1),J(a,l,j,c)),m&&(Se(l.lineNumber),l.lineNumber.appendChild(document.createTextNode(x(a.options,j)))),h=l.node.nextSibling}else{var n=R(a,l,j,c);g.insertBefore(n,h)}j+=l.size}for(;h;)h=d(h)}function J(a,b,c,d){for(var e=0;e1)if(Pf&&Pf.text.join("\n")==b){if(d.ranges.length%Pf.text.length==0){i=[];for(var j=0;j=0;j--){var k=d.ranges[j],l=k.from(),m=k.to();k.empty()&&(c&&c>0?l=Nf(l.line,l.ch-c):a.state.overwrite&&!g?m=Nf(m.line,Math.min(Zd(f,m.line).text.length,m.ch+Ge(h).length)):Pf&&Pf.lineWise&&Pf.text.join("\n")==b&&(l=m=Nf(l.line,0)));var n=a.curOp.updateInput,o={from:l,to:m,text:i?i[j%i.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};Ac(a.doc,o),ye(a,"inputRead",a,o)}b&&!g&&_(a,b),Mc(a),a.curOp.updateInput=n,a.curOp.typing=!0,a.state.pasteIncoming=a.state.cutIncoming=!1}function $(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");if(c)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||Eb(b,(function(){Z(b,c,0,null,"paste")})),!0}function _(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;d>=0;d--){var e=c.ranges[d];if(!(e.head.ch>100||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars){for(var h=0;h-1){g=Oc(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(Zd(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=Oc(a,e.head.line,"smart"));g&&ye(a,"electricInput",a,e.head.line)}}}function aa(a){for(var b=[],c=[],d=0;d=0){var g=X(f.from(),e.from()),h=W(f.to(),e.to()),i=f.empty()?e.from()==e.head:f.from()==f.head;d<=b&&--b,a.splice(--d,2,new la(i?h:g,i?g:h))}}return new ka(a,b)}function na(a,b){return new ka([new la(a,b||a)],0)}function oa(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function pa(a,b){if(b.linec?Nf(c,Zd(a,c).text.length):qa(b,Zd(a,b.line).text.length)}function qa(a,b){var c=a.ch;return null==c||c>b?Nf(a.line,b):c<0?Nf(a.line,0):a}function ra(a,b){return b>=a.first&&b=b.ch:h.to>b.ch))){if(e&&(Ig(i,"beforeCursorEnter"),i.explicitlyCleared)){if(f.markedSpans){--g;continue}break}if(!i.atomic)continue;if(c){var j,k=i.find(d<0?1:-1);if((d<0?i.inclusiveRight:i.inclusiveLeft)&&(k=Ha(a,k,-d,k&&k.line==b.line?f:null)),k&&k.line==b.line&&(j=Of(k,c))&&(d<0?j<0:j>0))return Fa(a,k,b,d,e)}var l=i.find(d<0?-1:1);return(d<0?i.inclusiveLeft:i.inclusiveRight)&&(l=Ha(a,l,d,l.line==b.line?f:null)),l?Fa(a,l,b,d,e):null}}return b}function Ga(a,b,c,d,e){var f=d||1,g=Fa(a,b,c,f,e)||!e&&Fa(a,b,c,f,!0)||Fa(a,b,c,-f,e)||!e&&Fa(a,b,c,-f,!0);return g?g:(a.cantEdit=!0,Nf(a.first,0))}function Ha(a,b,c,d){return c<0&&0==b.ch?b.line>a.first?pa(a,Nf(b.line-1)):null:c>0&&b.ch==(d||Zd(a,b.line)).text.length?b.line=a.display.viewTo||h.to().line3&&(d(n,p.top,null,p.bottom),n=j,p.bottomi.bottom||l.bottom==i.bottom&&l.right>i.right)&&(i=l),n0?b.blinker=setInterval((function(){b.cursorDiv.style.visibility=(c=!c)?"":"hidden"}),a.options.cursorBlinkRate):a.options.cursorBlinkRate<0&&(b.cursorDiv.style.visibility="hidden")}}function Na(a,b){a.doc.mode.startState&&a.doc.frontier=a.display.viewTo)){var c=+new Date+a.options.workTime,d=jg(b.mode,Qa(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),(function(f){if(b.frontier>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength,i=Id(a,f,h?jg(b.mode,d):d,!0);f.styles=i.styles;var j=f.styleClasses,k=i.classes;k?f.styleClasses=k:j&&(f.styleClasses=null);for(var l=!g||g.length!=f.styles.length||j!=k&&(!j||!k||j.bgClass!=k.bgClass||j.textClass!=k.textClass),m=0;!l&&mc)return Na(a,a.options.workDelay),!0})),e.length&&Eb(a,(function(){for(var b=0;bg;--h){if(h<=f.first)return f.first;var i=Zd(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=Pg(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function Qa(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=Pa(a,b,c),g=f>d.first&&Zd(d,f-1).stateAfter;return g=g?jg(d.mode,g):kg(d.mode),d.iter(f,b,(function(c){Kd(a,c.text,g);var h=f==b-1||f%5==0||f>=e.viewFrom&&f2&&f.push((i.bottom+j.top)/2-c.top)}}f.push(c.bottom-c.top)}}function Ya(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;dc)return{map:a.measure.maps[d],cache:a.measure.caches[d],before:!0}}function Za(a,b){b=sd(b);var c=be(b),d=a.display.externalMeasured=new Ib(a.doc,b,c);d.lineN=c;var e=d.built=Md(a,d);return d.text=e.pre,Te(a.display.lineMeasure,e.pre),d}function $a(a,b,c,d){return bb(a,ab(a,b),c,d)}function _a(a,b){if(b>=a.display.viewFrom&&b=c.lineN&&bb)&&(f=j-i,e=f-1,b>=j&&(g="right")),null!=e){if(d=a[h+2],i==j&&c==(d.insertLeft?"left":"right")&&(g=c),"left"==c&&0==e)for(;h&&a[h-2]==a[h-3]&&a[h-1].insertLeft;)d=a[(h-=3)+2],g="left";if("right"==c&&e==j-i)for(;h=0&&(c=a[d]).left==c.right;d--);return c}function eb(a,b,c,d){var e,f=cb(b.map,c,d),g=f.node,h=f.start,i=f.end,j=f.collapse;if(3==g.nodeType){for(var k=0;k<4;k++){for(;h&&Qe(b.line.text.charAt(f.coverStart+h));)--h;for(;f.coverStart+i0&&(j=d="right");var l;e=a.options.lineWrapping&&(l=g.getClientRects()).length>1?l["right"==d?l.length-1:0]:g.getBoundingClientRect()}if(uf&&vf<9&&!h&&(!e||!e.left&&!e.right)){var m=g.parentNode.getClientRects()[0];e=m?{left:m.left,right:m.left+ub(a.display),top:m.top,bottom:m.bottom}:Tf}for(var n=e.top-b.rect.top,o=e.bottom-b.rect.top,p=(n+o)/2,q=b.view.measure.heights,k=0;kc.from?g(a-1):g(a,d)}d=d||Zd(a.doc,b.line),e||(e=ab(a,d));var i=ee(d),j=b.ch;if(!i)return g(j);var k=lf(i,j),l=h(j,k);return null!=hh&&(l.other=h(j,hh)),l}function pb(a,b){var c=0,b=pa(a.doc,b);a.options.lineWrapping||(c=ub(a.display)*b.ch);var d=Zd(a.doc,b.line),e=de(d)+Ra(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function qb(a,b,c,d){var e=Nf(a,b);return e.xRel=d,c&&(e.outside=!0),e}function rb(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,c<0)return qb(d.first,0,!0,-1);var e=ce(d,c),f=d.first+d.size-1;if(e>f)return qb(d.first+d.size-1,Zd(d,f).text.length,!0,1);b<0&&(b=0);for(var g=Zd(d,e);;){var h=sb(a,g,e,b,c),i=qd(g),j=i&&i.find(0,!0);if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=be(g=j.to.line)}}function sb(a,b,c,d,e){function f(d){var e=ob(a,Nf(c,d),"line",b,j);return h=!0,g>e.bottom?e.left-i:gq)return qb(c,n,r,1);for(;;){if(k?n==m||n==nf(b,m,1):n-m<=1){var s=d0&&s1){var v=bb(a,j,s,"right");g<=v.bottom&&g>=v.top&&Math.abs(d-v.right)1?1:0);return w}var x=Math.ceil(l/2),y=m+x;if(k){y=m;for(var z=0;zd?(n=y,q=A,(r=h)&&(q+=1e3),l=x):(m=y,o=A,p=h,l-=x)}}function tb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Qf){Qf=Re("pre");for(var b=0;b<49;++b)Qf.appendChild(document.createTextNode("x")),Qf.appendChild(Re("br"));Qf.appendChild(document.createTextNode("x"))}Te(a.measure,Qf);var c=Qf.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),Se(a.measure),c||1}function ub(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=Re("span","xxxxxxxxxx"),c=Re("pre",[b]);Te(a.measure,c);var d=b.getBoundingClientRect(),e=(d.right-d.left)/10;return e>2&&(a.cachedCharWidth=e),e||10}function vb(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Vf},Uf?Uf.ops.push(a.curOp):a.curOp.ownsGroup=Uf={ops:[a.curOp],delayedCallbacks:[]}}function wb(a){var b=a.delayedCallbacks,c=0;do{for(;c=c.viewTo)||c.maxLineChanged&&b.options.lineWrapping,a.update=a.mustUpdate&&new z(b,a.mustUpdate&&{top:a.scrollTop,ensure:a.scrollToPos},a.forceUpdate)}function Ab(a){a.updatedDisplay=a.mustUpdate&&B(a.cm,a.update)}function Bb(a){var b=a.cm,c=b.display;a.updatedDisplay&&F(b),a.barMeasure=o(b),c.maxLineChanged&&!b.options.lineWrapping&&(a.adjustWidthTo=$a(b,c.maxLine,c.maxLine.text.length).left+3,b.display.sizerWidth=a.adjustWidthTo,a.barMeasure.scrollWidth=Math.max(c.scroller.clientWidth,c.sizer.offsetLeft+a.adjustWidthTo+Ua(b)+b.display.barWidth),a.maxScrollLeft=Math.max(0,c.sizer.offsetLeft+a.adjustWidthTo-Va(b))),(a.updatedDisplay||a.selectionChanged)&&(a.preparedSelection=c.input.prepareSelection(a.focus))}function Cb(a){var b=a.cm;null!=a.adjustWidthTo&&(b.display.sizer.style.minWidth=a.adjustWidthTo+"px",a.maxScrollLeftb)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)Mf&&ud(a.doc,b)e.viewFrom?Mb(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Mb(a);else if(b<=e.viewFrom){var f=Ob(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Mb(a)}else if(c>=e.viewTo){var f=Ob(a,b,b,-1);f?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Mb(a)}else{var g=Ob(a,b,b,-1),h=Ob(a,c,c+d,1);g&&h?(e.view=e.view.slice(0,g.index).concat(Jb(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):Mb(a)}var i=e.externalMeasured;i&&(c=e.lineN&&b=d.viewTo)){var f=d.view[Nb(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);He(g,c)==-1&&g.push(c)}}}function Mb(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function Nb(a,b){if(b>=a.display.viewTo)return null;if(b-=a.display.viewFrom,b<0)return null;for(var c=a.display.view,d=0;d0){if(f==g.length-1)return null;e=i+g[f].size-b,f++}else e=i-b;b+=e,c+=e}for(;ud(a.doc,c)!=c;){if(f==(d<0?0:g.length-1))return null;c+=d*g[f-(d<0?1:0)].size,f+=d}return{index:f,lineN:c}}function Pb(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=Jb(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=Jb(a,b,d.viewFrom).concat(d.view):d.viewFromc&&(d.view=d.view.slice(0,Nb(a,c)))),d.viewTo=c}function Qb(a){for(var b=a.display.view,c=0,d=0;d400}var e=a.display;Fg(e.scroller,"mousedown",Fb(a,Wb)),uf&&vf<11?Fg(e.scroller,"dblclick",Fb(a,(function(b){if(!Ae(a,b)){var c=Vb(a,b);if(c&&!_b(a,b)&&!Ub(a.display,b)){Cg(b);var d=a.findWordAt(c);ua(a.doc,d.anchor,d.head)}}}))):Fg(e.scroller,"dblclick",(function(b){Ae(a,b)||Cg(b)})),Kf||Fg(e.scroller,"contextmenu",(function(b){tc(a,b)}));var f,g={end:0};Fg(e.scroller,"touchstart",(function(b){if(!Ae(a,b)&&!c(b)){clearTimeout(f);var d=+new Date;e.activeTouch={start:d,moved:!1,prev:d-g.end<=300?g:null},1==b.touches.length&&(e.activeTouch.left=b.touches[0].pageX,e.activeTouch.top=b.touches[0].pageY)}})),Fg(e.scroller,"touchmove",(function(){e.activeTouch&&(e.activeTouch.moved=!0)})),Fg(e.scroller,"touchend",(function(c){var f=e.activeTouch;if(f&&!Ub(e,c)&&null!=f.left&&!f.moved&&new Date-f.start<300){var g,h=a.coordsChar(e.activeTouch,"page");g=!f.prev||d(f,f.prev)?new la(h,h):!f.prev.prev||d(f,f.prev.prev)?a.findWordAt(h):new la(Nf(h.line,0),pa(a.doc,Nf(h.line+1,0))),a.setSelection(g.anchor,g.head),a.focus(),Cg(c)}b()})),Fg(e.scroller,"touchcancel",b),Fg(e.scroller,"scroll",(function(){e.scroller.clientHeight&&(ec(a,e.scroller.scrollTop),fc(a,e.scroller.scrollLeft,!0),Ig(a,"scroll",a))})),Fg(e.scroller,"mousewheel",(function(b){gc(a,b)})),Fg(e.scroller,"DOMMouseScroll",(function(b){gc(a,b)})),Fg(e.wrapper,"scroll",(function(){e.wrapper.scrollTop=e.wrapper.scrollLeft=0})),e.dragFunctions={enter:function(b){Ae(a,b)||Eg(b)},over:function(b){Ae(a,b)||(cc(a,b),Eg(b))},start:function(b){bc(a,b)},drop:Fb(a,ac),leave:function(b){Ae(a,b)||dc(a)}};var h=e.input.getField();Fg(h,"keyup",(function(b){oc.call(a,b)})),Fg(h,"keydown",Fb(a,mc)),Fg(h,"keypress",Fb(a,pc)),Fg(h,"focus",(function(b){rc(a,b)})),Fg(h,"blur",(function(b){sc(a,b)}))}function Sb(b,c,d){var e=d&&d!=a.Init;if(!c!=!e){var f=b.display.dragFunctions,g=c?Fg:Hg;g(b.display.scroller,"dragstart",f.start),g(b.display.scroller,"dragenter",f.enter),g(b.display.scroller,"dragover",f.over),g(b.display.scroller,"dragleave",f.leave),g(b.display.scroller,"drop",f.drop)}}function Tb(a){var b=a.display;b.lastWrapHeight==b.wrapper.clientHeight&&b.lastWrapWidth==b.wrapper.clientWidth||(b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize())}function Ub(a,b){for(var c=ve(b);c!=a.wrapper;c=c.parentNode)if(!c||1==c.nodeType&&"true"==c.getAttribute("cm-ignore-events")||c.parentNode==a.sizer&&c!=a.mover)return!0}function Vb(a,b,c,d){var e=a.display;if(!c&&"true"==ve(b).getAttribute("cm-not-content"))return null;var f,g,h=e.lineSpace.getBoundingClientRect();try{f=b.clientX-h.left,g=b.clientY-h.top}catch(a){return null}var i,j=rb(a,f,g);if(d&&1==j.xRel&&(i=Zd(a.doc,j.line).text).length==j.ch){var k=Pg(i,i.length,a.options.tabSize)-i.length;j=Nf(j.line,Math.max(0,Math.round((f-Ta(a.display).left)/ub(a.display))-k))}return j}function Wb(a){var b=this,c=b.display;if(!(Ae(b,a)||c.activeTouch&&c.input.supportsTouch())){if(c.shift=a.shiftKey,Ub(c,a))return void(wf||(c.scroller.draggable=!1,setTimeout((function(){c.scroller.draggable=!0}),100)));if(!_b(b,a)){var d=Vb(b,a);switch(window.focus(),we(a)){case 1:b.state.selectingText?b.state.selectingText(a):d?Xb(b,a,d):ve(a)==c.scroller&&Cg(a);break;case 2:wf&&(b.state.lastMiddleDown=+new Date),d&&ua(b.doc,d),setTimeout((function(){c.input.focus()}),20),Cg(a);break;case 3:Kf?tc(b,a):qc(b)}}}}function Xb(a,b,c){uf?setTimeout(Ne(Y,a),0):a.curOp.focus=Ue();var d,e=+new Date;Sf&&Sf.time>e-400&&0==Of(Sf.pos,c)?d="triple":Rf&&Rf.time>e-400&&0==Of(Rf.pos,c)?(d="double",Sf={time:e,pos:c}):(d="single",Rf={time:e,pos:c});var f,g=a.doc.sel,h=Ff?b.metaKey:b.ctrlKey;a.options.dragDrop&&bh&&!a.isReadOnly()&&"single"==d&&(f=g.contains(c))>-1&&(Of((f=g.ranges[f]).from(),c)<0||c.xRel>0)&&(Of(f.to(),c)>0||c.xRel<0)?Yb(a,b,c,h):Zb(a,b,c,d,h)}function Yb(a,b,c,d){var e=a.display,f=+new Date,g=Fb(a,(function(h){wf&&(e.scroller.draggable=!1),a.state.draggingText=!1,Hg(document,"mouseup",g),Hg(e.scroller,"drop",g),Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)<10&&(Cg(h),!d&&+new Date-200s&&e.push(new la(Nf(o,s),Nf(o,Qg(r,n,f))))}e.length||e.push(new la(c,c)),Aa(j,ma(m.ranges.slice(0,l).concat(e),l),{origin:"*mouse",scroll:!1}),a.scrollIntoView(b)}else{var t=k,u=t.anchor,v=b;if("single"!=d){if("double"==d)var w=a.findWordAt(b);else var w=new la(Nf(b.line,0),pa(j,Nf(b.line+1,0)));Of(w.anchor,u)>0?(v=w.head,u=X(t.from(),w.anchor)):(v=w.anchor,u=W(t.to(),w.head))}var e=m.ranges.slice(0);e[l]=new la(pa(j,u),v),Aa(j,ma(e,l),Ng)}}function g(b){var c=++s,e=Vb(a,b,!0,"rect"==d);if(e)if(0!=Of(e,q)){a.curOp.focus=Ue(),f(e);var h=u(i,j);(e.line>=h.to||e.liner.bottom?20:0;k&&setTimeout(Fb(a,(function(){s==c&&(i.scroller.scrollTop+=k,g(b))})),50)}}function h(b){a.state.selectingText=!1,s=1/0,Cg(b),i.input.focus(),Hg(document,"mousemove",t),Hg(document,"mouseup",v),j.history.lastSelOrigin=null}var i=a.display,j=a.doc;Cg(b);var k,l,m=j.sel,n=m.ranges;if(e&&!b.shiftKey?(l=j.sel.contains(c),k=l>-1?n[l]:new la(c,c)):(k=j.sel.primary(),l=j.sel.primIndex),Gf?b.shiftKey&&b.metaKey:b.altKey)d="rect",e||(k=new la(c,c)),c=Vb(a,b,!0,!0),l=-1;else if("double"==d){var o=a.findWordAt(c);k=a.display.shift||j.extend?ta(j,k,o.anchor,o.head):o}else if("triple"==d){var p=new la(Nf(c.line,0),pa(j,Nf(c.line+1,0)));k=a.display.shift||j.extend?ta(j,k,p.anchor,p.head):p}else k=ta(j,k,c);e?l==-1?(l=n.length,Aa(j,ma(n.concat([k]),l),{scroll:!1,origin:"*mouse"})):n.length>1&&n[l].empty()&&"single"==d&&!b.shiftKey?(Aa(j,ma(n.slice(0,l).concat(n.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),m=j.sel):wa(j,l,k,Ng):(l=0,Aa(j,new ka([k],0),Ng),m=j.sel);var q=c,r=i.wrapper.getBoundingClientRect(),s=0,t=Fb(a,(function(a){we(a)?g(a):h(a)})),v=Fb(a,h);a.state.selectingText=v,Fg(document,"mousemove",t),Fg(document,"mouseup",v)}function $b(a,b,c,d){try{var e=b.clientX,f=b.clientY}catch(a){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&Cg(b);var g=a.display,h=g.lineDiv.getBoundingClientRect();if(f>h.bottom||!Ce(a,c))return ue(b);f-=h.top-g.viewOffset;for(var i=0;i=e){var k=ce(a.doc,f),l=a.options.gutters[i];return Ig(a,c,a,k,l,b),ue(b)}}}function _b(a,b){return $b(a,b,"gutterClick",!0)}function ac(a){var b=this;if(dc(b),!Ae(b,a)&&!Ub(b.display,a)){Cg(a),uf&&(Wf=+new Date);var c=Vb(b,a,!0),d=a.dataTransfer.files;if(c&&!b.isReadOnly())if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){if(!b.options.allowDropFileTypes||He(b.options.allowDropFileTypes,a.type)!=-1){var h=new FileReader;h.onload=Fb(b,(function(){var a=h.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a=""),f[d]=a,++g==e){c=pa(b.doc,c);var i={from:c,to:c,text:b.doc.splitLines(f.join(b.doc.lineSeparator())),origin:"paste"};Ac(b.doc,i),za(b.doc,na(c,ag(i)))}})),h.readAsText(a)}},i=0;i-1)return b.state.draggingText(a),void setTimeout((function(){b.display.input.focus()}),20);try{var f=a.dataTransfer.getData("Text");if(f){if(b.state.draggingText&&!b.state.draggingText.copy)var j=b.listSelections();if(Ba(b.doc,na(c,c)),j)for(var i=0;ig.clientWidth,i=g.scrollHeight>g.clientHeight;if(d&&h||e&&i){if(e&&Ff&&wf)a:for(var j=b.target,k=f.view;j!=g;j=j.parentNode)for(var l=0;l=0;--e)Bc(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text});else Bc(a,b)}}function Bc(a,b){if(1!=b.text.length||""!=b.text[0]||0!=Of(b.from,b.to)){var c=wc(a,b);je(a,b,c,a.cm?a.cm.curOp.id:NaN),Ec(a,b,c,fd(a,b));var d=[];Xd(a,(function(a,c){c||He(d,a.history)!=-1||(te(a.history,b),d.push(a.history)),Ec(a,b,null,fd(a,b))}))}}function Cc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits||c){for(var d,e=a.history,f=a.sel,g="undo"==b?e.done:e.undone,h="undo"==b?e.undone:e.done,i=0;i=0;--i){var l=d.changes[i];if(l.origin=b,k&&!zc(a,l,!1))return void(g.length=0);j.push(ge(a,l));var m=i?wc(a,l):Ge(g);Ec(a,l,m,hd(a,l)),!i&&a.cm&&a.cm.scrollIntoView({from:l.from,to:ag(l)});var n=[];Xd(a,(function(a,b){b||He(n,a.history)!=-1||(te(a.history,l),n.push(a.history)),Ec(a,l,null,hd(a,l))}))}}}}function Dc(a,b){if(0!=b&&(a.first+=b,a.sel=new ka(Ie(a.sel.ranges,(function(a){return new la(Nf(a.anchor.line+b,a.anchor.ch),Nf(a.head.line+b,a.head.ch))})),a.sel.primIndex),a.cm)){Kb(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;da.lastLine())){if(b.from.linef&&(b={from:b.from,to:Nf(f,Zd(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=$d(a,b.from,b.to),c||(c=wc(a,b)),a.cm?Fc(a.cm,b,d):Ud(a,b,d),Ba(a,c,Mg)}}function Fc(a,b,c){var d=a.doc,e=a.display,g=b.from,h=b.to,i=!1,j=g.line;a.options.lineWrapping||(j=be(sd(Zd(d,g.line))),d.iter(j,h.line+1,(function(a){if(a==e.maxLine)return i=!0,!0}))),d.sel.contains(b.from,b.to)>-1&&Be(a),Ud(d,b,c,f(a)),a.options.lineWrapping||(d.iter(j,g.line+b.text.length,(function(a){var b=l(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,i=!1)})),i&&(a.curOp.updateMaxLine=!0)),d.frontier=Math.min(d.frontier,g.line),Na(a,400);var k=b.text.length-(h.line-g.line)-1;b.full?Kb(a):g.line!=h.line||1!=b.text.length||Td(a.doc,b)?Kb(a,g.line,h.line+1,k):Lb(a,g.line,"text");var m=Ce(a,"changes"),n=Ce(a,"change");if(n||m){var o={from:g,to:h,text:b.text,removed:b.removed,origin:b.origin};n&&ye(a,"change",a,o),m&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(o)}a.display.selForContextMenu=null}function Gc(a,b,c,d,e){if(d||(d=c),Of(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=a.splitLines(b)),Ac(a,{from:c,to:d,text:b,origin:e})}function Hc(a,b){if(!Ae(a,"scrollCursorIntoView")){var c=a.display,d=c.sizer.getBoundingClientRect(),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!Cf){var f=Re("div","​",null,"position: absolute; top: "+(b.top-c.viewOffset-Ra(a.display))+"px; height: "+(b.bottom-b.top+Ua(a)+c.barHeight)+"px; left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(f),f.scrollIntoView(e),a.display.lineSpace.removeChild(f)}}}function Ic(a,b,c,d){null==d&&(d=0);for(var e=0;e<5;e++){var f=!1,g=ob(a,b),h=c&&c!=b?ob(a,c):g,i=Kc(a,Math.min(g.left,h.left),Math.min(g.top,h.top)-d,Math.max(g.left,h.left),Math.max(g.bottom,h.bottom)+d),j=a.doc.scrollTop,k=a.doc.scrollLeft;if(null!=i.scrollTop&&(ec(a,i.scrollTop),Math.abs(a.doc.scrollTop-j)>1&&(f=!0)),null!=i.scrollLeft&&(fc(a,i.scrollLeft),Math.abs(a.doc.scrollLeft-k)>1&&(f=!0)),!f)break}return g}function Jc(a,b,c,d,e){var f=Kc(a,b,c,d,e);null!=f.scrollTop&&ec(a,f.scrollTop),null!=f.scrollLeft&&fc(a,f.scrollLeft)}function Kc(a,b,c,d,e){var f=a.display,g=tb(a.display);c<0&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=Wa(a),j={};e-c>i&&(e=c+i);var k=a.doc.height+Sa(f),l=ck-g;if(ch+i){var n=Math.min(c,(m?k:e)-i);n!=h&&(j.scrollTop=n)}var o=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:f.scroller.scrollLeft,p=Va(a)-(a.options.fixedGutter?f.gutters.offsetWidth:0),q=d-b>p; -return q&&(d=b+p),b<10?j.scrollLeft=0:bp+o-3&&(j.scrollLeft=d+(q?0:10)-p),j}function Lc(a,b,c){null==b&&null==c||Nc(a),null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b),null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function Mc(a){Nc(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?Nf(b.line,b.ch-1):b,d=Nf(b.line,b.ch+1)),a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function Nc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=pb(a,b.from),d=pb(a,b.to),e=Kc(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(e.scrollLeft,e.scrollTop)}}function Oc(a,b,c,d){var e,f=a.doc;null==c&&(c="add"),"smart"==c&&(f.mode.indent?e=Qa(a,b):c="prev");var g=a.options.tabSize,h=Zd(f,b),i=Pg(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var j,k=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(j=f.mode.indent(e,h.text.slice(k.length),h.text),j==Lg||j>150)){if(!d)return;c="prev"}}else j=0,c="not";"prev"==c?j=b>f.first?Pg(Zd(f,b-1).text,null,g):0:"add"==c?j=i+a.options.indentUnit:"subtract"==c?j=i-a.options.indentUnit:"number"==typeof c&&(j=i+c),j=Math.max(0,j);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(j/g);n;--n)m+=g,l+="\t";if(m=0;b--)Gc(a.doc,"",d[b].from,d[b].to,"+delete");Mc(a)}))}function Rc(a,b,c,d,e){function f(){var b=h+c;return!(b=a.first+a.size)&&(h=b,k=Zd(a,b))}function g(a){var b=(e?nf:of)(k,i,c,!0);if(null==b){if(a||!f())return!1;i=e?(c<0?ff:ef)(k):c<0?k.text.length:0}else i=b;return!0}var h=b.line,i=b.ch,j=c,k=Zd(a,h);if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var l=null,m="group"==d,n=a.cm&&a.cm.getHelper(b,"wordChars"),o=!0;!(c<0)||g(!o);o=!1){var p=k.text.charAt(i)||"\n",q=Oe(p,n)?"w":m&&"\n"==p?"n":!m||/\s/.test(p)?null:"p";if(!m||o||q||(q="s"),l&&l!=q){c<0&&(c=1,g());break}if(q&&(l=q),c>0&&!g(!o))break}var r=Ga(a,Nf(h,i),b,j,!0);return Of(b,r)||(r.hitSide=!0),r}function Sc(a,b,c,d){var e,f=a.doc,g=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),i=Math.max(h-.5*tb(a.display),3);e=(c>0?b.bottom:b.top)+c*i}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(;;){var j=rb(a,g,e);if(!j.outside)break;if(c<0?e<=0:e>=f.height){j.hitSide=!0;break}e+=5*c}return j}function Tc(b,c,d,e){a.defaults[b]=c,d&&(cg[b]=e?function(a,b,c){c!=dg&&d(a,b,c)}:d)}function Uc(a){for(var b,c,d,e,f=a.split(/-(?!$)/),a=f[f.length-1],g=0;g0||0==g&&f.clearWhenEmpty!==!1)return f;if(f.replacedWith&&(f.collapsed=!0,f.widgetNode=Re("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if(rd(a,b.line,b,c,f)||b.line!=c.line&&rd(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");Mf=!0}f.addToHistory&&je(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var h,i=b.line,j=a.cm;if(a.iter(i,c.line+1,(function(a){j&&f.collapsed&&!j.options.lineWrapping&&sd(a)==j.display.maxLine&&(h=!0),f.collapsed&&i!=b.line&&ae(a,0),cd(a,new _c(f,i==b.line?b.ch:null,i==c.line?c.ch:null)),++i})),f.collapsed&&a.iter(b.line,c.line+1,(function(b){wd(a,b)&&ae(b,0)})),f.clearOnEnter&&Fg(f,"beforeCursorEnter",(function(){f.clear()})),f.readOnly&&(Lf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed&&(f.id=++rg,f.atomic=!0),j){if(h&&(j.curOp.updateMaxLine=!0),f.collapsed)Kb(j,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(var k=b.line;k<=c.line;k++)Lb(j,k,"text");f.atomic&&Da(j.doc),ye(j,"markerAdded",j,f)}return f}function Xc(a,b,c,d,e){d=Me(d),d.shared=!1;var f=[Wc(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Xd(a,(function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(Wc(a,pa(a,b),pa(a,c),d,e));for(var i=0;i=b:f.to>b);(d||(d=[])).push(new _c(g,f.from,i?null:f.to))}}return d}function ed(a,b,c){if(a)for(var d,e=0;e=b:f.to>b);if(h||f.from==b&&"bookmark"==g.type&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from0&&h)for(var l=0;l0)){var k=[i,1],l=Of(j.from,h.from),m=Of(j.to,h.to);(l<0||!g.inclusiveLeft&&!l)&&k.push({from:j.from,to:h.from}),(m>0||!g.inclusiveRight&&!m)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function jd(a){var b=a.markedSpans;if(b){for(var c=0;c=0&&l<=0||k<=0&&l>=0)&&(k<=0&&(i.marker.inclusiveRight&&e.inclusiveLeft?Of(j.to,c)>=0:Of(j.to,c)>0)||k>=0&&(i.marker.inclusiveRight&&e.inclusiveLeft?Of(j.from,d)<=0:Of(j.from,d)<0)))return!0}}}function sd(a){for(var b;b=pd(a);)a=b.find(-1,!0).line;return a}function td(a){for(var b,c;b=qd(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function ud(a,b){var c=Zd(a,b),d=sd(c);return c==d?b:be(d)}function vd(a,b){if(b>a.lastLine())return b;var c,d=Zd(a,b);if(!wd(a,d))return b;for(;c=qd(d);)d=c.find(1,!0).line;return be(d)+1}function wd(a,b){var c=Mf&&b.markedSpans;if(c)for(var d,e=0;ec.start)return g}throw new Error("Mode "+b.name+" failed to advance stream.")}function Gd(a,b,c,d){function e(a){return{start:l.start,end:l.pos,string:l.current(),type:f||null,state:a?jg(g.mode,k):k}}var f,g=a.doc,h=g.mode;b=pa(g,b);var i,j=Zd(g,b.line),k=Qa(a,b.line,c),l=new qg(j.text,a.options.tabSize);for(d&&(i=[]);(d||l.posa.options.maxHighlightLength?(h=!1,g&&Kd(a,b,d,l.pos),l.pos=b.length,i=null):i=Dd(Fd(c,l,d,m),f),m){var n=m[0].name;n&&(i="m-"+(i?n+" "+i:n))}if(!h||k!=i){for(;ja&&e.splice(i,1,a,e[i+1],d),i+=2,j=Math.min(a,d)}if(b)if(h.opaque)e.splice(c,i-c,a,"cm-overlay "+b),i=c+2;else for(;ca.options.maxHighlightLength?jg(a.doc.mode,d):d);b.stateAfter=d,b.styles=e.styles,e.classes?b.styleClasses=e.classes:b.styleClasses&&(b.styleClasses=null),c===a.doc.frontier&&a.doc.frontier++}return b.styles}function Kd(a,b,c,d){var e=a.doc.mode,f=new qg(b,a.options.tabSize);for(f.start=f.pos=d||0,""==b&&Ed(e,c);!f.eol();)Fd(e,f,c),f.start=f.pos}function Ld(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?xg:wg;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function Md(a,b){var c=Re("span",null,null,wf?"padding-right: .1px":null),d={pre:Re("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:(uf||wf)&&a.getOption("lineWrapping")};b.measure={};for(var e=0;e<=(b.rest?b.rest.length:0);e++){var f,g=e?b.rest[e-1]:b.line;d.pos=0,d.addToken=Od,_e(a.display.measure)&&(f=ee(g))&&(d.addToken=Qd(d.addToken,f)),d.map=[];var h=b!=a.display.externalMeasured&&be(g);Sd(g,d,Jd(a,g,h)),g.styleClasses&&(g.styleClasses.bgClass&&(d.bgClass=We(g.styleClasses.bgClass,d.bgClass||"")),g.styleClasses.textClass&&(d.textClass=We(g.styleClasses.textClass,d.textClass||""))),0==d.map.length&&d.map.push(0,0,d.content.appendChild($e(a.display.measure))),0==e?(b.measure.map=d.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(d.map),(b.measure.caches||(b.measure.caches=[])).push({}))}if(wf){var i=d.content.lastChild;(/\bcm-tab\b/.test(i.className)||i.querySelector&&i.querySelector(".cm-tab"))&&(d.content.className="cm-tab-wrap-hack")}return Ig(a,"renderLine",a,b.line,d.pre),d.pre.className&&(d.textClass=We(d.pre.className,d.textClass||"")),d}function Nd(a){var b=Re("span","•","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b.setAttribute("aria-label",b.title),b}function Od(a,b,c,d,e,f,g){if(b){var h=a.splitSpaces?Pd(b,a.trailingSpace):b,i=a.cm.state.specialChars,j=!1;if(i.test(b))for(var k=document.createDocumentFragment(),l=0;;){i.lastIndex=l;var m=i.exec(b),n=m?m.index-l:b.length-l;if(n){var o=document.createTextNode(h.slice(l,l+n));uf&&vf<9?k.appendChild(Re("span",[o])):k.appendChild(o),a.map.push(a.pos,a.pos+n,o),a.col+=n,a.pos+=n}if(!m)break;if(l+=n+1,"\t"==m[0]){var p=a.cm.options.tabSize,q=p-a.col%p,o=k.appendChild(Re("span",Fe(q),"cm-tab"));o.setAttribute("role","presentation"),o.setAttribute("cm-text","\t"),a.col+=q}else if("\r"==m[0]||"\n"==m[0]){var o=k.appendChild(Re("span","\r"==m[0]?"␍":"␤","cm-invalidchar"));o.setAttribute("cm-text",m[0]),a.col+=1}else{var o=a.cm.options.specialCharPlaceholder(m[0]);o.setAttribute("cm-text",m[0]),uf&&vf<9?k.appendChild(Re("span",[o])):k.appendChild(o),a.col+=1}a.map.push(a.pos,a.pos+1,o),a.pos++}else{a.col+=b.length;var k=document.createTextNode(h);a.map.push(a.pos,a.pos+b.length,k),uf&&vf<9&&(j=!0),a.pos+=b.length}if(a.trailingSpace=32==h.charCodeAt(b.length-1),c||d||e||j||g){var r=c||"";d&&(r+=d),e&&(r+=e);var s=Re("span",[k],r,g);return f&&(s.title=f),a.content.appendChild(s)}a.content.appendChild(k)}}function Pd(a,b){if(a.length>1&&!/ /.test(a))return a;for(var c=b,d="",e=0;ej&&m.from<=j)break}if(m.to>=k)return a(c,d,e,f,g,h,i);a(c,d.slice(0,m.to-j),e,f,null,h,i),f=null,d=d.slice(m.to-j),j=m.to}}}function Rd(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e),!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id)),e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e)),a.pos+=b,a.trailingSpace=!1}function Sd(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var g,h,i,j,k,l,m,n=e.length,o=0,p=1,q="",r=0;;){if(r==o){i=j=k=l=h="",m=null,r=1/0;for(var s,t=[],u=0;uo||w.collapsed&&v.to==o&&v.from==o)?(null!=v.to&&v.to!=o&&r>v.to&&(r=v.to,j=""),w.className&&(i+=" "+w.className),w.css&&(h=(h?h+";":"")+w.css),w.startStyle&&v.from==o&&(k+=" "+w.startStyle),w.endStyle&&v.to==r&&(s||(s=[])).push(w.endStyle,v.to),w.title&&!l&&(l=w.title),w.collapsed&&(!m||nd(m.marker,w)<0)&&(m=v)):v.from>o&&r>v.from&&(r=v.from)}if(s)for(var u=0;u=n)break;for(var x=Math.min(n,r);;){if(q){var y=o+q.length;if(!m){var z=y>x?q.slice(0,x-o):q;b.addToken(b,z,g?g+i:i,k,o+z.length==r?j:"",l,h)}if(y>=x){q=q.slice(x-o),o=x;break}o=y,k=""}q=e.slice(f,f=c[p++]),g=Ld(c[p++],b.cm.options)}}else for(var p=1;p1&&a.remove(h.line+1,o-1),a.insert(h.line+1,p)}ye(a,"change",a,b)}function Vd(a){this.lines=a,this.parent=null;for(var b=0,c=0;b=a.size)throw new Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(b1&&!a.done[a.done.length-2].ranges?(a.done.pop(),Ge(a.done)):void 0}function je(a,b,c,d){var e=a.history;e.undone.length=0;var f,g=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>g-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))&&(f=ie(e,e.lastOp==d))){var h=Ge(f.changes);0==Of(b.from,b.to)&&0==Of(b.from,h.to)?h.to=ag(b):f.changes.push(ge(a,b))}else{var i=Ge(e.done);for(i&&i.ranges||me(a.sel,e.done),f={changes:[ge(a,b)],generation:e.generation},e.done.push(f);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(c),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=g,e.lastOp=e.lastSelOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,h||Ig(a,"historyAdded")}function ke(a,b,c,d){var e=b.charAt(0);return"*"==e||"+"==e&&c.ranges.length==d.ranges.length&&c.somethingSelected()==d.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}function le(a,b,c,d){var e=a.history,f=d&&d.origin;c==e.lastSelOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||ke(a,f,Ge(e.done),b))?e.done[e.done.length-1]=b:me(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastSelOp=c,d&&d.clearRedo!==!1&&he(e.undone)}function me(a,b){var c=Ge(b);c&&c.ranges&&c.equals(a)||b.push(a)}function ne(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),(function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f}))}function oe(a){if(!a)return null;for(var b,c=0;c-1&&(Ge(h)[l]=k[l],delete k[l])}}}return e}function re(a,b,c,d){c0?d.slice():Gg:d||Gg}function ye(a,b){function c(a){return function(){a.apply(null,f)}}var d=xe(a,b,!1);if(d.length){var e,f=Array.prototype.slice.call(arguments,2);Uf?e=Uf.delayedCallbacks:Jg?e=Jg:(e=Jg=[],setTimeout(ze,0));for(var g=0;g0}function De(a){a.prototype.on=function(a,b){Fg(this,a,b)},a.prototype.off=function(a,b){Hg(this,a,b)}}function Ee(){this.id=null}function Fe(a){for(;Rg.length<=a;)Rg.push(Ge(Rg)+" ");return Rg[a]}function Ge(a){return a[a.length-1]}function He(a,b){for(var c=0;c-1&&Vg(a))||b.test(a):Vg(a)}function Pe(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function Qe(a){return a.charCodeAt(0)>=768&&Wg.test(a)}function Re(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f0;--b)a.removeChild(a.firstChild);return a}function Te(a,b){return Se(a).appendChild(b)}function Ue(){for(var a=document.activeElement;a&&a.root&&a.root.activeElement;)a=a.root.activeElement;return a}function Ve(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function We(a,b){for(var c=a.split(" "),d=0;d2&&!(uf&&vf<8))}var c=Yg?Re("span","​"):Re("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return c.setAttribute("cm-text",""),c}function _e(a){if(null!=Zg)return Zg;var b=Te(a,document.createTextNode("AخA")),c=Tg(b,0,1).getBoundingClientRect(),d=Tg(b,1,2).getBoundingClientRect();return Se(a),!(!c||c.left==c.right)&&(Zg=d.right-c.right<3)}function af(a){if(null!=fh)return fh;var b=Te(a,Re("span","x")),c=b.getBoundingClientRect(),d=Tg(b,0,1).getBoundingClientRect();return fh=Math.abs(c.left-d.left)>1}function bf(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;fb||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function cf(a){return a.level%2?a.to:a.from}function df(a){return a.level%2?a.from:a.to}function ef(a){var b=ee(a);return b?cf(b[0]):0}function ff(a){var b=ee(a);return b?df(Ge(b)):a.text.length}function gf(a,b){var c=Zd(a.doc,b),d=sd(c);d!=c&&(b=be(d));var e=ee(d),f=e?e[0].level%2?ff(d):ef(d):0;return Nf(b,f)}function hf(a,b){for(var c,d=Zd(a.doc,b);c=qd(d);)d=c.find(1,!0).line,b=null;var e=ee(d),f=e?e[0].level%2?ef(d):ff(d):d.text.length;return Nf(null==b?be(d):b,f)}function jf(a,b){var c=gf(a,b.line),d=Zd(a.doc,c.line),e=ee(d);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;return Nf(c.line,g?0:f)}return c}function kf(a,b,c){var d=a[0].level;return b==d||c!=d&&bb)return d;if(e.from==b||e.to==b){if(null!=c)return kf(a,e.level,a[c].level)?(e.from!=e.to&&(hh=c),d):(e.from!=e.to&&(hh=d),c);c=d}}return c}function mf(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&Qe(a.text.charAt(b)));return b}function nf(a,b,c,d){var e=ee(a);if(!e)return of(a,b,c,d);for(var f=lf(e,b),g=e[f],h=mf(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?mf(a,g.to,-1,d):mf(a,g.from,1,d)}}function of(a,b,c,d){var e=b+c;if(d)for(;e>0&&Qe(a.text.charAt(e));)e+=c;return e<0||e>a.text.length?null:e}var pf=navigator.userAgent,qf=navigator.platform,rf=/gecko\/\d/i.test(pf),sf=/MSIE \d/.test(pf),tf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(pf),uf=sf||tf,vf=uf&&(sf?document.documentMode||6:tf[1]),wf=/WebKit\//.test(pf),xf=wf&&/Qt\/\d+\.\d+/.test(pf),yf=/Chrome\//.test(pf),zf=/Opera\//.test(pf),Af=/Apple Computer/.test(navigator.vendor),Bf=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(pf),Cf=/PhantomJS/.test(pf),Df=/AppleWebKit/.test(pf)&&/Mobile\/\w+/.test(pf),Ef=Df||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(pf),Ff=Df||/Mac/.test(qf),Gf=/\bCrOS\b/.test(pf),Hf=/win/i.test(qf),If=zf&&pf.match(/Version\/(\d*\.\d*)/);If&&(If=Number(If[1])),If&&If>=15&&(zf=!1,wf=!0);var Jf=Ff&&(xf||zf&&(null==If||If<12.11)),Kf=rf||uf&&vf>=9,Lf=!1,Mf=!1;p.prototype=Me({update:function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;if(c){this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0";var e=a.viewHeight-(b?d:0);this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+e)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(b){this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px";var f=a.viewWidth-a.barLeft-(c?d:0);this.horiz.firstChild.style.width=a.scrollWidth-a.clientWidth+f+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&a.clientHeight>0&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:c?d:0,bottom:b?d:0}},setScrollLeft:function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert); -},zeroWidthHack:function(){var a=Ff&&!Bf?"12px":"18px";this.horiz.style.height=this.vert.style.width=a,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Ee,this.disableVert=new Ee},enableZeroWidthBar:function(a,b){function c(){var d=a.getBoundingClientRect(),e=document.elementFromPoint(d.left+1,d.bottom-1);e!=a?a.style.pointerEvents="none":b.set(1e3,c)}a.style.pointerEvents="auto",b.set(1e3,c)},clear:function(){var a=this.horiz.parentNode;a.removeChild(this.horiz),a.removeChild(this.vert)}},p.prototype),q.prototype=Me({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},q.prototype),a.scrollbarModel={native:p,null:q},z.prototype.signal=function(a,b){Ce(a,b)&&this.events.push(arguments)},z.prototype.finish=function(){for(var a=0;a=9&&c.hasSelection&&(c.hasSelection=null),c.poll()})),Fg(f,"paste",(function(a){Ae(d,a)||$(a,d)||(d.state.pasteIncoming=!0,c.fastPoll())})),Fg(f,"cut",b),Fg(f,"copy",b),Fg(a.scroller,"paste",(function(b){Ub(a,b)||Ae(d,b)||(d.state.pasteIncoming=!0,c.focus())})),Fg(a.lineSpace,"selectstart",(function(b){Ub(a,b)||Cg(b)})),Fg(f,"compositionstart",(function(){var a=d.getCursor("from");c.composing&&c.composing.range.clear(),c.composing={start:a,range:d.markText(a,d.getCursor("to"),{className:"CodeMirror-composing"})}})),Fg(f,"compositionend",(function(){c.composing&&(c.poll(),c.composing.range.clear(),c.composing=null)}))},prepareSelection:function(){var a=this.cm,b=a.display,c=a.doc,d=Ja(a);if(a.options.moveInputWithCursor){var e=ob(a,c.sel.primary().head,"div"),f=b.wrapper.getBoundingClientRect(),g=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,e.top+g.top-f.top)),d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,e.left+g.left-f.left))}return d},showSelection:function(a){var b=this.cm,c=b.display;Te(c.cursorDiv,a.cursors),Te(c.selectionDiv,a.selection),null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")},reset:function(a){if(!this.contextMenuPending){var b,c,d=this.cm,e=d.doc;if(d.somethingSelected()){this.prevInput="";var f=e.sel.primary();b=eh&&(f.to().line-f.from().line>100||(c=d.getSelection()).length>1e3);var g=b?"-":c||d.getSelection();this.textarea.value=g,d.state.focused&&Sg(this.textarea),uf&&vf>=9&&(this.hasSelection=g)}else a||(this.prevInput=this.textarea.value="",uf&&vf>=9&&(this.hasSelection=null));this.inaccurateSelection=b}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Ef||Ue()!=this.textarea))try{this.textarea.focus()}catch(a){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var a=this;a.pollingFast||a.polling.set(this.cm.options.pollInterval,(function(){a.poll(),a.cm.state.focused&&a.slowPoll()}))},fastPoll:function(){function a(){var d=c.poll();d||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0,c.polling.set(20,a)},poll:function(){var a=this.cm,b=this.textarea,c=this.prevInput;if(this.contextMenuPending||!a.state.focused||dh(b)&&!c&&!this.composing||a.isReadOnly()||a.options.disableInput||a.state.keySeq)return!1;var d=b.value;if(d==c&&!a.somethingSelected())return!1;if(uf&&vf>=9&&this.hasSelection===d||Ff&&/[\uf700-\uf7ff]/.test(d))return a.display.input.reset(),!1;if(a.doc.sel==a.display.selForContextMenu){var e=d.charCodeAt(0);if(8203!=e||c||(c="​"),8666==e)return this.reset(),this.cm.execCommand("undo")}for(var f=0,g=Math.min(c.length,d.length);f1e3||d.indexOf("\n")>-1?b.value=h.prevInput="":h.prevInput=d,h.composing&&(h.composing.range.clear(),h.composing.range=a.markText(h.composing.start,a.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){uf&&vf>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),b="​"+(a?g.value:"");g.value="⇚",g.value=b,d.prevInput=a?"":"​",g.selectionStart=1,g.selectionEnd=b.length,f.selForContextMenu=e.doc.sel}}function c(){if(d.contextMenuPending=!1,d.wrapper.style.cssText=l,g.style.cssText=k,uf&&vf<9&&f.scrollbars.setScrollTop(f.scroller.scrollTop=i),null!=g.selectionStart){(!uf||uf&&vf<9)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&g.selectionEnd>0&&"​"==d.prevInput?Fb(e,lg.selectAll)(e):a++<10?f.detectingSelectAll=setTimeout(c,500):f.input.reset()};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=Vb(e,a),i=f.scroller.scrollTop;if(h&&!zf){var j=e.options.resetSelectionOnContextMenu;j&&e.doc.sel.contains(h)==-1&&Fb(e,Aa)(e.doc,na(h),Mg);var k=g.style.cssText,l=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";var m=d.wrapper.getBoundingClientRect();if(g.style.cssText="position: absolute; width: 30px; height: 30px; top: "+(a.clientY-m.top-5)+"px; left: "+(a.clientX-m.left-5)+"px; z-index: 1000; background: "+(uf?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",wf)var n=window.scrollY;if(f.input.focus(),wf&&window.scrollTo(null,n),f.input.reset(),e.somethingSelected()||(g.value=d.prevInput=" "),d.contextMenuPending=!0,f.selForContextMenu=e.doc.sel,clearTimeout(f.detectingSelectAll),uf&&vf>=9&&b(),Kf){Eg(a);var o=function(){Hg(window,"mouseup",o),setTimeout(c,20)};Fg(window,"mouseup",o)}else setTimeout(c,50)}},readOnlyChanged:function(a){a||this.reset()},setUneditable:Ke,needsContentAttribute:!1},ca.prototype),ea.prototype=Me({init:function(a){function b(a){if(!Ae(d,a)){if(d.somethingSelected())Pf={lineWise:!1,text:d.getSelections()},"cut"==a.type&&d.replaceSelection("",null,"cut");else{if(!d.options.lineWiseCopyCut)return;var b=aa(d);Pf={lineWise:!0,text:b.text},"cut"==a.type&&d.operation((function(){d.setSelections(b.ranges,0,Mg),d.replaceSelection("",null,"cut")}))}if(a.clipboardData){a.clipboardData.clearData();var f=Pf.text.join("\n");if(a.clipboardData.setData("Text",f),a.clipboardData.getData("Text")==f)return void a.preventDefault()}var g=da(),h=g.firstChild;d.display.lineSpace.insertBefore(g,d.display.lineSpace.firstChild),h.value=Pf.text.join("\n");var i=document.activeElement;Sg(h),setTimeout((function(){d.display.lineSpace.removeChild(g),i.focus(),i==e&&c.showPrimarySelection()}),50)}}var c=this,d=c.cm,e=c.div=a.lineDiv;ba(e,d.options.spellcheck),Fg(e,"paste",(function(a){Ae(d,a)||$(a,d)||vf<=11&&setTimeout(Fb(d,(function(){c.pollContent()||Kb(d)})),20)})),Fg(e,"compositionstart",(function(a){var b=a.data;if(c.composing={sel:d.doc.sel,data:b,startData:b},b){var e=d.doc.sel.primary(),f=d.getLine(e.head.line),g=f.indexOf(b,Math.max(0,e.head.ch-b.length));g>-1&&g<=e.head.ch&&(c.composing.sel=na(Nf(e.head.line,g),Nf(e.head.line,g+b.length)))}})),Fg(e,"compositionupdate",(function(a){c.composing.data=a.data})),Fg(e,"compositionend",(function(a){var b=c.composing;b&&(a.data==b.startData||/\u200b/.test(a.data)||(b.data=a.data),setTimeout((function(){b.handled||c.applyComposition(b),c.composing==b&&(c.composing=null)}),50))})),Fg(e,"touchstart",(function(){c.forceCompositionEnd()})),Fg(e,"input",(function(){c.composing||!d.isReadOnly()&&c.pollContent()||Eb(c.cm,(function(){Kb(d)}))})),Fg(e,"copy",b),Fg(e,"cut",b)},prepareSelection:function(){var a=Ja(this.cm,!1);return a.focus=this.cm.state.focused,a},showSelection:function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))},showPrimarySelection:function(){var a=window.getSelection(),b=this.cm.doc.sel.primary(),c=ha(this.cm,a.anchorNode,a.anchorOffset),d=ha(this.cm,a.focusNode,a.focusOffset);if(!c||c.bad||!d||d.bad||0!=Of(X(c,d),b.from())||0!=Of(W(c,d),b.to())){var e=fa(this.cm,b.from()),f=fa(this.cm,b.to());if(e||f){var g=this.cm.display.view,h=a.rangeCount&&a.getRangeAt(0);if(e){if(!f){var i=g[g.length-1].measure,j=i.maps?i.maps[i.maps.length-1]:i.map;f={node:j[j.length-1],offset:j[j.length-2]-j[j.length-3]}}}else e={node:g[0].measure.map[2],offset:0};try{var k=Tg(e.node,e.offset,f.offset,f.node)}catch(a){}k&&(!rf&&this.cm.state.focused?(a.collapse(e.node,e.offset),k.collapsed||a.addRange(k)):(a.removeAllRanges(),a.addRange(k)),h&&null==a.anchorNode?a.addRange(h):rf&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var a=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){a.gracePeriod=!1,a.selectionChanged()&&a.cm.operation((function(){a.cm.curOp.selectionChanged=!0}))}),20)},showMultipleSelections:function(a){Te(this.cm.display.cursorDiv,a.cursors),Te(this.cm.display.selectionDiv,a.selection)},rememberSelection:function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode,this.lastAnchorOffset=a.anchorOffset,this.lastFocusNode=a.focusNode,this.lastFocusOffset=a.focusOffset},selectionInEditor:function(){var a=window.getSelection();if(!a.rangeCount)return!1;var b=a.getRangeAt(0).commonAncestorContainer;return Xg(this.div,b)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=this;this.selectionInEditor()?this.pollSelection():Eb(this.cm,(function(){b.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,a)},selectionChanged:function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),b=this.cm;this.rememberSelection();var c=ha(b,a.anchorNode,a.anchorOffset),d=ha(b,a.focusNode,a.focusOffset);c&&d&&Eb(b,(function(){Aa(b.doc,na(c,d),Mg),(c.bad||d.bad)&&(b.curOp.selectionChanged=!0)}))}},pollContent:function(){var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),e=c.to();if(d.lineb.viewTo-1)return!1;var f;if(d.line==b.viewFrom||0==(f=Nb(a,d.line)))var g=be(b.view[0].line),h=b.view[0].node;else var g=be(b.view[f].line),h=b.view[f-1].node.nextSibling;var i=Nb(a,e.line);if(i==b.view.length-1)var j=b.viewTo-1,k=b.lineDiv.lastChild;else var j=be(b.view[i+1].line)-1,k=b.view[i+1].node.previousSibling;for(var l=a.doc.splitLines(ja(a,h,k,g,j)),m=$d(a.doc,Nf(g,0),Nf(j,Zd(a.doc,j).text.length));l.length>1&&m.length>1;)if(Ge(l)==Ge(m))l.pop(),m.pop(),j--;else{if(l[0]!=m[0])break;l.shift(),m.shift(),g++}for(var n=0,o=0,p=l[0],q=m[0],r=Math.min(p.length,q.length);n1||l[0]||Of(v,w)?(Gc(a.doc,l,v,w,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(a){this.cm.isReadOnly()?Fb(this.cm,Kb)(this.cm):a.data&&a.data!=a.startData&&Fb(this.cm,Z)(this.cm,a.data,0,a.sel)},setUneditable:function(a){a.contentEditable="false"},onKeyPress:function(a){a.preventDefault(),this.cm.isReadOnly()||Fb(this.cm,Z)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0)},readOnlyChanged:function(a){this.div.contentEditable=String("nocursor"!=a)},onContextMenu:Ke,resetPosition:Ke,needsContentAttribute:!0},ea.prototype),a.inputStyles={textarea:ca,contenteditable:ea},ka.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b=0&&Of(a,d.to())<=0)return c}return-1}},la.prototype={from:function(){return X(this.anchor,this.head)},to:function(){return W(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Qf,Rf,Sf,Tf={left:0,right:0,top:0,bottom:0},Uf=null,Vf=0,Wf=0,Xf=0,Yf=null;uf?Yf=-.53:rf?Yf=15:yf?Yf=-.7:Af&&(Yf=-1/3);var Zf=function(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;return null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail),null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta),{x:b,y:c}};a.wheelEventPixels=function(a){var b=Zf(a);return b.x*=Yf,b.y*=Yf,b};var $f=new Ee,_f=null,ag=a.changeEnd=function(a){return a.text?Nf(a.from.line+a.text.length-1,Ge(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};a.prototype={constructor:a,focus:function(){window.focus(),this.display.input.focus()},setOption:function(a,b){var c=this.options,d=c[a];c[a]==b&&"mode"!=a||(c[a]=b,cg.hasOwnProperty(a)&&Fb(this,cg[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](Vc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;cc&&(Oc(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Mc(this));else{var f=e.from(),g=e.to(),h=Math.max(c,f.line);c=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var i=h;i0&&wa(this.doc,d,new la(f,j[d].to()),Mg)}}})),getTokenAt:function(a,b){return Gd(this,a,b)},getLineTokens:function(a,b){return Gd(this,Nf(a),b,!0)},getTokenTypeAt:function(a){a=pa(this.doc,a);var b,c=Jd(this,Zd(this.doc,a.line)),d=0,e=(c.length-1)/2,f=a.ch;if(0==f)b=c[2];else for(;;){var g=d+e>>1;if((g?c[2*g-1]:0)>=f)e=g;else{if(!(c[2*g+1]e&&(a=e,d=!0),c=Zd(this.doc,a)}else c=a;return lb(this,c,{top:0,left:0},b||"page").top+(d?this.doc.height-de(c):0)},defaultTextHeight:function(){return tb(this.display)},defaultCharWidth:function(){return ub(this.display)},setGutterMarker:Gb((function(a,b,c){return Pc(this.doc,a,"gutter",(function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&Pe(d)&&(a.gutterMarkers=null),!0}))})),clearGutter:Gb((function(a){var b=this,c=b.doc,d=c.first;c.iter((function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Lb(b,d,"gutter"),Pe(c.gutterMarkers)&&(c.gutterMarkers=null)),++d}))})),lineInfo:function(a){if("number"==typeof a){if(!ra(this.doc,a))return null;var b=a;if(a=Zd(this.doc,a),!a)return null}else{var b=be(a);if(null==b)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=ob(this,pa(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",b.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(b),f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Jc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Gb(mc),triggerOnKeyPress:Gb(pc),triggerOnKeyUp:oc,execCommand:function(a){if(lg.hasOwnProperty(a))return lg[a].call(null,this)},triggerElectric:Gb((function(a){_(this,a)})),findPosH:function(a,b,c,d){var e=1;b<0&&(e=-1,b=-b);for(var f=0,g=pa(this.doc,a);f0&&h(c.charAt(d-1));)--d;for(;e.5)&&g(this),Ig(this,"refresh",this)})),swapDoc:Gb((function(a){var b=this.doc;return b.cm=null,Yd(this,a),ib(this),this.display.input.reset(),this.scrollTo(a.scrollLeft,a.scrollTop),this.curOp.forceScroll=!0,ye(this,"swapDoc",this,b),b})),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},De(a);var bg=a.defaults={},cg=a.optionHandlers={},dg=a.Init={toString:function(){return"CodeMirror.Init"}};Tc("value","",(function(a,b){a.setValue(b)}),!0),Tc("mode",null,(function(a,b){a.doc.modeOption=b,c(a)}),!0),Tc("indentUnit",2,c,!0),Tc("indentWithTabs",!1),Tc("smartIndent",!0),Tc("tabSize",4,(function(a){d(a),ib(a),Kb(a)}),!0),Tc("lineSeparator",null,(function(a,b){if(a.doc.lineSep=b,b){var c=[],d=a.doc.first;a.doc.iter((function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(f==-1)break;e=f+b.length,c.push(Nf(d,f))}d++}));for(var e=c.length-1;e>=0;e--)Gc(a.doc,b,c[e],Nf(c[e].line,c[e].ch+b.length))}})),Tc("specialChars",/[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,(function(b,c,d){b.state.specialChars=new RegExp(c.source+(c.test("\t")?"":"|\t"),"g"),d!=a.Init&&b.refresh()})),Tc("specialCharPlaceholder",Nd,(function(a){a.refresh()}),!0),Tc("electricChars",!0),Tc("inputStyle",Ef?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),Tc("spellcheck",!1,(function(a,b){a.getInputField().spellcheck=b}),!0),Tc("rtlMoveVisually",!Hf),Tc("wholeLineUpdateBefore",!0),Tc("theme","default",(function(a){h(a),i(a)}),!0),Tc("keyMap","default",(function(b,c,d){var e=Vc(c),f=d!=a.Init&&Vc(d);f&&f.detach&&f.detach(b,e),e.attach&&e.attach(b,f||null)})),Tc("extraKeys",null),Tc("lineWrapping",!1,e,!0),Tc("gutters",[],(function(a){n(a.options),i(a)}),!0),Tc("fixedGutter",!0,(function(a,b){a.display.gutters.style.left=b?y(a.display)+"px":"0",a.refresh()}),!0),Tc("coverGutterNextToScrollbar",!1,(function(a){s(a)}),!0),Tc("scrollbarStyle","native",(function(a){r(a),s(a),a.display.scrollbars.setScrollTop(a.doc.scrollTop),a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)}),!0),Tc("lineNumbers",!1,(function(a){n(a.options),i(a)}),!0),Tc("firstLineNumber",1,i,!0),Tc("lineNumberFormatter",(function(a){return a}),i,!0),Tc("showCursorWhenSelecting",!1,Ia,!0),Tc("resetSelectionOnContextMenu",!0),Tc("lineWiseCopyCut",!0),Tc("readOnly",!1,(function(a,b){"nocursor"==b?(sc(a),a.display.input.blur(),a.display.disabled=!0):a.display.disabled=!1,a.display.input.readOnlyChanged(b)})),Tc("disableInput",!1,(function(a,b){b||a.display.input.reset()}),!0),Tc("dragDrop",!0,Sb),Tc("allowDropFileTypes",null),Tc("cursorBlinkRate",530),Tc("cursorScrollMargin",0),Tc("cursorHeight",1,Ia,!0),Tc("singleCursorHeightPerLine",!0,Ia,!0),Tc("workTime",100),Tc("workDelay",100),Tc("flattenSpans",!0,d,!0),Tc("addModeClass",!1,d,!0),Tc("pollInterval",100),Tc("undoDepth",200,(function(a,b){a.doc.history.undoDepth=b})),Tc("historyEventDelay",1250),Tc("viewportMargin",10,(function(a){a.refresh()}),!0),Tc("maxHighlightLength",1e4,d,!0),Tc("moveInputWithCursor",!0,(function(a,b){b||a.display.input.resetPosition()})),Tc("tabindex",null,(function(a,b){a.display.input.getField().tabIndex=b||""})),Tc("autofocus",null);var eg=a.modes={},fg=a.mimeModes={};a.defineMode=function(b,c){a.defaults.mode||"null"==b||(a.defaults.mode=b),arguments.length>2&&(c.dependencies=Array.prototype.slice.call(arguments,2)),eg[b]=c},a.defineMIME=function(a,b){fg[a]=b},a.resolveMode=function(b){if("string"==typeof b&&fg.hasOwnProperty(b))b=fg[b];else if(b&&"string"==typeof b.name&&fg.hasOwnProperty(b.name)){var c=fg[b.name];"string"==typeof c&&(c={name:c}),b=Le(c,b),b.name=c.name}else{if("string"==typeof b&&/^[\w\-]+\/[\w\-]+\+xml$/.test(b))return a.resolveMode("application/xml");if("string"==typeof b&&/^[\w\-]+\/[\w\-]+\+json$/.test(b))return a.resolveMode("application/json")}return"string"==typeof b?{name:b}:b||{name:"null"}},a.getMode=function(b,c){var c=a.resolveMode(c),d=eg[c.name];if(!d)return a.getMode(b,"text/plain");var e=d(b,c);if(gg.hasOwnProperty(c.name)){var f=gg[c.name];for(var g in f)f.hasOwnProperty(g)&&(e.hasOwnProperty(g)&&(e["_"+g]=e[g]),e[g]=f[g])}if(e.name=c.name,c.helperType&&(e.helperType=c.helperType),c.modeProps)for(var g in c.modeProps)e[g]=c.modeProps[g];return e},a.defineMode("null",(function(){return{token:function(a){a.skipToEnd()}}})),a.defineMIME("text/plain","null");var gg=a.modeExtensions={};a.extendMode=function(a,b){var c=gg.hasOwnProperty(a)?gg[a]:gg[a]={};Me(b,c)},a.defineExtension=function(b,c){a.prototype[b]=c},a.defineDocExtension=function(a,b){zg.prototype[a]=b},a.defineOption=Tc;var hg=[];a.defineInitHook=function(a){hg.push(a)};var ig=a.helpers={};a.registerHelper=function(b,c,d){ig.hasOwnProperty(b)||(ig[b]=a[b]={_global:[]}),ig[b][c]=d},a.registerGlobalHelper=function(b,c,d,e){a.registerHelper(b,c,e),ig[b]._global.push({pred:d,val:e})};var jg=a.copyState=function(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c},kg=a.startState=function(a,b,c){return!a.startState||a.startState(b,c)};a.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state,a=c.mode}return c||{mode:a,state:b}};var lg=a.commands={selectAll:function(a){a.setSelection(Nf(a.firstLine(),0),Nf(a.lastLine()),Mg)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Mg)},killLine:function(a){Qc(a,(function(b){if(b.empty()){var c=Zd(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line0)e=new Nf(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),Nf(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=Zd(a.doc,e.line-1).text;g&&a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),Nf(e.line-1,g.length-1),Nf(e.line,1),"+transpose")}c.push(new la(e,e))}a.setSelections(c)}))},newlineAndIndent:function(a){Eb(a,(function(){for(var b=a.listSelections().length,c=0;c=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.posb},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos0?null:(d&&b!==!1&&(this.pos+=d[0].length),d)}var e=function(a){return c?a.toLowerCase():a},f=this.string.substr(this.pos,a.length);if(e(f)==e(a))return b!==!1&&(this.pos+=a.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};var rg=0,sg=a.TextMarker=function(a,b){this.lines=[],this.type=b,this.doc=a,this.id=++rg};De(sg),sg.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&vb(a),Ce(this,"clear")){var c=this.find();c&&ye(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;fa.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&this.collapsed&&Kb(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Da(a.doc)),a&&ye(a,"markerCleared",a,this),b&&xb(a),this.parent&&this.parent.clear()}},sg.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e1||!(this.children[0]instanceof Vd))){var h=[];this.collapse(h),this.children=[new Vd(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0;b50){for(var g=e.lines.length%25+25,h=g;h10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d=0;f--)Ac(this,d[f]);h?za(this,h):this.cm&&Mc(this.cm)})),undo:Hb((function(){Cc(this,"undo")})),redo:Hb((function(){Cc(this,"redo")})),undoSelection:Hb((function(){Cc(this,"undo",!0)})),redoSelection:Hb((function(){Cc(this,"redo",!0)})),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=pa(this,a),b=pa(this,b);var d=[],e=a.line;return this.iter(a.line,b.line+1,(function(f){var g=f.markedSpans;if(g)for(var h=0;h=i.to||null==i.from&&e!=a.line||null!=i.from&&e==b.line&&i.from>=b.ch||c&&!c(i.marker)||d.push(i.marker.parent||i.marker)}++e})),d},getAllMarks:function(){var a=[];return this.iter((function(b){var c=b.markedSpans;if(c)for(var d=0;da?(b=a,!0):(a-=f,void++c)})),pa(this,Nf(c,b))},indexFromPos:function(a){a=pa(this,a);var b=a.ch;if(a.lineb&&(b=a.from),null!=a.to&&a.to=b)return g+(b-f);g+=h-f,g+=c-g%c,f=h+1}},Qg=a.findColumn=function(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);f==-1&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);if(e+=f-d,e+=c-e%c,d=f+1,e>=b)return d}},Rg=[""],Sg=function(a){a.select()};Df?Sg=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:uf&&(Sg=function(a){try{a.select()}catch(a){}});var Tg,Ug=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Vg=a.isWordChar=function(a){return/\w/.test(a)||a>"€"&&(a.toUpperCase()!=a.toLowerCase()||Ug.test(a))},Wg=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Tg=document.createRange?function(a,b,c,d){var e=document.createRange();return e.setEnd(d||a,c),e.setStart(a,b),e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(a){return d}return d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d};var Xg=a.contains=function(a,b){if(3==b.nodeType&&(b=b.parentNode),a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)};uf&&vf<11&&(Ue=function(){try{return document.activeElement}catch(a){return document.body}});var Yg,Zg,$g=a.rmClass=function(a,b){var c=a.className,d=Ve(b).exec(c);if(d){var e=c.slice(d.index+d[0].length);a.className=c.slice(0,d.index)+(e?d[1]+e:"")}},_g=a.addClass=function(a,b){var c=a.className;Ve(b).test(c)||(a.className+=(c?" ":"")+b)},ah=!1,bh=(function(){if(uf&&vf<9)return!1;var a=Re("div");return"draggable"in a||"dragDrop"in a})(),ch=a.splitLines=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);e==-1&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");g!=-1?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},dh=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(a){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(a){}return!(!b||b.parentElement()!=a)&&0!=b.compareEndPoints("StartToEnd",b)},eh=(function(){var a=Re("div");return"oncopy"in a||(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)})(),fh=null,gh=a.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};!(function(){for(var a=0;a<10;a++)gh[a+48]=gh[a+96]=String(a);for(var a=65;a<=90;a++)gh[a]=String.fromCharCode(a);for(var a=1;a<=12;a++)gh[a+111]=gh[a+63235]="F"+a})();var hh,ih=(function(){function a(a){return a<=247?c.charAt(a):1424<=a&&a<=1524?"R":1536<=a&&a<=1773?d.charAt(a-1536):1774<=a&&a<=2220?"r":8192<=a&&a<=8203?"w":8204==a?"b":"L"}function b(a,b,c){this.level=a,this.from=b,this.to=c}var c="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",d="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,g=/[LRr]/,h=/[Lb1n]/,i=/[1n]/,j="L";return function(c){if(!e.test(c))return!1;for(var d,k=c.length,l=[],m=0;m0;--b)a.removeChild(a.firstChild);return a}function c(a,c){return b(a).appendChild(c)}function d(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f=b)return g+(b-f);g+=h-f,g+=c-g%c,f=h+1}}function k(){this.id=null}function l(a,b){for(var c=0;c=b)return d+Math.min(g,b-e);if(e+=f-d,e+=c-e%c,d=f+1,e>=b)return d}}function n(a){for(;Hg.length<=a;)Hg.push(o(Hg)+" ");return Hg[a]}function o(a){return a[a.length-1]}function p(a,b){for(var c=[],d=0;d"€"&&(a.toUpperCase()!=a.toLowerCase()||Ig.test(a))}function u(a,b){return b?!!(b.source.indexOf("\\w")>-1&&t(a))||b.test(a):t(a)}function v(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function w(a){return a.charCodeAt(0)>=768&&Jg.test(a)}function x(a,b,c){var e=this;this.input=c,e.scrollbarFiller=d("div",null,"CodeMirror-scrollbar-filler"),e.scrollbarFiller.setAttribute("cm-not-content","true"),e.gutterFiller=d("div",null,"CodeMirror-gutter-filler"),e.gutterFiller.setAttribute("cm-not-content","true"),e.lineDiv=d("div",null,"CodeMirror-code"),e.selectionDiv=d("div",null,null,"position: relative; z-index: 1"),e.cursorDiv=d("div",null,"CodeMirror-cursors"),e.measure=d("div",null,"CodeMirror-measure"),e.lineMeasure=d("div",null,"CodeMirror-measure"),e.lineSpace=d("div",[e.measure,e.lineMeasure,e.selectionDiv,e.cursorDiv,e.lineDiv],null,"position: relative; outline: none"),e.mover=d("div",[d("div",[e.lineSpace],"CodeMirror-lines")],null,"position: relative"),e.sizer=d("div",[e.mover],"CodeMirror-sizer"),e.sizerWidth=null,e.heightForcer=d("div",null,null,"position: absolute; height: "+Cg+"px; width: 1px;"),e.gutters=d("div",null,"CodeMirror-gutters"),e.lineGutter=null,e.scroller=d("div",[e.sizer,e.heightForcer,e.gutters],"CodeMirror-scroll"),e.scroller.setAttribute("tabIndex","-1"),e.wrapper=d("div",[e.scrollbarFiller,e.gutterFiller,e.scroller],"CodeMirror"),fg&&gg<8&&(e.gutters.style.zIndex=-1,e.scroller.style.paddingRight=0),hg||cg&&pg||(e.scroller.draggable=!0),a&&(a.appendChild?a.appendChild(e.wrapper):a(e.wrapper)),e.viewFrom=e.viewTo=b.first,e.reportedViewFrom=e.reportedViewTo=b.first,e.view=[],e.renderedView=null,e.externalMeasured=null,e.viewOffset=0,e.lastWrapHeight=e.lastWrapWidth=0,e.updateLineNumbers=null,e.nativeBarWidth=e.barHeight=e.barWidth=0,e.scrollbarsClipped=!1,e.lineNumWidth=e.lineNumInnerWidth=e.lineNumChars=null,e.alignWidgets=!1,e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null,e.maxLine=null,e.maxLineLength=0,e.maxLineChanged=!1,e.wheelDX=e.wheelDY=e.wheelStartX=e.wheelStartY=null,e.shift=!1,e.selForContextMenu=null,e.activeTouch=null,c.init(e)}function y(a,b){if(b-=a.first,b<0||b>=a.size)throw new Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(b=a.first&&bc?G(c,y(a,c).text.length):N(b,y(a,b.line).text.length)}function N(a,b){var c=a.ch;return null==c||c>b?G(a.line,b):c<0?G(a.line,0):a}function O(a,b){for(var c=[],d=0;d=b:f.to>b);(d||(d=[])).push(new R(g,f.from,i?null:f.to))}}return d}function W(a,b,c){var d;if(a)for(var e=0;e=b:f.to>b);if(h||f.from==b&&"bookmark"==g.type&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from0&&h)for(var v=0;v0)){var k=[i,1],m=H(j.from,h.from),n=H(j.to,h.to);(m<0||!g.inclusiveLeft&&!m)&&k.push({from:j.from,to:h.from}),(n>0||!g.inclusiveRight&&!n)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function $(a){var b=a.markedSpans;if(b){for(var c=0;c=0&&l<=0||k<=0&&l>=0)&&(k<=0&&(i.marker.inclusiveRight&&e.inclusiveLeft?H(j.to,c)>=0:H(j.to,c)>0)||k>=0&&(i.marker.inclusiveRight&&e.inclusiveLeft?H(j.from,d)<=0:H(j.from,d)<0)))return!0}}}function ha(a){for(var b;b=ea(a);)a=b.find(-1,!0).line;return a}function ia(a){for(var b,c;b=fa(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function ja(a,b){var c=y(a,b),d=ha(c);return c==d?b:C(d)}function ka(a,b){if(b>a.lastLine())return b;var c,d=y(a,b);if(!la(a,d))return b;for(;c=fa(d);)d=c.find(1,!0).line;return C(d)+1}function la(a,b){var c=Lg&&b.markedSpans;if(c)for(var d=void 0,e=0;eb.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)}))}function qa(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;fb||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function ra(a){return a.level%2?a.to:a.from}function sa(a){return a.level%2?a.from:a.to}function ta(a){var b=Aa(a);return b?ra(b[0]):0}function ua(a){var b=Aa(a);return b?sa(o(b)):a.text.length}function va(a,b,c){var d=a[0].level;return b==d||c!=d&&bb)return d;if(e.from==b||e.to==b){if(null!=c)return va(a,e.level,a[c].level)?(e.from!=e.to&&(Mg=c),d):(e.from!=e.to&&(Mg=d),c);c=d}}return c}function xa(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&w(a.text.charAt(b)));return b}function ya(a,b,c,d){var e=Aa(a);if(!e)return za(a,b,c,d);for(var f=wa(e,b),g=e[f],h=xa(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?xa(a,g.to,-1,d):xa(a,g.from,1,d)}}function za(a,b,c,d){var e=b+c;if(d)for(;e>0&&w(a.text.charAt(e));)e+=c;return e<0||e>a.text.length?null:e}function Aa(a){var b=a.order;return null==b&&(b=a.order=Ng(a.text)),b}function Ba(a,b,c){var d=a._handlers&&a._handlers[b];return c?d&&d.length>0?d.slice():Pg:d||Pg}function Ca(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else for(var d=Ba(a,b,!1),e=0;e0}function Ha(a){a.prototype.on=function(a,b){Og(this,a,b)},a.prototype.off=function(a,b){Ca(this,a,b)}}function Ia(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Ja(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function Ka(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function La(a){Ia(a),Ja(a)}function Ma(a){return a.target||a.srcElement}function Na(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),qg&&a.ctrlKey&&1==b&&(b=3),b}function Oa(a){if(null==Ag){var b=d("span","​");c(a,d("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(Ag=b.offsetWidth<=1&&b.offsetHeight>2&&!(fg&&gg<8))}var e=Ag?d("span","​"):d("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return e.setAttribute("cm-text",""),e}function Pa(a){if(null!=Bg)return Bg;var d=c(a,document.createTextNode("AخA")),e=ug(d,0,1).getBoundingClientRect(),f=ug(d,1,2).getBoundingClientRect();return b(a),!(!e||e.left==e.right)&&(Bg=f.right-e.right<3)}function Qa(a){if(null!=Ug)return Ug;var b=c(a,d("span","x")),e=b.getBoundingClientRect(),f=ug(b,0,1).getBoundingClientRect();return Ug=Math.abs(e.left-f.left)>1}function Ra(a,b){arguments.length>2&&(b.dependencies=Array.prototype.slice.call(arguments,2)),Vg[a]=b}function Sa(a,b){Wg[a]=b}function Ta(a){if("string"==typeof a&&Wg.hasOwnProperty(a))a=Wg[a];else if(a&&"string"==typeof a.name&&Wg.hasOwnProperty(a.name)){var b=Wg[a.name];"string"==typeof b&&(b={name:b}),a=s(b,a),a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return Ta("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return Ta("application/json")}return"string"==typeof a?{name:a}:a||{name:"null"}}function Ua(a,b){b=Ta(b);var c=Vg[b.name];if(!c)return Ua(a,"text/plain");var d=c(a,b);if(Xg.hasOwnProperty(b.name)){var e=Xg[b.name];for(var f in e)e.hasOwnProperty(f)&&(d.hasOwnProperty(f)&&(d["_"+f]=d[f]),d[f]=e[f])}if(d.name=b.name,b.helperType&&(d.helperType=b.helperType),b.modeProps)for(var g in b.modeProps)d[g]=b.modeProps[g];return d}function Va(a,b){var c=Xg.hasOwnProperty(a)?Xg[a]:Xg[a]={};i(b,c)}function Wa(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function Xa(a,b){for(var c;a.innerMode&&(c=a.innerMode(b),c&&c.mode!=a);)b=c.state,a=c.mode;return c||{mode:a,state:b}}function Ya(a,b,c){return!a.startState||a.startState(b,c)}function Za(a,b,c,d){var e=[a.state.modeGen],f={};fb(a,b.text,a.doc.mode,c,(function(a,b){return e.push(a,b)}),f,d);for(var g=function(c){var d=a.state.overlays[c],g=1,h=0;fb(a,b.text,d.mode,!0,(function(a,b){for(var c=g;ha&&e.splice(g,1,a,e[g+1],f),g+=2,h=Math.min(a,f)}if(b)if(d.opaque)e.splice(c,g-c,a,"overlay "+b),g=c+2;else for(;ca.options.maxHighlightLength?Wa(a.doc.mode,d):d);b.stateAfter=d,b.styles=e.styles,e.classes?b.styleClasses=e.classes:b.styleClasses&&(b.styleClasses=null),c===a.doc.frontier&&a.doc.frontier++}return b.styles}function _a(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=gb(a,b,c),g=f>d.first&&y(d,f-1).stateAfter;return g=g?Wa(d.mode,g):Ya(d.mode),d.iter(f,b,(function(c){ab(a,c.text,g);var h=f==b-1||f%5==0||f>=e.viewFrom&&fb.start)return f}throw new Error("Mode "+a.name+" failed to advance stream.")}function db(a,b,c,d){var e,f=function(a){return{start:l.start,end:l.pos,string:l.current(),type:e||null,state:a?Wa(g.mode,k):k}},g=a.doc,h=g.mode;b=M(g,b);var i,j=y(g,b.line),k=_a(a,b.line,c),l=new Yg(j.text,a.options.tabSize);for(d&&(i=[]);(d||l.posa.options.maxHighlightLength?(h=!1,g&&ab(a,b,d,l.pos),l.pos=b.length,i=null):i=eb(cb(c,l,d,m),f),m){var n=m[0].name;n&&(i="m-"+(i?n+" "+i:n))}if(!h||k!=i){for(;jg;--h){if(h<=f.first)return f.first;var i=y(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var k=j(i.text,null,a.options.tabSize);(null==e||d>k)&&(e=h-1,d=k)}return e}function hb(a,b,c){this.text=a,_(this,b),this.height=c?c(this):1}function ib(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),$(a),_(a,c);var e=d?d(a):1;e!=a.height&&B(a,e)}function jb(a){a.parent=null,$(a)}function kb(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?_g:$g;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function lb(a,b){var c=d("span",null,null,hg?"padding-right: .1px":null),e={pre:d("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:(fg||hg)&&a.getOption("lineWrapping")};b.measure={};for(var f=0;f<=(b.rest?b.rest.length:0);f++){var h=f?b.rest[f-1]:b.line,i=void 0;e.pos=0,e.addToken=nb,Pa(a.display.measure)&&(i=Aa(h))&&(e.addToken=pb(e.addToken,i)),e.map=[];var j=b!=a.display.externalMeasured&&C(h);rb(h,e,$a(a,h,j)),h.styleClasses&&(h.styleClasses.bgClass&&(e.bgClass=g(h.styleClasses.bgClass,e.bgClass||"")),h.styleClasses.textClass&&(e.textClass=g(h.styleClasses.textClass,e.textClass||""))),0==e.map.length&&e.map.push(0,0,e.content.appendChild(Oa(a.display.measure))),0==f?(b.measure.map=e.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(e.map),(b.measure.caches||(b.measure.caches=[])).push({}))}if(hg){var k=e.content.lastChild;(/\bcm-tab\b/.test(k.className)||k.querySelector&&k.querySelector(".cm-tab"))&&(e.content.className="cm-tab-wrap-hack")}return Da(a,"renderLine",a,b.line,e.pre),e.pre.className&&(e.textClass=g(e.pre.className,e.textClass||"")),e}function mb(a){var b=d("span","•","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b.setAttribute("aria-label",b.title),b}function nb(a,b,c,e,f,g,h){if(b){var i,j=a.splitSpaces?ob(b,a.trailingSpace):b,k=a.cm.state.specialChars,l=!1;if(k.test(b)){i=document.createDocumentFragment();for(var m=0;;){k.lastIndex=m;var o=k.exec(b),p=o?o.index-m:b.length-m;if(p){var q=document.createTextNode(j.slice(m,m+p));fg&&gg<9?i.appendChild(d("span",[q])):i.appendChild(q),a.map.push(a.pos,a.pos+p,q),a.col+=p,a.pos+=p}if(!o)break;m+=p+1;var r=void 0;if("\t"==o[0]){var s=a.cm.options.tabSize,t=s-a.col%s;r=i.appendChild(d("span",n(t),"cm-tab")),r.setAttribute("role","presentation"),r.setAttribute("cm-text","\t"),a.col+=t}else"\r"==o[0]||"\n"==o[0]?(r=i.appendChild(d("span","\r"==o[0]?"␍":"␤","cm-invalidchar")),r.setAttribute("cm-text",o[0]),a.col+=1):(r=a.cm.options.specialCharPlaceholder(o[0]),r.setAttribute("cm-text",o[0]),fg&&gg<9?i.appendChild(d("span",[r])):i.appendChild(r),a.col+=1);a.map.push(a.pos,a.pos+1,r),a.pos++}}else a.col+=b.length,i=document.createTextNode(j),a.map.push(a.pos,a.pos+b.length,i),fg&&gg<9&&(l=!0),a.pos+=b.length;if(a.trailingSpace=32==j.charCodeAt(b.length-1),c||e||f||l||h){var u=c||"";e&&(u+=e),f&&(u+=f);var v=d("span",[i],u,h);return g&&(v.title=g),a.content.appendChild(v)}a.content.appendChild(i)}}function ob(a,b){if(a.length>1&&!/ /.test(a))return a;for(var c=b,d="",e=0;ej&&l.from<=j));m++);if(l.to>=k)return a(c,d,e,f,g,h,i);a(c,d.slice(0,l.to-j),e,f,null,h,i),f=null,d=d.slice(l.to-j),j=l.to}}}function qb(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e),!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id)),e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e)),a.pos+=b,a.trailingSpace=!1}function rb(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var g,h,i,j,k,l,m,n=e.length,o=0,p=1,q="",r=0;;){if(r==o){i=j=k=l=h="",m=null,r=1/0;for(var s=[],t=void 0,u=0;uo||w.collapsed&&v.to==o&&v.from==o)?(null!=v.to&&v.to!=o&&r>v.to&&(r=v.to,j=""),w.className&&(i+=" "+w.className),w.css&&(h=(h?h+";":"")+w.css),w.startStyle&&v.from==o&&(k+=" "+w.startStyle),w.endStyle&&v.to==r&&(t||(t=[])).push(w.endStyle,v.to),w.title&&!l&&(l=w.title),w.collapsed&&(!m||ca(m.marker,w)<0)&&(m=v)):v.from>o&&r>v.from&&(r=v.from)}if(t)for(var x=0;x=n)break;for(var z=Math.min(n,r);;){if(q){var A=o+q.length;if(!m){var B=A>z?q.slice(0,z-o):q;b.addToken(b,B,g?g+i:i,k,o+B.length==r?j:"",l,h)}if(A>=z){q=q.slice(z-o),o=z;break}o=A,k=""}q=e.slice(f,f=c[p++]),g=kb(c[p++],b.cm.options)}}else for(var C=1;C2&&f.push((i.bottom+j.top)/2-c.top)}}f.push(c.bottom-c.top)}}function Ub(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;dc)return{map:a.measure.maps[e],cache:a.measure.caches[e],before:!0}}function Vb(a,b){b=ha(b);var d=C(b),e=a.display.externalMeasured=new sb(a.doc,b,d);e.lineN=d;var f=e.built=lb(a,e);return e.text=f.pre,c(a.display.lineMeasure,f.pre),e}function Wb(a,b,c,d){return Zb(a,Yb(a,b),c,d)}function Xb(a,b){if(b>=a.display.viewFrom&&b=c.lineN&&bb)&&(f=i-h,e=f-1,b>=i&&(g="right")),null!=e){if(d=a[j+2],h==i&&c==(d.insertLeft?"left":"right")&&(g=c),"left"==c&&0==e)for(;j&&a[j-2]==a[j-3]&&a[j-1].insertLeft;)d=a[(j-=3)+2],g="left";if("right"==c&&e==i-h)for(;j=0&&(c=a[e]).left==c.right;e--);return c}function ac(a,b,c,d){var e,f=$b(b.map,c,d),g=f.node,h=f.start,i=f.end,j=f.collapse;if(3==g.nodeType){for(var k=0;k<4;k++){for(;h&&w(b.line.text.charAt(f.coverStart+h));)--h;for(;f.coverStart+i0&&(j=d="right"); +var l;e=a.options.lineWrapping&&(l=g.getClientRects()).length>1?l["right"==d?l.length-1:0]:g.getBoundingClientRect()}if(fg&&gg<9&&!h&&(!e||!e.left&&!e.right)){var m=g.parentNode.getClientRects()[0];e=m?{left:m.left,right:m.left+qc(a.display),top:m.top,bottom:m.bottom}:ch}for(var n=e.top-b.rect.top,o=e.bottom-b.rect.top,p=(n+o)/2,q=b.view.measure.heights,r=0;rc.from?g(a-1):g(a,d)}d=d||y(a.doc,b.line),e||(e=Yb(a,d));var i=Aa(d),j=b.ch;if(!i)return g(j);var k=wa(i,j),l=h(j,k);return null!=Mg&&(l.other=h(j,Mg)),l}function lc(a,b){var c=0;b=M(a.doc,b),a.options.lineWrapping||(c=qc(a.display)*b.ch);var d=y(a.doc,b.line),e=na(d)+Nb(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function mc(a,b,c,d){var e=G(a,b);return e.xRel=d,c&&(e.outside=!0),e}function nc(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,c<0)return mc(d.first,0,!0,-1);var e=D(d,c),f=d.first+d.size-1;if(e>f)return mc(d.first+d.size-1,y(d,f).text.length,!0,1);b<0&&(b=0);for(var g=y(d,e);;){var h=oc(a,g,e,b,c),i=fa(g),j=i&&i.find(0,!0);if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=C(g=j.to.line)}}function oc(a,b,c,d,e){function f(d){var e=kc(a,G(c,d),"line",b,j);return h=!0,g>e.bottom?e.left-i:gq)return mc(c,n,r,1);for(;;){if(k?n==m||n==ya(b,m,1):n-m<=1){var s=d0&&s1){var v=Zb(a,j,s,"right");g<=v.bottom&&g>=v.top&&Math.abs(d-v.right)1?1:0);return x}var y=Math.ceil(l/2),z=m+y;if(k){z=m;for(var A=0;Ad?(n=z,q=B,(r=h)&&(q+=1e3),l=y):(m=z,o=B,p=h,l-=y)}}function pc(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Zg){Zg=d("pre");for(var e=0;e<49;++e)Zg.appendChild(document.createTextNode("x")),Zg.appendChild(d("br"));Zg.appendChild(document.createTextNode("x"))}c(a.measure,Zg);var f=Zg.offsetHeight/50;return f>3&&(a.cachedTextHeight=f),b(a.measure),f||1}function qc(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=d("span","xxxxxxxxxx"),e=d("pre",[b]);c(a.measure,e);var f=b.getBoundingClientRect(),g=(f.right-f.left)/10;return g>2&&(a.cachedCharWidth=g),g||10}function rc(a){for(var b=a.display,c={},d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g)c[a.options.gutters[g]]=f.offsetLeft+f.clientLeft+e,d[a.options.gutters[g]]=f.clientWidth;return{fixedPos:sc(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function sc(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function tc(a){var b=pc(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/qc(a.display)-3);return function(e){if(la(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g=a.display.viewTo)return null;if(b-=a.display.viewFrom,b<0)return null;for(var c=a.display.view,d=0;d=a.display.viewTo||h.to().line3&&(e(n,p.top,null,p.bottom),n=k,p.bottomi.bottom||j.bottom==i.bottom&&j.right>i.right)&&(i=j),n0?b.blinker=setInterval((function(){return b.cursorDiv.style.visibility=(c=!c)?"":"hidden"}),a.options.cursorBlinkRate):a.options.cursorBlinkRate<0&&(b.cursorDiv.style.visibility="hidden")}}function Cc(a){a.state.focused||(a.display.input.focus(),Ec(a))}function Dc(a){a.state.delayingBlurEvent=!0,setTimeout((function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Fc(a))}),100)}function Ec(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1),"nocursor"!=a.options.readOnly&&(a.state.focused||(Da(a,"focus",a,b),a.state.focused=!0,f(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),hg&&setTimeout((function(){return a.display.input.reset(!0)}),20)),a.display.input.receivedFocus()),Bc(a))}function Fc(a,b){a.state.delayingBlurEvent||(a.state.focused&&(Da(a,"blur",a,b),a.state.focused=!1,xg(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout((function(){a.state.focused||(a.display.shift=!1)}),150))}function Gc(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=sc(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g.001||i<-.001)&&(B(e.line,f),Jc(e.line),e.rest))for(var j=0;j=g&&(f=D(b,na(y(b,i))-a.wrapper.clientHeight),g=i)}return{from:f,to:Math.max(g,f+1)}}function Lc(a,b){Math.abs(a.doc.scrollTop-b)<2||(a.doc.scrollTop=b,cg||zd(a,{top:b}),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbars.setScrollTop(b),cg&&zd(a),td(a,100))}function Mc(a,b,c){(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,Gc(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function Nc(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;return null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail),null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta),{x:b,y:c}}function Oc(a){var b=Nc(a);return b.x*=eh,b.y*=eh,b}function Pc(a,b){var c=Nc(b),d=c.x,e=c.y,f=a.display,g=f.scroller,h=g.scrollWidth>g.clientWidth,i=g.scrollHeight>g.clientHeight;if(d&&h||e&&i){if(e&&qg&&hg)a:for(var j=b.target,k=f.view;j!=g;j=j.parentNode)for(var l=0;l(window.innerHeight||document.documentElement.clientHeight)&&(f=!1),null!=f&&!ng){var g=d("div","​",null,"position: absolute;\n top: "+(b.top-c.viewOffset-Nb(a.display))+"px;\n height: "+(b.bottom-b.top+Qb(a)+c.barHeight)+"px;\n left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(g),g.scrollIntoView(f),a.display.lineSpace.removeChild(g)}}}function Xc(a,b,c,d){null==d&&(d=0);for(var e,f=0;f<5;f++){var g=!1;e=kc(a,b);var h=c&&c!=b?kc(a,c):e,i=Zc(a,Math.min(e.left,h.left),Math.min(e.top,h.top)-d,Math.max(e.left,h.left),Math.max(e.bottom,h.bottom)+d),j=a.doc.scrollTop,k=a.doc.scrollLeft;if(null!=i.scrollTop&&(Lc(a,i.scrollTop),Math.abs(a.doc.scrollTop-j)>1&&(g=!0)),null!=i.scrollLeft&&(Mc(a,i.scrollLeft),Math.abs(a.doc.scrollLeft-k)>1&&(g=!0)),!g)break}return e}function Yc(a,b,c,d,e){var f=Zc(a,b,c,d,e);null!=f.scrollTop&&Lc(a,f.scrollTop),null!=f.scrollLeft&&Mc(a,f.scrollLeft)}function Zc(a,b,c,d,e){var f=a.display,g=pc(a.display);c<0&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=Sb(a),j={};e-c>i&&(e=c+i);var k=a.doc.height+Ob(f),l=ck-g;if(ch+i){var n=Math.min(c,(m?k:e)-i);n!=h&&(j.scrollTop=n)}var o=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:f.scroller.scrollLeft,p=Rb(a)-(a.options.fixedGutter?f.gutters.offsetWidth:0),q=d-b>p;return q&&(d=b+p),b<10?j.scrollLeft=0:bp+o-3&&(j.scrollLeft=d+(q?0:10)-p),j}function $c(a,b,c){null==b&&null==c||ad(a),null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b),null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function _c(a){ad(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?G(b.line,b.ch-1):b,d=G(b.line,b.ch+1)),a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function ad(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=lc(a,b.from),d=lc(a,b.to),e=Zc(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(e.scrollLeft,e.scrollTop)}}function bd(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++gh},ub(a.curOp)}function cd(a){var b=a.curOp;wb(b,(function(a){for(var b=0;b=c.viewTo)||c.maxLineChanged&&b.options.lineWrapping,a.update=a.mustUpdate&&new vd(b,a.mustUpdate&&{top:a.scrollTop,ensure:a.scrollToPos},a.forceUpdate)}function fd(a){a.updatedDisplay=a.mustUpdate&&xd(a.cm,a.update)}function gd(a){var b=a.cm,c=b.display;a.updatedDisplay&&Ic(b),a.barMeasure=Qc(b),c.maxLineChanged&&!b.options.lineWrapping&&(a.adjustWidthTo=Wb(b,c.maxLine,c.maxLine.text.length).left+3,b.display.sizerWidth=a.adjustWidthTo,a.barMeasure.scrollWidth=Math.max(c.scroller.clientWidth,c.sizer.offsetLeft+a.adjustWidthTo+Qb(b)+b.display.barWidth),a.maxScrollLeft=Math.max(0,c.sizer.offsetLeft+a.adjustWidthTo-Rb(b))),(a.updatedDisplay||a.selectionChanged)&&(a.preparedSelection=c.input.prepareSelection(a.focus))}function hd(a){var b=a.cm;null!=a.adjustWidthTo&&(b.display.sizer.style.minWidth=a.adjustWidthTo+"px",a.maxScrollLeftb)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)Lg&&ja(a.doc,b)e.viewFrom?pd(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)pd(a);else if(b<=e.viewFrom){var f=qd(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):pd(a)}else if(c>=e.viewTo){var g=qd(a,b,b,-1);g?(e.view=e.view.slice(0,g.index),e.viewTo=g.lineN):pd(a)}else{var h=qd(a,b,b,-1),i=qd(a,c,c+d,1);h&&i?(e.view=e.view.slice(0,h.index).concat(tb(a,h.lineN,i.lineN)).concat(e.view.slice(i.index)),e.viewTo+=d):pd(a)}var j=e.externalMeasured;j&&(c=e.lineN&&b=d.viewTo)){var f=d.view[wc(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);l(g,c)==-1&&g.push(c)}}}function pd(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function qd(a,b,c,d){var e,f=wc(a,b),g=a.display.view;if(!Lg||c==a.doc.first+a.doc.size)return{index:f,lineN:c};for(var h=a.display.viewFrom,i=0;i0){if(f==g.length-1)return null;e=h+g[f].size-b,f++}else e=h-b;b+=e,c+=e}for(;ja(a.doc,c)!=c;){if(f==(d<0?0:g.length-1))return null;c+=d*g[f-(d<0?1:0)].size,f+=d}return{index:f,lineN:c}}function rd(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=tb(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=tb(a,b,d.viewFrom).concat(d.view):d.viewFromc&&(d.view=d.view.slice(0,wc(a,c)))),d.viewTo=c}function sd(a){for(var b=a.display.view,c=0,d=0;d=a.display.viewTo)){var c=+new Date+a.options.workTime,d=Wa(b.mode,_a(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),(function(f){if(b.frontier>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength,i=Za(a,f,h?Wa(b.mode,d):d,!0);f.styles=i.styles;var j=f.styleClasses,k=i.classes;k?f.styleClasses=k:j&&(f.styleClasses=null);for(var l=!g||g.length!=f.styles.length||j!=k&&(!j||!k||j.bgClass!=k.bgClass||j.textClass!=k.textClass),m=0;!l&&mc)return td(a,a.options.workDelay),!0})),e.length&&jd(a,(function(){for(var b=0;b=d.viewFrom&&c.visible.to<=d.viewTo&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo)&&d.renderedView==d.view&&0==sd(a))return!1;Hc(a)&&(pd(a),c.dims=rc(a));var f=e.first+e.size,g=Math.max(c.visible.from-a.options.viewportMargin,e.first),h=Math.min(f,c.visible.to+a.options.viewportMargin);d.viewFromh&&d.viewTo-h<20&&(h=Math.min(f,d.viewTo)),Lg&&(g=ja(a.doc,g),h=ka(a.doc,h));var i=g!=d.viewFrom||h!=d.viewTo||d.lastWrapHeight!=c.wrapperHeight||d.lastWrapWidth!=c.wrapperWidth;rd(a,g,h),d.viewOffset=na(y(a.doc,d.viewFrom)),a.display.mover.style.top=d.viewOffset+"px";var j=sd(a);if(!i&&0==j&&!c.force&&d.renderedView==d.view&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo))return!1;var k=yg();return j>4&&(d.lineDiv.style.display="none"),Ad(a,d.updateLineNumbers,c.dims),j>4&&(d.lineDiv.style.display=""),d.renderedView=d.view,k&&yg()!=k&&k.offsetHeight&&k.focus(),b(d.cursorDiv),b(d.selectionDiv),d.gutters.style.height=d.sizer.style.minHeight=0,i&&(d.lastWrapHeight=c.wrapperHeight,d.lastWrapWidth=c.wrapperWidth,td(a,400)),d.updateLineNumbers=null,!0}function yd(a,b){for(var c=b.viewport,d=!0;(d&&a.options.lineWrapping&&b.oldDisplayWidth!=Rb(a)||(c&&null!=c.top&&(c={top:Math.min(a.doc.height+Ob(a.display)-Sb(a),c.top)}),b.visible=Kc(a.display,a.doc,c),!(b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)))&&xd(a,b);d=!1){Ic(a);var e=Qc(a);xc(a),Tc(a,e),Cd(a,e)}b.signal(a,"update",a),a.display.viewFrom==a.display.reportedViewFrom&&a.display.viewTo==a.display.reportedViewTo||(b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo)}function zd(a,b){var c=new vd(a,b);if(xd(a,c)){Ic(a),yd(a,c);var d=Qc(a);xc(a),Tc(a,d),Cd(a,d),c.finish()}}function Ad(a,c,d){function e(b){var c=b.nextSibling;return hg&&qg&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b),c}for(var f=a.display,g=a.options.lineNumbers,h=f.lineDiv,i=h.firstChild,j=f.view,k=f.viewFrom,m=0;m-1&&(o=!1),zb(a,n,k,d)),o&&(b(n.lineNumber),n.lineNumber.appendChild(document.createTextNode(F(a.options,k)))),i=n.node.nextSibling}else{var p=Hb(a,n,k,d);h.insertBefore(p,i)}k+=n.size}for(;i;)i=e(i)}function Bd(a){var b=a.display.gutters.offsetWidth;a.display.sizer.style.marginLeft=b+"px"}function Cd(a,b){a.display.sizer.style.minHeight=b.docHeight+"px",a.display.heightForcer.style.top=b.docHeight+"px",a.display.gutters.style.height=b.docHeight+a.display.barHeight+Qb(a)+"px"}function Dd(a){var c=a.display.gutters,e=a.options.gutters;b(c);for(var f=0;f-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function Fd(a,b){this.ranges=a,this.primIndex=b}function Gd(a,b){this.anchor=a,this.head=b}function Hd(a,b){var c=a[b];a.sort((function(a,b){return H(a.from(),b.from())})),b=l(a,c);for(var d=1;d=0){var g=K(f.from(),e.from()),h=J(f.to(),e.to()),i=f.empty()?e.from()==e.head:f.from()==f.head;d<=b&&--b,a.splice(--d,2,new Gd(i?h:g,i?g:h))}}return new Fd(a,b)}function Id(a,b){return new Fd([new Gd(a,b||a)],0)}function Jd(a){return a.text?G(a.from.line+a.text.length-1,o(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function Kd(a,b){if(H(a,b.from)<0)return a;if(H(a,b.to)<=0)return Jd(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;return a.line==b.to.line&&(d+=Jd(b).ch-b.to.ch),G(c,d)}function Ld(a,b){for(var c=[],d=0;d1&&a.remove(h.line+1,p-1),a.insert(h.line+1,s)}xb(a,"change",a,b)}function Sd(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;g1&&!a.done[a.done.length-2].ranges?(a.done.pop(),o(a.done)):void 0}function Yd(a,b,c,d){var e=a.history;e.undone.length=0;var f,g,h=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>h-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))&&(f=Xd(e,e.lastOp==d)))g=o(f.changes),0==H(b.from,b.to)&&0==H(b.from,g.to)?g.to=Jd(b):f.changes.push(Vd(a,b));else{var i=o(e.done);for(i&&i.ranges||_d(a.sel,e.done),f={changes:[Vd(a,b)],generation:e.generation},e.done.push(f);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(c),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=h,e.lastOp=e.lastSelOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,g||Da(a,"historyAdded")}function Zd(a,b,c,d){var e=b.charAt(0);return"*"==e||"+"==e&&c.ranges.length==d.ranges.length&&c.somethingSelected()==d.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}function $d(a,b,c,d){var e=a.history,f=d&&d.origin;c==e.lastSelOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||Zd(a,f,o(e.done),b))?e.done[e.done.length-1]=b:_d(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastSelOp=c,d&&d.clearRedo!==!1&&Wd(e.undone)}function _d(a,b){var c=o(b);c&&c.ranges&&c.equals(a)||b.push(a)}function ae(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),(function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f}))}function be(a){if(!a)return null;for(var b,c=0;c-1&&(o(h)[m]=j[m],delete j[m])}}}return d}function fe(a,b,c,d){if(a.cm&&a.cm.display.shift||a.extend){var e=b.anchor;if(d){var f=H(c,e)<0;f!=H(d,e)<0?(e=c,c=d):f!=H(c,d)<0&&(c=d)}return new Gd(e,c)}return new Gd(d||c,c)}function ge(a,b,c,d){me(a,new Fd([fe(a,a.sel.primary(),b,c)],0),d)}function he(a,b,c){for(var d=[],e=0;e=b.ch:h.to>b.ch))){if(e&&(Da(i,"beforeCursorEnter"),i.explicitlyCleared)){if(f.markedSpans){--g;continue}break}if(!i.atomic)continue;if(c){var j=i.find(d<0?1:-1),k=void 0;if((d<0?i.inclusiveRight:i.inclusiveLeft)&&(j=te(a,j,-d,j&&j.line==b.line?f:null)),j&&j.line==b.line&&(k=H(j,c))&&(d<0?k<0:k>0))return re(a,j,b,d,e)}var l=i.find(d<0?-1:1);return(d<0?i.inclusiveLeft:i.inclusiveRight)&&(l=te(a,l,d,l.line==b.line?f:null)),l?re(a,l,b,d,e):null}}return b}function se(a,b,c,d,e){var f=d||1,g=re(a,b,c,f,e)||!e&&re(a,b,c,f,!0)||re(a,b,c,-f,e)||!e&&re(a,b,c,-f,!0);return g?g:(a.cantEdit=!0,G(a.first,0))}function te(a,b,c,d){return c<0&&0==b.ch?b.line>a.first?M(a,G(b.line-1)):null:c>0&&b.ch==(d||y(a,b.line)).text.length?b.line=0;--e)xe(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text});else xe(a,b)}}function xe(a,b){if(1!=b.text.length||""!=b.text[0]||0!=H(b.from,b.to)){var c=Ld(a,b);Yd(a,b,c,a.cm?a.cm.curOp.id:NaN),Ae(a,b,c,X(a,b));var d=[];Sd(a,(function(a,c){c||l(d,a.history)!=-1||(Fe(a.history,b),d.push(a.history)),Ae(a,b,null,X(a,b))}))}}function ye(a,b,c){if(!a.cm||!a.cm.state.suppressEdits||c){for(var d,e=a.history,f=a.sel,g="undo"==b?e.done:e.undone,h="undo"==b?e.undone:e.done,i=0;i=0;--n){var p=m(n);if(p)return p.v}}}}function ze(a,b){if(0!=b&&(a.first+=b,a.sel=new Fd(p(a.sel.ranges,(function(a){return new Gd(G(a.anchor.line+b,a.anchor.ch),G(a.head.line+b,a.head.ch))})),a.sel.primIndex),a.cm)){nd(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;da.lastLine())){if(b.from.linef&&(b={from:b.from,to:G(f,y(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=z(a,b.from,b.to),c||(c=Ld(a,b)),a.cm?Be(a.cm,b,d):Rd(a,b,d),ne(a,c,Eg)}}function Be(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,i=f.line;a.options.lineWrapping||(i=C(ha(y(d,f.line))),d.iter(i,g.line+1,(function(a){if(a==e.maxLine)return h=!0,!0}))),d.sel.contains(b.from,b.to)>-1&&Fa(a),Rd(d,b,c,tc(a)),a.options.lineWrapping||(d.iter(i,f.line+b.text.length,(function(a){var b=oa(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)})),h&&(a.curOp.updateMaxLine=!0)),d.frontier=Math.min(d.frontier,f.line),td(a,400);var j=b.text.length-(g.line-f.line)-1;b.full?nd(a):f.line!=g.line||1!=b.text.length||Qd(a.doc,b)?nd(a,f.line,g.line+1,j):od(a,f.line,"text");var k=Ga(a,"changes"),l=Ga(a,"change");if(l||k){var m={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin};l&&xb(a,"change",a,m),k&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(m)}a.display.selForContextMenu=null}function Ce(a,b,c,d,e){if(d||(d=c),H(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=a.splitLines(b)),we(a,{from:c,to:d,text:b,origin:e})}function De(a,b,c,d){c0||0==h&&g.clearWhenEmpty!==!1)return g;if(g.replacedWith&&(g.collapsed=!0,g.widgetNode=d("span",[g.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||g.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(g.widgetNode.insertLeft=!0)),g.collapsed){if(ga(a,b.line,b,c,g)||b.line!=c.line&&ga(a,c.line,b,c,g))throw new Error("Inserting collapsed marker partially overlapping an existing one");Q()}g.addToHistory&&Yd(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var j,k=b.line,l=a.cm;if(a.iter(k,c.line+1,(function(a){l&&g.collapsed&&!l.options.lineWrapping&&ha(a)==l.display.maxLine&&(j=!0),g.collapsed&&k!=b.line&&B(a,0),U(a,new R(g,k==b.line?b.ch:null,k==c.line?c.ch:null)),++k})),g.collapsed&&a.iter(b.line,c.line+1,(function(b){la(a,b)&&B(b,0)})),g.clearOnEnter&&Og(g,"beforeCursorEnter",(function(){return g.clear()})),g.readOnly&&(P(),(a.history.done.length||a.history.undone.length)&&a.clearHistory()),g.collapsed&&(g.id=++hh,g.atomic=!0),l){if(j&&(l.curOp.updateMaxLine=!0),g.collapsed)nd(l,b.line,c.line+1);else if(g.className||g.title||g.startStyle||g.endStyle||g.css)for(var m=b.line;m<=c.line;m++)od(l,m,"text");g.atomic&&pe(l.doc),xb(l,"markerAdded",l,g)}return g}function Oe(a,b){var c=this;this.markers=a,this.primary=b;for(var d=0;d-1)return b.state.draggingText(a),void setTimeout((function(){return b.display.input.focus()}),20);try{var j=a.dataTransfer.getData("Text");if(j){var k;if(b.state.draggingText&&!b.state.draggingText.copy&&(k=b.listSelections()),ne(b.doc,Id(c,c)),k)for(var m=0;m=0;b--)Ce(a.doc,"",d[b].from,d[b].to,"+delete");_c(a)}))}function gf(a,b){var c=y(a.doc,b),d=ha(c);d!=c&&(b=C(d));var e=Aa(d),f=e?e[0].level%2?ua(d):ta(d):0;return G(b,f)}function hf(a,b){for(var c,d=y(a.doc,b);c=fa(d);)d=c.find(1,!0).line,b=null;var e=Aa(d),f=e?e[0].level%2?ta(d):ua(d):d.text.length;return G(null==b?C(d):b,f)}function jf(a,b){var c=gf(a,b.line),d=y(a.doc,c.line),e=Aa(d);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;return G(c.line,g?0:f)}return c}function kf(a,b,c){if("string"==typeof b&&(b=th[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Dg}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function lf(a,b,c){for(var d=0;de-400&&0==H(sh.pos,c)?d="triple":rh&&rh.time>e-400&&0==H(rh.pos,c)?(d="double",sh={time:e,pos:c}):(d="single",rh={time:e,pos:c});var f,g=a.doc.sel,i=qg?b.metaKey:b.ctrlKey;a.options.dragDrop&&Qg&&!a.isReadOnly()&&"single"==d&&(f=g.contains(c))>-1&&(H((f=g.ranges[f]).from(),c)<0||c.xRel>0)&&(H(f.to(),c)>0||c.xRel<0)?vf(a,b,c,i):wf(a,b,c,d,i)}function vf(a,b,c,d){var e=a.display,f=+new Date,g=kd(a,(function(h){hg&&(e.scroller.draggable=!1),a.state.draggingText=!1,Ca(document,"mouseup",g),Ca(e.scroller,"drop",g),Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)<10&&(Ia(h),!d&&+new Date-200u&&e.push(new Gd(G(q,u),G(q,m(t,p,f))))}e.length||e.push(new Gd(c,c)),me(k,Hd(o.ranges.slice(0,n).concat(e),n),{origin:"*mouse",scroll:!1}),a.scrollIntoView(b)}else{var v=l,w=v.anchor,x=b;if("single"!=d){var z;z="double"==d?a.findWordAt(b):new Gd(G(b.line,0),M(k,G(b.line+1,0))),H(z.anchor,w)>0?(x=z.head,w=K(v.from(),z.anchor)):(x=z.anchor,w=J(v.to(),z.head))}var A=o.ranges.slice(0);A[n]=new Gd(M(k,w),x),me(k,Hd(A,n),Fg)}}function g(b){var c=++u,e=vc(a,b,!0,"rect"==d);if(e)if(0!=H(e,s)){a.curOp.focus=yg(),f(e);var h=Kc(i,k);(e.line>=h.to||e.linet.bottom?20:0;j&&setTimeout(kd(a,(function(){u==c&&(i.scroller.scrollTop+=j,g(b))})),50)}}function h(b){a.state.selectingText=!1,u=1/0,Ia(b),i.input.focus(),Ca(document,"mousemove",v),Ca(document,"mouseup",w),k.history.lastSelOrigin=null}var i=a.display,k=a.doc;Ia(b);var l,n,o=k.sel,p=o.ranges;if(e&&!b.shiftKey?(n=k.sel.contains(c),l=n>-1?p[n]:new Gd(c,c)):(l=k.sel.primary(),n=k.sel.primIndex),rg?b.shiftKey&&b.metaKey:b.altKey)d="rect",e||(l=new Gd(c,c)),c=vc(a,b,!0,!0),n=-1;else if("double"==d){var q=a.findWordAt(c);l=a.display.shift||k.extend?fe(k,l,q.anchor,q.head):q}else if("triple"==d){var r=new Gd(G(c.line,0),M(k,G(c.line+1,0)));l=a.display.shift||k.extend?fe(k,l,r.anchor,r.head):r}else l=fe(k,l,c);e?n==-1?(n=p.length,me(k,Hd(p.concat([l]),n),{scroll:!1,origin:"*mouse"})):p.length>1&&p[n].empty()&&"single"==d&&!b.shiftKey?(me(k,Hd(p.slice(0,n).concat(p.slice(n+1)),0),{scroll:!1,origin:"*mouse"}),o=k.sel):ie(k,n,l,Fg):(n=0,me(k,new Fd([l],0),Fg),o=k.sel);var s=c,t=i.wrapper.getBoundingClientRect(),u=0,v=kd(a,(function(a){Na(a)?g(a):h(a)})),w=kd(a,h);a.state.selectingText=w,Og(document,"mousemove",v),Og(document,"mouseup",w)}function xf(a,b,c,d){var e,f;try{e=b.clientX,f=b.clientY}catch(a){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&Ia(b);var g=a.display,h=g.lineDiv.getBoundingClientRect();if(f>h.bottom||!Ga(a,c))return Ka(b);f-=h.top-g.viewOffset;for(var i=0;i=e){var k=D(a.doc,f),l=a.options.gutters[i];return Da(a,c,a,k,l,b),Ka(b)}}}function yf(a,b){return xf(a,b,"gutterClick",!0)}function zf(a,b){Mb(a.display,b)||Af(a,b)||Ea(a,b,"contextmenu")||a.display.input.onContextMenu(b)}function Af(a,b){return!!Ga(a,"gutterContextMenu")&&xf(a,b,"gutterContextMenu",!1)}function Bf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ec(a)}function Cf(a){function b(b,d,e,f){a.defaults[b]=d,e&&(c[b]=f?function(a,b,c){c!=wh&&e(a,b,c)}:e)}var c=a.optionHandlers;a.defineOption=b,a.Init=wh,b("value","",(function(a,b){return a.setValue(b)}),!0),b("mode",null,(function(a,b){a.doc.modeOption=b,Od(a)}),!0),b("indentUnit",2,Od,!0),b("indentWithTabs",!1),b("smartIndent",!0),b("tabSize",4,(function(a){Pd(a),ec(a),nd(a)}),!0),b("lineSeparator",null,(function(a,b){if(a.doc.lineSep=b,b){var c=[],d=a.doc.first;a.doc.iter((function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(f==-1)break;e=f+b.length,c.push(G(d,f))}d++}));for(var e=c.length-1;e>=0;e--)Ce(a.doc,b,c[e],G(c[e].line,c[e].ch+b.length))}})),b("specialChars",/[\u0000-\u001f\u007f\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,(function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g"),c!=wh&&a.refresh()})),b("specialCharPlaceholder",mb,(function(a){return a.refresh()}),!0),b("electricChars",!0),b("inputStyle",pg?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),b("spellcheck",!1,(function(a,b){return a.getInputField().spellcheck=b}),!0),b("rtlMoveVisually",!sg),b("wholeLineUpdateBefore",!0),b("theme","default",(function(a){Bf(a),Df(a)}),!0),b("keyMap","default",(function(a,b,c){var d=ef(b),e=c!=wh&&ef(c);e&&e.detach&&e.detach(a,d),d.attach&&d.attach(a,e||null)})),b("extraKeys",null),b("lineWrapping",!1,Ff,!0),b("gutters",[],(function(a){Ed(a.options),Df(a)}),!0),b("fixedGutter",!0,(function(a,b){a.display.gutters.style.left=b?sc(a.display)+"px":"0",a.refresh()}),!0),b("coverGutterNextToScrollbar",!1,(function(a){return Tc(a)}),!0),b("scrollbarStyle","native",(function(a){Vc(a),Tc(a),a.display.scrollbars.setScrollTop(a.doc.scrollTop),a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)}),!0),b("lineNumbers",!1,(function(a){Ed(a.options),Df(a)}),!0),b("firstLineNumber",1,Df,!0),b("lineNumberFormatter",(function(a){return a}),Df,!0),b("showCursorWhenSelecting",!1,xc,!0),b("resetSelectionOnContextMenu",!0),b("lineWiseCopyCut",!0),b("readOnly",!1,(function(a,b){"nocursor"==b?(Fc(a),a.display.input.blur(),a.display.disabled=!0):a.display.disabled=!1,a.display.input.readOnlyChanged(b)})),b("disableInput",!1,(function(a,b){b||a.display.input.reset()}),!0),b("dragDrop",!0,Ef),b("allowDropFileTypes",null),b("cursorBlinkRate",530),b("cursorScrollMargin",0),b("cursorHeight",1,xc,!0),b("singleCursorHeightPerLine",!0,xc,!0),b("workTime",100),b("workDelay",100),b("flattenSpans",!0,Pd,!0),b("addModeClass",!1,Pd,!0),b("pollInterval",100),b("undoDepth",200,(function(a,b){return a.doc.history.undoDepth=b})),b("historyEventDelay",1250),b("viewportMargin",10,(function(a){return a.refresh()}),!0),b("maxHighlightLength",1e4,Pd,!0),b("moveInputWithCursor",!0,(function(a,b){b||a.display.input.resetPosition()})),b("tabindex",null,(function(a,b){return a.display.input.getField().tabIndex=b||""})),b("autofocus",null)}function Df(a){Dd(a),nd(a),setTimeout((function(){return Gc(a)}),20)}function Ef(a,b,c){var d=c&&c!=wh;if(!b!=!d){var e=a.display.dragFunctions,f=b?Og:Ca;f(a.display.scroller,"dragstart",e.start),f(a.display.scroller,"dragenter",e.enter),f(a.display.scroller,"dragover",e.over),f(a.display.scroller,"dragleave",e.leave),f(a.display.scroller,"drop",e.drop)}}function Ff(a){a.options.lineWrapping?(f(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(xg(a.display.wrapper,"CodeMirror-wrap"),pa(a)),uc(a),nd(a),ec(a),setTimeout((function(){return Tc(a)}),100)}function Gf(a,b){var c=this;if(!(this instanceof Gf))return new Gf(a,b);this.options=b=b?i(b):{},i(xh,b,!1),Ed(b);var d=b.value;"string"==typeof d&&(d=new jh(d,b.mode,null,b.lineSeparator)),this.doc=d;var e=new Gf.inputStyles[b.inputStyle](this),f=this.display=new x(a,d,e);f.wrapper.CodeMirror=this,Dd(this),Bf(this),b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),b.autofocus&&!pg&&f.input.focus(),Vc(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new k,keySeq:null,specialChars:null},fg&&gg<11&&setTimeout((function(){return c.display.input.reset(!0)}),20),Hf(this),Ye(),bd(this),this.curOp.forceUpdate=!0,Td(this,d),b.autofocus&&!pg||this.hasFocus()?setTimeout(h(Ec,this),20):Fc(this);for(var g in yh)yh.hasOwnProperty(g)&&yh[g](c,b[g],wh);Hc(this),b.finishInit&&b.finishInit(this);for(var j=0;j400}var e=a.display;Og(e.scroller,"mousedown",kd(a,tf)),fg&&gg<11?Og(e.scroller,"dblclick",kd(a,(function(b){if(!Ea(a,b)){var c=vc(a,b);if(c&&!yf(a,b)&&!Mb(a.display,b)){Ia(b);var d=a.findWordAt(c);ge(a.doc,d.anchor,d.head)}}}))):Og(e.scroller,"dblclick",(function(b){return Ea(a,b)||Ia(b)})),wg||Og(e.scroller,"contextmenu",(function(b){return zf(a,b)}));var f,g={end:0};Og(e.scroller,"touchstart",(function(b){if(!Ea(a,b)&&!c(b)){clearTimeout(f);var d=+new Date;e.activeTouch={start:d,moved:!1,prev:d-g.end<=300?g:null},1==b.touches.length&&(e.activeTouch.left=b.touches[0].pageX,e.activeTouch.top=b.touches[0].pageY)}})),Og(e.scroller,"touchmove",(function(){e.activeTouch&&(e.activeTouch.moved=!0)})),Og(e.scroller,"touchend",(function(c){var f=e.activeTouch;if(f&&!Mb(e,c)&&null!=f.left&&!f.moved&&new Date-f.start<300){var g,h=a.coordsChar(e.activeTouch,"page");g=!f.prev||d(f,f.prev)?new Gd(h,h):!f.prev.prev||d(f,f.prev.prev)?a.findWordAt(h):new Gd(G(h.line,0),M(a.doc,G(h.line+1,0))),a.setSelection(g.anchor,g.head),a.focus(),Ia(c)}b()})),Og(e.scroller,"touchcancel",b),Og(e.scroller,"scroll",(function(){e.scroller.clientHeight&&(Lc(a,e.scroller.scrollTop),Mc(a,e.scroller.scrollLeft,!0),Da(a,"scroll",a))})),Og(e.scroller,"mousewheel",(function(b){return Pc(a,b)})),Og(e.scroller,"DOMMouseScroll",(function(b){return Pc(a,b)})),Og(e.wrapper,"scroll",(function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0})),e.dragFunctions={enter:function(b){Ea(a,b)||La(b)},over:function(b){Ea(a,b)||(Ve(a,b),La(b))},start:function(b){return Ue(a,b)},drop:kd(a,Te),leave:function(b){Ea(a,b)||We(a)}};var h=e.input.getField();Og(h,"keyup",(function(b){return rf.call(a,b)})),Og(h,"keydown",kd(a,pf)),Og(h,"keypress",kd(a,sf)),Og(h,"focus",(function(b){return Ec(a,b)})),Og(h,"blur",(function(b){return Fc(a,b)}))}function If(a,b,c,d){var e,f=a.doc;null==c&&(c="add"),"smart"==c&&(f.mode.indent?e=_a(a,b):c="prev");var g=a.options.tabSize,h=y(f,b),i=j(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var k,l=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(k=f.mode.indent(e,h.text.slice(l.length),h.text),k==Dg||k>150)){if(!d)return;c="prev"}}else k=0,c="not";"prev"==c?k=b>f.first?j(y(f,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c?k=i-a.options.indentUnit:"number"==typeof c&&(k=i+c),k=Math.max(0,k);var m="",o=0;if(a.options.indentWithTabs)for(var p=Math.floor(k/g);p;--p)o+=g,m+="\t";if(o1)if(Ah&&Ah.text.join("\n")==b){if(d.ranges.length%Ah.text.length==0){i=[];for(var j=0;j=0;l--){var m=d.ranges[l],n=m.from(),q=m.to();m.empty()&&(c&&c>0?n=G(n.line,n.ch-c):a.state.overwrite&&!g?q=G(q.line,Math.min(y(f,q.line).text.length,q.ch+o(h).length)):Ah&&Ah.lineWise&&Ah.text.join("\n")==b&&(n=q=G(n.line,0))),k=a.curOp.updateInput;var r={from:n,to:q,text:i?i[l%i.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};we(a.doc,r),xb(a,"inputRead",a,r)}b&&!g&&Mf(a,b),_c(a),a.curOp.updateInput=k,a.curOp.typing=!0,a.state.pasteIncoming=a.state.cutIncoming=!1}function Lf(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");if(c)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||jd(b,(function(){return Kf(b,c,0,null,"paste")})),!0}function Mf(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;d>=0;d--){var e=c.ranges[d];if(!(e.head.ch>100||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars){for(var h=0;h-1){g=If(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(y(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=If(a,e.head.line,"smart"));g&&xb(a,"electricInput",a,e.head.line)}}}function Nf(a){for(var b=[],c=[],d=0;dd&&(If(b,f.head.line,a,!0),d=f.head.line,e==b.doc.sel.primIndex&&_c(b));else{var g=f.from(),h=f.to(),i=Math.max(d,g.line);d=Math.min(b.lastLine(),h.line-(h.ch?0:1))+1;for(var j=i;j0&&ie(b.doc,e,new Gd(g,k[e].to()),Eg)}}})),getTokenAt:function(a,b){return db(this,a,b)},getLineTokens:function(a,b){return db(this,G(a),b,!0)},getTokenTypeAt:function(a){a=M(this.doc,a);var b,c=$a(this,y(this.doc,a.line)),d=0,e=(c.length-1)/2,f=a.ch;if(0==f)b=c[2];else for(;;){var g=d+e>>1;if((g?c[2*g-1]:0)>=f)e=g;else{if(!(c[2*g+1]e&&(a=e,d=!0),c=y(this.doc,a)}else c=a;return hc(this,c,{top:0,left:0},b||"page").top+(d?this.doc.height-na(c):0)},defaultTextHeight:function(){return pc(this.display)},defaultCharWidth:function(){return qc(this.display)},setGutterMarker:ld((function(a,b,c){return Ge(this.doc,a,"gutter",(function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&v(d)&&(a.gutterMarkers=null),!0}))})),clearGutter:ld((function(a){var b=this,c=this.doc,d=c.first;c.iter((function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,od(b,d,"gutter"),v(c.gutterMarkers)&&(c.gutterMarkers=null)),++d}))})),lineInfo:function(a){var b;if("number"==typeof a){if(!E(this.doc,a))return null;if(b=a,a=y(this.doc,a),!a)return null}else if(b=C(a),null==b)return null;return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=kc(this,M(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",b.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(b),f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&Yc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:ld(pf),triggerOnKeyPress:ld(sf),triggerOnKeyUp:rf,execCommand:function(a){if(th.hasOwnProperty(a))return th[a].call(null,this)},triggerElectric:ld((function(a){Mf(this,a)})),findPosH:function(a,b,c,d){var e=this,f=1;b<0&&(f=-1,b=-b);for(var g=M(this.doc,a),h=0;h0&&h(c.charAt(d-1));)--d;for(;e.5)&&uc(this),Da(this,"refresh",this)})),swapDoc:ld((function(a){var b=this.doc;return b.cm=null,Td(this,a),ec(this),this.display.input.reset(),this.scrollTo(a.scrollLeft,a.scrollTop),this.curOp.forceScroll=!0,xb(this,"swapDoc",this,b),b})),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ha(a),a.registerHelper=function(b,d,e){c.hasOwnProperty(b)||(c[b]=a[b]={_global:[]}),c[b][d]=e},a.registerGlobalHelper=function(b,d,e,f){a.registerHelper(b,d,f),c[b]._global.push({pred:e,val:f})}}function Rf(a,b,c,d,e){function f(){var b=h+c;return!(b=a.first+a.size)&&(h=b,k=y(a,b))}function g(a){var b=(e?ya:za)(k,i,c,!0);if(null==b){if(a||!f())return!1;i=e?(c<0?ua:ta)(k):c<0?k.text.length:0}else i=b;return!0}var h=b.line,i=b.ch,j=c,k=y(a,h);if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var l=null,m="group"==d,n=a.cm&&a.cm.getHelper(b,"wordChars"),o=!0;!(c<0)||g(!o);o=!1){var p=k.text.charAt(i)||"\n",q=u(p,n)?"w":m&&"\n"==p?"n":!m||/\s/.test(p)?null:"p";if(!m||o||q||(q="s"),l&&l!=q){c<0&&(c=1,g());break}if(q&&(l=q),c>0&&!g(!o))break}var r=se(a,G(h,i),b,j,!0);return H(b,r)||(r.hitSide=!0),r}function Sf(a,b,c,d){var e,f=a.doc,g=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),i=Math.max(h-.5*pc(a.display),3);e=(c>0?b.bottom:b.top)+c*i}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(var j;j=nc(a,g,e),j.outside;){if(c<0?e<=0:e>=f.height){j.hitSide=!0;break}e+=5*c}return j}function Tf(a){this.cm=a,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new k,this.gracePeriod=!1}function Uf(a,b){var c=Xb(a,b.line);if(!c||c.hidden)return null;var d=y(a.doc,b.line),e=Ub(c,d,b.line),f=Aa(d),g="left";if(f){var h=wa(f,b.ch);g=h%2?"right":"left"}var i=$b(e.map,b.ch,g);return i.offset="right"==i.collapse?i.end:i.start,i}function Vf(a,b){return b&&(a.bad=!0),a}function Wf(a,b,c,d,e){function f(a){return function(b){return b.id==a}}function g(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)return""==c&&(c=b.textContent.replace(/\u200b/g,"")),void(h+=c);var k,l=b.getAttribute("cm-marker");if(l){var m=a.findMarks(G(d,0),G(e+1,0),f(+l));return void(m.length&&(k=m[0].find())&&(h+=z(a.doc,k.from,k.to).join(j)))}if("false"==b.getAttribute("contenteditable"))return;for(var n=0;n=15&&(kg=!1,hg=!0);var ug,vg=qg&&(ig||kg&&(null==tg||tg<12.11)),wg=cg||fg&&gg>=9,xg=function(b,c){var d=b.className,e=a(c).exec(d);if(e){var f=d.slice(e.index+e[0].length);b.className=d.slice(0,e.index)+(f?e[1]+f:"")}};ug=document.createRange?function(a,b,c,d){var e=document.createRange();return e.setEnd(d||a,c),e.setStart(a,b),e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(a){return d}return d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d};var yg=function(){for(var a=document.activeElement;a&&a.root&&a.root.activeElement;)a=a.root.activeElement;return a};fg&&gg<11&&(yg=function(){try{return document.activeElement}catch(a){return document.body}});var zg=function(a){a.select()};og?zg=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:fg&&(zg=function(a){try{a.select()}catch(a){}}),k.prototype.set=function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)};var Ag,Bg,Cg=30,Dg={toString:function(){return"CodeMirror.Pass"}},Eg={scroll:!1},Fg={origin:"*mouse"},Gg={origin:"+move"},Hg=[""],Ig=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Jg=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,Kg=!1,Lg=!1,Mg=null,Ng=(function(){function a(a){return a<=247?c.charAt(a):1424<=a&&a<=1524?"R":1536<=a&&a<=1773?d.charAt(a-1536):1774<=a&&a<=2220?"r":8192<=a&&a<=8203?"w":8204==a?"b":"L"}function b(a,b,c){this.level=a,this.from=b,this.to=c}var c="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",d="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,g=/[LRr]/,h=/[Lb1n]/,i=/[1n]/,j="L";return function(c){if(!e.test(c))return!1;for(var d=c.length,k=[],l=0;l=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.posb},eatSpace:function(){for(var a=this,b=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++a.pos;return this.pos>b},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos0?null:(d&&b!==!1&&(this.pos+=d[0].length),d)}var e=function(a){return c?a.toLowerCase():a},f=this.string.substr(this.pos,a.length);if(e(f)==e(a))return b!==!1&&(this.pos+=a.length),!0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}},Ha(hb),hb.prototype.lineNo=function(){return C(this)};var Zg,$g={},_g={},ah=null,bh=null,ch={left:0,right:0,top:0,bottom:0},dh=0,eh=null;fg?eh=-.53:cg?eh=15:jg?eh=-.7:lg&&(eh=-1/3),Rc.prototype=i({update:function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;if(c){this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0";var e=a.viewHeight-(b?d:0);this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+e)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(b){this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px";var f=a.viewWidth-a.barLeft-(c?d:0);this.horiz.firstChild.style.width=a.scrollWidth-a.clientWidth+f+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&a.clientHeight>0&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:c?d:0,bottom:b?d:0}},setScrollLeft:function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var a=qg&&!mg?"12px":"18px";this.horiz.style.height=this.vert.style.width=a,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new k,this.disableVert=new k},enableZeroWidthBar:function(a,b){function c(){var d=a.getBoundingClientRect(),e=document.elementFromPoint(d.left+1,d.bottom-1);e!=a?a.style.pointerEvents="none":b.set(1e3,c)}a.style.pointerEvents="auto",b.set(1e3,c)},clear:function(){var a=this.horiz.parentNode;a.removeChild(this.horiz),a.removeChild(this.vert)}},Rc.prototype),Sc.prototype=i({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},Sc.prototype);var fh={native:Rc,null:Sc},gh=0;vd.prototype.signal=function(a,b){Ga(a,b)&&this.events.push(arguments)},vd.prototype.finish=function(){for(var a=this,b=0;b=0&&H(a,e.to())<=0)return d}return-1}},Gd.prototype={from:function(){return K(this.anchor,this.head)},to:function(){return J(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}},He.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=this,d=a,e=a+b;d1||!(this.children[0]instanceof He))){var i=[];this.collapse(i),this.children=[new He(i)],this.children[0].parent=this}},collapse:function(a){for(var b=this,c=0;c50){for(var h=f.lines.length%25+25,i=h;i10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=this,e=0;eb.display.maxLineLength&&(b.display.maxLine=k,b.display.maxLineLength=l,b.display.maxLineChanged=!0)}null!=e&&b&&this.collapsed&&nd(b,e,f+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,b&&pe(b.doc)),b&&xb(b,"markerCleared",b,this),c&&cd(b),this.parent&&this.parent.clear()}},Me.prototype.find=function(a,b){ +var c=this;null==a&&"bookmark"==this.type&&(a=1);for(var d,e,f=0;f=0;j--)we(d,e[j]);i?le(this,i):this.cm&&_c(this.cm)})),undo:md((function(){ye(this,"undo")})),redo:md((function(){ye(this,"redo")})),undoSelection:md((function(){ye(this,"undo",!0)})),redoSelection:md((function(){ye(this,"redo",!0)})),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=M(this,a),b=M(this,b);var d=[],e=a.line;return this.iter(a.line,b.line+1,(function(f){var g=f.markedSpans;if(g)for(var h=0;h=i.to||null==i.from&&e!=a.line||null!=i.from&&e==b.line&&i.from>=b.ch||c&&!c(i.marker)||d.push(i.marker.parent||i.marker)}++e})),d},getAllMarks:function(){var a=[];return this.iter((function(b){var c=b.markedSpans;if(c)for(var d=0;da?(b=a,!0):(a-=f,void++c)})),M(this,G(c,b))},indexFromPos:function(a){a=M(this,a);var b=a.ch;if(a.lineb&&(b=a.from),null!=a.to&&a.to0)e=new G(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),G(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=y(a.doc,e.line-1).text;g&&(e=new G(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),G(e.line-1,g.length-1),e,"+transpose"))}c.push(new Gd(e,e))}a.setSelections(c)}))},newlineAndIndent:function(a){return jd(a,(function(){for(var b=a.listSelections(),c=b.length-1;c>=0;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input");b=a.listSelections();for(var d=0;d-1&&g<=e.head.ch&&(c.composing.sel=Id(G(e.head.line,g),G(e.head.line,g+b.length)))}})),Og(e,"compositionupdate",(function(a){return c.composing.data=a.data})),Og(e,"compositionend",(function(a){var b=c.composing;b&&(a.data==b.startData||/\u200b/.test(a.data)||(b.data=a.data),setTimeout((function(){b.handled||c.applyComposition(b),c.composing==b&&(c.composing=null)}),50))})),Og(e,"touchstart",(function(){return c.forceCompositionEnd()})),Og(e,"input",(function(){c.composing||!d.isReadOnly()&&c.pollContent()||jd(c.cm,(function(){return nd(d)}))})),Og(e,"copy",b),Og(e,"cut",b)},prepareSelection:function(){var a=yc(this.cm,!1);return a.focus=this.cm.state.focused,a},showSelection:function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))},showPrimarySelection:function(){var a=window.getSelection(),b=this.cm.doc.sel.primary(),c=Xf(this.cm,a.anchorNode,a.anchorOffset),d=Xf(this.cm,a.focusNode,a.focusOffset);if(!c||c.bad||!d||d.bad||0!=H(K(c,d),b.from())||0!=H(J(c,d),b.to())){var e=Uf(this.cm,b.from()),f=Uf(this.cm,b.to());if(e||f){var g=this.cm.display.view,h=a.rangeCount&&a.getRangeAt(0);if(e){if(!f){var i=g[g.length-1].measure,j=i.maps?i.maps[i.maps.length-1]:i.map;f={node:j[j.length-1],offset:j[j.length-2]-j[j.length-3]}}}else e={node:g[0].measure.map[2],offset:0};var k;try{k=ug(e.node,e.offset,f.offset,f.node)}catch(a){}k&&(!cg&&this.cm.state.focused?(a.collapse(e.node,e.offset),k.collapsed||(a.removeAllRanges(),a.addRange(k))):(a.removeAllRanges(),a.addRange(k)),h&&null==a.anchorNode?a.addRange(h):cg&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var a=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){a.gracePeriod=!1,a.selectionChanged()&&a.cm.operation((function(){return a.cm.curOp.selectionChanged=!0}))}),20)},showMultipleSelections:function(a){c(this.cm.display.cursorDiv,a.cursors),c(this.cm.display.selectionDiv,a.selection)},rememberSelection:function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode,this.lastAnchorOffset=a.anchorOffset,this.lastFocusNode=a.focusNode,this.lastFocusOffset=a.focusOffset},selectionInEditor:function(){var a=window.getSelection();if(!a.rangeCount)return!1;var b=a.getRangeAt(0).commonAncestorContainer;return e(this.div,b)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=this;this.selectionInEditor()?this.pollSelection():jd(this.cm,(function(){return b.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,a)},selectionChanged:function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),b=this.cm;this.rememberSelection();var c=Xf(b,a.anchorNode,a.anchorOffset),d=Xf(b,a.focusNode,a.focusOffset);c&&d&&jd(b,(function(){me(b.doc,Id(c,d),Eg),(c.bad||d.bad)&&(b.curOp.selectionChanged=!0)}))}},pollContent:function(){var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),e=c.to();if(d.lineb.viewTo-1)return!1;var f,g,h;d.line==b.viewFrom||0==(f=wc(a,d.line))?(g=C(b.view[0].line),h=b.view[0].node):(g=C(b.view[f].line),h=b.view[f-1].node.nextSibling);var i,j,k=wc(a,e.line);k==b.view.length-1?(i=b.viewTo-1,j=b.lineDiv.lastChild):(i=C(b.view[k+1].line)-1,j=b.view[k+1].node.previousSibling);for(var l=a.doc.splitLines(Wf(a,h,j,g,i)),m=z(a.doc,G(g,0),G(i,y(a.doc,i).text.length));l.length>1&&m.length>1;)if(o(l)==o(m))l.pop(),m.pop(),i--;else{if(l[0]!=m[0])break;l.shift(),m.shift(),g++}for(var n=0,p=0,q=l[0],r=m[0],s=Math.min(q.length,r.length);n1||l[0]||H(w,x)?(Ce(a.doc,l,w,x,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(a){this.cm.isReadOnly()?kd(this.cm,nd)(this.cm):a.data&&a.data!=a.startData&&kd(this.cm,Kf)(this.cm,a.data,0,a.sel)},setUneditable:function(a){a.contentEditable="false"},onKeyPress:function(a){a.preventDefault(),this.cm.isReadOnly()||kd(this.cm,Kf)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0)},readOnlyChanged:function(a){this.div.contentEditable=String("nocursor"!=a)},onContextMenu:r,resetPosition:r,needsContentAttribute:!0},Tf.prototype),Zf.prototype=i({init:function(a){function b(a){if(!Ea(e,a)){if(e.somethingSelected())Jf({lineWise:!1,text:e.getSelections()}),d.inaccurateSelection&&(d.prevInput="",d.inaccurateSelection=!1,g.value=Ah.text.join("\n"),zg(g));else{if(!e.options.lineWiseCopyCut)return;var b=Nf(e);Jf({lineWise:!0,text:b.text}),"cut"==a.type?e.setSelections(b.ranges,null,Eg):(d.prevInput="",g.value=b.text.join("\n"),zg(g))}"cut"==a.type&&(e.state.cutIncoming=!0)}}var c=this,d=this,e=this.cm,f=this.wrapper=Pf(),g=this.textarea=f.firstChild;a.wrapper.insertBefore(f,a.wrapper.firstChild),og&&(g.style.width="0px"),Og(g,"input",(function(){fg&&gg>=9&&c.hasSelection&&(c.hasSelection=null),d.poll()})),Og(g,"paste",(function(a){Ea(e,a)||Lf(a,e)||(e.state.pasteIncoming=!0,d.fastPoll())})),Og(g,"cut",b),Og(g,"copy",b),Og(a.scroller,"paste",(function(b){Mb(a,b)||Ea(e,b)||(e.state.pasteIncoming=!0,d.focus())})),Og(a.lineSpace,"selectstart",(function(b){Mb(a,b)||Ia(b)})),Og(g,"compositionstart",(function(){var a=e.getCursor("from");d.composing&&d.composing.range.clear(),d.composing={start:a,range:e.markText(a,e.getCursor("to"),{className:"CodeMirror-composing"})}})),Og(g,"compositionend",(function(){d.composing&&(d.poll(),d.composing.range.clear(),d.composing=null)}))},prepareSelection:function(){var a=this.cm,b=a.display,c=a.doc,d=yc(a);if(a.options.moveInputWithCursor){var e=kc(a,c.sel.primary().head,"div"),f=b.wrapper.getBoundingClientRect(),g=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,e.top+g.top-f.top)),d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,e.left+g.left-f.left))}return d},showSelection:function(a){var b=this.cm,d=b.display;c(d.cursorDiv,a.cursors),c(d.selectionDiv,a.selection),null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")},reset:function(a){if(!this.contextMenuPending){var b,c,d=this.cm,e=d.doc;if(d.somethingSelected()){this.prevInput="";var f=e.sel.primary();b=Tg&&(f.to().line-f.from().line>100||(c=d.getSelection()).length>1e3);var g=b?"-":c||d.getSelection();this.textarea.value=g,d.state.focused&&zg(this.textarea),fg&&gg>=9&&(this.hasSelection=g)}else a||(this.prevInput=this.textarea.value="",fg&&gg>=9&&(this.hasSelection=null));this.inaccurateSelection=b}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!pg||yg()!=this.textarea))try{this.textarea.focus()}catch(a){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){a.poll(),a.cm.state.focused&&a.slowPoll()}))},fastPoll:function(){function a(){var d=c.poll();d||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0,c.polling.set(20,a)},poll:function(){var a=this,b=this.cm,c=this.textarea,d=this.prevInput;if(this.contextMenuPending||!b.state.focused||Sg(c)&&!d&&!this.composing||b.isReadOnly()||b.options.disableInput||b.state.keySeq)return!1;var e=c.value;if(e==d&&!b.somethingSelected())return!1;if(fg&&gg>=9&&this.hasSelection===e||qg&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var f=e.charCodeAt(0);if(8203!=f||d||(d="​"),8666==f)return this.reset(),this.cm.execCommand("undo")}for(var g=0,h=Math.min(d.length,e.length);g1e3||e.indexOf("\n")>-1?c.value=a.prevInput="":a.prevInput=e,a.composing&&(a.composing.range.clear(),a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){fg&&gg>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),b="​"+(a?g.value:"");g.value="⇚",g.value=b,d.prevInput=a?"":"​",g.selectionStart=1,g.selectionEnd=b.length,f.selForContextMenu=e.doc.sel}}function c(){if(d.contextMenuPending=!1,d.wrapper.style.cssText=l,g.style.cssText=k,fg&&gg<9&&f.scrollbars.setScrollTop(f.scroller.scrollTop=i),null!=g.selectionStart){(!fg||fg&&gg<9)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&g.selectionEnd>0&&"​"==d.prevInput?kd(e,ue)(e):a++<10?f.detectingSelectAll=setTimeout(c,500):f.input.reset()};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=vc(e,a),i=f.scroller.scrollTop;if(h&&!kg){var j=e.options.resetSelectionOnContextMenu;j&&e.doc.sel.contains(h)==-1&&kd(e,me)(e.doc,Id(h),Eg);var k=g.style.cssText,l=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";var m=d.wrapper.getBoundingClientRect();g.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(a.clientY-m.top-5)+"px; left: "+(a.clientX-m.left-5)+"px;\n z-index: 1000; background: "+(fg?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var n;if(hg&&(n=window.scrollY),f.input.focus(),hg&&window.scrollTo(null,n),f.input.reset(),e.somethingSelected()||(g.value=d.prevInput=" "),d.contextMenuPending=!0,f.selForContextMenu=e.doc.sel,clearTimeout(f.detectingSelectAll),fg&&gg>=9&&b(),wg){La(a);var o=function(){Ca(window,"mouseup",o),setTimeout(c,20)};Og(window,"mouseup",o)}else setTimeout(c,50)}},readOnlyChanged:function(a){a||this.reset()},setUneditable:r,needsContentAttribute:!1},Zf.prototype),Cf(Gf),Qf(Gf);var Bh="iter insert remove copy getEditor constructor".split(" ");for(var Ch in jh.prototype)jh.prototype.hasOwnProperty(Ch)&&l(Bh,Ch)<0&&(Gf.prototype[Ch]=(function(a){return function(){return a.apply(this.doc,arguments)}})(jh.prototype[Ch]));return Ha(jh),Gf.inputStyles={textarea:Zf,contenteditable:Tf},Gf.defineMode=function(a){Gf.defaults.mode||"null"==a||(Gf.defaults.mode=a),Ra.apply(this,arguments)},Gf.defineMIME=Sa,Gf.defineMode("null",(function(){return{token:function(a){return a.skipToEnd()}}})),Gf.defineMIME("text/plain","null"),Gf.defineExtension=function(a,b){Gf.prototype[a]=b},Gf.defineDocExtension=function(a,b){jh.prototype[a]=b},Gf.fromTextArea=$f,_f(Gf),Gf.version="5.20.2",Gf})); \ No newline at end of file diff --git a/media/editors/codemirror/mode/clike/clike.js b/media/editors/codemirror/mode/clike/clike.js index a37921fdae7ed..cad2d5145c5d0 100644 --- a/media/editors/codemirror/mode/clike/clike.js +++ b/media/editors/codemirror/mode/clike/clike.js @@ -21,7 +21,7 @@ function Context(indented, column, type, info, align, prev) { } function pushContext(state, col, type, info) { var indent = state.indented; - if (state.context && state.context.type != "statement" && type != "statement") + if (state.context && state.context.type == "statement" && type != "statement") indent = state.context.indented; return state.context = new Context(indent, col, type, info, null, state.context); } @@ -64,8 +64,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/, numberStart = parserConfig.numberStart || /[\d\.]/, number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i, - isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/, - endStatement = parserConfig.endStatement || /^[;:,]$/; + isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/; var curPunc, isDefKeyword; @@ -177,7 +176,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { if (style == "comment" || style == "meta") return style; if (ctx.align == null) ctx.align = true; - if (endStatement.test(curPunc)) while (state.context.type == "statement") popContext(state); + if (curPunc == ";" || curPunc == ":" || (curPunc == "," && stream.match(/^\s*(?:\/\/.*)?$/, false))) + while (state.context.type == "statement") popContext(state); else if (curPunc == "{") pushContext(state, stream.column(), "}"); else if (curPunc == "[") pushContext(state, stream.column(), "]"); else if (curPunc == "(") pushContext(state, stream.column(), ")"); @@ -432,7 +432,6 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { defKeywords: words("class interface package enum"), typeFirstDefinitions: true, atoms: words("true false null"), - endStatement: /^[;:]$/, number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i, hooks: { "@": function(stream) { diff --git a/media/editors/codemirror/mode/clike/clike.min.js b/media/editors/codemirror/mode/clike/clike.min.js index 302a6b57ddd41..afb83417aac4a 100644 --- a/media/editors/codemirror/mode/clike/clike.min.js +++ b/media/editors/codemirror/mode/clike/clike.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.info=d,this.align=e,this.prev=f}function c(a,c,d,e){var f=a.indented;return a.context&&"statement"!=a.context.type&&"statement"!=d&&(f=a.context.indented),a.context=new b(f,c,d,e,null,a.context)}function d(a){var b=a.context.type;return")"!=b&&"]"!=b&&"}"!=b||(a.indented=a.context.indented),a.context=a.context.prev}function e(a,b,c){return"variable"==b.prevToken||"variable-3"==b.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(a.string.slice(0,c))||(!(!b.typeAtEndOfLine||a.column()!=a.indentation())||void 0))}function f(a){for(;;){if(!a||"top"==a.type)return!0;if("}"==a.type&&"namespace"!=a.prev.info)return!1;a=a.prev}}function g(a){for(var b={},c=a.split(" "),d=0;d!?|\/]/,H=i.endStatement||/^[;:,]$/;return{startState:function(a){return{tokenize:null,context:new b((a||0)-p,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(a,b){var g=b.context;if(a.sol()&&(null==g.align&&(g.align=!1),b.indented=a.indentation(),b.startOfLine=!0),a.eatSpace())return m(a,b),null;n=o=null;var h=(b.tokenize||j)(a,b);if("comment"==h||"meta"==h)return h;if(null==g.align&&(g.align=!0),H.test(n))for(;"statement"==b.context.type;)d(b);else if("{"==n)c(b,a.column(),"}");else if("["==n)c(b,a.column(),"]");else if("("==n)c(b,a.column(),")");else if("}"==n){for(;"statement"==g.type;)g=d(b);for("}"==g.type&&(g=d(b));"statement"==g.type;)g=d(b)}else n==g.type?d(b):A&&(("}"==g.type||"top"==g.type)&&";"!=n||"statement"==g.type&&"newstatement"==n)&&c(b,a.column(),"statement",a.current());if("variable"==h&&("def"==b.prevToken||i.typeFirstDefinitions&&e(a,b,a.start)&&f(b.context)&&a.match(/^\s*\(/,!1))&&(h="def"),y.token){var k=y.token(a,b,h);void 0!==k&&(h=k)}return"def"==h&&i.styleDefs===!1&&(h="variable"),b.startOfLine=!1,b.prevToken=o?"def":h||n,m(a,b),h},indent:function(b,c){if(b.tokenize!=j&&null!=b.tokenize||b.typeAtEndOfLine)return a.Pass;var d=b.context,e=c&&c.charAt(0);if("statement"==d.type&&"}"==e&&(d=d.prev),i.dontIndentStatements)for(;"statement"==d.type&&i.dontIndentStatements.test(d.info);)d=d.prev;if(y.indent){var f=y.indent(b,d,c);if("number"==typeof f)return f}var g=e==d.type,h=d.prev&&"switch"==d.prev.info;if(i.allmanIndentation&&/[{(]/.test(e)){for(;"top"!=d.type&&"}"!=d.type;)d=d.prev;return d.indented}return"statement"==d.type?d.indented+("{"==e?0:q):!d.align||r&&")"==d.type?")"!=d.type||g?d.indented+(g?0:p)+(g||!h||/^(?:case|default)\b/.test(c)?0:p):d.indented+q:d.column+(g?0:1)},electricInput:B?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}}));var t="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",u="int long char short double float unsigned signed void size_t ptrdiff_t";p(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:g(t),types:g(u+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:g("case do else for if switch while struct"),defKeywords:g("struct"),typeFirstDefinitions:!0,atoms:g("null true false"),hooks:{"#":i,"*":j},modeProps:{fold:["brace","include"]}}),p(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:g(t+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:g(u+" bool wchar_t"),blockKeywords:g("catch class do else finally for if struct switch try while"),defKeywords:g("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:g("true false null"),dontIndentStatements:/^template$/,hooks:{"#":i,"*":j,u:l,U:l,L:l,R:l,0:k,1:k,2:k,3:k,4:k,5:k,6:k,7:k,8:k,9:k,token:function(a,b,c){if("variable"==c&&"("==a.peek()&&(";"==b.prevToken||null==b.prevToken||"}"==b.prevToken)&&m(a.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),p("text/x-java",{name:"clike",keywords:g("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while"),types:g("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:g("catch class do else finally for if switch try while"),defKeywords:g("class interface package enum"),typeFirstDefinitions:!0,atoms:g("true false null"),endStatement:/^[;:]$/,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),p("text/x-csharp",{name:"clike",keywords:g("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:g("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:g("catch class do else finally for foreach if struct switch try while"),defKeywords:g("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:g("true false null"),hooks:{"@":function(a,b){return a.eat('"')?(b.tokenize=n,n(a,b)):(a.eatWhile(/[\w\$_]/),"meta")}}}),p("text/x-scala",{name:"clike",keywords:g("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble :: #:: "),types:g("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:g("catch class do else finally for forSome if match switch try while"),defKeywords:g("class def object package trait type val var"),atoms:g("true false null"),indentStatements:!1,indentSwitch:!1,hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"},'"':function(a,b){return!!a.match('""')&&(b.tokenize=q,b.tokenize(a,b))},"'":function(a){return a.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(a,c){var d=c.context;return!("}"!=d.type||!d.align||!a.eat(">"))&&(c.context=new b(d.indented,d.column,d.type,d.info,null,d.prev),"operator")}},modeProps:{closeBrackets:{triples:'"'}}}),p("text/x-kotlin",{name:"clike",keywords:g("package as typealias class interface this super val var fun for is in This throw return break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix"),types:g("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,blockKeywords:g("catch class do else finally for if where try while enum"),defKeywords:g("class val var object package interface fun"),atoms:g("true false null this"),hooks:{'"':function(a,b){return b.tokenize=r(a.match('""')),b.tokenize(a,b)}},modeProps:{closeBrackets:{triples:'"'}}}),p(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:g("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:g("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:g("for while do if else struct"),builtin:g("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:g("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":i},modeProps:{fold:["brace","include"]}}),p("text/x-nesc",{name:"clike",keywords:g(t+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:g(u),blockKeywords:g("case do else for if switch while struct"),atoms:g("null true false"),hooks:{"#":i},modeProps:{fold:["brace","include"]}}),p("text/x-objectivec",{name:"clike",keywords:g(t+"inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:g(u),atoms:g("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(a){return a.eatWhile(/[\w\$]/),"keyword"},"#":i,indent:function(a,b,c){if("statement"==b.type&&/^@\w/.test(c))return b.indented}},modeProps:{fold:"brace"}}),p("text/x-squirrel",{name:"clike",keywords:g("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:g(u),blockKeywords:g("case catch class else for foreach if switch try while"),defKeywords:g("function local class"),typeFirstDefinitions:!0,atoms:g("true false null"),hooks:{"#":i},modeProps:{fold:["brace","include"]}});var v=null;p("text/x-ceylon",{name:"clike",keywords:g("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(a){var b=a.charAt(0);return b===b.toUpperCase()&&b!==b.toLowerCase()},blockKeywords:g("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:g("class dynamic function interface module object package value"),builtin:g("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:g("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"},'"':function(a,b){return b.tokenize=s(a.match('""')?"triple":"single"),b.tokenize(a,b)},"`":function(a,b){return!(!v||!a.match("`"))&&(b.tokenize=v,v=null,b.tokenize(a,b))},"'":function(a){return a.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(a,b,c){if(("variable"==c||"variable-3"==c)&&"."==b.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})})); \ No newline at end of file +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.info=d,this.align=e,this.prev=f}function c(a,c,d,e){var f=a.indented;return a.context&&"statement"==a.context.type&&"statement"!=d&&(f=a.context.indented),a.context=new b(f,c,d,e,null,a.context)}function d(a){var b=a.context.type;return")"!=b&&"]"!=b&&"}"!=b||(a.indented=a.context.indented),a.context=a.context.prev}function e(a,b,c){return"variable"==b.prevToken||"variable-3"==b.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(a.string.slice(0,c))||(!(!b.typeAtEndOfLine||a.column()!=a.indentation())||void 0))}function f(a){for(;;){if(!a||"top"==a.type)return!0;if("}"==a.type&&"namespace"!=a.prev.info)return!1;a=a.prev}}function g(a){for(var b={},c=a.split(" "),d=0;d!?|\/]/;return{startState:function(a){return{tokenize:null,context:new b((a||0)-p,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(a,b){var g=b.context;if(a.sol()&&(null==g.align&&(g.align=!1),b.indented=a.indentation(),b.startOfLine=!0),a.eatSpace())return m(a,b),null;n=o=null;var h=(b.tokenize||j)(a,b);if("comment"==h||"meta"==h)return h;if(null==g.align&&(g.align=!0),";"==n||":"==n||","==n&&a.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==b.context.type;)d(b);else if("{"==n)c(b,a.column(),"}");else if("["==n)c(b,a.column(),"]");else if("("==n)c(b,a.column(),")");else if("}"==n){for(;"statement"==g.type;)g=d(b);for("}"==g.type&&(g=d(b));"statement"==g.type;)g=d(b)}else n==g.type?d(b):A&&(("}"==g.type||"top"==g.type)&&";"!=n||"statement"==g.type&&"newstatement"==n)&&c(b,a.column(),"statement",a.current());if("variable"==h&&("def"==b.prevToken||i.typeFirstDefinitions&&e(a,b,a.start)&&f(b.context)&&a.match(/^\s*\(/,!1))&&(h="def"),y.token){var k=y.token(a,b,h);void 0!==k&&(h=k)}return"def"==h&&i.styleDefs===!1&&(h="variable"),b.startOfLine=!1,b.prevToken=o?"def":h||n,m(a,b),h},indent:function(b,c){if(b.tokenize!=j&&null!=b.tokenize||b.typeAtEndOfLine)return a.Pass;var d=b.context,e=c&&c.charAt(0);if("statement"==d.type&&"}"==e&&(d=d.prev),i.dontIndentStatements)for(;"statement"==d.type&&i.dontIndentStatements.test(d.info);)d=d.prev;if(y.indent){var f=y.indent(b,d,c);if("number"==typeof f)return f}var g=e==d.type,h=d.prev&&"switch"==d.prev.info;if(i.allmanIndentation&&/[{(]/.test(e)){for(;"top"!=d.type&&"}"!=d.type;)d=d.prev;return d.indented}return"statement"==d.type?d.indented+("{"==e?0:q):!d.align||r&&")"==d.type?")"!=d.type||g?d.indented+(g?0:p)+(g||!h||/^(?:case|default)\b/.test(c)?0:p):d.indented+q:d.column+(g?0:1)},electricInput:B?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}}));var t="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",u="int long char short double float unsigned signed void size_t ptrdiff_t";p(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:g(t),types:g(u+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:g("case do else for if switch while struct"),defKeywords:g("struct"),typeFirstDefinitions:!0,atoms:g("null true false"),hooks:{"#":i,"*":j},modeProps:{fold:["brace","include"]}}),p(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:g(t+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:g(u+" bool wchar_t"),blockKeywords:g("catch class do else finally for if struct switch try while"),defKeywords:g("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:g("true false null"),dontIndentStatements:/^template$/,hooks:{"#":i,"*":j,u:l,U:l,L:l,R:l,0:k,1:k,2:k,3:k,4:k,5:k,6:k,7:k,8:k,9:k,token:function(a,b,c){if("variable"==c&&"("==a.peek()&&(";"==b.prevToken||null==b.prevToken||"}"==b.prevToken)&&m(a.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),p("text/x-java",{name:"clike",keywords:g("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while"),types:g("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:g("catch class do else finally for if switch try while"),defKeywords:g("class interface package enum"),typeFirstDefinitions:!0,atoms:g("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),p("text/x-csharp",{name:"clike",keywords:g("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:g("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:g("catch class do else finally for foreach if struct switch try while"),defKeywords:g("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:g("true false null"),hooks:{"@":function(a,b){return a.eat('"')?(b.tokenize=n,n(a,b)):(a.eatWhile(/[\w\$_]/),"meta")}}}),p("text/x-scala",{name:"clike",keywords:g("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble :: #:: "),types:g("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:g("catch class do else finally for forSome if match switch try while"),defKeywords:g("class def object package trait type val var"),atoms:g("true false null"),indentStatements:!1,indentSwitch:!1,hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"},'"':function(a,b){return!!a.match('""')&&(b.tokenize=q,b.tokenize(a,b))},"'":function(a){return a.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(a,c){var d=c.context;return!("}"!=d.type||!d.align||!a.eat(">"))&&(c.context=new b(d.indented,d.column,d.type,d.info,null,d.prev),"operator")}},modeProps:{closeBrackets:{triples:'"'}}}),p("text/x-kotlin",{name:"clike",keywords:g("package as typealias class interface this super val var fun for is in This throw return break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix"),types:g("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,blockKeywords:g("catch class do else finally for if where try while enum"),defKeywords:g("class val var object package interface fun"),atoms:g("true false null this"),hooks:{'"':function(a,b){return b.tokenize=r(a.match('""')),b.tokenize(a,b)}},modeProps:{closeBrackets:{triples:'"'}}}),p(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:g("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:g("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:g("for while do if else struct"),builtin:g("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:g("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":i},modeProps:{fold:["brace","include"]}}),p("text/x-nesc",{name:"clike",keywords:g(t+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:g(u),blockKeywords:g("case do else for if switch while struct"),atoms:g("null true false"),hooks:{"#":i},modeProps:{fold:["brace","include"]}}),p("text/x-objectivec",{name:"clike",keywords:g(t+"inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:g(u),atoms:g("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(a){return a.eatWhile(/[\w\$]/),"keyword"},"#":i,indent:function(a,b,c){if("statement"==b.type&&/^@\w/.test(c))return b.indented}},modeProps:{fold:"brace"}}),p("text/x-squirrel",{name:"clike",keywords:g("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:g(u),blockKeywords:g("case catch class else for foreach if switch try while"),defKeywords:g("function local class"),typeFirstDefinitions:!0,atoms:g("true false null"),hooks:{"#":i},modeProps:{fold:["brace","include"]}});var v=null;p("text/x-ceylon",{name:"clike",keywords:g("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(a){var b=a.charAt(0);return b===b.toUpperCase()&&b!==b.toLowerCase()},blockKeywords:g("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:g("class dynamic function interface module object package value"),builtin:g("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:g("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"},'"':function(a,b){return b.tokenize=s(a.match('""')?"triple":"single"),b.tokenize(a,b)},"`":function(a,b){return!(!v||!a.match("`"))&&(b.tokenize=v,v=null,b.tokenize(a,b))},"'":function(a){return a.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(a,b,c){if(("variable"==c||"variable-3"==c)&&"."==b.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})})); \ No newline at end of file diff --git a/media/editors/codemirror/mode/css/css.js b/media/editors/codemirror/mode/css/css.js index ea7bd01d84dce..e56e3dd8c6973 100644 --- a/media/editors/codemirror/mode/css/css.js +++ b/media/editors/codemirror/mode/css/css.js @@ -414,7 +414,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { function keySet(array) { var keys = {}; for (var i = 0; i < array.length; ++i) { - keys[array[i]] = true; + keys[array[i].toLowerCase()] = true; } return keys; } diff --git a/media/editors/codemirror/mode/css/css.min.js b/media/editors/codemirror/mode/css/css.min.js index 2a81f8f90456f..26487b2b917eb 100644 --- a/media/editors/codemirror/mode/css/css.min.js +++ b/media/editors/codemirror/mode/css/css.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a){for(var b={},c=0;c*\/]/.test(c)?d(null,"select-op"):"."==c&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?d("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(c)?d(null,c):"u"==c&&a.match(/rl(-prefix)?\(/)||"d"==c&&a.match("omain(")||"r"==c&&a.match("egexp(")?(a.backUp(1),b.tokenize=g,d("property","word")):/[\w\\\-]/.test(c)?(a.eatWhile(/[\w\\\-]/),d("property","word")):d(null,null):/[\d.]/.test(a.peek())?(a.eatWhile(/[\w.%]/),d("number","unit")):a.match(/^-[\w\\\-]+/)?(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?d("variable-2","variable-definition"):d("variable-2","variable")):a.match(/^\w+-/)?d("meta","meta"):void 0}function f(a){return function(b,c){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){")"==a&&b.backUp(1);break}f=!f&&"\\"==e}return(e==a||!f&&")"!=a)&&(c.tokenize=null),d("string","string")}}function g(a,b){return a.next(),a.match(/\s*[\"\')]/,!1)?b.tokenize=null:b.tokenize=f(")"),d(null,"(")}function h(a,b,c){this.type=a,this.indent=b,this.prev=c}function i(a,b,c,d){return a.context=new h(c,b.indentation()+(d===!1?0:q),a.context),c}function j(a){return a.context.prev&&(a.context=a.context.prev),a.context.type}function k(a,b,c){return E[c.context.type](a,b,c)}function l(a,b,c,d){for(var e=d||1;e>0;e--)c.context=c.context.prev;return k(a,b,c)}function m(a){var b=a.current().toLowerCase();p=B.hasOwnProperty(b)?"atom":A.hasOwnProperty(b)?"keyword":"variable"}var n=c.inline;c.propertyKeywords||(c=a.resolveMode("text/css"));var o,p,q=b.indentUnit,r=c.tokenHooks,s=c.documentTypes||{},t=c.mediaTypes||{},u=c.mediaFeatures||{},v=c.mediaValueKeywords||{},w=c.propertyKeywords||{},x=c.nonStandardPropertyKeywords||{},y=c.fontProperties||{},z=c.counterDescriptors||{},A=c.colorKeywords||{},B=c.valueKeywords||{},C=c.allowNested,D=c.supportsAtComponent===!0,E={};return E.top=function(a,b,c){if("{"==a)return i(c,b,"block");if("}"==a&&c.context.prev)return j(c);if(D&&/@component/.test(a))return i(c,b,"atComponentBlock");if(/^@(-moz-)?document$/.test(a))return i(c,b,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(a))return i(c,b,"atBlock");if(/^@(font-face|counter-style)/.test(a))return c.stateArg=a,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(a))return"keyframes";if(a&&"@"==a.charAt(0))return i(c,b,"at");if("hash"==a)p="builtin";else if("word"==a)p="tag";else{if("variable-definition"==a)return"maybeprop";if("interpolation"==a)return i(c,b,"interpolation");if(":"==a)return"pseudo";if(C&&"("==a)return i(c,b,"parens")}return c.context.type},E.block=function(a,b,c){if("word"==a){var d=b.current().toLowerCase();return w.hasOwnProperty(d)?(p="property","maybeprop"):x.hasOwnProperty(d)?(p="string-2","maybeprop"):C?(p=b.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(p+=" error","maybeprop")}return"meta"==a?"block":C||"hash"!=a&&"qualifier"!=a?E.top(a,b,c):(p="error","block")},E.maybeprop=function(a,b,c){return":"==a?i(c,b,"prop"):k(a,b,c)},E.prop=function(a,b,c){if(";"==a)return j(c);if("{"==a&&C)return i(c,b,"propBlock");if("}"==a||"{"==a)return l(a,b,c);if("("==a)return i(c,b,"parens");if("hash"!=a||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(b.current())){if("word"==a)m(b);else if("interpolation"==a)return i(c,b,"interpolation")}else p+=" error";return"prop"},E.propBlock=function(a,b,c){return"}"==a?j(c):"word"==a?(p="property","maybeprop"):c.context.type},E.parens=function(a,b,c){return"{"==a||"}"==a?l(a,b,c):")"==a?j(c):"("==a?i(c,b,"parens"):"interpolation"==a?i(c,b,"interpolation"):("word"==a&&m(b),"parens")},E.pseudo=function(a,b,c){return"word"==a?(p="variable-3",c.context.type):k(a,b,c)},E.documentTypes=function(a,b,c){return"word"==a&&s.hasOwnProperty(b.current())?(p="tag",c.context.type):E.atBlock(a,b,c)},E.atBlock=function(a,b,c){if("("==a)return i(c,b,"atBlock_parens");if("}"==a||";"==a)return l(a,b,c);if("{"==a)return j(c)&&i(c,b,C?"block":"top");if("interpolation"==a)return i(c,b,"interpolation");if("word"==a){var d=b.current().toLowerCase();p="only"==d||"not"==d||"and"==d||"or"==d?"keyword":t.hasOwnProperty(d)?"attribute":u.hasOwnProperty(d)?"property":v.hasOwnProperty(d)?"keyword":w.hasOwnProperty(d)?"property":x.hasOwnProperty(d)?"string-2":B.hasOwnProperty(d)?"atom":A.hasOwnProperty(d)?"keyword":"error"}return c.context.type},E.atComponentBlock=function(a,b,c){return"}"==a?l(a,b,c):"{"==a?j(c)&&i(c,b,C?"block":"top",!1):("word"==a&&(p="error"),c.context.type)},E.atBlock_parens=function(a,b,c){return")"==a?j(c):"{"==a||"}"==a?l(a,b,c,2):E.atBlock(a,b,c)},E.restricted_atBlock_before=function(a,b,c){return"{"==a?i(c,b,"restricted_atBlock"):"word"==a&&"@counter-style"==c.stateArg?(p="variable","restricted_atBlock_before"):k(a,b,c)},E.restricted_atBlock=function(a,b,c){return"}"==a?(c.stateArg=null,j(c)):"word"==a?(p="@font-face"==c.stateArg&&!y.hasOwnProperty(b.current().toLowerCase())||"@counter-style"==c.stateArg&&!z.hasOwnProperty(b.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},E.keyframes=function(a,b,c){return"word"==a?(p="variable","keyframes"):"{"==a?i(c,b,"top"):k(a,b,c)},E.at=function(a,b,c){return";"==a?j(c):"{"==a||"}"==a?l(a,b,c):("word"==a?p="tag":"hash"==a&&(p="builtin"),"at")},E.interpolation=function(a,b,c){return"}"==a?j(c):"{"==a||";"==a?l(a,b,c):("word"==a?p="variable":"variable"!=a&&"("!=a&&")"!=a&&(p="error"),"interpolation")},{startState:function(a){return{tokenize:null,state:n?"block":"top",stateArg:null,context:new h(n?"block":"top",a||0,null)}},token:function(a,b){if(!b.tokenize&&a.eatSpace())return null;var c=(b.tokenize||e)(a,b);return c&&"object"==typeof c&&(o=c[1],c=c[0]),p=c,b.state=E[b.state](o,a,b),p},indent:function(a,b){var c=a.context,d=b&&b.charAt(0),e=c.indent;return"prop"!=c.type||"}"!=d&&")"!=d||(c=c.prev),c.prev&&("}"!=d||"block"!=c.type&&"top"!=c.type&&"interpolation"!=c.type&&"restricted_atBlock"!=c.type?(")"!=d||"parens"!=c.type&&"atBlock_parens"!=c.type)&&("{"!=d||"at"!=c.type&&"atBlock"!=c.type)||(e=Math.max(0,c.indent-q),c=c.prev):(c=c.prev,e=c.indent)),e},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}}));var d=["domain","regexp","url","url-prefix"],e=b(d),f=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],g=b(f),h=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],i=b(h),j=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],k=b(j),l=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","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-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","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","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],m=b(l),n=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],o=b(n),p=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],q=b(p),r=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],s=b(r),t=["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","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","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","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],u=b(t),v=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],w=b(v),x=d.concat(f).concat(h).concat(j).concat(l).concat(n).concat(t).concat(v);a.registerHelper("hintWords","css",x),a.defineMIME("text/css",{documentTypes:e,mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,fontProperties:q,counterDescriptors:s,colorKeywords:u,valueKeywords:w,tokenHooks:{"/":function(a,b){return!!a.eat("*")&&(b.tokenize=c,c(a,b))}},name:"css"}),a.defineMIME("text/x-scss",{mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,colorKeywords:u,valueKeywords:w,fontProperties:q,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=c,c(a,b)):["operator","operator"]},":":function(a){return!!a.match(/\s*\{/)&&[null,"{"]},$:function(a){return a.match(/^[\w-]+/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(a){return!!a.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),a.defineMIME("text/x-less",{mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,colorKeywords:u,valueKeywords:w,fontProperties:q,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=c,c(a,b)):["operator","operator"]},"@":function(a){return a.eat("{")?[null,"interpolation"]:!a.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)&&(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),a.defineMIME("text/x-gss",{documentTypes:e,mediaTypes:g,mediaFeatures:i,propertyKeywords:m,nonStandardPropertyKeywords:o,fontProperties:q,counterDescriptors:s,colorKeywords:u,valueKeywords:w,supportsAtComponent:!0,tokenHooks:{"/":function(a,b){return!!a.eat("*")&&(b.tokenize=c,c(a,b))}},name:"css",helperType:"gss"})})); \ No newline at end of file +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a){for(var b={},c=0;c*\/]/.test(c)?d(null,"select-op"):"."==c&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?d("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(c)?d(null,c):"u"==c&&a.match(/rl(-prefix)?\(/)||"d"==c&&a.match("omain(")||"r"==c&&a.match("egexp(")?(a.backUp(1),b.tokenize=g,d("property","word")):/[\w\\\-]/.test(c)?(a.eatWhile(/[\w\\\-]/),d("property","word")):d(null,null):/[\d.]/.test(a.peek())?(a.eatWhile(/[\w.%]/),d("number","unit")):a.match(/^-[\w\\\-]+/)?(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?d("variable-2","variable-definition"):d("variable-2","variable")):a.match(/^\w+-/)?d("meta","meta"):void 0}function f(a){return function(b,c){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){")"==a&&b.backUp(1);break}f=!f&&"\\"==e}return(e==a||!f&&")"!=a)&&(c.tokenize=null),d("string","string")}}function g(a,b){return a.next(),a.match(/\s*[\"\')]/,!1)?b.tokenize=null:b.tokenize=f(")"),d(null,"(")}function h(a,b,c){this.type=a,this.indent=b,this.prev=c}function i(a,b,c,d){return a.context=new h(c,b.indentation()+(d===!1?0:q),a.context),c}function j(a){return a.context.prev&&(a.context=a.context.prev),a.context.type}function k(a,b,c){return E[c.context.type](a,b,c)}function l(a,b,c,d){for(var e=d||1;e>0;e--)c.context=c.context.prev;return k(a,b,c)}function m(a){var b=a.current().toLowerCase();p=B.hasOwnProperty(b)?"atom":A.hasOwnProperty(b)?"keyword":"variable"}var n=c.inline;c.propertyKeywords||(c=a.resolveMode("text/css"));var o,p,q=b.indentUnit,r=c.tokenHooks,s=c.documentTypes||{},t=c.mediaTypes||{},u=c.mediaFeatures||{},v=c.mediaValueKeywords||{},w=c.propertyKeywords||{},x=c.nonStandardPropertyKeywords||{},y=c.fontProperties||{},z=c.counterDescriptors||{},A=c.colorKeywords||{},B=c.valueKeywords||{},C=c.allowNested,D=c.supportsAtComponent===!0,E={};return E.top=function(a,b,c){if("{"==a)return i(c,b,"block");if("}"==a&&c.context.prev)return j(c);if(D&&/@component/.test(a))return i(c,b,"atComponentBlock");if(/^@(-moz-)?document$/.test(a))return i(c,b,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(a))return i(c,b,"atBlock");if(/^@(font-face|counter-style)/.test(a))return c.stateArg=a,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(a))return"keyframes";if(a&&"@"==a.charAt(0))return i(c,b,"at");if("hash"==a)p="builtin";else if("word"==a)p="tag";else{if("variable-definition"==a)return"maybeprop";if("interpolation"==a)return i(c,b,"interpolation");if(":"==a)return"pseudo";if(C&&"("==a)return i(c,b,"parens")}return c.context.type},E.block=function(a,b,c){if("word"==a){var d=b.current().toLowerCase();return w.hasOwnProperty(d)?(p="property","maybeprop"):x.hasOwnProperty(d)?(p="string-2","maybeprop"):C?(p=b.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(p+=" error","maybeprop")}return"meta"==a?"block":C||"hash"!=a&&"qualifier"!=a?E.top(a,b,c):(p="error","block")},E.maybeprop=function(a,b,c){return":"==a?i(c,b,"prop"):k(a,b,c)},E.prop=function(a,b,c){if(";"==a)return j(c);if("{"==a&&C)return i(c,b,"propBlock");if("}"==a||"{"==a)return l(a,b,c);if("("==a)return i(c,b,"parens");if("hash"!=a||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(b.current())){if("word"==a)m(b);else if("interpolation"==a)return i(c,b,"interpolation")}else p+=" error";return"prop"},E.propBlock=function(a,b,c){return"}"==a?j(c):"word"==a?(p="property","maybeprop"):c.context.type},E.parens=function(a,b,c){return"{"==a||"}"==a?l(a,b,c):")"==a?j(c):"("==a?i(c,b,"parens"):"interpolation"==a?i(c,b,"interpolation"):("word"==a&&m(b),"parens")},E.pseudo=function(a,b,c){return"word"==a?(p="variable-3",c.context.type):k(a,b,c)},E.documentTypes=function(a,b,c){return"word"==a&&s.hasOwnProperty(b.current())?(p="tag",c.context.type):E.atBlock(a,b,c)},E.atBlock=function(a,b,c){if("("==a)return i(c,b,"atBlock_parens");if("}"==a||";"==a)return l(a,b,c);if("{"==a)return j(c)&&i(c,b,C?"block":"top");if("interpolation"==a)return i(c,b,"interpolation");if("word"==a){var d=b.current().toLowerCase();p="only"==d||"not"==d||"and"==d||"or"==d?"keyword":t.hasOwnProperty(d)?"attribute":u.hasOwnProperty(d)?"property":v.hasOwnProperty(d)?"keyword":w.hasOwnProperty(d)?"property":x.hasOwnProperty(d)?"string-2":B.hasOwnProperty(d)?"atom":A.hasOwnProperty(d)?"keyword":"error"}return c.context.type},E.atComponentBlock=function(a,b,c){return"}"==a?l(a,b,c):"{"==a?j(c)&&i(c,b,C?"block":"top",!1):("word"==a&&(p="error"),c.context.type)},E.atBlock_parens=function(a,b,c){return")"==a?j(c):"{"==a||"}"==a?l(a,b,c,2):E.atBlock(a,b,c)},E.restricted_atBlock_before=function(a,b,c){return"{"==a?i(c,b,"restricted_atBlock"):"word"==a&&"@counter-style"==c.stateArg?(p="variable","restricted_atBlock_before"):k(a,b,c)},E.restricted_atBlock=function(a,b,c){return"}"==a?(c.stateArg=null,j(c)):"word"==a?(p="@font-face"==c.stateArg&&!y.hasOwnProperty(b.current().toLowerCase())||"@counter-style"==c.stateArg&&!z.hasOwnProperty(b.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},E.keyframes=function(a,b,c){return"word"==a?(p="variable","keyframes"):"{"==a?i(c,b,"top"):k(a,b,c)},E.at=function(a,b,c){return";"==a?j(c):"{"==a||"}"==a?l(a,b,c):("word"==a?p="tag":"hash"==a&&(p="builtin"),"at")},E.interpolation=function(a,b,c){return"}"==a?j(c):"{"==a||";"==a?l(a,b,c):("word"==a?p="variable":"variable"!=a&&"("!=a&&")"!=a&&(p="error"),"interpolation")},{startState:function(a){return{tokenize:null,state:n?"block":"top",stateArg:null,context:new h(n?"block":"top",a||0,null)}},token:function(a,b){if(!b.tokenize&&a.eatSpace())return null;var c=(b.tokenize||e)(a,b);return c&&"object"==typeof c&&(o=c[1],c=c[0]),p=c,b.state=E[b.state](o,a,b),p},indent:function(a,b){var c=a.context,d=b&&b.charAt(0),e=c.indent;return"prop"!=c.type||"}"!=d&&")"!=d||(c=c.prev),c.prev&&("}"!=d||"block"!=c.type&&"top"!=c.type&&"interpolation"!=c.type&&"restricted_atBlock"!=c.type?(")"!=d||"parens"!=c.type&&"atBlock_parens"!=c.type)&&("{"!=d||"at"!=c.type&&"atBlock"!=c.type)||(e=Math.max(0,c.indent-q),c=c.prev):(c=c.prev,e=c.indent)),e},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}}));var d=["domain","regexp","url","url-prefix"],e=b(d),f=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],g=b(f),h=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],i=b(h),j=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],k=b(j),l=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","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-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","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","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],m=b(l),n=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],o=b(n),p=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],q=b(p),r=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],s=b(r),t=["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","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","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","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],u=b(t),v=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],w=b(v),x=d.concat(f).concat(h).concat(j).concat(l).concat(n).concat(t).concat(v);a.registerHelper("hintWords","css",x),a.defineMIME("text/css",{documentTypes:e,mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,fontProperties:q,counterDescriptors:s,colorKeywords:u,valueKeywords:w,tokenHooks:{"/":function(a,b){return!!a.eat("*")&&(b.tokenize=c,c(a,b))}},name:"css"}),a.defineMIME("text/x-scss",{mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,colorKeywords:u,valueKeywords:w,fontProperties:q,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=c,c(a,b)):["operator","operator"]},":":function(a){return!!a.match(/\s*\{/)&&[null,"{"]},$:function(a){return a.match(/^[\w-]+/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(a){return!!a.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),a.defineMIME("text/x-less",{mediaTypes:g,mediaFeatures:i,mediaValueKeywords:k,propertyKeywords:m,nonStandardPropertyKeywords:o,colorKeywords:u,valueKeywords:w,fontProperties:q,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=c,c(a,b)):["operator","operator"]},"@":function(a){return a.eat("{")?[null,"interpolation"]:!a.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)&&(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),a.defineMIME("text/x-gss",{documentTypes:e,mediaTypes:g,mediaFeatures:i,propertyKeywords:m,nonStandardPropertyKeywords:o,fontProperties:q,counterDescriptors:s,colorKeywords:u,valueKeywords:w,supportsAtComponent:!0,tokenHooks:{"/":function(a,b){return!!a.eat("*")&&(b.tokenize=c,c(a,b))}},name:"css",helperType:"gss"})})); \ No newline at end of file diff --git a/media/editors/codemirror/mode/cypher/cypher.js b/media/editors/codemirror/mode/cypher/cypher.js index f99abe23850ac..1d9ca4334ab6f 100644 --- a/media/editors/codemirror/mode/cypher/cypher.js +++ b/media/editors/codemirror/mode/cypher/cypher.js @@ -20,8 +20,12 @@ CodeMirror.defineMode("cypher", function(config) { var tokenBase = function(stream/*, state*/) { var ch = stream.next(); - if (ch === "\"" || ch === "'") { - stream.match(/.+?["']/); + if (ch === "\"") { + stream.match(/.+?["]/); + return "string"; + } + if (ch === "'") { + stream.match(/.+?[']/); return "string"; } if (/[{}\(\),\.;\[\]]/.test(ch)) { diff --git a/media/editors/codemirror/mode/cypher/cypher.min.js b/media/editors/codemirror/mode/cypher/cypher.min.js index dd0ba00f78ab7..d00afc87d9b4a 100644 --- a/media/editors/codemirror/mode/cypher/cypher.min.js +++ b/media/editors/codemirror/mode/cypher/cypher.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";var b=function(a){return new RegExp("^(?:"+a.join("|")+")$","i")};a.defineMode("cypher",(function(c){var d,e=function(a){var b=a.next();if('"'===b||"'"===b)return a.match(/.+?["']/),"string";if(/[{}\(\),\.;\[\]]/.test(b))return d=b,"node";if("/"===b&&a.eat("/"))return a.skipToEnd(),"comment";if(l.test(b))return a.eatWhile(l),null;if(a.eatWhile(/[_\w\d]/),a.eat(":"))return a.eatWhile(/[\w\d_\-]/),"atom";var c=a.current();return i.test(c)?"builtin":j.test(c)?"def":k.test(c)?"keyword":"variable"},f=function(a,b,c){return a.context={prev:a.context,indent:a.indent,col:c,type:b}},g=function(a){return a.indent=a.context.indent,a.context=a.context.prev},h=c.indentUnit,i=b(["abs","acos","allShortestPaths","asin","atan","atan2","avg","ceil","coalesce","collect","cos","cot","count","degrees","e","endnode","exp","extract","filter","floor","haversin","head","id","keys","labels","last","left","length","log","log10","lower","ltrim","max","min","node","nodes","percentileCont","percentileDisc","pi","radians","rand","range","reduce","rel","relationship","relationships","replace","reverse","right","round","rtrim","shortestPath","sign","sin","size","split","sqrt","startnode","stdev","stdevp","str","substring","sum","tail","tan","timestamp","toFloat","toInt","toString","trim","type","upper"]),j=b(["all","and","any","contains","exists","has","in","none","not","or","single","xor"]),k=b(["as","asc","ascending","assert","by","case","commit","constraint","create","csv","cypher","delete","desc","descending","detach","distinct","drop","else","end","ends","explain","false","fieldterminator","foreach","from","headers","in","index","is","join","limit","load","match","merge","null","on","optional","order","periodic","profile","remove","return","scan","set","skip","start","starts","then","true","union","unique","unwind","using","when","where","with","call","yield"]),l=/[*+\-<>=&|~%^]/;return{startState:function(){return{tokenize:e,context:null,indent:0,col:0}},token:function(a,b){if(a.sol()&&(b.context&&null==b.context.align&&(b.context.align=!1),b.indent=a.indentation()),a.eatSpace())return null;var c=b.tokenize(a,b);if("comment"!==c&&b.context&&null==b.context.align&&"pattern"!==b.context.type&&(b.context.align=!0),"("===d)f(b,")",a.column());else if("["===d)f(b,"]",a.column());else if("{"===d)f(b,"}",a.column());else if(/[\]\}\)]/.test(d)){for(;b.context&&"pattern"===b.context.type;)g(b);b.context&&d===b.context.type&&g(b)}else"."===d&&b.context&&"pattern"===b.context.type?g(b):/atom|string|variable/.test(c)&&b.context&&(/[\}\]]/.test(b.context.type)?f(b,"pattern",a.column()):"pattern"!==b.context.type||b.context.align||(b.context.align=!0,b.context.col=a.column()));return c},indent:function(b,c){var d=c&&c.charAt(0),e=b.context;if(/[\]\}]/.test(d))for(;e&&"pattern"===e.type;)e=e.prev;var f=e&&d===e.type;return e?"keywords"===e.type?a.commands.newlineAndIndent:e.align?e.col+(f?0:1):e.indent+(f?0:h):0}}})),a.modeExtensions.cypher={autoFormatLineBreaks:function(a){for(var b,c,d,c=a.split("\n"),d=/\s+\b(return|where|order by|match|with|skip|limit|create|delete|set)\b\s/g,b=0;b=&|~%^]/;return{startState:function(){return{tokenize:e,context:null,indent:0,col:0}},token:function(a,b){if(a.sol()&&(b.context&&null==b.context.align&&(b.context.align=!1),b.indent=a.indentation()),a.eatSpace())return null;var c=b.tokenize(a,b);if("comment"!==c&&b.context&&null==b.context.align&&"pattern"!==b.context.type&&(b.context.align=!0),"("===d)f(b,")",a.column());else if("["===d)f(b,"]",a.column());else if("{"===d)f(b,"}",a.column());else if(/[\]\}\)]/.test(d)){for(;b.context&&"pattern"===b.context.type;)g(b);b.context&&d===b.context.type&&g(b)}else"."===d&&b.context&&"pattern"===b.context.type?g(b):/atom|string|variable/.test(c)&&b.context&&(/[\}\]]/.test(b.context.type)?f(b,"pattern",a.column()):"pattern"!==b.context.type||b.context.align||(b.context.align=!0,b.context.col=a.column()));return c},indent:function(b,c){var d=c&&c.charAt(0),e=b.context;if(/[\]\}]/.test(d))for(;e&&"pattern"===e.type;)e=e.prev;var f=e&&d===e.type;return e?"keywords"===e.type?a.commands.newlineAndIndent:e.align?e.col+(f?0:1):e.indent+(f?0:h):0}}})),a.modeExtensions.cypher={autoFormatLineBreaks:function(a){for(var b,c,d,c=a.split("\n"),d=/\s+\b(return|where|order by|match|with|skip|limit|create|delete|set)\b\s/g,b=0;b!|\/]/;return{startState:function(a){return{tokenize:null,context:new e((a||0)-i,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,c){var d=c.context;if(a.sol()&&(null==d.align&&(d.align=!1),c.indented=a.indentation(),c.startOfLine=!0,"case"==d.type&&(d.type="}")),a.eatSpace())return null;h=null;var e=(c.tokenize||b)(a,c);return"comment"==e?e:(null==d.align&&(d.align=!0),"{"==h?f(c,a.column(),"}"):"["==h?f(c,a.column(),"]"):"("==h?f(c,a.column(),")"):"case"==h?d.type="case":"}"==h&&"}"==d.type?d=g(c):h==d.type&&g(c),c.startOfLine=!1,e)},indent:function(a,c){if(a.tokenize!=b&&null!=a.tokenize)return 0;var d=a.context,e=c&&c.charAt(0);if("case"==d.type&&/^(?:case|default)\b/.test(c))return a.context.type="}",d.indented;var f=e==d.type;return d.align?d.column+(f?0:1):d.indented+(f?0:i)},electricChars:"{}):",fold:"brace",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}})),a.defineMIME("text/x-go","go")})); \ No newline at end of file +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";a.defineMode("go",(function(a){function b(a,b){var e=a.next();if('"'==e||"'"==e||"`"==e)return b.tokenize=c(e),b.tokenize(a,b);if(/[\d\.]/.test(e))return"."==e?a.match(/^[0-9]+([eE][\-+]?[0-9]+)?/):"0"==e?a.match(/^[xX][0-9a-fA-F]+/)||a.match(/^0[0-7]+/):a.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/),"number";if(/[\[\]{}\(\),;\:\.]/.test(e))return h=e,null;if("/"==e){if(a.eat("*"))return b.tokenize=d,d(a,b);if(a.eat("/"))return a.skipToEnd(),"comment"}if(l.test(e))return a.eatWhile(l),"operator";a.eatWhile(/[\w\$_\xa1-\uffff]/);var f=a.current();return j.propertyIsEnumerable(f)?("case"!=f&&"default"!=f||(h="case"),"keyword"):k.propertyIsEnumerable(f)?"atom":"variable"}function c(a){return function(c,d){for(var e,f=!1,g=!1;null!=(e=c.next());){if(e==a&&!f){g=!0;break}f=!f&&"`"!=a&&"\\"==e}return(g||!f&&"`"!=a)&&(d.tokenize=b),"string"}}function d(a,c){for(var d,e=!1;d=a.next();){if("/"==d&&e){c.tokenize=b;break}e="*"==d}return"comment"}function e(a,b,c,d,e){this.indented=a,this.column=b,this.type=c,this.align=d,this.prev=e}function f(a,b,c){return a.context=new e(a.indented,b,c,null,a.context)}function g(a){if(a.context.prev){var b=a.context.type;return")"!=b&&"]"!=b&&"}"!=b||(a.indented=a.context.indented),a.context=a.context.prev}}var h,i=a.indentUnit,j={break:!0,case:!0,chan:!0,const:!0,continue:!0,default:!0,defer:!0,else:!0,fallthrough:!0,for:!0,func:!0,go:!0,goto:!0,if:!0,import:!0,interface:!0,map:!0,package:!0,range:!0,return:!0,select:!0,struct:!0,switch:!0,type:!0,var:!0,bool:!0,byte:!0,complex64:!0,complex128:!0,float32:!0,float64:!0,int8:!0,int16:!0,int32:!0,int64:!0,string:!0,uint8:!0,uint16:!0,uint32:!0,uint64:!0,int:!0,uint:!0,uintptr:!0,error:!0},k={true:!0,false:!0,iota:!0,nil:!0,append:!0,cap:!0,close:!0,complex:!0,copy:!0,imag:!0,len:!0,make:!0,new:!0,panic:!0,print:!0,println:!0,real:!0,recover:!0},l=/[+\-*&^%:=<>!|\/]/;return{startState:function(a){return{tokenize:null,context:new e((a||0)-i,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,c){var d=c.context;if(a.sol()&&(null==d.align&&(d.align=!1),c.indented=a.indentation(),c.startOfLine=!0,"case"==d.type&&(d.type="}")),a.eatSpace())return null;h=null;var e=(c.tokenize||b)(a,c);return"comment"==e?e:(null==d.align&&(d.align=!0),"{"==h?f(c,a.column(),"}"):"["==h?f(c,a.column(),"]"):"("==h?f(c,a.column(),")"):"case"==h?d.type="case":"}"==h&&"}"==d.type?d=g(c):h==d.type&&g(c),c.startOfLine=!1,e)},indent:function(a,c){if(a.tokenize!=b&&null!=a.tokenize)return 0;var d=a.context,e=c&&c.charAt(0);if("case"==d.type&&/^(?:case|default)\b/.test(c))return a.context.type="}",d.indented;var f=e==d.type;return d.align?d.column+(f?0:1):d.indented+(f?0:i)},electricChars:"{}):",closeBrackets:"()[]{}''\"\"``",fold:"brace",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//"}})),a.defineMIME("text/x-go","go")})); \ No newline at end of file diff --git a/media/editors/codemirror/mode/haskell/haskell.js b/media/editors/codemirror/mode/haskell/haskell.js index fe0bab67ed6be..4197666a44f45 100644 --- a/media/editors/codemirror/mode/haskell/haskell.js +++ b/media/editors/codemirror/mode/haskell/haskell.js @@ -56,7 +56,7 @@ CodeMirror.defineMode("haskell", function(_config, modeConfig) { if (source.eat('\'')) { return "string"; } - return "error"; + return "string error"; } if (ch == '"') { @@ -166,7 +166,7 @@ CodeMirror.defineMode("haskell", function(_config, modeConfig) { } } setState(normal); - return "error"; + return "string error"; } function stringGap(source, setState) { @@ -194,7 +194,7 @@ CodeMirror.defineMode("haskell", function(_config, modeConfig) { "module", "newtype", "of", "then", "type", "where", "_"); setType("keyword")( - "\.\.", ":", "::", "=", "\\", "\"", "<-", "->", "@", "~", "=>"); + "\.\.", ":", "::", "=", "\\", "<-", "->", "@", "~", "=>"); setType("builtin")( "!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<", diff --git a/media/editors/codemirror/mode/haskell/haskell.min.js b/media/editors/codemirror/mode/haskell/haskell.min.js index 2284abc839f3f..438d0f04928b0 100644 --- a/media/editors/codemirror/mode/haskell/haskell.min.js +++ b/media/editors/codemirror/mode/haskell/haskell.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";a.defineMode("haskell",(function(a,b){function c(a,b,c){return b(c),c(a,b)}function d(a,b){if(a.eatWhile(p))return null;var d=a.next();if(o.test(d)){if("{"==d&&a.eat("-")){var g="comment";return a.eat("#")&&(g="meta"),c(a,b,e(g,1))}return null}if("'"==d)return a.eat("\\")?a.next():a.next(),a.eat("'")?"string":"error";if('"'==d)return c(a,b,f);if(i.test(d))return a.eatWhile(m),a.eat(".")?"qualifier":"variable-2";if(h.test(d))return a.eatWhile(m),"variable";if(j.test(d)){if("0"==d){if(a.eat(/[xX]/))return a.eatWhile(k),"integer";if(a.eat(/[oO]/))return a.eatWhile(l),"number"}a.eatWhile(j);var g="number";return a.match(/^\.\d+/)&&(g="number"),a.eat(/[eE]/)&&(g="number",a.eat(/[-+]/),a.eatWhile(j)),g}if("."==d&&a.eat("."))return"keyword";if(n.test(d)){if("-"==d&&a.eat(/-/)&&(a.eatWhile(/-/),!a.eat(n)))return a.skipToEnd(),"comment";var g="variable";return":"==d&&(g="variable-2"),a.eatWhile(n),g}return"error"}function e(a,b){return 0==b?d:function(c,f){for(var g=b;!c.eol();){var h=c.next();if("{"==h&&c.eat("-"))++g;else if("-"==h&&c.eat("}")&&(--g,0==g))return f(d),a}return f(e(a,g)),a}}function f(a,b){for(;!a.eol();){var c=a.next();if('"'==c)return b(d),"string";if("\\"==c){if(a.eol()||a.eat(p))return b(g),"string";a.eat("&")||a.next()}}return b(d),"error"}function g(a,b){return a.eat("\\")?c(a,b,f):(a.next(),b(d),"error")}var h=/[a-z_]/,i=/[A-Z]/,j=/\d/,k=/[0-9A-Fa-f]/,l=/[0-7]/,m=/[a-z_A-Z0-9'\xa1-\uffff]/,n=/[-!#$%&*+.\/<=>?@\\^|~:]/,o=/[(),;[\]`{}]/,p=/[ \t\v\f]/,q=(function(){function a(a){return function(){for(var b=0;b","@","~","=>"),a("builtin")("!!","$!","$","&&","+","++","-",".","/","/=","<","<=","=<<","==",">",">=",">>",">>=","^","^^","||","*","**"),a("builtin")("Bool","Bounded","Char","Double","EQ","Either","Enum","Eq","False","FilePath","Float","Floating","Fractional","Functor","GT","IO","IOError","Int","Integer","Integral","Just","LT","Left","Maybe","Monad","Nothing","Num","Ord","Ordering","Rational","Read","ReadS","Real","RealFloat","RealFrac","Right","Show","ShowS","String","True"),a("builtin")("abs","acos","acosh","all","and","any","appendFile","asTypeOf","asin","asinh","atan","atan2","atanh","break","catch","ceiling","compare","concat","concatMap","const","cos","cosh","curry","cycle","decodeFloat","div","divMod","drop","dropWhile","either","elem","encodeFloat","enumFrom","enumFromThen","enumFromThenTo","enumFromTo","error","even","exp","exponent","fail","filter","flip","floatDigits","floatRadix","floatRange","floor","fmap","foldl","foldl1","foldr","foldr1","fromEnum","fromInteger","fromIntegral","fromRational","fst","gcd","getChar","getContents","getLine","head","id","init","interact","ioError","isDenormalized","isIEEE","isInfinite","isNaN","isNegativeZero","iterate","last","lcm","length","lex","lines","log","logBase","lookup","map","mapM","mapM_","max","maxBound","maximum","maybe","min","minBound","minimum","mod","negate","not","notElem","null","odd","or","otherwise","pi","pred","print","product","properFraction","putChar","putStr","putStrLn","quot","quotRem","read","readFile","readIO","readList","readLn","readParen","reads","readsPrec","realToFrac","recip","rem","repeat","replicate","return","reverse","round","scaleFloat","scanl","scanl1","scanr","scanr1","seq","sequence","sequence_","show","showChar","showList","showParen","showString","shows","showsPrec","significand","signum","sin","sinh","snd","span","splitAt","sqrt","subtract","succ","sum","tail","take","takeWhile","tan","tanh","toEnum","toInteger","toRational","truncate","uncurry","undefined","unlines","until","unwords","unzip","unzip3","userError","words","writeFile","zip","zip3","zipWith","zipWith3");var d=b.overrideKeywords;if(d)for(var e in d)d.hasOwnProperty(e)&&(c[e]=d[e]);return c})();return{startState:function(){return{f:d}},copyState:function(a){return{f:a.f}},token:function(a,b){var c=b.f(a,(function(a){b.f=a})),d=a.current();return q.hasOwnProperty(d)?q[d]:c},blockCommentStart:"{-",blockCommentEnd:"-}",lineComment:"--"}})),a.defineMIME("text/x-haskell","haskell")})); \ No newline at end of file +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";a.defineMode("haskell",(function(a,b){function c(a,b,c){return b(c),c(a,b)}function d(a,b){if(a.eatWhile(p))return null;var d=a.next();if(o.test(d)){if("{"==d&&a.eat("-")){var g="comment";return a.eat("#")&&(g="meta"),c(a,b,e(g,1))}return null}if("'"==d)return a.eat("\\")?a.next():a.next(),a.eat("'")?"string":"string error";if('"'==d)return c(a,b,f);if(i.test(d))return a.eatWhile(m),a.eat(".")?"qualifier":"variable-2";if(h.test(d))return a.eatWhile(m),"variable";if(j.test(d)){if("0"==d){if(a.eat(/[xX]/))return a.eatWhile(k),"integer";if(a.eat(/[oO]/))return a.eatWhile(l),"number"}a.eatWhile(j);var g="number";return a.match(/^\.\d+/)&&(g="number"),a.eat(/[eE]/)&&(g="number",a.eat(/[-+]/),a.eatWhile(j)),g}if("."==d&&a.eat("."))return"keyword";if(n.test(d)){if("-"==d&&a.eat(/-/)&&(a.eatWhile(/-/),!a.eat(n)))return a.skipToEnd(),"comment";var g="variable";return":"==d&&(g="variable-2"),a.eatWhile(n),g}return"error"}function e(a,b){return 0==b?d:function(c,f){for(var g=b;!c.eol();){var h=c.next();if("{"==h&&c.eat("-"))++g;else if("-"==h&&c.eat("}")&&(--g,0==g))return f(d),a}return f(e(a,g)),a}}function f(a,b){for(;!a.eol();){var c=a.next();if('"'==c)return b(d),"string";if("\\"==c){if(a.eol()||a.eat(p))return b(g),"string";a.eat("&")||a.next()}}return b(d),"string error"}function g(a,b){return a.eat("\\")?c(a,b,f):(a.next(),b(d),"error")}var h=/[a-z_]/,i=/[A-Z]/,j=/\d/,k=/[0-9A-Fa-f]/,l=/[0-7]/,m=/[a-z_A-Z0-9'\xa1-\uffff]/,n=/[-!#$%&*+.\/<=>?@\\^|~:]/,o=/[(),;[\]`{}]/,p=/[ \t\v\f]/,q=(function(){function a(a){return function(){for(var b=0;b","@","~","=>"),a("builtin")("!!","$!","$","&&","+","++","-",".","/","/=","<","<=","=<<","==",">",">=",">>",">>=","^","^^","||","*","**"),a("builtin")("Bool","Bounded","Char","Double","EQ","Either","Enum","Eq","False","FilePath","Float","Floating","Fractional","Functor","GT","IO","IOError","Int","Integer","Integral","Just","LT","Left","Maybe","Monad","Nothing","Num","Ord","Ordering","Rational","Read","ReadS","Real","RealFloat","RealFrac","Right","Show","ShowS","String","True"),a("builtin")("abs","acos","acosh","all","and","any","appendFile","asTypeOf","asin","asinh","atan","atan2","atanh","break","catch","ceiling","compare","concat","concatMap","const","cos","cosh","curry","cycle","decodeFloat","div","divMod","drop","dropWhile","either","elem","encodeFloat","enumFrom","enumFromThen","enumFromThenTo","enumFromTo","error","even","exp","exponent","fail","filter","flip","floatDigits","floatRadix","floatRange","floor","fmap","foldl","foldl1","foldr","foldr1","fromEnum","fromInteger","fromIntegral","fromRational","fst","gcd","getChar","getContents","getLine","head","id","init","interact","ioError","isDenormalized","isIEEE","isInfinite","isNaN","isNegativeZero","iterate","last","lcm","length","lex","lines","log","logBase","lookup","map","mapM","mapM_","max","maxBound","maximum","maybe","min","minBound","minimum","mod","negate","not","notElem","null","odd","or","otherwise","pi","pred","print","product","properFraction","putChar","putStr","putStrLn","quot","quotRem","read","readFile","readIO","readList","readLn","readParen","reads","readsPrec","realToFrac","recip","rem","repeat","replicate","return","reverse","round","scaleFloat","scanl","scanl1","scanr","scanr1","seq","sequence","sequence_","show","showChar","showList","showParen","showString","shows","showsPrec","significand","signum","sin","sinh","snd","span","splitAt","sqrt","subtract","succ","sum","tail","take","takeWhile","tan","tanh","toEnum","toInteger","toRational","truncate","uncurry","undefined","unlines","until","unwords","unzip","unzip3","userError","words","writeFile","zip","zip3","zipWith","zipWith3");var d=b.overrideKeywords;if(d)for(var e in d)d.hasOwnProperty(e)&&(c[e]=d[e]);return c})();return{startState:function(){return{f:d}},copyState:function(a){return{f:a.f}},token:function(a,b){var c=b.f(a,(function(a){b.f=a})),d=a.current();return q.hasOwnProperty(d)?q[d]:c},blockCommentStart:"{-",blockCommentEnd:"-}",lineComment:"--"}})),a.defineMIME("text/x-haskell","haskell")})); \ No newline at end of file diff --git a/media/editors/codemirror/mode/javascript/javascript.js b/media/editors/codemirror/mode/javascript/javascript.js index e23560746d68d..a717745897415 100644 --- a/media/editors/codemirror/mode/javascript/javascript.js +++ b/media/editors/codemirror/mode/javascript/javascript.js @@ -209,6 +209,11 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { var arrow = stream.string.indexOf("=>", stream.start); if (arrow < 0) return; + if (isTS) { // Try to skip TypeScript return type declarations after the arguments + var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow)) + if (m) arrow = m.index + } + var depth = 0, sawSomething = false; for (var pos = arrow - 1; pos >= 0; --pos) { var ch = stream.string.charAt(pos); @@ -390,6 +395,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma; if (atomicTypes.hasOwnProperty(type)) return cont(maybeop); if (type == "function") return cont(functiondef, maybeop); + if (type == "class") return cont(pushlex("form"), classExpression, poplex); if (type == "keyword c" || type == "async") return cont(noComma ? maybeexpressionNoComma : maybeexpression); if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop); if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression); @@ -531,9 +537,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (value == "?") return cont(maybetype); } } - function maybedefault(_, value) { - if (value == "=") return cont(expressionNoComma); - } function typeexpr(type) { if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);} if (type == "{") return cont(commasep(typeprop, "}")) @@ -615,19 +618,24 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { } function funarg(type) { if (type == "spread") return cont(funarg); - return pass(pattern, maybetype, maybedefault); + return pass(pattern, maybetype, maybeAssign); + } + function classExpression(type, value) { + // Class expressions may have an optional name. + if (type == "variable") return className(type, value); + return classNameAfter(type, value); } function className(type, value) { if (type == "variable") {register(value); return cont(classNameAfter);} } function classNameAfter(type, value) { - if (value == "extends") return cont(isTS ? typeexpr : expression, classNameAfter); + if (value == "extends" || value == "implements") return cont(isTS ? typeexpr : expression, classNameAfter); if (type == "{") return cont(pushlex("}"), classBody, poplex); } function classBody(type, value) { if (type == "variable" || cx.style == "keyword") { if ((value == "static" || value == "get" || value == "set" || - (isTS && (value == "public" || value == "private" || value == "protected"))) && + (isTS && (value == "public" || value == "private" || value == "protected" || value == "readonly" || value == "abstract"))) && cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false)) { cx.marked = "keyword"; return cont(classBody); @@ -642,8 +650,9 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == ";") return cont(classBody); if (type == "}") return cont(); } - function classfield(type) { - if (type == ":") return cont(typeexpr) + function classfield(type, value) { + if (value == "?") return cont(classfield) + if (type == ":") return cont(typeexpr, maybeAssign) return pass(functiondef) } function afterExport(_type, value) { diff --git a/media/editors/codemirror/mode/javascript/javascript.min.js b/media/editors/codemirror/mode/javascript/javascript.min.js index 7a8a8db3fcd47..dbd3ec0768dc1 100644 --- a/media/editors/codemirror/mode/javascript/javascript.min.js +++ b/media/editors/codemirror/mode/javascript/javascript.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a,b,c){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(b.lastType)||"quasi"==b.lastType&&/\{\s*$/.test(a.string.slice(0,a.pos-(c||0)))}a.defineMode("javascript",(function(c,d){function e(a){for(var b,c=!1,d=!1;null!=(b=a.next());){if(!c){if("/"==b&&!d)return;"["==b?d=!0:d&&"]"==b&&(d=!1)}c=!c&&"\\"==b}}function f(a,b,c){return xa=a,ya=c,b}function g(a,c){var d=a.next();if('"'==d||"'"==d)return c.tokenize=h(d),c.tokenize(a,c);if("."==d&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return f("number","number");if("."==d&&a.match(".."))return f("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(d))return f(d);if("="==d&&a.eat(">"))return f("=>","operator");if("0"==d&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),f("number","number");if("0"==d&&a.eat(/o/i))return a.eatWhile(/[0-7]/i),f("number","number");if("0"==d&&a.eat(/b/i))return a.eatWhile(/[01]/i),f("number","number");if(/\d/.test(d))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),f("number","number");if("/"==d)return a.eat("*")?(c.tokenize=i,i(a,c)):a.eat("/")?(a.skipToEnd(),f("comment","comment")):b(a,c,1)?(e(a),a.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),f("regexp","string-2")):(a.eatWhile(Ga),f("operator","operator",a.current()));if("`"==d)return c.tokenize=j,j(a,c);if("#"==d)return a.skipToEnd(),f("error","error");if(Ga.test(d))return a.eatWhile(Ga),f("operator","operator",a.current());if(Ea.test(d)){a.eatWhile(Ea);var g=a.current(),k=Fa.propertyIsEnumerable(g)&&Fa[g];return k&&"."!=c.lastType?f(k.type,k.style,g):f("variable","variable",g)}}function h(a){return function(b,c){var d,e=!1;if(Ba&&"@"==b.peek()&&b.match(Ha))return c.tokenize=g,f("jsonld-keyword","meta");for(;null!=(d=b.next())&&(d!=a||e);)e=!e&&"\\"==d;return e||(c.tokenize=g),f("string","string")}}function i(a,b){for(var c,d=!1;c=a.next();){if("/"==c&&d){b.tokenize=g;break}d="*"==c}return f("comment","comment")}function j(a,b){for(var c,d=!1;null!=(c=a.next());){if(!d&&("`"==c||"$"==c&&a.eat("{"))){b.tokenize=g;break}d=!d&&"\\"==c}return f("quasi","string-2",a.current())}function k(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var c=a.string.indexOf("=>",a.start);if(!(c<0)){for(var d=0,e=!1,f=c-1;f>=0;--f){var g=a.string.charAt(f),h=Ia.indexOf(g);if(h>=0&&h<3){if(!d){++f;break}if(0==--d){"("==g&&(e=!0);break}}else if(h>=3&&h<6)++d;else if(Ea.test(g))e=!0;else{if(/["'\/]/.test(g))return;if(e&&!d){++f;break}}}e&&!d&&(b.fatArrowAt=f)}}function l(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,null!=d&&(this.align=d)}function m(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0;for(var d=a.context;d;d=d.prev)for(var c=d.vars;c;c=c.next)if(c.name==b)return!0}function n(a,b,c,d,e){var f=a.cc;for(Ka.state=a,Ka.stream=e,Ka.marked=null,Ka.cc=f,Ka.style=b,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);;){var g=f.length?f.pop():Ca?x:w;if(g(c,d)){for(;f.length&&f[f.length-1].lex;)f.pop()();return Ka.marked?Ka.marked:"variable"==c&&m(a,d)?"variable-2":b}}}function o(){for(var a=arguments.length-1;a>=0;a--)Ka.cc.push(arguments[a])}function p(){return o.apply(null,arguments),!0}function q(a){function b(b){for(var c=b;c;c=c.next)if(c.name==a)return!0;return!1}var c=Ka.state;if(Ka.marked="def",c.context){if(b(c.localVars))return;c.localVars={name:a,next:c.localVars}}else{if(b(c.globalVars))return;d.globalVars&&(c.globalVars={name:a,next:c.globalVars})}}function r(){Ka.state.context={prev:Ka.state.context,vars:Ka.state.localVars},Ka.state.localVars=La}function s(){Ka.state.localVars=Ka.state.context.vars,Ka.state.context=Ka.state.context.prev}function t(a,b){var c=function(){var c=Ka.state,d=c.indented;if("stat"==c.lexical.type)d=c.lexical.indented;else for(var e=c.lexical;e&&")"==e.type&&e.align;e=e.prev)d=e.indented;c.lexical=new l(d,Ka.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function u(){var a=Ka.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function v(a){function b(c){return c==a?p():";"==a?o():p(b)}return b}function w(a,b){return"var"==a?p(t("vardef",b.length),_,v(";"),u):"keyword a"==a?p(t("form"),z,w,u):"keyword b"==a?p(t("form"),w,u):"{"==a?p(t("}"),T,u):";"==a?p():"if"==a?("else"==Ka.state.lexical.info&&Ka.state.cc[Ka.state.cc.length-1]==u&&Ka.state.cc.pop()(),p(t("form"),z,w,u,ea)):"function"==a?p(ka):"for"==a?p(t("form"),fa,w,u):"variable"==a?p(t("stat"),M):"switch"==a?p(t("form"),z,t("}","switch"),v("{"),T,u,u):"case"==a?p(x,v(":")):"default"==a?p(v(":")):"catch"==a?p(t("form"),r,v("("),la,v(")"),w,u,s):"class"==a?p(t("form"),ma,u):"export"==a?p(t("stat"),qa,u):"import"==a?p(t("stat"),ra,u):"module"==a?p(t("form"),aa,t("}"),v("{"),T,u,u):"type"==a?p(W,v("operator"),W,v(";")):"async"==a?p(w):o(t("stat"),x,v(";"),u)}function x(a){return A(a,!1)}function y(a){return A(a,!0)}function z(a){return"("!=a?o():p(t(")"),x,v(")"),u)}function A(a,b){if(Ka.state.fatArrowAt==Ka.stream.start){var c=b?I:H;if("("==a)return p(r,t(")"),R(aa,")"),u,v("=>"),c,s);if("variable"==a)return o(r,aa,v("=>"),c,s)}var d=b?E:D;return Ja.hasOwnProperty(a)?p(d):"function"==a?p(ka,d):"keyword c"==a||"async"==a?p(b?C:B):"("==a?p(t(")"),B,v(")"),u,d):"operator"==a||"spread"==a?p(b?y:x):"["==a?p(t("]"),va,u,d):"{"==a?S(O,"}",null,d):"quasi"==a?o(F,d):"new"==a?p(J(b)):p()}function B(a){return a.match(/[;\}\)\],]/)?o():o(x)}function C(a){return a.match(/[;\}\)\],]/)?o():o(y)}function D(a,b){return","==a?p(x):E(a,b,!1)}function E(a,b,c){var d=0==c?D:E,e=0==c?x:y;return"=>"==a?p(r,c?I:H,s):"operator"==a?/\+\+|--/.test(b)?p(d):"?"==b?p(x,v(":"),e):p(e):"quasi"==a?o(F,d):";"!=a?"("==a?S(y,")","call",d):"."==a?p(N,d):"["==a?p(t("]"),B,v("]"),u,d):void 0:void 0}function F(a,b){return"quasi"!=a?o():"${"!=b.slice(b.length-2)?p(F):p(x,G)}function G(a){if("}"==a)return Ka.marked="string-2",Ka.state.tokenize=j,p(F)}function H(a){return k(Ka.stream,Ka.state),o("{"==a?w:x)}function I(a){return k(Ka.stream,Ka.state),o("{"==a?w:y)}function J(a){return function(b){return"."==b?p(a?L:K):o(a?y:x)}}function K(a,b){if("target"==b)return Ka.marked="keyword",p(D)}function L(a,b){if("target"==b)return Ka.marked="keyword",p(E)}function M(a){return":"==a?p(u,w):o(D,v(";"),u)}function N(a){if("variable"==a)return Ka.marked="property",p()}function O(a,b){return"async"==a?(Ka.marked="property",p(O)):"variable"==a||"keyword"==Ka.style?(Ka.marked="property",p("get"==b||"set"==b?P:Q)):"number"==a||"string"==a?(Ka.marked=Ba?"property":Ka.style+" property",p(Q)):"jsonld-keyword"==a?p(Q):"modifier"==a?p(O):"["==a?p(x,v("]"),Q):"spread"==a?p(x):":"==a?o(Q):void 0}function P(a){return"variable"!=a?o(Q):(Ka.marked="property",p(ka))}function Q(a){return":"==a?p(y):"("==a?o(ka):void 0}function R(a,b){function c(d,e){if(","==d){var f=Ka.state.lexical;return"call"==f.info&&(f.pos=(f.pos||0)+1),p((function(c,d){return c==b||d==b?o():o(a)}),c)}return d==b||e==b?p():p(v(b))}return function(d,e){return d==b||e==b?p():o(a,c)}}function S(a,b,c){for(var d=3;d"==a)return p(W)}function Y(a){return"variable"==a||"keyword"==Ka.style?(Ka.marked="property",p(Y)):":"==a?p(W):void 0}function Z(a){return"variable"==a?p(Z):":"==a?p(W):void 0}function $(a,b){return"<"==b?p(R(W,">"),$):"["==a?p(v("]"),$):void 0}function _(){return o(aa,U,ca,da)}function aa(a,b){return"modifier"==a?p(aa):"variable"==a?(q(b),p()):"spread"==a?p(aa):"["==a?S(aa,"]"):"{"==a?S(ba,"}"):void 0}function ba(a,b){return"variable"!=a||Ka.stream.match(/^\s*:/,!1)?("variable"==a&&(Ka.marked="property"),"spread"==a?p(aa):"}"==a?o():p(v(":"),aa,ca)):(q(b),p(ca))}function ca(a,b){if("="==b)return p(y)}function da(a){if(","==a)return p(_)}function ea(a,b){if("keyword b"==a&&"else"==b)return p(t("form","else"),w,u)}function fa(a){if("("==a)return p(t(")"),ga,v(")"),u)}function ga(a){return"var"==a?p(_,v(";"),ia):";"==a?p(ia):"variable"==a?p(ha):o(x,v(";"),ia)}function ha(a,b){return"in"==b||"of"==b?(Ka.marked="keyword",p(x)):p(D,ia)}function ia(a,b){return";"==a?p(ja):"in"==b||"of"==b?(Ka.marked="keyword",p(x)):o(x,v(";"),ja)}function ja(a){")"!=a&&p(x)}function ka(a,b){return"*"==b?(Ka.marked="keyword",p(ka)):"variable"==a?(q(b),p(ka)):"("==a?p(r,t(")"),R(la,")"),u,U,w,s):void 0}function la(a){return"spread"==a?p(la):o(aa,U,V)}function ma(a,b){if("variable"==a)return q(b),p(na)}function na(a,b){return"extends"==b?p(Da?W:x,na):"{"==a?p(t("}"),oa,u):void 0}function oa(a,b){return"variable"==a||"keyword"==Ka.style?("static"==b||"get"==b||"set"==b||Da&&("public"==b||"private"==b||"protected"==b))&&Ka.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(Ka.marked="keyword",p(oa)):(Ka.marked="property",p(Da?pa:ka,oa)):"*"==b?(Ka.marked="keyword",p(oa)):";"==a?p(oa):"}"==a?p():void 0}function pa(a){return":"==a?p(W):o(ka)}function qa(a,b){return"*"==b?(Ka.marked="keyword",p(ua,v(";"))):"default"==b?(Ka.marked="keyword",p(x,v(";"))):o(w)}function ra(a){return"string"==a?p():o(sa,ua)}function sa(a,b){return"{"==a?S(sa,"}"):("variable"==a&&q(b),"*"==b&&(Ka.marked="keyword"),p(ta))}function ta(a,b){if("as"==b)return Ka.marked="keyword",p(sa)}function ua(a,b){if("from"==b)return Ka.marked="keyword",p(x)}function va(a){return"]"==a?p():o(R(y,"]"))}function wa(a,b){return"operator"==a.lastType||","==a.lastType||Ga.test(b.charAt(0))||/[,.]/.test(b.charAt(0))}var xa,ya,za=c.indentUnit,Aa=d.statementIndent,Ba=d.jsonld,Ca=d.json||Ba,Da=d.typescript,Ea=d.wordCharacters||/[\w$\xa1-\uffff]/,Fa=(function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),f={type:"atom",style:"atom"},g={if:a("if"),while:b,with:b,else:c,do:c,try:c,finally:c,return:d,break:d,continue:d,new:a("new"),delete:d,throw:d,debugger:d,var:a("var"),const:a("var"),let:a("var"),function:a("function"),catch:a("catch"),for:a("for"),switch:a("switch"),case:a("case"),default:a("default"),in:e,typeof:e,instanceof:e,true:f,false:f,null:f,undefined:f,NaN:f,Infinity:f,this:a("this"),class:a("class"),super:a("atom"),yield:d,export:a("export"),import:a("import"),extends:d,await:d,async:a("async")};if(Da){var h={type:"variable",style:"variable-3"},i={interface:a("class"),implements:d,namespace:d,module:a("module"),enum:a("module"),type:a("type"),public:a("modifier"),private:a("modifier"),protected:a("modifier"),abstract:a("modifier"),as:e,string:h,number:h,boolean:h,any:h};for(var j in i)g[j]=i[j]}return g})(),Ga=/[+\-*&%=<>!?|~^]/,Ha=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Ia="([{}])",Ja={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0},Ka={state:null,column:null,marked:null,cc:null},La={name:"this",next:{name:"arguments"}};return u.lex=!0,{startState:function(a){var b={tokenize:g,lastType:"sof",cc:[],lexical:new l((a||0)-za,0,"block",!1),localVars:d.localVars,context:d.localVars&&{vars:d.localVars},indented:a||0};return d.globalVars&&"object"==typeof d.globalVars&&(b.globalVars=d.globalVars),b},token:function(a,b){if(a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation(),k(a,b)),b.tokenize!=i&&a.eatSpace())return null;var c=b.tokenize(a,b);return"comment"==xa?c:(b.lastType="operator"!=xa||"++"!=ya&&"--"!=ya?xa:"incdec",n(b,c,xa,ya,a))},indent:function(b,c){if(b.tokenize==i)return a.Pass;if(b.tokenize!=g)return 0;var e,f=c&&c.charAt(0),h=b.lexical;if(!/^\s*else\b/.test(c))for(var j=b.cc.length-1;j>=0;--j){var k=b.cc[j];if(k==u)h=h.prev;else if(k!=ea)break}for(;("stat"==h.type||"form"==h.type)&&("}"==f||(e=b.cc[b.cc.length-1])&&(e==D||e==E)&&!/^[,\.=+\-*:?[\(]/.test(c));)h=h.prev;Aa&&")"==h.type&&"stat"==h.prev.type&&(h=h.prev);var l=h.type,m=f==l;return"vardef"==l?h.indented+("operator"==b.lastType||","==b.lastType?h.info+1:0):"form"==l&&"{"==f?h.indented:"form"==l?h.indented+za:"stat"==l?h.indented+(wa(b,c)?Aa||za:0):"switch"!=h.info||m||0==d.doubleIndentSwitch?h.align?h.column+(m?0:1):h.indented+(m?0:za):h.indented+(/^(?:case|default)\b/.test(c)?za:2*za)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Ca?null:"/*",blockCommentEnd:Ca?null:"*/",lineComment:Ca?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Ca?"json":"javascript",jsonldMode:Ba,jsonMode:Ca,expressionAllowed:b,skipExpression:function(a){var b=a.cc[a.cc.length-1];b!=x&&b!=y||a.cc.pop()}}})),a.registerHelper("wordChars","javascript",/[\w$]/),a.defineMIME("text/javascript","javascript"),a.defineMIME("text/ecmascript","javascript"),a.defineMIME("application/javascript","javascript"),a.defineMIME("application/x-javascript","javascript"),a.defineMIME("application/ecmascript","javascript"),a.defineMIME("application/json",{name:"javascript",json:!0}),a.defineMIME("application/x-json",{name:"javascript",json:!0}),a.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),a.defineMIME("text/typescript",{name:"javascript",typescript:!0}),a.defineMIME("application/typescript",{name:"javascript",typescript:!0})})); \ No newline at end of file +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a,b,c){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(b.lastType)||"quasi"==b.lastType&&/\{\s*$/.test(a.string.slice(0,a.pos-(c||0)))}a.defineMode("javascript",(function(c,d){function e(a){for(var b,c=!1,d=!1;null!=(b=a.next());){if(!c){if("/"==b&&!d)return;"["==b?d=!0:d&&"]"==b&&(d=!1)}c=!c&&"\\"==b}}function f(a,b,c){return xa=a,ya=c,b}function g(a,c){var d=a.next();if('"'==d||"'"==d)return c.tokenize=h(d),c.tokenize(a,c);if("."==d&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return f("number","number");if("."==d&&a.match(".."))return f("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(d))return f(d);if("="==d&&a.eat(">"))return f("=>","operator");if("0"==d&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),f("number","number");if("0"==d&&a.eat(/o/i))return a.eatWhile(/[0-7]/i),f("number","number");if("0"==d&&a.eat(/b/i))return a.eatWhile(/[01]/i),f("number","number");if(/\d/.test(d))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),f("number","number");if("/"==d)return a.eat("*")?(c.tokenize=i,i(a,c)):a.eat("/")?(a.skipToEnd(),f("comment","comment")):b(a,c,1)?(e(a),a.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),f("regexp","string-2")):(a.eatWhile(Ga),f("operator","operator",a.current()));if("`"==d)return c.tokenize=j,j(a,c);if("#"==d)return a.skipToEnd(),f("error","error");if(Ga.test(d))return a.eatWhile(Ga),f("operator","operator",a.current());if(Ea.test(d)){a.eatWhile(Ea);var g=a.current(),k=Fa.propertyIsEnumerable(g)&&Fa[g];return k&&"."!=c.lastType?f(k.type,k.style,g):f("variable","variable",g)}}function h(a){return function(b,c){var d,e=!1;if(Ba&&"@"==b.peek()&&b.match(Ha))return c.tokenize=g,f("jsonld-keyword","meta");for(;null!=(d=b.next())&&(d!=a||e);)e=!e&&"\\"==d;return e||(c.tokenize=g),f("string","string")}}function i(a,b){for(var c,d=!1;c=a.next();){if("/"==c&&d){b.tokenize=g;break}d="*"==c}return f("comment","comment")}function j(a,b){for(var c,d=!1;null!=(c=a.next());){if(!d&&("`"==c||"$"==c&&a.eat("{"))){b.tokenize=g;break}d=!d&&"\\"==c}return f("quasi","string-2",a.current())}function k(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var c=a.string.indexOf("=>",a.start);if(!(c<0)){if(Da){var d=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(a.string.slice(a.start,c));d&&(c=d.index)}for(var e=0,f=!1,g=c-1;g>=0;--g){var h=a.string.charAt(g),i=Ia.indexOf(h);if(i>=0&&i<3){if(!e){++g;break}if(0==--e){"("==h&&(f=!0);break}}else if(i>=3&&i<6)++e;else if(Ea.test(h))f=!0;else{if(/["'\/]/.test(h))return;if(f&&!e){++g;break}}}f&&!e&&(b.fatArrowAt=g)}}function l(a,b,c,d,e,f){this.indented=a,this.column=b,this.type=c,this.prev=e,this.info=f,null!=d&&(this.align=d)}function m(a,b){for(var c=a.localVars;c;c=c.next)if(c.name==b)return!0;for(var d=a.context;d;d=d.prev)for(var c=d.vars;c;c=c.next)if(c.name==b)return!0}function n(a,b,c,d,e){var f=a.cc;for(Ka.state=a,Ka.stream=e,Ka.marked=null,Ka.cc=f,Ka.style=b,a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);;){var g=f.length?f.pop():Ca?x:w;if(g(c,d)){for(;f.length&&f[f.length-1].lex;)f.pop()();return Ka.marked?Ka.marked:"variable"==c&&m(a,d)?"variable-2":b}}}function o(){for(var a=arguments.length-1;a>=0;a--)Ka.cc.push(arguments[a])}function p(){return o.apply(null,arguments),!0}function q(a){function b(b){for(var c=b;c;c=c.next)if(c.name==a)return!0;return!1}var c=Ka.state;if(Ka.marked="def",c.context){if(b(c.localVars))return;c.localVars={name:a,next:c.localVars}}else{if(b(c.globalVars))return;d.globalVars&&(c.globalVars={name:a,next:c.globalVars})}}function r(){Ka.state.context={prev:Ka.state.context,vars:Ka.state.localVars},Ka.state.localVars=La}function s(){Ka.state.localVars=Ka.state.context.vars,Ka.state.context=Ka.state.context.prev}function t(a,b){var c=function(){var c=Ka.state,d=c.indented;if("stat"==c.lexical.type)d=c.lexical.indented;else for(var e=c.lexical;e&&")"==e.type&&e.align;e=e.prev)d=e.indented;c.lexical=new l(d,Ka.stream.column(),a,null,c.lexical,b)};return c.lex=!0,c}function u(){var a=Ka.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function v(a){function b(c){return c==a?p():";"==a?o():p(b)}return b}function w(a,b){return"var"==a?p(t("vardef",b.length),$,v(";"),u):"keyword a"==a?p(t("form"),z,w,u):"keyword b"==a?p(t("form"),w,u):"{"==a?p(t("}"),T,u):";"==a?p():"if"==a?("else"==Ka.state.lexical.info&&Ka.state.cc[Ka.state.cc.length-1]==u&&Ka.state.cc.pop()(),p(t("form"),z,w,u,da)):"function"==a?p(ja):"for"==a?p(t("form"),ea,w,u):"variable"==a?p(t("stat"),M):"switch"==a?p(t("form"),z,t("}","switch"),v("{"),T,u,u):"case"==a?p(x,v(":")):"default"==a?p(v(":")):"catch"==a?p(t("form"),r,v("("),ka,v(")"),w,u,s):"class"==a?p(t("form"),ma,u):"export"==a?p(t("stat"),qa,u):"import"==a?p(t("stat"),ra,u):"module"==a?p(t("form"),_,t("}"),v("{"),T,u,u):"type"==a?p(V,v("operator"),V,v(";")):"async"==a?p(w):o(t("stat"),x,v(";"),u)}function x(a){return A(a,!1)}function y(a){return A(a,!0)}function z(a){return"("!=a?o():p(t(")"),x,v(")"),u)}function A(a,b){if(Ka.state.fatArrowAt==Ka.stream.start){var c=b?I:H;if("("==a)return p(r,t(")"),R(_,")"),u,v("=>"),c,s);if("variable"==a)return o(r,_,v("=>"),c,s)}var d=b?E:D;return Ja.hasOwnProperty(a)?p(d):"function"==a?p(ja,d):"class"==a?p(t("form"),la,u):"keyword c"==a||"async"==a?p(b?C:B):"("==a?p(t(")"),B,v(")"),u,d):"operator"==a||"spread"==a?p(b?y:x):"["==a?p(t("]"),va,u,d):"{"==a?S(O,"}",null,d):"quasi"==a?o(F,d):"new"==a?p(J(b)):p()}function B(a){return a.match(/[;\}\)\],]/)?o():o(x)}function C(a){return a.match(/[;\}\)\],]/)?o():o(y)}function D(a,b){return","==a?p(x):E(a,b,!1)}function E(a,b,c){var d=0==c?D:E,e=0==c?x:y;return"=>"==a?p(r,c?I:H,s):"operator"==a?/\+\+|--/.test(b)?p(d):"?"==b?p(x,v(":"),e):p(e):"quasi"==a?o(F,d):";"!=a?"("==a?S(y,")","call",d):"."==a?p(N,d):"["==a?p(t("]"),B,v("]"),u,d):void 0:void 0}function F(a,b){return"quasi"!=a?o():"${"!=b.slice(b.length-2)?p(F):p(x,G)}function G(a){if("}"==a)return Ka.marked="string-2",Ka.state.tokenize=j,p(F)}function H(a){return k(Ka.stream,Ka.state),o("{"==a?w:x)}function I(a){return k(Ka.stream,Ka.state),o("{"==a?w:y)}function J(a){return function(b){return"."==b?p(a?L:K):o(a?y:x)}}function K(a,b){if("target"==b)return Ka.marked="keyword",p(D)}function L(a,b){if("target"==b)return Ka.marked="keyword",p(E)}function M(a){return":"==a?p(u,w):o(D,v(";"),u)}function N(a){if("variable"==a)return Ka.marked="property",p()}function O(a,b){return"async"==a?(Ka.marked="property",p(O)):"variable"==a||"keyword"==Ka.style?(Ka.marked="property",p("get"==b||"set"==b?P:Q)):"number"==a||"string"==a?(Ka.marked=Ba?"property":Ka.style+" property",p(Q)):"jsonld-keyword"==a?p(Q):"modifier"==a?p(O):"["==a?p(x,v("]"),Q):"spread"==a?p(x):":"==a?o(Q):void 0}function P(a){return"variable"!=a?o(Q):(Ka.marked="property",p(ja))}function Q(a){return":"==a?p(y):"("==a?o(ja):void 0}function R(a,b){function c(d,e){if(","==d){var f=Ka.state.lexical;return"call"==f.info&&(f.pos=(f.pos||0)+1),p((function(c,d){return c==b||d==b?o():o(a)}),c)}return d==b||e==b?p():p(v(b))}return function(d,e){return d==b||e==b?p():o(a,c)}}function S(a,b,c){for(var d=3;d"==a)return p(V)}function X(a){return"variable"==a||"keyword"==Ka.style?(Ka.marked="property",p(X)):":"==a?p(V):void 0}function Y(a){return"variable"==a?p(Y):":"==a?p(V):void 0}function Z(a,b){return"<"==b?p(R(V,">"),Z):"["==a?p(v("]"),Z):void 0}function $(){return o(_,U,ba,ca)}function _(a,b){return"modifier"==a?p(_):"variable"==a?(q(b),p()):"spread"==a?p(_):"["==a?S(_,"]"):"{"==a?S(aa,"}"):void 0}function aa(a,b){return"variable"!=a||Ka.stream.match(/^\s*:/,!1)?("variable"==a&&(Ka.marked="property"),"spread"==a?p(_):"}"==a?o():p(v(":"),_,ba)):(q(b),p(ba))}function ba(a,b){if("="==b)return p(y)}function ca(a){if(","==a)return p($)}function da(a,b){if("keyword b"==a&&"else"==b)return p(t("form","else"),w,u)}function ea(a){if("("==a)return p(t(")"),fa,v(")"),u)}function fa(a){return"var"==a?p($,v(";"),ha):";"==a?p(ha):"variable"==a?p(ga):o(x,v(";"),ha)}function ga(a,b){return"in"==b||"of"==b?(Ka.marked="keyword",p(x)):p(D,ha)}function ha(a,b){return";"==a?p(ia):"in"==b||"of"==b?(Ka.marked="keyword",p(x)):o(x,v(";"),ia)}function ia(a){")"!=a&&p(x)}function ja(a,b){return"*"==b?(Ka.marked="keyword",p(ja)):"variable"==a?(q(b),p(ja)):"("==a?p(r,t(")"),R(ka,")"),u,U,w,s):void 0}function ka(a){return"spread"==a?p(ka):o(_,U,ba)}function la(a,b){return"variable"==a?ma(a,b):na(a,b)}function ma(a,b){if("variable"==a)return q(b),p(na)}function na(a,b){return"extends"==b||"implements"==b?p(Da?V:x,na):"{"==a?p(t("}"),oa,u):void 0}function oa(a,b){return"variable"==a||"keyword"==Ka.style?("static"==b||"get"==b||"set"==b||Da&&("public"==b||"private"==b||"protected"==b||"readonly"==b||"abstract"==b))&&Ka.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(Ka.marked="keyword",p(oa)):(Ka.marked="property",p(Da?pa:ja,oa)):"*"==b?(Ka.marked="keyword",p(oa)):";"==a?p(oa):"}"==a?p():void 0}function pa(a,b){return"?"==b?p(pa):":"==a?p(V,ba):o(ja)}function qa(a,b){return"*"==b?(Ka.marked="keyword",p(ua,v(";"))):"default"==b?(Ka.marked="keyword",p(x,v(";"))):o(w)}function ra(a){return"string"==a?p():o(sa,ua)}function sa(a,b){return"{"==a?S(sa,"}"):("variable"==a&&q(b),"*"==b&&(Ka.marked="keyword"),p(ta))}function ta(a,b){if("as"==b)return Ka.marked="keyword",p(sa)}function ua(a,b){if("from"==b)return Ka.marked="keyword",p(x)}function va(a){return"]"==a?p():o(R(y,"]"))}function wa(a,b){return"operator"==a.lastType||","==a.lastType||Ga.test(b.charAt(0))||/[,.]/.test(b.charAt(0))}var xa,ya,za=c.indentUnit,Aa=d.statementIndent,Ba=d.jsonld,Ca=d.json||Ba,Da=d.typescript,Ea=d.wordCharacters||/[\w$\xa1-\uffff]/,Fa=(function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),c=a("keyword b"),d=a("keyword c"),e=a("operator"),f={type:"atom",style:"atom"},g={if:a("if"),while:b,with:b,else:c,do:c,try:c,finally:c,return:d,break:d,continue:d,new:a("new"),delete:d,throw:d,debugger:d,var:a("var"),const:a("var"),let:a("var"),function:a("function"),catch:a("catch"),for:a("for"),switch:a("switch"),case:a("case"),default:a("default"),in:e,typeof:e,instanceof:e,true:f,false:f,null:f,undefined:f,NaN:f,Infinity:f,this:a("this"),class:a("class"),super:a("atom"),yield:d,export:a("export"),import:a("import"),extends:d,await:d,async:a("async")};if(Da){var h={type:"variable",style:"variable-3"},i={interface:a("class"),implements:d,namespace:d,module:a("module"),enum:a("module"),type:a("type"),public:a("modifier"),private:a("modifier"),protected:a("modifier"),abstract:a("modifier"),as:e,string:h,number:h,boolean:h,any:h};for(var j in i)g[j]=i[j]}return g})(),Ga=/[+\-*&%=<>!?|~^]/,Ha=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Ia="([{}])",Ja={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0},Ka={state:null,column:null,marked:null,cc:null},La={name:"this",next:{name:"arguments"}};return u.lex=!0,{startState:function(a){var b={tokenize:g,lastType:"sof",cc:[],lexical:new l((a||0)-za,0,"block",!1),localVars:d.localVars,context:d.localVars&&{vars:d.localVars},indented:a||0};return d.globalVars&&"object"==typeof d.globalVars&&(b.globalVars=d.globalVars),b},token:function(a,b){if(a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation(),k(a,b)),b.tokenize!=i&&a.eatSpace())return null;var c=b.tokenize(a,b);return"comment"==xa?c:(b.lastType="operator"!=xa||"++"!=ya&&"--"!=ya?xa:"incdec",n(b,c,xa,ya,a))},indent:function(b,c){if(b.tokenize==i)return a.Pass;if(b.tokenize!=g)return 0;var e,f=c&&c.charAt(0),h=b.lexical;if(!/^\s*else\b/.test(c))for(var j=b.cc.length-1;j>=0;--j){var k=b.cc[j];if(k==u)h=h.prev;else if(k!=da)break}for(;("stat"==h.type||"form"==h.type)&&("}"==f||(e=b.cc[b.cc.length-1])&&(e==D||e==E)&&!/^[,\.=+\-*:?[\(]/.test(c));)h=h.prev;Aa&&")"==h.type&&"stat"==h.prev.type&&(h=h.prev);var l=h.type,m=f==l;return"vardef"==l?h.indented+("operator"==b.lastType||","==b.lastType?h.info+1:0):"form"==l&&"{"==f?h.indented:"form"==l?h.indented+za:"stat"==l?h.indented+(wa(b,c)?Aa||za:0):"switch"!=h.info||m||0==d.doubleIndentSwitch?h.align?h.column+(m?0:1):h.indented+(m?0:za):h.indented+(/^(?:case|default)\b/.test(c)?za:2*za)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Ca?null:"/*",blockCommentEnd:Ca?null:"*/",lineComment:Ca?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Ca?"json":"javascript",jsonldMode:Ba,jsonMode:Ca,expressionAllowed:b,skipExpression:function(a){var b=a.cc[a.cc.length-1];b!=x&&b!=y||a.cc.pop()}}})),a.registerHelper("wordChars","javascript",/[\w$]/),a.defineMIME("text/javascript","javascript"),a.defineMIME("text/ecmascript","javascript"),a.defineMIME("application/javascript","javascript"),a.defineMIME("application/x-javascript","javascript"),a.defineMIME("application/ecmascript","javascript"),a.defineMIME("application/json",{name:"javascript",json:!0}),a.defineMIME("application/x-json",{name:"javascript",json:!0}),a.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),a.defineMIME("text/typescript",{name:"javascript",typescript:!0}),a.defineMIME("application/typescript",{name:"javascript",typescript:!0})})); \ No newline at end of file diff --git a/media/editors/codemirror/mode/markdown/markdown.js b/media/editors/codemirror/mode/markdown/markdown.js index 9dd44574fc33d..3dcce8d3b1e66 100644 --- a/media/editors/codemirror/mode/markdown/markdown.js +++ b/media/editors/codemirror/mode/markdown/markdown.js @@ -809,6 +809,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { getType: getType, + closeBrackets: "()[]{}''\"\"``", fold: "markdown" }; return mode; diff --git a/media/editors/codemirror/mode/markdown/markdown.min.js b/media/editors/codemirror/mode/markdown/markdown.min.js index 1b2df6f1c4394..3e962f615953c 100644 --- a/media/editors/codemirror/mode/markdown/markdown.min.js +++ b/media/editors/codemirror/mode/markdown/markdown.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],a):a(CodeMirror)})((function(a){"use strict";a.defineMode("markdown",(function(b,c){function d(c){if(a.findModeByName){var d=a.findModeByName(c);d&&(c=d.mime||d.mimes[0])}var e=a.getMode(b,c);return"null"==e.name?null:e}function e(a,b,c){return b.f=b.inline=c,c(a,b)}function f(a,b,c){return b.f=b.block=c,c(a,b)}function g(a){return!a||!/\S/.test(a.string)}function h(a){return a.linkTitle=!1,a.em=!1,a.strong=!1,a.strikethrough=!1,a.quote=0,a.indentedCode=!1,w&&a.f==j&&(a.f=o,a.block=i),a.trailingSpace=0,a.trailingSpaceNewLine=!1,a.prevLine=a.thisLine,a.thisLine=null,null}function i(b,f){var h=b.sol(),i=f.list!==!1,j=f.indentedCode;f.indentedCode=!1,i&&(f.indentationDiff>=0?(f.indentationDiff<4&&(f.indentation-=f.indentationDiff),f.list=null):f.indentation>0?f.list=null:f.list=!1);var l=null;if(f.indentationDiff>=4)return b.skipToEnd(),j||g(f.prevLine)?(f.indentation-=4,f.indentedCode=!0,x.code):null;if(b.eatSpace())return null;if((l=b.match(D))&&l[1].length<=6)return f.header=l[1].length,c.highlightFormatting&&(f.formatting="header"),f.f=f.inline,m(f);if(!(g(f.prevLine)||f.quote||i||j)&&(l=b.match(E)))return f.header="="==l[0].charAt(0)?1:2,c.highlightFormatting&&(f.formatting="header"),f.f=f.inline,m(f);if(b.eat(">"))return f.quote=h?1:f.quote+1,c.highlightFormatting&&(f.formatting="quote"),b.eatSpace(),m(f);if("["===b.peek())return e(b,f,s);if(b.match(z,!0))return f.hr=!0,x.hr;if((g(f.prevLine)||i)&&(b.match(A,!1)||b.match(B,!1))){var n=null;for(b.match(A,!0)?n="ul":(b.match(B,!0),n="ol"),f.indentation=b.column()+b.current().length,f.list=!0;f.listStack&&b.column()")>-1)&&(c.f=o,c.block=i,c.htmlState=null)}return d}function k(a,b){return b.fencedChars&&a.match(b.fencedChars,!1)?(b.localMode=b.localState=null,b.f=b.block=l,null):b.localMode?b.localMode.token(a,b.localState):(a.skipToEnd(),x.code)}function l(a,b){a.match(b.fencedChars),b.block=i,b.f=o,b.fencedChars=null,c.highlightFormatting&&(b.formatting="code-block"),b.code=1;var d=m(b);return b.code=0,d}function m(a){var b=[];if(a.formatting){b.push(x.formatting),"string"==typeof a.formatting&&(a.formatting=[a.formatting]);for(var d=0;d=a.quote?b.push(x.formatting+"-"+a.formatting[d]+"-"+a.quote):b.push("error"))}if(a.taskOpen)return b.push("meta"),b.length?b.join(" "):null;if(a.taskClosed)return b.push("property"),b.length?b.join(" "):null;if(a.linkHref?b.push(x.linkHref,"url"):(a.strong&&b.push(x.strong),a.em&&b.push(x.em),a.strikethrough&&b.push(x.strikethrough),a.linkText&&b.push(x.linkText),a.code&&b.push(x.code),a.image&&b.push(x.image),a.imageAltText&&b.push(x.imageAltText,"link"),a.imageMarker&&b.push(x.imageMarker)),a.header&&b.push(x.header,x.header+"-"+a.header),a.quote&&(b.push(x.quote),!c.maxBlockquoteDepth||c.maxBlockquoteDepth>=a.quote?b.push(x.quote+"-"+a.quote):b.push(x.quote+"-"+c.maxBlockquoteDepth)),a.list!==!1){var e=(a.listStack.length-1)%3;e?1===e?b.push(x.list2):b.push(x.list3):b.push(x.list1)}return a.trailingSpaceNewLine?b.push("trailing-space-new-line"):a.trailingSpace&&b.push("trailing-space-"+(a.trailingSpace%2?"a":"b")),b.length?b.join(" "):null}function n(a,b){if(a.match(F,!0))return m(b)}function o(b,d){var e=d.text(b,d);if("undefined"!=typeof e)return e;if(d.list)return d.list=null,m(d);if(d.taskList){var g="x"!==b.match(C,!0)[1];return g?d.taskOpen=!0:d.taskClosed=!0,c.highlightFormatting&&(d.formatting="task"),d.taskList=!1,m(d)}if(d.taskOpen=!1,d.taskClosed=!1,d.header&&b.match(/^#+$/,!0))return c.highlightFormatting&&(d.formatting="header"),m(d);var h=b.sol(),i=b.next();if(d.linkTitle){d.linkTitle=!1;var k=i;"("===i&&(k=")"),k=(k+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var l="^\\s*(?:[^"+k+"\\\\]+|\\\\\\\\|\\\\.)"+k;if(b.match(new RegExp(l),!0))return x.linkHref}if("`"===i){var n=d.formatting;c.highlightFormatting&&(d.formatting="code"),b.eatWhile("`");var o=b.current().length;if(0==d.code)return d.code=o,m(d);if(o==d.code){var r=m(d);return d.code=0,r}return d.formatting=n,m(d)}if(d.code)return m(d);if("\\"===i&&(b.next(),c.highlightFormatting)){var s=m(d),t=x.formatting+"-escape";return s?s+" "+t:t}if("!"===i&&b.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return d.imageMarker=!0,d.image=!0,c.highlightFormatting&&(d.formatting="image"),m(d);if("["===i&&d.imageMarker)return d.imageMarker=!1,d.imageAltText=!0,c.highlightFormatting&&(d.formatting="image"),m(d);if("]"===i&&d.imageAltText){c.highlightFormatting&&(d.formatting="image");var s=m(d);return d.imageAltText=!1,d.image=!1,d.inline=d.f=q,s}if("["===i&&b.match(/[^\]]*\](\(.*\)| ?\[.*?\])/,!1)&&!d.image)return d.linkText=!0,c.highlightFormatting&&(d.formatting="link"),m(d);if("]"===i&&d.linkText&&b.match(/\(.*?\)| ?\[.*?\]/,!1)){c.highlightFormatting&&(d.formatting="link");var s=m(d);return d.linkText=!1,d.inline=d.f=q,s}if("<"===i&&b.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){d.f=d.inline=p,c.highlightFormatting&&(d.formatting="link");var s=m(d);return s?s+=" ":s="",s+x.linkInline}if("<"===i&&b.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){d.f=d.inline=p,c.highlightFormatting&&(d.formatting="link");var s=m(d);return s?s+=" ":s="",s+x.linkEmail}if("<"===i&&b.match(/^(!--|\w)/,!1)){var u=b.string.indexOf(">",b.pos);if(u!=-1){var w=b.string.substring(b.start,u);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(w)&&(d.md_inside=!0)}return b.backUp(1),d.htmlState=a.startState(v),f(b,d,j)}if("<"===i&&b.match(/^\/\w*?>/))return d.md_inside=!1,"tag";var y=!1;if(!c.underscoresBreakWords&&"_"===i&&"_"!==b.peek()&&b.match(/(\w)/,!1)){var z=b.pos-2;if(z>=0){var A=b.string.charAt(z);"_"!==A&&A.match(/(\w)/,!1)&&(y=!0)}}if("*"===i||"_"===i&&!y)if(h&&" "===b.peek());else{if(d.strong===i&&b.eat(i)){c.highlightFormatting&&(d.formatting="strong");var r=m(d);return d.strong=!1,r}if(!d.strong&&b.eat(i))return d.strong=i,c.highlightFormatting&&(d.formatting="strong"),m(d);if(d.em===i){c.highlightFormatting&&(d.formatting="em");var r=m(d);return d.em=!1,r}if(!d.em)return d.em=i,c.highlightFormatting&&(d.formatting="em"),m(d)}else if(" "===i&&(b.eat("*")||b.eat("_"))){if(" "===b.peek())return m(d);b.backUp(1)}if(c.strikethrough)if("~"===i&&b.eatWhile(i)){if(d.strikethrough){c.highlightFormatting&&(d.formatting="strikethrough");var r=m(d);return d.strikethrough=!1,r}if(b.match(/^[^\s]/,!1))return d.strikethrough=!0,c.highlightFormatting&&(d.formatting="strikethrough"),m(d)}else if(" "===i&&b.match(/^~~/,!0)){if(" "===b.peek())return m(d);b.backUp(2)}return" "===i&&(b.match(/ +$/,!1)?d.trailingSpace++:d.trailingSpace&&(d.trailingSpaceNewLine=!0)),m(d)}function p(a,b){var d=a.next();if(">"===d){b.f=b.inline=o,c.highlightFormatting&&(b.formatting="link");var e=m(b);return e?e+=" ":e="",e+x.linkInline}return a.match(/^[^>]+/,!0),x.linkInline}function q(a,b){if(a.eatSpace())return null;var d=a.next();return"("===d||"["===d?(b.f=b.inline=r("("===d?")":"]",0),c.highlightFormatting&&(b.formatting="link-string"),b.linkHref=!0,m(b)):"error"}function r(a){return function(b,d){var e=b.next();if(e===a){d.f=d.inline=o,c.highlightFormatting&&(d.formatting="link-string");var f=m(d);return d.linkHref=!1,f}return b.match(H[a]),d.linkHref=!0,m(d)}}function s(a,b){return a.match(/^([^\]\\]|\\.)*\]:/,!1)?(b.f=t,a.next(),c.highlightFormatting&&(b.formatting="link"),b.linkText=!0,m(b)):e(a,b,o)}function t(a,b){if(a.match(/^\]:/,!0)){b.f=b.inline=u,c.highlightFormatting&&(b.formatting="link");var d=m(b);return b.linkText=!1,d}return a.match(/^([^\]\\]|\\.)+/,!0),x.linkText}function u(a,b){return a.eatSpace()?null:(a.match(/^[^\s]+/,!0),void 0===a.peek()?b.linkTitle=!0:a.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),b.f=b.inline=o,x.linkHref+" url")}var v=a.getMode(b,"text/html"),w="null"==v.name;void 0===c.highlightFormatting&&(c.highlightFormatting=!1),void 0===c.maxBlockquoteDepth&&(c.maxBlockquoteDepth=0),void 0===c.underscoresBreakWords&&(c.underscoresBreakWords=!0),void 0===c.taskLists&&(c.taskLists=!1),void 0===c.strikethrough&&(c.strikethrough=!1),void 0===c.tokenTypeOverrides&&(c.tokenTypeOverrides={});var x={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough"};for(var y in x)x.hasOwnProperty(y)&&c.tokenTypeOverrides[y]&&(x[y]=c.tokenTypeOverrides[y]);var z=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^[*\-+]\s+/,B=/^[0-9]+([.)])\s+/,C=/^\[(x| )\](?=\s)/,D=c.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,E=/^ *(?:\={1,}|-{1,})\s*$/,F=/^[^#!\[\]*_\\<>` "'(~]+/,G=new RegExp("^("+(c.fencedCodeBlocks===!0?"~~~+|```+":c.fencedCodeBlocks)+")[ \\t]*([\\w+#-]*)"),H={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\\]]|\\.)*\])*?(?=\])/},I={startState:function(){return{f:i,prevLine:null,thisLine:null,block:i,htmlState:null,indentation:0,inline:o,text:n,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,fencedChars:null}},copyState:function(b){return{f:b.f,prevLine:b.prevLine,thisLine:b.thisLine,block:b.block,htmlState:b.htmlState&&a.copyState(v,b.htmlState),indentation:b.indentation,localMode:b.localMode,localState:b.localMode?a.copyState(b.localMode,b.localState):null,inline:b.inline,text:b.text,formatting:!1,linkTitle:b.linkTitle,code:b.code,em:b.em,strong:b.strong,strikethrough:b.strikethrough,header:b.header,hr:b.hr,taskList:b.taskList,list:b.list,listStack:b.listStack.slice(0),quote:b.quote,indentedCode:b.indentedCode,trailingSpace:b.trailingSpace,trailingSpaceNewLine:b.trailingSpaceNewLine,md_inside:b.md_inside,fencedChars:b.fencedChars}},token:function(a,b){if(b.formatting=!1,a!=b.thisLine){var c=b.header||b.hr;if(b.header=0,b.hr=!1,a.match(/^\s*$/,!0)||c){if(h(b),!c)return null;b.prevLine=null}b.prevLine=b.thisLine,b.thisLine=a,b.taskList=!1,b.trailingSpace=0,b.trailingSpaceNewLine=!1,b.f=b.block;var d=a.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(b.indentationDiff=Math.min(d-b.indentation,4),b.indentation=b.indentation+b.indentationDiff,d>0)return null}return b.f(a,b)},innerMode:function(a){return a.block==j?{state:a.htmlState,mode:v}:a.localState?{state:a.localState,mode:a.localMode}:{state:a,mode:I}},blankLine:h,getType:m,fold:"markdown"};return I}),"xml"),a.defineMIME("text/x-markdown","markdown")})); \ No newline at end of file +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],a):a(CodeMirror)})((function(a){"use strict";a.defineMode("markdown",(function(b,c){function d(c){if(a.findModeByName){var d=a.findModeByName(c);d&&(c=d.mime||d.mimes[0])}var e=a.getMode(b,c);return"null"==e.name?null:e}function e(a,b,c){return b.f=b.inline=c,c(a,b)}function f(a,b,c){return b.f=b.block=c,c(a,b)}function g(a){return!a||!/\S/.test(a.string)}function h(a){return a.linkTitle=!1,a.em=!1,a.strong=!1,a.strikethrough=!1,a.quote=0,a.indentedCode=!1,w&&a.f==j&&(a.f=o,a.block=i),a.trailingSpace=0,a.trailingSpaceNewLine=!1,a.prevLine=a.thisLine,a.thisLine=null,null}function i(b,f){var h=b.sol(),i=f.list!==!1,j=f.indentedCode;f.indentedCode=!1,i&&(f.indentationDiff>=0?(f.indentationDiff<4&&(f.indentation-=f.indentationDiff),f.list=null):f.indentation>0?f.list=null:f.list=!1);var l=null;if(f.indentationDiff>=4)return b.skipToEnd(),j||g(f.prevLine)?(f.indentation-=4,f.indentedCode=!0,x.code):null;if(b.eatSpace())return null;if((l=b.match(D))&&l[1].length<=6)return f.header=l[1].length,c.highlightFormatting&&(f.formatting="header"),f.f=f.inline,m(f);if(!(g(f.prevLine)||f.quote||i||j)&&(l=b.match(E)))return f.header="="==l[0].charAt(0)?1:2,c.highlightFormatting&&(f.formatting="header"),f.f=f.inline,m(f);if(b.eat(">"))return f.quote=h?1:f.quote+1,c.highlightFormatting&&(f.formatting="quote"),b.eatSpace(),m(f);if("["===b.peek())return e(b,f,s);if(b.match(z,!0))return f.hr=!0,x.hr;if((g(f.prevLine)||i)&&(b.match(A,!1)||b.match(B,!1))){var n=null;for(b.match(A,!0)?n="ul":(b.match(B,!0),n="ol"),f.indentation=b.column()+b.current().length,f.list=!0;f.listStack&&b.column()")>-1)&&(c.f=o,c.block=i,c.htmlState=null)}return d}function k(a,b){return b.fencedChars&&a.match(b.fencedChars,!1)?(b.localMode=b.localState=null,b.f=b.block=l,null):b.localMode?b.localMode.token(a,b.localState):(a.skipToEnd(),x.code)}function l(a,b){a.match(b.fencedChars),b.block=i,b.f=o,b.fencedChars=null,c.highlightFormatting&&(b.formatting="code-block"),b.code=1;var d=m(b);return b.code=0,d}function m(a){var b=[];if(a.formatting){b.push(x.formatting),"string"==typeof a.formatting&&(a.formatting=[a.formatting]);for(var d=0;d=a.quote?b.push(x.formatting+"-"+a.formatting[d]+"-"+a.quote):b.push("error"))}if(a.taskOpen)return b.push("meta"),b.length?b.join(" "):null;if(a.taskClosed)return b.push("property"),b.length?b.join(" "):null;if(a.linkHref?b.push(x.linkHref,"url"):(a.strong&&b.push(x.strong),a.em&&b.push(x.em),a.strikethrough&&b.push(x.strikethrough),a.linkText&&b.push(x.linkText),a.code&&b.push(x.code),a.image&&b.push(x.image),a.imageAltText&&b.push(x.imageAltText,"link"),a.imageMarker&&b.push(x.imageMarker)),a.header&&b.push(x.header,x.header+"-"+a.header),a.quote&&(b.push(x.quote),!c.maxBlockquoteDepth||c.maxBlockquoteDepth>=a.quote?b.push(x.quote+"-"+a.quote):b.push(x.quote+"-"+c.maxBlockquoteDepth)),a.list!==!1){var e=(a.listStack.length-1)%3;e?1===e?b.push(x.list2):b.push(x.list3):b.push(x.list1)}return a.trailingSpaceNewLine?b.push("trailing-space-new-line"):a.trailingSpace&&b.push("trailing-space-"+(a.trailingSpace%2?"a":"b")),b.length?b.join(" "):null}function n(a,b){if(a.match(F,!0))return m(b)}function o(b,d){var e=d.text(b,d);if("undefined"!=typeof e)return e;if(d.list)return d.list=null,m(d);if(d.taskList){var g="x"!==b.match(C,!0)[1];return g?d.taskOpen=!0:d.taskClosed=!0,c.highlightFormatting&&(d.formatting="task"),d.taskList=!1,m(d)}if(d.taskOpen=!1,d.taskClosed=!1,d.header&&b.match(/^#+$/,!0))return c.highlightFormatting&&(d.formatting="header"),m(d);var h=b.sol(),i=b.next();if(d.linkTitle){d.linkTitle=!1;var k=i;"("===i&&(k=")"),k=(k+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var l="^\\s*(?:[^"+k+"\\\\]+|\\\\\\\\|\\\\.)"+k;if(b.match(new RegExp(l),!0))return x.linkHref}if("`"===i){var n=d.formatting;c.highlightFormatting&&(d.formatting="code"),b.eatWhile("`");var o=b.current().length;if(0==d.code)return d.code=o,m(d);if(o==d.code){var r=m(d);return d.code=0,r}return d.formatting=n,m(d)}if(d.code)return m(d);if("\\"===i&&(b.next(),c.highlightFormatting)){var s=m(d),t=x.formatting+"-escape";return s?s+" "+t:t}if("!"===i&&b.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return d.imageMarker=!0,d.image=!0,c.highlightFormatting&&(d.formatting="image"),m(d);if("["===i&&d.imageMarker)return d.imageMarker=!1,d.imageAltText=!0,c.highlightFormatting&&(d.formatting="image"),m(d);if("]"===i&&d.imageAltText){c.highlightFormatting&&(d.formatting="image");var s=m(d);return d.imageAltText=!1,d.image=!1,d.inline=d.f=q,s}if("["===i&&b.match(/[^\]]*\](\(.*\)| ?\[.*?\])/,!1)&&!d.image)return d.linkText=!0,c.highlightFormatting&&(d.formatting="link"),m(d);if("]"===i&&d.linkText&&b.match(/\(.*?\)| ?\[.*?\]/,!1)){c.highlightFormatting&&(d.formatting="link");var s=m(d);return d.linkText=!1,d.inline=d.f=q,s}if("<"===i&&b.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){d.f=d.inline=p,c.highlightFormatting&&(d.formatting="link");var s=m(d);return s?s+=" ":s="",s+x.linkInline}if("<"===i&&b.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){d.f=d.inline=p,c.highlightFormatting&&(d.formatting="link");var s=m(d);return s?s+=" ":s="",s+x.linkEmail}if("<"===i&&b.match(/^(!--|\w)/,!1)){var u=b.string.indexOf(">",b.pos);if(u!=-1){var w=b.string.substring(b.start,u);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(w)&&(d.md_inside=!0)}return b.backUp(1),d.htmlState=a.startState(v),f(b,d,j)}if("<"===i&&b.match(/^\/\w*?>/))return d.md_inside=!1,"tag";var y=!1;if(!c.underscoresBreakWords&&"_"===i&&"_"!==b.peek()&&b.match(/(\w)/,!1)){var z=b.pos-2;if(z>=0){var A=b.string.charAt(z);"_"!==A&&A.match(/(\w)/,!1)&&(y=!0)}}if("*"===i||"_"===i&&!y)if(h&&" "===b.peek());else{if(d.strong===i&&b.eat(i)){c.highlightFormatting&&(d.formatting="strong");var r=m(d);return d.strong=!1,r}if(!d.strong&&b.eat(i))return d.strong=i,c.highlightFormatting&&(d.formatting="strong"),m(d);if(d.em===i){c.highlightFormatting&&(d.formatting="em");var r=m(d);return d.em=!1,r}if(!d.em)return d.em=i,c.highlightFormatting&&(d.formatting="em"),m(d)}else if(" "===i&&(b.eat("*")||b.eat("_"))){if(" "===b.peek())return m(d);b.backUp(1)}if(c.strikethrough)if("~"===i&&b.eatWhile(i)){if(d.strikethrough){c.highlightFormatting&&(d.formatting="strikethrough");var r=m(d);return d.strikethrough=!1,r}if(b.match(/^[^\s]/,!1))return d.strikethrough=!0,c.highlightFormatting&&(d.formatting="strikethrough"),m(d)}else if(" "===i&&b.match(/^~~/,!0)){if(" "===b.peek())return m(d);b.backUp(2)}return" "===i&&(b.match(/ +$/,!1)?d.trailingSpace++:d.trailingSpace&&(d.trailingSpaceNewLine=!0)),m(d)}function p(a,b){var d=a.next();if(">"===d){b.f=b.inline=o,c.highlightFormatting&&(b.formatting="link");var e=m(b);return e?e+=" ":e="",e+x.linkInline}return a.match(/^[^>]+/,!0),x.linkInline}function q(a,b){if(a.eatSpace())return null;var d=a.next();return"("===d||"["===d?(b.f=b.inline=r("("===d?")":"]",0),c.highlightFormatting&&(b.formatting="link-string"),b.linkHref=!0,m(b)):"error"}function r(a){return function(b,d){var e=b.next();if(e===a){d.f=d.inline=o,c.highlightFormatting&&(d.formatting="link-string");var f=m(d);return d.linkHref=!1,f}return b.match(H[a]),d.linkHref=!0,m(d)}}function s(a,b){return a.match(/^([^\]\\]|\\.)*\]:/,!1)?(b.f=t,a.next(),c.highlightFormatting&&(b.formatting="link"),b.linkText=!0,m(b)):e(a,b,o)}function t(a,b){if(a.match(/^\]:/,!0)){b.f=b.inline=u,c.highlightFormatting&&(b.formatting="link");var d=m(b);return b.linkText=!1,d}return a.match(/^([^\]\\]|\\.)+/,!0),x.linkText}function u(a,b){return a.eatSpace()?null:(a.match(/^[^\s]+/,!0),void 0===a.peek()?b.linkTitle=!0:a.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),b.f=b.inline=o,x.linkHref+" url")}var v=a.getMode(b,"text/html"),w="null"==v.name;void 0===c.highlightFormatting&&(c.highlightFormatting=!1),void 0===c.maxBlockquoteDepth&&(c.maxBlockquoteDepth=0),void 0===c.underscoresBreakWords&&(c.underscoresBreakWords=!0),void 0===c.taskLists&&(c.taskLists=!1),void 0===c.strikethrough&&(c.strikethrough=!1),void 0===c.tokenTypeOverrides&&(c.tokenTypeOverrides={});var x={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough"};for(var y in x)x.hasOwnProperty(y)&&c.tokenTypeOverrides[y]&&(x[y]=c.tokenTypeOverrides[y]);var z=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^[*\-+]\s+/,B=/^[0-9]+([.)])\s+/,C=/^\[(x| )\](?=\s)/,D=c.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,E=/^ *(?:\={1,}|-{1,})\s*$/,F=/^[^#!\[\]*_\\<>` "'(~]+/,G=new RegExp("^("+(c.fencedCodeBlocks===!0?"~~~+|```+":c.fencedCodeBlocks)+")[ \\t]*([\\w+#-]*)"),H={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\\]]|\\.)*\])*?(?=\])/},I={startState:function(){return{f:i,prevLine:null,thisLine:null,block:i,htmlState:null,indentation:0,inline:o,text:n,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,fencedChars:null}},copyState:function(b){return{f:b.f,prevLine:b.prevLine,thisLine:b.thisLine,block:b.block,htmlState:b.htmlState&&a.copyState(v,b.htmlState),indentation:b.indentation,localMode:b.localMode,localState:b.localMode?a.copyState(b.localMode,b.localState):null,inline:b.inline,text:b.text,formatting:!1,linkTitle:b.linkTitle,code:b.code,em:b.em,strong:b.strong,strikethrough:b.strikethrough,header:b.header,hr:b.hr,taskList:b.taskList,list:b.list,listStack:b.listStack.slice(0),quote:b.quote,indentedCode:b.indentedCode,trailingSpace:b.trailingSpace,trailingSpaceNewLine:b.trailingSpaceNewLine,md_inside:b.md_inside,fencedChars:b.fencedChars}},token:function(a,b){if(b.formatting=!1,a!=b.thisLine){var c=b.header||b.hr;if(b.header=0,b.hr=!1,a.match(/^\s*$/,!0)||c){if(h(b),!c)return null;b.prevLine=null}b.prevLine=b.thisLine,b.thisLine=a,b.taskList=!1,b.trailingSpace=0,b.trailingSpaceNewLine=!1,b.f=b.block;var d=a.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(b.indentationDiff=Math.min(d-b.indentation,4),b.indentation=b.indentation+b.indentationDiff,d>0)return null}return b.f(a,b)},innerMode:function(a){return a.block==j?{state:a.htmlState,mode:v}:a.localState?{state:a.localState,mode:a.localMode}:{state:a,mode:I}},blankLine:h,getType:m,closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return I}),"xml"),a.defineMIME("text/x-markdown","markdown")})); \ No newline at end of file diff --git a/media/editors/codemirror/mode/meta.js b/media/editors/codemirror/mode/meta.js index 1e078eedee0b5..47e9a31ce88ee 100644 --- a/media/editors/codemirror/mode/meta.js +++ b/media/editors/codemirror/mode/meta.js @@ -131,6 +131,7 @@ {name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]}, {name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]}, {name: "Squirrel", mime: "text/x-squirrel", mode: "clike", ext: ["nut"]}, + {name: "Stylus", mime: "text/x-styl", mode: "stylus", ext: ["styl"]}, {name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]}, {name: "sTeX", mime: "text/x-stex", mode: "stex"}, {name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx"], alias: ["tex"]}, diff --git a/media/editors/codemirror/mode/meta.min.js b/media/editors/codemirror/mode/meta.min.js index cd880788490c9..74d0d083fc075 100644 --- a/media/editors/codemirror/mode/meta.min.js +++ b/media/editors/codemirror/mode/meta.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";a.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["pgp"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists.txt$/},{name:"CoffeeScript",mime:"text/x-coffeescript",mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history).md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"null",mode:"jinja2"},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mime:"text/n-triples",mode:"ntriples",ext:["nt"]},{name:"Objective C",mime:"text/x-objectivec",mode:"clike",ext:["m","mm"],alias:["objective-c","objc"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mime:"application/x-httpd-php",mode:"php",ext:["php","php3","php4","php5","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mime:"text/x-sh",mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki ",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mime:"text/x-yaml",mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]}];for(var b=0;b-1&&b.substring(e+1,b.length);if(f)return a.findModeByExtension(f)},a.findModeByName=function(b){b=b.toLowerCase();for(var c=0;c-1&&b.substring(e+1,b.length);if(f)return a.findModeByExtension(f)},a.findModeByName=function(b){b=b.toLowerCase();for(var c=0;c!]+/, token: "operator"}, // Variable - {regex: /\$[\w]+/, token: "variable"}, + {regex: /\$\w+/, token: "variable"}, // Constant - {regex: /\${[\w]+}/,token: "variable-2"}, + {regex: /\${[\w\.:-]+}/, token: "variable-2"}, // Language String - {regex: /\$\([\w]+\)/,token: "variable-3"} + {regex: /\$\([\w\.:-]+\)/, token: "variable-3"} ], comment: [ {regex: /.*?\*\//, token: "comment", next: "start"}, diff --git a/media/editors/codemirror/mode/nsis/nsis.min.js b/media/editors/codemirror/mode/nsis/nsis.min.js index 8b6a3c164afc2..1105da25bb093 100644 --- a/media/editors/codemirror/mode/nsis/nsis.min.js +++ b/media/editors/codemirror/mode/nsis/nsis.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../../addon/mode/simple")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../addon/mode/simple"],a):a(CodeMirror)})((function(a){"use strict";a.defineSimpleMode("nsis",{start:[{regex:/(?:[+-]?)(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\d+.?\d*)/,token:"number"},{regex:/"(?:[^\\"]|\\.)*"?/,token:"string"},{regex:/'(?:[^\\']|\\.)*'?/,token:"string"},{regex:/`(?:[^\\`]|\\.)*`?/,token:"string"},{regex:/(?:\!(include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|finalize|getdllversion|system|tempfile|warning|verbose|define|undef|insertmacro|makensis|searchparse|searchreplace))\b/,token:"keyword"},{regex:/(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/,token:"keyword",indent:!0},{regex:/(?:\!(else|endif|macroend))\b/,token:"keyword",dedent:!0},{regex:/\b(?: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|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|IntCmp|IntCmpU|IntFmt|IntOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|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|SetPluginUnload|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|WriteRegStr|WriteUninstaller|XPStyle)\b/,token:"keyword"},{regex:/\b(?:Function|PageEx|Section(?:Group)?)\b/,token:"keyword",indent:!0},{regex:/\b(?:(Function|PageEx|Section(?:Group)?)End)\b/,token:"keyword",dedent:!0},{regex:/\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR|HKCU|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/,token:"atom"},{regex:/\b(?:admin|all|auto|both|bottom|bzip2|components|current|custom|directory|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|right|show|silent|silentlog|textonly|top|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|WinVista|zlib)\b/,token:"builtin"},{regex:/\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/,token:"variable-2",indent:!0},{regex:/\$\{(?:BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)\}/,token:"variable-2",dedent:!0},{regex:/\$\{(?:Memento(?:Section(?:Done|End|Restore|Save)?|UnselectedSection))\}/,token:"variable-2",dedent:!0},{regex:/\$\{(?:Config(?:Read|ReadS|Write|WriteS)|File(?:Join|ReadFromEnd|Recode)|Line(?:Find|Read|Sum)|Text(?:Compare|CompareS)|TrimNewLines)\}/,token:"variable-2",dedent:!0},{regex:/\$\{(?:(?:At(?:Least|Most)|Is)(?:ServicePack|Win(?:7|8|10|95|98|200(?:0|3|8(?:R2)?)|ME|NT4|Vista|XP))|Is(?:NT|Server))\}/,token:"variable",dedent:!0},{regex:/\$\{(?:StrFilterS?|Version(?:Compare|Convert)|Word(?:AddS?|Find(?:(?:2|3)X)?S?|InsertS?|ReplaceS?))\}/,token:"variable-2",dedent:!0},{regex:/\$\{(?:RunningX64)\}/,token:"variable",dedent:!0},{regex:/\$\{(?:Disable|Enable)X64FSRedirection\}/,token:"variable-2",dedent:!0},{regex:/(#|;).*/,token:"comment"},{regex:/\/\*/,token:"comment",next:"comment"},{regex:/[-+\/*=<>!]+/,token:"operator"},{regex:/\$[\w]+/,token:"variable"},{regex:/\${[\w]+}/,token:"variable-2"},{regex:/\$\([\w]+\)/,token:"variable-3"}],comment:[{regex:/.*?\*\//,token:"comment",next:"start"},{regex:/.*/,token:"comment"}],meta:{electricInput:/^\s*((Function|PageEx|Section|Section(Group)?)End|(\!(endif|macroend))|\$\{(End(If|Unless|While)|Loop(Until)|Next)\})$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:["#",";"]}}),a.defineMIME("text/x-nsis","nsis")})); \ No newline at end of file +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../../addon/mode/simple")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../addon/mode/simple"],a):a(CodeMirror)})((function(a){"use strict";a.defineSimpleMode("nsis",{start:[{regex:/(?:[+-]?)(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\d+.?\d*)/,token:"number"},{regex:/"(?:[^\\"]|\\.)*"?/,token:"string"},{regex:/'(?:[^\\']|\\.)*'?/,token:"string"},{regex:/`(?:[^\\`]|\\.)*`?/,token:"string"},{regex:/^\s*(?:\!(include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|finalize|getdllversion|system|tempfile|warning|verbose|define|undef|insertmacro|makensis|searchparse|searchreplace))\b/,token:"keyword"},{regex:/^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/,token:"keyword",indent:!0},{regex:/^\s*(?:\!(else|endif|macroend))\b/,token:"keyword",dedent:!0},{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|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|IntCmp|IntCmpU|IntFmt|IntOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|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|WriteRegStr|WriteUninstaller|XPStyle)\b/,token:"keyword"},{regex:/^\s*(?:Function|PageEx|Section(?:Group)?)\b/,token:"keyword",indent:!0},{regex:/^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/,token:"keyword",dedent:!0},{regex:/\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR|HKCU|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/,token:"atom"},{regex:/\b(?:admin|all|auto|both|bottom|bzip2|components|current|custom|directory|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|right|show|silent|silentlog|textonly|top|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|WinVista|zlib)\b/,token:"builtin"},{regex:/\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/,token:"variable-2",indent:!0},{regex:/\$\{(?:BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)\}/,token:"variable-2",dedent:!0},{regex:/\$\{(?:Memento(?:Section(?:Done|End|Restore|Save)?|UnselectedSection))\}/,token:"variable-2",dedent:!0},{regex:/\$\{(?:Config(?:Read|ReadS|Write|WriteS)|File(?:Join|ReadFromEnd|Recode)|Line(?:Find|Read|Sum)|Text(?:Compare|CompareS)|TrimNewLines)\}/,token:"variable-2",dedent:!0},{regex:/\$\{(?:(?:At(?:Least|Most)|Is)(?:ServicePack|Win(?:7|8|10|95|98|200(?:0|3|8(?:R2)?)|ME|NT4|Vista|XP))|Is(?:NT|Server))\}/,token:"variable",dedent:!0},{regex:/\$\{(?:StrFilterS?|Version(?:Compare|Convert)|Word(?:AddS?|Find(?:(?:2|3)X)?S?|InsertS?|ReplaceS?))\}/,token:"variable-2",dedent:!0},{regex:/\$\{(?:RunningX64)\}/,token:"variable",dedent:!0},{regex:/\$\{(?:Disable|Enable)X64FSRedirection\}/,token:"variable-2",dedent:!0},{regex:/(#|;).*/,token:"comment"},{regex:/\/\*/,token:"comment",next:"comment"},{regex:/[-+\/*=<>!]+/,token:"operator"},{regex:/\$\w+/,token:"variable"},{regex:/\${[\w\.:-]+}/,token:"variable-2"},{regex:/\$\([\w\.:-]+\)/,token:"variable-3"}],comment:[{regex:/.*?\*\//,token:"comment",next:"start"},{regex:/.*/,token:"comment"}],meta:{electricInput:/^\s*((Function|PageEx|Section|Section(Group)?)End|(\!(endif|macroend))|\$\{(End(If|Unless|While)|Loop(Until)|Next)\})$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:["#",";"]}}),a.defineMIME("text/x-nsis","nsis")})); \ No newline at end of file diff --git a/media/editors/codemirror/mode/python/python.js b/media/editors/codemirror/mode/python/python.js index efeed7f15434c..30f1428e3aa48 100644 --- a/media/editors/codemirror/mode/python/python.js +++ b/media/editors/codemirror/mode/python/python.js @@ -85,7 +85,7 @@ var lineOffset = stream.indentation(); if (lineOffset > scopeOffset) pushPyScope(state); - else if (lineOffset < scopeOffset && dedent(stream, state)) + else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#") state.errorToken = true; return null; } else { diff --git a/media/editors/codemirror/mode/python/python.min.js b/media/editors/codemirror/mode/python/python.min.js index 960d451e01fbd..582dca9cb546a 100644 --- a/media/editors/codemirror/mode/python/python.min.js +++ b/media/editors/codemirror/mode/python/python.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a){return new RegExp("^(("+a.join(")|(")+"))\\b")}function c(a){return a.scopes[a.scopes.length-1]}var d=b(["and","or","not","is"]),e=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],f=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];a.registerHelper("hintWords","python",e.concat(f)),a.defineMode("python",(function(g,h){function i(a,b){if(a.sol()&&(b.indent=a.indentation()),a.sol()&&"py"==c(b).type){var d=c(b).offset;if(a.eatSpace()){var e=a.indentation();return e>d?l(b):e0&&n(a,b)&&(f+=" "+p),f}return j(a,b)}function j(a,b){if(a.eatSpace())return null;var c=a.peek();if("#"==c)return a.skipToEnd(),"comment";if(a.match(/^[0-9\.]/,!1)){var e=!1;if(a.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)&&(e=!0),a.match(/^\d+\.\d*/)&&(e=!0),a.match(/^\.\d+/)&&(e=!0),e)return a.eat(/J/i),"number";var f=!1;if(a.match(/^0x[0-9a-f]+/i)&&(f=!0),a.match(/^0b[01]+/i)&&(f=!0),a.match(/^0o[0-7]+/i)&&(f=!0),a.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(a.eat(/J/i),f=!0),a.match(/^0(?![\dx])/i)&&(f=!0),f)return a.eat(/L/i),"number"}return a.match(A)?(b.tokenize=k(a.current()),b.tokenize(a,b)):a.match(t)||a.match(s)?"punctuation":a.match(r)||a.match(y)?"operator":a.match(q)?"punctuation":"."==b.lastToken&&a.match(z)?"property":a.match(B)||a.match(d)?"keyword":a.match(C)?"builtin":a.match(/^(self|cls)\b/)?"variable-2":a.match(z)?"def"==b.lastToken||"class"==b.lastToken?"def":"variable":(a.next(),p)}function k(a){function b(b,e){for(;!b.eol();)if(b.eatWhile(/[^'"\\]/),b.eat("\\")){if(b.next(),c&&b.eol())return d}else{if(b.match(a))return e.tokenize=i,d;b.eat(/['"]/)}if(c){if(h.singleLineStringErrors)return p;e.tokenize=i}return d}for(;"rubf".indexOf(a.charAt(0).toLowerCase())>=0;)a=a.substr(1);var c=1==a.length,d="string";return b.isString=!0,b}function l(a){for(;"py"!=c(a).type;)a.scopes.pop();a.scopes.push({offset:c(a).offset+g.indentUnit,type:"py",align:null})}function m(a,b,c){var d=a.match(/^([\s\[\{\(]|#.*)*$/,!1)?null:a.column()+1;b.scopes.push({offset:b.indent+u,type:c,align:d})}function n(a,b){for(var d=a.indentation();b.scopes.length>1&&c(b).offset>d;){if("py"!=c(b).type)return!0;b.scopes.pop()}return c(b).offset!=d}function o(a,b){a.sol()&&(b.beginningOfLine=!0);var d=b.tokenize(a,b),e=a.current();if(b.beginningOfLine&&"@"==e)return a.match(z,!1)?"meta":x?"operator":p;/\S/.test(e)&&(b.beginningOfLine=!1),"variable"!=d&&"builtin"!=d||"meta"!=b.lastToken||(d="meta"),"pass"!=e&&"return"!=e||(b.dedent+=1),"lambda"==e&&(b.lambda=!0),":"!=e||b.lambda||"py"!=c(b).type||l(b);var f=1==e.length?"[({".indexOf(e):-1;if(f!=-1&&m(a,b,"])}".slice(f,f+1)),f="])}".indexOf(e),f!=-1){if(c(b).type!=e)return p;b.indent=b.scopes.pop().offset-u}return b.dedent>0&&a.eol()&&"py"==c(b).type&&(b.scopes.length>1&&b.scopes.pop(),b.dedent-=1),d}var p="error",q=h.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.]/,r=h.doubleOperators||/^([!<>]==|<>|<<|>>|\/\/|\*\*)/,s=h.doubleDelimiters||/^(\+=|\-=|\*=|%=|\/=|&=|\|=|\^=)/,t=h.tripleDelimiters||/^(\/\/=|>>=|<<=|\*\*=)/,u=h.hangingIndent||g.indentUnit,v=e,w=f;void 0!=h.extra_keywords&&(v=v.concat(h.extra_keywords)),void 0!=h.extra_builtins&&(w=w.concat(h.extra_builtins));var x=!(h.version&&Number(h.version)<3);if(x){var y=h.singleOperators||/^[\+\-\*\/%&|\^~<>!@]/,z=h.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;v=v.concat(["nonlocal","False","True","None","async","await"]),w=w.concat(["ascii","bytes","exec","print"]);var A=new RegExp("^(([rbuf]|(br))?('{3}|\"{3}|['\"]))","i")}else{var y=h.singleOperators||/^[\+\-\*\/%&|\^~<>!]/,z=h.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/;v=v.concat(["exec","print"]),w=w.concat(["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"]);var A=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var B=b(v),C=b(w),D={startState:function(a){return{tokenize:i,scopes:[{offset:a||0,type:"py",align:null}],indent:a||0,lastToken:null,lambda:!1,dedent:0}},token:function(a,b){var c=b.errorToken;c&&(b.errorToken=!1);var d=o(a,b);return d&&"comment"!=d&&(b.lastToken="keyword"==d||"punctuation"==d?a.current():d),"punctuation"==d&&(d=null),a.eol()&&b.lambda&&(b.lambda=!1),c?d+" "+p:d},indent:function(b,d){if(b.tokenize!=i)return b.tokenize.isString?a.Pass:0;var e=c(b),f=e.type==d.charAt(0);return null!=e.align?e.align-(f?1:0):e.offset-(f?u:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return D})),a.defineMIME("text/x-python","python");var g=function(a){return a.split(" ")};a.defineMIME("text/x-cython",{name:"python",extra_keywords:g("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})})); \ No newline at end of file +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a){return new RegExp("^(("+a.join(")|(")+"))\\b")}function c(a){return a.scopes[a.scopes.length-1]}var d=b(["and","or","not","is"]),e=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],f=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];a.registerHelper("hintWords","python",e.concat(f)),a.defineMode("python",(function(g,h){function i(a,b){if(a.sol()&&(b.indent=a.indentation()),a.sol()&&"py"==c(b).type){var d=c(b).offset;if(a.eatSpace()){var e=a.indentation();return e>d?l(b):e0&&n(a,b)&&(f+=" "+p),f}return j(a,b)}function j(a,b){if(a.eatSpace())return null;var c=a.peek();if("#"==c)return a.skipToEnd(),"comment";if(a.match(/^[0-9\.]/,!1)){var e=!1;if(a.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)&&(e=!0),a.match(/^\d+\.\d*/)&&(e=!0),a.match(/^\.\d+/)&&(e=!0),e)return a.eat(/J/i),"number";var f=!1;if(a.match(/^0x[0-9a-f]+/i)&&(f=!0),a.match(/^0b[01]+/i)&&(f=!0),a.match(/^0o[0-7]+/i)&&(f=!0),a.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(a.eat(/J/i),f=!0),a.match(/^0(?![\dx])/i)&&(f=!0),f)return a.eat(/L/i),"number"}return a.match(A)?(b.tokenize=k(a.current()),b.tokenize(a,b)):a.match(t)||a.match(s)?"punctuation":a.match(r)||a.match(y)?"operator":a.match(q)?"punctuation":"."==b.lastToken&&a.match(z)?"property":a.match(B)||a.match(d)?"keyword":a.match(C)?"builtin":a.match(/^(self|cls)\b/)?"variable-2":a.match(z)?"def"==b.lastToken||"class"==b.lastToken?"def":"variable":(a.next(),p)}function k(a){function b(b,e){for(;!b.eol();)if(b.eatWhile(/[^'"\\]/),b.eat("\\")){if(b.next(),c&&b.eol())return d}else{if(b.match(a))return e.tokenize=i,d;b.eat(/['"]/)}if(c){if(h.singleLineStringErrors)return p;e.tokenize=i}return d}for(;"rubf".indexOf(a.charAt(0).toLowerCase())>=0;)a=a.substr(1);var c=1==a.length,d="string";return b.isString=!0,b}function l(a){for(;"py"!=c(a).type;)a.scopes.pop();a.scopes.push({offset:c(a).offset+g.indentUnit,type:"py",align:null})}function m(a,b,c){var d=a.match(/^([\s\[\{\(]|#.*)*$/,!1)?null:a.column()+1;b.scopes.push({offset:b.indent+u,type:c,align:d})}function n(a,b){for(var d=a.indentation();b.scopes.length>1&&c(b).offset>d;){if("py"!=c(b).type)return!0;b.scopes.pop()}return c(b).offset!=d}function o(a,b){a.sol()&&(b.beginningOfLine=!0);var d=b.tokenize(a,b),e=a.current();if(b.beginningOfLine&&"@"==e)return a.match(z,!1)?"meta":x?"operator":p;/\S/.test(e)&&(b.beginningOfLine=!1),"variable"!=d&&"builtin"!=d||"meta"!=b.lastToken||(d="meta"),"pass"!=e&&"return"!=e||(b.dedent+=1),"lambda"==e&&(b.lambda=!0),":"!=e||b.lambda||"py"!=c(b).type||l(b);var f=1==e.length?"[({".indexOf(e):-1;if(f!=-1&&m(a,b,"])}".slice(f,f+1)),f="])}".indexOf(e),f!=-1){if(c(b).type!=e)return p;b.indent=b.scopes.pop().offset-u}return b.dedent>0&&a.eol()&&"py"==c(b).type&&(b.scopes.length>1&&b.scopes.pop(),b.dedent-=1),d}var p="error",q=h.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.]/,r=h.doubleOperators||/^([!<>]==|<>|<<|>>|\/\/|\*\*)/,s=h.doubleDelimiters||/^(\+=|\-=|\*=|%=|\/=|&=|\|=|\^=)/,t=h.tripleDelimiters||/^(\/\/=|>>=|<<=|\*\*=)/,u=h.hangingIndent||g.indentUnit,v=e,w=f;void 0!=h.extra_keywords&&(v=v.concat(h.extra_keywords)),void 0!=h.extra_builtins&&(w=w.concat(h.extra_builtins));var x=!(h.version&&Number(h.version)<3);if(x){var y=h.singleOperators||/^[\+\-\*\/%&|\^~<>!@]/,z=h.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;v=v.concat(["nonlocal","False","True","None","async","await"]),w=w.concat(["ascii","bytes","exec","print"]);var A=new RegExp("^(([rbuf]|(br))?('{3}|\"{3}|['\"]))","i")}else{var y=h.singleOperators||/^[\+\-\*\/%&|\^~<>!]/,z=h.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/;v=v.concat(["exec","print"]),w=w.concat(["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"]);var A=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var B=b(v),C=b(w),D={startState:function(a){return{tokenize:i,scopes:[{offset:a||0,type:"py",align:null}],indent:a||0,lastToken:null,lambda:!1,dedent:0}},token:function(a,b){var c=b.errorToken;c&&(b.errorToken=!1);var d=o(a,b);return d&&"comment"!=d&&(b.lastToken="keyword"==d||"punctuation"==d?a.current():d),"punctuation"==d&&(d=null),a.eol()&&b.lambda&&(b.lambda=!1),c?d+" "+p:d},indent:function(b,d){if(b.tokenize!=i)return b.tokenize.isString?a.Pass:0;var e=c(b),f=e.type==d.charAt(0);return null!=e.align?e.align-(f?1:0):e.offset-(f?u:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return D})),a.defineMIME("text/x-python","python");var g=function(a){return a.split(" ")};a.defineMIME("text/x-cython",{name:"python",extra_keywords:g("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})})); \ No newline at end of file diff --git a/media/editors/codemirror/mode/r/r.js b/media/editors/codemirror/mode/r/r.js index d41d1c54c1335..7e15beac629f7 100644 --- a/media/editors/codemirror/mode/r/r.js +++ b/media/editors/codemirror/mode/r/r.js @@ -44,6 +44,9 @@ CodeMirror.defineMode("r", function(config) { } else if (ch == "'" || ch == '"') { state.tokenize = tokenString(ch); return "string"; + } else if (ch == "`") { + stream.match(/[^`]+`/); + return "variable-3"; } else if (ch == "." && stream.match(/.[.\d]+/)) { return "keyword"; } else if (/[\w\.]/.test(ch) && ch != "_") { @@ -62,13 +65,17 @@ CodeMirror.defineMode("r", function(config) { return "variable"; } else if (ch == "%") { if (stream.skipTo("%")) stream.next(); - return "variable-2"; - } else if (ch == "<" && stream.eat("-")) { - return "arrow"; + return "operator variable-2"; + } else if ( + (ch == "<" && stream.eat("-")) || + (ch == "<" && stream.match("<-")) || + (ch == "-" && stream.match(/>>?/)) + ) { + return "operator arrow"; } else if (ch == "=" && state.ctx.argList) { return "arg-is"; } else if (opChars.test(ch)) { - if (ch == "$") return "dollar"; + if (ch == "$") return "operator dollar"; stream.eatWhile(opChars); return "operator"; } else if (/[\(\){}\[\];]/.test(ch)) { diff --git a/media/editors/codemirror/mode/r/r.min.js b/media/editors/codemirror/mode/r/r.min.js index 57df35d0a6fe0..26a5df58165ea 100644 --- a/media/editors/codemirror/mode/r/r.min.js +++ b/media/editors/codemirror/mode/r/r.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";a.registerHelper("wordChars","r",/[\w.]/),a.defineMode("r",(function(a){function b(a){for(var b=a.split(" "),c={},d=0;d=!&|~$:]/;return{startState:function(){return{tokenize:c,ctx:{type:"top",indent:-a.indentUnit,align:!1},indent:0,afterIdent:!1}},token:function(a,b){if(a.sol()&&(null==b.ctx.align&&(b.ctx.align=!1),b.indent=a.indentation()),a.eatSpace())return null;var c=b.tokenize(a,b);"comment"!=c&&null==b.ctx.align&&(b.ctx.align=!0);var d=b.ctx.type;return";"!=g&&"{"!=g&&"}"!=g||"block"!=d||f(b),"{"==g?e(b,"}",a):"("==g?(e(b,")",a),b.afterIdent&&(b.ctx.argList=!0)):"["==g?e(b,"]",a):"block"==g?e(b,"block",a):g==d&&f(b),b.afterIdent="variable"==c||"keyword"==c,c},indent:function(b,d){if(b.tokenize!=c)return 0;var e=d&&d.charAt(0),f=b.ctx,g=e==f.type;return"block"==f.type?f.indent+("{"==e?0:a.indentUnit):f.align?f.column+(g?0:1):f.indent+(g?0:a.indentUnit)},lineComment:"#"}})),a.defineMIME("text/x-rsrc","r")})); \ No newline at end of file +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";a.registerHelper("wordChars","r",/[\w.]/),a.defineMode("r",(function(a){function b(a){for(var b=a.split(" "),c={},d=0;d>?/)?"operator arrow":"="==c&&b.ctx.argList?"arg-is":l.test(c)?"$"==c?"operator dollar":(a.eatWhile(l),"operator"):/[\(\){}\[\];]/.test(c)?(g=c,";"==c?"semi":null):null}function d(a){return function(b,d){if(b.eat("\\")){var e=b.next();return"x"==e?b.match(/^[a-f0-9]{2}/i):("u"==e||"U"==e)&&b.eat("{")&&b.skipTo("}")?b.next():"u"==e?b.match(/^[a-f0-9]{4}/i):"U"==e?b.match(/^[a-f0-9]{8}/i):/[0-7]/.test(e)&&b.match(/^[0-7]{1,2}/),"string-2"}for(var f;null!=(f=b.next());){if(f==a){d.tokenize=c;break}if("\\"==f){b.backUp(1);break}}return"string"}}function e(a,b,c){a.ctx={type:b,indent:a.indent,align:null,column:c.column(),prev:a.ctx}}function f(a){a.indent=a.ctx.indent,a.ctx=a.ctx.prev}var g,h=b("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_"),i=b("list quote bquote eval return call parse deparse"),j=b("if else repeat while function for in next break"),k=b("if else repeat while function for"),l=/[+\-*\/^<>=!&|~$:]/;return{startState:function(){return{tokenize:c,ctx:{type:"top",indent:-a.indentUnit,align:!1},indent:0,afterIdent:!1}},token:function(a,b){if(a.sol()&&(null==b.ctx.align&&(b.ctx.align=!1),b.indent=a.indentation()),a.eatSpace())return null;var c=b.tokenize(a,b);"comment"!=c&&null==b.ctx.align&&(b.ctx.align=!0);var d=b.ctx.type;return";"!=g&&"{"!=g&&"}"!=g||"block"!=d||f(b),"{"==g?e(b,"}",a):"("==g?(e(b,")",a),b.afterIdent&&(b.ctx.argList=!0)):"["==g?e(b,"]",a):"block"==g?e(b,"block",a):g==d&&f(b),b.afterIdent="variable"==c||"keyword"==c,c},indent:function(b,d){if(b.tokenize!=c)return 0;var e=d&&d.charAt(0),f=b.ctx,g=e==f.type;return"block"==f.type?f.indent+("{"==e?0:a.indentUnit):f.align?f.column+(g?0:1):f.indent+(g?0:a.indentUnit)},lineComment:"#"}})),a.defineMIME("text/x-rsrc","r")})); \ No newline at end of file diff --git a/media/editors/codemirror/mode/rpm/changes/index.html b/media/editors/codemirror/mode/rpm/changes/index.html new file mode 100644 index 0000000000000..6e5031bd1f55f --- /dev/null +++ b/media/editors/codemirror/mode/rpm/changes/index.html @@ -0,0 +1,66 @@ + + +CodeMirror: RPM changes mode + + + + + + + + + + + +
    +

    RPM changes mode

    + +
    + + +

    MIME types defined: text/x-rpm-changes.

    +
    diff --git a/media/editors/codemirror/mode/shell/shell.js b/media/editors/codemirror/mode/shell/shell.js index a684e8c233ad2..570b4e2419bdb 100644 --- a/media/editors/codemirror/mode/shell/shell.js +++ b/media/editors/codemirror/mode/shell/shell.js @@ -129,6 +129,7 @@ CodeMirror.defineMode('shell', function() { token: function(stream, state) { return tokenize(stream, state); }, + closeBrackets: "()[]{}''\"\"``", lineComment: '#', fold: "brace" }; diff --git a/media/editors/codemirror/mode/shell/shell.min.js b/media/editors/codemirror/mode/shell/shell.min.js index e88fb2142fda3..0632b2f3fa7d7 100644 --- a/media/editors/codemirror/mode/shell/shell.min.js +++ b/media/editors/codemirror/mode/shell/shell.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";a.defineMode("shell",(function(){function a(a,b){for(var c=b.split(" "),d=0;d1&&a.eat("$");var e=a.next(),f=/\w/;return"{"===e&&(f=/[^}]/),"("===e?(b.tokens[0]=c(")"),d(a,b)):(/\d/.test(e)||(a.eatWhile(f),a.eat("}")),b.tokens.shift(),"def")};return{startState:function(){return{tokens:[]}},token:function(a,b){return d(a,b)},lineComment:"#",fold:"brace"}})),a.defineMIME("text/x-sh","shell")})); \ No newline at end of file +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";a.defineMode("shell",(function(){function a(a,b){for(var c=b.split(" "),d=0;d1&&a.eat("$");var e=a.next(),f=/\w/;return"{"===e&&(f=/[^}]/),"("===e?(b.tokens[0]=c(")"),d(a,b)):(/\d/.test(e)||(a.eatWhile(f),a.eat("}")),b.tokens.shift(),"def")};return{startState:function(){return{tokens:[]}},token:function(a,b){return d(a,b)},closeBrackets:"()[]{}''\"\"``",lineComment:"#",fold:"brace"}})),a.defineMIME("text/x-sh","shell")})); \ No newline at end of file diff --git a/media/editors/codemirror/mode/sql/sql.js b/media/editors/codemirror/mode/sql/sql.js index 01ebd80ae1a28..e3cbae54cffa5 100644 --- a/media/editors/codemirror/mode/sql/sql.js +++ b/media/editors/codemirror/mode/sql/sql.js @@ -280,7 +280,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { CodeMirror.defineMIME("text/x-mssql", { name: "sql", client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), - keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"), + keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare exec"), builtin: set("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "), atoms: set("false true null unknown"), operatorChars: /^[*+\-%<>!=]/, diff --git a/media/editors/codemirror/mode/sql/sql.min.js b/media/editors/codemirror/mode/sql/sql.min.js index 2803cba049d13..702058eeb7982 100644 --- a/media/editors/codemirror/mode/sql/sql.min.js +++ b/media/editors/codemirror/mode/sql/sql.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";a.defineMode("sql",(function(b,c){function d(a,b){var c=a.next();if(o[c]){var d=o[c](a,b);if(d!==!1)return d}if(1==n.hexNumber&&("0"==c&&a.match(/^[xX][0-9a-fA-F]+/)||("x"==c||"X"==c)&&a.match(/^'[0-9a-fA-F]+'/)))return"number";if(1==n.binaryNumber&&(("b"==c||"B"==c)&&a.match(/^'[01]+'/)||"0"==c&&a.match(/^b[01]+/)))return"number";if(c.charCodeAt(0)>47&&c.charCodeAt(0)<58)return a.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),1==n.decimallessFloat&&a.eat("."),"number";if("?"==c&&(a.eatSpace()||a.eol()||a.eat(";")))return"variable-3";if("'"==c||'"'==c&&n.doubleQuote)return b.tokenize=e(c),b.tokenize(a,b);if((1==n.nCharCast&&("n"==c||"N"==c)||1==n.charsetCast&&"_"==c&&a.match(/[a-z][a-z0-9]*/i))&&("'"==a.peek()||'"'==a.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(c))return null;if(n.commentSlashSlash&&"/"==c&&a.eat("/"))return a.skipToEnd(),"comment";if(n.commentHash&&"#"==c||"-"==c&&a.eat("-")&&(!n.commentSpaceRequired||a.eat(" ")))return a.skipToEnd(),"comment";if("/"==c&&a.eat("*"))return b.tokenize=f,b.tokenize(a,b);if("."!=c){if(m.test(c))return a.eatWhile(m),null;if("{"==c&&(a.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||a.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";a.eatWhile(/^[_\w\d]/);var g=a.current().toLowerCase();return p.hasOwnProperty(g)&&(a.match(/^( )+'[^']*'/)||a.match(/^( )+"[^"]*"/))?"number":j.hasOwnProperty(g)?"atom":k.hasOwnProperty(g)?"builtin":l.hasOwnProperty(g)?"keyword":i.hasOwnProperty(g)?"string-2":null}return 1==n.zerolessFloat&&a.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":1==n.ODBCdotTable&&a.match(/^[a-zA-Z_]+/)?"variable-2":void 0}function e(a){return function(b,c){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){c.tokenize=d;break}f=!f&&"\\"==e}return"string"}}function f(a,b){for(;;){if(!a.skipTo("*")){a.skipToEnd();break}if(a.next(),a.eat("/")){b.tokenize=d;break}}return"comment"}function g(a,b,c){b.context={prev:b.context,indent:a.indentation(),col:a.column(),type:c}}function h(a){a.indent=a.context.indent,a.context=a.context.prev}var i=c.client||{},j=c.atoms||{false:!0,true:!0,null:!0},k=c.builtin||{},l=c.keywords||{},m=c.operatorChars||/^[*+\-%<>!=&|~^]/,n=c.support||{},o=c.hooks||{},p=c.dateSQL||{date:!0,time:!0,timestamp:!0};return{startState:function(){return{tokenize:d,context:null}},token:function(a,b){if(a.sol()&&b.context&&null==b.context.align&&(b.context.align=!1),a.eatSpace())return null;var c=b.tokenize(a,b);if("comment"==c)return c;b.context&&null==b.context.align&&(b.context.align=!0);var d=a.current();return"("==d?g(a,b,")"):"["==d?g(a,b,"]"):b.context&&b.context.type==d&&h(b),c},indent:function(c,d){var e=c.context;if(!e)return a.Pass;var f=d.charAt(0)==e.type;return e.align?e.col+(f?0:1):e.indent+(f?0:b.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:n.commentSlashSlash?"//":n.commentHash?"#":null}})),(function(){function b(a){for(var b;null!=(b=a.next());)if("`"==b&&!a.eat("`"))return"variable-2";return a.backUp(a.current().length-1),a.eatWhile(/\w/)?"variable-2":null}function c(a){return a.eat("@")&&(a.match(/^session\./),a.match(/^local\./),a.match(/^global\./)),a.eat("'")?(a.match(/^.*'/),"variable-2"):a.eat('"')?(a.match(/^.*"/),"variable-2"):a.eat("`")?(a.match(/^.*`/),"variable-2"):a.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function d(a){return a.eat("N")?"atom":a.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function e(a){for(var b={},c=a.split(" "),d=0;d!=]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable doubleQuote binaryNumber hexNumber")}),a.defineMIME("text/x-mssql",{name:"sql",client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(f+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"),builtin:e("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:e("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":c}}),a.defineMIME("text/x-mysql",{name:"sql",client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(f+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":c,"`":b,"\\":d}}),a.defineMIME("text/x-mariadb",{name:"sql",client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(f+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":c,"`":b,"\\":d}}),a.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:e("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:e("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:e("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:e("commentSlashSlash decimallessFloat"),hooks:{}}),a.defineMIME("text/x-plsql",{name:"sql",client:e("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:e("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:e("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:e("date time timestamp"),support:e("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),a.defineMIME("text/x-hive",{name:"sql",keywords:e("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),builtin:e("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:e("date timestamp"),support:e("ODBCdotTable doubleQuote binaryNumber hexNumber")}),a.defineMIME("text/x-pgsql",{name:"sql",client:e("source"),keywords:e(f+"a abort abs absent absolute access according action ada add admin after aggregate all allocate also always analyse analyze any are array array_agg array_max_cardinality asensitive assertion assignment asymmetric at atomic attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli binary bit_length blob blocked bom both breadth c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain characteristics characters character_length character_set_catalog character_set_name character_set_schema char_length check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column columns column_name command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constraint constraints constraint_catalog constraint_name constraint_schema constructor contains content continue control conversion convert copy corr corresponding cost covar_pop covar_samp cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datetime_interval_code datetime_interval_precision day db deallocate dec declare default defaults deferrable deferred defined definer degree delimiter delimiters dense_rank depth deref derived describe descriptor deterministic diagnostics dictionary disable discard disconnect dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain dynamic dynamic_function dynamic_function_code each element else empty enable encoding encrypted end end-exec end_frame end_partition enforced enum equals escape event every except exception exclude excluding exclusive exec execute exists exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreign fortran forward found frame_row free freeze fs full function functions fusion g general generated get global go goto grant granted greatest grouping groups handler header hex hierarchy hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import including increment indent index indexes indicator inherit inherits initially inline inner inout input insensitive instance instantiable instead integrity intersect intersection invoker isnull isolation k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like_regex link listen ln load local localtime localtimestamp location locator lock locked logged lower m map mapping match matched materialized max maxvalue max_cardinality member merge message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized nothing notify notnull nowait nth_value ntile null nullable nullif nulls number object occurrences_regex octets octet_length of off offset oids old only open operator option options ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password percent percentile_cont percentile_disc percent_rank period permission placing plans pli policy portion position position_regex power precedes preceding prepare prepared preserve primary prior privileges procedural procedure program public quote range rank read reads reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns revoke right role rollback rollup routine routine_catalog routine_name routine_schema row rows row_count row_number rule savepoint scale schema schema_name scope scope_catalog scope_name scope_schema scroll search second section security selective self sensitive sequence sequences serializable server server_name session session_user setof sets share show similar simple size skip snapshot some source space specific specifictype specific_name sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset substring substring_regex succeeds sum symmetric sysid system system_time system_user t tables tablesample tablespace table_name temp template temporary then ties timezone_hour timezone_minute to token top_level_count trailing transaction transactions_committed transactions_rolled_back transaction_active transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted unique unknown unlink unlisten unlogged unnamed unnest until untyped upper uri usage user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of varbinary variadic var_pop var_samp verbose version versioning view views volatile when whenever whitespace width_bucket window within work wrapper write xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes loop repeat"),builtin:e("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")}),a.defineMIME("text/x-gql",{name:"sql",keywords:e("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),atoms:e("false true"),builtin:e("blob datetime first key __key__ string integer double boolean null"),operatorChars:/^[*+\-%<>!=]/})})()})); \ No newline at end of file +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";a.defineMode("sql",(function(b,c){function d(a,b){var c=a.next();if(o[c]){var d=o[c](a,b);if(d!==!1)return d}if(1==n.hexNumber&&("0"==c&&a.match(/^[xX][0-9a-fA-F]+/)||("x"==c||"X"==c)&&a.match(/^'[0-9a-fA-F]+'/)))return"number";if(1==n.binaryNumber&&(("b"==c||"B"==c)&&a.match(/^'[01]+'/)||"0"==c&&a.match(/^b[01]+/)))return"number";if(c.charCodeAt(0)>47&&c.charCodeAt(0)<58)return a.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),1==n.decimallessFloat&&a.eat("."),"number";if("?"==c&&(a.eatSpace()||a.eol()||a.eat(";")))return"variable-3";if("'"==c||'"'==c&&n.doubleQuote)return b.tokenize=e(c),b.tokenize(a,b);if((1==n.nCharCast&&("n"==c||"N"==c)||1==n.charsetCast&&"_"==c&&a.match(/[a-z][a-z0-9]*/i))&&("'"==a.peek()||'"'==a.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(c))return null;if(n.commentSlashSlash&&"/"==c&&a.eat("/"))return a.skipToEnd(),"comment";if(n.commentHash&&"#"==c||"-"==c&&a.eat("-")&&(!n.commentSpaceRequired||a.eat(" ")))return a.skipToEnd(),"comment";if("/"==c&&a.eat("*"))return b.tokenize=f,b.tokenize(a,b);if("."!=c){if(m.test(c))return a.eatWhile(m),null;if("{"==c&&(a.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||a.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";a.eatWhile(/^[_\w\d]/);var g=a.current().toLowerCase();return p.hasOwnProperty(g)&&(a.match(/^( )+'[^']*'/)||a.match(/^( )+"[^"]*"/))?"number":j.hasOwnProperty(g)?"atom":k.hasOwnProperty(g)?"builtin":l.hasOwnProperty(g)?"keyword":i.hasOwnProperty(g)?"string-2":null}return 1==n.zerolessFloat&&a.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":1==n.ODBCdotTable&&a.match(/^[a-zA-Z_]+/)?"variable-2":void 0}function e(a){return function(b,c){for(var e,f=!1;null!=(e=b.next());){if(e==a&&!f){c.tokenize=d;break}f=!f&&"\\"==e}return"string"}}function f(a,b){for(;;){if(!a.skipTo("*")){a.skipToEnd();break}if(a.next(),a.eat("/")){b.tokenize=d;break}}return"comment"}function g(a,b,c){b.context={prev:b.context,indent:a.indentation(),col:a.column(),type:c}}function h(a){a.indent=a.context.indent,a.context=a.context.prev}var i=c.client||{},j=c.atoms||{false:!0,true:!0,null:!0},k=c.builtin||{},l=c.keywords||{},m=c.operatorChars||/^[*+\-%<>!=&|~^]/,n=c.support||{},o=c.hooks||{},p=c.dateSQL||{date:!0,time:!0,timestamp:!0};return{startState:function(){return{tokenize:d,context:null}},token:function(a,b){if(a.sol()&&b.context&&null==b.context.align&&(b.context.align=!1),a.eatSpace())return null;var c=b.tokenize(a,b);if("comment"==c)return c;b.context&&null==b.context.align&&(b.context.align=!0);var d=a.current();return"("==d?g(a,b,")"):"["==d?g(a,b,"]"):b.context&&b.context.type==d&&h(b),c},indent:function(c,d){var e=c.context;if(!e)return a.Pass;var f=d.charAt(0)==e.type;return e.align?e.col+(f?0:1):e.indent+(f?0:b.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:n.commentSlashSlash?"//":n.commentHash?"#":null}})),(function(){function b(a){for(var b;null!=(b=a.next());)if("`"==b&&!a.eat("`"))return"variable-2";return a.backUp(a.current().length-1),a.eatWhile(/\w/)?"variable-2":null}function c(a){return a.eat("@")&&(a.match(/^session\./),a.match(/^local\./),a.match(/^global\./)),a.eat("'")?(a.match(/^.*'/),"variable-2"):a.eat('"')?(a.match(/^.*"/),"variable-2"):a.eat("`")?(a.match(/^.*`/),"variable-2"):a.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function d(a){return a.eat("N")?"atom":a.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function e(a){for(var b={},c=a.split(" "),d=0;d!=]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable doubleQuote binaryNumber hexNumber")}),a.defineMIME("text/x-mssql",{name:"sql",client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(f+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare exec"),builtin:e("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:e("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":c}}),a.defineMIME("text/x-mysql",{name:"sql",client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(f+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":c,"`":b,"\\":d}}),a.defineMIME("text/x-mariadb",{name:"sql",client:e("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:e(f+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:e("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":c,"`":b,"\\":d}}),a.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:e("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:e("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:e("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:e("commentSlashSlash decimallessFloat"),hooks:{}}),a.defineMIME("text/x-plsql",{name:"sql",client:e("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:e("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:e("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:e("date time timestamp"),support:e("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),a.defineMIME("text/x-hive",{name:"sql",keywords:e("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),builtin:e("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:e("date timestamp"),support:e("ODBCdotTable doubleQuote binaryNumber hexNumber")}),a.defineMIME("text/x-pgsql",{name:"sql",client:e("source"),keywords:e(f+"a abort abs absent absolute access according action ada add admin after aggregate all allocate also always analyse analyze any are array array_agg array_max_cardinality asensitive assertion assignment asymmetric at atomic attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli binary bit_length blob blocked bom both breadth c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain characteristics characters character_length character_set_catalog character_set_name character_set_schema char_length check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column columns column_name command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constraint constraints constraint_catalog constraint_name constraint_schema constructor contains content continue control conversion convert copy corr corresponding cost covar_pop covar_samp cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datetime_interval_code datetime_interval_precision day db deallocate dec declare default defaults deferrable deferred defined definer degree delimiter delimiters dense_rank depth deref derived describe descriptor deterministic diagnostics dictionary disable discard disconnect dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain dynamic dynamic_function dynamic_function_code each element else empty enable encoding encrypted end end-exec end_frame end_partition enforced enum equals escape event every except exception exclude excluding exclusive exec execute exists exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreign fortran forward found frame_row free freeze fs full function functions fusion g general generated get global go goto grant granted greatest grouping groups handler header hex hierarchy hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import including increment indent index indexes indicator inherit inherits initially inline inner inout input insensitive instance instantiable instead integrity intersect intersection invoker isnull isolation k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like_regex link listen ln load local localtime localtimestamp location locator lock locked logged lower m map mapping match matched materialized max maxvalue max_cardinality member merge message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized nothing notify notnull nowait nth_value ntile null nullable nullif nulls number object occurrences_regex octets octet_length of off offset oids old only open operator option options ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password percent percentile_cont percentile_disc percent_rank period permission placing plans pli policy portion position position_regex power precedes preceding prepare prepared preserve primary prior privileges procedural procedure program public quote range rank read reads reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns revoke right role rollback rollup routine routine_catalog routine_name routine_schema row rows row_count row_number rule savepoint scale schema schema_name scope scope_catalog scope_name scope_schema scroll search second section security selective self sensitive sequence sequences serializable server server_name session session_user setof sets share show similar simple size skip snapshot some source space specific specifictype specific_name sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset substring substring_regex succeeds sum symmetric sysid system system_time system_user t tables tablesample tablespace table_name temp template temporary then ties timezone_hour timezone_minute to token top_level_count trailing transaction transactions_committed transactions_rolled_back transaction_active transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted unique unknown unlink unlisten unlogged unnamed unnest until untyped upper uri usage user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of varbinary variadic var_pop var_samp verbose version versioning view views volatile when whenever whitespace width_bucket window within work wrapper write xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes loop repeat"),builtin:e("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:e("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:e("date time timestamp"),support:e("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")}),a.defineMIME("text/x-gql",{name:"sql",keywords:e("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),atoms:e("false true"),builtin:e("blob datetime first key __key__ string integer double boolean null"),operatorChars:/^[*+\-%<>!=]/})})()})); \ No newline at end of file diff --git a/media/editors/codemirror/mode/swift/swift.js b/media/editors/codemirror/mode/swift/swift.js index 3c28ced329b18..9dcd822e917da 100644 --- a/media/editors/codemirror/mode/swift/swift.js +++ b/media/editors/codemirror/mode/swift/swift.js @@ -19,24 +19,21 @@ return set } - var keywords = wordSet(["var","let","class","deinit","enum","extension","func","import","init","protocol", - "static","struct","subscript","typealias","as","dynamicType","is","new","super", - "self","Self","Type","__COLUMN__","__FILE__","__FUNCTION__","__LINE__","break","case", - "continue","default","do","else","fallthrough","if","in","for","return","switch", - "where","while","associativity","didSet","get","infix","inout","left","mutating", - "none","nonmutating","operator","override","postfix","precedence","prefix","right", - "set","unowned","weak","willSet"]) - var definingKeywords = wordSet(["var","let","class","enum","extension","func","import","protocol","struct", - "typealias","dynamicType","for"]) - var atoms = wordSet(["Infinity","NaN","undefined","null","true","false","on","off","yes","no","nil","null", - "this","super"]) - var types = wordSet(["String","bool","int","string","double","Double","Int","Float","float","public", - "private","extension"]) - var operators = "+-/*%=|&<>#" + var keywords = wordSet(["_","var","let","class","enum","extension","import","protocol","struct","func","typealias","associatedtype", + "open","public","internal","fileprivate","private","deinit","init","new","override","self","subscript","super", + "convenience","dynamic","final","indirect","lazy","required","static","unowned","unowned(safe)","unowned(unsafe)","weak","as","is", + "break","case","continue","default","else","fallthrough","for","guard","if","in","repeat","switch","where","while", + "defer","return","inout","mutating","nonmutating","catch","do","rethrows","throw","throws","try","didSet","get","set","willSet", + "assignment","associativity","infix","left","none","operator","postfix","precedence","precedencegroup","prefix","right", + "Any","AnyObject","Type","dynamicType","Self","Protocol","__COLUMN__","__FILE__","__FUNCTION__","__LINE__"]) + var definingKeywords = wordSet(["var","let","class","enum","extension","import","protocol","struct","func","typealias","associatedtype"]) + var atoms = wordSet(["true","false","nil","self","super","_"]) + var types = wordSet(["Array","Bool","Dictionary","Double","Float","Int","Never","Optional","String","Void"]) + var operators = "+-/*%=|&<>" var punc = ";,.(){}[]" var number = /^-?(?:(?:[\d_]+\.[_\d]*|\.[_\d]+|0o[0-7_\.]+|0b[01_\.]+)(?:e-?[\d_]+)?|0x[\d_a-f\.]+(?:p-?[\d_]+)?)/i var identifier = /^[_A-Za-z$][_A-Za-z$0-9]*/ - var property = /^[@\.][_A-Za-z$][_A-Za-z$0-9]*/ + var property = /^[@\#\.][_A-Za-z$][_A-Za-z$0-9]*/ var regexp = /^\/(?!\s)(?:\/\/)?(?:\\.|[^\/])+\// function tokenBase(stream, state, prev) { diff --git a/media/editors/codemirror/mode/swift/swift.min.js b/media/editors/codemirror/mode/swift/swift.min.js index 9bcd7644e796e..d1bd4d8bda095 100644 --- a/media/editors/codemirror/mode/swift/swift.min.js +++ b/media/editors/codemirror/mode/swift/swift.min.js @@ -1 +1 @@ -!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a){for(var b={},c=0;c-1)return a.next(),"operator";if(o.indexOf(d)>-1)return a.next(),a.match(".."),"punctuation";if('"'==d||"'"==d){a.next();var g=e(d);return b.tokenize.push(g),g(a,b)}if(a.match(p))return"number";if(a.match(r))return"property";if(a.match(q)){var h=a.current();return j.hasOwnProperty(h)?(k.hasOwnProperty(h)&&(b.prev="define"),"keyword"):m.hasOwnProperty(h)?"variable-2":l.hasOwnProperty(h)?"atom":"define"==c?"def":"variable"}return a.next(),null}function d(){var a=0;return function(b,d,e){var f=c(b,d,e);if("punctuation"==f)if("("==b.current())++a;else if(")"==b.current()){if(0==a)return b.backUp(1),d.tokenize.pop(),d.tokenize[d.tokenize.length-1](b,d);--a}return f}}function e(a){return function(b,c){for(var e,f=!1;e=b.next();)if(f){if("("==e)return c.tokenize.push(d()),"string";f=!1}else{if(e==a)break;f="\\"==e}return c.tokenize.pop(),"string"}}function f(a,b){return a.match(/^(?:[^*]|\*(?!\/))*/),a.match("*/")&&b.tokenize.pop(),"comment"}function g(a,b,c){this.prev=a,this.align=b,this.indented=c}function h(a,b){var c=b.match(/^\s*($|\/[\/\*])/,!1)?null:b.column()+1;a.context=new g(a.context,c,a.indented)}function i(a){a.context&&(a.indented=a.context.indented,a.context=a.context.prev)}var j=b(["var","let","class","deinit","enum","extension","func","import","init","protocol","static","struct","subscript","typealias","as","dynamicType","is","new","super","self","Self","Type","__COLUMN__","__FILE__","__FUNCTION__","__LINE__","break","case","continue","default","do","else","fallthrough","if","in","for","return","switch","where","while","associativity","didSet","get","infix","inout","left","mutating","none","nonmutating","operator","override","postfix","precedence","prefix","right","set","unowned","weak","willSet"]),k=b(["var","let","class","enum","extension","func","import","protocol","struct","typealias","dynamicType","for"]),l=b(["Infinity","NaN","undefined","null","true","false","on","off","yes","no","nil","null","this","super"]),m=b(["String","bool","int","string","double","Double","Int","Float","float","public","private","extension"]),n="+-/*%=|&<>#",o=";,.(){}[]",p=/^-?(?:(?:[\d_]+\.[_\d]*|\.[_\d]+|0o[0-7_\.]+|0b[01_\.]+)(?:e-?[\d_]+)?|0x[\d_a-f\.]+(?:p-?[\d_]+)?)/i,q=/^[_A-Za-z$][_A-Za-z$0-9]*/,r=/^[@\.][_A-Za-z$][_A-Za-z$0-9]*/,s=/^\/(?!\s)(?:\/\/)?(?:\\.|[^\/])+\//;a.defineMode("swift",(function(a){return{startState:function(){return{prev:null,context:null,indented:0,tokenize:[]}},token:function(a,b){var d=b.prev;b.prev=null;var e=b.tokenize[b.tokenize.length-1]||c,f=e(a,b,d);if(f&&"comment"!=f?b.prev||(b.prev=f):b.prev=d,"punctuation"==f){var g=/[\(\[\{]|([\]\)\}])/.exec(a.current());g&&(g[1]?i:h)(b,a)}return f},indent:function(b,c){var d=b.context;if(!d)return 0;var e=/^[\]\}\)]/.test(c);return null!=d.align?d.align-(e?1:0):d.indented+(e?0:a.indentUnit)},electricInput:/^\s*[\)\}\]]$/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/"}})),a.defineMIME("text/x-swift","swift")})); \ No newline at end of file +!(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){"use strict";function b(a){for(var b={},c=0;c-1)return a.next(),"operator";if(o.indexOf(d)>-1)return a.next(),a.match(".."),"punctuation";if('"'==d||"'"==d){a.next();var g=e(d);return b.tokenize.push(g),g(a,b)}if(a.match(p))return"number";if(a.match(r))return"property";if(a.match(q)){var h=a.current();return j.hasOwnProperty(h)?(k.hasOwnProperty(h)&&(b.prev="define"),"keyword"):m.hasOwnProperty(h)?"variable-2":l.hasOwnProperty(h)?"atom":"define"==c?"def":"variable"}return a.next(),null}function d(){var a=0;return function(b,d,e){var f=c(b,d,e);if("punctuation"==f)if("("==b.current())++a;else if(")"==b.current()){if(0==a)return b.backUp(1),d.tokenize.pop(),d.tokenize[d.tokenize.length-1](b,d);--a}return f}}function e(a){return function(b,c){for(var e,f=!1;e=b.next();)if(f){if("("==e)return c.tokenize.push(d()),"string";f=!1}else{if(e==a)break;f="\\"==e}return c.tokenize.pop(),"string"}}function f(a,b){return a.match(/^(?:[^*]|\*(?!\/))*/),a.match("*/")&&b.tokenize.pop(),"comment"}function g(a,b,c){this.prev=a,this.align=b,this.indented=c}function h(a,b){var c=b.match(/^\s*($|\/[\/\*])/,!1)?null:b.column()+1;a.context=new g(a.context,c,a.indented)}function i(a){a.context&&(a.indented=a.context.indented,a.context=a.context.prev)}var j=b(["_","var","let","class","enum","extension","import","protocol","struct","func","typealias","associatedtype","open","public","internal","fileprivate","private","deinit","init","new","override","self","subscript","super","convenience","dynamic","final","indirect","lazy","required","static","unowned","unowned(safe)","unowned(unsafe)","weak","as","is","break","case","continue","default","else","fallthrough","for","guard","if","in","repeat","switch","where","while","defer","return","inout","mutating","nonmutating","catch","do","rethrows","throw","throws","try","didSet","get","set","willSet","assignment","associativity","infix","left","none","operator","postfix","precedence","precedencegroup","prefix","right","Any","AnyObject","Type","dynamicType","Self","Protocol","__COLUMN__","__FILE__","__FUNCTION__","__LINE__"]),k=b(["var","let","class","enum","extension","import","protocol","struct","func","typealias","associatedtype"]),l=b(["true","false","nil","self","super","_"]),m=b(["Array","Bool","Dictionary","Double","Float","Int","Never","Optional","String","Void"]),n="+-/*%=|&<>",o=";,.(){}[]",p=/^-?(?:(?:[\d_]+\.[_\d]*|\.[_\d]+|0o[0-7_\.]+|0b[01_\.]+)(?:e-?[\d_]+)?|0x[\d_a-f\.]+(?:p-?[\d_]+)?)/i,q=/^[_A-Za-z$][_A-Za-z$0-9]*/,r=/^[@\#\.][_A-Za-z$][_A-Za-z$0-9]*/,s=/^\/(?!\s)(?:\/\/)?(?:\\.|[^\/])+\//;a.defineMode("swift",(function(a){return{startState:function(){return{prev:null,context:null,indented:0,tokenize:[]}},token:function(a,b){var d=b.prev;b.prev=null;var e=b.tokenize[b.tokenize.length-1]||c,f=e(a,b,d);if(f&&"comment"!=f?b.prev||(b.prev=f):b.prev=d,"punctuation"==f){var g=/[\(\[\{]|([\]\)\}])/.exec(a.current());g&&(g[1]?i:h)(b,a)}return f},indent:function(b,c){var d=b.context;if(!d)return 0;var e=/^[\]\}\)]/.test(c);return null!=d.align?d.align-(e?1:0):d.indented+(e?0:a.indentUnit)},electricInput:/^\s*[\)\}\]]$/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/"}})),a.defineMIME("text/x-swift","swift")})); \ No newline at end of file diff --git a/media/editors/codemirror/theme/dracula.css b/media/editors/codemirror/theme/dracula.css index 57f979ae69412..b2ef62913c65f 100644 --- a/media/editors/codemirror/theme/dracula.css +++ b/media/editors/codemirror/theme/dracula.css @@ -16,7 +16,7 @@ .cm-s-dracula .CodeMirror-gutters { color: #282a36; } .cm-s-dracula .CodeMirror-cursor { border-left: solid thin #f8f8f0; } .cm-s-dracula .CodeMirror-linenumber { color: #6D8A88; } -.cm-s-dracula.CodeMirror-focused div.CodeMirror-selected { background: rgba(255, 255, 255, 0.10); } +.cm-s-dracula .CodeMirror-selected { background: rgba(255, 255, 255, 0.10); } .cm-s-dracula .CodeMirror-line::selection, .cm-s-dracula .CodeMirror-line > span::selection, .cm-s-dracula .CodeMirror-line > span > span::selection { background: rgba(255, 255, 255, 0.10); } .cm-s-dracula .CodeMirror-line::-moz-selection, .cm-s-dracula .CodeMirror-line > span::-moz-selection, .cm-s-dracula .CodeMirror-line > span > span::-moz-selection { background: rgba(255, 255, 255, 0.10); } .cm-s-dracula span.cm-comment { color: #6272a4; } diff --git a/media/editors/codemirror/theme/duotone-dark.css b/media/editors/codemirror/theme/duotone-dark.css new file mode 100644 index 0000000000000..b09a585c97867 --- /dev/null +++ b/media/editors/codemirror/theme/duotone-dark.css @@ -0,0 +1,35 @@ +/* +Name: DuoTone-Dark +Author: by Bram de Haan, adapted from DuoTone themes by Simurai (http://simurai.com/projects/2016/01/01/duotone-themes) + +CodeMirror template by Jan T. Sott (https://github.com/idleberg), adapted by Bram de Haan (https://github.com/atelierbram/) +*/ + +.cm-s-duotone-dark.CodeMirror { background: #2a2734; color: #6c6783; } +.cm-s-duotone-dark div.CodeMirror-selected { background: #545167!important; } +.cm-s-duotone-dark .CodeMirror-gutters { background: #2a2734; border-right: 0px; } +.cm-s-duotone-dark .CodeMirror-linenumber { color: #545167; } + +/* begin cursor */ +.cm-s-duotone-dark .CodeMirror-cursor { border-left: 1px solid #ffad5c; /* border-left: 1px solid #ffad5c80; */ border-right: .5em solid #ffad5c; /* border-right: .5em solid #ffad5c80; */ opacity: .5; } +.cm-s-duotone-dark .CodeMirror-activeline-background { background: #363342; /* background: #36334280; */ opacity: .5;} +.cm-s-duotone-dark .cm-fat-cursor .CodeMirror-cursor { background: #ffad5c; /* background: #ffad5c80; */ opacity: .5;} +/* end cursor */ + +.cm-s-duotone-dark span.cm-atom, .cm-s-duotone-dark span.cm-number, .cm-s-duotone-dark span.cm-keyword, .cm-s-duotone-dark span.cm-variable, .cm-s-duotone-dark span.cm-attribute, .cm-s-duotone-dark span.cm-quote, .cm-s-duotone-dark span.cm-hr, .cm-s-duotone-dark span.cm-link { color: #ffcc99; } + +.cm-s-duotone-dark span.cm-property { color: #9a86fd; } +.cm-s-duotone-dark span.cm-punctuation, .cm-s-duotone-dark span.cm-unit, .cm-s-duotone-dark span.cm-negative { color: #e09142; } +.cm-s-duotone-dark span.cm-string { color: #ffb870; } +.cm-s-duotone-dark span.cm-operator { color: #ffad5c; } +.cm-s-duotone-dark span.cm-positive { color: #6a51e6; } + +.cm-s-duotone-dark span.cm-variable-2, .cm-s-duotone-dark span.cm-variable-3, .cm-s-duotone-dark span.cm-string-2, .cm-s-duotone-dark span.cm-url { color: #7a63ee; } +.cm-s-duotone-dark span.cm-def, .cm-s-duotone-dark span.cm-tag, .cm-s-duotone-dark span.cm-builtin, .cm-s-duotone-dark span.cm-qualifier, .cm-s-duotone-dark span.cm-header, .cm-s-duotone-dark span.cm-em { color: #eeebff; } +.cm-s-duotone-dark span.cm-bracket, .cm-s-duotone-dark span.cm-comment { color: #6c6783; } + +/* using #f00 red for errors, don't think any of the colorscheme variables will stand out enough, ... maybe by giving it a background-color ... */ +.cm-s-duotone-dark span.cm-error, .cm-s-duotone-dark span.cm-invalidchar { color: #f00; } + +.cm-s-duotone-dark span.cm-header { font-weight: normal; } +.cm-s-duotone-dark .CodeMirror-matchingbracket { text-decoration: underline; color: #eeebff !important; } diff --git a/media/editors/codemirror/theme/duotone-light.css b/media/editors/codemirror/theme/duotone-light.css new file mode 100644 index 0000000000000..80203d15d9a6f --- /dev/null +++ b/media/editors/codemirror/theme/duotone-light.css @@ -0,0 +1,36 @@ +/* +Name: DuoTone-Light +Author: by Bram de Haan, adapted from DuoTone themes by Simurai (http://simurai.com/projects/2016/01/01/duotone-themes) + +CodeMirror template by Jan T. Sott (https://github.com/idleberg), adapted by Bram de Haan (https://github.com/atelierbram/) +*/ + +.cm-s-duotone-light.CodeMirror { background: #faf8f5; color: #b29762; } +.cm-s-duotone-light div.CodeMirror-selected { background: #e3dcce !important; } +.cm-s-duotone-light .CodeMirror-gutters { background: #faf8f5; border-right: 0px; } +.cm-s-duotone-light .CodeMirror-linenumber { color: #cdc4b1; } + +/* begin cursor */ +.cm-s-duotone-light .CodeMirror-cursor { border-left: 1px solid #93abdc; /* border-left: 1px solid #93abdc80; */ border-right: .5em solid #93abdc; /* border-right: .5em solid #93abdc80; */ opacity: .5; } +.cm-s-duotone-light .CodeMirror-activeline-background { background: #e3dcce; /* background: #e3dcce80; */ opacity: .5; } +.cm-s-duotone-light .cm-fat-cursor .CodeMirror-cursor { background: #93abdc; /* #93abdc80; */ opacity: .5; } +/* end cursor */ + +.cm-s-duotone-light span.cm-atom, .cm-s-duotone-light span.cm-number, .cm-s-duotone-light span.cm-keyword, .cm-s-duotone-light span.cm-variable, .cm-s-duotone-light span.cm-attribute, .cm-s-duotone-light span.cm-quote, .cm-s-duotone-light-light span.cm-hr, .cm-s-duotone-light-light span.cm-link { color: #063289; } + +.cm-s-duotone-light span.cm-property { color: #b29762; } +.cm-s-duotone-light span.cm-punctuation, .cm-s-duotone-light span.cm-unit, .cm-s-duotone-light span.cm-negative { color: #063289; } +.cm-s-duotone-light span.cm-string, .cm-s-duotone-light span.cm-operator { color: #1659df; } +.cm-s-duotone-light span.cm-positive { color: #896724; } + +.cm-s-duotone-light span.cm-variable-2, .cm-s-duotone-light span.cm-variable-3, .cm-s-duotone-light span.cm-string-2, .cm-s-duotone-light span.cm-url { color: #896724; } +.cm-s-duotone-light span.cm-def, .cm-s-duotone-light span.cm-tag, .cm-s-duotone-light span.cm-builtin, .cm-s-duotone-light span.cm-qualifier, .cm-s-duotone-light span.cm-header, .cm-s-duotone-light span.cm-em { color: #2d2006; } +.cm-s-duotone-light span.cm-bracket, .cm-s-duotone-light span.cm-comment { color: #b6ad9a; } + +/* using #f00 red for errors, don't think any of the colorscheme variables will stand out enough, ... maybe by giving it a background-color ... */ +/* .cm-s-duotone-light span.cm-error { background: #896724; color: #728fcb; } */ +.cm-s-duotone-light span.cm-error, .cm-s-duotone-light span.cm-invalidchar { color: #f00; } + +.cm-s-duotone-light span.cm-header { font-weight: normal; } +.cm-s-duotone-light .CodeMirror-matchingbracket { text-decoration: underline; color: #faf8f5 !important; } + diff --git a/media/editors/codemirror/theme/panda-syntax.css b/media/editors/codemirror/theme/panda-syntax.css index 8c0c754082165..c93b2ea03a76e 100644 --- a/media/editors/codemirror/theme/panda-syntax.css +++ b/media/editors/codemirror/theme/panda-syntax.css @@ -75,11 +75,11 @@ padding-bottom: 2px; color: #e6e6e6; } -.CodeMirror-gutters { +.cm-s-panda-syntax .CodeMirror-gutters { background: #292a2b; border-right-color: rgba(255, 255, 255, 0.1); } -.CodeMirror-linenumber { +.cm-s-panda-syntax .CodeMirror-linenumber { color: #e6e6e6; opacity: 0.6; } diff --git a/media/jui/css/bootstrap-extended.css b/media/jui/css/bootstrap-extended.css index 75e2d2674e851..f5b42ed53d3c6 100644 --- a/media/jui/css/bootstrap-extended.css +++ b/media/jui/css/bootstrap-extended.css @@ -347,18 +347,6 @@ fieldset.radio.btn-group { margin: 2px 0px 10px 0px; padding-bottom: 5px; } -.input-prepend .chzn-container-single .chzn-single, -.input-append .chzn-container-single .chzn-single { - border-color: #ccc; - height: 26px; - -moz-box-shadow: none; - -webkit-box-shadow: none; - box-shadow: none; -} -.input-prepend .chzn-container-single .chzn-drop, -.input-append .chzn-container-single .chzn-drop { - border-color: #ccc; -} .input-prepend > .add-on, .input-append > .add-on { vertical-align: top; diff --git a/media/jui/less/bootstrap-extended.less b/media/jui/less/bootstrap-extended.less index b2b83e892f9a1..c1418315d13b5 100644 --- a/media/jui/less/bootstrap-extended.less +++ b/media/jui/less/bootstrap-extended.less @@ -375,12 +375,6 @@ fieldset.radio.btn-group { } /* Input Prepend Chosen Select Boxes */ /* Common styling for Chosen Select Boxes with Input Prepend/Append */ -.input-prepend .chzn-container-single .chzn-single, -.input-append .chzn-container-single .chzn-single { -} -.input-prepend .chzn-container-single .chzn-drop, -.input-append .chzn-container-single .chzn-drop { -} .input-prepend > .add-on, .input-append > .add-on { vertical-align: top; diff --git a/media/jui/less/tables.less b/media/jui/less/tables.less index 0e35271e11fe5..bdb32c60f4dc8 100644 --- a/media/jui/less/tables.less +++ b/media/jui/less/tables.less @@ -242,3 +242,14 @@ table th[class*="span"], background-color: darken(@infoBackground, 5%); } } + + +// TABLE WITHOUT HEADER +// ----------------- +// Table with table header hidden +.table-noheader { + border-collapse: collapse; + thead { + display: none; + } +} \ No newline at end of file diff --git a/media/plg_fields_gallery/css/fotorama.min.css b/media/plg_fields_gallery/css/fotorama.min.css new file mode 100644 index 0000000000000..8064fb729f216 --- /dev/null +++ b/media/plg_fields_gallery/css/fotorama.min.css @@ -0,0 +1,4 @@ +/*! + * Fotorama 4.6.4 | http://fotorama.io/license/ + */ +.fotorama__arr:focus:after,.fotorama__fullscreen-icon:focus:after,.fotorama__html,.fotorama__img,.fotorama__nav__frame:focus .fotorama__dot:after,.fotorama__nav__frame:focus .fotorama__thumb:after,.fotorama__stage__frame,.fotorama__stage__shaft,.fotorama__video iframe{position:absolute;width:100%;height:100%;top:0;right:0;left:0;bottom:0}.fotorama--fullscreen,.fotorama__img{max-width:99999px!important;max-height:99999px!important;min-width:0!important;min-height:0!important;border-radius:0!important;box-shadow:none!important;padding:0!important}.fotorama__wrap .fotorama__grab{cursor:move;cursor:-webkit-grab;cursor:-o-grab;cursor:-ms-grab;cursor:grab}.fotorama__grabbing *{cursor:move;cursor:-webkit-grabbing;cursor:-o-grabbing;cursor:-ms-grabbing;cursor:grabbing}.fotorama__spinner{position:absolute!important;top:50%!important;left:50%!important}.fotorama__wrap--css3 .fotorama__arr,.fotorama__wrap--css3 .fotorama__fullscreen-icon,.fotorama__wrap--css3 .fotorama__nav__shaft,.fotorama__wrap--css3 .fotorama__stage__shaft,.fotorama__wrap--css3 .fotorama__thumb-border,.fotorama__wrap--css3 .fotorama__video-close,.fotorama__wrap--css3 .fotorama__video-play{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.fotorama__caption,.fotorama__nav:after,.fotorama__nav:before,.fotorama__stage:after,.fotorama__stage:before,.fotorama__wrap--css3 .fotorama__html,.fotorama__wrap--css3 .fotorama__nav,.fotorama__wrap--css3 .fotorama__spinner,.fotorama__wrap--css3 .fotorama__stage,.fotorama__wrap--css3 .fotorama__stage .fotorama__img,.fotorama__wrap--css3 .fotorama__stage__frame{-webkit-transform:translateZ(0);transform:translateZ(0)}.fotorama__arr:focus,.fotorama__fullscreen-icon:focus,.fotorama__nav__frame{outline:0}.fotorama__arr:focus:after,.fotorama__fullscreen-icon:focus:after,.fotorama__nav__frame:focus .fotorama__dot:after,.fotorama__nav__frame:focus .fotorama__thumb:after{content:'';border-radius:inherit;background-color:rgba(0,175,234,.5)}.fotorama__wrap--video .fotorama__stage,.fotorama__wrap--video .fotorama__stage__frame--video,.fotorama__wrap--video .fotorama__stage__frame--video .fotorama__html,.fotorama__wrap--video .fotorama__stage__frame--video .fotorama__img,.fotorama__wrap--video .fotorama__stage__shaft{-webkit-transform:none!important;transform:none!important}.fotorama__wrap--css3 .fotorama__nav__shaft,.fotorama__wrap--css3 .fotorama__stage__shaft,.fotorama__wrap--css3 .fotorama__thumb-border{transition-property:-webkit-transform,width;transition-property:transform,width;transition-timing-function:cubic-bezier(0.1,0,.25,1);transition-duration:0ms}.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__no-select,.fotorama__video-close,.fotorama__video-play,.fotorama__wrap{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fotorama__select{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.fotorama__nav,.fotorama__nav__frame{margin:auto;padding:0}.fotorama__caption__wrap,.fotorama__nav__frame,.fotorama__nav__shaft{-moz-box-orient:vertical;display:inline-block;vertical-align:middle;*display:inline;*zoom:1}.fotorama__nav__frame,.fotorama__thumb-border{box-sizing:content-box}.fotorama__caption__wrap{box-sizing:border-box}.fotorama--hidden,.fotorama__load{position:absolute;left:-99999px;top:-99999px;z-index:-1}.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__nav,.fotorama__nav__frame,.fotorama__nav__shaft,.fotorama__stage__frame,.fotorama__stage__shaft,.fotorama__video-close,.fotorama__video-play{-webkit-tap-highlight-color:transparent}.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__video-close,.fotorama__video-play{background:url(fotorama.png) no-repeat}@media (-webkit-min-device-pixel-ratio:1.5),(min-resolution:2dppx){.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__video-close,.fotorama__video-play{background:url(fotorama@2x.png) 0 0/96px 160px no-repeat}}.fotorama__thumb{background-color:#7f7f7f;background-color:rgba(127,127,127,.2)}@media print{.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__thumb-border,.fotorama__video-close,.fotorama__video-play{background:none!important}}.fotorama{min-width:1px;overflow:hidden}.fotorama:not(.fotorama--unobtrusive)>*:not(:first-child){display:none}.fullscreen{width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;margin:0!important;padding:0!important;overflow:hidden!important;background:#000}.fotorama--fullscreen{position:absolute!important;top:0!important;left:0!important;right:0!important;bottom:0!important;float:none!important;z-index:2147483647!important;background:#000;width:100%!important;height:100%!important;margin:0!important}.fotorama--fullscreen .fotorama__nav,.fotorama--fullscreen .fotorama__stage{background:#000}.fotorama__wrap{-webkit-text-size-adjust:100%;position:relative;direction:ltr;z-index:0}.fotorama__wrap--rtl .fotorama__stage__frame{direction:rtl}.fotorama__nav,.fotorama__stage{overflow:hidden;position:relative;max-width:100%}.fotorama__wrap--pan-y{-ms-touch-action:pan-y}.fotorama__wrap .fotorama__pointer{cursor:pointer}.fotorama__wrap--slide .fotorama__stage__frame{opacity:1!important}.fotorama__stage__frame{overflow:hidden}.fotorama__stage__frame.fotorama__active{z-index:8}.fotorama__wrap--fade .fotorama__stage__frame{display:none}.fotorama__wrap--fade .fotorama__fade-front,.fotorama__wrap--fade .fotorama__fade-rear,.fotorama__wrap--fade .fotorama__stage__frame.fotorama__active{display:block;left:0;top:0}.fotorama__wrap--fade .fotorama__fade-front{z-index:8}.fotorama__wrap--fade .fotorama__fade-rear{z-index:7}.fotorama__wrap--fade .fotorama__fade-rear.fotorama__active{z-index:9}.fotorama__wrap--fade .fotorama__stage .fotorama__shadow{display:none}.fotorama__img{-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0);opacity:0;border:none!important}.fotorama__error .fotorama__img,.fotorama__loaded .fotorama__img{-ms-filter:"alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1}.fotorama--fullscreen .fotorama__loaded--full .fotorama__img,.fotorama__img--full{display:none}.fotorama--fullscreen .fotorama__loaded--full .fotorama__img--full{display:block}.fotorama__wrap--only-active .fotorama__nav,.fotorama__wrap--only-active .fotorama__stage{max-width:99999px!important}.fotorama__wrap--only-active .fotorama__stage__frame{visibility:hidden}.fotorama__wrap--only-active .fotorama__stage__frame.fotorama__active{visibility:visible}.fotorama__nav{font-size:0;line-height:0;text-align:center;display:none;white-space:nowrap;z-index:5}.fotorama__nav__shaft{position:relative;left:0;top:0;text-align:left}.fotorama__nav__frame{position:relative;cursor:pointer}.fotorama__nav--dots{display:block}.fotorama__nav--dots .fotorama__nav__frame{width:18px;height:30px}.fotorama__nav--dots .fotorama__nav__frame--thumb,.fotorama__nav--dots .fotorama__thumb-border{display:none}.fotorama__nav--thumbs{display:block}.fotorama__nav--thumbs .fotorama__nav__frame{padding-left:0!important}.fotorama__nav--thumbs .fotorama__nav__frame:last-child{padding-right:0!important}.fotorama__nav--thumbs .fotorama__nav__frame--dot{display:none}.fotorama__dot{display:block;width:4px;height:4px;position:relative;top:12px;left:6px;border-radius:6px;border:1px solid #7f7f7f}.fotorama__nav__frame:focus .fotorama__dot:after{padding:1px;top:-1px;left:-1px}.fotorama__nav__frame.fotorama__active .fotorama__dot{width:0;height:0;border-width:3px}.fotorama__nav__frame.fotorama__active .fotorama__dot:after{padding:3px;top:-3px;left:-3px}.fotorama__thumb{overflow:hidden;position:relative;width:100%;height:100%}.fotorama__nav__frame:focus .fotorama__thumb{z-index:2}.fotorama__thumb-border{position:absolute;z-index:9;top:0;left:0;border-style:solid;border-color:#00afea;background-image:linear-gradient(to bottom right,rgba(255,255,255,.25),rgba(64,64,64,.1))}.fotorama__caption{position:absolute;z-index:12;bottom:0;left:0;right:0;font-family:'Helvetica Neue',Arial,sans-serif;font-size:14px;line-height:1.5;color:#000}.fotorama__caption a{text-decoration:none;color:#000;border-bottom:1px solid;border-color:rgba(0,0,0,.5)}.fotorama__caption a:hover{color:#333;border-color:rgba(51,51,51,.5)}.fotorama__wrap--rtl .fotorama__caption{left:auto;right:0}.fotorama__wrap--no-captions .fotorama__caption,.fotorama__wrap--video .fotorama__caption{display:none}.fotorama__caption__wrap{background-color:#fff;background-color:rgba(255,255,255,.9);padding:5px 10px}@-webkit-keyframes spinner{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spinner{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.fotorama__wrap--css3 .fotorama__spinner{-webkit-animation:spinner 24s infinite linear;animation:spinner 24s infinite linear}.fotorama__wrap--css3 .fotorama__html,.fotorama__wrap--css3 .fotorama__stage .fotorama__img{transition-property:opacity;transition-timing-function:linear;transition-duration:.3s}.fotorama__wrap--video .fotorama__stage__frame--video .fotorama__html,.fotorama__wrap--video .fotorama__stage__frame--video .fotorama__img{-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0);opacity:0}.fotorama__select{cursor:auto}.fotorama__video{top:32px;right:0;bottom:0;left:0;position:absolute;z-index:10}@-moz-document url-prefix(){.fotorama__active{box-shadow:0 0 0 transparent}}.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__video-close,.fotorama__video-play{position:absolute;z-index:11;cursor:pointer}.fotorama__arr{position:absolute;width:32px;height:32px;top:50%;margin-top:-16px}.fotorama__arr--prev{left:2px;background-position:0 0}.fotorama__arr--next{right:2px;background-position:-32px 0}.fotorama__arr--disabled{pointer-events:none;cursor:default;*display:none;opacity:.1}.fotorama__fullscreen-icon{width:32px;height:32px;top:2px;right:2px;background-position:0 -32px;z-index:20}.fotorama__arr:focus,.fotorama__fullscreen-icon:focus{border-radius:50%}.fotorama--fullscreen .fotorama__fullscreen-icon{background-position:-32px -32px}.fotorama__video-play{width:96px;height:96px;left:50%;top:50%;margin-left:-48px;margin-top:-48px;background-position:0 -64px;opacity:0}.fotorama__wrap--css2 .fotorama__video-play,.fotorama__wrap--video .fotorama__stage .fotorama__video-play{display:none}.fotorama__error .fotorama__video-play,.fotorama__loaded .fotorama__video-play,.fotorama__nav__frame .fotorama__video-play{opacity:1;display:block}.fotorama__nav__frame .fotorama__video-play{width:32px;height:32px;margin-left:-16px;margin-top:-16px;background-position:-64px -32px}.fotorama__video-close{width:32px;height:32px;top:0;right:0;background-position:-64px 0;z-index:20;opacity:0}.fotorama__wrap--css2 .fotorama__video-close{display:none}.fotorama__wrap--css3 .fotorama__video-close{-webkit-transform:translate3d(32px,-32px,0);transform:translate3d(32px,-32px,0)}.fotorama__wrap--video .fotorama__video-close{display:block;opacity:1}.fotorama__wrap--css3.fotorama__wrap--video .fotorama__video-close{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__arr,.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon{opacity:0}.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__arr:focus,.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon:focus{opacity:1}.fotorama__wrap--video .fotorama__arr,.fotorama__wrap--video .fotorama__fullscreen-icon{opacity:0!important}.fotorama__wrap--css2.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__arr,.fotorama__wrap--css2.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon{display:none}.fotorama__wrap--css2.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__arr:focus,.fotorama__wrap--css2.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon:focus{display:block}.fotorama__wrap--css2.fotorama__wrap--video .fotorama__arr,.fotorama__wrap--css2.fotorama__wrap--video .fotorama__fullscreen-icon{display:none!important}.fotorama__wrap--css3.fotorama__wrap--no-controls.fotorama__wrap--slide.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon:not(:focus){-webkit-transform:translate3d(32px,-32px,0);transform:translate3d(32px,-32px,0)}.fotorama__wrap--css3.fotorama__wrap--no-controls.fotorama__wrap--slide.fotorama__wrap--toggle-arrows .fotorama__arr--prev:not(:focus){-webkit-transform:translate3d(-48px,0,0);transform:translate3d(-48px,0,0)}.fotorama__wrap--css3.fotorama__wrap--no-controls.fotorama__wrap--slide.fotorama__wrap--toggle-arrows .fotorama__arr--next:not(:focus){-webkit-transform:translate3d(48px,0,0);transform:translate3d(48px,0,0)}.fotorama__wrap--css3.fotorama__wrap--video .fotorama__fullscreen-icon{-webkit-transform:translate3d(32px,-32px,0)!important;transform:translate3d(32px,-32px,0)!important}.fotorama__wrap--css3.fotorama__wrap--video .fotorama__arr--prev{-webkit-transform:translate3d(-48px,0,0)!important;transform:translate3d(-48px,0,0)!important}.fotorama__wrap--css3.fotorama__wrap--video .fotorama__arr--next{-webkit-transform:translate3d(48px,0,0)!important;transform:translate3d(48px,0,0)!important}.fotorama__wrap--css3 .fotorama__arr:not(:focus),.fotorama__wrap--css3 .fotorama__fullscreen-icon:not(:focus),.fotorama__wrap--css3 .fotorama__video-close:not(:focus),.fotorama__wrap--css3 .fotorama__video-play:not(:focus){transition-property:-webkit-transform,opacity;transition-property:transform,opacity;transition-duration:.3s}.fotorama__nav:after,.fotorama__nav:before,.fotorama__stage:after,.fotorama__stage:before{content:"";display:block;position:absolute;text-decoration:none;top:0;bottom:0;width:10px;height:auto;z-index:10;pointer-events:none;background-repeat:no-repeat;background-size:1px 100%,5px 100%}.fotorama__nav:before,.fotorama__stage:before{background-image:linear-gradient(transparent,rgba(0,0,0,.2) 25%,rgba(0,0,0,.3) 75%,transparent),radial-gradient(farthest-side at 0 50%,rgba(0,0,0,.4),transparent);background-position:0 0,0 0;left:-10px}.fotorama__nav.fotorama__shadows--left:before,.fotorama__stage.fotorama__shadows--left:before{left:0}.fotorama__nav:after,.fotorama__stage:after{background-image:linear-gradient(transparent,rgba(0,0,0,.2) 25%,rgba(0,0,0,.3) 75%,transparent),radial-gradient(farthest-side at 100% 50%,rgba(0,0,0,.4),transparent);background-position:100% 0,100% 0;right:-10px}.fotorama__nav.fotorama__shadows--right:after,.fotorama__stage.fotorama__shadows--right:after{right:0}.fotorama--fullscreen .fotorama__nav:after,.fotorama--fullscreen .fotorama__nav:before,.fotorama--fullscreen .fotorama__stage:after,.fotorama--fullscreen .fotorama__stage:before,.fotorama__wrap--fade .fotorama__stage:after,.fotorama__wrap--fade .fotorama__stage:before,.fotorama__wrap--no-shadows .fotorama__nav:after,.fotorama__wrap--no-shadows .fotorama__nav:before,.fotorama__wrap--no-shadows .fotorama__stage:after,.fotorama__wrap--no-shadows .fotorama__stage:before{display:none} \ No newline at end of file diff --git a/media/plg_fields_gallery/css/fotorama.png b/media/plg_fields_gallery/css/fotorama.png new file mode 100644 index 0000000000000..b59419a93109b Binary files /dev/null and b/media/plg_fields_gallery/css/fotorama.png differ diff --git a/media/plg_fields_gallery/css/fotorama@2x.png b/media/plg_fields_gallery/css/fotorama@2x.png new file mode 100644 index 0000000000000..f94f06d028b89 Binary files /dev/null and b/media/plg_fields_gallery/css/fotorama@2x.png differ diff --git a/media/plg_fields_gallery/js/fotorama.min.js b/media/plg_fields_gallery/js/fotorama.min.js new file mode 100644 index 0000000000000..5081132a164ef --- /dev/null +++ b/media/plg_fields_gallery/js/fotorama.min.js @@ -0,0 +1,5 @@ +/*! + * Fotorama 4.6.4 | http://fotorama.io/license/ + */ +fotoramaVersion="4.6.4",function(a,b,c,d,e){"use strict";function f(a){var b="bez_"+d.makeArray(arguments).join("_").replace(".","p");if("function"!=typeof d.easing[b]){var c=function(a,b){var c=[null,null],d=[null,null],e=[null,null],f=function(f,g){return e[g]=3*a[g],d[g]=3*(b[g]-a[g])-e[g],c[g]=1-e[g]-d[g],f*(e[g]+f*(d[g]+f*c[g]))},g=function(a){return e[0]+a*(2*d[0]+3*c[0]*a)},h=function(a){for(var b,c=a,d=0;++d<14&&(b=f(c,0)-a,!(Math.abs(b)<.001));)c-=b/g(c);return c};return function(a){return f(h(a),1)}};d.easing[b]=function(b,d,e,f,g){return f*c([a[0],a[1]],[a[2],a[3]])(d/g)+e}}return b}function g(){}function h(a,b,c){return Math.max(isNaN(b)?-1/0:b,Math.min(isNaN(c)?1/0:c,a))}function i(a){return a.match(/ma/)&&a.match(/-?\d+(?!d)/g)[a.match(/3d/)?12:4]}function j(a){return Ic?+i(a.css("transform")):+a.css("left").replace("px","")}function k(a){var b={};return Ic?b.transform="translate3d("+a+"px,0,0)":b.left=a,b}function l(a){return{"transition-duration":a+"ms"}}function m(a,b){return isNaN(a)?b:a}function n(a,b){return m(+String(a).replace(b||"px",""))}function o(a){return/%$/.test(a)?n(a,"%"):e}function p(a,b){return m(o(a)/100*b,n(a))}function q(a){return(!isNaN(n(a))||!isNaN(n(a,"%")))&&a}function r(a,b,c,d){return(a-(d||0))*(b+(c||0))}function s(a,b,c,d){return-Math.round(a/(b+(c||0))-(d||0))}function t(a){var b=a.data();if(!b.tEnd){var c=a[0],d={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",msTransition:"MSTransitionEnd",transition:"transitionend"};T(c,d[uc.prefixed("transition")],function(a){b.tProp&&a.propertyName.match(b.tProp)&&b.onEndFn()}),b.tEnd=!0}}function u(a,b,c,d){var e,f=a.data();f&&(f.onEndFn=function(){e||(e=!0,clearTimeout(f.tT),c())},f.tProp=b,clearTimeout(f.tT),f.tT=setTimeout(function(){f.onEndFn()},1.5*d),t(a))}function v(a,b){if(a.length){var c=a.data();Ic?(a.css(l(0)),c.onEndFn=g,clearTimeout(c.tT)):a.stop();var d=w(b,function(){return j(a)});return a.css(k(d)),d}}function w(){for(var a,b=0,c=arguments.length;c>b&&(a=b?arguments[b]():arguments[b],"number"!=typeof a);b++);return a}function x(a,b){return Math.round(a+(b-a)/1.5)}function y(){return y.p=y.p||("https:"===c.protocol?"https://":"http://"),y.p}function z(a){var c=b.createElement("a");return c.href=a,c}function A(a,b){if("string"!=typeof a)return a;a=z(a);var c,d;if(a.host.match(/youtube\.com/)&&a.search){if(c=a.search.split("v=")[1]){var e=c.indexOf("&");-1!==e&&(c=c.substring(0,e)),d="youtube"}}else a.host.match(/youtube\.com|youtu\.be/)?(c=a.pathname.replace(/^\/(embed\/|v\/)?/,"").replace(/\/.*/,""),d="youtube"):a.host.match(/vimeo\.com/)&&(d="vimeo",c=a.pathname.replace(/^\/(video\/)?/,"").replace(/\/.*/,""));return c&&d||!b||(c=a.href,d="custom"),c?{id:c,type:d,s:a.search.replace(/^\?/,""),p:y()}:!1}function B(a,b,c){var e,f,g=a.video;return"youtube"===g.type?(f=y()+"img.youtube.com/vi/"+g.id+"/default.jpg",e=f.replace(/\/default.jpg$/,"/hqdefault.jpg"),a.thumbsReady=!0):"vimeo"===g.type?d.ajax({url:y()+"vimeo.com/api/v2/video/"+g.id+".json",dataType:"jsonp",success:function(d){a.thumbsReady=!0,C(b,{img:d[0].thumbnail_large,thumb:d[0].thumbnail_small},a.i,c)}}):a.thumbsReady=!0,{img:e,thumb:f}}function C(a,b,c,e){for(var f=0,g=a.length;g>f;f++){var h=a[f];if(h.i===c&&h.thumbsReady){var i={videoReady:!0};i[Xc]=i[Zc]=i[Yc]=!1,e.splice(f,1,d.extend({},h,i,b));break}}}function D(a){function b(a,b,e){var f=a.children("img").eq(0),g=a.attr("href"),h=a.attr("src"),i=f.attr("src"),j=b.video,k=e?A(g,j===!0):!1;k?g=!1:k=j,c(a,f,d.extend(b,{video:k,img:b.img||g||h||i,thumb:b.thumb||i||h||g}))}function c(a,b,c){var e=c.thumb&&c.img!==c.thumb,f=n(c.width||a.attr("width")),g=n(c.height||a.attr("height"));d.extend(c,{width:f,height:g,thumbratio:S(c.thumbratio||n(c.thumbwidth||b&&b.attr("width")||e||f)/n(c.thumbheight||b&&b.attr("height")||e||g))})}var e=[];return a.children().each(function(){var a=d(this),f=R(d.extend(a.data(),{id:a.attr("id")}));if(a.is("a, img"))b(a,f,!0);else{if(a.is(":empty"))return;c(a,null,d.extend(f,{html:this,_html:a.html()}))}e.push(f)}),e}function E(a){return 0===a.offsetWidth&&0===a.offsetHeight}function F(a){return!d.contains(b.documentElement,a)}function G(a,b,c,d){return G.i||(G.i=1,G.ii=[!0]),d=d||G.i,"undefined"==typeof G.ii[d]&&(G.ii[d]=!0),a()?b():G.ii[d]&&setTimeout(function(){G.ii[d]&&G(a,b,c,d)},c||100),G.i++}function H(a){c.replace(c.protocol+"//"+c.host+c.pathname.replace(/^\/?/,"/")+c.search+"#"+a)}function I(a,b,c,d){var e=a.data(),f=e.measures;if(f&&(!e.l||e.l.W!==f.width||e.l.H!==f.height||e.l.r!==f.ratio||e.l.w!==b.w||e.l.h!==b.h||e.l.m!==c||e.l.p!==d)){var g=f.width,i=f.height,j=b.w/b.h,k=f.ratio>=j,l="scaledown"===c,m="contain"===c,n="cover"===c,o=$(d);k&&(l||m)||!k&&n?(g=h(b.w,0,l?g:1/0),i=g/f.ratio):(k&&n||!k&&(l||m))&&(i=h(b.h,0,l?i:1/0),g=i*f.ratio),a.css({width:g,height:i,left:p(o.x,b.w-g),top:p(o.y,b.h-i)}),e.l={W:f.width,H:f.height,r:f.ratio,w:b.w,h:b.h,m:c,p:d}}return!0}function J(a,b){var c=a[0];c.styleSheet?c.styleSheet.cssText=b:a.html(b)}function K(a,b,c){return b===c?!1:b>=a?"left":a>=c?"right":"left right"}function L(a,b,c,d){if(!c)return!1;if(!isNaN(a))return a-(d?0:1);for(var e,f=0,g=b.length;g>f;f++){var h=b[f];if(h.id===a){e=f;break}}return e}function M(a,b,c){c=c||{},a.each(function(){var a,e=d(this),f=e.data();f.clickOn||(f.clickOn=!0,d.extend(cb(e,{onStart:function(b){a=b,(c.onStart||g).call(this,b)},onMove:c.onMove||g,onTouchEnd:c.onTouchEnd||g,onEnd:function(c){c.moved||b.call(this,a)}}),{noMove:!0}))})}function N(a,b){return'
    '+(b||"")+"
    "}function O(a){for(var b=a.length;b;){var c=Math.floor(Math.random()*b--),d=a[b];a[b]=a[c],a[c]=d}return a}function P(a){return"[object Array]"==Object.prototype.toString.call(a)&&d.map(a,function(a){return d.extend({},a)})}function Q(a,b,c){a.scrollLeft(b||0).scrollTop(c||0)}function R(a){if(a){var b={};return d.each(a,function(a,c){b[a.toLowerCase()]=c}),b}}function S(a){if(a){var b=+a;return isNaN(b)?(b=a.split("/"),+b[0]/+b[1]||e):b}}function T(a,b,c,d){b&&(a.addEventListener?a.addEventListener(b,c,!!d):a.attachEvent("on"+b,c))}function U(a){return!!a.getAttribute("disabled")}function V(a){return{tabindex:-1*a+"",disabled:a}}function W(a,b){T(a,"keyup",function(c){U(a)||13==c.keyCode&&b.call(a,c)})}function X(a,b){T(a,"focus",a.onfocusin=function(c){b.call(a,c)},!0)}function Y(a,b){a.preventDefault?a.preventDefault():a.returnValue=!1,b&&a.stopPropagation&&a.stopPropagation()}function Z(a){return a?">":"<"}function $(a){return a=(a+"").split(/\s+/),{x:q(a[0])||bd,y:q(a[1])||bd}}function _(a,b){var c=a.data(),e=Math.round(b.pos),f=function(){c.sliding=!1,(b.onEnd||g)()};"undefined"!=typeof b.overPos&&b.overPos!==b.pos&&(e=b.overPos,f=function(){_(a,d.extend({},b,{overPos:b.pos,time:Math.max(Qc,b.time/2)}))});var h=d.extend(k(e),b.width&&{width:b.width});c.sliding=!0,Ic?(a.css(d.extend(l(b.time),h)),b.time>10?u(a,"transform",f,b.time):f()):a.stop().animate(h,b.time,_c,f)}function ab(a,b,c,e,f,h){var i="undefined"!=typeof h;if(i||(f.push(arguments),Array.prototype.push.call(arguments,f.length),!(f.length>1))){a=a||d(a),b=b||d(b);var j=a[0],k=b[0],l="crossfade"===e.method,m=function(){if(!m.done){m.done=!0;var a=(i||f.shift())&&f.shift();a&&ab.apply(this,a),(e.onEnd||g)(!!a)}},n=e.time/(h||1);c.removeClass(Rb+" "+Qb),a.stop().addClass(Rb),b.stop().addClass(Qb),l&&k&&a.fadeTo(0,0),a.fadeTo(l?n:0,1,l&&m),b.fadeTo(n,0,m),j&&l||k||m()}}function bb(a){var b=(a.touches||[])[0]||a;a._x=b.pageX,a._y=b.clientY,a._now=d.now()}function cb(a,c){function e(a){return m=d(a.target),u.checked=p=q=s=!1,k||u.flow||a.touches&&a.touches.length>1||a.which>1||ed&&ed.type!==a.type&&gd||(p=c.select&&m.is(c.select,t))?p:(o="touchstart"===a.type,q=m.is("a, a *",t),n=u.control,r=u.noMove||u.noSwipe||n?16:u.snap?0:4,bb(a),l=ed=a,fd=a.type.replace(/down|start/,"move").replace(/Down/,"Move"),(c.onStart||g).call(t,a,{control:n,$target:m}),k=u.flow=!0,void((!o||u.go)&&Y(a)))}function f(a){if(a.touches&&a.touches.length>1||Nc&&!a.isPrimary||fd!==a.type||!k)return k&&h(),void(c.onTouchEnd||g)();bb(a);var b=Math.abs(a._x-l._x),d=Math.abs(a._y-l._y),e=b-d,f=(u.go||u.x||e>=0)&&!u.noSwipe,i=0>e;o&&!u.checked?(k=f)&&Y(a):(Y(a),(c.onMove||g).call(t,a,{touch:o})),!s&&Math.sqrt(Math.pow(b,2)+Math.pow(d,2))>r&&(s=!0),u.checked=u.checked||f||i}function h(a){(c.onTouchEnd||g)();var b=k;u.control=k=!1,b&&(u.flow=!1),!b||q&&!u.checked||(a&&Y(a),gd=!0,clearTimeout(hd),hd=setTimeout(function(){gd=!1},1e3),(c.onEnd||g).call(t,{moved:s,$target:m,control:n,touch:o,startEvent:l,aborted:!a||"MSPointerCancel"===a.type}))}function i(){u.flow||setTimeout(function(){u.flow=!0},10)}function j(){u.flow&&setTimeout(function(){u.flow=!1},Pc)}var k,l,m,n,o,p,q,r,s,t=a[0],u={};return Nc?(T(t,"MSPointerDown",e),T(b,"MSPointerMove",f),T(b,"MSPointerCancel",h),T(b,"MSPointerUp",h)):(T(t,"touchstart",e),T(t,"touchmove",f),T(t,"touchend",h),T(b,"touchstart",i),T(b,"touchend",j),T(b,"touchcancel",j),Ec.on("scroll",j),a.on("mousedown",e),Fc.on("mousemove",f).on("mouseup",h)),a.on("click","a",function(a){u.checked&&Y(a)}),u}function db(a,b){function c(c,d){A=!0,j=l=c._x,q=c._now,p=[[q,j]],m=n=D.noMove||d?0:v(a,(b.getPos||g)()),(b.onStart||g).call(B,c)}function e(a,b){s=D.min,t=D.max,u=D.snap,w=a.altKey,A=z=!1,y=b.control,y||C.sliding||c(a)}function f(d,e){D.noSwipe||(A||c(d),l=d._x,p.push([d._now,l]),n=m-(j-l),o=K(n,s,t),s>=n?n=x(n,s):n>=t&&(n=x(n,t)),D.noMove||(a.css(k(n)),z||(z=!0,e.touch||Nc||a.addClass(ec)),(b.onMove||g).call(B,d,{pos:n,edge:o})))}function i(e){if(!D.noSwipe||!e.moved){A||c(e.startEvent,!0),e.touch||Nc||a.removeClass(ec),r=d.now();for(var f,i,j,k,o,q,v,x,y,z=r-Pc,C=null,E=Qc,F=b.friction,G=p.length-1;G>=0;G--){if(f=p[G][0],i=Math.abs(f-z),null===C||j>i)C=f,k=p[G][1];else if(C===z||i>j)break;j=i}v=h(n,s,t);var H=k-l,I=H>=0,J=r-C,K=J>Pc,L=!K&&n!==m&&v===n;u&&(v=h(Math[L?I?"floor":"ceil":"round"](n/u)*u,s,t),s=t=v),L&&(u||v===n)&&(y=-(H/J),E*=h(Math.abs(y),b.timeLow,b.timeHigh),o=Math.round(n+y*E/F),u||(v=o),(!I&&o>t||I&&s>o)&&(q=I?s:t,x=o-q,u||(v=q),x=h(v+.03*x,q-50,q+50),E=Math.abs((n-x)/(y/F)))),E*=w?10:1,(b.onEnd||g).call(B,d.extend(e,{moved:e.moved||K&&u,pos:n,newPos:v,overPos:x,time:E}))}}var j,l,m,n,o,p,q,r,s,t,u,w,y,z,A,B=a[0],C=a.data(),D={};return D=d.extend(cb(b.$wrap,d.extend({},b,{onStart:e,onMove:f,onEnd:i})),D)}function eb(a,b){var c,e,f,h=a[0],i={prevent:{}};return T(h,Oc,function(a){var h=a.wheelDeltaY||-1*a.deltaY||0,j=a.wheelDeltaX||-1*a.deltaX||0,k=Math.abs(j)&&!Math.abs(h),l=Z(0>j),m=e===l,n=d.now(),o=Pc>n-f;e=l,f=n,k&&i.ok&&(!i.prevent[l]||c)&&(Y(a,!0),c&&m&&o||(b.shift&&(c=!0,clearTimeout(i.t),i.t=setTimeout(function(){c=!1},Rc)),(b.onEnd||g)(a,b.shift?l:j)))}),i}function fb(){d.each(d.Fotorama.instances,function(a,b){b.index=a})}function gb(a){d.Fotorama.instances.push(a),fb()}function hb(a){d.Fotorama.instances.splice(a.index,1),fb()}var ib="fotorama",jb="fullscreen",kb=ib+"__wrap",lb=kb+"--css2",mb=kb+"--css3",nb=kb+"--video",ob=kb+"--fade",pb=kb+"--slide",qb=kb+"--no-controls",rb=kb+"--no-shadows",sb=kb+"--pan-y",tb=kb+"--rtl",ub=kb+"--only-active",vb=kb+"--no-captions",wb=kb+"--toggle-arrows",xb=ib+"__stage",yb=xb+"__frame",zb=yb+"--video",Ab=xb+"__shaft",Bb=ib+"__grab",Cb=ib+"__pointer",Db=ib+"__arr",Eb=Db+"--disabled",Fb=Db+"--prev",Gb=Db+"--next",Hb=ib+"__nav",Ib=Hb+"-wrap",Jb=Hb+"__shaft",Kb=Hb+"--dots",Lb=Hb+"--thumbs",Mb=Hb+"__frame",Nb=Mb+"--dot",Ob=Mb+"--thumb",Pb=ib+"__fade",Qb=Pb+"-front",Rb=Pb+"-rear",Sb=ib+"__shadow",Tb=Sb+"s",Ub=Tb+"--left",Vb=Tb+"--right",Wb=ib+"__active",Xb=ib+"__select",Yb=ib+"--hidden",Zb=ib+"--fullscreen",$b=ib+"__fullscreen-icon",_b=ib+"__error",ac=ib+"__loading",bc=ib+"__loaded",cc=bc+"--full",dc=bc+"--img",ec=ib+"__grabbing",fc=ib+"__img",gc=fc+"--full",hc=ib+"__dot",ic=ib+"__thumb",jc=ic+"-border",kc=ib+"__html",lc=ib+"__video",mc=lc+"-play",nc=lc+"-close",oc=ib+"__caption",pc=ib+"__caption__wrap",qc=ib+"__spinner",rc='" tabindex="0" role="button',sc=d&&d.fn.jquery.split(".");if(!sc||sc[0]<1||1==sc[0]&&sc[1]<8)throw"Fotorama requires jQuery 1.8 or later and will not run without it.";var tc={},uc=function(a,b,c){function d(a){r.cssText=a}function e(a,b){return typeof a===b}function f(a,b){return!!~(""+a).indexOf(b)}function g(a,b){for(var d in a){var e=a[d];if(!f(e,"-")&&r[e]!==c)return"pfx"==b?e:!0}return!1}function h(a,b,d){for(var f in a){var g=b[a[f]];if(g!==c)return d===!1?a[f]:e(g,"function")?g.bind(d||b):g}return!1}function i(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),f=(a+" "+u.join(d+" ")+d).split(" ");return e(b,"string")||e(b,"undefined")?g(f,b):(f=(a+" "+v.join(d+" ")+d).split(" "),h(f,b,c))}var j,k,l,m="2.6.2",n={},o=b.documentElement,p="modernizr",q=b.createElement(p),r=q.style,s=({}.toString," -webkit- -moz- -o- -ms- ".split(" ")),t="Webkit Moz O ms",u=t.split(" "),v=t.toLowerCase().split(" "),w={},x=[],y=x.slice,z=function(a,c,d,e){var f,g,h,i,j=b.createElement("div"),k=b.body,l=k||b.createElement("body");if(parseInt(d,10))for(;d--;)h=b.createElement("div"),h.id=e?e[d]:p+(d+1),j.appendChild(h);return f=["­",'"].join(""),j.id=p,(k?j:l).innerHTML+=f,l.appendChild(j),k||(l.style.background="",l.style.overflow="hidden",i=o.style.overflow,o.style.overflow="hidden",o.appendChild(l)),g=c(j,a),k?j.parentNode.removeChild(j):(l.parentNode.removeChild(l),o.style.overflow=i),!!g},A={}.hasOwnProperty;l=e(A,"undefined")||e(A.call,"undefined")?function(a,b){return b in a&&e(a.constructor.prototype[b],"undefined")}:function(a,b){return A.call(a,b)},Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError;var c=y.call(arguments,1),d=function(){if(this instanceof d){var e=function(){};e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(y.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(y.call(arguments)))};return d}),w.csstransforms3d=function(){var a=!!i("perspective");return a};for(var B in w)l(w,B)&&(k=B.toLowerCase(),n[k]=w[B](),x.push((n[k]?"":"no-")+k));return n.addTest=function(a,b){if("object"==typeof a)for(var d in a)l(a,d)&&n.addTest(d,a[d]);else{if(a=a.toLowerCase(),n[a]!==c)return n;b="function"==typeof b?b():b,"undefined"!=typeof enableClasses&&enableClasses&&(o.className+=" "+(b?"":"no-")+a),n[a]=b}return n},d(""),q=j=null,n._version=m,n._prefixes=s,n._domPrefixes=v,n._cssomPrefixes=u,n.testProp=function(a){return g([a])},n.testAllProps=i,n.testStyles=z,n.prefixed=function(a,b,c){return b?i(a,b,c):i(a,"pfx")},n}(a,b),vc={ok:!1,is:function(){return!1},request:function(){},cancel:function(){},event:"",prefix:""},wc="webkit moz o ms khtml".split(" ");if("undefined"!=typeof b.cancelFullScreen)vc.ok=!0;else for(var xc=0,yc=wc.length;yc>xc;xc++)if(vc.prefix=wc[xc],"undefined"!=typeof b[vc.prefix+"CancelFullScreen"]){vc.ok=!0;break}vc.ok&&(vc.event=vc.prefix+"fullscreenchange",vc.is=function(){switch(this.prefix){case"":return b.fullScreen;case"webkit":return b.webkitIsFullScreen;default:return b[this.prefix+"FullScreen"]}},vc.request=function(a){return""===this.prefix?a.requestFullScreen():a[this.prefix+"RequestFullScreen"]()},vc.cancel=function(){return""===this.prefix?b.cancelFullScreen():b[this.prefix+"CancelFullScreen"]()});var zc,Ac={lines:12,length:5,width:2,radius:7,corners:1,rotate:15,color:"rgba(128, 128, 128, .75)",hwaccel:!0},Bc={top:"auto",left:"auto",className:""};!function(a,b){zc=b()}(this,function(){function a(a,c){var d,e=b.createElement(a||"div");for(d in c)e[d]=c[d];return e}function c(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function d(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=m.substring(0,m.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return o[e]||(p.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",p.cssRules.length),o[e]=1),e}function f(a,b){var c,d,f=a.style;for(b=b.charAt(0).toUpperCase()+b.slice(1),d=0;d',c)}p.addRule(".spin-vml","behavior:url(#default#VML)"),k.prototype.lines=function(a,d){function e(){return g(b("group",{coordsize:k+" "+k,coordorigin:-i+" "+-i}),{width:k,height:k})}function f(a,f,h){c(m,c(g(e(),{rotation:360/d.lines*a+"deg",left:~~f}),c(g(b("roundrect",{arcsize:d.corners}),{width:i,height:d.width,left:d.radius,top:-d.width>>1,filter:h}),b("fill",{color:j(d.color,a),opacity:d.opacity}),b("stroke",{opacity:0}))))}var h,i=d.length+d.width,k=2*i,l=2*-(d.width+d.length)+"px",m=g(e(),{position:"absolute",top:l,left:l});if(d.shadow)for(h=1;h<=d.lines;h++)f(h,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(h=1;h<=d.lines;h++)f(h);return c(a,m)},k.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d>1):parseInt(f.left,10)+j)+"px",top:("auto"==f.top?d.y-c.y+(b.offsetHeight>>1):parseInt(f.top,10)+j)+"px"})),h.setAttribute("role","progressbar"),e.lines(h,e.opts),!m){var k,l=0,n=(f.lines-1)*(1-f.direction)/2,o=f.fps,p=o/f.speed,q=(1-f.opacity)/(p*f.trail/100),r=p/f.lines;!function s(){l++;for(var a=0;a>1)+"px"})}for(var h,i=0,k=(e.lines-1)*(1-e.direction)/2;i":36===a.keyCode&&g("home")?c="<<":35===a.keyCode&&g("end")&&(c=">>")),(b||c)&&Y(a),c&&ie.show({index:c,slow:a.altKey,user:!0})}),ie.index||Fc.off(b).on(b,"textarea, input, select",function(a){!Dc.hasClass(jb)&&a.stopPropagation()}),Ec.on(f,ie.resize)):(Fc.off(d),Ec.off(f))}function j(b){b!==j.f&&(b?(a.html("").addClass(ib+" "+ke).append(qe).before(oe).before(pe),gb(ie)):(qe.detach(),oe.detach(),pe.detach(),a.html(ne.urtext).removeClass(ke),hb(ie)),i(b),j.f=b)}function m(){yd=ie.data=yd||P(e.data)||D(a),zd=ie.size=yd.length,!xd.ok&&e.shuffle&&O(yd),f(),Je=y(Je),zd&&j(!0)}function o(){var a=2>zd&&!e.enableifsingleframe||Cd;Me.noMove=a||Sd,Me.noSwipe=a||!e.swipe,!Wd&&se.toggleClass(Bb,!e.click&&!Me.noMove&&!Me.noSwipe),Nc&&qe.toggleClass(sb,!Me.noSwipe)}function t(a){a===!0&&(a=""),e.autoplay=Math.max(+a||Sc,1.5*Vd)}function u(){function a(a,c){b[a?"add":"remove"].push(c)}ie.options=e=R(e),Sd="crossfade"===e.transition||"dissolve"===e.transition,Md=e.loop&&(zd>2||Sd&&(!Wd||"slide"!==Wd)),Vd=+e.transitionduration||Qc,Yd="rtl"===e.direction,Zd=d.extend({},e.keyboard&&dd,e.keyboard);var b={add:[],remove:[]};zd>1||e.enableifsingleframe?(Nd=e.nav,Pd="top"===e.navposition,b.remove.push(Xb),we.toggle(!!e.arrows)):(Nd=!1,we.hide()),Rb(),Bd=new zc(d.extend(Ac,e.spinner,Bc,{direction:Yd?-1:1})),Gc(),Hc(),e.autoplay&&t(e.autoplay),Td=n(e.thumbwidth)||Uc,Ud=n(e.thumbheight)||Uc,Ne.ok=Pe.ok=e.trackpad&&!Mc,o(),ed(e,[Le]),Od="thumbs"===Nd,Od?(lc(zd,"navThumb"),Ad=Be,he=Zc,J(oe,d.Fotorama.jst.style({w:Td,h:Ud,b:e.thumbborderwidth,m:e.thumbmargin,s:je,q:!Jc})),ye.addClass(Lb).removeClass(Kb)):"dots"===Nd?(lc(zd,"navDot"),Ad=Ae,he=Yc,ye.addClass(Kb).removeClass(Lb)):(Nd=!1,ye.removeClass(Lb+" "+Kb)),Nd&&(Pd?xe.insertBefore(re):xe.insertAfter(re),wc.nav=!1,wc(Ad,ze,"nav")),Qd=e.allowfullscreen,Qd?(De.prependTo(re),Rd=Kc&&"native"===Qd):(De.detach(),Rd=!1),a(Sd,ob),a(!Sd,pb),a(!e.captions,vb),a(Yd,tb),a("always"!==e.arrows,wb),Xd=e.shadows&&!Mc,a(!Xd,rb),qe.addClass(b.add.join(" ")).removeClass(b.remove.join(" ")),Ke=d.extend({},e)}function x(a){return 0>a?(zd+a%zd)%zd:a>=zd?a%zd:a}function y(a){return h(a,0,zd-1)}function z(a){return Md?x(a):y(a)}function E(a){return a>0||Md?a-1:!1}function U(a){return zd-1>a||Md?a+1:!1}function $(){Me.min=Md?-1/0:-r(zd-1,Le.w,e.margin,Fd),Me.max=Md?1/0:-r(0,Le.w,e.margin,Fd),Me.snap=Le.w+e.margin}function bb(){Oe.min=Math.min(0,Le.nw-ze.width()),Oe.max=0,ze.toggleClass(Bb,!(Oe.noMove=Oe.min===Oe.max))}function cb(a,b,c){if("number"==typeof a){a=new Array(a);var e=!0}return d.each(a,function(a,d){if(e&&(d=a),"number"==typeof d){var f=yd[x(d)];if(f){var g="$"+b+"Frame",h=f[g];c.call(this,a,d,f,h,g,h&&h.data())}}})}function fb(a,b,c,d){(!$d||"*"===$d&&d===Ld)&&(a=q(e.width)||q(a)||Vc,b=q(e.height)||q(b)||Wc,ie.resize({width:a,ratio:e.ratio||c||a/b},0,d!==Ld&&"*"))}function Pb(a,b,c,f,g,h){cb(a,b,function(a,i,j,k,l,m){function n(a){var b=x(i);fd(a,{index:b,src:w,frame:yd[b]})}function o(){t.remove(),d.Fotorama.cache[w]="error",j.html&&"stage"===b||!y||y===w?(!w||j.html||r?"stage"===b&&(k.trigger("f:load").removeClass(ac+" "+_b).addClass(bc),n("load"),fb()):(k.trigger("f:error").removeClass(ac).addClass(_b),n("error")),m.state="error",!(zd>1&&yd[i]===j)||j.html||j.deleted||j.video||r||(j.deleted=!0,ie.splice(i,1))):(j[v]=w=y,Pb([i],b,c,f,g,!0))}function p(){d.Fotorama.measures[w]=u.measures=d.Fotorama.measures[w]||{width:s.width,height:s.height,ratio:s.width/s.height},fb(u.measures.width,u.measures.height,u.measures.ratio,i),t.off("load error").addClass(fc+(r?" "+gc:"")).prependTo(k),I(t,(d.isFunction(c)?c():c)||Le,f||j.fit||e.fit,g||j.position||e.position),d.Fotorama.cache[w]=m.state="loaded",setTimeout(function(){k.trigger("f:load").removeClass(ac+" "+_b).addClass(bc+" "+(r?cc:dc)),"stage"===b?n("load"):(j.thumbratio===$c||!j.thumbratio&&e.thumbratio===$c)&&(j.thumbratio=u.measures.ratio,vd())},0)}function q(){var a=10;G(function(){return!fe||!a--&&!Mc},function(){p()})}if(k){var r=ie.fullScreen&&j.full&&j.full!==j.img&&!m.$full&&"stage"===b;if(!m.$img||h||r){var s=new Image,t=d(s),u=t.data();m[r?"$full":"$img"]=t;var v="stage"===b?r?"full":"img":"thumb",w=j[v],y=r?null:j["stage"===b?"thumb":"img"];if("navThumb"===b&&(k=m.$wrap),!w)return void o();d.Fotorama.cache[w]?!function z(){"error"===d.Fotorama.cache[w]?o():"loaded"===d.Fotorama.cache[w]?setTimeout(q,0):setTimeout(z,100)}():(d.Fotorama.cache[w]="*",t.on("load",q).on("error",o)),m.state="",s.src=w}}})}function Qb(a){Ie.append(Bd.spin().el).appendTo(a)}function Rb(){Ie.detach(),Bd&&Bd.stop()}function Sb(){var a=Dd[Xc];a&&!a.data().state&&(Qb(a),a.on("f:load f:error",function(){a.off("f:load f:error"),Rb()}))}function ec(a){W(a,sd),X(a,function(){setTimeout(function(){Q(ye)},0),Rc({time:Vd,guessIndex:d(this).data().eq,minMax:Oe})})}function lc(a,b){cb(a,b,function(a,c,e,f,g,h){if(!f){f=e[g]=qe[g].clone(),h=f.data(),h.data=e;var i=f[0];"stage"===b?(e.html&&d('
    ').append(e._html?d(e.html).removeAttr("id").html(e._html):e.html).appendTo(f),e.caption&&d(N(oc,N(pc,e.caption))).appendTo(f),e.video&&f.addClass(zb).append(Fe.clone()),X(i,function(){setTimeout(function(){Q(re)},0),pd({index:h.eq,user:!0})}),te=te.add(f)):"navDot"===b?(ec(i),Ae=Ae.add(f)):"navThumb"===b&&(ec(i),h.$wrap=f.children(":first"),Be=Be.add(f),e.video&&h.$wrap.append(Fe.clone()))}})}function sc(a,b,c,d){return a&&a.length&&I(a,b,c,d)}function tc(a){cb(a,"stage",function(a,b,c,f,g,h){if(f){var i=x(b),j=c.fit||e.fit,k=c.position||e.position;h.eq=i,Re[Xc][i]=f.css(d.extend({left:Sd?0:r(b,Le.w,e.margin,Fd)},Sd&&l(0))),F(f[0])&&(f.appendTo(se),md(c.$video)),sc(h.$img,Le,j,k),sc(h.$full,Le,j,k)}})}function uc(a,b){if("thumbs"===Nd&&!isNaN(a)){var c=-a,f=-a+Le.nw;Be.each(function(){var a=d(this),g=a.data(),h=g.eq,i=function(){return{h:Ud,w:g.w}},j=i(),k=yd[h]||{},l=k.thumbfit||e.thumbfit,m=k.thumbposition||e.thumbposition;j.w=g.w,g.l+g.wf||sc(g.$img,j,l,m)||b&&Pb([h],"navThumb",i,l,m)})}}function wc(a,b,c){if(!wc[c]){var f="nav"===c&&Od,g=0;b.append(a.filter(function(){for(var a,b=d(this),c=b.data(),e=0,f=yd.length;f>e;e++)if(c.data===yd[e]){a=!0,c.eq=e;break}return a||b.remove()&&!1}).sort(function(a,b){return d(a).data().eq-d(b).data().eq}).each(function(){if(f){var a=d(this),b=a.data(),c=Math.round(Ud*b.data.thumbratio)||Td;b.l=g,b.w=c,a.css({width:c}),g+=c+e.thumbmargin}})),wc[c]=!0}}function xc(a){return a-Se>Le.w/3}function yc(a){return!(Md||Je+a&&Je-zd+a||Cd)}function Gc(){var a=yc(0),b=yc(1);ue.toggleClass(Eb,a).attr(V(a)),ve.toggleClass(Eb,b).attr(V(b))}function Hc(){Ne.ok&&(Ne.prevent={"<":yc(0),">":yc(1)})}function Lc(a){var b,c,d=a.data();return Od?(b=d.l,c=d.w):(b=a.position().left,c=a.width()),{c:b+c/2,min:-b+10*e.thumbmargin,max:-b+Le.w-c-10*e.thumbmargin}}function Oc(a){var b=Dd[he].data();_(Ce,{time:1.2*a,pos:b.l,width:b.w-2*e.thumbborderwidth})}function Rc(a){var b=yd[a.guessIndex][he];if(b){var c=Oe.min!==Oe.max,d=a.minMax||c&&Lc(Dd[he]),e=c&&(a.keep&&Rc.l?Rc.l:h((a.coo||Le.nw/2)-Lc(b).c,d.min,d.max)),f=c&&h(e,Oe.min,Oe.max),g=1.1*a.time;_(ze,{time:g,pos:f||0,onEnd:function(){uc(f,!0)}}),ld(ye,K(f,Oe.min,Oe.max)),Rc.l=e}}function Tc(){_c(he),Qe[he].push(Dd[he].addClass(Wb))}function _c(a){for(var b=Qe[a];b.length;)b.shift().removeClass(Wb)}function bd(a){var b=Re[a];d.each(Ed,function(a,c){delete b[x(c)]}),d.each(b,function(a,c){delete b[a],c.detach()})}function cd(a){Fd=Gd=Je;var b=Dd[Xc];b&&(_c(Xc),Qe[Xc].push(b.addClass(Wb)),a||ie.show.onEnd(!0),v(se,0,!0),bd(Xc),tc(Ed),$(),bb())}function ed(a,b){a&&d.each(b,function(b,c){c&&d.extend(c,{width:a.width||c.width,height:a.height,minwidth:a.minwidth,maxwidth:a.maxwidth,minheight:a.minheight,maxheight:a.maxheight,ratio:S(a.ratio)})})}function fd(b,c){a.trigger(ib+":"+b,[ie,c])}function gd(){clearTimeout(hd.t),fe=1,e.stopautoplayontouch?ie.stopAutoplay():ce=!0}function hd(){fe&&(e.stopautoplayontouch||(id(),jd()),hd.t=setTimeout(function(){fe=0},Qc+Pc))}function id(){ce=!(!Cd&&!de)}function jd(){if(clearTimeout(jd.t),G.stop(jd.w),!e.autoplay||ce)return void(ie.autoplay&&(ie.autoplay=!1,fd("stopautoplay")));ie.autoplay||(ie.autoplay=!0,fd("startautoplay"));var a=Je,b=Dd[Xc].data();jd.w=G(function(){return b.state||a!==Je},function(){jd.t=setTimeout(function(){if(!ce&&a===Je){var b=Kd,c=yd[b][Xc].data();jd.w=G(function(){return c.state||b!==Kd},function(){ce||b!==Kd||ie.show(Md?Z(!Yd):Kd)})}},e.autoplay)})}function kd(){ie.fullScreen&&(ie.fullScreen=!1,Kc&&vc.cancel(le),Dc.removeClass(jb),Cc.removeClass(jb),a.removeClass(Zb).insertAfter(pe),Le=d.extend({},ee),md(Cd,!0,!0),rd("x",!1),ie.resize(),Pb(Ed,"stage"),Q(Ec,ae,_d),fd("fullscreenexit"))}function ld(a,b){Xd&&(a.removeClass(Ub+" "+Vb),b&&!Cd&&a.addClass(b.replace(/^|\s/g," "+Tb+"--")))}function md(a,b,c){b&&(qe.removeClass(nb),Cd=!1,o()),a&&a!==Cd&&(a.remove(),fd("unloadvideo")),c&&(id(),jd())}function nd(a){qe.toggleClass(qb,a)}function od(a){if(!Me.flow){var b=a?a.pageX:od.x,c=b&&!yc(xc(b))&&e.click;od.p!==c&&re.toggleClass(Cb,c)&&(od.p=c,od.x=b)}}function pd(a){clearTimeout(pd.t),e.clicktransition&&e.clicktransition!==e.transition?setTimeout(function(){var b=e.transition;ie.setOptions({transition:e.clicktransition}),Wd=b,pd.t=setTimeout(function(){ie.show(a)},10)},0):ie.show(a)}function qd(a,b){var c=a.target,f=d(c);f.hasClass(mc)?ie.playVideo():c===Ee?ie.toggleFullScreen():Cd?c===He&&md(Cd,!0,!0):b?nd():e.click&&pd({index:a.shiftKey||Z(xc(a._x)),slow:a.altKey,user:!0})}function rd(a,b){Me[a]=Oe[a]=b}function sd(a){var b=d(this).data().eq;pd({index:b,slow:a.altKey,user:!0,coo:a._x-ye.offset().left})}function td(a){pd({index:we.index(this)?">":"<",slow:a.altKey,user:!0})}function ud(a){X(a,function(){setTimeout(function(){Q(re)},0),nd(!1)})}function vd(){if(m(),u(),!vd.i){vd.i=!0;var a=e.startindex;(a||e.hash&&c.hash)&&(Ld=L(a||c.hash.replace(/^#/,""),yd,0===ie.index||a,a)),Je=Fd=Gd=Hd=Ld=z(Ld)||0}if(zd){if(wd())return;Cd&&md(Cd,!0),Ed=[],bd(Xc),vd.ok=!0,ie.show({index:Je,time:0}),ie.resize()}else ie.destroy()}function wd(){return!wd.f===Yd?(wd.f=Yd,Je=zd-1-Je,ie.reverse(),!0):void 0}function xd(){xd.ok||(xd.ok=!0,fd("ready"))}Cc=d("html"),Dc=d("body");var yd,zd,Ad,Bd,Cd,Dd,Ed,Fd,Gd,Hd,Id,Jd,Kd,Ld,Md,Nd,Od,Pd,Qd,Rd,Sd,Td,Ud,Vd,Wd,Xd,Yd,Zd,$d,_d,ae,be,ce,de,ee,fe,ge,he,ie=this,je=d.now(),ke=ib+je,le=a[0],me=1,ne=a.data(),oe=d(""),pe=d(N(Yb)),qe=d(N(kb)),re=d(N(xb)).appendTo(qe),se=(re[0],d(N(Ab)).appendTo(re)),te=d(),ue=d(N(Db+" "+Fb+rc)),ve=d(N(Db+" "+Gb+rc)),we=ue.add(ve).appendTo(re),xe=d(N(Ib)),ye=d(N(Hb)).appendTo(xe),ze=d(N(Jb)).appendTo(ye),Ae=d(),Be=d(),Ce=(se.data(),ze.data(),d(N(jc)).appendTo(ze)),De=d(N($b+rc)),Ee=De[0],Fe=d(N(mc)),Ge=d(N(nc)).appendTo(re),He=Ge[0],Ie=d(N(qc)),Je=!1,Ke={},Le={},Me={},Ne={},Oe={},Pe={},Qe={},Re={},Se=0,Te=[]; +qe[Xc]=d(N(yb)),qe[Zc]=d(N(Mb+" "+Ob+rc,N(ic))),qe[Yc]=d(N(Mb+" "+Nb+rc,N(hc))),Qe[Xc]=[],Qe[Zc]=[],Qe[Yc]=[],Re[Xc]={},qe.addClass(Ic?mb:lb).toggleClass(qb,!e.controlsonstart),ne.fotorama=this,ie.startAutoplay=function(a){return ie.autoplay?this:(ce=de=!1,t(a||e.autoplay),jd(),this)},ie.stopAutoplay=function(){return ie.autoplay&&(ce=de=!0,jd()),this},ie.show=function(a){var b;"object"!=typeof a?(b=a,a={}):b=a.index,b=">"===b?Gd+1:"<"===b?Gd-1:"<<"===b?0:">>"===b?zd-1:b,b=isNaN(b)?L(b,yd,!0):b,b="undefined"==typeof b?Je||0:b,ie.activeIndex=Je=z(b),Id=E(Je),Jd=U(Je),Kd=x(Je+(Yd?-1:1)),Ed=[Je,Id,Jd],Gd=Md?b:Je;var c=Math.abs(Hd-Gd),d=w(a.time,function(){return Math.min(Vd*(1+(c-1)/12),2*Vd)}),f=a.overPos;a.slow&&(d*=10);var g=Dd;ie.activeFrame=Dd=yd[Je];var i=g===Dd&&!a.user;md(Cd,Dd.i!==yd[x(Fd)].i),lc(Ed,"stage"),tc(Mc?[Gd]:[Gd,E(Gd),U(Gd)]),rd("go",!0),i||fd("show",{user:a.user,time:d}),ce=!0;var j=ie.show.onEnd=function(b){if(!j.ok){if(j.ok=!0,b||cd(!0),i||fd("showend",{user:a.user}),!b&&Wd&&Wd!==e.transition)return ie.setOptions({transition:Wd}),void(Wd=!1);Sb(),Pb(Ed,"stage"),rd("go",!1),Hc(),od(),id(),jd()}};if(Sd){var k=Dd[Xc],l=Je!==Hd?yd[Hd][Xc]:null;ab(k,l,te,{time:d,method:e.transition,onEnd:j},Te)}else _(se,{pos:-r(Gd,Le.w,e.margin,Fd),overPos:f,time:d,onEnd:j});if(Gc(),Nd){Tc();var m=y(Je+h(Gd-Hd,-1,1));Rc({time:d,coo:m!==Je&&a.coo,guessIndex:"undefined"!=typeof a.coo?m:Je,keep:i}),Od&&Oc(d)}return be="undefined"!=typeof Hd&&Hd!==Je,Hd=Je,e.hash&&be&&!ie.eq&&H(Dd.id||Je+1),this},ie.requestFullScreen=function(){return Qd&&!ie.fullScreen&&(_d=Ec.scrollTop(),ae=Ec.scrollLeft(),Q(Ec),rd("x",!0),ee=d.extend({},Le),a.addClass(Zb).appendTo(Dc.addClass(jb)),Cc.addClass(jb),md(Cd,!0,!0),ie.fullScreen=!0,Rd&&vc.request(le),ie.resize(),Pb(Ed,"stage"),Sb(),fd("fullscreenenter")),this},ie.cancelFullScreen=function(){return Rd&&vc.is()?vc.cancel(b):kd(),this},ie.toggleFullScreen=function(){return ie[(ie.fullScreen?"cancel":"request")+"FullScreen"]()},T(b,vc.event,function(){!yd||vc.is()||Cd||kd()}),ie.resize=function(a){if(!yd)return this;var b=arguments[1]||0,c=arguments[2];ed(ie.fullScreen?{width:"100%",maxwidth:null,minwidth:null,height:"100%",maxheight:null,minheight:null}:R(a),[Le,c||ie.fullScreen||e]);var d=Le.width,f=Le.height,g=Le.ratio,i=Ec.height()-(Nd?ye.height():0);return q(d)&&(qe.addClass(ub).css({width:d,minWidth:Le.minwidth||0,maxWidth:Le.maxwidth||ad}),d=Le.W=Le.w=qe.width(),Le.nw=Nd&&p(e.navwidth,d)||d,e.glimpse&&(Le.w-=Math.round(2*(p(e.glimpse,d)||0))),se.css({width:Le.w,marginLeft:(Le.W-Le.w)/2}),f=p(f,i),f=f||g&&d/g,f&&(d=Math.round(d),f=Le.h=Math.round(h(f,p(Le.minheight,i),p(Le.maxheight,i))),re.stop().animate({width:d,height:f},b,function(){qe.removeClass(ub)}),cd(),Nd&&(ye.stop().animate({width:Le.nw},b),Rc({guessIndex:Je,time:b,keep:!0}),Od&&wc.nav&&Oc(b)),$d=c||!0,xd())),Se=re.offset().left,this},ie.setOptions=function(a){return d.extend(e,a),vd(),this},ie.shuffle=function(){return yd&&O(yd)&&vd(),this},ie.destroy=function(){return ie.cancelFullScreen(),ie.stopAutoplay(),yd=ie.data=null,j(),Ed=[],bd(Xc),vd.ok=!1,this},ie.playVideo=function(){var a=Dd,b=a.video,c=Je;return"object"==typeof b&&a.videoReady&&(Rd&&ie.fullScreen&&ie.cancelFullScreen(),G(function(){return!vc.is()||c!==Je},function(){c===Je&&(a.$video=a.$video||d(d.Fotorama.jst.video(b)),a.$video.appendTo(a[Xc]),qe.addClass(nb),Cd=a.$video,o(),we.blur(),De.blur(),fd("loadvideo"))})),this},ie.stopVideo=function(){return md(Cd,!0,!0),this},re.on("mousemove",od),Me=db(se,{onStart:gd,onMove:function(a,b){ld(re,b.edge)},onTouchEnd:hd,onEnd:function(a){ld(re);var b=(Nc&&!ge||a.touch)&&e.arrows&&"always"!==e.arrows;if(a.moved||b&&a.pos!==a.newPos&&!a.control){var c=s(a.newPos,Le.w,e.margin,Fd);ie.show({index:c,time:Sd?Vd:a.time,overPos:a.overPos,user:!0})}else a.aborted||a.control||qd(a.startEvent,b)},timeLow:1,timeHigh:1,friction:2,select:"."+Xb+", ."+Xb+" *",$wrap:re}),Oe=db(ze,{onStart:gd,onMove:function(a,b){ld(ye,b.edge)},onTouchEnd:hd,onEnd:function(a){function b(){Rc.l=a.newPos,id(),jd(),uc(a.newPos,!0)}if(a.moved)a.pos!==a.newPos?(ce=!0,_(ze,{time:a.time,pos:a.newPos,overPos:a.overPos,onEnd:b}),uc(a.newPos),Xd&&ld(ye,K(a.newPos,Oe.min,Oe.max))):b();else{var c=a.$target.closest("."+Mb,ze)[0];c&&sd.call(c,a.startEvent)}},timeLow:.5,timeHigh:2,friction:5,$wrap:ye}),Ne=eb(re,{shift:!0,onEnd:function(a,b){gd(),hd(),ie.show({index:b,slow:a.altKey})}}),Pe=eb(ye,{onEnd:function(a,b){gd(),hd();var c=v(ze)+.25*b;ze.css(k(h(c,Oe.min,Oe.max))),Xd&&ld(ye,K(c,Oe.min,Oe.max)),Pe.prevent={"<":c>=Oe.max,">":c<=Oe.min},clearTimeout(Pe.t),Pe.t=setTimeout(function(){Rc.l=c,uc(c,!0)},Pc),uc(c)}}),qe.hover(function(){setTimeout(function(){fe||nd(!(ge=!0))},0)},function(){ge&&nd(!(ge=!1))}),M(we,function(a){Y(a),td.call(this,a)},{onStart:function(){gd(),Me.control=!0},onTouchEnd:hd}),we.each(function(){W(this,function(a){td.call(this,a)}),ud(this)}),W(Ee,ie.toggleFullScreen),ud(Ee),d.each("load push pop shift unshift reverse sort splice".split(" "),function(a,b){ie[b]=function(){return yd=yd||[],"load"!==b?Array.prototype[b].apply(yd,arguments):arguments[0]&&"object"==typeof arguments[0]&&arguments[0].length&&(yd=P(arguments[0])),vd(),ie}}),vd()},d.fn.fotorama=function(b){return this.each(function(){var c=this,e=d(this),f=e.data(),g=f.fotorama;g?g.setOptions(b,!0):G(function(){return!E(c)},function(){f.urtext=e.html(),new d.Fotorama(e,d.extend({},cd,a.fotoramaDefaults,b,f))})})},d.Fotorama.instances=[],d.Fotorama.cache={},d.Fotorama.measures={},d=d||{},d.Fotorama=d.Fotorama||{},d.Fotorama.jst=d.Fotorama.jst||{},d.Fotorama.jst.style=function(a){{var b,c="";tc.escape}return c+=".fotorama"+(null==(b=a.s)?"":b)+" .fotorama__nav--thumbs .fotorama__nav__frame{\npadding:"+(null==(b=a.m)?"":b)+"px;\nheight:"+(null==(b=a.h)?"":b)+"px}\n.fotorama"+(null==(b=a.s)?"":b)+" .fotorama__thumb-border{\nheight:"+(null==(b=a.h-a.b*(a.q?0:2))?"":b)+"px;\nborder-width:"+(null==(b=a.b)?"":b)+"px;\nmargin-top:"+(null==(b=a.m)?"":b)+"px}"},d.Fotorama.jst.video=function(a){function b(){c+=d.call(arguments,"")}var c="",d=(tc.escape,Array.prototype.join);return c+='
    \n'},d(function(){d("."+ib+':not([data-auto="false"])').fotorama()})}(window,document,location,"undefined"!=typeof jQuery&&jQuery); \ No newline at end of file diff --git a/media/system/js/associations-edit-uncompressed.js b/media/system/js/associations-edit-uncompressed.js new file mode 100644 index 0000000000000..683f89470151e --- /dev/null +++ b/media/system/js/associations-edit-uncompressed.js @@ -0,0 +1,97 @@ +/** + * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/** + * Edit Associations javascript behavior + * + * Used for editing associations in the backend. + * + * @package Joomla + * @since __DEPLOY_VERSION__ + */ + +window.hideAssociation = function(formControl, languageCode) +{ + jQuery('#associations .control-group').each(function() + { + // Current selected language. Hide it. + if (jQuery(this).find('.control-label label').attr('for').replace('_id', '') == formControl + '_associations_' + languageCode.replace('-', '_')) + { + jQuery(this).hide(); + } + }); +} + +window.showAssociationMessage = function() +{ + jQuery('#associations .control-group').hide(); + jQuery('#associations').prepend('
    ' + Joomla.JText._('JGLOBAL_ASSOC_NOT_POSSIBLE') + '
    '); +} + +!(function() +{ + jQuery(document).ready(function($) + { + var associationsEditOptions = Joomla.getOptions('system.associations.edit'), formControl = associationsEditOptions.formControl || 'jform'; + + // Hide the associations tab if needed. + if (associationsEditOptions.hidden == 1) + { + window.showAssociationMessage(); + } + // Hide only the associations for the current language. + else + { + window.hideAssociation(formControl, $('#' + formControl + '_language').val()); + } + + // When changing the language. + $('#' + formControl + '_language').on('change', function(event) + { + // Remove message if any. + Joomla.removeMessages(); + $('#associations-notice').remove(); + + var existsAssociations = false; + + // For each language, remove the associations, ie, empty the associations fields and reset the buttons to Select/Create. + $('#associations .control-group').each(function() + { + var languageCode = $(this).find('.control-label label').attr('for').replace('_id', '').replace('jform_associations_', ''); + + // Show the association fields. + $(this).show(); + + // Check if there was an association selected for this language. + if (!existsAssociations && $('#' + formControl + '_associations_' + languageCode + '_id').val() !== '') + { + existsAssociations = true; + } + + // Call the modal clear button. + $('#' + formControl + '_associations_' + languageCode + '_clear').click(); + }); + + // If associations existed, send a warning to the user. + if (existsAssociations) + { + Joomla.renderMessages({warning: [Joomla.JText._('JGLOBAL_ASSOCIATIONS_RESET_WARNING')]}); + } + + var selectedLanguage = $(this).val(); + + // If the selected language is All hide the fields and add a message. + if (selectedLanguage == '*') + { + window.showAssociationMessage(); + } + // Else show the associations fields/buttons and hide the current selected language. + else + { + window.hideAssociation(formControl, selectedLanguage); + } + }); + }); +})(window, document, Joomla); diff --git a/media/system/js/associations-edit.js b/media/system/js/associations-edit.js new file mode 100644 index 0000000000000..ea17b04783700 --- /dev/null +++ b/media/system/js/associations-edit.js @@ -0,0 +1 @@ +window.hideAssociation=function(o,i){jQuery("#associations .control-group").each(function(){jQuery(this).find(".control-label label").attr("for").replace("_id","")==o+"_associations_"+i.replace("-","_")&&jQuery(this).hide()})},window.showAssociationMessage=function(){jQuery("#associations .control-group").hide(),jQuery("#associations").prepend('
    '+Joomla.JText._("JGLOBAL_ASSOC_NOT_POSSIBLE")+"
    ")},!function(){jQuery(document).ready(function(o){var i=Joomla.getOptions("system.associations.edit"),s=i.formControl||"jform";1==i.hidden?window.showAssociationMessage():window.hideAssociation(s,o("#"+s+"_language").val()),o("#"+s+"_language").on("change",function(){Joomla.removeMessages(),o("#associations-notice").remove();var i=!1;o("#associations .control-group").each(function(){var a=o(this).find(".control-label label").attr("for").replace("_id","").replace("jform_associations_","");o(this).show(),i||""===o("#"+s+"_associations_"+a+"_id").val()||(i=!0),o("#"+s+"_associations_"+a+"_clear").click()}),i&&Joomla.renderMessages({warning:[Joomla.JText._("JGLOBAL_ASSOCIATIONS_RESET_WARNING")]});var a=o(this).val();"*"==a?window.showAssociationMessage():window.hideAssociation(s,a)})})}(window,document,Joomla); diff --git a/media/system/js/core-uncompressed.js b/media/system/js/core-uncompressed.js index f93e322b2f9f2..856abdf5dcfb5 100644 --- a/media/system/js/core-uncompressed.js +++ b/media/system/js/core-uncompressed.js @@ -316,10 +316,10 @@ Joomla.editors.instances = Joomla.editors.instances || {}; }; /** - * Treat AJAX jQuery errors. + * Treat AJAX errors. * Used by some javascripts such as sendtestmail.js and permissions.js * - * @param object jqXHR jQuery XHR object. See http://api.jquery.com/jQuery.ajax/#jqXHR + * @param object xhr XHR object. * @param string textStatus Type of error that occurred. * @param string error Textual portion of the HTTP status. * @@ -327,13 +327,14 @@ Joomla.editors.instances = Joomla.editors.instances || {}; * * @since 3.6.0 */ - Joomla.ajaxErrorsMessages = function( jqXHR, textStatus, error ) { + Joomla.ajaxErrorsMessages = function( xhr, textStatus, error ) { var msg = {}; - if (textStatus == 'parsererror') + // For jQuery jqXHR + if (textStatus === 'parsererror') { // Html entity encode. - var encodedJson = jqXHR.responseText.trim(); + var encodedJson = xhr.responseText.trim(); var buf = []; for (var i = encodedJson.length-1; i >= 0; i--) { @@ -344,21 +345,30 @@ Joomla.editors.instances = Joomla.editors.instances || {}; msg.error = [ Joomla.JText._('JLIB_JS_AJAX_ERROR_PARSE').replace('%s', encodedJson) ]; } - else if (textStatus == 'nocontent') + else if (textStatus === 'nocontent') { msg.error = [ Joomla.JText._('JLIB_JS_AJAX_ERROR_NO_CONTENT') ]; } - else if (textStatus == 'timeout') + else if (textStatus === 'timeout') { msg.error = [ Joomla.JText._('JLIB_JS_AJAX_ERROR_TIMEOUT') ]; } - else if (textStatus == 'abort') + else if (textStatus === 'abort') { msg.error = [ Joomla.JText._('JLIB_JS_AJAX_ERROR_CONNECTION_ABORT') ]; } + // For vannila XHR + else if (xhr.responseJSON && xhr.responseJSON.message) + { + msg.error = [ Joomla.JText._('JLIB_JS_AJAX_ERROR_OTHER').replace('%s', xhr.status) + ' ' + xhr.responseJSON.message + '' ]; + } + else if (xhr.statusText) + { + msg.error = [ Joomla.JText._('JLIB_JS_AJAX_ERROR_OTHER').replace('%s', xhr.status) + ' ' + xhr.statusText + '' ]; + } else { - msg.error = [ Joomla.JText._('JLIB_JS_AJAX_ERROR_OTHER').replace('%s', jqXHR.status) ]; + msg.error = [ Joomla.JText._('JLIB_JS_AJAX_ERROR_OTHER').replace('%s', xhr.status) ]; } return msg; diff --git a/media/system/js/core.js b/media/system/js/core.js index 15cf0e91f8fea..d58fd89f6a654 100644 --- a/media/system/js/core.js +++ b/media/system/js/core.js @@ -1 +1 @@ -Joomla=window.Joomla||{};Joomla.editors=Joomla.editors||{};Joomla.editors.instances=Joomla.editors.instances||{};(function(Joomla,document){"use strict";Joomla.submitform=function(task,form,validate){if(!form){form=document.getElementById("adminForm")}if(task){form.task.value=task}form.noValidate=!validate;form.setAttribute("novalidate",!validate);var button=document.createElement("input");button.style.display="none";button.type="submit";form.appendChild(button).click();form.removeChild(button)};Joomla.submitbutton=function(pressbutton){Joomla.submitform(pressbutton)};Joomla.JText={strings:{},_:function(key,def){var newStrings=Joomla.getOptions("joomla.jtext");if(newStrings){this.load(newStrings);Joomla.loadOptions({"joomla.jtext":null})}def=def===undefined?"":def;key=key.toUpperCase();return this.strings[key]!==undefined?this.strings[key]:def},load:function(object){for(var key in object){if(!object.hasOwnProperty(key))continue;this.strings[key.toUpperCase()]=object[key]}return this}};Joomla.optionsStorage=Joomla.optionsStorage||null;Joomla.getOptions=function(key,def){if(!Joomla.optionsStorage){Joomla.loadOptions()}return Joomla.optionsStorage[key]!==undefined?Joomla.optionsStorage[key]:def};Joomla.loadOptions=function(options){if(!options){var elements=document.querySelectorAll(".joomla-script-options.new"),str,element,option;for(var i=0,l=elements.length;i=0;i--){messageWrapper=document.createElement("div");messageWrapper.innerHTML=typeMessages[i];messagesBox.appendChild(messageWrapper)}messageContainer.appendChild(messagesBox)}};Joomla.removeMessages=function(){var messageContainer=document.getElementById("system-message-container");while(messageContainer.firstChild)messageContainer.removeChild(messageContainer.firstChild);messageContainer.style.display="none";messageContainer.offsetHeight;messageContainer.style.display=""};Joomla.ajaxErrorsMessages=function(jqXHR,textStatus,error){var msg={};if(textStatus=="parsererror"){var encodedJson=jqXHR.responseText.trim();var buf=[];for(var i=encodedJson.length-1;i>=0;i--){buf.unshift(["&#",encodedJson[i].charCodeAt(),";"].join(""))}encodedJson=buf.join("");msg.error=[Joomla.JText._("JLIB_JS_AJAX_ERROR_PARSE").replace("%s",encodedJson)]}else if(textStatus=="nocontent"){msg.error=[Joomla.JText._("JLIB_JS_AJAX_ERROR_NO_CONTENT")]}else if(textStatus=="timeout"){msg.error=[Joomla.JText._("JLIB_JS_AJAX_ERROR_TIMEOUT")]}else if(textStatus=="abort"){msg.error=[Joomla.JText._("JLIB_JS_AJAX_ERROR_CONNECTION_ABORT")]}else{msg.error=[Joomla.JText._("JLIB_JS_AJAX_ERROR_OTHER").replace("%s",jqXHR.status)]}return msg};Joomla.isChecked=function(isitchecked,form){if(typeof form==="undefined"){form=document.getElementById("adminForm")}form.boxchecked.value=isitchecked?parseInt(form.boxchecked.value)+1:parseInt(form.boxchecked.value)-1;if(!form.elements["checkall-toggle"])return;var c=true,i,e,n;for(i=0,n=form.elements.length;i",hasSelection=key==orig_key,i=0,selected,x,item;for(x in source){if(!source.hasOwnProperty(x)){continue}item=source[x];if(item[0]!=key){continue}selected="";if(hasSelection&&orig_val==item[1]||!hasSelection&&i===0){selected='selected="selected"'}html+='";i++}html+="";if(element){element.innerHTML=html}else{document.writeln(html)}};window.changeDynaList=function(listname,source,key,orig_key,orig_val){var list=document.adminForm[listname],hasSelection=key==orig_key,i,x,item,opt;while(list.firstChild)list.removeChild(list.firstChild);i=0;for(x in source){if(!source.hasOwnProperty(x)){continue}item=source[x];if(item[0]!=key){continue}opt=new Option;opt.value=item[1];opt.text=item[2];if(hasSelection&&orig_val==opt.value||!hasSelection&&i===0){opt.selected=true}list.options[i++]=opt}list.length=i};window.radioGetCheckedValue=function(radioObj){if(!radioObj){return""}var n=radioObj.length,i;if(n===undefined){return radioObj.checked?radioObj.value:""}for(i=0;i-1){return srcList.options[i].value}else{return null}};window.listItemTask=function(id,task){var f=document.adminForm,i=0,cbx,cb=f[id];if(!cb)return false;while(true){cbx=f["cb"+i];if(!cbx)break;cbx.checked=false;i++}cb.checked=true;f.boxchecked.value=1;window.submitform(task);return false};window.submitbutton=function(pressbutton){Joomla.submitbutton(pressbutton)};window.submitform=function(pressbutton){Joomla.submitform(pressbutton)};window.saveorder=function(n,task){window.checkAll_button(n,task)};window.checkAll_button=function(n,task){task=task?task:"saveorder";var j,box;for(j=0;j<=n;j++){box=document.adminForm["cb"+j];if(box){box.checked=true}else{alert("You cannot change the order of items, as an item in the list is `Checked Out`");return}}Joomla.submitform(task)};Joomla.loadingLayer=function(task,parentElement){task=task||"show";parentElement=parentElement||document.body;if(task=="load"){var basePath=document.getElementsByTagName("body")[0].getAttribute("data-basepath")||"";var loadingDiv=document.createElement("div");loadingDiv.id="loading-logo";loadingDiv.style["position"]="fixed";loadingDiv.style["top"]="0";loadingDiv.style["left"]="0";loadingDiv.style["width"]="100%";loadingDiv.style["height"]="100%";loadingDiv.style["opacity"]="0.8";loadingDiv.style["filter"]="alpha(opacity=80)";loadingDiv.style["overflow"]="hidden";loadingDiv.style["z-index"]="10000";loadingDiv.style["display"]="none";loadingDiv.style["background-color"]="#fff";loadingDiv.style["background-image"]='url("'+basePath+'/media/jui/images/ajax-loader.gif")';loadingDiv.style["background-position"]="center";loadingDiv.style["background-repeat"]="no-repeat";loadingDiv.style["background-attachment"]="fixed";parentElement.appendChild(loadingDiv)}else{if(!document.getElementById("loading-logo")){Joomla.loadingLayer("load",parentElement)}document.getElementById("loading-logo").style["display"]=task=="show"?"block":"none"}return document.getElementById("loading-logo")};Joomla.extend=function(destination,source){for(var p in source){if(source.hasOwnProperty(p)){destination[p]=source[p]}}return destination};Joomla.request=function(options){options=Joomla.extend({url:"",method:"GET",data:null,perform:true},options);options.method=options.data?"POST":options.method;try{var xhr=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0");xhr.open(options.method,options.url,true);xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("X-Ajax-Engine","Joomla!");if(options.method==="POST"&&(!options.headers||!options.headers["Content-Type"])){xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}if(options.headers){for(var p in options.headers){if(options.headers.hasOwnProperty(p)){xhr.setRequestHeader(p,options.headers[p])}}}xhr.onreadystatechange=function(){if(xhr.readyState!==4)return;if(xhr.status===200){if(options.onSuccess){options.onSuccess.call(window,xhr.responseText,xhr)}}else if(options.onError){options.onError.call(window,xhr)}};if(options.perform){if(options.onBefore&&options.onBefore.call(window,xhr)===false){return xhr}xhr.send(options.data)}}catch(error){window.console?console.log(error):null;return false}return xhr}})(Joomla,document); \ No newline at end of file +Joomla=window.Joomla||{},Joomla.editors=Joomla.editors||{},Joomla.editors.instances=Joomla.editors.instances||{},function(e,t){"use strict";e.submitform=function(e,o,n){o||(o=t.getElementById("adminForm")),e&&(o.task.value=e),o.noValidate=!n,o.setAttribute("novalidate",!n);var r=t.createElement("input");r.style.display="none",r.type="submit",o.appendChild(r).click(),o.removeChild(r)},e.submitbutton=function(t){e.submitform(t)},e.JText={strings:{},_:function(t,o){var n=e.getOptions("joomla.jtext");return n&&(this.load(n),e.loadOptions({"joomla.jtext":null})),o=void 0===o?"":o,t=t.toUpperCase(),void 0!==this.strings[t]?this.strings[t]:o},load:function(e){for(var t in e)e.hasOwnProperty(t)&&(this.strings[t.toUpperCase()]=e[t]);return this}},e.optionsStorage=e.optionsStorage||null,e.getOptions=function(t,o){return e.optionsStorage||e.loadOptions(),void 0!==e.optionsStorage[t]?e.optionsStorage[t]:o},e.loadOptions=function(o){if(o)if(e.optionsStorage)for(var n in o)o.hasOwnProperty(n)&&(e.optionsStorage[n]=o[n]);else e.optionsStorage=o;else for(var r,a,i,s=t.querySelectorAll(".joomla-script-options.new"),l=0,d=s.length;d>l;l++)a=s[l],r=a.text||a.textContent,i=JSON.parse(r),i?e.loadOptions(i):null,a.className=a.className.replace(" new"," loaded")},e.replaceTokens=function(e){if(/^[0-9A-F]{32}$/i.test(e)){var o,n,r,a=t.getElementsByTagName("input");for(o=0,r=a.length;r>o;o++)n=a[o],"hidden"==n.type&&"1"==n.value&&32==n.name.length&&(n.name=e)}},e.isEmail=function(e){var t=/^[\w.!#$%&‚Äô*+\/=?^`{|}~-]+@[a-z0-9-]+(?:\.[a-z0-9-]{2,})+$/i;return t.test(e)},e.checkAll=function(e,t){if(!e.form)return!1;t=t?t:"cb";var o,n,r,a=0;for(o=0,r=e.form.elements.length;r>o;o++)n=e.form.elements[o],n.type==e.type&&0===n.id.indexOf(t)&&(n.checked=e.checked,a+=n.checked?1:0);return e.form.boxchecked&&(e.form.boxchecked.value=a),!0},e.renderMessages=function(o){e.removeMessages();var n,r,a,i,s,l,d,c,u=t.getElementById("system-message-container");for(n in o)if(o.hasOwnProperty(n)){r=o[n],a=t.createElement("div"),c="notice"==n?"alert-info":"alert-"+n,c="message"==n?"alert-success":c,a.className="alert "+c;var m=t.createElement("button");for(m.setAttribute("type","button"),m.setAttribute("data-dismiss","alert"),m.className="close",m.innerHTML="×",a.appendChild(m),i=e.JText._(n),"undefined"!=typeof i&&(s=t.createElement("h4"),s.className="alert-heading",s.innerHTML=e.JText._(n),a.appendChild(s)),l=r.length-1;l>=0;l--)d=t.createElement("div"),d.innerHTML=r[l],a.appendChild(d);u.appendChild(a)}},e.removeMessages=function(){for(var e=t.getElementById("system-message-container");e.firstChild;)e.removeChild(e.firstChild);e.style.display="none",e.offsetHeight,e.style.display=""},e.ajaxErrorsMessages=function(t,o){var n={};if("parsererror"===o){for(var r=t.responseText.trim(),a=[],i=r.length-1;i>=0;i--)a.unshift(["&#",r[i].charCodeAt(),";"].join(""));r=a.join(""),n.error=[e.JText._("JLIB_JS_AJAX_ERROR_PARSE").replace("%s",r)]}else"nocontent"===o?n.error=[e.JText._("JLIB_JS_AJAX_ERROR_NO_CONTENT")]:"timeout"===o?n.error=[e.JText._("JLIB_JS_AJAX_ERROR_TIMEOUT")]:"abort"===o?n.error=[e.JText._("JLIB_JS_AJAX_ERROR_CONNECTION_ABORT")]:t.responseJSON&&t.responseJSON.message?n.error=[e.JText._("JLIB_JS_AJAX_ERROR_OTHER").replace("%s",t.status)+" "+t.responseJSON.message+""]:t.statusText?n.error=[e.JText._("JLIB_JS_AJAX_ERROR_OTHER").replace("%s",t.status)+" "+t.statusText+""]:n.error=[e.JText._("JLIB_JS_AJAX_ERROR_OTHER").replace("%s",t.status)];return n},e.isChecked=function(e,o){if("undefined"==typeof o&&(o=t.getElementById("adminForm")),o.boxchecked.value=e?parseInt(o.boxchecked.value)+1:parseInt(o.boxchecked.value)-1,o.elements["checkall-toggle"]){var n,r,a,i=!0;for(n=0,a=o.elements.length;a>n;n++)if(r=o.elements[n],"checkbox"==r.type&&"checkall-toggle"!=r.name&&!r.checked){i=!1;break}o.elements["checkall-toggle"].checked=i}},e.popupWindow=function(e,t,o,n,r){var a=(screen.width-o)/2,i=(screen.height-n)/2,s="height="+n+",width="+o+",top="+i+",left="+a+",scrollbars="+r+",resizable";window.open(e,t,s).window.focus()},e.tableOrdering=function(o,n,r,a){"undefined"==typeof a&&(a=t.getElementById("adminForm")),a.filter_order.value=o,a.filter_order_Dir.value=n,e.submitform(r,a)},window.writeDynaList=function(e,o,n,r,a,i){var s,l,d,c="",i?i.innerHTML=c:t.writeln(c)},window.changeDynaList=function(e,o,n,r,a){for(var i,s,l,d,c=t.adminForm[e],u=n==r;c.firstChild;)c.removeChild(c.firstChild);i=0;for(s in o)o.hasOwnProperty(s)&&(l=o[s],l[0]==n&&(d=new Option,d.value=l[1],d.text=l[2],(u&&a==d.value||!u&&0===i)&&(d.selected=!0),c.options[i++]=d));c.length=i},window.radioGetCheckedValue=function(e){if(!e)return"";var t,o=e.length;if(void 0===o)return e.checked?e.value:"";for(t=0;o>t;t++)if(e[t].checked)return e[t].value;return""},window.getSelectedValue=function(e,o){var n=t[e][o],r=n.selectedIndex;return null!==r&&r>-1?n.options[r].value:null},window.listItemTask=function(e,o){var n,r=t.adminForm,a=0,i=r[e];if(!i)return!1;for(;;){if(n=r["cb"+a],!n)break;n.checked=!1,a++}return i.checked=!0,r.boxchecked.value=1,window.submitform(o),!1},window.submitbutton=function(t){e.submitbutton(t)},window.submitform=function(t){e.submitform(t)},window.saveorder=function(e,t){window.checkAll_button(e,t)},window.checkAll_button=function(o,n){n=n?n:"saveorder";var r,a;for(r=0;o>=r;r++){if(a=t.adminForm["cb"+r],!a)return void alert("You cannot change the order of items, as an item in the list is `Checked Out`");a.checked=!0}e.submitform(n)},e.loadingLayer=function(o,n){if(o=o||"show",n=n||t.body,"load"==o){var r=t.getElementsByTagName("body")[0].getAttribute("data-basepath")||"",a=t.createElement("div");a.id="loading-logo",a.style.position="fixed",a.style.top="0",a.style.left="0",a.style.width="100%",a.style.height="100%",a.style.opacity="0.8",a.style.filter="alpha(opacity=80)",a.style.overflow="hidden",a.style["z-index"]="10000",a.style.display="none",a.style["background-color"]="#fff",a.style["background-image"]='url("'+r+'/media/jui/images/ajax-loader.gif")',a.style["background-position"]="center",a.style["background-repeat"]="no-repeat",a.style["background-attachment"]="fixed",n.appendChild(a)}else t.getElementById("loading-logo")||e.loadingLayer("load",n),t.getElementById("loading-logo").style.display="show"==o?"block":"none";return t.getElementById("loading-logo")},e.extend=function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);return e},e.request=function(t){t=e.extend({url:"",method:"GET",data:null,perform:!0},t),t.method=t.data?"POST":t.method;try{var o=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0");if(o.open(t.method,t.url,!0),o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.setRequestHeader("X-Ajax-Engine","Joomla!"),"POST"!==t.method||t.headers&&t.headers["Content-Type"]||o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.headers)for(var n in t.headers)t.headers.hasOwnProperty(n)&&o.setRequestHeader(n,t.headers[n]);if(o.onreadystatechange=function(){4===o.readyState&&(200===o.status?t.onSuccess&&t.onSuccess.call(window,o.responseText,o):t.onError&&t.onError.call(window,o))},t.perform){if(t.onBefore&&t.onBefore.call(window,o)===!1)return o;o.send(t.data)}}catch(r){return window.console?console.log(r):null,!1}return o}}(Joomla,document); diff --git a/media/system/js/keepalive-uncompressed.js b/media/system/js/keepalive-uncompressed.js index 7e5b3e0702946..8058e603177d6 100644 --- a/media/system/js/keepalive-uncompressed.js +++ b/media/system/js/keepalive-uncompressed.js @@ -29,7 +29,7 @@ }, onError: function(xhr) { - Joomla.renderMessages(Joomla.ajaxErrorsMessages(xhr)); + // Do nothing } }); }, keepaliveInterval); diff --git a/media/system/js/keepalive.js b/media/system/js/keepalive.js index 57ad930330936..568cf932b9482 100644 --- a/media/system/js/keepalive.js +++ b/media/system/js/keepalive.js @@ -1 +1 @@ -!function(){"use strict";document.addEventListener("DOMContentLoaded",function(){var e=Joomla.getOptions("system.keepalive"),o=e.uri?e.uri.replace(/&/g,"&"):window.location.pathname,n=e.interval?e.interval:45e3;window.setInterval(function(){Joomla.request({url:o,onSuccess:function(){},onError:function(e){Joomla.renderMessages(Joomla.ajaxErrorsMessages(e))}})},n)})}(window,document,Joomla); +!function(){"use strict";document.addEventListener("DOMContentLoaded",function(){var n=Joomla.getOptions("system.keepalive"),e=n.uri?n.uri.replace(/&/g,"&"):window.location.pathname,o=n.interval?n.interval:45e3;window.setInterval(function(){Joomla.request({url:e,onSuccess:function(){},onError:function(){}})},o)})}(window,document,Joomla); diff --git a/media/system/js/moduleorder.js b/media/system/js/moduleorder.js index be2af9344f5a0..0aac1a85bd541 100644 --- a/media/system/js/moduleorder.js +++ b/media/system/js/moduleorder.js @@ -7,7 +7,7 @@ $linkedField = $field.data('linked-field') ? $field.data('linked-field') : 'jform_position', $linkedFieldEl = $('#' + $linkedField), $originalOrder = $field.data('ordering'), - $originalPos = $linkedFieldEl.chosen().val(), + $originalPos = $linkedFieldEl.val(), $name = $field.data('name'), $attr = $field.data('client-attr') ? $field.data('client-attr') : '', $id = $field.attr('id') + '_1', @@ -41,7 +41,7 @@ // Add chosen to the element var $el = $("#" + $id); - if ($el) { + if ($el.length && $el.data('chosen') && $.fn.chosen) { $el.chosen('destroy'); $el.chosen(); } @@ -61,8 +61,8 @@ getNewOrder(); // Event listener for the linked field - $linkedFieldEl.chosen().change( function() { - $originalPos = $('#' + $linkedField).chosen().val(); + $linkedFieldEl.change( function() { + $originalPos = $('#' + $linkedField).val(); getNewOrder(); }); }); diff --git a/media/system/js/tabs-state.js b/media/system/js/tabs-state.js index dbbcf98457bee..62951f753c5ac 100644 --- a/media/system/js/tabs-state.js +++ b/media/system/js/tabs-state.js @@ -11,15 +11,20 @@ jQuery(function($) { var loadTabs = function() { function saveActiveTab(href) { - if (activeTabsHrefs === null) { - activeTabsHrefs = []; + // Remove the old entry if exists, key is always dependant on the url + // This should be removed in the future + if (localStorage.getItem('active-tab')) { + localStorage.removeItem('active-tab'); } + // Reset the array + activeTabsHrefs = []; + // Save clicked tab href to the array activeTabsHrefs.push(href); - // Store the selected tabs hrefs in localstorage - localStorage.setItem('active-tabs', JSON.stringify(activeTabsHrefs)); + // Store the selected tabs hrefs in localStorage + localStorage.setItem(window.location.href.toString().split(window.location.host)[1].replace(/&return=[a-zA-Z0-9%]+/, '').replace(/&[a-zA-Z-_]+=[0-9]+/, ''), JSON.stringify(activeTabsHrefs)); } function activateTab(href) { @@ -31,7 +36,7 @@ jQuery(function($) { } // Array with active tabs hrefs - var activeTabsHrefs = JSON.parse(localStorage.getItem('active-tabs')); + var activeTabsHrefs = JSON.parse(localStorage.getItem(window.location.href.toString().split(window.location.host)[1].replace(/&return=[a-zA-Z0-9%]+/, '').replace(/&[a-zA-Z-_]+=[0-9]+/, ''))); // jQuery object with all tabs links var $tabs = $('a[data-toggle="tab"]'); @@ -47,7 +52,7 @@ jQuery(function($) { // When moving from tab area to a different view $.each(activeTabsHrefs, function(index, tabHref) { if (!hasTab(tabHref)) { - localStorage.removeItem('active-tabs'); + localStorage.removeItem(window.location.href.toString().split(window.location.host)[1].replace(/&return=[a-zA-Z0-9%]+/, '').replace(/&[a-zA-Z-_]+=[0-9]+/, '')); return true; } diff --git a/media/system/js/tinymce-init.js b/media/system/js/tinymce-init.js index d38978039dc76..e477f8af15896 100644 --- a/media/system/js/tinymce-init.js +++ b/media/system/js/tinymce-init.js @@ -56,8 +56,8 @@ options.target = element; } - if (options.setupCallbacString && !options.setup) { - options.setup = new Function('editor', options.setupCallbacString); + if (options.setupCallbackString && !options.setup) { + options.setup = new Function('editor', options.setupCallbackString); } tinyMCE.init(options); diff --git a/media/system/js/tinymce-init.min.js b/media/system/js/tinymce-init.min.js index 54f7a622a2118..e13eac0342b5e 100644 --- a/media/system/js/tinymce-init.min.js +++ b/media/system/js/tinymce-init.min.js @@ -1 +1 @@ -!function(a,b,c,d){"use strict";c.getSize=c.getSize||function(){return{x:c.innerWidth,y:c.innerHeight}},c.jInsertEditorText=function(b,c){a.activeEditor.execCommand("mceInsertContent",!1,b)};var e={setupEditors:function(a){a=a||d;for(var c=b.getOptions?b.getOptions("plg_editor_tinymce",{}):b.optionsStorage.plg_editor_tinymce||{},e=a.querySelectorAll(".joomla-editor-tinymce"),f=0,g=e.length;fu;u++)jQuery(e[u]).hasClass("novalidate")||l(e[u])===!1&&(o=!1,d.push(e[u]));if(jQuery.each(a,function(t,e){e.exec()!==!0&&(o=!1)}),!o&&d.length>0){for(r=Joomla.JText._("JLIB_FORM_FIELD_INVALID"),n={error:[]},u=d.length-1;u>=0;u--)i=jQuery(d[u]).data("label"),i&&n.error.push(r+i.text().replace("*",""));Joomla.renderMessages(n)}return o},s=function(t){var a,r=[],n=jQuery(t);a=n.find("input, textarea, select, fieldset, button");for(var i=0,s=a.length;s>i;i++){var o=jQuery(a[i]),d=o.prop("tagName").toLowerCase();"input"!==d&&"button"!==d||"submit"!==o.attr("type")&&"image"!==o.attr("type")?"button"===d||"input"===d&&"button"===o.attr("type")||(o.hasClass("required")&&o.attr("aria-required","true").attr("required","required"),"fieldset"!==d&&(o.on("blur",function(){return l(this)}),o.hasClass("validate-email")&&e&&a[i].setAttribute("type","email")),r.push(o)):o.hasClass("validate")&&o.on("click",function(){return u(t)})}n.data("inputfields",r)},o=function(){t={},a=a||{},e=function(){var t=document.createElement("input");return t.setAttribute("type","email"),"text"!==t.type}(),r("username",function(t,e){var a=new RegExp("[<|>|\"|'|%|;|(|)|&]","i");return!a.test(t)}),r("password",function(t,e){var a=/^\S[\S ]{2,98}\S$/;return a.test(t)}),r("numeric",function(t,e){var a=/^(\d|-)?(\d|,)*\.?\d*$/;return a.test(t)}),r("email",function(t,e){t=punycode.toASCII(t);var a=/^[a-zA-Z0-9.!#$%&’*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return a.test(t)});for(var n=jQuery("form.form-validate"),i=0,l=n.length;l>i;i++)s(n[i])};return o(),{isValid:u,validate:l,setHandler:r,attachToForm:s,custom:a}};document.formvalidator=null,jQuery(function(){document.formvalidator=new JFormValidator}); \ No newline at end of file +var JFormValidator=function(){"use strict";var t,e,a,r=function(e,a,r){r=""===r?!0:r,t[e]={enabled:r,exec:a}},n=function(t,e){var a,r=jQuery(e);return t?(a=r.find("#"+t+"-lbl"),a.length?a:(a=r.find('label[for="'+t+'"]'),a.length?a:!1)):!1},i=function(t,e){var a=e.data("label");void 0===a&&(a=n(e.attr("id"),e.get(0).form),e.data("label",a)),t===!1?(e.addClass("invalid").attr("aria-invalid","true"),a&&a.addClass("invalid")):(e.removeClass("invalid").attr("aria-invalid","false"),a&&a.removeClass("invalid"))},l=function(e){var a,r,n=jQuery(e);if(n.attr("disabled"))return i(!0,n),!0;if(n.attr("required")||n.hasClass("required"))if(a=n.prop("tagName").toLowerCase(),"fieldset"===a&&(n.hasClass("radio")||n.hasClass("checkboxes"))){if(!n.find("input:checked").length)return i(!1,n),!1}else if(!n.val()||n.hasClass("placeholder")||"checkbox"===n.attr("type")&&!n.is(":checked"))return i(!1,n),!1;return r=n.attr("class")&&n.attr("class").match(/validate-([a-zA-Z0-9\_\-]+)/)?n.attr("class").match(/validate-([a-zA-Z0-9\_\-]+)/)[1]:"",""===r?(i(!0,n),!0):r&&"none"!==r&&t[r]&&n.val()&&t[r].exec(n.val(),n)!==!0?(i(!1,n),!1):(i(!0,n),!0)},u=function(t){var e,r,n,i,u,s,o=!0,d=[];for(e=jQuery(t).find("input, textarea, select, fieldset"),u=0,s=e.length;s>u;u++)jQuery(e[u]).hasClass("novalidate")||l(e[u])===!1&&(o=!1,d.push(e[u]));if(jQuery.each(a,function(t,e){e.exec()!==!0&&(o=!1)}),!o&&d.length>0){for(r=Joomla.JText._("JLIB_FORM_FIELD_INVALID"),n={error:[]},u=d.length-1;u>=0;u--)i=jQuery(d[u]).data("label"),i&&n.error.push(r+i.text().replace("*",""));Joomla.renderMessages(n)}return o},s=function(t){var a,r=[],n=jQuery(t);a=n.find("input, textarea, select, fieldset, button");for(var i=0,s=a.length;s>i;i++){var o=jQuery(a[i]),d=o.prop("tagName").toLowerCase();"input"!==d&&"button"!==d||"submit"!==o.attr("type")&&"image"!==o.attr("type")?"button"===d||"input"===d&&"button"===o.attr("type")||(o.hasClass("required")&&o.attr("aria-required","true").attr("required","required"),"fieldset"!==d&&(o.on("blur",function(){return l(this)}),o.hasClass("validate-email")&&e&&a[i].setAttribute("type","email")),r.push(o)):o.hasClass("validate")&&o.on("click",function(){return u(t)})}n.data("inputfields",r)},o=function(){t={},a=a||{},e=function(){var t=document.createElement("input");return t.setAttribute("type","email"),"text"!==t.type}(),r("username",function(t,e){var a=new RegExp("[<|>|\"|'|%|;|(|)|&]","i");return!a.test(t)}),r("password",function(t,e){var a=/^\S[\S ]{2,98}\S$/;return a.test(t)}),r("numeric",function(t,e){var a=/^(\d|-)?(\d|,)*\.?\d*$/;return a.test(t)}),r("email",function(t,e){t=punycode.toASCII(t);var a=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return a.test(t)});for(var n=jQuery("form.form-validate"),i=0,l=n.length;l>i;i++)s(n[i])};return o(),{isValid:u,validate:l,setHandler:r,attachToForm:s,custom:a}};document.formvalidator=null,jQuery(function(){document.formvalidator=new JFormValidator}); \ No newline at end of file diff --git a/modules/mod_articles_category/helper.php b/modules/mod_articles_category/helper.php index a96ceae0bb81a..def005603b9ce 100644 --- a/modules/mod_articles_category/helper.php +++ b/modules/mod_articles_category/helper.php @@ -251,6 +251,8 @@ public static function getList(&$params) foreach ($items as &$item) { $item->slug = $item->id . ':' . $item->alias; + + /** @deprecated Catslug is deprecated, use catid instead. 4.0 **/ $item->catslug = $item->catid . ':' . $item->category_alias; if ($access || in_array($item->access, $authorised)) diff --git a/modules/mod_articles_latest/helper.php b/modules/mod_articles_latest/helper.php index 387cec9015795..014a85b458a6f 100644 --- a/modules/mod_articles_latest/helper.php +++ b/modules/mod_articles_latest/helper.php @@ -115,6 +115,8 @@ public static function getList(&$params) foreach ($items as &$item) { $item->slug = $item->id . ':' . $item->alias; + + /** @deprecated Catslug is deprecated, use catid instead. 4.0 **/ $item->catslug = $item->catid . ':' . $item->category_alias; if ($access || in_array($item->access, $authorised)) diff --git a/modules/mod_articles_news/helper.php b/modules/mod_articles_news/helper.php index 30f88457f2913..9b40b69639185 100644 --- a/modules/mod_articles_news/helper.php +++ b/modules/mod_articles_news/helper.php @@ -77,6 +77,8 @@ public static function getList(&$params) { $item->readmore = strlen(trim($item->fulltext)); $item->slug = $item->id . ':' . $item->alias; + + /** @deprecated Catslug is deprecated, use catid instead. 4.0 **/ $item->catslug = $item->catid . ':' . $item->category_alias; if ($access || in_array($item->access, $authorised)) diff --git a/modules/mod_articles_popular/helper.php b/modules/mod_articles_popular/helper.php index ce21b6eb40e02..08dca69728e49 100644 --- a/modules/mod_articles_popular/helper.php +++ b/modules/mod_articles_popular/helper.php @@ -16,7 +16,10 @@ /** * Helper for mod_articles_popular * - * @since 1.6.0 + * @package Joomla.Site + * @subpackage mod_articles_popular + * + * @since 1.6.0 */ abstract class ModArticlesPopularHelper { @@ -30,10 +33,10 @@ abstract class ModArticlesPopularHelper public static function getList(&$params) { // Get an instance of the generic articles model - $model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); + $model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); // Set application parameters in model - $app = JFactory::getApplication(); + $app = JFactory::getApplication(); $appParams = $app->getParams(); $model->setState('params', $appParams); @@ -74,7 +77,9 @@ public static function getList(&$params) foreach ($items as &$item) { - $item->slug = $item->id . ':' . $item->alias; + $item->slug = $item->id . ':' . $item->alias; + + /** @deprecated Catslug is deprecated, use catid instead. 4.0 **/ $item->catslug = $item->catid . ':' . $item->category_alias; if ($access || in_array($item->access, $authorised)) diff --git a/modules/mod_finder/tmpl/default.php b/modules/mod_finder/tmpl/default.php index 8a0393ac26d78..0790b5e6f274f 100644 --- a/modules/mod_finder/tmpl/default.php +++ b/modules/mod_finder/tmpl/default.php @@ -73,7 +73,7 @@ } } -JHtml::_('stylesheet', 'com_finder/finder.css', false, true, false); +JHtml::_('stylesheet', 'com_finder/finder.css', array('version' => 'auto', 'relative' => true)); $script = " jQuery(document).ready(function() { @@ -128,7 +128,7 @@ */ if ($params->get('show_autosuggest', 1)) { - JHtml::_('script', 'media/jui/js/jquery.autocomplete.min.js', false, false, false, false, true); + JHtml::_('script', 'jui/jquery.autocomplete.min.js', array('version' => 'auto', 'relative' => true)); $script .= " var suggest = jQuery('#mod-finder-searchword" . $module->id . "').autocomplete({ diff --git a/modules/mod_languages/helper.php b/modules/mod_languages/helper.php index 140574d52ecff..97fb6e8d44d31 100644 --- a/modules/mod_languages/helper.php +++ b/modules/mod_languages/helper.php @@ -73,7 +73,7 @@ public static function getList(&$params) } $levels = $user->getAuthorisedViewLevels(); - $sitelangs = JLanguageMultilang::getSiteLangs(); + $sitelangs = JLanguageHelper::getInstalledLanguages(0); $multilang = JLanguageMultilang::isEnabled(); // Filter allowed languages diff --git a/modules/mod_languages/tmpl/default.php b/modules/mod_languages/tmpl/default.php index 6122b92c68e1c..eb4ce77194a75 100644 --- a/modules/mod_languages/tmpl/default.php +++ b/modules/mod_languages/tmpl/default.php @@ -9,7 +9,7 @@ defined('_JEXEC') or die; -JHtml::_('stylesheet', 'mod_languages/template.css', array(), true); +JHtml::_('stylesheet', 'mod_languages/template.css', array('version' => 'auto', 'relative' => true)); if ($params->get('dropdown', 1) && !$params->get('dropdownimage', 0)) { diff --git a/modules/mod_login/mod_login.xml b/modules/mod_login/mod_login.xml index 93a3e213ea6af..cb4f0aafdc32b 100644 --- a/modules/mod_login/mod_login.xml +++ b/modules/mod_login/mod_login.xml @@ -83,7 +83,17 @@
    - + + + + get('username'), ENT_COMPAT, 'UTF-8')); ?>
    + +get('profilelink')) : ?> +
    diff --git a/modules/mod_related_items/helper.php b/modules/mod_related_items/helper.php index 04ee9dbcdb871..47a51f4c6122a 100644 --- a/modules/mod_related_items/helper.php +++ b/modules/mod_related_items/helper.php @@ -117,15 +117,7 @@ public static function getList(&$params) $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $a_id . ' END as slug'; - $query->select($case_when); - $case_when = ' CASE WHEN '; - $case_when .= $query->charLength('cc.alias', '!=', '0'); - $case_when .= ' THEN '; - $c_id = $query->castAsChar('cc.id'); - $case_when .= $query->concatenate(array($c_id, 'cc.alias'), ':'); - $case_when .= ' ELSE '; - $case_when .= $c_id . ' END as catslug'; $query->select($case_when) ->from('#__content AS a') ->join('LEFT', '#__content_frontpage AS f ON f.content_id = a.id') @@ -188,9 +180,11 @@ public static function getList(&$params) foreach ($related as &$item) { $item->slug = $item->id . ':' . $item->alias; + + /** @deprecated Catslug is deprecated, use catid instead. 4.0 **/ $item->catslug = $item->catid . ':' . $item->category_alias; - $item->route = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language)); + $item->route = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language)); } } diff --git a/modules/mod_search/tmpl/default.php b/modules/mod_search/tmpl/default.php index 80d223c6bbb28..9e3bfb4df3e43 100644 --- a/modules/mod_search/tmpl/default.php +++ b/modules/mod_search/tmpl/default.php @@ -11,7 +11,7 @@ // Including fallback code for the placeholder attribute in the search field. JHtml::_('jquery.framework'); -JHtml::_('script', 'system/html5fallback.js', false, true); +JHtml::_('script', 'system/html5fallback.js', array('version' => 'auto', 'relative' => true)); if ($width) { diff --git a/modules/mod_wrapper/tmpl/default.php b/modules/mod_wrapper/tmpl/default.php index 81a843efcd2c8..0e5cbacbd8acf 100644 --- a/modules/mod_wrapper/tmpl/default.php +++ b/modules/mod_wrapper/tmpl/default.php @@ -8,7 +8,8 @@ */ defined('_JEXEC') or die; -JHtml::script('com_wrapper/iframe-height.min.js', false, true); + +JHtml::_('script', 'com_wrapper/iframe-height.min.js', array('version' => 'auto', 'relative' => true)); ?>