Version Description
- Toolset Dashboard now supports custom post types created by theme or other plugins
- Updated select2 to version 4
- Fixed issue using [types] shortcode in CRED notification
- Fixed minor incompatibility with the latest version of Toolset Access.
- Fixed issue with custom values for checkboxes fields not being respected.
Download this release
Release Info
| Developer | christianglingener |
| Plugin | |
| Version | 2.2.2 |
| Comparing to | |
| See all releases | |
Code changes from version 2.2.1 to 2.2.2
- application/controllers/page/dashboard.php +218 -100
- application/controllers/page/field_control.php +2 -1
- application/data/dashboard/table/head.php +0 -12
- application/models/field/group/term.php +10 -1
- application/views/page/dashboard/main.twig +14 -3
- application/views/page/dashboard/table.twig +1 -0
- application/views/page/dashboard/table/tbody-row.twig +7 -1
- application/views/page/dashboard/table/thead-cell.twig +3 -1
- library/otgs/installer/includes/installer.class.php +1 -2
- library/otgs/installer/res/css/admin.css +0 -8
- library/toolset/onthego-resources/onthego-styles/onthego-admin-styles.css +15 -66
- library/toolset/onthego-resources/onthego-styles/onthego-styles-helper.css +0 -2
- library/toolset/toolset-common/bootstrap.php +4 -0
- library/toolset/toolset-common/changelog.md +23 -0
- library/toolset/toolset-common/changelog.txt +14 -0
- library/toolset/toolset-common/inc/toolset.assets.manager.class.php +13 -4
- library/toolset/toolset-common/inc/toolset.css.component.class.php +4 -4
- library/toolset/toolset-common/inc/toolset.internal.compatibility.class.php +216 -0
- library/toolset/toolset-common/inc/toolset.relevanssi.compatibility.class.php +45 -6
- library/toolset/toolset-common/loader.php +1 -1
- library/toolset/toolset-common/loader.php.orig +0 -95
- library/toolset/toolset-common/res/css/toolset-common.css +4 -0
- library/toolset/toolset-common/res/js/toolset-select2-compatibility.js +153 -0
- library/toolset/toolset-common/res/lib/select2/select2-overrides.css +15 -6
- library/toolset/toolset-common/res/lib/select2/select2.css +455 -675
- library/toolset/toolset-common/res/lib/select2/select2.js +5725 -0
- library/toolset/toolset-common/res/lib/select2/select2.min.js +3 -23
- library/toolset/toolset-common/toolset-common-loader.php +3 -3
- library/toolset/toolset-common/toolset-forms/api.php +22 -17
- library/toolset/toolset-common/toolset-forms/classes/class.credfile.php +14 -13
- library/toolset/toolset-common/toolset-forms/classes/class.eforms.php +11 -1
- library/toolset/toolset-common/toolset-forms/classes/class.fieldconfig.php +4 -58
- library/toolset/toolset-common/toolset-forms/classes/class.taxonomy.php +1 -1
- library/toolset/toolset-common/toolset-forms/classes/submit.php +85 -67
- library/toolset/toolset-common/toolset-forms/js/credfile.js +12 -8
- library/toolset/toolset-common/toolset-forms/js/jquery_upload/file_upload.js +9 -57
- library/toolset/toolset-common/toolset-forms/js/main.js +6 -4
- library/toolset/toolset-common/user-editors/resource/types/dialog.php +1 -1
- library/toolset/toolset-common/user-editors/resource/views/dialog/types-fields.php +1 -1
- library/toolset/toolset-common/utility/dialogs/css/dd-dialogs-forms.css +7 -7
- library/toolset/toolset-common/utility/dialogs/js/views/abstract/ddl-abstract-dialog.js +1 -1
- library/toolset/toolset-common/utility/help-videos/toolset-help-videos.php +2 -2
- library/toolset/types/embedded/classes/loader.php +1 -1
- library/toolset/types/embedded/functions.php +14 -19
- library/toolset/types/embedded/includes/ajax.php +3 -29
- library/toolset/types/embedded/includes/post-relationship.php +154 -92
- library/toolset/types/embedded/resources/css/post-relationship.css +24 -1
- library/toolset/types/embedded/resources/js/post-relationship.js +89 -113
- library/toolset/types/includes/post-relationship.php +1 -1
- library/twig/twig/CHANGELOG +16 -0
- library/twig/twig/doc/api.rst +4 -4
- library/twig/twig/doc/coding_standards.rst +3 -3
- library/twig/twig/doc/filters/escape.rst +1 -1
- library/twig/twig/doc/tags/macro.rst +18 -1
- library/twig/twig/doc/tags/use.rst +1 -1
- library/twig/twig/doc/templates.rst +2 -0
- library/twig/twig/doc/tests/empty.rst +2 -1
- library/twig/twig/ext/twig/php_twig.h +1 -1
- library/twig/twig/lib/Twig/Cache/Filesystem.php +3 -1
- library/twig/twig/lib/Twig/Compiler.php +8 -0
- library/twig/twig/lib/Twig/Environment.php +30 -11
- library/twig/twig/lib/Twig/Extension/Core.php +1 -1
- library/twig/twig/lib/Twig/Lexer.php +1 -1
- library/twig/twig/lib/Twig/Loader/Filesystem.php +16 -5
- library/twig/twig/lib/Twig/Node.php +22 -0
- library/twig/twig/lib/Twig/Node/Embed.php +1 -1
- library/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php +2 -2
- library/twig/twig/lib/Twig/Node/Expression/Call.php +2 -2
- library/twig/twig/lib/Twig/Node/Expression/GetAttr.php +8 -3
- library/twig/twig/lib/Twig/Node/Expression/Test.php +6 -1
- library/twig/twig/lib/Twig/Node/For.php +9 -4
- library/twig/twig/lib/Twig/Node/If.php +7 -2
- library/twig/twig/lib/Twig/Node/Import.php +1 -1
- library/twig/twig/lib/Twig/Node/Include.php +8 -3
- library/twig/twig/lib/Twig/Node/Module.php +38 -16
- library/twig/twig/lib/Twig/NodeVisitor/Escaper.php +2 -0
- library/twig/twig/lib/Twig/Parser.php +1 -1
- library/twig/twig/lib/Twig/Template.php +19 -27
- library/twig/twig/lib/Twig/TokenParser/Embed.php +11 -2
- library/twig/twig/lib/Twig/TokenStream.php +19 -5
- library/twig/twig/test/Twig/Tests/CompilerTest.php +1 -1
- library/twig/twig/test/Twig/Tests/EnvironmentTest.php +26 -31
- library/twig/twig/test/Twig/Tests/ExpressionParserTest.php +16 -16
- library/twig/twig/test/Twig/Tests/Extension/CoreTest.php +12 -12
- library/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test +21 -0
- library/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test +35 -0
- library/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test +35 -0
- library/twig/twig/test/Twig/Tests/LexerTest.php +20 -20
- library/twig/twig/test/Twig/Tests/Loader/ChainTest.php +2 -2
- library/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php +14 -7
- library/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php +1 -1
- library/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php +31 -0
- library/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php +1 -1
- library/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php +1 -1
- library/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php +2 -2
- library/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php +1 -1
- library/twig/twig/test/Twig/Tests/Node/ForTest.php +1 -1
- library/twig/twig/test/Twig/Tests/Node/IfTest.php +1 -1
- library/twig/twig/test/Twig/Tests/Node/IncludeTest.php +1 -1
- library/twig/twig/test/Twig/Tests/Node/ModuleTest.php +17 -2
- library/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php +4 -4
- library/twig/twig/test/Twig/Tests/ParserTest.php +6 -6
- library/twig/twig/test/Twig/Tests/TemplateTest.php +14 -18
- library/twig/twig/test/Twig/Tests/escapingTest.php +1 -1
- readme.txt +8 -0
- wpcf.php +3 -3
application/controllers/page/dashboard.php
CHANGED
|
@@ -8,9 +8,15 @@
|
|
| 8 |
final class Types_Page_Dashboard extends Types_Page_Abstract {
|
| 9 |
|
| 10 |
protected $dashboard;
|
| 11 |
-
protected $table = false;
|
| 12 |
protected $twig;
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
private static $instance;
|
| 16 |
|
|
@@ -162,7 +168,9 @@ final class Types_Page_Dashboard extends Types_Page_Abstract {
|
|
| 162 |
|
| 163 |
$context = array(
|
| 164 |
'page' => self::get_instance(),
|
| 165 |
-
'
|
|
|
|
|
|
|
| 166 |
'labels' => array(
|
| 167 |
'create_type' => __( 'Add new post type', 'types' ),
|
| 168 |
'msg_no_custom_post_types' =>
|
|
@@ -174,34 +182,22 @@ final class Types_Page_Dashboard extends Types_Page_Abstract {
|
|
| 174 |
return $context;
|
| 175 |
}
|
| 176 |
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
$cpts_raw = ! isset( $_GET['toolset-dashboard-simulate-no-custom-post-types'] )
|
| 182 |
? get_option( WPCF_OPTION_NAME_CUSTOM_TYPES, array() )
|
| 183 |
: array();
|
| 184 |
|
| 185 |
-
//
|
| 186 |
-
|
| 187 |
-
$cpts_raw['post'] = array(
|
| 188 |
-
'slug' => 'post',
|
| 189 |
-
'_builtin' => 1
|
| 190 |
-
);
|
| 191 |
-
|
| 192 |
-
// make sure post type "page" is added
|
| 193 |
-
if( !isset( $cpts_raw['page'] ) )
|
| 194 |
-
$cpts_raw['page'] = array(
|
| 195 |
-
'slug' => 'page',
|
| 196 |
-
'_builtin' => 1
|
| 197 |
-
);
|
| 198 |
|
| 199 |
-
// make sure post type "attachment" is added
|
| 200 |
-
if( !isset( $cpts_raw['attachment'] ) )
|
| 201 |
-
$cpts_raw['attachment'] = array(
|
| 202 |
-
'slug' => 'attachment',
|
| 203 |
-
'_builtin' => 1
|
| 204 |
-
);
|
| 205 |
$cpts = array();
|
| 206 |
|
| 207 |
foreach( $cpts_raw as $cpt_raw ) {
|
|
@@ -213,16 +209,80 @@ final class Types_Page_Dashboard extends Types_Page_Abstract {
|
|
| 213 |
|
| 214 |
uasort( $cpts, array( $this, 'sort_post_types_by_name' ) );
|
| 215 |
|
| 216 |
-
$this->
|
| 217 |
-
return $this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
}
|
| 219 |
|
| 220 |
private function sort_post_types_by_name( $a, $b ) {
|
| 221 |
return strcasecmp( $a->name, $b->name ) > 0 ? true : false;
|
| 222 |
}
|
| 223 |
|
| 224 |
-
private function get_post_types_filtered_by_screen_options() {
|
| 225 |
-
$cpts
|
|
|
|
|
|
|
| 226 |
$cpts_filtered = array();
|
| 227 |
|
| 228 |
$user = get_current_user_id();
|
|
@@ -264,77 +324,37 @@ final class Types_Page_Dashboard extends Types_Page_Abstract {
|
|
| 264 |
}
|
| 265 |
|
| 266 |
private function get_dashboard() {
|
| 267 |
-
//
|
| 268 |
-
$post_types = $this->get_post_types_filtered_by_screen_options();
|
| 269 |
-
|
| 270 |
-
// abort if there are no post types
|
| 271 |
-
if( empty( $post_types ) )
|
| 272 |
-
return false;
|
| 273 |
|
| 274 |
-
|
| 275 |
-
|
|
|
|
|
|
|
|
|
|
| 276 |
|
| 277 |
-
// add links to use analytics
|
| 278 |
-
Types_Helper_Url::add_urls( $documentation_urls );
|
| 279 |
|
| 280 |
-
//
|
| 281 |
-
|
| 282 |
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
);
|
| 290 |
|
| 291 |
-
// add dashboard
|
| 292 |
-
$rows = '';
|
| 293 |
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
Types_Helper_Condition::set_post_type( $post_type->get_name() );
|
| 297 |
-
Types_Helper_Placeholder::set_post_type( $post_type->get_name() );
|
| 298 |
-
|
| 299 |
-
foreach( $messages_files as $message_file ) {
|
| 300 |
-
$this->load_data_to_table( $message_file, $info_post_type );
|
| 301 |
-
}
|
| 302 |
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
'create_taxonomy' => __( 'Create taxonomy', 'types' ),
|
| 309 |
-
'create_field_group' => __( 'Create field group', 'types' ),
|
| 310 |
-
'no_archive_for' => __( 'No archive available for %s', 'types' ),
|
| 311 |
-
),
|
| 312 |
-
'admin_url' => admin_url(),
|
| 313 |
-
'post_type' => $post_type,
|
| 314 |
-
'table' => $info_post_type
|
| 315 |
-
)
|
| 316 |
);
|
| 317 |
|
| 318 |
-
Types_Helper_Placeholder::replace( $row );
|
| 319 |
-
$rows .= $row;
|
| 320 |
-
}
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
// table view
|
| 324 |
-
$data_thead = require( TYPES_DATA . '/dashboard/table/head.php' );
|
| 325 |
-
$this->table = $this->get_twig()->render(
|
| 326 |
-
'/page/dashboard/table.twig',
|
| 327 |
-
array(
|
| 328 |
-
'labels' => array(
|
| 329 |
-
'admin' => __( 'WordPress admin', 'types' ),
|
| 330 |
-
'frontend' => __( 'Front-end', 'types' ),
|
| 331 |
-
'or' => __( 'Or...', 'types' ),
|
| 332 |
-
),
|
| 333 |
-
'admin_url' => admin_url(),
|
| 334 |
-
'thead' => $data_thead,
|
| 335 |
-
'rows' => $rows
|
| 336 |
-
)
|
| 337 |
-
);
|
| 338 |
}
|
| 339 |
|
| 340 |
protected function load_data_to_table( $path, &$info ) {
|
|
@@ -351,30 +371,51 @@ final class Types_Page_Dashboard extends Types_Page_Abstract {
|
|
| 351 |
public function screen_settings( $status, $args ) {
|
| 352 |
$return = $status;
|
| 353 |
|
| 354 |
-
$cpts = $this->get_post_types();
|
| 355 |
$cpts_filtered = $this->get_post_types_filtered_by_screen_options();
|
| 356 |
|
| 357 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 358 |
|
| 359 |
-
$return .= '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 360 |
<fieldset>
|
| 361 |
-
<legend>' .
|
| 362 |
<div class="metabox-prefs">
|
| 363 |
<div><input type="hidden" name="wp_screen_options[option]" value="toolset_dashboard_screen_post_types" /></div>
|
| 364 |
<div><input type="hidden" name="wp_screen_options[value]" value="yes" /></div>
|
| 365 |
<div class="toolset-dashboard-screen-post-types">';
|
| 366 |
foreach( $cpts as $cpt ) {
|
| 367 |
$checked = isset( $cpts_filtered[$cpt->get_name()] ) ? ' checked="checked" ' : ' ';
|
| 368 |
-
$
|
| 369 |
-
$
|
| 370 |
}
|
| 371 |
-
$
|
| 372 |
</div>
|
| 373 |
</fieldset>
|
| 374 |
<br class="clear">
|
| 375 |
-
'
|
| 376 |
|
| 377 |
-
return $
|
| 378 |
}
|
| 379 |
|
| 380 |
public function screen_settings_save($status, $option, $value) {
|
|
@@ -401,4 +442,81 @@ final class Types_Page_Dashboard extends Types_Page_Abstract {
|
|
| 401 |
)
|
| 402 |
);
|
| 403 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 404 |
}
|
| 8 |
final class Types_Page_Dashboard extends Types_Page_Abstract {
|
| 9 |
|
| 10 |
protected $dashboard;
|
|
|
|
| 11 |
protected $twig;
|
| 12 |
+
|
| 13 |
+
protected $table_toolset = false;
|
| 14 |
+
protected $table_3rd = false;
|
| 15 |
+
protected $table_wordpress;
|
| 16 |
+
|
| 17 |
+
protected $types_by_toolset;
|
| 18 |
+
protected $types_by_3rd;
|
| 19 |
+
protected $types_by_wordpress;
|
| 20 |
|
| 21 |
private static $instance;
|
| 22 |
|
| 168 |
|
| 169 |
$context = array(
|
| 170 |
'page' => self::get_instance(),
|
| 171 |
+
'table_toolset' => $this->table_toolset,
|
| 172 |
+
'table_3rd' => $this->table_3rd,
|
| 173 |
+
'table_wordpress' => $this->table_wordpress,
|
| 174 |
'labels' => array(
|
| 175 |
'create_type' => __( 'Add new post type', 'types' ),
|
| 176 |
'msg_no_custom_post_types' =>
|
| 182 |
return $context;
|
| 183 |
}
|
| 184 |
|
| 185 |
+
/**
|
| 186 |
+
* Types by Toolset
|
| 187 |
+
*
|
| 188 |
+
* @return array
|
| 189 |
+
*/
|
| 190 |
+
private function get_types_by_toolset() {
|
| 191 |
+
if( $this->types_by_toolset !== null )
|
| 192 |
+
return $this->types_by_toolset;
|
| 193 |
|
| 194 |
$cpts_raw = ! isset( $_GET['toolset-dashboard-simulate-no-custom-post-types'] )
|
| 195 |
? get_option( WPCF_OPTION_NAME_CUSTOM_TYPES, array() )
|
| 196 |
: array();
|
| 197 |
|
| 198 |
+
// remove buildin types
|
| 199 |
+
$cpts_raw = array_diff_key( $cpts_raw, $this->get_types_by_wordpress() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
$cpts = array();
|
| 202 |
|
| 203 |
foreach( $cpts_raw as $cpt_raw ) {
|
| 209 |
|
| 210 |
uasort( $cpts, array( $this, 'sort_post_types_by_name' ) );
|
| 211 |
|
| 212 |
+
$this->types_by_toolset = $cpts;
|
| 213 |
+
return $this->types_by_toolset;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
/**
|
| 217 |
+
* Types by WordPress
|
| 218 |
+
* @return array
|
| 219 |
+
*/
|
| 220 |
+
private function get_types_by_wordpress() {
|
| 221 |
+
if( $this->types_by_wordpress !== null )
|
| 222 |
+
return $this->types_by_wordpress;
|
| 223 |
+
|
| 224 |
+
$cpts_raw = array(
|
| 225 |
+
'post' => array(
|
| 226 |
+
'slug' => 'post',
|
| 227 |
+
'_buildin' => 1
|
| 228 |
+
),
|
| 229 |
+
'page' => array(
|
| 230 |
+
'slug' => 'page',
|
| 231 |
+
'_buildin' => 1
|
| 232 |
+
),
|
| 233 |
+
'attachment' => array(
|
| 234 |
+
'slug' => 'attachment',
|
| 235 |
+
'_buildin' => 1
|
| 236 |
+
),
|
| 237 |
+
);
|
| 238 |
+
|
| 239 |
+
$cpts = array();
|
| 240 |
+
foreach( $cpts_raw as $cpt_raw ) {
|
| 241 |
+
$post_type = new Types_Post_Type( $cpt_raw['slug'] );
|
| 242 |
+
// only use active post types
|
| 243 |
+
if( isset( $post_type->name ) )
|
| 244 |
+
$cpts[$cpt_raw['slug']] = $post_type;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
uasort( $cpts, array( $this, 'sort_post_types_by_name' ) );
|
| 248 |
+
$this->types_by_wordpress = $cpts;
|
| 249 |
+
|
| 250 |
+
return $this->types_by_wordpress;
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
/**
|
| 254 |
+
* Types by 3rd (by themes/plugins)
|
| 255 |
+
* @return array
|
| 256 |
+
*/
|
| 257 |
+
private function get_types_by_3rd() {
|
| 258 |
+
if( $this->types_by_3rd !== null )
|
| 259 |
+
return $this->types_by_3rd;
|
| 260 |
+
|
| 261 |
+
$cpts_raw = get_post_types( array( 'public' => true ) );
|
| 262 |
+
$cpts = array();
|
| 263 |
+
foreach( $cpts_raw as $cpt_slug => $cpt_raw ) {
|
| 264 |
+
$post_type = new Types_Post_Type( $cpt_slug );
|
| 265 |
+
// only use active post types
|
| 266 |
+
if( isset( $post_type->name ) )
|
| 267 |
+
$cpts[$cpt_slug] = $post_type;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
$cpts = array_diff_key( $cpts, $this->get_types_by_wordpress(), $this->get_types_by_toolset() );
|
| 271 |
+
|
| 272 |
+
uasort( $cpts, array( $this, 'sort_post_types_by_name' ) );
|
| 273 |
+
$this->types_by_3rd = $cpts;
|
| 274 |
+
|
| 275 |
+
return $this->types_by_3rd;
|
| 276 |
}
|
| 277 |
|
| 278 |
private function sort_post_types_by_name( $a, $b ) {
|
| 279 |
return strcasecmp( $a->name, $b->name ) > 0 ? true : false;
|
| 280 |
}
|
| 281 |
|
| 282 |
+
private function get_post_types_filtered_by_screen_options( $cpts = false ) {
|
| 283 |
+
if( $cpts === false )
|
| 284 |
+
$cpts = array_merge( $this->get_types_by_toolset(), $this->get_types_by_wordpress(), $this->get_types_by_3rd() );
|
| 285 |
+
|
| 286 |
$cpts_filtered = array();
|
| 287 |
|
| 288 |
$user = get_current_user_id();
|
| 324 |
}
|
| 325 |
|
| 326 |
private function get_dashboard() {
|
| 327 |
+
// Types by Toolset
|
| 328 |
+
$post_types = $this->get_post_types_filtered_by_screen_options( $this->get_types_by_toolset() );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
|
| 330 |
+
if( ! empty( $post_types ) )
|
| 331 |
+
$this->table_toolset = $this->get_dashboard_types_table(
|
| 332 |
+
$post_types,
|
| 333 |
+
__( 'Custom post types that you created with Toolset', 'types' )
|
| 334 |
+
);
|
| 335 |
|
|
|
|
|
|
|
| 336 |
|
| 337 |
+
// Types by 3rd
|
| 338 |
+
$post_types = $this->get_post_types_filtered_by_screen_options( $this->get_types_by_3rd() );
|
| 339 |
|
| 340 |
+
if( ! empty( $post_types ) )
|
| 341 |
+
$this->table_3rd = $this->get_dashboard_types_table(
|
| 342 |
+
$post_types,
|
| 343 |
+
__( 'Custom post types created by the theme and other plugins', 'types' ),
|
| 344 |
+
false
|
| 345 |
+
);
|
|
|
|
| 346 |
|
|
|
|
|
|
|
| 347 |
|
| 348 |
+
// Types by Wordpress
|
| 349 |
+
$post_types = $this->get_post_types_filtered_by_screen_options( $this->get_types_by_wordpress() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 350 |
|
| 351 |
+
if( ! empty( $post_types ) )
|
| 352 |
+
$this->table_wordpress = $this->get_dashboard_types_table(
|
| 353 |
+
$post_types,
|
| 354 |
+
__( 'Built-in post types created by WordPress', 'types' ),
|
| 355 |
+
false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
);
|
| 357 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 358 |
}
|
| 359 |
|
| 360 |
protected function load_data_to_table( $path, &$info ) {
|
| 371 |
public function screen_settings( $status, $args ) {
|
| 372 |
$return = $status;
|
| 373 |
|
|
|
|
| 374 |
$cpts_filtered = $this->get_post_types_filtered_by_screen_options();
|
| 375 |
|
| 376 |
+
// Types by Toolset
|
| 377 |
+
$cpts = $this->get_types_by_toolset();
|
| 378 |
+
if( ! empty( $cpts ) ) {
|
| 379 |
+
$string_legend = __( 'Custom post types that you created with Toolset', 'types' );
|
| 380 |
+
$return .= $this->screen_settings_fieldset( $cpts, $cpts_filtered, $string_legend );
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
// Types by 3rd
|
| 384 |
+
$cpts = $this->get_types_by_3rd();
|
| 385 |
+
if( ! empty( $cpts ) ) {
|
| 386 |
+
$string_legend = __( 'Custom post types created by the theme and other plugins', 'types' );
|
| 387 |
+
$return .= $this->screen_settings_fieldset( $cpts, $cpts_filtered, $string_legend );
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
// Types by WordPress
|
| 391 |
+
$cpts = $this->get_types_by_wordpress();
|
| 392 |
+
$string_legend = __( 'Built-in post types created by WordPress', 'types' );
|
| 393 |
+
$return .= $this->screen_settings_fieldset( $cpts, $cpts_filtered, $string_legend );
|
| 394 |
|
| 395 |
+
$return .= get_submit_button( __( 'Apply' ), 'button button-primary', 'screen-options-apply', false );
|
| 396 |
+
return $return;
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
private function screen_settings_fieldset( $cpts, $cpts_filtered, $legend ) {
|
| 400 |
+
$string = '
|
| 401 |
<fieldset>
|
| 402 |
+
<legend>' . $legend . '</legend>
|
| 403 |
<div class="metabox-prefs">
|
| 404 |
<div><input type="hidden" name="wp_screen_options[option]" value="toolset_dashboard_screen_post_types" /></div>
|
| 405 |
<div><input type="hidden" name="wp_screen_options[value]" value="yes" /></div>
|
| 406 |
<div class="toolset-dashboard-screen-post-types">';
|
| 407 |
foreach( $cpts as $cpt ) {
|
| 408 |
$checked = isset( $cpts_filtered[$cpt->get_name()] ) ? ' checked="checked" ' : ' ';
|
| 409 |
+
$string .= '<input type="hidden" value="off" name="toolset_dashboard_screen_post_types['.$cpt->get_name().']" />';
|
| 410 |
+
$string .= '<label for="toolset-dashboard-screen-post-type-'.$cpt->get_name().'"><input type="checkbox"' . $checked . 'value="on" name="toolset_dashboard_screen_post_types['.$cpt->get_name().']" id="toolset-dashboard-screen-post-type-'.$cpt->get_name().'" /> '.$cpt->name.'</label>';
|
| 411 |
}
|
| 412 |
+
$string .= '</div>
|
| 413 |
</div>
|
| 414 |
</fieldset>
|
| 415 |
<br class="clear">
|
| 416 |
+
';
|
| 417 |
|
| 418 |
+
return $string;
|
| 419 |
}
|
| 420 |
|
| 421 |
public function screen_settings_save($status, $option, $value) {
|
| 442 |
)
|
| 443 |
);
|
| 444 |
}
|
| 445 |
+
|
| 446 |
+
/**
|
| 447 |
+
* @param $post_types
|
| 448 |
+
* @param $headline
|
| 449 |
+
*
|
| 450 |
+
* @return string
|
| 451 |
+
*/
|
| 452 |
+
private function get_dashboard_types_table( $post_types, $headline, $post_type_edit_link = true ) {
|
| 453 |
+
// documentation urls
|
| 454 |
+
$documentation_urls = include( TYPES_DATA . '/documentation-urls.php' );
|
| 455 |
+
|
| 456 |
+
// add links to use analytics
|
| 457 |
+
Types_Helper_Url::add_urls( $documentation_urls );
|
| 458 |
+
|
| 459 |
+
// set analytics medium
|
| 460 |
+
Types_Helper_Url::set_medium( 'dashboard' );
|
| 461 |
+
|
| 462 |
+
/* messages */
|
| 463 |
+
$messages_files = array(
|
| 464 |
+
TYPES_DATA . '/dashboard/table/template.php',
|
| 465 |
+
TYPES_DATA . '/dashboard/table/archive.php',
|
| 466 |
+
TYPES_DATA . '/dashboard/table/views.php',
|
| 467 |
+
TYPES_DATA . '/dashboard/table/forms.php',
|
| 468 |
+
);
|
| 469 |
+
|
| 470 |
+
// add dashboard
|
| 471 |
+
$rows = '';
|
| 472 |
+
|
| 473 |
+
foreach( $post_types as $post_type ) {
|
| 474 |
+
$info_post_type = new Types_Information_Table( 'types-information-table' );
|
| 475 |
+
Types_Helper_Condition::set_post_type( $post_type->get_name() );
|
| 476 |
+
Types_Helper_Placeholder::set_post_type( $post_type->get_name() );
|
| 477 |
+
|
| 478 |
+
foreach( $messages_files as $message_file ) {
|
| 479 |
+
$this->load_data_to_table( $message_file, $info_post_type );
|
| 480 |
+
}
|
| 481 |
+
|
| 482 |
+
$row = $this->get_twig()->render(
|
| 483 |
+
'/page/dashboard/table/tbody-row.twig',
|
| 484 |
+
array(
|
| 485 |
+
'labels' => array(
|
| 486 |
+
'or' => __( 'Or...', 'types' ),
|
| 487 |
+
'create_taxonomy' => __( 'Create taxonomy', 'types' ),
|
| 488 |
+
'create_field_group' => __( 'Create field group', 'types' ),
|
| 489 |
+
'no_archive_for' => __( 'No archive available for %s', 'types' ),
|
| 490 |
+
),
|
| 491 |
+
'admin_url' => admin_url(),
|
| 492 |
+
'post_type' => $post_type,
|
| 493 |
+
'table' => $info_post_type,
|
| 494 |
+
'post_type_edit_link' => $post_type_edit_link
|
| 495 |
+
)
|
| 496 |
+
);
|
| 497 |
+
|
| 498 |
+
Types_Helper_Placeholder::replace( $row );
|
| 499 |
+
$rows .= $row;
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
|
| 503 |
+
// table view
|
| 504 |
+
$data_thead = require( TYPES_DATA . '/dashboard/table/head.php' );
|
| 505 |
+
$table = $this->get_twig()->render(
|
| 506 |
+
'/page/dashboard/table.twig',
|
| 507 |
+
array(
|
| 508 |
+
'labels' => array(
|
| 509 |
+
'headline' => $headline,
|
| 510 |
+
'admin' => __( 'WordPress admin', 'types' ),
|
| 511 |
+
'frontend' => __( 'Front-end', 'types' ),
|
| 512 |
+
'or' => __( 'Or...', 'types' ),
|
| 513 |
+
),
|
| 514 |
+
'admin_url' => admin_url(),
|
| 515 |
+
'thead' => $data_thead,
|
| 516 |
+
'rows' => $rows
|
| 517 |
+
)
|
| 518 |
+
);
|
| 519 |
+
|
| 520 |
+
return $table;
|
| 521 |
+
}
|
| 522 |
}
|
application/controllers/page/field_control.php
CHANGED
|
@@ -171,7 +171,8 @@ final class Types_Page_Field_Control extends Types_Page_Abstract {
|
|
| 171 |
'wp-admin',
|
| 172 |
'common',
|
| 173 |
'font-awesome',
|
| 174 |
-
'wpcf-css-embedded'
|
|
|
|
| 175 |
)
|
| 176 |
);
|
| 177 |
|
| 171 |
'wp-admin',
|
| 172 |
'common',
|
| 173 |
'font-awesome',
|
| 174 |
+
'wpcf-css-embedded',
|
| 175 |
+
'wp-jquery-ui-dialog'
|
| 176 |
)
|
| 177 |
);
|
| 178 |
|
application/data/dashboard/table/head.php
CHANGED
|
@@ -4,18 +4,6 @@ $question_marks = array(
|
|
| 4 |
'type' => array(
|
| 5 |
'id' => 'type',
|
| 6 |
'title' => __( 'Post Type', 'types' ),
|
| 7 |
-
'description' => array(
|
| 8 |
-
array(
|
| 9 |
-
'type' => 'paragraph',
|
| 10 |
-
'content' => __( 'A list of all Post Types available in your site.', 'types' )
|
| 11 |
-
),
|
| 12 |
-
array(
|
| 13 |
-
'type' => 'link',
|
| 14 |
-
'external' => true,
|
| 15 |
-
'label' => __( 'Learn more', 'types' ),
|
| 16 |
-
'target' => Types_Helper_Url::get_url( 'learn-how-post-types', 'tooltip' )
|
| 17 |
-
),
|
| 18 |
-
)
|
| 19 |
),
|
| 20 |
|
| 21 |
'fields' => array(
|
| 4 |
'type' => array(
|
| 5 |
'id' => 'type',
|
| 6 |
'title' => __( 'Post Type', 'types' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
),
|
| 8 |
|
| 9 |
'fields' => array(
|
application/models/field/group/term.php
CHANGED
|
@@ -47,7 +47,16 @@ class Types_Field_Group_Term extends Types_Field_Group {
|
|
| 47 |
*/
|
| 48 |
public function get_associated_taxonomies() {
|
| 49 |
$postmeta = get_post_meta( $this->get_id(), self::POSTMETA_ASSOCIATED_TAXONOMY, false );
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
return wpcf_ensarr( $postmeta );
|
| 52 |
}
|
| 53 |
|
| 47 |
*/
|
| 48 |
public function get_associated_taxonomies() {
|
| 49 |
$postmeta = get_post_meta( $this->get_id(), self::POSTMETA_ASSOCIATED_TAXONOMY, false );
|
| 50 |
+
|
| 51 |
+
// Survive empty or whitespace taxonomy slugs (skip them). They are invalid values but
|
| 52 |
+
// if we have only them, we need to return an empty array to keep the group displayed everywhere.
|
| 53 |
+
foreach( $postmeta as $index => $taxonomy_slug ) {
|
| 54 |
+
$taxonomy_slug = trim( $taxonomy_slug );
|
| 55 |
+
if( empty( $taxonomy_slug ) ) {
|
| 56 |
+
unset( $postmeta[ $index ] );
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
return wpcf_ensarr( $postmeta );
|
| 61 |
}
|
| 62 |
|
application/views/page/dashboard/main.twig
CHANGED
|
@@ -4,17 +4,28 @@
|
|
| 4 |
|
| 5 |
{% block content %}
|
| 6 |
<div class="toolset-dashboard">
|
| 7 |
-
{% if
|
| 8 |
-
{{
|
| 9 |
{% else %}
|
| 10 |
<p>{{ labels.msg_no_custom_post_types }}</p>
|
| 11 |
{% endif %}
|
| 12 |
|
| 13 |
-
|
| 14 |
{# Add new post type #}
|
| 15 |
<p>
|
| 16 |
<a class="button-primary types-button" href="{{ admin_url }}admin.php?page=wpcf-edit-type">{{ labels.create_type }}</a>
|
| 17 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
</div>
|
| 19 |
{% endblock %}
|
| 20 |
|
| 4 |
|
| 5 |
{% block content %}
|
| 6 |
<div class="toolset-dashboard">
|
| 7 |
+
{% if table_toolset %}
|
| 8 |
+
{{ table_toolset|raw }}
|
| 9 |
{% else %}
|
| 10 |
<p>{{ labels.msg_no_custom_post_types }}</p>
|
| 11 |
{% endif %}
|
| 12 |
|
|
|
|
| 13 |
{# Add new post type #}
|
| 14 |
<p>
|
| 15 |
<a class="button-primary types-button" href="{{ admin_url }}admin.php?page=wpcf-edit-type">{{ labels.create_type }}</a>
|
| 16 |
</p>
|
| 17 |
+
|
| 18 |
+
{# Table with 3rd party post types #}
|
| 19 |
+
{% if table_3rd %}
|
| 20 |
+
<div style="height:20px;"></div>
|
| 21 |
+
{{ table_3rd|raw }}
|
| 22 |
+
{% endif %}
|
| 23 |
+
|
| 24 |
+
{# Table with wordpress post types #}
|
| 25 |
+
{% if table_wordpress %}
|
| 26 |
+
<div style="height:20px;"></div>
|
| 27 |
+
{{ table_wordpress|raw }}
|
| 28 |
+
{% endif %}
|
| 29 |
</div>
|
| 30 |
{% endblock %}
|
| 31 |
|
application/views/page/dashboard/table.twig
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
|
| 2 |
<div class="types-information">
|
|
|
|
| 3 |
<table width="100%">
|
| 4 |
<thead>
|
| 5 |
<tr>
|
| 1 |
|
| 2 |
<div class="types-information">
|
| 3 |
+
<h2>{{ labels.headline }}</h2>
|
| 4 |
<table width="100%">
|
| 5 |
<thead>
|
| 6 |
<tr>
|
application/views/page/dashboard/table/tbody-row.twig
CHANGED
|
@@ -1,7 +1,13 @@
|
|
| 1 |
<tr>
|
| 2 |
<td>
|
| 3 |
<div class="types-information-td-inner">
|
| 4 |
-
<p class="types-information-paragraph toolset-dashboard-post-type"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
</div>
|
| 6 |
</td>
|
| 7 |
<td>
|
| 1 |
<tr>
|
| 2 |
<td>
|
| 3 |
<div class="types-information-td-inner">
|
| 4 |
+
<p class="types-information-paragraph toolset-dashboard-post-type">
|
| 5 |
+
{% if post_type_edit_link %}
|
| 6 |
+
<a href="{{ post_type.get_edit_link }}">{{ post_type.name }}</a>
|
| 7 |
+
{% else %}
|
| 8 |
+
{{ post_type.name }}
|
| 9 |
+
{% endif %}
|
| 10 |
+
</p>
|
| 11 |
</div>
|
| 12 |
</td>
|
| 13 |
<td>
|
application/views/page/dashboard/table/thead-cell.twig
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
{{ content.title }}
|
| 2 |
|
|
|
|
| 3 |
<a id="types-pointer-target-{{ content.id }}" href="javascript:void(0)" class="dashicons dashicons-editor-help"
|
| 4 |
data-types-open-pointer="types-pointer-{{ content.id }}" style="position:relative;"></a>
|
| 5 |
|
|
@@ -14,4 +15,5 @@
|
|
| 14 |
{% endfor %}
|
| 15 |
</div>
|
| 16 |
</div>
|
| 17 |
-
</div>
|
|
|
| 1 |
{{ content.title }}
|
| 2 |
|
| 3 |
+
{% if content.description %}
|
| 4 |
<a id="types-pointer-target-{{ content.id }}" href="javascript:void(0)" class="dashicons dashicons-editor-help"
|
| 5 |
data-types-open-pointer="types-pointer-{{ content.id }}" style="position:relative;"></a>
|
| 6 |
|
| 15 |
{% endfor %}
|
| 16 |
</div>
|
| 17 |
</div>
|
| 18 |
+
</div>
|
| 19 |
+
{% endif %}
|
library/otgs/installer/includes/installer.class.php
CHANGED
|
@@ -1040,8 +1040,7 @@ final class WP_Installer{
|
|
| 1040 |
$this->settings['repositories'][$repository_id]['subscription'] = array('key' => $site_key, 'data' => $subscription_data);
|
| 1041 |
$this->save_settings();
|
| 1042 |
} else {
|
| 1043 |
-
$error = __( 'Invalid site key for the current site.', 'installer' )
|
| 1044 |
-
. '<br /><div class="installer-footnote">' . __('Please note that the site key is case sensitive.', 'installer') . '</div>';
|
| 1045 |
}
|
| 1046 |
|
| 1047 |
} catch (Exception $e ){
|
| 1040 |
$this->settings['repositories'][$repository_id]['subscription'] = array('key' => $site_key, 'data' => $subscription_data);
|
| 1041 |
$this->save_settings();
|
| 1042 |
} else {
|
| 1043 |
+
$error = __( 'Invalid site key for the current site.', 'installer' );
|
|
|
|
| 1044 |
}
|
| 1045 |
|
| 1046 |
} catch (Exception $e ){
|
library/otgs/installer/res/css/admin.css
CHANGED
|
@@ -29,14 +29,6 @@
|
|
| 29 |
font-weight:bold;
|
| 30 |
}
|
| 31 |
|
| 32 |
-
.installer-footnote{
|
| 33 |
-
color:#3d5e69;
|
| 34 |
-
display:block;
|
| 35 |
-
float: left;
|
| 36 |
-
font-style: italic;
|
| 37 |
-
font-size: 90%;
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
.installer-products-list li{
|
| 41 |
display: inline;
|
| 42 |
margin-right: 20px;
|
| 29 |
font-weight:bold;
|
| 30 |
}
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
.installer-products-list li{
|
| 33 |
display: inline;
|
| 34 |
margin-right: 20px;
|
library/toolset/onthego-resources/onthego-styles/onthego-admin-styles.css
CHANGED
|
@@ -3,8 +3,21 @@
|
|
| 3 |
**
|
| 4 |
*/
|
| 5 |
/* ADMIN MENU ICONS */
|
| 6 |
-
li#toplevel_page_wpcf-cpt div.wp-menu-image:before,
|
| 7 |
-
li#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
font-family: "onthegosystems-icons"!important;
|
| 9 |
content: "\f12a";
|
| 10 |
font-size: 22px!important;
|
|
@@ -12,70 +25,6 @@ li#toplevel_page_toolset-dashboard div.wp-menu-image:before, li#toplevel_page_to
|
|
| 12 |
padding-left: 3px;
|
| 13 |
padding-top: 5px;
|
| 14 |
}
|
| 15 |
-
li#toolset_page_dd_layouts div.wp-menu-image:before, li#toplevel_page_dd_layouts .dashicons-admin-generic:before {
|
| 16 |
-
font-family: "onthegosystems-icons"!important;
|
| 17 |
-
content: "\f12a";
|
| 18 |
-
font-size: 22px!important;
|
| 19 |
-
width: 30px;
|
| 20 |
-
padding-left: 3px;
|
| 21 |
-
padding-top: 5px; }
|
| 22 |
-
|
| 23 |
-
li#toplevel_page_embedded-views div.wp-menu-image:before,
|
| 24 |
-
li#toplevel_page_views div.wp-menu-image:before {
|
| 25 |
-
font-family: "onthegosystems-icons"!important;
|
| 26 |
-
content: "\f12a";
|
| 27 |
-
font-size: 22px!important;
|
| 28 |
-
width: 30px;
|
| 29 |
-
padding-left: 3px;
|
| 30 |
-
padding-top: 3px; }
|
| 31 |
-
|
| 32 |
-
li#toplevel_page_ModuleManager_Modules div.wp-menu-image:before {
|
| 33 |
-
font-family: "onthegosystems-icons"!important;
|
| 34 |
-
content: "\f12a";
|
| 35 |
-
font-size: 22px!important;
|
| 36 |
-
width: 30px;
|
| 37 |
-
padding-left: 3px;
|
| 38 |
-
padding-top: 3px; }
|
| 39 |
-
|
| 40 |
-
li#toplevel_page_CRED_Forms div.wp-menu-image:before {
|
| 41 |
-
font-family: "onthegosystems-icons"!important;
|
| 42 |
-
content: "\f12a";
|
| 43 |
-
font-size: 22px!important;
|
| 44 |
-
width: 30px;
|
| 45 |
-
padding-left: 3px;
|
| 46 |
-
padding-top: 3px; }
|
| 47 |
-
|
| 48 |
-
li#toplevel_page_wpcf div.wp-menu-image:before {
|
| 49 |
-
font-family: "onthegosystems-icons"!important;
|
| 50 |
-
content: "\f12a";
|
| 51 |
-
font-size: 22px!important;
|
| 52 |
-
width: 30px;
|
| 53 |
-
padding-left: 3px;
|
| 54 |
-
padding-top: 4px; }
|
| 55 |
-
|
| 56 |
-
li#toplevel_page_types_access div.wp-menu-image:before {
|
| 57 |
-
font-family: "onthegosystems-icons"!important;
|
| 58 |
-
content: "\f12a";
|
| 59 |
-
font-size: 22px!important;
|
| 60 |
-
width: 30px;
|
| 61 |
-
padding-left: 3px;
|
| 62 |
-
padding-top: 3px; }
|
| 63 |
-
|
| 64 |
-
li#toplevel_page_CRED_Commerce div.wp-menu-image:before {
|
| 65 |
-
font-family: "onthegosystems-icons"!important;
|
| 66 |
-
content: "\f12a";
|
| 67 |
-
font-size: 22px!important;
|
| 68 |
-
width: 30px;
|
| 69 |
-
padding-left: 3px;
|
| 70 |
-
padding-top: 3px; }
|
| 71 |
-
|
| 72 |
-
li#toplevel_page_toolset-packager div.wp-menu-image:before {
|
| 73 |
-
font-family: "onthegosystems-icons"!important;
|
| 74 |
-
content: "\f12a";
|
| 75 |
-
font-size: 22px!important;
|
| 76 |
-
width: 30px;
|
| 77 |
-
padding-left: 3px;
|
| 78 |
-
padding-top: 3px; }
|
| 79 |
|
| 80 |
/* POST EDIT PAGE SHORT TAGS BUTTONS ICONS */
|
| 81 |
#wp-content-editor-tools [class^="icon-"] {
|
| 3 |
**
|
| 4 |
*/
|
| 5 |
/* ADMIN MENU ICONS */
|
| 6 |
+
li#toplevel_page_wpcf-cpt div.wp-menu-image:before,
|
| 7 |
+
li#toplevel_page_wpcf-cpt .dashicons-admin-generic:before,
|
| 8 |
+
li#toplevel_page_toolset-dashboard div.wp-menu-image:before,
|
| 9 |
+
li#toplevel_page_toolset-dashboard .dashicons-admin-generic:before,
|
| 10 |
+
li#toolset_page_dd_layouts div.wp-menu-image:before,
|
| 11 |
+
li#toplevel_page_dd_layouts .dashicons-admin-generic:before,
|
| 12 |
+
li#toplevel_page_embedded-views div.wp-menu-image:before,
|
| 13 |
+
li#toplevel_page_views div.wp-menu-image:before,
|
| 14 |
+
li#toplevel_page_ModuleManager_Modules div.wp-menu-image:before,
|
| 15 |
+
li#toplevel_page_CRED_Forms div.wp-menu-image:before,
|
| 16 |
+
li#toplevel_page_wpcf div.wp-menu-image:before,
|
| 17 |
+
li#toplevel_page_types_access div.wp-menu-image:before,
|
| 18 |
+
li#toplevel_page_CRED_Commerce div.wp-menu-image:before,
|
| 19 |
+
li#toplevel_page_toolset-packager div.wp-menu-image:before,
|
| 20 |
+
li#toplevel_page_toolset-settings div.wp-menu-image:before {
|
| 21 |
font-family: "onthegosystems-icons"!important;
|
| 22 |
content: "\f12a";
|
| 23 |
font-size: 22px!important;
|
| 25 |
padding-left: 3px;
|
| 26 |
padding-top: 5px;
|
| 27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
/* POST EDIT PAGE SHORT TAGS BUTTONS ICONS */
|
| 30 |
#wp-content-editor-tools [class^="icon-"] {
|
library/toolset/onthego-resources/onthego-styles/onthego-styles-helper.css
CHANGED
|
@@ -5170,5 +5170,3 @@
|
|
| 5170 |
|
| 5171 |
.align-right {
|
| 5172 |
text-align: right !important; }
|
| 5173 |
-
|
| 5174 |
-
/*# sourceMappingURL=onthego-styles-helper.css.map */
|
| 5170 |
|
| 5171 |
.align-right {
|
| 5172 |
text-align: right !important; }
|
|
|
|
|
|
library/toolset/toolset-common/bootstrap.php
CHANGED
|
@@ -180,6 +180,10 @@ class Toolset_Common_Bootstrap {
|
|
| 180 |
global $toolset_admin_bar_menu;
|
| 181 |
$toolset_admin_bar_menu = Toolset_Admin_Bar_Menu::get_instance();
|
| 182 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
if ( ! class_exists( 'Toolset_WPML_Compatibility' ) ) {
|
| 184 |
require_once( TOOLSET_COMMON_PATH . '/inc/toolset.wpml.compatibility.class.php' );
|
| 185 |
$this->wpml_compatibility = new Toolset_WPML_Compatibility();
|
| 180 |
global $toolset_admin_bar_menu;
|
| 181 |
$toolset_admin_bar_menu = Toolset_Admin_Bar_Menu::get_instance();
|
| 182 |
}
|
| 183 |
+
if ( ! class_exists( 'Toolset_Internal_Compatibility' ) ) {
|
| 184 |
+
require_once( TOOLSET_COMMON_PATH . '/inc/toolset.internal.compatibility.class.php' );
|
| 185 |
+
$this->internal_compatibility = new Toolset_Internal_Compatibility();
|
| 186 |
+
}
|
| 187 |
if ( ! class_exists( 'Toolset_WPML_Compatibility' ) ) {
|
| 188 |
require_once( TOOLSET_COMMON_PATH . '/inc/toolset.wpml.compatibility.class.php' );
|
| 189 |
$this->wpml_compatibility = new Toolset_WPML_Compatibility();
|
library/toolset/toolset-common/changelog.md
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
Common 2.1 (June 13, 2016)
|
| 2 |
- Refactored event-manager library to toolset-event manager to namespace it and avoid conficts with ACF Plugin
|
| 3 |
- Added a new class for promotional and help videos management
|
| 4 |
- Improved compatibility with PHP 5.2
|
| 5 |
- Improved compatibility with WPML, including admin language switchers and loading times
|
| 6 |
- Improved compatibility for CRED file uploads and bundled scripts
|
|
|
|
| 7 |
|
| 8 |
-------------------------------------------------------------------------------------------------------------------
|
| 9 |
|
| 1 |
+
Common 2.2.2 (September 26, 2016)
|
| 2 |
+
- Updated the bundled select2 script to version 4.0.3
|
| 3 |
+
- Fixed a problem with some assets URLs lacking a backslash
|
| 4 |
+
- Improved management of CRED file fields uploads
|
| 5 |
+
- Improved the frontend markup for CRED taxonomy fields
|
| 6 |
+
- Added an internal Toolset compatibility class
|
| 7 |
+
|
| 8 |
+
-------------------------------------------------------------------------------------------------------------------
|
| 9 |
+
|
| 10 |
+
Common 2.2.1 (August 25, 2016)
|
| 11 |
+
- Avoid translating the Toolset top level admin menu label
|
| 12 |
+
|
| 13 |
+
-------------------------------------------------------------------------------------------------------------------
|
| 14 |
+
|
| 15 |
+
Common 2.2 (August 24, 2016)
|
| 16 |
+
- Added compatibility classes for Relevanssi and Beaver Builder
|
| 17 |
+
- Added a CSS components class
|
| 18 |
+
- Improved the Toolset Common assets management
|
| 19 |
+
- Added the Glyphicons library
|
| 20 |
+
|
| 21 |
+
-------------------------------------------------------------------------------------------------------------------
|
| 22 |
+
|
| 23 |
Common 2.1 (June 13, 2016)
|
| 24 |
- Refactored event-manager library to toolset-event manager to namespace it and avoid conficts with ACF Plugin
|
| 25 |
- Added a new class for promotional and help videos management
|
| 26 |
- Improved compatibility with PHP 5.2
|
| 27 |
- Improved compatibility with WPML, including admin language switchers and loading times
|
| 28 |
- Improved compatibility for CRED file uploads and bundled scripts
|
| 29 |
+
- Fixed double slashes on assets URLs
|
| 30 |
|
| 31 |
-------------------------------------------------------------------------------------------------------------------
|
| 32 |
|
library/toolset/toolset-common/changelog.txt
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
Common 2.2 (August 24, 2016)
|
| 2 |
- Added compatibility classes for Relevanssi and Beaver Builder
|
| 3 |
- Added a CSS components class
|
| 1 |
+
Common 2.2.2 (September 26, 2016)
|
| 2 |
+
- Updated the bundled select2 script to version 4.0.3
|
| 3 |
+
- Fixed a problem with some assets URLs lacking a backslash
|
| 4 |
+
- Improved management of CRED file fields uploads
|
| 5 |
+
- Improved the frontend markup for CRED taxonomy fields
|
| 6 |
+
- Added an internal Toolset compatibility class
|
| 7 |
+
|
| 8 |
+
-------------------------------------------------------------------------------------------------------------------
|
| 9 |
+
|
| 10 |
+
Common 2.2.1 (August 25, 2016)
|
| 11 |
+
- Avoid translating the Toolset top level admin menu label
|
| 12 |
+
|
| 13 |
+
-------------------------------------------------------------------------------------------------------------------
|
| 14 |
+
|
| 15 |
Common 2.2 (August 24, 2016)
|
| 16 |
- Added compatibility classes for Relevanssi and Beaver Builder
|
| 17 |
- Added a CSS components class
|
library/toolset/toolset-common/inc/toolset.assets.manager.class.php
CHANGED
|
@@ -332,11 +332,20 @@ class Toolset_Assets_Manager
|
|
| 332 |
TOOLSET_COMMON_VERSION,
|
| 333 |
true
|
| 334 |
);
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
|
|
|
| 338 |
array( 'jquery' ),
|
| 339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
true
|
| 341 |
);
|
| 342 |
$this->scripts['toolset-colorbox'] = new Toolset_Script(
|
| 332 |
TOOLSET_COMMON_VERSION,
|
| 333 |
true
|
| 334 |
);
|
| 335 |
+
|
| 336 |
+
$this->scripts['toolset-select2-compatibility'] = new Toolset_Script(
|
| 337 |
+
'toolset-select2-compatibility',
|
| 338 |
+
$this->assets_url . "/res/js/toolset-select2-compatibility.js",
|
| 339 |
array( 'jquery' ),
|
| 340 |
+
TOOLSET_COMMON_VERSION,
|
| 341 |
+
true
|
| 342 |
+
);
|
| 343 |
+
|
| 344 |
+
$this->scripts['toolset_select2'] = new Toolset_Script(
|
| 345 |
+
'toolset_select2',
|
| 346 |
+
$this->assets_url . "/res/lib/select2/select2.js",
|
| 347 |
+
array( 'jquery', "toolset-select2-compatibility" ),
|
| 348 |
+
'4.0.3',
|
| 349 |
true
|
| 350 |
);
|
| 351 |
$this->scripts['toolset-colorbox'] = new Toolset_Script(
|
library/toolset/toolset-common/inc/toolset.css.component.class.php
CHANGED
|
@@ -45,14 +45,14 @@ if ( ! class_exists( 'Toolset_CssComponent' ) ) {
|
|
| 45 |
}
|
| 46 |
|
| 47 |
public function add_register_scripts($scripts){
|
| 48 |
-
$scripts[]
|
| 49 |
-
$scripts[]
|
| 50 |
return $scripts;
|
| 51 |
}
|
| 52 |
|
| 53 |
public function add_register_styles($styles){
|
| 54 |
-
$styles[]
|
| 55 |
-
$styles[]
|
| 56 |
return $styles;
|
| 57 |
}
|
| 58 |
|
| 45 |
}
|
| 46 |
|
| 47 |
public function add_register_scripts($scripts){
|
| 48 |
+
$scripts['toolset-css-component-buttons'] = new Toolset_Script( 'toolset-css-component-buttons', TOOLSET_COMMON_URL . "/res/js/toolset-bs-component-buttons.js", array('jquery'), false );
|
| 49 |
+
$scripts['toolset-css-component-events'] = new Toolset_Script( 'toolset-css-component-events', TOOLSET_COMMON_URL . "/res/js/toolset-bs-component-events.js", array('jquery'), true );
|
| 50 |
return $scripts;
|
| 51 |
}
|
| 52 |
|
| 53 |
public function add_register_styles($styles){
|
| 54 |
+
$styles['toolset-bs-component-style'] = new Toolset_Style( 'toolset-bs-component-style', TOOLSET_COMMON_URL . '/res/css/toolset-bs-component.css', array(), TOOLSET_VERSION );
|
| 55 |
+
$styles['glyphicons'] = new Toolset_Style( 'glyphicons', TOOLSET_COMMON_URL. '/res/lib/glyphicons/css/glyphicons.css', array(), '3.3.5', 'screen' );
|
| 56 |
return $styles;
|
| 57 |
}
|
| 58 |
|
library/toolset/toolset-common/inc/toolset.internal.compatibility.class.php
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* ########################################
|
| 5 |
+
* Common internal compatibility
|
| 6 |
+
*
|
| 7 |
+
* @since 2.3.0
|
| 8 |
+
* ########################################
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
if ( ! class_exists( 'Toolset_Internal_Compatibility' ) ) {
|
| 12 |
+
|
| 13 |
+
class Toolset_Internal_Compatibility {
|
| 14 |
+
|
| 15 |
+
function __construct() {
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* API hooks for plugins compatibility
|
| 19 |
+
*/
|
| 20 |
+
add_filter( 'wpv_filter_wpv_before_set_meta_query', array( $this, 'resolve_types_checkboxes_views_meta_query' ), 10, 2 );
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Resolve Types checkboxes query filters in Views and WordPress Archives
|
| 25 |
+
*
|
| 26 |
+
* @param $meta_query array Meta query instances
|
| 27 |
+
* @param $data array(
|
| 28 |
+
* domain string 'posts'|'terms'|'users' The kind of query being run. Optional. Defaults to `posts`.
|
| 29 |
+
* )
|
| 30 |
+
*
|
| 31 |
+
* @uses auxiliar_recursive_add_comma_values Auxiliar method for adding recursive values from a comma-separated list.
|
| 32 |
+
* @uses types_filter_query_field_definitions Native Types filter to get Types fields based on some conditions.
|
| 33 |
+
*
|
| 34 |
+
* @return array
|
| 35 |
+
*
|
| 36 |
+
* @since 2.3.0
|
| 37 |
+
*/
|
| 38 |
+
|
| 39 |
+
function resolve_types_checkboxes_views_meta_query( $meta_query, $data = array() ) {
|
| 40 |
+
|
| 41 |
+
$defaults = array(
|
| 42 |
+
'domain' => 'posts'
|
| 43 |
+
);
|
| 44 |
+
$data = wp_parse_args( $data, $defaults );
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Get Types checkboxes meta fields
|
| 48 |
+
*
|
| 49 |
+
* @uses types_filter_query_field_definitions
|
| 50 |
+
*/
|
| 51 |
+
$args = array(
|
| 52 |
+
'domain' => $data['domain'],
|
| 53 |
+
'field_type' => array( 'checkboxes' )
|
| 54 |
+
);
|
| 55 |
+
$fields_to_check = apply_filters( 'types_filter_query_field_definitions', array(), $args );
|
| 56 |
+
$fields_to_check_slugs = wp_list_pluck( $fields_to_check, 'meta_key' );
|
| 57 |
+
|
| 58 |
+
if ( empty( $fields_to_check ) ) {
|
| 59 |
+
return $meta_query;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
global $wp_version;
|
| 63 |
+
|
| 64 |
+
foreach ( $meta_query as $meta_query_index => $meta_query_entry ) {
|
| 65 |
+
if (
|
| 66 |
+
is_array( $meta_query_entry )
|
| 67 |
+
&& isset( $meta_query_entry['key'] )
|
| 68 |
+
&& in_array( $meta_query_entry['key'], $fields_to_check_slugs )
|
| 69 |
+
) {
|
| 70 |
+
|
| 71 |
+
$original_meta_query_entry = $meta_query_entry;
|
| 72 |
+
unset( $meta_query[ $meta_query_index ] );
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* According to http://codex.wordpress.org/Class_Reference/WP_Meta_Query#Accepted_Arguments,
|
| 76 |
+
* $meta_query_entry['value'] can be an array or a string. In case of a string we additionally allow
|
| 77 |
+
* multiple comma-separated values.
|
| 78 |
+
*/
|
| 79 |
+
if ( is_array( $meta_query_entry['value'] ) ) {
|
| 80 |
+
$meta_query_entry_values = $meta_query_entry['value'];
|
| 81 |
+
// Add comma-separated combinations of meta values, since a legit value containing a comma might have been removed
|
| 82 |
+
$meta_query_entry_values = $this->auxiliar_recursive_add_comma_values( $meta_query_entry_values );
|
| 83 |
+
} elseif ( is_string( $meta_query_entry['value'] ) ) {
|
| 84 |
+
$meta_query_entry_values = explode( ',', $meta_query_entry['value'] );
|
| 85 |
+
if ( count( $meta_query_entry_values ) > 1 ) {
|
| 86 |
+
// Add comma-separated combinations of meta values, since a legit value containing a comma might have been removed
|
| 87 |
+
$meta_query_entry_values = $this->auxiliar_recursive_add_comma_values( $meta_query_entry_values );
|
| 88 |
+
// Also add the original one, as it might be a legitimate value containing several commas instead of a comma-separated list
|
| 89 |
+
$meta_query_entry_values[] = $meta_query_entry['value'];
|
| 90 |
+
}
|
| 91 |
+
} else {
|
| 92 |
+
// This can happen if $meta_query_entry['value'] is a number, for example.
|
| 93 |
+
$meta_query_entry_values = array( $meta_query_entry['value'] );
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
$field_definition_candidates = wp_list_filter( $fields_to_check, array( 'meta_key' => $meta_query_entry['key'] ) );
|
| 97 |
+
$field_definition = reset( $field_definition_candidates );
|
| 98 |
+
$field_options = isset( $field_definition['data']['options'] ) ? $field_definition['data']['options'] : array();
|
| 99 |
+
|
| 100 |
+
if ( version_compare( $wp_version, '4.1', '<' ) ) {
|
| 101 |
+
// We can not use nested meta_query entries
|
| 102 |
+
foreach ( $meta_query_entry_values as $value_to_filter_by ) {
|
| 103 |
+
foreach ( $field_options as $field_options_key => $field_options_option ) {
|
| 104 |
+
if (
|
| 105 |
+
$field_options_option['title'] == $value_to_filter_by
|
| 106 |
+
|| (
|
| 107 |
+
isset( $field_options_option['set_value'] )
|
| 108 |
+
&& $field_options_option['set_value'] == $value_to_filter_by
|
| 109 |
+
)
|
| 110 |
+
) {
|
| 111 |
+
$meta_query[] = array(
|
| 112 |
+
'key' => $meta_query_entry['key'],
|
| 113 |
+
'compare' => in_array( $original_meta_query_entry['compare'], array( '!=', 'NOT LIKE', 'NOT IN' ) ) ? 'NOT LIKE' : 'LIKE',
|
| 114 |
+
'value' => $field_options_key,
|
| 115 |
+
'type' => 'CHAR',
|
| 116 |
+
);
|
| 117 |
+
break;
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
} else {
|
| 122 |
+
// We can use nested meta_query entries
|
| 123 |
+
if ( count( $meta_query_entry_values ) < 2 ) {
|
| 124 |
+
// Only one value to filter by, so no need to add nested meta_query entries
|
| 125 |
+
foreach ( $meta_query_entry_values as $value_to_filter_by ) {
|
| 126 |
+
foreach ( $field_options as $field_options_key => $field_options_option ) {
|
| 127 |
+
if (
|
| 128 |
+
$field_options_option['title'] == $value_to_filter_by
|
| 129 |
+
|| (
|
| 130 |
+
isset( $field_options_option['set_value'] )
|
| 131 |
+
&& $field_options_option['set_value'] == $value_to_filter_by
|
| 132 |
+
)
|
| 133 |
+
) {
|
| 134 |
+
$meta_query[] = array(
|
| 135 |
+
'key' => $meta_query_entry['key'],
|
| 136 |
+
'compare' => in_array( $original_meta_query_entry['compare'], array( '!=', 'NOT LIKE', 'NOT IN' ) ) ? 'NOT LIKE' : 'LIKE',
|
| 137 |
+
'value' => $field_options_key,
|
| 138 |
+
'type' => 'CHAR',
|
| 139 |
+
);
|
| 140 |
+
break;
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
} else {
|
| 145 |
+
// We will translate each value into a meta_query clause and add them all as a nested meta_query entry
|
| 146 |
+
$inner_relation = in_array( $original_meta_query_entry['compare'], array( '!=', 'NOT LIKE', 'NOT IN' ) ) ? 'AND' : 'OR';
|
| 147 |
+
$inner_compare = in_array( $original_meta_query_entry['compare'], array( '!=', 'NOT LIKE', 'NOT IN' ) ) ? 'NOT LIKE' : 'LIKE';
|
| 148 |
+
$inner_meta_query = array(
|
| 149 |
+
'relation' => $inner_relation
|
| 150 |
+
);
|
| 151 |
+
foreach ( $meta_query_entry_values as $value_to_filter_by ) {
|
| 152 |
+
foreach ( $field_options as $field_options_key => $field_options_option ) {
|
| 153 |
+
if (
|
| 154 |
+
$field_options_option['title'] == $value_to_filter_by
|
| 155 |
+
|| (
|
| 156 |
+
isset( $field_options_option['set_value'] )
|
| 157 |
+
&& $field_options_option['set_value'] == $value_to_filter_by
|
| 158 |
+
)
|
| 159 |
+
) {
|
| 160 |
+
$inner_meta_query[] = array(
|
| 161 |
+
'key' => $meta_query_entry['key'],
|
| 162 |
+
'compare' => $inner_compare,
|
| 163 |
+
'value' => $field_options_key,
|
| 164 |
+
'type' => 'CHAR',
|
| 165 |
+
);
|
| 166 |
+
break;
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
$meta_query[] = $inner_meta_query;
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
return $meta_query;
|
| 178 |
+
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/**
|
| 182 |
+
* auxiliar_recursive_add_comma_values
|
| 183 |
+
*
|
| 184 |
+
* Transform an array of values into an array with all possible ordered combinations of those values as comma-separated items.
|
| 185 |
+
*
|
| 186 |
+
* @param $values array
|
| 187 |
+
*
|
| 188 |
+
* @return array
|
| 189 |
+
*
|
| 190 |
+
* @since 2.3.0
|
| 191 |
+
*/
|
| 192 |
+
|
| 193 |
+
function auxiliar_recursive_add_comma_values( $values ) {
|
| 194 |
+
$values_orig = array_reverse( $values );
|
| 195 |
+
$values_aux = array();
|
| 196 |
+
$values_end = array();
|
| 197 |
+
if ( count( $values ) > 1 ) {
|
| 198 |
+
foreach ( $values_orig as $v_key => $v_val ) {
|
| 199 |
+
if ( count( $values_aux ) > 0 ) {
|
| 200 |
+
foreach ( $values_aux as &$v_aux ) {
|
| 201 |
+
$values_end[] = $v_val . ',' . $v_aux;
|
| 202 |
+
$v_aux = $v_val . ',' . $v_aux;
|
| 203 |
+
}
|
| 204 |
+
}
|
| 205 |
+
$values_end[] = $v_val;
|
| 206 |
+
$values_aux[] = $v_val;
|
| 207 |
+
}
|
| 208 |
+
} else {
|
| 209 |
+
$values_end = $values;
|
| 210 |
+
}
|
| 211 |
+
return $values_end;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
}
|
library/toolset/toolset-common/inc/toolset.relevanssi.compatibility.class.php
CHANGED
|
@@ -62,11 +62,17 @@ if ( ! class_exists( 'Toolset_Relevanssi_Compatibility' ) ) {
|
|
| 62 |
// Views queries compatibility
|
| 63 |
add_filter( 'wpv_filter_query', array( $this, 'wpv_filter_query_compatibility' ), 99, 3 );
|
| 64 |
add_filter( 'wpv_filter_query_post_process', array( $this, 'wpv_filter_query_post_proccess_compatibility' ), 99, 3 );
|
| 65 |
-
// Register search
|
| 66 |
add_filter( 'wpv_filter_wpv_extend_post_search_content_options', array( $this, 'wpv_extend_post_search_content_options' ) );
|
| 67 |
-
// Fix Relevanssi
|
| 68 |
add_action( 'wpv_action_wpv_before_clone_archive_loop', array( $this, 'wpv_fix_relevanssi_on_archive_loops' ), 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
add_action( 'toolset_action_toolset_relevanssi_do_query_processed', array( $this, 'wpv_fix_relevanssi_max_num_pages' ) );
|
|
|
|
|
|
|
| 70 |
}
|
| 71 |
}
|
| 72 |
|
|
@@ -186,7 +192,6 @@ if ( ! class_exists( 'Toolset_Relevanssi_Compatibility' ) ) {
|
|
| 186 |
'field_type' => array( 'textfield', 'textarea', 'wysiwyg' ),
|
| 187 |
'group_id' => $group->get_id()
|
| 188 |
);
|
| 189 |
-
// https://onthegosystems.myjetbrains.com/youtrack/issue/types-742
|
| 190 |
$fields_in_group = apply_filters( 'types_filter_query_field_definitions', array(), $args );
|
| 191 |
if ( ! empty( $fields_in_group ) ) {
|
| 192 |
$indexable_fields[ $group->get_display_name() ] = $fields_in_group;
|
|
@@ -611,6 +616,7 @@ if ( ! class_exists( 'Toolset_Relevanssi_Compatibility' ) ) {
|
|
| 611 |
&& ! empty( $_GET['wpv_post_search'] )
|
| 612 |
) {
|
| 613 |
// Modify the POSTed search
|
|
|
|
| 614 |
$relevanssi_posts = relevanssi_do_query( $post_query );
|
| 615 |
do_action( 'toolset_action_toolset_relevanssi_do_query_processed', $post_query );
|
| 616 |
} else if (
|
|
@@ -620,6 +626,7 @@ if ( ! class_exists( 'Toolset_Relevanssi_Compatibility' ) ) {
|
|
| 620 |
) {
|
| 621 |
// Modify the specific search
|
| 622 |
//add_filter('posts_request', 'relevanssi_prevent_default_request', 10, 3 );
|
|
|
|
| 623 |
$relevanssi_posts = relevanssi_do_query( $post_query );
|
| 624 |
do_action( 'toolset_action_toolset_relevanssi_do_query_processed', $post_query );
|
| 625 |
}
|
|
@@ -696,14 +703,16 @@ if ( ! class_exists( 'Toolset_Relevanssi_Compatibility' ) ) {
|
|
| 696 |
}
|
| 697 |
} else if (
|
| 698 |
is_search()
|
| 699 |
-
&& isset( $
|
| 700 |
-
&& ! empty( $
|
| 701 |
) {
|
| 702 |
$do_relevanssi_query = true;
|
| 703 |
}
|
| 704 |
|
| 705 |
if ( $do_relevanssi_query ) {
|
|
|
|
| 706 |
$relevanssi_posts = relevanssi_do_query( $query );
|
|
|
|
| 707 |
$wpa_object = isset( $args['wpa_object'] ) ? $args['wpa_object'] : null;
|
| 708 |
if ( $wpa_object ) {
|
| 709 |
if ( empty( $relevanssi_posts ) ) {
|
|
@@ -738,6 +747,19 @@ if ( ! class_exists( 'Toolset_Relevanssi_Compatibility' ) ) {
|
|
| 738 |
}
|
| 739 |
}
|
| 740 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 741 |
/**
|
| 742 |
* wpv_fix_relevanssi_max_num_pages
|
| 743 |
*
|
|
@@ -747,10 +769,27 @@ if ( ! class_exists( 'Toolset_Relevanssi_Compatibility' ) ) {
|
|
| 747 |
*/
|
| 748 |
|
| 749 |
function wpv_fix_relevanssi_max_num_pages( $query ) {
|
| 750 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 751 |
$query->max_num_pages = 1;
|
| 752 |
}
|
| 753 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 754 |
|
| 755 |
}
|
| 756 |
|
| 62 |
// Views queries compatibility
|
| 63 |
add_filter( 'wpv_filter_query', array( $this, 'wpv_filter_query_compatibility' ), 99, 3 );
|
| 64 |
add_filter( 'wpv_filter_query_post_process', array( $this, 'wpv_filter_query_post_proccess_compatibility' ), 99, 3 );
|
| 65 |
+
// Register search content options
|
| 66 |
add_filter( 'wpv_filter_wpv_extend_post_search_content_options', array( $this, 'wpv_extend_post_search_content_options' ) );
|
| 67 |
+
// Fix Relevanssi on archive pages by forcing the Relevanssi query when needed
|
| 68 |
add_action( 'wpv_action_wpv_before_clone_archive_loop', array( $this, 'wpv_fix_relevanssi_on_archive_loops' ), 10, 2 );
|
| 69 |
+
// Fix Relevanssi sorting as we were getting the Views objects one
|
| 70 |
+
// Note that we do not allow table sorting on Relevanssi searches for now
|
| 71 |
+
add_action( 'toolset_action_toolset_relevanssi_do_query_before', array( $this, 'wpv_fix_relevanssi_orderby' ) );
|
| 72 |
+
// Fix Relevanssi max_num_pages
|
| 73 |
add_action( 'toolset_action_toolset_relevanssi_do_query_processed', array( $this, 'wpv_fix_relevanssi_max_num_pages' ) );
|
| 74 |
+
// Fix Relevanssi returning posts as objects but not as WP_Post objects
|
| 75 |
+
add_action( 'toolset_action_toolset_relevanssi_do_query_processed', array( $this, 'wpv_fix_relevanssi_return_as_post_objects' ) );
|
| 76 |
}
|
| 77 |
}
|
| 78 |
|
| 192 |
'field_type' => array( 'textfield', 'textarea', 'wysiwyg' ),
|
| 193 |
'group_id' => $group->get_id()
|
| 194 |
);
|
|
|
|
| 195 |
$fields_in_group = apply_filters( 'types_filter_query_field_definitions', array(), $args );
|
| 196 |
if ( ! empty( $fields_in_group ) ) {
|
| 197 |
$indexable_fields[ $group->get_display_name() ] = $fields_in_group;
|
| 616 |
&& ! empty( $_GET['wpv_post_search'] )
|
| 617 |
) {
|
| 618 |
// Modify the POSTed search
|
| 619 |
+
do_action( 'toolset_action_toolset_relevanssi_do_query_before', $post_query );
|
| 620 |
$relevanssi_posts = relevanssi_do_query( $post_query );
|
| 621 |
do_action( 'toolset_action_toolset_relevanssi_do_query_processed', $post_query );
|
| 622 |
} else if (
|
| 626 |
) {
|
| 627 |
// Modify the specific search
|
| 628 |
//add_filter('posts_request', 'relevanssi_prevent_default_request', 10, 3 );
|
| 629 |
+
do_action( 'toolset_action_toolset_relevanssi_do_query_before', $post_query );
|
| 630 |
$relevanssi_posts = relevanssi_do_query( $post_query );
|
| 631 |
do_action( 'toolset_action_toolset_relevanssi_do_query_processed', $post_query );
|
| 632 |
}
|
| 703 |
}
|
| 704 |
} else if (
|
| 705 |
is_search()
|
| 706 |
+
&& isset( $query->query_vars['s'] )
|
| 707 |
+
&& ! empty( $query->query_vars['s'] )
|
| 708 |
) {
|
| 709 |
$do_relevanssi_query = true;
|
| 710 |
}
|
| 711 |
|
| 712 |
if ( $do_relevanssi_query ) {
|
| 713 |
+
do_action( 'toolset_action_toolset_relevanssi_do_query_before', $query );
|
| 714 |
$relevanssi_posts = relevanssi_do_query( $query );
|
| 715 |
+
do_action( 'toolset_action_toolset_relevanssi_do_query_processed', $query );
|
| 716 |
$wpa_object = isset( $args['wpa_object'] ) ? $args['wpa_object'] : null;
|
| 717 |
if ( $wpa_object ) {
|
| 718 |
if ( empty( $relevanssi_posts ) ) {
|
| 747 |
}
|
| 748 |
}
|
| 749 |
|
| 750 |
+
/**
|
| 751 |
+
* wpv_fix_relevanssi_orderby
|
| 752 |
+
*
|
| 753 |
+
* Relevanssi only applies its sorting options when no other sorting setting was passed to the query it modifies.
|
| 754 |
+
* Views will always set a default sorting setting, hence on Relevanssi queries we need to null it.
|
| 755 |
+
*
|
| 756 |
+
* @since 2.3.0
|
| 757 |
+
*/
|
| 758 |
+
|
| 759 |
+
function wpv_fix_relevanssi_orderby( $query ) {
|
| 760 |
+
$query->set( 'orderby', null );
|
| 761 |
+
}
|
| 762 |
+
|
| 763 |
/**
|
| 764 |
* wpv_fix_relevanssi_max_num_pages
|
| 765 |
*
|
| 769 |
*/
|
| 770 |
|
| 771 |
function wpv_fix_relevanssi_max_num_pages( $query ) {
|
| 772 |
+
if (
|
| 773 |
+
isset( $query->query_vars["posts_per_page"] )
|
| 774 |
+
&& $query->query_vars["posts_per_page"] == -1
|
| 775 |
+
) {
|
| 776 |
$query->max_num_pages = 1;
|
| 777 |
}
|
| 778 |
}
|
| 779 |
+
|
| 780 |
+
/**
|
| 781 |
+
* wpv_fix_relevanssi_return_as_post_objects
|
| 782 |
+
*
|
| 783 |
+
* Relevanssi return posts as dummy objects instead of WP_Post instances, and we need them.
|
| 784 |
+
*
|
| 785 |
+
* @since 2.3
|
| 786 |
+
*/
|
| 787 |
+
|
| 788 |
+
function wpv_fix_relevanssi_return_as_post_objects( $query ) {
|
| 789 |
+
if ( $query->posts ) {
|
| 790 |
+
$query->posts = array_map( 'get_post', $query->posts );
|
| 791 |
+
}
|
| 792 |
+
}
|
| 793 |
|
| 794 |
}
|
| 795 |
|
library/toolset/toolset-common/loader.php
CHANGED
|
@@ -28,8 +28,8 @@
|
|
| 28 |
* Now that we have a unique version for all plugins
|
| 29 |
* we define the version here
|
| 30 |
*/
|
|
|
|
| 31 |
|
| 32 |
-
$toolset_common_version = 220001;
|
| 33 |
|
| 34 |
// ----------------------------------------------------------------------//
|
| 35 |
// WARNING * WARNING * WARNING
|
| 28 |
* Now that we have a unique version for all plugins
|
| 29 |
* we define the version here
|
| 30 |
*/
|
| 31 |
+
$toolset_common_version = 222001;
|
| 32 |
|
|
|
|
| 33 |
|
| 34 |
// ----------------------------------------------------------------------//
|
| 35 |
// WARNING * WARNING * WARNING
|
library/toolset/toolset-common/loader.php.orig
DELETED
|
@@ -1,95 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
*
|
| 5 |
-
* This file is responsible for loading the latest version of the Toolset Common lbraries.
|
| 6 |
-
*
|
| 7 |
-
* To use it in a plugin or theme you should include this file early in the
|
| 8 |
-
* plugin loader and then call the toolset_common_initialize function.
|
| 9 |
-
* The toolset_common_initialize should be passed the file path to the directory
|
| 10 |
-
* where this file is located and also the url to this directory.
|
| 11 |
-
*
|
| 12 |
-
*
|
| 13 |
-
*
|
| 14 |
-
* -----------------------------------------------------------------------
|
| 15 |
-
*
|
| 16 |
-
* This version number should always be incremented by 1 whenever a change
|
| 17 |
-
* is made to the toolset-common code.
|
| 18 |
-
* The version number will then be used to work out which plugin has the latest
|
| 19 |
-
* version of the code.
|
| 20 |
-
*
|
| 21 |
-
* The version number will have a format of XXYYYY
|
| 22 |
-
* where XX is the future target Toolset Common version number, built upon the stable released one stated in changelog.txt plus 1
|
| 23 |
-
* and YYYY is incremented by 1 on each change to the Toolset Common repo
|
| 24 |
-
* so we allow up to 10000 changes per dev cycle.
|
| 25 |
-
*
|
| 26 |
-
*/
|
| 27 |
-
/**
|
| 28 |
-
* Now that we have a unique version for all plugins
|
| 29 |
-
* we define the version here
|
| 30 |
-
*/
|
| 31 |
-
|
| 32 |
-
<<<<<<< 8852ecb6b66be48726cc9736b8dad401d06ba559
|
| 33 |
-
$toolset_common_version = 200103;
|
| 34 |
-
=======
|
| 35 |
-
$toolset_common_version = 200102;
|
| 36 |
-
>>>>>>> [types-251/cred-731] Fixed: Types using #default-value and #value differently than CRED
|
| 37 |
-
|
| 38 |
-
// ----------------------------------------------------------------------//
|
| 39 |
-
// WARNING * WARNING * WARNING
|
| 40 |
-
// ----------------------------------------------------------------------//
|
| 41 |
-
|
| 42 |
-
// Don't modify or add to this code.
|
| 43 |
-
// This is only responsible for making sure the latest version of common is loaded.
|
| 44 |
-
|
| 45 |
-
global $toolset_common_paths;
|
| 46 |
-
|
| 47 |
-
if ( ! isset( $toolset_common_paths ) ) {
|
| 48 |
-
$toolset_common_paths = array();
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
-
if ( ! isset( $toolset_common_paths[ $toolset_common_version ] ) ) {
|
| 52 |
-
// Save the path to this version.
|
| 53 |
-
$toolset_common_paths[ $toolset_common_version ]['path'] = str_replace( '\\', '/', dirname( __FILE__ ) );
|
| 54 |
-
}
|
| 55 |
-
|
| 56 |
-
if ( ! function_exists( 'toolset_common_plugins_loaded' ) ) {
|
| 57 |
-
function toolset_common_plugins_loaded() {
|
| 58 |
-
global $toolset_common_paths;
|
| 59 |
-
|
| 60 |
-
// find the latest version
|
| 61 |
-
$latest = 0;
|
| 62 |
-
foreach ( $toolset_common_paths as $key => $data ) {
|
| 63 |
-
if ( $key > $latest ) {
|
| 64 |
-
$latest = $key;
|
| 65 |
-
}
|
| 66 |
-
}
|
| 67 |
-
if ( $latest > 0 ) {
|
| 68 |
-
require_once $toolset_common_paths[ $latest ]['path'] . '/toolset-common-loader.php';
|
| 69 |
-
toolset_common_set_constants_and_start( $toolset_common_paths[ $latest ]['url'] );
|
| 70 |
-
}
|
| 71 |
-
}
|
| 72 |
-
add_action( 'plugins_loaded', 'toolset_common_plugins_loaded', -1 );
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
if ( ! function_exists( 'toolset_common_initialize' ) ) {
|
| 76 |
-
|
| 77 |
-
function toolset_common_initialize( $path, $url ) {
|
| 78 |
-
global $toolset_common_paths;
|
| 79 |
-
|
| 80 |
-
$path = str_replace( '\\', '/', $path );
|
| 81 |
-
|
| 82 |
-
if ( substr( $path, strlen( $path ) - 1 ) == '/' ) {
|
| 83 |
-
$path = substr( $path, 0, strlen( $path ) - 1 );
|
| 84 |
-
}
|
| 85 |
-
|
| 86 |
-
// Save the url in the matching path
|
| 87 |
-
foreach ( $toolset_common_paths as $key => $data ) {
|
| 88 |
-
if ( $toolset_common_paths[ $key ]['path'] == $path ) {
|
| 89 |
-
$toolset_common_paths[ $key ]['url'] = $url;
|
| 90 |
-
break;
|
| 91 |
-
}
|
| 92 |
-
}
|
| 93 |
-
}
|
| 94 |
-
}
|
| 95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
library/toolset/toolset-common/res/css/toolset-common.css
CHANGED
|
@@ -326,4 +326,8 @@ Overlay
|
|
| 326 |
padding: 5px 15px;
|
| 327 |
color: #c09853;
|
| 328 |
background: #fcf8e3;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
}
|
| 326 |
padding: 5px 15px;
|
| 327 |
color: #c09853;
|
| 328 |
background: #fcf8e3;
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
.select2-container--open{
|
| 332 |
+
z-index: 10000 !important;
|
| 333 |
}
|
library/toolset/toolset-common/res/js/toolset-select2-compatibility.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* This module is for hijacking toolset_select2 4.0 prototype to make it compatible with toolset_select2 2.0 method calling
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
var ToolsetCommon = ToolsetCommon || {};
|
| 6 |
+
|
| 7 |
+
ToolsetCommon.initSelect2Compatibility = function( $ ){
|
| 8 |
+
if(!jQuery().toolset_select2)
|
| 9 |
+
return
|
| 10 |
+
//preserve original toolset_select2 object
|
| 11 |
+
jQuery.fn.toolset_select2_original = jQuery.fn.toolset_select2;
|
| 12 |
+
//backwards compatible object
|
| 13 |
+
jQuery.fn.toolset_select2 = function(options, param){
|
| 14 |
+
if(typeof options == "string"){
|
| 15 |
+
ToolsetCommon.toolset_select2ExecMethods(this, options, param)
|
| 16 |
+
}else if (typeof options == "object"){
|
| 17 |
+
if(jQuery(this)){
|
| 18 |
+
return ToolsetCommon.toolset_select2ConvertInputToSelect(jQuery(this), options);
|
| 19 |
+
}
|
| 20 |
+
}else if(options === null || options === undefined){
|
| 21 |
+
if(jQuery(this)){
|
| 22 |
+
return ToolsetCommon.toolset_select2ConvertInputToSelect(jQuery(this));
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
};
|
| 26 |
+
};
|
| 27 |
+
/*
|
| 28 |
+
* @description convert ordinary inputs to select elements, and apply toolset_select2 to them.
|
| 29 |
+
*/
|
| 30 |
+
ToolsetCommon.toolset_select2ConvertInputToSelect = function(el, options){
|
| 31 |
+
if(ToolsetCommon.toolset_select2ConversionRequired(el, options) && typeof el[0] != "string" && el[0] !== undefined){
|
| 32 |
+
//check if the element isn't previously initailized to prevent duplicate elements
|
| 33 |
+
if(jQuery(el).data("toolset_select2"))
|
| 34 |
+
return el;
|
| 35 |
+
|
| 36 |
+
//create a select element to replace the normal input
|
| 37 |
+
var convertedEl = jQuery("<select></select>");
|
| 38 |
+
|
| 39 |
+
//if is a tags field create a hidden input to hold value for backwards compatibility with v2
|
| 40 |
+
if(options && options.hasOwnProperty("tags") && options.tags){
|
| 41 |
+
var hiddenInput = jQuery("<input type='hidden' />");
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
//copy all attributes to the new select element
|
| 45 |
+
jQuery.each(jQuery(el).get(0).attributes, function() {
|
| 46 |
+
if(hiddenInput && this.specified && (this.name == "name" || this.name == "class")){
|
| 47 |
+
jQuery(hiddenInput).attr(this.name, this.value);
|
| 48 |
+
}
|
| 49 |
+
if(this.specified && this.name != "type") {
|
| 50 |
+
jQuery(convertedEl).attr(this.name, this.value);
|
| 51 |
+
}
|
| 52 |
+
});
|
| 53 |
+
|
| 54 |
+
//create dynamicClass with toolset_select2 prefix and add to the new element to be able to reference the element in the future
|
| 55 |
+
var dynamicClass = ToolsetCommon.addSelect2RandomClassName(convertedEl);
|
| 56 |
+
var hiddenDynamicClass = ToolsetCommon.addSelect2RandomClassName(hiddenInput);
|
| 57 |
+
|
| 58 |
+
//remove the old input and replace it with the new select
|
| 59 |
+
jQuery(el).replaceWith(convertedEl);
|
| 60 |
+
jQuery(el).remove();
|
| 61 |
+
|
| 62 |
+
//Insert the hidden input after the select
|
| 63 |
+
if(hiddenInput){
|
| 64 |
+
jQuery(hiddenInput).insertAfter("."+dynamicClass);
|
| 65 |
+
}
|
| 66 |
+
//initialize toolset_select2
|
| 67 |
+
convertedEl = jQuery("."+dynamicClass).toolset_select2_original(options);
|
| 68 |
+
|
| 69 |
+
//Add event listener on tags fields to update hidden inputs on change
|
| 70 |
+
if(options && options.hasOwnProperty("tags")){
|
| 71 |
+
jQuery(convertedEl).on("change", function(){
|
| 72 |
+
var actualValue = jQuery(convertedEl).val();
|
| 73 |
+
|
| 74 |
+
if(actualValue && actualValue.length > 0 && hiddenInput){
|
| 75 |
+
jQuery("."+hiddenDynamicClass).attr("value", actualValue.join(","));
|
| 76 |
+
}
|
| 77 |
+
});
|
| 78 |
+
jQuery("."+dynamicClass).trigger("change");
|
| 79 |
+
}
|
| 80 |
+
return convertedEl;
|
| 81 |
+
}else{
|
| 82 |
+
var dynamicClass = ToolsetCommon.addSelect2RandomClassName(el);
|
| 83 |
+
return jQuery("."+dynamicClass).toolset_select2_original(options);
|
| 84 |
+
}
|
| 85 |
+
};
|
| 86 |
+
/*
|
| 87 |
+
* @description checks if input needs to be converted to a select element.
|
| 88 |
+
*/
|
| 89 |
+
ToolsetCommon.toolset_select2ConversionRequired = function(el, options){
|
| 90 |
+
if(options && options.hasOwnProperty("tags")){
|
| 91 |
+
jQuery(el).prop("multiple", "multiple");
|
| 92 |
+
options.multiple = true;
|
| 93 |
+
if(options.tags instanceof Array && options.tags.length > 0){
|
| 94 |
+
options.data = [];
|
| 95 |
+
options.tags.forEach(function(item){
|
| 96 |
+
options.data.push({
|
| 97 |
+
id: item,
|
| 98 |
+
text: item
|
| 99 |
+
});
|
| 100 |
+
});
|
| 101 |
+
options.tags = true;
|
| 102 |
+
}
|
| 103 |
+
return true;
|
| 104 |
+
}else{
|
| 105 |
+
return (jQuery(el).prop("tagName") !== "SELECT");
|
| 106 |
+
}
|
| 107 |
+
};
|
| 108 |
+
|
| 109 |
+
/*
|
| 110 |
+
* @description executes toolset_select2 methods after filtering deprecated ones, and applying compatible replacement.
|
| 111 |
+
*/
|
| 112 |
+
|
| 113 |
+
ToolsetCommon.toolset_select2ExecMethods = function(el, method, param){
|
| 114 |
+
if(jQuery(el).data("toolset_select2")){
|
| 115 |
+
var elm_id = jQuery(el).attr("id");
|
| 116 |
+
|
| 117 |
+
switch(method){
|
| 118 |
+
case "val":
|
| 119 |
+
if(param !== undefined && param !== null){
|
| 120 |
+
jQuery(el).val(param).trigger("change");
|
| 121 |
+
}else{
|
| 122 |
+
return jQuery(el).val();
|
| 123 |
+
}
|
| 124 |
+
break;
|
| 125 |
+
case "enable":
|
| 126 |
+
jQuery(el).prop("disabled", !param);
|
| 127 |
+
break;
|
| 128 |
+
case "data":
|
| 129 |
+
jQuery(el).val(param.ID).trigger("change").trigger("toolset_select2:selecting");
|
| 130 |
+
break;
|
| 131 |
+
case "close":
|
| 132 |
+
jQuery(el).toolset_select2_original("close");
|
| 133 |
+
break;
|
| 134 |
+
default:
|
| 135 |
+
jQuery("#"+elm_id).toolset_select2_original(method, param);
|
| 136 |
+
break;
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
};
|
| 140 |
+
|
| 141 |
+
/*
|
| 142 |
+
* @description creates and adds dynamic class name to the element.
|
| 143 |
+
*/
|
| 144 |
+
ToolsetCommon.addSelect2RandomClassName = function(el) {
|
| 145 |
+
var className = ("toolset_select2_prefix_" + (Math.round(Math.random() * (100000 - 99) + 99)).toString());
|
| 146 |
+
jQuery(el).addClass(className);
|
| 147 |
+
return className;
|
| 148 |
+
};
|
| 149 |
+
|
| 150 |
+
/*
|
| 151 |
+
* @description start the compatibility listener on document ready.
|
| 152 |
+
*/
|
| 153 |
+
jQuery(document).ready(function($){ ToolsetCommon.initSelect2Compatibility(); });
|
library/toolset/toolset-common/res/lib/select2/select2-overrides.css
CHANGED
|
@@ -1,26 +1,35 @@
|
|
| 1 |
-
/* These are overrides to get the
|
| 2 |
* want in the css editor
|
| 3 |
*/
|
| 4 |
|
| 5 |
-
.
|
| 6 |
|
| 7 |
z-index: 19998;
|
| 8 |
}
|
| 9 |
|
| 10 |
-
.
|
| 11 |
z-index: 19999;
|
| 12 |
}
|
| 13 |
|
| 14 |
|
| 15 |
-
.
|
| 16 |
z-index: 20000;
|
| 17 |
}
|
| 18 |
|
| 19 |
-
.
|
| 20 |
margin-bottom: 0px !important;
|
| 21 |
}
|
| 22 |
|
| 23 |
-
.
|
| 24 |
padding-left: 0px !important;
|
| 25 |
}
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* These are overrides to get the toolset_select2 to behave how we
|
| 2 |
* want in the css editor
|
| 3 |
*/
|
| 4 |
|
| 5 |
+
.toolset_select2-drop-mask {
|
| 6 |
|
| 7 |
z-index: 19998;
|
| 8 |
}
|
| 9 |
|
| 10 |
+
.toolset_select2-drop {
|
| 11 |
z-index: 19999;
|
| 12 |
}
|
| 13 |
|
| 14 |
|
| 15 |
+
.toolset_select2-search {
|
| 16 |
z-index: 20000;
|
| 17 |
}
|
| 18 |
|
| 19 |
+
.toolset_select2-results li {
|
| 20 |
margin-bottom: 0px !important;
|
| 21 |
}
|
| 22 |
|
| 23 |
+
.toolset_select2-results {
|
| 24 |
padding-left: 0px !important;
|
| 25 |
}
|
| 26 |
|
| 27 |
+
/**
|
| 28 |
+
* Cmpatibility with toolset_select2 4.X.X
|
| 29 |
+
*
|
| 30 |
+
* @since 2.3.0
|
| 31 |
+
*/
|
| 32 |
+
|
| 33 |
+
.toolset_select2-container {
|
| 34 |
+
z-index: 9999;
|
| 35 |
+
}
|
library/toolset/toolset-common/res/lib/select2/select2.css
CHANGED
|
@@ -1,704 +1,484 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
.
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
display: block;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
height: 26px;
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
border: 1px solid #aaa;
|
| 36 |
-
white-space: nowrap;
|
| 37 |
-
line-height: 26px;
|
| 38 |
-
color: #444;
|
| 39 |
-
text-decoration: none;
|
| 40 |
-
|
| 41 |
border-radius: 4px;
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
user-select: none;
|
| 50 |
-
|
| 51 |
-
background-color: #fff;
|
| 52 |
-
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.5, #fff));
|
| 53 |
-
background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 50%);
|
| 54 |
-
background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 50%);
|
| 55 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffffff', endColorstr = '#eeeeee', GradientType = 0);
|
| 56 |
-
background-image: linear-gradient(to top, #eee 0%, #fff 50%);
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
html[dir="rtl"] .select2-container .select2-choice {
|
| 60 |
-
padding: 0 8px 0 0;
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
.select2-container.select2-drop-above .select2-choice {
|
| 64 |
-
border-bottom-color: #aaa;
|
| 65 |
-
|
| 66 |
-
border-radius: 0 0 4px 4px;
|
| 67 |
-
|
| 68 |
-
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.9, #fff));
|
| 69 |
-
background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 90%);
|
| 70 |
-
background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 90%);
|
| 71 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);
|
| 72 |
-
background-image: linear-gradient(to bottom, #eee 0%, #fff 90%);
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
.select2-container.select2-allowclear .select2-choice .select2-chosen {
|
| 76 |
-
margin-right: 42px;
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
.select2-container .select2-choice > .select2-chosen {
|
| 80 |
-
margin-right: 26px;
|
| 81 |
-
display: block;
|
| 82 |
-
overflow: hidden;
|
| 83 |
-
|
| 84 |
-
white-space: nowrap;
|
| 85 |
-
|
| 86 |
-
text-overflow: ellipsis;
|
| 87 |
-
float: none;
|
| 88 |
-
width: auto;
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
html[dir="rtl"] .select2-container .select2-choice > .select2-chosen {
|
| 92 |
-
margin-left: 26px;
|
| 93 |
-
margin-right: 0;
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
.select2-container .select2-choice abbr {
|
| 97 |
-
display: none;
|
| 98 |
-
width: 12px;
|
| 99 |
-
height: 12px;
|
| 100 |
-
position: absolute;
|
| 101 |
-
right: 24px;
|
| 102 |
-
top: 8px;
|
| 103 |
-
|
| 104 |
-
font-size: 1px;
|
| 105 |
-
text-decoration: none;
|
| 106 |
-
|
| 107 |
-
border: 0;
|
| 108 |
-
background: url('select2.png') right top no-repeat;
|
| 109 |
cursor: pointer;
|
| 110 |
-
outline: 0;
|
| 111 |
-
}
|
| 112 |
-
|
| 113 |
-
.select2-container.select2-allowclear .select2-choice abbr {
|
| 114 |
display: inline-block;
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
.
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
cursor: pointer;
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
top: 0;
|
| 129 |
-
min-height: 100%;
|
| 130 |
-
min-width: 100%;
|
| 131 |
-
height: auto;
|
| 132 |
-
width: auto;
|
| 133 |
-
opacity: 0;
|
| 134 |
-
z-index: 9998;
|
| 135 |
-
/* styles required for IE to work */
|
| 136 |
-
background-color: #fff;
|
| 137 |
-
filter: alpha(opacity=0);
|
| 138 |
-
}
|
| 139 |
-
|
| 140 |
-
.select2-drop {
|
| 141 |
-
width: 100%;
|
| 142 |
-
margin-top: -1px;
|
| 143 |
-
position: absolute;
|
| 144 |
-
z-index: 9999;
|
| 145 |
-
top: 100%;
|
| 146 |
-
|
| 147 |
-
background: #fff;
|
| 148 |
-
color: #000;
|
| 149 |
-
border: 1px solid #aaa;
|
| 150 |
-
border-top: 0;
|
| 151 |
-
|
| 152 |
-
border-radius: 0 0 4px 4px;
|
| 153 |
-
|
| 154 |
-
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
|
| 155 |
-
box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
|
| 156 |
-
}
|
| 157 |
-
|
| 158 |
-
.select2-drop.select2-drop-above {
|
| 159 |
-
margin-top: 1px;
|
| 160 |
-
border-top: 1px solid #aaa;
|
| 161 |
-
border-bottom: 0;
|
| 162 |
-
|
| 163 |
-
border-radius: 4px 4px 0 0;
|
| 164 |
-
|
| 165 |
-
-webkit-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
|
| 166 |
-
box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
|
| 167 |
-
}
|
| 168 |
-
|
| 169 |
-
.select2-drop-active {
|
| 170 |
-
border: 1px solid #5897fb;
|
| 171 |
-
border-top: none;
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
.select2-drop.select2-drop-above.select2-drop-active {
|
| 175 |
-
border-top: 1px solid #5897fb;
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
-
.select2-drop-auto-width {
|
| 179 |
-
border-top: 1px solid #aaa;
|
| 180 |
-
width: auto;
|
| 181 |
-
}
|
| 182 |
-
|
| 183 |
-
.select2-drop-auto-width .select2-search {
|
| 184 |
-
padding-top: 4px;
|
| 185 |
-
}
|
| 186 |
-
|
| 187 |
-
.select2-container .select2-choice .select2-arrow {
|
| 188 |
-
display: inline-block;
|
| 189 |
-
width: 18px;
|
| 190 |
-
height: 100%;
|
| 191 |
-
position: absolute;
|
| 192 |
-
right: 0;
|
| 193 |
-
top: 0;
|
| 194 |
-
|
| 195 |
border-left: 1px solid #aaa;
|
| 196 |
-
border-radius:
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
background: #ccc;
|
| 201 |
-
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
|
| 202 |
-
background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%);
|
| 203 |
-
background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
|
| 204 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#eeeeee', endColorstr = '#cccccc', GradientType = 0);
|
| 205 |
-
background-image: linear-gradient(to top, #ccc 0%, #eee 60%);
|
| 206 |
-
}
|
| 207 |
-
|
| 208 |
-
html[dir="rtl"] .select2-container .select2-choice .select2-arrow {
|
| 209 |
-
left: 0;
|
| 210 |
-
right: auto;
|
| 211 |
-
|
| 212 |
-
border-left: none;
|
| 213 |
-
border-right: 1px solid #aaa;
|
| 214 |
-
border-radius: 4px 0 0 4px;
|
| 215 |
-
}
|
| 216 |
-
|
| 217 |
-
.select2-container .select2-choice .select2-arrow b {
|
| 218 |
-
display: block;
|
| 219 |
-
width: 100%;
|
| 220 |
-
height: 100%;
|
| 221 |
-
background: url('select2.png') no-repeat 0 1px;
|
| 222 |
-
}
|
| 223 |
-
|
| 224 |
-
html[dir="rtl"] .select2-container .select2-choice .select2-arrow b {
|
| 225 |
-
background-position: 2px 1px;
|
| 226 |
-
}
|
| 227 |
-
|
| 228 |
-
.select2-search {
|
| 229 |
-
display: inline-block;
|
| 230 |
-
width: 100%;
|
| 231 |
-
min-height: 26px;
|
| 232 |
-
margin: 0;
|
| 233 |
-
padding-left: 4px;
|
| 234 |
-
padding-right: 4px;
|
| 235 |
-
|
| 236 |
-
position: relative;
|
| 237 |
-
z-index: 10000;
|
| 238 |
-
|
| 239 |
-
white-space: nowrap;
|
| 240 |
-
}
|
| 241 |
-
|
| 242 |
-
.select2-search input {
|
| 243 |
-
width: 100%;
|
| 244 |
-
height: auto !important;
|
| 245 |
-
min-height: 26px;
|
| 246 |
-
padding: 4px 20px 4px 5px;
|
| 247 |
-
margin: 0;
|
| 248 |
-
|
| 249 |
-
outline: 0;
|
| 250 |
-
font-family: sans-serif;
|
| 251 |
-
font-size: 1em;
|
| 252 |
-
|
| 253 |
-
border: 1px solid #aaa;
|
| 254 |
-
border-radius: 0;
|
| 255 |
-
|
| 256 |
-
-webkit-box-shadow: none;
|
| 257 |
-
box-shadow: none;
|
| 258 |
-
|
| 259 |
-
background: #fff url('select2.png') no-repeat 100% -22px;
|
| 260 |
-
background: url('select2.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
|
| 261 |
-
background: url('select2.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
|
| 262 |
-
background: url('select2.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
|
| 263 |
-
background: url('select2.png') no-repeat 100% -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
|
| 264 |
-
}
|
| 265 |
-
|
| 266 |
-
html[dir="rtl"] .select2-search input {
|
| 267 |
-
padding: 4px 5px 4px 20px;
|
| 268 |
-
|
| 269 |
-
background: #fff url('select2.png') no-repeat -37px -22px;
|
| 270 |
-
background: url('select2.png') no-repeat -37px -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
|
| 271 |
-
background: url('select2.png') no-repeat -37px -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
|
| 272 |
-
background: url('select2.png') no-repeat -37px -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
|
| 273 |
-
background: url('select2.png') no-repeat -37px -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
|
| 274 |
-
}
|
| 275 |
-
|
| 276 |
-
.select2-drop.select2-drop-above .select2-search input {
|
| 277 |
-
margin-top: 4px;
|
| 278 |
-
}
|
| 279 |
-
|
| 280 |
-
.select2-search input.select2-active {
|
| 281 |
-
background: #fff url('select2-spinner.gif') no-repeat 100%;
|
| 282 |
-
background: url('select2-spinner.gif') no-repeat 100%, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
|
| 283 |
-
background: url('select2-spinner.gif') no-repeat 100%, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
|
| 284 |
-
background: url('select2-spinner.gif') no-repeat 100%, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
|
| 285 |
-
background: url('select2-spinner.gif') no-repeat 100%, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
|
| 286 |
-
}
|
| 287 |
-
|
| 288 |
-
.select2-container-active .select2-choice,
|
| 289 |
-
.select2-container-active .select2-choices {
|
| 290 |
-
border: 1px solid #5897fb;
|
| 291 |
-
outline: none;
|
| 292 |
-
|
| 293 |
-
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
|
| 294 |
-
box-shadow: 0 0 5px rgba(0, 0, 0, .3);
|
| 295 |
-
}
|
| 296 |
-
|
| 297 |
-
.select2-dropdown-open .select2-choice {
|
| 298 |
-
border-bottom-color: transparent;
|
| 299 |
-
-webkit-box-shadow: 0 1px 0 #fff inset;
|
| 300 |
-
box-shadow: 0 1px 0 #fff inset;
|
| 301 |
-
|
| 302 |
-
border-bottom-left-radius: 0;
|
| 303 |
-
border-bottom-right-radius: 0;
|
| 304 |
-
|
| 305 |
-
background-color: #eee;
|
| 306 |
-
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #fff), color-stop(0.5, #eee));
|
| 307 |
-
background-image: -webkit-linear-gradient(center bottom, #fff 0%, #eee 50%);
|
| 308 |
-
background-image: -moz-linear-gradient(center bottom, #fff 0%, #eee 50%);
|
| 309 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
|
| 310 |
-
background-image: linear-gradient(to top, #fff 0%, #eee 50%);
|
| 311 |
-
}
|
| 312 |
-
|
| 313 |
-
.select2-dropdown-open.select2-drop-above .select2-choice,
|
| 314 |
-
.select2-dropdown-open.select2-drop-above .select2-choices {
|
| 315 |
-
border: 1px solid #5897fb;
|
| 316 |
-
border-top-color: transparent;
|
| 317 |
-
|
| 318 |
-
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(0.5, #eee));
|
| 319 |
-
background-image: -webkit-linear-gradient(center top, #fff 0%, #eee 50%);
|
| 320 |
-
background-image: -moz-linear-gradient(center top, #fff 0%, #eee 50%);
|
| 321 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
|
| 322 |
-
background-image: linear-gradient(to bottom, #fff 0%, #eee 50%);
|
| 323 |
-
}
|
| 324 |
-
|
| 325 |
-
.select2-dropdown-open .select2-choice .select2-arrow {
|
| 326 |
-
background: transparent;
|
| 327 |
-
border-left: none;
|
| 328 |
-
filter: none;
|
| 329 |
-
}
|
| 330 |
-
html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow {
|
| 331 |
-
border-right: none;
|
| 332 |
-
}
|
| 333 |
-
|
| 334 |
-
.select2-dropdown-open .select2-choice .select2-arrow b {
|
| 335 |
-
background-position: -18px 1px;
|
| 336 |
-
}
|
| 337 |
-
|
| 338 |
-
html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow b {
|
| 339 |
-
background-position: -16px 1px;
|
| 340 |
-
}
|
| 341 |
-
|
| 342 |
-
.select2-hidden-accessible {
|
| 343 |
-
border: 0;
|
| 344 |
-
clip: rect(0 0 0 0);
|
| 345 |
-
height: 1px;
|
| 346 |
-
margin: -1px;
|
| 347 |
-
overflow: hidden;
|
| 348 |
-
padding: 0;
|
| 349 |
position: absolute;
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 375 |
list-style: none;
|
| 376 |
-
display: list-item;
|
| 377 |
-
background-image: none;
|
| 378 |
-
}
|
| 379 |
-
|
| 380 |
-
.select2-results li.select2-result-with-children > .select2-result-label {
|
| 381 |
-
font-weight: bold;
|
| 382 |
-
}
|
| 383 |
-
|
| 384 |
-
.select2-results .select2-result-label {
|
| 385 |
-
padding: 3px 7px 4px;
|
| 386 |
margin: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
-webkit-touch-callout: none;
|
| 392 |
-
-webkit-user-select: none;
|
| 393 |
-
-moz-user-select: none;
|
| 394 |
-
-ms-user-select: none;
|
| 395 |
-
user-select: none;
|
| 396 |
-
}
|
| 397 |
-
|
| 398 |
-
.select2-results-dept-1 .select2-result-label { padding-left: 20px }
|
| 399 |
-
.select2-results-dept-2 .select2-result-label { padding-left: 40px }
|
| 400 |
-
.select2-results-dept-3 .select2-result-label { padding-left: 60px }
|
| 401 |
-
.select2-results-dept-4 .select2-result-label { padding-left: 80px }
|
| 402 |
-
.select2-results-dept-5 .select2-result-label { padding-left: 100px }
|
| 403 |
-
.select2-results-dept-6 .select2-result-label { padding-left: 110px }
|
| 404 |
-
.select2-results-dept-7 .select2-result-label { padding-left: 120px }
|
| 405 |
-
|
| 406 |
-
.select2-results .select2-highlighted {
|
| 407 |
-
background: #3875d7;
|
| 408 |
-
color: #fff;
|
| 409 |
-
}
|
| 410 |
-
|
| 411 |
-
.select2-results li em {
|
| 412 |
-
background: #feffde;
|
| 413 |
-
font-style: normal;
|
| 414 |
-
}
|
| 415 |
-
|
| 416 |
-
.select2-results .select2-highlighted em {
|
| 417 |
-
background: transparent;
|
| 418 |
-
}
|
| 419 |
-
|
| 420 |
-
.select2-results .select2-highlighted ul {
|
| 421 |
-
background: #fff;
|
| 422 |
-
color: #000;
|
| 423 |
-
}
|
| 424 |
-
|
| 425 |
-
.select2-results .select2-no-results,
|
| 426 |
-
.select2-results .select2-searching,
|
| 427 |
-
.select2-results .select2-ajax-error,
|
| 428 |
-
.select2-results .select2-selection-limit {
|
| 429 |
-
background: #f4f4f4;
|
| 430 |
-
display: list-item;
|
| 431 |
-
padding-left: 5px;
|
| 432 |
-
}
|
| 433 |
-
|
| 434 |
-
/*
|
| 435 |
-
disabled look for disabled choices in the results dropdown
|
| 436 |
-
*/
|
| 437 |
-
.select2-results .select2-disabled.select2-highlighted {
|
| 438 |
-
color: #666;
|
| 439 |
-
background: #f4f4f4;
|
| 440 |
-
display: list-item;
|
| 441 |
-
cursor: default;
|
| 442 |
-
}
|
| 443 |
-
.select2-results .select2-disabled {
|
| 444 |
-
background: #f4f4f4;
|
| 445 |
-
display: list-item;
|
| 446 |
-
cursor: default;
|
| 447 |
-
}
|
| 448 |
|
| 449 |
-
.
|
| 450 |
-
|
| 451 |
-
}
|
| 452 |
|
| 453 |
-
.
|
| 454 |
-
|
| 455 |
-
}
|
| 456 |
|
| 457 |
-
.
|
| 458 |
-
|
| 459 |
-
}
|
| 460 |
|
| 461 |
-
.
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
}
|
| 465 |
|
| 466 |
-
|
|
|
|
|
|
|
|
|
|
| 467 |
|
| 468 |
-
.
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
border: 1px solid #ddd;
|
| 472 |
-
cursor: default;
|
| 473 |
-
}
|
| 474 |
|
| 475 |
-
.
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
border-left: 0;
|
| 479 |
-
}
|
| 480 |
|
| 481 |
-
.
|
| 482 |
-
|
| 483 |
-
}
|
| 484 |
|
|
|
|
|
|
|
| 485 |
|
| 486 |
-
|
|
|
|
| 487 |
|
| 488 |
-
.
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
margin: 0;
|
| 492 |
-
padding: 0 5px 0 0;
|
| 493 |
-
position: relative;
|
| 494 |
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
overflow: hidden;
|
| 498 |
-
|
| 499 |
-
background-color: #fff;
|
| 500 |
-
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eee), color-stop(15%, #fff));
|
| 501 |
-
background-image: -webkit-linear-gradient(top, #eee 1%, #fff 15%);
|
| 502 |
-
background-image: -moz-linear-gradient(top, #eee 1%, #fff 15%);
|
| 503 |
-
background-image: linear-gradient(to bottom, #eee 1%, #fff 15%);
|
| 504 |
-
}
|
| 505 |
-
|
| 506 |
-
html[dir="rtl"] .select2-container-multi .select2-choices {
|
| 507 |
-
padding: 0 0 0 5px;
|
| 508 |
-
}
|
| 509 |
-
|
| 510 |
-
.select2-locked {
|
| 511 |
-
padding: 3px 5px 3px 5px !important;
|
| 512 |
-
}
|
| 513 |
-
|
| 514 |
-
.select2-container-multi .select2-choices {
|
| 515 |
-
min-height: 26px;
|
| 516 |
-
}
|
| 517 |
-
|
| 518 |
-
.select2-container-multi.select2-container-active .select2-choices {
|
| 519 |
-
border: 1px solid #5897fb;
|
| 520 |
-
outline: none;
|
| 521 |
-
|
| 522 |
-
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
|
| 523 |
-
box-shadow: 0 0 5px rgba(0, 0, 0, .3);
|
| 524 |
-
}
|
| 525 |
-
.select2-container-multi .select2-choices li {
|
| 526 |
-
float: left;
|
| 527 |
-
list-style: none;
|
| 528 |
-
}
|
| 529 |
-
html[dir="rtl"] .select2-container-multi .select2-choices li
|
| 530 |
-
{
|
| 531 |
-
float: right;
|
| 532 |
-
}
|
| 533 |
-
.select2-container-multi .select2-choices .select2-search-field {
|
| 534 |
-
margin: 0;
|
| 535 |
-
padding: 0;
|
| 536 |
-
white-space: nowrap;
|
| 537 |
-
}
|
| 538 |
-
|
| 539 |
-
.select2-container-multi .select2-choices .select2-search-field input {
|
| 540 |
-
padding: 5px;
|
| 541 |
-
margin: 1px 0;
|
| 542 |
-
|
| 543 |
-
font-family: sans-serif;
|
| 544 |
-
font-size: 100%;
|
| 545 |
-
color: #666;
|
| 546 |
-
outline: 0;
|
| 547 |
-
border: 0;
|
| 548 |
-
-webkit-box-shadow: none;
|
| 549 |
-
box-shadow: none;
|
| 550 |
-
background: transparent !important;
|
| 551 |
-
}
|
| 552 |
-
|
| 553 |
-
.select2-container-multi .select2-choices .select2-search-field input.select2-active {
|
| 554 |
-
background: #fff url('select2-spinner.gif') no-repeat 100% !important;
|
| 555 |
-
}
|
| 556 |
-
|
| 557 |
-
.select2-default {
|
| 558 |
-
color: #999 !important;
|
| 559 |
-
}
|
| 560 |
-
|
| 561 |
-
.select2-container-multi .select2-choices .select2-search-choice {
|
| 562 |
-
padding: 3px 5px 3px 18px;
|
| 563 |
-
margin: 3px 0 3px 5px;
|
| 564 |
-
position: relative;
|
| 565 |
-
|
| 566 |
-
line-height: 13px;
|
| 567 |
-
color: #333;
|
| 568 |
-
cursor: default;
|
| 569 |
-
border: 1px solid #aaaaaa;
|
| 570 |
-
|
| 571 |
-
border-radius: 3px;
|
| 572 |
-
|
| 573 |
-
-webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
|
| 574 |
-
box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
|
| 575 |
|
| 576 |
-
|
|
|
|
| 577 |
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
-ms-user-select: none;
|
| 582 |
-
user-select: none;
|
| 583 |
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
| 589 |
-
background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
| 590 |
-
}
|
| 591 |
-
html[dir="rtl"] .select2-container-multi .select2-choices .select2-search-choice
|
| 592 |
-
{
|
| 593 |
-
margin: 3px 5px 3px 0;
|
| 594 |
-
padding: 3px 18px 3px 5px;
|
| 595 |
-
}
|
| 596 |
-
.select2-container-multi .select2-choices .select2-search-choice .select2-chosen {
|
| 597 |
-
cursor: default;
|
| 598 |
-
}
|
| 599 |
-
.select2-container-multi .select2-choices .select2-search-choice-focus {
|
| 600 |
-
background: #d4d4d4;
|
| 601 |
-
}
|
| 602 |
|
| 603 |
-
.
|
| 604 |
-
|
| 605 |
-
width: 12px;
|
| 606 |
-
height: 13px;
|
| 607 |
-
position: absolute;
|
| 608 |
-
right: 3px;
|
| 609 |
-
top: 4px;
|
| 610 |
-
|
| 611 |
-
font-size: 1px;
|
| 612 |
-
outline: none;
|
| 613 |
-
background: url('select2.png') right top no-repeat;
|
| 614 |
-
}
|
| 615 |
-
html[dir="rtl"] .select2-search-choice-close {
|
| 616 |
-
right: auto;
|
| 617 |
-
left: 3px;
|
| 618 |
-
}
|
| 619 |
-
|
| 620 |
-
.select2-container-multi .select2-search-choice-close {
|
| 621 |
-
left: 3px;
|
| 622 |
-
}
|
| 623 |
-
|
| 624 |
-
html[dir="rtl"] .select2-container-multi .select2-search-choice-close {
|
| 625 |
-
left: auto;
|
| 626 |
-
right: 2px;
|
| 627 |
-
}
|
| 628 |
-
|
| 629 |
-
.select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover {
|
| 630 |
-
background-position: right -11px;
|
| 631 |
-
}
|
| 632 |
-
.select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close {
|
| 633 |
-
background-position: right -11px;
|
| 634 |
-
}
|
| 635 |
-
|
| 636 |
-
/* disabled styles */
|
| 637 |
-
.select2-container-multi.select2-container-disabled .select2-choices {
|
| 638 |
-
background-color: #f4f4f4;
|
| 639 |
-
background-image: none;
|
| 640 |
-
border: 1px solid #ddd;
|
| 641 |
-
cursor: default;
|
| 642 |
-
}
|
| 643 |
-
|
| 644 |
-
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice {
|
| 645 |
-
padding: 3px 5px 3px 5px;
|
| 646 |
-
border: 1px solid #ddd;
|
| 647 |
-
background-image: none;
|
| 648 |
-
background-color: #f4f4f4;
|
| 649 |
-
}
|
| 650 |
-
|
| 651 |
-
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close { display: none;
|
| 652 |
-
background: none;
|
| 653 |
-
}
|
| 654 |
-
/* end multiselect */
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
.select2-result-selectable .select2-match,
|
| 658 |
-
.select2-result-unselectable .select2-match {
|
| 659 |
-
text-decoration: underline;
|
| 660 |
-
}
|
| 661 |
-
|
| 662 |
-
.select2-offscreen, .select2-offscreen:focus {
|
| 663 |
-
clip: rect(0 0 0 0) !important;
|
| 664 |
-
width: 1px !important;
|
| 665 |
-
height: 1px !important;
|
| 666 |
-
border: 0 !important;
|
| 667 |
-
margin: 0 !important;
|
| 668 |
-
padding: 0 !important;
|
| 669 |
-
overflow: hidden !important;
|
| 670 |
-
position: absolute !important;
|
| 671 |
-
outline: 0 !important;
|
| 672 |
-
left: 0px !important;
|
| 673 |
-
top: 0px !important;
|
| 674 |
-
}
|
| 675 |
-
|
| 676 |
-
.select2-display-none {
|
| 677 |
-
display: none;
|
| 678 |
-
}
|
| 679 |
-
|
| 680 |
-
.select2-measure-scrollbar {
|
| 681 |
-
position: absolute;
|
| 682 |
-
top: -10000px;
|
| 683 |
-
left: -10000px;
|
| 684 |
-
width: 100px;
|
| 685 |
-
height: 100px;
|
| 686 |
-
overflow: scroll;
|
| 687 |
-
}
|
| 688 |
-
|
| 689 |
-
/* Retina-ize icons */
|
| 690 |
-
|
| 691 |
-
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 2dppx) {
|
| 692 |
-
.select2-search input,
|
| 693 |
-
.select2-search-choice-close,
|
| 694 |
-
.select2-container .select2-choice abbr,
|
| 695 |
-
.select2-container .select2-choice .select2-arrow b {
|
| 696 |
-
background-image: url('select2x2.png') !important;
|
| 697 |
-
background-repeat: no-repeat !important;
|
| 698 |
-
background-size: 60px 40px !important;
|
| 699 |
-
}
|
| 700 |
-
|
| 701 |
-
.select2-search input {
|
| 702 |
-
background-position: 100% -21px !important;
|
| 703 |
-
}
|
| 704 |
-
}
|
| 1 |
+
.toolset_select2-container {
|
| 2 |
+
box-sizing: border-box;
|
| 3 |
+
display: inline-block;
|
| 4 |
+
margin: 0;
|
| 5 |
+
position: relative;
|
| 6 |
+
vertical-align: middle; }
|
| 7 |
+
.toolset_select2-container .toolset_select2-selection--single {
|
| 8 |
+
box-sizing: border-box;
|
| 9 |
+
cursor: pointer;
|
| 10 |
+
display: block;
|
| 11 |
+
height: 28px;
|
| 12 |
+
user-select: none;
|
| 13 |
+
-webkit-user-select: none; }
|
| 14 |
+
.toolset_select2-container .toolset_select2-selection--single .toolset_select2-selection__rendered {
|
| 15 |
+
display: block;
|
| 16 |
+
padding-left: 8px;
|
| 17 |
+
padding-right: 20px;
|
| 18 |
+
overflow: hidden;
|
| 19 |
+
text-overflow: ellipsis;
|
| 20 |
+
white-space: nowrap; }
|
| 21 |
+
.toolset_select2-container .toolset_select2-selection--single .toolset_select2-selection__clear {
|
| 22 |
+
position: relative; }
|
| 23 |
+
.toolset_select2-container[dir="rtl"] .toolset_select2-selection--single .toolset_select2-selection__rendered {
|
| 24 |
+
padding-right: 8px;
|
| 25 |
+
padding-left: 20px; }
|
| 26 |
+
.toolset_select2-container .toolset_select2-selection--multiple {
|
| 27 |
+
box-sizing: border-box;
|
| 28 |
+
cursor: pointer;
|
| 29 |
display: block;
|
| 30 |
+
min-height: 32px;
|
| 31 |
+
user-select: none;
|
| 32 |
+
-webkit-user-select: none; }
|
| 33 |
+
.toolset_select2-container .toolset_select2-selection--multiple .toolset_select2-selection__rendered {
|
| 34 |
+
display: inline-block;
|
| 35 |
+
overflow: hidden;
|
| 36 |
+
padding-left: 8px;
|
| 37 |
+
text-overflow: ellipsis;
|
| 38 |
+
white-space: nowrap; }
|
| 39 |
+
.toolset_select2-container .toolset_select2-search--inline {
|
| 40 |
+
float: left; }
|
| 41 |
+
.toolset_select2-container .toolset_select2-search--inline .toolset_select2-search__field {
|
| 42 |
+
box-sizing: border-box;
|
| 43 |
+
border: none;
|
| 44 |
+
font-size: 100%;
|
| 45 |
+
margin-top: 5px;
|
| 46 |
+
padding: 0; }
|
| 47 |
+
.toolset_select2-container .toolset_select2-search--inline .toolset_select2-search__field::-webkit-search-cancel-button {
|
| 48 |
+
-webkit-appearance: none; }
|
| 49 |
+
|
| 50 |
+
.toolset_select2-dropdown {
|
| 51 |
+
background-color: white;
|
| 52 |
+
border: 1px solid #aaa;
|
| 53 |
+
border-radius: 4px;
|
| 54 |
+
box-sizing: border-box;
|
| 55 |
+
display: block;
|
| 56 |
+
position: absolute;
|
| 57 |
+
left: -100000px;
|
| 58 |
+
width: 100%;
|
| 59 |
+
z-index: 1051; }
|
| 60 |
+
|
| 61 |
+
.toolset_select2-results {
|
| 62 |
+
display: block; }
|
| 63 |
+
|
| 64 |
+
.toolset_select2-results__options {
|
| 65 |
+
list-style: none;
|
| 66 |
+
margin: 0;
|
| 67 |
+
padding: 0; }
|
| 68 |
+
|
| 69 |
+
.toolset_select2-results__option {
|
| 70 |
+
padding: 6px;
|
| 71 |
+
user-select: none;
|
| 72 |
+
-webkit-user-select: none; }
|
| 73 |
+
.toolset_select2-results__option[aria-selected] {
|
| 74 |
+
cursor: pointer; }
|
| 75 |
+
|
| 76 |
+
.toolset_select2-container--open .toolset_select2-dropdown {
|
| 77 |
+
left: 0; }
|
| 78 |
+
|
| 79 |
+
.toolset_select2-container--open .toolset_select2-dropdown--above {
|
| 80 |
+
border-bottom: none;
|
| 81 |
+
border-bottom-left-radius: 0;
|
| 82 |
+
border-bottom-right-radius: 0; }
|
| 83 |
+
|
| 84 |
+
.toolset_select2-container--open .toolset_select2-dropdown--below {
|
| 85 |
+
border-top: none;
|
| 86 |
+
border-top-left-radius: 0;
|
| 87 |
+
border-top-right-radius: 0; }
|
| 88 |
+
|
| 89 |
+
.toolset_select2-search--dropdown {
|
| 90 |
+
display: block;
|
| 91 |
+
padding: 4px; }
|
| 92 |
+
.toolset_select2-search--dropdown .toolset_select2-search__field {
|
| 93 |
+
padding: 4px;
|
| 94 |
+
width: 100%;
|
| 95 |
+
box-sizing: border-box; }
|
| 96 |
+
.toolset_select2-search--dropdown .toolset_select2-search__field::-webkit-search-cancel-button {
|
| 97 |
+
-webkit-appearance: none; }
|
| 98 |
+
.toolset_select2-search--dropdown.toolset_select2-search--hide {
|
| 99 |
+
display: none; }
|
| 100 |
+
|
| 101 |
+
.toolset_select2-close-mask {
|
| 102 |
+
border: 0;
|
| 103 |
+
margin: 0;
|
| 104 |
+
padding: 0;
|
| 105 |
+
display: block;
|
| 106 |
+
position: fixed;
|
| 107 |
+
left: 0;
|
| 108 |
+
top: 0;
|
| 109 |
+
min-height: 100%;
|
| 110 |
+
min-width: 100%;
|
| 111 |
+
height: auto;
|
| 112 |
+
width: auto;
|
| 113 |
+
opacity: 0;
|
| 114 |
+
z-index: 99;
|
| 115 |
+
background-color: #fff;
|
| 116 |
+
filter: alpha(opacity=0); }
|
| 117 |
+
|
| 118 |
+
.toolset_select2-hidden-accessible {
|
| 119 |
+
border: 0 !important;
|
| 120 |
+
clip: rect(0 0 0 0) !important;
|
| 121 |
+
height: 1px !important;
|
| 122 |
+
margin: -1px !important;
|
| 123 |
+
overflow: hidden !important;
|
| 124 |
+
padding: 0 !important;
|
| 125 |
+
position: absolute !important;
|
| 126 |
+
width: 1px !important; }
|
| 127 |
+
|
| 128 |
+
.toolset_select2-container--default .toolset_select2-selection--single {
|
| 129 |
+
background-color: #fff;
|
| 130 |
+
border: 1px solid #aaa;
|
| 131 |
+
border-radius: 4px; }
|
| 132 |
+
.toolset_select2-container--default .toolset_select2-selection--single .toolset_select2-selection__rendered {
|
| 133 |
+
color: #444;
|
| 134 |
+
line-height: 28px; }
|
| 135 |
+
.toolset_select2-container--default .toolset_select2-selection--single .toolset_select2-selection__clear {
|
| 136 |
+
cursor: pointer;
|
| 137 |
+
float: right;
|
| 138 |
+
font-weight: bold; }
|
| 139 |
+
.toolset_select2-container--default .toolset_select2-selection--single .toolset_select2-selection__placeholder {
|
| 140 |
+
color: #999; }
|
| 141 |
+
.toolset_select2-container--default .toolset_select2-selection--single .toolset_select2-selection__arrow {
|
| 142 |
height: 26px;
|
| 143 |
+
position: absolute;
|
| 144 |
+
top: 1px;
|
| 145 |
+
right: 1px;
|
| 146 |
+
width: 20px; }
|
| 147 |
+
.toolset_select2-container--default .toolset_select2-selection--single .toolset_select2-selection__arrow b {
|
| 148 |
+
border-color: #888 transparent transparent transparent;
|
| 149 |
+
border-style: solid;
|
| 150 |
+
border-width: 5px 4px 0 4px;
|
| 151 |
+
height: 0;
|
| 152 |
+
left: 50%;
|
| 153 |
+
margin-left: -4px;
|
| 154 |
+
margin-top: -2px;
|
| 155 |
+
position: absolute;
|
| 156 |
+
top: 50%;
|
| 157 |
+
width: 0; }
|
| 158 |
+
|
| 159 |
+
.toolset_select2-container--default[dir="rtl"] .toolset_select2-selection--single .toolset_select2-selection__clear {
|
| 160 |
+
float: left; }
|
| 161 |
+
|
| 162 |
+
.toolset_select2-container--default[dir="rtl"] .toolset_select2-selection--single .toolset_select2-selection__arrow {
|
| 163 |
+
left: 1px;
|
| 164 |
+
right: auto; }
|
| 165 |
+
|
| 166 |
+
.toolset_select2-container--default.toolset_select2-container--disabled .toolset_select2-selection--single {
|
| 167 |
+
background-color: #eee;
|
| 168 |
+
cursor: default; }
|
| 169 |
+
.toolset_select2-container--default.toolset_select2-container--disabled .toolset_select2-selection--single .toolset_select2-selection__clear {
|
| 170 |
+
display: none; }
|
| 171 |
+
|
| 172 |
+
.toolset_select2-container--default.toolset_select2-container--open .toolset_select2-selection--single .toolset_select2-selection__arrow b {
|
| 173 |
+
border-color: transparent transparent #888 transparent;
|
| 174 |
+
border-width: 0 4px 5px 4px; }
|
| 175 |
+
|
| 176 |
+
.toolset_select2-container--default .toolset_select2-selection--multiple {
|
| 177 |
+
background-color: white;
|
| 178 |
+
border: 1px solid #aaa;
|
| 179 |
+
border-radius: 4px;
|
| 180 |
+
cursor: text; }
|
| 181 |
+
.toolset_select2-container--default .toolset_select2-selection--multiple .toolset_select2-selection__rendered {
|
| 182 |
+
box-sizing: border-box;
|
| 183 |
+
list-style: none;
|
| 184 |
+
margin: 0;
|
| 185 |
+
padding: 0 5px;
|
| 186 |
+
width: 100%; }
|
| 187 |
+
.toolset_select2-container--default .toolset_select2-selection--multiple .toolset_select2-selection__rendered li {
|
| 188 |
+
list-style: none; }
|
| 189 |
+
.toolset_select2-container--default .toolset_select2-selection--multiple .toolset_select2-selection__placeholder {
|
| 190 |
+
color: #999;
|
| 191 |
+
margin-top: 5px;
|
| 192 |
+
float: left; }
|
| 193 |
+
.toolset_select2-container--default .toolset_select2-selection--multiple .toolset_select2-selection__clear {
|
| 194 |
+
cursor: pointer;
|
| 195 |
+
float: right;
|
| 196 |
+
font-weight: bold;
|
| 197 |
+
margin-top: 5px;
|
| 198 |
+
margin-right: 10px; }
|
| 199 |
+
.toolset_select2-container--default .toolset_select2-selection--multiple .toolset_select2-selection__choice {
|
| 200 |
+
background-color: #e4e4e4;
|
| 201 |
border: 1px solid #aaa;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
border-radius: 4px;
|
| 203 |
+
cursor: default;
|
| 204 |
+
float: left;
|
| 205 |
+
margin-right: 5px;
|
| 206 |
+
margin-top: 5px;
|
| 207 |
+
padding: 0 5px; }
|
| 208 |
+
.toolset_select2-container--default .toolset_select2-selection--multiple .toolset_select2-selection__choice__remove {
|
| 209 |
+
color: #999;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
display: inline-block;
|
| 212 |
+
font-weight: bold;
|
| 213 |
+
margin-right: 2px; }
|
| 214 |
+
.toolset_select2-container--default .toolset_select2-selection--multiple .toolset_select2-selection__choice__remove:hover {
|
| 215 |
+
color: #333; }
|
| 216 |
+
|
| 217 |
+
.toolset_select2-container--default[dir="rtl"] .toolset_select2-selection--multiple .toolset_select2-selection__choice, .toolset_select2-container--default[dir="rtl"] .toolset_select2-selection--multiple .toolset_select2-selection__placeholder, .toolset_select2-container--default[dir="rtl"] .toolset_select2-selection--multiple .toolset_select2-search--inline {
|
| 218 |
+
float: right; }
|
| 219 |
+
|
| 220 |
+
.toolset_select2-container--default[dir="rtl"] .toolset_select2-selection--multiple .toolset_select2-selection__choice {
|
| 221 |
+
margin-left: 5px;
|
| 222 |
+
margin-right: auto; }
|
| 223 |
+
|
| 224 |
+
.toolset_select2-container--default[dir="rtl"] .toolset_select2-selection--multiple .toolset_select2-selection__choice__remove {
|
| 225 |
+
margin-left: 2px;
|
| 226 |
+
margin-right: auto; }
|
| 227 |
+
|
| 228 |
+
.toolset_select2-container--default.toolset_select2-container--focus .toolset_select2-selection--multiple {
|
| 229 |
+
border: solid black 1px;
|
| 230 |
+
outline: 0; }
|
| 231 |
+
|
| 232 |
+
.toolset_select2-container--default.toolset_select2-container--disabled .toolset_select2-selection--multiple {
|
| 233 |
+
background-color: #eee;
|
| 234 |
+
cursor: default; }
|
| 235 |
+
|
| 236 |
+
.toolset_select2-container--default.toolset_select2-container--disabled .toolset_select2-selection__choice__remove {
|
| 237 |
+
display: none; }
|
| 238 |
+
|
| 239 |
+
.toolset_select2-container--default.toolset_select2-container--open.toolset_select2-container--above .toolset_select2-selection--single, .toolset_select2-container--default.toolset_select2-container--open.toolset_select2-container--above .toolset_select2-selection--multiple {
|
| 240 |
+
border-top-left-radius: 0;
|
| 241 |
+
border-top-right-radius: 0; }
|
| 242 |
+
|
| 243 |
+
.toolset_select2-container--default.toolset_select2-container--open.toolset_select2-container--below .toolset_select2-selection--single, .toolset_select2-container--default.toolset_select2-container--open.toolset_select2-container--below .toolset_select2-selection--multiple {
|
| 244 |
+
border-bottom-left-radius: 0;
|
| 245 |
+
border-bottom-right-radius: 0; }
|
| 246 |
+
|
| 247 |
+
.toolset_select2-container--default .toolset_select2-search--dropdown .toolset_select2-search__field {
|
| 248 |
+
border: 1px solid #aaa; }
|
| 249 |
+
|
| 250 |
+
.toolset_select2-container--default .toolset_select2-search--inline .toolset_select2-search__field {
|
| 251 |
+
background: transparent;
|
| 252 |
+
border: none;
|
| 253 |
+
outline: 0;
|
| 254 |
+
box-shadow: none;
|
| 255 |
+
-webkit-appearance: textfield; }
|
| 256 |
+
|
| 257 |
+
.toolset_select2-container--default .toolset_select2-results > .toolset_select2-results__options {
|
| 258 |
+
max-height: 200px;
|
| 259 |
+
overflow-y: auto; }
|
| 260 |
+
|
| 261 |
+
.toolset_select2-container--default .toolset_select2-results__option[role=group] {
|
| 262 |
+
padding: 0; }
|
| 263 |
+
|
| 264 |
+
.toolset_select2-container--default .toolset_select2-results__option[aria-disabled=true] {
|
| 265 |
+
color: #999; }
|
| 266 |
+
|
| 267 |
+
.toolset_select2-container--default .toolset_select2-results__option[aria-selected=true] {
|
| 268 |
+
background-color: #ddd; }
|
| 269 |
+
|
| 270 |
+
.toolset_select2-container--default .toolset_select2-results__option .toolset_select2-results__option {
|
| 271 |
+
padding-left: 1em; }
|
| 272 |
+
.toolset_select2-container--default .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__group {
|
| 273 |
+
padding-left: 0; }
|
| 274 |
+
.toolset_select2-container--default .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option {
|
| 275 |
+
margin-left: -1em;
|
| 276 |
+
padding-left: 2em; }
|
| 277 |
+
.toolset_select2-container--default .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option {
|
| 278 |
+
margin-left: -2em;
|
| 279 |
+
padding-left: 3em; }
|
| 280 |
+
.toolset_select2-container--default .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option {
|
| 281 |
+
margin-left: -3em;
|
| 282 |
+
padding-left: 4em; }
|
| 283 |
+
.toolset_select2-container--default .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option {
|
| 284 |
+
margin-left: -4em;
|
| 285 |
+
padding-left: 5em; }
|
| 286 |
+
.toolset_select2-container--default .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option .toolset_select2-results__option {
|
| 287 |
+
margin-left: -5em;
|
| 288 |
+
padding-left: 6em; }
|
| 289 |
+
|
| 290 |
+
.toolset_select2-container--default .toolset_select2-results__option--highlighted[aria-selected] {
|
| 291 |
+
background-color: #5897fb;
|
| 292 |
+
color: white; }
|
| 293 |
+
|
| 294 |
+
.toolset_select2-container--default .toolset_select2-results__group {
|
| 295 |
+
cursor: default;
|
| 296 |
+
display: block;
|
| 297 |
+
padding: 6px; }
|
| 298 |
+
|
| 299 |
+
.toolset_select2-container--classic .toolset_select2-selection--single {
|
| 300 |
+
background-color: #f7f7f7;
|
| 301 |
+
border: 1px solid #aaa;
|
| 302 |
+
border-radius: 4px;
|
| 303 |
+
outline: 0;
|
| 304 |
+
background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
|
| 305 |
+
background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
|
| 306 |
+
background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
|
| 307 |
+
background-repeat: repeat-x;
|
| 308 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
| 309 |
+
.toolset_select2-container--classic .toolset_select2-selection--single:focus {
|
| 310 |
+
border: 1px solid #5897fb; }
|
| 311 |
+
.toolset_select2-container--classic .toolset_select2-selection--single .toolset_select2-selection__rendered {
|
| 312 |
+
color: #444;
|
| 313 |
+
line-height: 28px; }
|
| 314 |
+
.toolset_select2-container--classic .toolset_select2-selection--single .toolset_select2-selection__clear {
|
| 315 |
cursor: pointer;
|
| 316 |
+
float: right;
|
| 317 |
+
font-weight: bold;
|
| 318 |
+
margin-right: 10px; }
|
| 319 |
+
.toolset_select2-container--classic .toolset_select2-selection--single .toolset_select2-selection__placeholder {
|
| 320 |
+
color: #999; }
|
| 321 |
+
.toolset_select2-container--classic .toolset_select2-selection--single .toolset_select2-selection__arrow {
|
| 322 |
+
background-color: #ddd;
|
| 323 |
+
border: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
border-left: 1px solid #aaa;
|
| 325 |
+
border-top-right-radius: 4px;
|
| 326 |
+
border-bottom-right-radius: 4px;
|
| 327 |
+
height: 26px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
position: absolute;
|
| 329 |
+
top: 1px;
|
| 330 |
+
right: 1px;
|
| 331 |
+
width: 20px;
|
| 332 |
+
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
| 333 |
+
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
| 334 |
+
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
|
| 335 |
+
background-repeat: repeat-x;
|
| 336 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
|
| 337 |
+
.toolset_select2-container--classic .toolset_select2-selection--single .toolset_select2-selection__arrow b {
|
| 338 |
+
border-color: #888 transparent transparent transparent;
|
| 339 |
+
border-style: solid;
|
| 340 |
+
border-width: 5px 4px 0 4px;
|
| 341 |
+
height: 0;
|
| 342 |
+
left: 50%;
|
| 343 |
+
margin-left: -4px;
|
| 344 |
+
margin-top: -2px;
|
| 345 |
+
position: absolute;
|
| 346 |
+
top: 50%;
|
| 347 |
+
width: 0; }
|
| 348 |
+
|
| 349 |
+
.toolset_select2-container--classic[dir="rtl"] .toolset_select2-selection--single .toolset_select2-selection__clear {
|
| 350 |
+
float: left; }
|
| 351 |
+
|
| 352 |
+
.toolset_select2-container--classic[dir="rtl"] .toolset_select2-selection--single .toolset_select2-selection__arrow {
|
| 353 |
+
border: none;
|
| 354 |
+
border-right: 1px solid #aaa;
|
| 355 |
+
border-radius: 0;
|
| 356 |
+
border-top-left-radius: 4px;
|
| 357 |
+
border-bottom-left-radius: 4px;
|
| 358 |
+
left: 1px;
|
| 359 |
+
right: auto; }
|
| 360 |
+
|
| 361 |
+
.toolset_select2-container--classic.toolset_select2-container--open .toolset_select2-selection--single {
|
| 362 |
+
border: 1px solid #5897fb; }
|
| 363 |
+
.toolset_select2-container--classic.toolset_select2-container--open .toolset_select2-selection--single .toolset_select2-selection__arrow {
|
| 364 |
+
background: transparent;
|
| 365 |
+
border: none; }
|
| 366 |
+
.toolset_select2-container--classic.toolset_select2-container--open .toolset_select2-selection--single .toolset_select2-selection__arrow b {
|
| 367 |
+
border-color: transparent transparent #888 transparent;
|
| 368 |
+
border-width: 0 4px 5px 4px; }
|
| 369 |
+
|
| 370 |
+
.toolset_select2-container--classic.toolset_select2-container--open.toolset_select2-container--above .toolset_select2-selection--single {
|
| 371 |
+
border-top: none;
|
| 372 |
+
border-top-left-radius: 0;
|
| 373 |
+
border-top-right-radius: 0;
|
| 374 |
+
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
|
| 375 |
+
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
|
| 376 |
+
background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
|
| 377 |
+
background-repeat: repeat-x;
|
| 378 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
| 379 |
+
|
| 380 |
+
.toolset_select2-container--classic.toolset_select2-container--open.toolset_select2-container--below .toolset_select2-selection--single {
|
| 381 |
+
border-bottom: none;
|
| 382 |
+
border-bottom-left-radius: 0;
|
| 383 |
+
border-bottom-right-radius: 0;
|
| 384 |
+
background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
|
| 385 |
+
background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
|
| 386 |
+
background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
|
| 387 |
+
background-repeat: repeat-x;
|
| 388 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
|
| 389 |
+
|
| 390 |
+
.toolset_select2-container--classic .toolset_select2-selection--multiple {
|
| 391 |
+
background-color: white;
|
| 392 |
+
border: 1px solid #aaa;
|
| 393 |
+
border-radius: 4px;
|
| 394 |
+
cursor: text;
|
| 395 |
+
outline: 0; }
|
| 396 |
+
.toolset_select2-container--classic .toolset_select2-selection--multiple:focus {
|
| 397 |
+
border: 1px solid #5897fb; }
|
| 398 |
+
.toolset_select2-container--classic .toolset_select2-selection--multiple .toolset_select2-selection__rendered {
|
| 399 |
list-style: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 400 |
margin: 0;
|
| 401 |
+
padding: 0 5px; }
|
| 402 |
+
.toolset_select2-container--classic .toolset_select2-selection--multiple .toolset_select2-selection__clear {
|
| 403 |
+
display: none; }
|
| 404 |
+
.toolset_select2-container--classic .toolset_select2-selection--multiple .toolset_select2-selection__choice {
|
| 405 |
+
background-color: #e4e4e4;
|
| 406 |
+
border: 1px solid #aaa;
|
| 407 |
+
border-radius: 4px;
|
| 408 |
+
cursor: default;
|
| 409 |
+
float: left;
|
| 410 |
+
margin-right: 5px;
|
| 411 |
+
margin-top: 5px;
|
| 412 |
+
padding: 0 5px; }
|
| 413 |
+
.toolset_select2-container--classic .toolset_select2-selection--multiple .toolset_select2-selection__choice__remove {
|
| 414 |
+
color: #888;
|
| 415 |
cursor: pointer;
|
| 416 |
+
display: inline-block;
|
| 417 |
+
font-weight: bold;
|
| 418 |
+
margin-right: 2px; }
|
| 419 |
+
.toolset_select2-container--classic .toolset_select2-selection--multiple .toolset_select2-selection__choice__remove:hover {
|
| 420 |
+
color: #555; }
|
| 421 |
|
| 422 |
+
.toolset_select2-container--classic[dir="rtl"] .toolset_select2-selection--multiple .toolset_select2-selection__choice {
|
| 423 |
+
float: right; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
|
| 425 |
+
.toolset_select2-container--classic[dir="rtl"] .toolset_select2-selection--multiple .toolset_select2-selection__choice {
|
| 426 |
+
margin-left: 5px;
|
| 427 |
+
margin-right: auto; }
|
| 428 |
|
| 429 |
+
.toolset_select2-container--classic[dir="rtl"] .toolset_select2-selection--multiple .toolset_select2-selection__choice__remove {
|
| 430 |
+
margin-left: 2px;
|
| 431 |
+
margin-right: auto; }
|
| 432 |
|
| 433 |
+
.toolset_select2-container--classic.toolset_select2-container--open .toolset_select2-selection--multiple {
|
| 434 |
+
border: 1px solid #5897fb; }
|
|
|
|
| 435 |
|
| 436 |
+
.toolset_select2-container--classic.toolset_select2-container--open.toolset_select2-container--above .toolset_select2-selection--multiple {
|
| 437 |
+
border-top: none;
|
| 438 |
+
border-top-left-radius: 0;
|
| 439 |
+
border-top-right-radius: 0; }
|
| 440 |
|
| 441 |
+
.toolset_select2-container--classic.toolset_select2-container--open.toolset_select2-container--below .toolset_select2-selection--multiple {
|
| 442 |
+
border-bottom: none;
|
| 443 |
+
border-bottom-left-radius: 0;
|
| 444 |
+
border-bottom-right-radius: 0; }
|
| 445 |
|
| 446 |
+
.toolset_select2-container--classic .toolset_select2-search--dropdown .toolset_select2-search__field {
|
| 447 |
+
border: 1px solid #aaa;
|
| 448 |
+
outline: 0; }
|
|
|
|
|
|
|
|
|
|
| 449 |
|
| 450 |
+
.toolset_select2-container--classic .toolset_select2-search--inline .toolset_select2-search__field {
|
| 451 |
+
outline: 0;
|
| 452 |
+
box-shadow: none; }
|
|
|
|
|
|
|
| 453 |
|
| 454 |
+
.toolset_select2-container--classic .toolset_select2-dropdown {
|
| 455 |
+
background-color: white;
|
| 456 |
+
border: 1px solid transparent; }
|
| 457 |
|
| 458 |
+
.toolset_select2-container--classic .toolset_select2-dropdown--above {
|
| 459 |
+
border-bottom: none; }
|
| 460 |
|
| 461 |
+
.toolset_select2-container--classic .toolset_select2-dropdown--below {
|
| 462 |
+
border-top: none; }
|
| 463 |
|
| 464 |
+
.toolset_select2-container--classic .toolset_select2-results > .toolset_select2-results__options {
|
| 465 |
+
max-height: 200px;
|
| 466 |
+
overflow-y: auto; }
|
|
|
|
|
|
|
|
|
|
| 467 |
|
| 468 |
+
.toolset_select2-container--classic .toolset_select2-results__option[role=group] {
|
| 469 |
+
padding: 0; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 470 |
|
| 471 |
+
.toolset_select2-container--classic .toolset_select2-results__option[aria-disabled=true] {
|
| 472 |
+
color: grey; }
|
| 473 |
|
| 474 |
+
.toolset_select2-container--classic .toolset_select2-results__option--highlighted[aria-selected] {
|
| 475 |
+
background-color: #3875d7;
|
| 476 |
+
color: white; }
|
|
|
|
|
|
|
| 477 |
|
| 478 |
+
.toolset_select2-container--classic .toolset_select2-results__group {
|
| 479 |
+
cursor: default;
|
| 480 |
+
display: block;
|
| 481 |
+
padding: 6px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 482 |
|
| 483 |
+
.toolset_select2-container--classic.toolset_select2-container--open .toolset_select2-dropdown {
|
| 484 |
+
border-color: #5897fb; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
library/toolset/toolset-common/res/lib/select2/select2.js
ADDED
|
@@ -0,0 +1,5725 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* Select2 4.0.3
|
| 3 |
+
* https://select2.github.io
|
| 4 |
+
*
|
| 5 |
+
* Released under the MIT license
|
| 6 |
+
* https://github.com/select2/select2/blob/master/LICENSE.md
|
| 7 |
+
*/
|
| 8 |
+
(function (factory) {
|
| 9 |
+
if (typeof define === 'function' && define.amd) {
|
| 10 |
+
// AMD. Register as an anonymous module.
|
| 11 |
+
define(['jquery'], factory);
|
| 12 |
+
} else if (typeof exports === 'object') {
|
| 13 |
+
// Node/CommonJS
|
| 14 |
+
factory(require('jquery'));
|
| 15 |
+
} else {
|
| 16 |
+
// Browser globals
|
| 17 |
+
factory(jQuery);
|
| 18 |
+
}
|
| 19 |
+
}(function (jQuery) {
|
| 20 |
+
// This is needed so we can catch the AMD loader configuration and use it
|
| 21 |
+
// The inner file should be wrapped (by `banner.start.js`) in a function that
|
| 22 |
+
// returns the AMD loader references.
|
| 23 |
+
var Toolset_S2 =
|
| 24 |
+
(function () {
|
| 25 |
+
// Restore the Select2 AMD loader so it can be used
|
| 26 |
+
// Needed mostly in the language files, where the loader is not inserted
|
| 27 |
+
if (jQuery && jQuery.fn && jQuery.fn.toolset_select2 && jQuery.fn.toolset_select2.amd) {
|
| 28 |
+
var Toolset_S2 = jQuery.fn.toolset_select2.amd;
|
| 29 |
+
}
|
| 30 |
+
var Toolset_S2;(function () { if (!Toolset_S2 || !Toolset_S2.requirejs) {
|
| 31 |
+
if (!Toolset_S2) { Toolset_S2 = {}; } else { require = Toolset_S2; }
|
| 32 |
+
/**
|
| 33 |
+
* @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
|
| 34 |
+
* Available via the MIT or new BSD license.
|
| 35 |
+
* see: http://github.com/jrburke/almond for details
|
| 36 |
+
*/
|
| 37 |
+
//Going sloppy to avoid 'use strict' string cost, but strict practices should
|
| 38 |
+
//be followed.
|
| 39 |
+
/*jslint sloppy: true */
|
| 40 |
+
/*global setTimeout: false */
|
| 41 |
+
|
| 42 |
+
var requirejs, require, define;
|
| 43 |
+
(function (undef) {
|
| 44 |
+
var main, req, makeMap, handlers,
|
| 45 |
+
defined = {},
|
| 46 |
+
waiting = {},
|
| 47 |
+
config = {},
|
| 48 |
+
defining = {},
|
| 49 |
+
hasOwn = Object.prototype.hasOwnProperty,
|
| 50 |
+
aps = [].slice,
|
| 51 |
+
jsSuffixRegExp = /\.js$/;
|
| 52 |
+
|
| 53 |
+
function hasProp(obj, prop) {
|
| 54 |
+
return hasOwn.call(obj, prop);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* Given a relative module name, like ./something, normalize it to
|
| 59 |
+
* a real name that can be mapped to a path.
|
| 60 |
+
* @param {String} name the relative name
|
| 61 |
+
* @param {String} baseName a real name that the name arg is relative
|
| 62 |
+
* to.
|
| 63 |
+
* @returns {String} normalized name
|
| 64 |
+
*/
|
| 65 |
+
function normalize(name, baseName) {
|
| 66 |
+
var nameParts, nameSegment, mapValue, foundMap, lastIndex,
|
| 67 |
+
foundI, foundStarMap, starI, i, j, part,
|
| 68 |
+
baseParts = baseName && baseName.split("/"),
|
| 69 |
+
map = config.map,
|
| 70 |
+
starMap = (map && map['*']) || {};
|
| 71 |
+
|
| 72 |
+
//Adjust any relative paths.
|
| 73 |
+
if (name && name.charAt(0) === ".") {
|
| 74 |
+
//If have a base name, try to normalize against it,
|
| 75 |
+
//otherwise, assume it is a top-level require that will
|
| 76 |
+
//be relative to baseUrl in the end.
|
| 77 |
+
if (baseName) {
|
| 78 |
+
name = name.split('/');
|
| 79 |
+
lastIndex = name.length - 1;
|
| 80 |
+
|
| 81 |
+
// Node .js allowance:
|
| 82 |
+
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
|
| 83 |
+
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
//Lop off the last part of baseParts, so that . matches the
|
| 87 |
+
//"directory" and not name of the baseName's module. For instance,
|
| 88 |
+
//baseName of "one/two/three", maps to "one/two/three.js", but we
|
| 89 |
+
//want the directory, "one/two" for this normalization.
|
| 90 |
+
name = baseParts.slice(0, baseParts.length - 1).concat(name);
|
| 91 |
+
|
| 92 |
+
//start trimDots
|
| 93 |
+
for (i = 0; i < name.length; i += 1) {
|
| 94 |
+
part = name[i];
|
| 95 |
+
if (part === ".") {
|
| 96 |
+
name.splice(i, 1);
|
| 97 |
+
i -= 1;
|
| 98 |
+
} else if (part === "..") {
|
| 99 |
+
if (i === 1 && (name[2] === '..' || name[0] === '..')) {
|
| 100 |
+
//End of the line. Keep at least one non-dot
|
| 101 |
+
//path segment at the front so it can be mapped
|
| 102 |
+
//correctly to disk. Otherwise, there is likely
|
| 103 |
+
//no path mapping for a path starting with '..'.
|
| 104 |
+
//This can still fail, but catches the most reasonable
|
| 105 |
+
//uses of ..
|
| 106 |
+
break;
|
| 107 |
+
} else if (i > 0) {
|
| 108 |
+
name.splice(i - 1, 2);
|
| 109 |
+
i -= 2;
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
//end trimDots
|
| 114 |
+
|
| 115 |
+
name = name.join("/");
|
| 116 |
+
} else if (name.indexOf('./') === 0) {
|
| 117 |
+
// No baseName, so this is ID is resolved relative
|
| 118 |
+
// to baseUrl, pull off the leading dot.
|
| 119 |
+
name = name.substring(2);
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
//Apply map config if available.
|
| 124 |
+
if ((baseParts || starMap) && map) {
|
| 125 |
+
nameParts = name.split('/');
|
| 126 |
+
|
| 127 |
+
for (i = nameParts.length; i > 0; i -= 1) {
|
| 128 |
+
nameSegment = nameParts.slice(0, i).join("/");
|
| 129 |
+
|
| 130 |
+
if (baseParts) {
|
| 131 |
+
//Find the longest baseName segment match in the config.
|
| 132 |
+
//So, do joins on the biggest to smallest lengths of baseParts.
|
| 133 |
+
for (j = baseParts.length; j > 0; j -= 1) {
|
| 134 |
+
mapValue = map[baseParts.slice(0, j).join('/')];
|
| 135 |
+
|
| 136 |
+
//baseName segment has config, find if it has one for
|
| 137 |
+
//this name.
|
| 138 |
+
if (mapValue) {
|
| 139 |
+
mapValue = mapValue[nameSegment];
|
| 140 |
+
if (mapValue) {
|
| 141 |
+
//Match, update name to the new value.
|
| 142 |
+
foundMap = mapValue;
|
| 143 |
+
foundI = i;
|
| 144 |
+
break;
|
| 145 |
+
}
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
if (foundMap) {
|
| 151 |
+
break;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
//Check for a star map match, but just hold on to it,
|
| 155 |
+
//if there is a shorter segment match later in a matching
|
| 156 |
+
//config, then favor over this star map.
|
| 157 |
+
if (!foundStarMap && starMap && starMap[nameSegment]) {
|
| 158 |
+
foundStarMap = starMap[nameSegment];
|
| 159 |
+
starI = i;
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
if (!foundMap && foundStarMap) {
|
| 164 |
+
foundMap = foundStarMap;
|
| 165 |
+
foundI = starI;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
if (foundMap) {
|
| 169 |
+
nameParts.splice(0, foundI, foundMap);
|
| 170 |
+
name = nameParts.join('/');
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
return name;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
function makeRequire(relName, forceSync) {
|
| 178 |
+
return function () {
|
| 179 |
+
//A version of a require function that passes a moduleName
|
| 180 |
+
//value for items that may need to
|
| 181 |
+
//look up paths relative to the moduleName
|
| 182 |
+
var args = aps.call(arguments, 0);
|
| 183 |
+
|
| 184 |
+
//If first arg is not require('string'), and there is only
|
| 185 |
+
//one arg, it is the array form without a callback. Insert
|
| 186 |
+
//a null so that the following concat is correct.
|
| 187 |
+
if (typeof args[0] !== 'string' && args.length === 1) {
|
| 188 |
+
args.push(null);
|
| 189 |
+
}
|
| 190 |
+
return req.apply(undef, args.concat([relName, forceSync]));
|
| 191 |
+
};
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
function makeNormalize(relName) {
|
| 195 |
+
return function (name) {
|
| 196 |
+
return normalize(name, relName);
|
| 197 |
+
};
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
function makeLoad(depName) {
|
| 201 |
+
return function (value) {
|
| 202 |
+
defined[depName] = value;
|
| 203 |
+
};
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
function callDep(name) {
|
| 207 |
+
if (hasProp(waiting, name)) {
|
| 208 |
+
var args = waiting[name];
|
| 209 |
+
delete waiting[name];
|
| 210 |
+
defining[name] = true;
|
| 211 |
+
main.apply(undef, args);
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
if (!hasProp(defined, name) && !hasProp(defining, name)) {
|
| 215 |
+
throw new Error('No ' + name);
|
| 216 |
+
}
|
| 217 |
+
return defined[name];
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
//Turns a plugin!resource to [plugin, resource]
|
| 221 |
+
//with the plugin being undefined if the name
|
| 222 |
+
//did not have a plugin prefix.
|
| 223 |
+
function splitPrefix(name) {
|
| 224 |
+
var prefix,
|
| 225 |
+
index = name ? name.indexOf('!') : -1;
|
| 226 |
+
if (index > -1) {
|
| 227 |
+
prefix = name.substring(0, index);
|
| 228 |
+
name = name.substring(index + 1, name.length);
|
| 229 |
+
}
|
| 230 |
+
return [prefix, name];
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
/**
|
| 234 |
+
* Makes a name map, normalizing the name, and using a plugin
|
| 235 |
+
* for normalization if necessary. Grabs a ref to plugin
|
| 236 |
+
* too, as an optimization.
|
| 237 |
+
*/
|
| 238 |
+
makeMap = function (name, relName) {
|
| 239 |
+
var plugin,
|
| 240 |
+
parts = splitPrefix(name),
|
| 241 |
+
prefix = parts[0];
|
| 242 |
+
|
| 243 |
+
name = parts[1];
|
| 244 |
+
|
| 245 |
+
if (prefix) {
|
| 246 |
+
prefix = normalize(prefix, relName);
|
| 247 |
+
plugin = callDep(prefix);
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
//Normalize according
|
| 251 |
+
if (prefix) {
|
| 252 |
+
if (plugin && plugin.normalize) {
|
| 253 |
+
name = plugin.normalize(name, makeNormalize(relName));
|
| 254 |
+
} else {
|
| 255 |
+
name = normalize(name, relName);
|
| 256 |
+
}
|
| 257 |
+
} else {
|
| 258 |
+
name = normalize(name, relName);
|
| 259 |
+
parts = splitPrefix(name);
|
| 260 |
+
prefix = parts[0];
|
| 261 |
+
name = parts[1];
|
| 262 |
+
if (prefix) {
|
| 263 |
+
plugin = callDep(prefix);
|
| 264 |
+
}
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
//Using ridiculous property names for space reasons
|
| 268 |
+
return {
|
| 269 |
+
f: prefix ? prefix + '!' + name : name, //fullName
|
| 270 |
+
n: name,
|
| 271 |
+
pr: prefix,
|
| 272 |
+
p: plugin
|
| 273 |
+
};
|
| 274 |
+
};
|
| 275 |
+
|
| 276 |
+
function makeConfig(name) {
|
| 277 |
+
return function () {
|
| 278 |
+
return (config && config.config && config.config[name]) || {};
|
| 279 |
+
};
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
handlers = {
|
| 283 |
+
require: function (name) {
|
| 284 |
+
return makeRequire(name);
|
| 285 |
+
},
|
| 286 |
+
exports: function (name) {
|
| 287 |
+
var e = defined[name];
|
| 288 |
+
if (typeof e !== 'undefined') {
|
| 289 |
+
return e;
|
| 290 |
+
} else {
|
| 291 |
+
return (defined[name] = {});
|
| 292 |
+
}
|
| 293 |
+
},
|
| 294 |
+
module: function (name) {
|
| 295 |
+
return {
|
| 296 |
+
id: name,
|
| 297 |
+
uri: '',
|
| 298 |
+
exports: defined[name],
|
| 299 |
+
config: makeConfig(name)
|
| 300 |
+
};
|
| 301 |
+
}
|
| 302 |
+
};
|
| 303 |
+
|
| 304 |
+
main = function (name, deps, callback, relName) {
|
| 305 |
+
var cjsModule, depName, ret, map, i,
|
| 306 |
+
args = [],
|
| 307 |
+
callbackType = typeof callback,
|
| 308 |
+
usingExports;
|
| 309 |
+
|
| 310 |
+
//Use name if no relName
|
| 311 |
+
relName = relName || name;
|
| 312 |
+
|
| 313 |
+
//Call the callback to define the module, if necessary.
|
| 314 |
+
if (callbackType === 'undefined' || callbackType === 'function') {
|
| 315 |
+
//Pull out the defined dependencies and pass the ordered
|
| 316 |
+
//values to the callback.
|
| 317 |
+
//Default to [require, exports, module] if no deps
|
| 318 |
+
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
|
| 319 |
+
for (i = 0; i < deps.length; i += 1) {
|
| 320 |
+
map = makeMap(deps[i], relName);
|
| 321 |
+
depName = map.f;
|
| 322 |
+
|
| 323 |
+
//Fast path CommonJS standard dependencies.
|
| 324 |
+
if (depName === "require") {
|
| 325 |
+
args[i] = handlers.require(name);
|
| 326 |
+
} else if (depName === "exports") {
|
| 327 |
+
//CommonJS module spec 1.1
|
| 328 |
+
args[i] = handlers.exports(name);
|
| 329 |
+
usingExports = true;
|
| 330 |
+
} else if (depName === "module") {
|
| 331 |
+
//CommonJS module spec 1.1
|
| 332 |
+
cjsModule = args[i] = handlers.module(name);
|
| 333 |
+
} else if (hasProp(defined, depName) ||
|
| 334 |
+
hasProp(waiting, depName) ||
|
| 335 |
+
hasProp(defining, depName)) {
|
| 336 |
+
args[i] = callDep(depName);
|
| 337 |
+
} else if (map.p) {
|
| 338 |
+
map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
|
| 339 |
+
args[i] = defined[depName];
|
| 340 |
+
} else {
|
| 341 |
+
throw new Error(name + ' missing ' + depName);
|
| 342 |
+
}
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
ret = callback ? callback.apply(defined[name], args) : undefined;
|
| 346 |
+
|
| 347 |
+
if (name) {
|
| 348 |
+
//If setting exports via "module" is in play,
|
| 349 |
+
//favor that over return value and exports. After that,
|
| 350 |
+
//favor a non-undefined return value over exports use.
|
| 351 |
+
if (cjsModule && cjsModule.exports !== undef &&
|
| 352 |
+
cjsModule.exports !== defined[name]) {
|
| 353 |
+
defined[name] = cjsModule.exports;
|
| 354 |
+
} else if (ret !== undef || !usingExports) {
|
| 355 |
+
//Use the return value from the function.
|
| 356 |
+
defined[name] = ret;
|
| 357 |
+
}
|
| 358 |
+
}
|
| 359 |
+
} else if (name) {
|
| 360 |
+
//May just be an object definition for the module. Only
|
| 361 |
+
//worry about defining if have a module name.
|
| 362 |
+
defined[name] = callback;
|
| 363 |
+
}
|
| 364 |
+
};
|
| 365 |
+
|
| 366 |
+
requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
|
| 367 |
+
if (typeof deps === "string") {
|
| 368 |
+
if (handlers[deps]) {
|
| 369 |
+
//callback in this case is really relName
|
| 370 |
+
return handlers[deps](callback);
|
| 371 |
+
}
|
| 372 |
+
//Just return the module wanted. In this scenario, the
|
| 373 |
+
//deps arg is the module name, and second arg (if passed)
|
| 374 |
+
//is just the relName.
|
| 375 |
+
//Normalize module name, if it contains . or ..
|
| 376 |
+
return callDep(makeMap(deps, callback).f);
|
| 377 |
+
} else if (!deps.splice) {
|
| 378 |
+
//deps is a config object, not an array.
|
| 379 |
+
config = deps;
|
| 380 |
+
if (config.deps) {
|
| 381 |
+
req(config.deps, config.callback);
|
| 382 |
+
}
|
| 383 |
+
if (!callback) {
|
| 384 |
+
return;
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
if (callback.splice) {
|
| 388 |
+
//callback is an array, which means it is a dependency list.
|
| 389 |
+
//Adjust args if there are dependencies
|
| 390 |
+
deps = callback;
|
| 391 |
+
callback = relName;
|
| 392 |
+
relName = null;
|
| 393 |
+
} else {
|
| 394 |
+
deps = undef;
|
| 395 |
+
}
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
//Support require(['a'])
|
| 399 |
+
callback = callback || function () {};
|
| 400 |
+
|
| 401 |
+
//If relName is a function, it is an errback handler,
|
| 402 |
+
//so remove it.
|
| 403 |
+
if (typeof relName === 'function') {
|
| 404 |
+
relName = forceSync;
|
| 405 |
+
forceSync = alt;
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
//Simulate async callback;
|
| 409 |
+
if (forceSync) {
|
| 410 |
+
main(undef, deps, callback, relName);
|
| 411 |
+
} else {
|
| 412 |
+
//Using a non-zero value because of concern for what old browsers
|
| 413 |
+
//do, and latest browsers "upgrade" to 4 if lower value is used:
|
| 414 |
+
//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
|
| 415 |
+
//If want a value immediately, use require('id') instead -- something
|
| 416 |
+
//that works in almond on the global level, but not guaranteed and
|
| 417 |
+
//unlikely to work in other AMD implementations.
|
| 418 |
+
setTimeout(function () {
|
| 419 |
+
main(undef, deps, callback, relName);
|
| 420 |
+
}, 4);
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
return req;
|
| 424 |
+
};
|
| 425 |
+
|
| 426 |
+
/**
|
| 427 |
+
* Just drops the config on the floor, but returns req in case
|
| 428 |
+
* the config return value is used.
|
| 429 |
+
*/
|
| 430 |
+
req.config = function (cfg) {
|
| 431 |
+
return req(cfg);
|
| 432 |
+
};
|
| 433 |
+
|
| 434 |
+
/**
|
| 435 |
+
* Expose module registry for debugging and tooling
|
| 436 |
+
*/
|
| 437 |
+
requirejs._defined = defined;
|
| 438 |
+
|
| 439 |
+
define = function (name, deps, callback) {
|
| 440 |
+
if (typeof name !== 'string') {
|
| 441 |
+
throw new Error('See almond README: incorrect module build, no module name');
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
//This module may not have dependencies
|
| 445 |
+
if (!deps.splice) {
|
| 446 |
+
//deps is not an array, so probably means
|
| 447 |
+
//an object literal or factory function for
|
| 448 |
+
//the value. Adjust args.
|
| 449 |
+
callback = deps;
|
| 450 |
+
deps = [];
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
if (!hasProp(defined, name) && !hasProp(waiting, name)) {
|
| 454 |
+
waiting[name] = [name, deps, callback];
|
| 455 |
+
}
|
| 456 |
+
};
|
| 457 |
+
|
| 458 |
+
define.amd = {
|
| 459 |
+
jQuery: true
|
| 460 |
+
};
|
| 461 |
+
}());
|
| 462 |
+
|
| 463 |
+
Toolset_S2.requirejs = requirejs;Toolset_S2.require = require;Toolset_S2.define = define;
|
| 464 |
+
}
|
| 465 |
+
}());
|
| 466 |
+
Toolset_S2.define("almond", function(){});
|
| 467 |
+
|
| 468 |
+
/* global jQuery:false, $:false */
|
| 469 |
+
Toolset_S2.define('jquery',[],function () {
|
| 470 |
+
var _$ = jQuery || $;
|
| 471 |
+
|
| 472 |
+
if (_$ == null && console && console.error) {
|
| 473 |
+
console.error(
|
| 474 |
+
'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
|
| 475 |
+
'found. Make sure that you are including jQuery before Select2 on your ' +
|
| 476 |
+
'web page.'
|
| 477 |
+
);
|
| 478 |
+
}
|
| 479 |
+
|
| 480 |
+
return _$;
|
| 481 |
+
});
|
| 482 |
+
|
| 483 |
+
Toolset_S2.define('toolset_select2/utils',[
|
| 484 |
+
'jquery'
|
| 485 |
+
], function ($) {
|
| 486 |
+
var Utils = {};
|
| 487 |
+
|
| 488 |
+
Utils.Extend = function (ChildClass, SuperClass) {
|
| 489 |
+
var __hasProp = {}.hasOwnProperty;
|
| 490 |
+
|
| 491 |
+
function BaseConstructor () {
|
| 492 |
+
this.constructor = ChildClass;
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
for (var key in SuperClass) {
|
| 496 |
+
if (__hasProp.call(SuperClass, key)) {
|
| 497 |
+
ChildClass[key] = SuperClass[key];
|
| 498 |
+
}
|
| 499 |
+
}
|
| 500 |
+
|
| 501 |
+
BaseConstructor.prototype = SuperClass.prototype;
|
| 502 |
+
ChildClass.prototype = new BaseConstructor();
|
| 503 |
+
ChildClass.__super__ = SuperClass.prototype;
|
| 504 |
+
|
| 505 |
+
return ChildClass;
|
| 506 |
+
};
|
| 507 |
+
|
| 508 |
+
function getMethods (theClass) {
|
| 509 |
+
var proto = theClass.prototype;
|
| 510 |
+
|
| 511 |
+
var methods = [];
|
| 512 |
+
|
| 513 |
+
for (var methodName in proto) {
|
| 514 |
+
var m = proto[methodName];
|
| 515 |
+
|
| 516 |
+
if (typeof m !== 'function') {
|
| 517 |
+
continue;
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
if (methodName === 'constructor') {
|
| 521 |
+
continue;
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
methods.push(methodName);
|
| 525 |
+
}
|
| 526 |
+
|
| 527 |
+
return methods;
|
| 528 |
+
}
|
| 529 |
+
|
| 530 |
+
Utils.Decorate = function (SuperClass, DecoratorClass) {
|
| 531 |
+
var decoratedMethods = getMethods(DecoratorClass);
|
| 532 |
+
var superMethods = getMethods(SuperClass);
|
| 533 |
+
|
| 534 |
+
function DecoratedClass () {
|
| 535 |
+
var unshift = Array.prototype.unshift;
|
| 536 |
+
|
| 537 |
+
var argCount = DecoratorClass.prototype.constructor.length;
|
| 538 |
+
|
| 539 |
+
var calledConstructor = SuperClass.prototype.constructor;
|
| 540 |
+
|
| 541 |
+
if (argCount > 0) {
|
| 542 |
+
unshift.call(arguments, SuperClass.prototype.constructor);
|
| 543 |
+
|
| 544 |
+
calledConstructor = DecoratorClass.prototype.constructor;
|
| 545 |
+
}
|
| 546 |
+
|
| 547 |
+
calledConstructor.apply(this, arguments);
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
DecoratorClass.displayName = SuperClass.displayName;
|
| 551 |
+
|
| 552 |
+
function ctr () {
|
| 553 |
+
this.constructor = DecoratedClass;
|
| 554 |
+
}
|
| 555 |
+
|
| 556 |
+
DecoratedClass.prototype = new ctr();
|
| 557 |
+
|
| 558 |
+
for (var m = 0; m < superMethods.length; m++) {
|
| 559 |
+
var superMethod = superMethods[m];
|
| 560 |
+
|
| 561 |
+
DecoratedClass.prototype[superMethod] =
|
| 562 |
+
SuperClass.prototype[superMethod];
|
| 563 |
+
}
|
| 564 |
+
|
| 565 |
+
var calledMethod = function (methodName) {
|
| 566 |
+
// Stub out the original method if it's not decorating an actual method
|
| 567 |
+
var originalMethod = function () {};
|
| 568 |
+
|
| 569 |
+
if (methodName in DecoratedClass.prototype) {
|
| 570 |
+
originalMethod = DecoratedClass.prototype[methodName];
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
var decoratedMethod = DecoratorClass.prototype[methodName];
|
| 574 |
+
|
| 575 |
+
return function () {
|
| 576 |
+
var unshift = Array.prototype.unshift;
|
| 577 |
+
|
| 578 |
+
unshift.call(arguments, originalMethod);
|
| 579 |
+
|
| 580 |
+
return decoratedMethod.apply(this, arguments);
|
| 581 |
+
};
|
| 582 |
+
};
|
| 583 |
+
|
| 584 |
+
for (var d = 0; d < decoratedMethods.length; d++) {
|
| 585 |
+
var decoratedMethod = decoratedMethods[d];
|
| 586 |
+
|
| 587 |
+
DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
|
| 588 |
+
}
|
| 589 |
+
|
| 590 |
+
return DecoratedClass;
|
| 591 |
+
};
|
| 592 |
+
|
| 593 |
+
var Observable = function () {
|
| 594 |
+
this.listeners = {};
|
| 595 |
+
};
|
| 596 |
+
|
| 597 |
+
Observable.prototype.on = function (event, callback) {
|
| 598 |
+
this.listeners = this.listeners || {};
|
| 599 |
+
|
| 600 |
+
if (event in this.listeners) {
|
| 601 |
+
this.listeners[event].push(callback);
|
| 602 |
+
} else {
|
| 603 |
+
this.listeners[event] = [callback];
|
| 604 |
+
}
|
| 605 |
+
};
|
| 606 |
+
|
| 607 |
+
Observable.prototype.trigger = function (event) {
|
| 608 |
+
var slice = Array.prototype.slice;
|
| 609 |
+
var params = slice.call(arguments, 1);
|
| 610 |
+
|
| 611 |
+
this.listeners = this.listeners || {};
|
| 612 |
+
|
| 613 |
+
// Params should always come in as an array
|
| 614 |
+
if (params == null) {
|
| 615 |
+
params = [];
|
| 616 |
+
}
|
| 617 |
+
|
| 618 |
+
// If there are no arguments to the event, use a temporary object
|
| 619 |
+
if (params.length === 0) {
|
| 620 |
+
params.push({});
|
| 621 |
+
}
|
| 622 |
+
|
| 623 |
+
// Set the `_type` of the first object to the event
|
| 624 |
+
params[0]._type = event;
|
| 625 |
+
|
| 626 |
+
if (event in this.listeners) {
|
| 627 |
+
this.invoke(this.listeners[event], slice.call(arguments, 1));
|
| 628 |
+
}
|
| 629 |
+
|
| 630 |
+
if ('*' in this.listeners) {
|
| 631 |
+
this.invoke(this.listeners['*'], arguments);
|
| 632 |
+
}
|
| 633 |
+
};
|
| 634 |
+
|
| 635 |
+
Observable.prototype.invoke = function (listeners, params) {
|
| 636 |
+
for (var i = 0, len = listeners.length; i < len; i++) {
|
| 637 |
+
listeners[i].apply(this, params);
|
| 638 |
+
}
|
| 639 |
+
};
|
| 640 |
+
|
| 641 |
+
Utils.Observable = Observable;
|
| 642 |
+
|
| 643 |
+
Utils.generateChars = function (length) {
|
| 644 |
+
var chars = '';
|
| 645 |
+
|
| 646 |
+
for (var i = 0; i < length; i++) {
|
| 647 |
+
var randomChar = Math.floor(Math.random() * 36);
|
| 648 |
+
chars += randomChar.toString(36);
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
return chars;
|
| 652 |
+
};
|
| 653 |
+
|
| 654 |
+
Utils.bind = function (func, context) {
|
| 655 |
+
return function () {
|
| 656 |
+
func.apply(context, arguments);
|
| 657 |
+
};
|
| 658 |
+
};
|
| 659 |
+
|
| 660 |
+
Utils._convertData = function (data) {
|
| 661 |
+
for (var originalKey in data) {
|
| 662 |
+
var keys = originalKey.split('-');
|
| 663 |
+
|
| 664 |
+
var dataLevel = data;
|
| 665 |
+
|
| 666 |
+
if (keys.length === 1) {
|
| 667 |
+
continue;
|
| 668 |
+
}
|
| 669 |
+
|
| 670 |
+
for (var k = 0; k < keys.length; k++) {
|
| 671 |
+
var key = keys[k];
|
| 672 |
+
|
| 673 |
+
// Lowercase the first letter
|
| 674 |
+
// By default, dash-separated becomes camelCase
|
| 675 |
+
key = key.substring(0, 1).toLowerCase() + key.substring(1);
|
| 676 |
+
|
| 677 |
+
if (!(key in dataLevel)) {
|
| 678 |
+
dataLevel[key] = {};
|
| 679 |
+
}
|
| 680 |
+
|
| 681 |
+
if (k == keys.length - 1) {
|
| 682 |
+
dataLevel[key] = data[originalKey];
|
| 683 |
+
}
|
| 684 |
+
|
| 685 |
+
dataLevel = dataLevel[key];
|
| 686 |
+
}
|
| 687 |
+
|
| 688 |
+
delete data[originalKey];
|
| 689 |
+
}
|
| 690 |
+
|
| 691 |
+
return data;
|
| 692 |
+
};
|
| 693 |
+
|
| 694 |
+
Utils.hasScroll = function (index, el) {
|
| 695 |
+
// Adapted from the function created by @ShadowScripter
|
| 696 |
+
// and adapted by @BillBarry on the Stack Exchange Code Review website.
|
| 697 |
+
// The original code can be found at
|
| 698 |
+
// http://codereview.stackexchange.com/q/13338
|
| 699 |
+
// and was designed to be used with the Sizzle selector engine.
|
| 700 |
+
|
| 701 |
+
var $el = $(el);
|
| 702 |
+
var overflowX = el.style.overflowX;
|
| 703 |
+
var overflowY = el.style.overflowY;
|
| 704 |
+
|
| 705 |
+
//Check both x and y declarations
|
| 706 |
+
if (overflowX === overflowY &&
|
| 707 |
+
(overflowY === 'hidden' || overflowY === 'visible')) {
|
| 708 |
+
return false;
|
| 709 |
+
}
|
| 710 |
+
|
| 711 |
+
if (overflowX === 'scroll' || overflowY === 'scroll') {
|
| 712 |
+
return true;
|
| 713 |
+
}
|
| 714 |
+
|
| 715 |
+
return ($el.innerHeight() < el.scrollHeight ||
|
| 716 |
+
$el.innerWidth() < el.scrollWidth);
|
| 717 |
+
};
|
| 718 |
+
|
| 719 |
+
Utils.escapeMarkup = function (markup) {
|
| 720 |
+
var replaceMap = {
|
| 721 |
+
'\\': '\',
|
| 722 |
+
'&': '&',
|
| 723 |
+
'<': '<',
|
| 724 |
+
'>': '>',
|
| 725 |
+
'"': '"',
|
| 726 |
+
'\'': ''',
|
| 727 |
+
'/': '/'
|
| 728 |
+
};
|
| 729 |
+
|
| 730 |
+
// Do not try to escape the markup if it's not a string
|
| 731 |
+
if (typeof markup !== 'string') {
|
| 732 |
+
return markup;
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
|
| 736 |
+
return replaceMap[match];
|
| 737 |
+
});
|
| 738 |
+
};
|
| 739 |
+
|
| 740 |
+
// Append an array of jQuery nodes to a given element.
|
| 741 |
+
Utils.appendMany = function ($element, $nodes) {
|
| 742 |
+
// jQuery 1.7.x does not support $.fn.append() with an array
|
| 743 |
+
// Fall back to a jQuery object collection using $.fn.add()
|
| 744 |
+
if ($.fn.jquery.substr(0, 3) === '1.7') {
|
| 745 |
+
var $jqNodes = $();
|
| 746 |
+
|
| 747 |
+
$.map($nodes, function (node) {
|
| 748 |
+
$jqNodes = $jqNodes.add(node);
|
| 749 |
+
});
|
| 750 |
+
|
| 751 |
+
$nodes = $jqNodes;
|
| 752 |
+
}
|
| 753 |
+
|
| 754 |
+
$element.append($nodes);
|
| 755 |
+
};
|
| 756 |
+
|
| 757 |
+
return Utils;
|
| 758 |
+
});
|
| 759 |
+
|
| 760 |
+
Toolset_S2.define('toolset_select2/results',[
|
| 761 |
+
'jquery',
|
| 762 |
+
'./utils'
|
| 763 |
+
], function ($, Utils) {
|
| 764 |
+
function Results ($element, options, dataAdapter) {
|
| 765 |
+
this.$element = $element;
|
| 766 |
+
this.data = dataAdapter;
|
| 767 |
+
this.options = options;
|
| 768 |
+
|
| 769 |
+
Results.__super__.constructor.call(this);
|
| 770 |
+
}
|
| 771 |
+
|
| 772 |
+
Utils.Extend(Results, Utils.Observable);
|
| 773 |
+
|
| 774 |
+
Results.prototype.render = function () {
|
| 775 |
+
var $results = $(
|
| 776 |
+
'<ul class="toolset_select2-results__options" role="tree"></ul>'
|
| 777 |
+
);
|
| 778 |
+
|
| 779 |
+
if (this.options.get('multiple')) {
|
| 780 |
+
$results.attr('aria-multiselectable', 'true');
|
| 781 |
+
}
|
| 782 |
+
|
| 783 |
+
this.$results = $results;
|
| 784 |
+
|
| 785 |
+
return $results;
|
| 786 |
+
};
|
| 787 |
+
|
| 788 |
+
Results.prototype.clear = function () {
|
| 789 |
+
this.$results.empty();
|
| 790 |
+
};
|
| 791 |
+
|
| 792 |
+
Results.prototype.displayMessage = function (params) {
|
| 793 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
| 794 |
+
|
| 795 |
+
this.clear();
|
| 796 |
+
this.hideLoading();
|
| 797 |
+
|
| 798 |
+
var $message = $(
|
| 799 |
+
'<li role="treeitem" aria-live="assertive"' +
|
| 800 |
+
' class="toolset_select2-results__option"></li>'
|
| 801 |
+
);
|
| 802 |
+
|
| 803 |
+
var message = this.options.get('translations').get(params.message);
|
| 804 |
+
|
| 805 |
+
$message.append(
|
| 806 |
+
escapeMarkup(
|
| 807 |
+
message(params.args)
|
| 808 |
+
)
|
| 809 |
+
);
|
| 810 |
+
|
| 811 |
+
$message[0].className += ' toolset_select2-results__message';
|
| 812 |
+
|
| 813 |
+
this.$results.append($message);
|
| 814 |
+
};
|
| 815 |
+
|
| 816 |
+
Results.prototype.hideMessages = function () {
|
| 817 |
+
this.$results.find('.toolset_select2-results__message').remove();
|
| 818 |
+
};
|
| 819 |
+
|
| 820 |
+
Results.prototype.append = function (data) {
|
| 821 |
+
this.hideLoading();
|
| 822 |
+
|
| 823 |
+
var $options = [];
|
| 824 |
+
|
| 825 |
+
if (data.results == null || data.results.length === 0) {
|
| 826 |
+
if (this.$results.children().length === 0) {
|
| 827 |
+
this.trigger('results:message', {
|
| 828 |
+
message: 'noResults'
|
| 829 |
+
});
|
| 830 |
+
}
|
| 831 |
+
|
| 832 |
+
return;
|
| 833 |
+
}
|
| 834 |
+
|
| 835 |
+
data.results = this.sort(data.results);
|
| 836 |
+
|
| 837 |
+
for (var d = 0; d < data.results.length; d++) {
|
| 838 |
+
var item = data.results[d];
|
| 839 |
+
|
| 840 |
+
var $option = this.option(item);
|
| 841 |
+
|
| 842 |
+
$options.push($option);
|
| 843 |
+
}
|
| 844 |
+
|
| 845 |
+
this.$results.append($options);
|
| 846 |
+
};
|
| 847 |
+
|
| 848 |
+
Results.prototype.position = function ($results, $dropdown) {
|
| 849 |
+
var $resultsContainer = $dropdown.find('.toolset_select2-results');
|
| 850 |
+
$resultsContainer.append($results);
|
| 851 |
+
};
|
| 852 |
+
|
| 853 |
+
Results.prototype.sort = function (data) {
|
| 854 |
+
var sorter = this.options.get('sorter');
|
| 855 |
+
|
| 856 |
+
return sorter(data);
|
| 857 |
+
};
|
| 858 |
+
|
| 859 |
+
Results.prototype.highlightFirstItem = function () {
|
| 860 |
+
var $options = this.$results
|
| 861 |
+
.find('.toolset_select2-results__option[aria-selected]');
|
| 862 |
+
|
| 863 |
+
var $selected = $options.filter('[aria-selected=true]');
|
| 864 |
+
|
| 865 |
+
// Check if there are any selected options
|
| 866 |
+
if ($selected.length > 0) {
|
| 867 |
+
// If there are selected options, highlight the first
|
| 868 |
+
$selected.first().trigger('mouseenter');
|
| 869 |
+
} else {
|
| 870 |
+
// If there are no selected options, highlight the first option
|
| 871 |
+
// in the dropdown
|
| 872 |
+
$options.first().trigger('mouseenter');
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
this.ensureHighlightVisible();
|
| 876 |
+
};
|
| 877 |
+
|
| 878 |
+
Results.prototype.setClasses = function () {
|
| 879 |
+
var self = this;
|
| 880 |
+
|
| 881 |
+
this.data.current(function (selected) {
|
| 882 |
+
var selectedIds = $.map(selected, function (s) {
|
| 883 |
+
return s.id.toString();
|
| 884 |
+
});
|
| 885 |
+
|
| 886 |
+
var $options = self.$results
|
| 887 |
+
.find('.toolset_select2-results__option[aria-selected]');
|
| 888 |
+
|
| 889 |
+
$options.each(function () {
|
| 890 |
+
var $option = $(this);
|
| 891 |
+
|
| 892 |
+
var item = $.data(this, 'data');
|
| 893 |
+
|
| 894 |
+
// id needs to be converted to a string when comparing
|
| 895 |
+
var id = '' + item.id;
|
| 896 |
+
|
| 897 |
+
if ((item.element != null && item.element.selected) ||
|
| 898 |
+
(item.element == null && $.inArray(id, selectedIds) > -1)) {
|
| 899 |
+
$option.attr('aria-selected', 'true');
|
| 900 |
+
} else {
|
| 901 |
+
$option.attr('aria-selected', 'false');
|
| 902 |
+
}
|
| 903 |
+
});
|
| 904 |
+
|
| 905 |
+
});
|
| 906 |
+
};
|
| 907 |
+
|
| 908 |
+
Results.prototype.showLoading = function (params) {
|
| 909 |
+
this.hideLoading();
|
| 910 |
+
|
| 911 |
+
var loadingMore = this.options.get('translations').get('searching');
|
| 912 |
+
|
| 913 |
+
var loading = {
|
| 914 |
+
disabled: true,
|
| 915 |
+
loading: true,
|
| 916 |
+
text: loadingMore(params)
|
| 917 |
+
};
|
| 918 |
+
var $loading = this.option(loading);
|
| 919 |
+
$loading.className += ' loading-results';
|
| 920 |
+
|
| 921 |
+
this.$results.prepend($loading);
|
| 922 |
+
};
|
| 923 |
+
|
| 924 |
+
Results.prototype.hideLoading = function () {
|
| 925 |
+
this.$results.find('.loading-results').remove();
|
| 926 |
+
};
|
| 927 |
+
|
| 928 |
+
Results.prototype.option = function (data) {
|
| 929 |
+
var option = document.createElement('li');
|
| 930 |
+
option.className = 'toolset_select2-results__option';
|
| 931 |
+
|
| 932 |
+
var attrs = {
|
| 933 |
+
'role': 'treeitem',
|
| 934 |
+
'aria-selected': 'false'
|
| 935 |
+
};
|
| 936 |
+
|
| 937 |
+
if (data.disabled) {
|
| 938 |
+
delete attrs['aria-selected'];
|
| 939 |
+
attrs['aria-disabled'] = 'true';
|
| 940 |
+
}
|
| 941 |
+
|
| 942 |
+
if (data.id == null) {
|
| 943 |
+
delete attrs['aria-selected'];
|
| 944 |
+
}
|
| 945 |
+
|
| 946 |
+
if (data._resultId != null) {
|
| 947 |
+
option.id = data._resultId;
|
| 948 |
+
}
|
| 949 |
+
|
| 950 |
+
if (data.title) {
|
| 951 |
+
option.title = data.title;
|
| 952 |
+
}
|
| 953 |
+
|
| 954 |
+
if (data.children) {
|
| 955 |
+
attrs.role = 'group';
|
| 956 |
+
attrs['aria-label'] = data.text;
|
| 957 |
+
delete attrs['aria-selected'];
|
| 958 |
+
}
|
| 959 |
+
|
| 960 |
+
for (var attr in attrs) {
|
| 961 |
+
var val = attrs[attr];
|
| 962 |
+
|
| 963 |
+
option.setAttribute(attr, val);
|
| 964 |
+
}
|
| 965 |
+
|
| 966 |
+
if (data.children) {
|
| 967 |
+
var $option = $(option);
|
| 968 |
+
|
| 969 |
+
var label = document.createElement('strong');
|
| 970 |
+
label.className = 'toolset_select2-results__group';
|
| 971 |
+
|
| 972 |
+
var $label = $(label);
|
| 973 |
+
this.template(data, label);
|
| 974 |
+
|
| 975 |
+
var $children = [];
|
| 976 |
+
|
| 977 |
+
for (var c = 0; c < data.children.length; c++) {
|
| 978 |
+
var child = data.children[c];
|
| 979 |
+
|
| 980 |
+
var $child = this.option(child);
|
| 981 |
+
|
| 982 |
+
$children.push($child);
|
| 983 |
+
}
|
| 984 |
+
|
| 985 |
+
var $childrenContainer = $('<ul></ul>', {
|
| 986 |
+
'class': 'toolset_select2-results__options toolset_select2-results__options--nested'
|
| 987 |
+
});
|
| 988 |
+
|
| 989 |
+
$childrenContainer.append($children);
|
| 990 |
+
|
| 991 |
+
$option.append(label);
|
| 992 |
+
$option.append($childrenContainer);
|
| 993 |
+
} else {
|
| 994 |
+
this.template(data, option);
|
| 995 |
+
}
|
| 996 |
+
|
| 997 |
+
$.data(option, 'data', data);
|
| 998 |
+
|
| 999 |
+
return option;
|
| 1000 |
+
};
|
| 1001 |
+
|
| 1002 |
+
Results.prototype.bind = function (container, $container) {
|
| 1003 |
+
var self = this;
|
| 1004 |
+
|
| 1005 |
+
var id = container.id + '-results';
|
| 1006 |
+
|
| 1007 |
+
this.$results.attr('id', id);
|
| 1008 |
+
|
| 1009 |
+
container.on('results:all', function (params) {
|
| 1010 |
+
self.clear();
|
| 1011 |
+
self.append(params.data);
|
| 1012 |
+
|
| 1013 |
+
if (container.isOpen()) {
|
| 1014 |
+
self.setClasses();
|
| 1015 |
+
self.highlightFirstItem();
|
| 1016 |
+
}
|
| 1017 |
+
});
|
| 1018 |
+
|
| 1019 |
+
container.on('results:append', function (params) {
|
| 1020 |
+
self.append(params.data);
|
| 1021 |
+
|
| 1022 |
+
if (container.isOpen()) {
|
| 1023 |
+
self.setClasses();
|
| 1024 |
+
}
|
| 1025 |
+
});
|
| 1026 |
+
|
| 1027 |
+
container.on('query', function (params) {
|
| 1028 |
+
self.hideMessages();
|
| 1029 |
+
self.showLoading(params);
|
| 1030 |
+
});
|
| 1031 |
+
|
| 1032 |
+
container.on('select', function () {
|
| 1033 |
+
if (!container.isOpen()) {
|
| 1034 |
+
return;
|
| 1035 |
+
}
|
| 1036 |
+
|
| 1037 |
+
self.setClasses();
|
| 1038 |
+
self.highlightFirstItem();
|
| 1039 |
+
});
|
| 1040 |
+
|
| 1041 |
+
container.on('unselect', function () {
|
| 1042 |
+
if (!container.isOpen()) {
|
| 1043 |
+
return;
|
| 1044 |
+
}
|
| 1045 |
+
|
| 1046 |
+
self.setClasses();
|
| 1047 |
+
self.highlightFirstItem();
|
| 1048 |
+
});
|
| 1049 |
+
|
| 1050 |
+
container.on('open', function () {
|
| 1051 |
+
// When the dropdown is open, aria-expended="true"
|
| 1052 |
+
self.$results.attr('aria-expanded', 'true');
|
| 1053 |
+
self.$results.attr('aria-hidden', 'false');
|
| 1054 |
+
|
| 1055 |
+
self.setClasses();
|
| 1056 |
+
self.ensureHighlightVisible();
|
| 1057 |
+
});
|
| 1058 |
+
|
| 1059 |
+
container.on('close', function () {
|
| 1060 |
+
// When the dropdown is closed, aria-expended="false"
|
| 1061 |
+
self.$results.attr('aria-expanded', 'false');
|
| 1062 |
+
self.$results.attr('aria-hidden', 'true');
|
| 1063 |
+
self.$results.removeAttr('aria-activedescendant');
|
| 1064 |
+
});
|
| 1065 |
+
|
| 1066 |
+
container.on('results:toggle', function () {
|
| 1067 |
+
var $highlighted = self.getHighlightedResults();
|
| 1068 |
+
|
| 1069 |
+
if ($highlighted.length === 0) {
|
| 1070 |
+
return;
|
| 1071 |
+
}
|
| 1072 |
+
|
| 1073 |
+
$highlighted.trigger('mouseup');
|
| 1074 |
+
});
|
| 1075 |
+
|
| 1076 |
+
container.on('results:select', function () {
|
| 1077 |
+
var $highlighted = self.getHighlightedResults();
|
| 1078 |
+
|
| 1079 |
+
if ($highlighted.length === 0) {
|
| 1080 |
+
return;
|
| 1081 |
+
}
|
| 1082 |
+
|
| 1083 |
+
var data = $highlighted.data('data');
|
| 1084 |
+
|
| 1085 |
+
if ($highlighted.attr('aria-selected') == 'true') {
|
| 1086 |
+
self.trigger('close', {});
|
| 1087 |
+
} else {
|
| 1088 |
+
self.trigger('select', {
|
| 1089 |
+
data: data
|
| 1090 |
+
});
|
| 1091 |
+
}
|
| 1092 |
+
});
|
| 1093 |
+
|
| 1094 |
+
container.on('results:previous', function () {
|
| 1095 |
+
var $highlighted = self.getHighlightedResults();
|
| 1096 |
+
|
| 1097 |
+
var $options = self.$results.find('[aria-selected]');
|
| 1098 |
+
|
| 1099 |
+
var currentIndex = $options.index($highlighted);
|
| 1100 |
+
|
| 1101 |
+
// If we are already at te top, don't move further
|
| 1102 |
+
if (currentIndex === 0) {
|
| 1103 |
+
return;
|
| 1104 |
+
}
|
| 1105 |
+
|
| 1106 |
+
var nextIndex = currentIndex - 1;
|
| 1107 |
+
|
| 1108 |
+
// If none are highlighted, highlight the first
|
| 1109 |
+
if ($highlighted.length === 0) {
|
| 1110 |
+
nextIndex = 0;
|
| 1111 |
+
}
|
| 1112 |
+
|
| 1113 |
+
var $next = $options.eq(nextIndex);
|
| 1114 |
+
|
| 1115 |
+
$next.trigger('mouseenter');
|
| 1116 |
+
|
| 1117 |
+
var currentOffset = self.$results.offset().top;
|
| 1118 |
+
var nextTop = $next.offset().top;
|
| 1119 |
+
var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
|
| 1120 |
+
|
| 1121 |
+
if (nextIndex === 0) {
|
| 1122 |
+
self.$results.scrollTop(0);
|
| 1123 |
+
} else if (nextTop - currentOffset < 0) {
|
| 1124 |
+
self.$results.scrollTop(nextOffset);
|
| 1125 |
+
}
|
| 1126 |
+
});
|
| 1127 |
+
|
| 1128 |
+
container.on('results:next', function () {
|
| 1129 |
+
var $highlighted = self.getHighlightedResults();
|
| 1130 |
+
|
| 1131 |
+
var $options = self.$results.find('[aria-selected]');
|
| 1132 |
+
|
| 1133 |
+
var currentIndex = $options.index($highlighted);
|
| 1134 |
+
|
| 1135 |
+
var nextIndex = currentIndex + 1;
|
| 1136 |
+
|
| 1137 |
+
// If we are at the last option, stay there
|
| 1138 |
+
if (nextIndex >= $options.length) {
|
| 1139 |
+
return;
|
| 1140 |
+
}
|
| 1141 |
+
|
| 1142 |
+
var $next = $options.eq(nextIndex);
|
| 1143 |
+
|
| 1144 |
+
$next.trigger('mouseenter');
|
| 1145 |
+
|
| 1146 |
+
var currentOffset = self.$results.offset().top +
|
| 1147 |
+
self.$results.outerHeight(false);
|
| 1148 |
+
var nextBottom = $next.offset().top + $next.outerHeight(false);
|
| 1149 |
+
var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
|
| 1150 |
+
|
| 1151 |
+
if (nextIndex === 0) {
|
| 1152 |
+
self.$results.scrollTop(0);
|
| 1153 |
+
} else if (nextBottom > currentOffset) {
|
| 1154 |
+
self.$results.scrollTop(nextOffset);
|
| 1155 |
+
}
|
| 1156 |
+
});
|
| 1157 |
+
|
| 1158 |
+
container.on('results:focus', function (params) {
|
| 1159 |
+
params.element.addClass('toolset_select2-results__option--highlighted');
|
| 1160 |
+
});
|
| 1161 |
+
|
| 1162 |
+
container.on('results:message', function (params) {
|
| 1163 |
+
self.displayMessage(params);
|
| 1164 |
+
});
|
| 1165 |
+
|
| 1166 |
+
if ($.fn.mousewheel) {
|
| 1167 |
+
this.$results.on('mousewheel', function (e) {
|
| 1168 |
+
var top = self.$results.scrollTop();
|
| 1169 |
+
|
| 1170 |
+
var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
|
| 1171 |
+
|
| 1172 |
+
var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
|
| 1173 |
+
var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
|
| 1174 |
+
|
| 1175 |
+
if (isAtTop) {
|
| 1176 |
+
self.$results.scrollTop(0);
|
| 1177 |
+
|
| 1178 |
+
e.preventDefault();
|
| 1179 |
+
e.stopPropagation();
|
| 1180 |
+
} else if (isAtBottom) {
|
| 1181 |
+
self.$results.scrollTop(
|
| 1182 |
+
self.$results.get(0).scrollHeight - self.$results.height()
|
| 1183 |
+
);
|
| 1184 |
+
|
| 1185 |
+
e.preventDefault();
|
| 1186 |
+
e.stopPropagation();
|
| 1187 |
+
}
|
| 1188 |
+
});
|
| 1189 |
+
}
|
| 1190 |
+
|
| 1191 |
+
this.$results.on('mouseup', '.toolset_select2-results__option[aria-selected]',
|
| 1192 |
+
function (evt) {
|
| 1193 |
+
var $this = $(this);
|
| 1194 |
+
|
| 1195 |
+
var data = $this.data('data');
|
| 1196 |
+
|
| 1197 |
+
if ($this.attr('aria-selected') === 'true') {
|
| 1198 |
+
if (self.options.get('multiple')) {
|
| 1199 |
+
self.trigger('unselect', {
|
| 1200 |
+
originalEvent: evt,
|
| 1201 |
+
data: data
|
| 1202 |
+
});
|
| 1203 |
+
} else {
|
| 1204 |
+
self.trigger('close', {});
|
| 1205 |
+
}
|
| 1206 |
+
|
| 1207 |
+
return;
|
| 1208 |
+
}
|
| 1209 |
+
|
| 1210 |
+
self.trigger('select', {
|
| 1211 |
+
originalEvent: evt,
|
| 1212 |
+
data: data
|
| 1213 |
+
});
|
| 1214 |
+
});
|
| 1215 |
+
|
| 1216 |
+
this.$results.on('mouseenter', '.toolset_select2-results__option[aria-selected]',
|
| 1217 |
+
function (evt) {
|
| 1218 |
+
var data = $(this).data('data');
|
| 1219 |
+
|
| 1220 |
+
self.getHighlightedResults()
|
| 1221 |
+
.removeClass('toolset_select2-results__option--highlighted');
|
| 1222 |
+
|
| 1223 |
+
self.trigger('results:focus', {
|
| 1224 |
+
data: data,
|
| 1225 |
+
element: $(this)
|
| 1226 |
+
});
|
| 1227 |
+
});
|
| 1228 |
+
};
|
| 1229 |
+
|
| 1230 |
+
Results.prototype.getHighlightedResults = function () {
|
| 1231 |
+
var $highlighted = this.$results
|
| 1232 |
+
.find('.toolset_select2-results__option--highlighted');
|
| 1233 |
+
|
| 1234 |
+
return $highlighted;
|
| 1235 |
+
};
|
| 1236 |
+
|
| 1237 |
+
Results.prototype.destroy = function () {
|
| 1238 |
+
this.$results.remove();
|
| 1239 |
+
};
|
| 1240 |
+
|
| 1241 |
+
Results.prototype.ensureHighlightVisible = function () {
|
| 1242 |
+
var $highlighted = this.getHighlightedResults();
|
| 1243 |
+
|
| 1244 |
+
if ($highlighted.length === 0) {
|
| 1245 |
+
return;
|
| 1246 |
+
}
|
| 1247 |
+
|
| 1248 |
+
var $options = this.$results.find('[aria-selected]');
|
| 1249 |
+
|
| 1250 |
+
var currentIndex = $options.index($highlighted);
|
| 1251 |
+
|
| 1252 |
+
var currentOffset = this.$results.offset().top;
|
| 1253 |
+
var nextTop = $highlighted.offset().top;
|
| 1254 |
+
var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
|
| 1255 |
+
|
| 1256 |
+
var offsetDelta = nextTop - currentOffset;
|
| 1257 |
+
nextOffset -= $highlighted.outerHeight(false) * 2;
|
| 1258 |
+
|
| 1259 |
+
if (currentIndex <= 2) {
|
| 1260 |
+
this.$results.scrollTop(0);
|
| 1261 |
+
} else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
|
| 1262 |
+
this.$results.scrollTop(nextOffset);
|
| 1263 |
+
}
|
| 1264 |
+
};
|
| 1265 |
+
|
| 1266 |
+
Results.prototype.template = function (result, container) {
|
| 1267 |
+
var template = this.options.get('templateResult');
|
| 1268 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
| 1269 |
+
|
| 1270 |
+
var content = template(result, container);
|
| 1271 |
+
|
| 1272 |
+
if (content == null) {
|
| 1273 |
+
container.style.display = 'none';
|
| 1274 |
+
} else if (typeof content === 'string') {
|
| 1275 |
+
container.innerHTML = escapeMarkup(content);
|
| 1276 |
+
} else {
|
| 1277 |
+
$(container).append(content);
|
| 1278 |
+
}
|
| 1279 |
+
};
|
| 1280 |
+
|
| 1281 |
+
return Results;
|
| 1282 |
+
});
|
| 1283 |
+
|
| 1284 |
+
Toolset_S2.define('toolset_select2/keys',[
|
| 1285 |
+
|
| 1286 |
+
], function () {
|
| 1287 |
+
var KEYS = {
|
| 1288 |
+
BACKSPACE: 8,
|
| 1289 |
+
TAB: 9,
|
| 1290 |
+
ENTER: 13,
|
| 1291 |
+
SHIFT: 16,
|
| 1292 |
+
CTRL: 17,
|
| 1293 |
+
ALT: 18,
|
| 1294 |
+
ESC: 27,
|
| 1295 |
+
SPACE: 32,
|
| 1296 |
+
PAGE_UP: 33,
|
| 1297 |
+
PAGE_DOWN: 34,
|
| 1298 |
+
END: 35,
|
| 1299 |
+
HOME: 36,
|
| 1300 |
+
LEFT: 37,
|
| 1301 |
+
UP: 38,
|
| 1302 |
+
RIGHT: 39,
|
| 1303 |
+
DOWN: 40,
|
| 1304 |
+
DELETE: 46
|
| 1305 |
+
};
|
| 1306 |
+
|
| 1307 |
+
return KEYS;
|
| 1308 |
+
});
|
| 1309 |
+
|
| 1310 |
+
Toolset_S2.define('toolset_select2/selection/base',[
|
| 1311 |
+
'jquery',
|
| 1312 |
+
'../utils',
|
| 1313 |
+
'../keys'
|
| 1314 |
+
], function ($, Utils, KEYS) {
|
| 1315 |
+
function BaseSelection ($element, options) {
|
| 1316 |
+
this.$element = $element;
|
| 1317 |
+
this.options = options;
|
| 1318 |
+
|
| 1319 |
+
BaseSelection.__super__.constructor.call(this);
|
| 1320 |
+
}
|
| 1321 |
+
|
| 1322 |
+
Utils.Extend(BaseSelection, Utils.Observable);
|
| 1323 |
+
|
| 1324 |
+
BaseSelection.prototype.render = function () {
|
| 1325 |
+
var $selection = $(
|
| 1326 |
+
'<span class="toolset_select2-selection" role="combobox" ' +
|
| 1327 |
+
' aria-haspopup="true" aria-expanded="false">' +
|
| 1328 |
+
'</span>'
|
| 1329 |
+
);
|
| 1330 |
+
|
| 1331 |
+
this._tabindex = 0;
|
| 1332 |
+
|
| 1333 |
+
if (this.$element.data('old-tabindex') != null) {
|
| 1334 |
+
this._tabindex = this.$element.data('old-tabindex');
|
| 1335 |
+
} else if (this.$element.attr('tabindex') != null) {
|
| 1336 |
+
this._tabindex = this.$element.attr('tabindex');
|
| 1337 |
+
}
|
| 1338 |
+
|
| 1339 |
+
$selection.attr('title', this.$element.attr('title'));
|
| 1340 |
+
$selection.attr('tabindex', this._tabindex);
|
| 1341 |
+
|
| 1342 |
+
this.$selection = $selection;
|
| 1343 |
+
|
| 1344 |
+
return $selection;
|
| 1345 |
+
};
|
| 1346 |
+
|
| 1347 |
+
BaseSelection.prototype.bind = function (container, $container) {
|
| 1348 |
+
var self = this;
|
| 1349 |
+
|
| 1350 |
+
var id = container.id + '-container';
|
| 1351 |
+
var resultsId = container.id + '-results';
|
| 1352 |
+
|
| 1353 |
+
this.container = container;
|
| 1354 |
+
|
| 1355 |
+
this.$selection.on('focus', function (evt) {
|
| 1356 |
+
self.trigger('focus', evt);
|
| 1357 |
+
});
|
| 1358 |
+
|
| 1359 |
+
this.$selection.on('blur', function (evt) {
|
| 1360 |
+
self._handleBlur(evt);
|
| 1361 |
+
});
|
| 1362 |
+
|
| 1363 |
+
this.$selection.on('keydown', function (evt) {
|
| 1364 |
+
self.trigger('keypress', evt);
|
| 1365 |
+
|
| 1366 |
+
if (evt.which === KEYS.SPACE) {
|
| 1367 |
+
evt.preventDefault();
|
| 1368 |
+
}
|
| 1369 |
+
});
|
| 1370 |
+
|
| 1371 |
+
container.on('results:focus', function (params) {
|
| 1372 |
+
self.$selection.attr('aria-activedescendant', params.data._resultId);
|
| 1373 |
+
});
|
| 1374 |
+
|
| 1375 |
+
container.on('selection:update', function (params) {
|
| 1376 |
+
self.update(params.data);
|
| 1377 |
+
});
|
| 1378 |
+
|
| 1379 |
+
container.on('open', function () {
|
| 1380 |
+
// When the dropdown is open, aria-expanded="true"
|
| 1381 |
+
self.$selection.attr('aria-expanded', 'true');
|
| 1382 |
+
self.$selection.attr('aria-owns', resultsId);
|
| 1383 |
+
|
| 1384 |
+
self._attachCloseHandler(container);
|
| 1385 |
+
});
|
| 1386 |
+
|
| 1387 |
+
container.on('close', function () {
|
| 1388 |
+
// When the dropdown is closed, aria-expanded="false"
|
| 1389 |
+
self.$selection.attr('aria-expanded', 'false');
|
| 1390 |
+
self.$selection.removeAttr('aria-activedescendant');
|
| 1391 |
+
self.$selection.removeAttr('aria-owns');
|
| 1392 |
+
|
| 1393 |
+
self.$selection.focus();
|
| 1394 |
+
|
| 1395 |
+
self._detachCloseHandler(container);
|
| 1396 |
+
});
|
| 1397 |
+
|
| 1398 |
+
container.on('enable', function () {
|
| 1399 |
+
self.$selection.attr('tabindex', self._tabindex);
|
| 1400 |
+
});
|
| 1401 |
+
|
| 1402 |
+
container.on('disable', function () {
|
| 1403 |
+
self.$selection.attr('tabindex', '-1');
|
| 1404 |
+
});
|
| 1405 |
+
};
|
| 1406 |
+
|
| 1407 |
+
BaseSelection.prototype._handleBlur = function (evt) {
|
| 1408 |
+
var self = this;
|
| 1409 |
+
|
| 1410 |
+
// This needs to be delayed as the active element is the body when the tab
|
| 1411 |
+
// key is pressed, possibly along with others.
|
| 1412 |
+
window.setTimeout(function () {
|
| 1413 |
+
// Don't trigger `blur` if the focus is still in the selection
|
| 1414 |
+
if (
|
| 1415 |
+
(document.activeElement == self.$selection[0]) ||
|
| 1416 |
+
($.contains(self.$selection[0], document.activeElement))
|
| 1417 |
+
) {
|
| 1418 |
+
return;
|
| 1419 |
+
}
|
| 1420 |
+
|
| 1421 |
+
self.trigger('blur', evt);
|
| 1422 |
+
}, 1);
|
| 1423 |
+
};
|
| 1424 |
+
|
| 1425 |
+
BaseSelection.prototype._attachCloseHandler = function (container) {
|
| 1426 |
+
var self = this;
|
| 1427 |
+
|
| 1428 |
+
$(document.body).on('mousedown.toolset_select2.' + container.id, function (e) {
|
| 1429 |
+
var $target = $(e.target);
|
| 1430 |
+
|
| 1431 |
+
var $select = $target.closest('.toolset_select2');
|
| 1432 |
+
|
| 1433 |
+
var $all = $('.toolset_select2.toolset_select2-container--open');
|
| 1434 |
+
|
| 1435 |
+
$all.each(function () {
|
| 1436 |
+
var $this = $(this);
|
| 1437 |
+
|
| 1438 |
+
if (this == $select[0]) {
|
| 1439 |
+
return;
|
| 1440 |
+
}
|
| 1441 |
+
|
| 1442 |
+
var $element = $this.data('element');
|
| 1443 |
+
|
| 1444 |
+
$element.toolset_select2('close');
|
| 1445 |
+
});
|
| 1446 |
+
});
|
| 1447 |
+
};
|
| 1448 |
+
|
| 1449 |
+
BaseSelection.prototype._detachCloseHandler = function (container) {
|
| 1450 |
+
$(document.body).off('mousedown.toolset_select2.' + container.id);
|
| 1451 |
+
};
|
| 1452 |
+
|
| 1453 |
+
BaseSelection.prototype.position = function ($selection, $container) {
|
| 1454 |
+
var $selectionContainer = $container.find('.selection');
|
| 1455 |
+
$selectionContainer.append($selection);
|
| 1456 |
+
};
|
| 1457 |
+
|
| 1458 |
+
BaseSelection.prototype.destroy = function () {
|
| 1459 |
+
this._detachCloseHandler(this.container);
|
| 1460 |
+
};
|
| 1461 |
+
|
| 1462 |
+
BaseSelection.prototype.update = function (data) {
|
| 1463 |
+
throw new Error('The `update` method must be defined in child classes.');
|
| 1464 |
+
};
|
| 1465 |
+
|
| 1466 |
+
return BaseSelection;
|
| 1467 |
+
});
|
| 1468 |
+
|
| 1469 |
+
Toolset_S2.define('toolset_select2/selection/single',[
|
| 1470 |
+
'jquery',
|
| 1471 |
+
'./base',
|
| 1472 |
+
'../utils',
|
| 1473 |
+
'../keys'
|
| 1474 |
+
], function ($, BaseSelection, Utils, KEYS) {
|
| 1475 |
+
function SingleSelection () {
|
| 1476 |
+
SingleSelection.__super__.constructor.apply(this, arguments);
|
| 1477 |
+
}
|
| 1478 |
+
|
| 1479 |
+
Utils.Extend(SingleSelection, BaseSelection);
|
| 1480 |
+
|
| 1481 |
+
SingleSelection.prototype.render = function () {
|
| 1482 |
+
var $selection = SingleSelection.__super__.render.call(this);
|
| 1483 |
+
|
| 1484 |
+
$selection.addClass('toolset_select2-selection--single');
|
| 1485 |
+
|
| 1486 |
+
$selection.html(
|
| 1487 |
+
'<span class="toolset_select2-selection__rendered"></span>' +
|
| 1488 |
+
'<span class="toolset_select2-selection__arrow" role="presentation">' +
|
| 1489 |
+
'<b role="presentation"></b>' +
|
| 1490 |
+
'</span>'
|
| 1491 |
+
);
|
| 1492 |
+
|
| 1493 |
+
return $selection;
|
| 1494 |
+
};
|
| 1495 |
+
|
| 1496 |
+
SingleSelection.prototype.bind = function (container, $container) {
|
| 1497 |
+
var self = this;
|
| 1498 |
+
|
| 1499 |
+
SingleSelection.__super__.bind.apply(this, arguments);
|
| 1500 |
+
|
| 1501 |
+
var id = container.id + '-container';
|
| 1502 |
+
|
| 1503 |
+
this.$selection.find('.toolset_select2-selection__rendered').attr('id', id);
|
| 1504 |
+
this.$selection.attr('aria-labelledby', id);
|
| 1505 |
+
|
| 1506 |
+
this.$selection.on('mousedown', function (evt) {
|
| 1507 |
+
// Only respond to left clicks
|
| 1508 |
+
if (evt.which !== 1) {
|
| 1509 |
+
return;
|
| 1510 |
+
}
|
| 1511 |
+
|
| 1512 |
+
self.trigger('toggle', {
|
| 1513 |
+
originalEvent: evt
|
| 1514 |
+
});
|
| 1515 |
+
});
|
| 1516 |
+
|
| 1517 |
+
this.$selection.on('focus', function (evt) {
|
| 1518 |
+
// User focuses on the container
|
| 1519 |
+
});
|
| 1520 |
+
|
| 1521 |
+
this.$selection.on('blur', function (evt) {
|
| 1522 |
+
// User exits the container
|
| 1523 |
+
});
|
| 1524 |
+
|
| 1525 |
+
container.on('focus', function (evt) {
|
| 1526 |
+
if (!container.isOpen()) {
|
| 1527 |
+
self.$selection.focus();
|
| 1528 |
+
}
|
| 1529 |
+
});
|
| 1530 |
+
|
| 1531 |
+
container.on('selection:update', function (params) {
|
| 1532 |
+
self.update(params.data);
|
| 1533 |
+
});
|
| 1534 |
+
};
|
| 1535 |
+
|
| 1536 |
+
SingleSelection.prototype.clear = function () {
|
| 1537 |
+
this.$selection.find('.toolset_select2-selection__rendered').empty();
|
| 1538 |
+
};
|
| 1539 |
+
|
| 1540 |
+
SingleSelection.prototype.display = function (data, container) {
|
| 1541 |
+
var template = this.options.get('templateSelection');
|
| 1542 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
| 1543 |
+
|
| 1544 |
+
return escapeMarkup(template(data, container));
|
| 1545 |
+
};
|
| 1546 |
+
|
| 1547 |
+
SingleSelection.prototype.selectionContainer = function () {
|
| 1548 |
+
return $('<span></span>');
|
| 1549 |
+
};
|
| 1550 |
+
|
| 1551 |
+
SingleSelection.prototype.update = function (data) {
|
| 1552 |
+
if (data.length === 0) {
|
| 1553 |
+
this.clear();
|
| 1554 |
+
return;
|
| 1555 |
+
}
|
| 1556 |
+
|
| 1557 |
+
var selection = data[0];
|
| 1558 |
+
|
| 1559 |
+
var $rendered = this.$selection.find('.toolset_select2-selection__rendered');
|
| 1560 |
+
var formatted = this.display(selection, $rendered);
|
| 1561 |
+
|
| 1562 |
+
$rendered.empty().append(formatted);
|
| 1563 |
+
$rendered.prop('title', selection.title || selection.text);
|
| 1564 |
+
};
|
| 1565 |
+
|
| 1566 |
+
return SingleSelection;
|
| 1567 |
+
});
|
| 1568 |
+
|
| 1569 |
+
Toolset_S2.define('toolset_select2/selection/multiple',[
|
| 1570 |
+
'jquery',
|
| 1571 |
+
'./base',
|
| 1572 |
+
'../utils'
|
| 1573 |
+
], function ($, BaseSelection, Utils) {
|
| 1574 |
+
function MultipleSelection ($element, options) {
|
| 1575 |
+
MultipleSelection.__super__.constructor.apply(this, arguments);
|
| 1576 |
+
}
|
| 1577 |
+
|
| 1578 |
+
Utils.Extend(MultipleSelection, BaseSelection);
|
| 1579 |
+
|
| 1580 |
+
MultipleSelection.prototype.render = function () {
|
| 1581 |
+
var $selection = MultipleSelection.__super__.render.call(this);
|
| 1582 |
+
|
| 1583 |
+
$selection.addClass('toolset_select2-selection--multiple');
|
| 1584 |
+
|
| 1585 |
+
$selection.html(
|
| 1586 |
+
'<ul class="toolset_select2-selection__rendered"></ul>'
|
| 1587 |
+
);
|
| 1588 |
+
|
| 1589 |
+
return $selection;
|
| 1590 |
+
};
|
| 1591 |
+
|
| 1592 |
+
MultipleSelection.prototype.bind = function (container, $container) {
|
| 1593 |
+
var self = this;
|
| 1594 |
+
|
| 1595 |
+
MultipleSelection.__super__.bind.apply(this, arguments);
|
| 1596 |
+
|
| 1597 |
+
this.$selection.on('click', function (evt) {
|
| 1598 |
+
self.trigger('toggle', {
|
| 1599 |
+
originalEvent: evt
|
| 1600 |
+
});
|
| 1601 |
+
});
|
| 1602 |
+
|
| 1603 |
+
this.$selection.on(
|
| 1604 |
+
'click',
|
| 1605 |
+
'.toolset_select2-selection__choice__remove',
|
| 1606 |
+
function (evt) {
|
| 1607 |
+
// Ignore the event if it is disabled
|
| 1608 |
+
if (self.options.get('disabled')) {
|
| 1609 |
+
return;
|
| 1610 |
+
}
|
| 1611 |
+
|
| 1612 |
+
var $remove = $(this);
|
| 1613 |
+
var $selection = $remove.parent();
|
| 1614 |
+
|
| 1615 |
+
var data = $selection.data('data');
|
| 1616 |
+
|
| 1617 |
+
self.trigger('unselect', {
|
| 1618 |
+
originalEvent: evt,
|
| 1619 |
+
data: data
|
| 1620 |
+
});
|
| 1621 |
+
}
|
| 1622 |
+
);
|
| 1623 |
+
};
|
| 1624 |
+
|
| 1625 |
+
MultipleSelection.prototype.clear = function () {
|
| 1626 |
+
this.$selection.find('.toolset_select2-selection__rendered').empty();
|
| 1627 |
+
};
|
| 1628 |
+
|
| 1629 |
+
MultipleSelection.prototype.display = function (data, container) {
|
| 1630 |
+
var template = this.options.get('templateSelection');
|
| 1631 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
| 1632 |
+
|
| 1633 |
+
return escapeMarkup(template(data, container));
|
| 1634 |
+
};
|
| 1635 |
+
|
| 1636 |
+
MultipleSelection.prototype.selectionContainer = function () {
|
| 1637 |
+
var $container = $(
|
| 1638 |
+
'<li class="toolset_select2-selection__choice">' +
|
| 1639 |
+
'<span class="toolset_select2-selection__choice__remove" role="presentation">' +
|
| 1640 |
+
'×' +
|
| 1641 |
+
'</span>' +
|
| 1642 |
+
'</li>'
|
| 1643 |
+
);
|
| 1644 |
+
|
| 1645 |
+
return $container;
|
| 1646 |
+
};
|
| 1647 |
+
|
| 1648 |
+
MultipleSelection.prototype.update = function (data) {
|
| 1649 |
+
this.clear();
|
| 1650 |
+
|
| 1651 |
+
if (data.length === 0) {
|
| 1652 |
+
return;
|
| 1653 |
+
}
|
| 1654 |
+
|
| 1655 |
+
var $selections = [];
|
| 1656 |
+
|
| 1657 |
+
for (var d = 0; d < data.length; d++) {
|
| 1658 |
+
var selection = data[d];
|
| 1659 |
+
|
| 1660 |
+
var $selection = this.selectionContainer();
|
| 1661 |
+
var formatted = this.display(selection, $selection);
|
| 1662 |
+
|
| 1663 |
+
$selection.append(formatted);
|
| 1664 |
+
$selection.prop('title', selection.title || selection.text);
|
| 1665 |
+
|
| 1666 |
+
$selection.data('data', selection);
|
| 1667 |
+
|
| 1668 |
+
$selections.push($selection);
|
| 1669 |
+
}
|
| 1670 |
+
|
| 1671 |
+
var $rendered = this.$selection.find('.toolset_select2-selection__rendered');
|
| 1672 |
+
|
| 1673 |
+
Utils.appendMany($rendered, $selections);
|
| 1674 |
+
};
|
| 1675 |
+
|
| 1676 |
+
return MultipleSelection;
|
| 1677 |
+
});
|
| 1678 |
+
|
| 1679 |
+
Toolset_S2.define('toolset_select2/selection/placeholder',[
|
| 1680 |
+
'../utils'
|
| 1681 |
+
], function (Utils) {
|
| 1682 |
+
function Placeholder (decorated, $element, options) {
|
| 1683 |
+
this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
|
| 1684 |
+
|
| 1685 |
+
decorated.call(this, $element, options);
|
| 1686 |
+
}
|
| 1687 |
+
|
| 1688 |
+
Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
|
| 1689 |
+
if (typeof placeholder === 'string') {
|
| 1690 |
+
placeholder = {
|
| 1691 |
+
id: '',
|
| 1692 |
+
text: placeholder
|
| 1693 |
+
};
|
| 1694 |
+
}
|
| 1695 |
+
|
| 1696 |
+
return placeholder;
|
| 1697 |
+
};
|
| 1698 |
+
|
| 1699 |
+
Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
|
| 1700 |
+
var $placeholder = this.selectionContainer();
|
| 1701 |
+
|
| 1702 |
+
$placeholder.html(this.display(placeholder));
|
| 1703 |
+
$placeholder.addClass('toolset_select2-selection__placeholder')
|
| 1704 |
+
.removeClass('toolset_select2-selection__choice');
|
| 1705 |
+
|
| 1706 |
+
return $placeholder;
|
| 1707 |
+
};
|
| 1708 |
+
|
| 1709 |
+
Placeholder.prototype.update = function (decorated, data) {
|
| 1710 |
+
var singlePlaceholder = (
|
| 1711 |
+
data.length == 1 && data[0].id != this.placeholder.id
|
| 1712 |
+
);
|
| 1713 |
+
var multipleSelections = data.length > 1;
|
| 1714 |
+
|
| 1715 |
+
if (multipleSelections || singlePlaceholder) {
|
| 1716 |
+
return decorated.call(this, data);
|
| 1717 |
+
}
|
| 1718 |
+
|
| 1719 |
+
this.clear();
|
| 1720 |
+
|
| 1721 |
+
var $placeholder = this.createPlaceholder(this.placeholder);
|
| 1722 |
+
|
| 1723 |
+
this.$selection.find('.toolset_select2-selection__rendered').append($placeholder);
|
| 1724 |
+
};
|
| 1725 |
+
|
| 1726 |
+
return Placeholder;
|
| 1727 |
+
});
|
| 1728 |
+
|
| 1729 |
+
Toolset_S2.define('toolset_select2/selection/allowClear',[
|
| 1730 |
+
'jquery',
|
| 1731 |
+
'../keys'
|
| 1732 |
+
], function ($, KEYS) {
|
| 1733 |
+
function AllowClear () { }
|
| 1734 |
+
|
| 1735 |
+
AllowClear.prototype.bind = function (decorated, container, $container) {
|
| 1736 |
+
var self = this;
|
| 1737 |
+
|
| 1738 |
+
decorated.call(this, container, $container);
|
| 1739 |
+
|
| 1740 |
+
if (this.placeholder == null) {
|
| 1741 |
+
if (this.options.get('debug') && window.console && console.error) {
|
| 1742 |
+
console.error(
|
| 1743 |
+
'Select2: The `allowClear` option should be used in combination ' +
|
| 1744 |
+
'with the `placeholder` option.'
|
| 1745 |
+
);
|
| 1746 |
+
}
|
| 1747 |
+
}
|
| 1748 |
+
|
| 1749 |
+
this.$selection.on('mousedown', '.toolset_select2-selection__clear',
|
| 1750 |
+
function (evt) {
|
| 1751 |
+
self._handleClear(evt);
|
| 1752 |
+
});
|
| 1753 |
+
|
| 1754 |
+
container.on('keypress', function (evt) {
|
| 1755 |
+
self._handleKeyboardClear(evt, container);
|
| 1756 |
+
});
|
| 1757 |
+
};
|
| 1758 |
+
|
| 1759 |
+
AllowClear.prototype._handleClear = function (_, evt) {
|
| 1760 |
+
// Ignore the event if it is disabled
|
| 1761 |
+
if (this.options.get('disabled')) {
|
| 1762 |
+
return;
|
| 1763 |
+
}
|
| 1764 |
+
|
| 1765 |
+
var $clear = this.$selection.find('.toolset_select2-selection__clear');
|
| 1766 |
+
|
| 1767 |
+
// Ignore the event if nothing has been selected
|
| 1768 |
+
if ($clear.length === 0) {
|
| 1769 |
+
return;
|
| 1770 |
+
}
|
| 1771 |
+
|
| 1772 |
+
evt.stopPropagation();
|
| 1773 |
+
|
| 1774 |
+
var data = $clear.data('data');
|
| 1775 |
+
|
| 1776 |
+
for (var d = 0; d < data.length; d++) {
|
| 1777 |
+
var unselectData = {
|
| 1778 |
+
data: data[d]
|
| 1779 |
+
};
|
| 1780 |
+
|
| 1781 |
+
// Trigger the `unselect` event, so people can prevent it from being
|
| 1782 |
+
// cleared.
|
| 1783 |
+
this.trigger('unselect', unselectData);
|
| 1784 |
+
|
| 1785 |
+
// If the event was prevented, don't clear it out.
|
| 1786 |
+
if (unselectData.prevented) {
|
| 1787 |
+
return;
|
| 1788 |
+
}
|
| 1789 |
+
}
|
| 1790 |
+
|
| 1791 |
+
this.$element.val(this.placeholder.id).trigger('change');
|
| 1792 |
+
|
| 1793 |
+
this.trigger('toggle', {});
|
| 1794 |
+
};
|
| 1795 |
+
|
| 1796 |
+
AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
|
| 1797 |
+
if (container.isOpen()) {
|
| 1798 |
+
return;
|
| 1799 |
+
}
|
| 1800 |
+
|
| 1801 |
+
if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
|
| 1802 |
+
this._handleClear(evt);
|
| 1803 |
+
}
|
| 1804 |
+
};
|
| 1805 |
+
|
| 1806 |
+
AllowClear.prototype.update = function (decorated, data) {
|
| 1807 |
+
decorated.call(this, data);
|
| 1808 |
+
|
| 1809 |
+
if (this.$selection.find('.toolset_select2-selection__placeholder').length > 0 ||
|
| 1810 |
+
data.length === 0) {
|
| 1811 |
+
return;
|
| 1812 |
+
}
|
| 1813 |
+
|
| 1814 |
+
var $remove = $(
|
| 1815 |
+
'<span class="toolset_select2-selection__clear">' +
|
| 1816 |
+
'×' +
|
| 1817 |
+
'</span>'
|
| 1818 |
+
);
|
| 1819 |
+
$remove.data('data', data);
|
| 1820 |
+
|
| 1821 |
+
this.$selection.find('.toolset_select2-selection__rendered').prepend($remove);
|
| 1822 |
+
};
|
| 1823 |
+
|
| 1824 |
+
return AllowClear;
|
| 1825 |
+
});
|
| 1826 |
+
|
| 1827 |
+
Toolset_S2.define('toolset_select2/selection/search',[
|
| 1828 |
+
'jquery',
|
| 1829 |
+
'../utils',
|
| 1830 |
+
'../keys'
|
| 1831 |
+
], function ($, Utils, KEYS) {
|
| 1832 |
+
function Search (decorated, $element, options) {
|
| 1833 |
+
decorated.call(this, $element, options);
|
| 1834 |
+
}
|
| 1835 |
+
|
| 1836 |
+
Search.prototype.render = function (decorated) {
|
| 1837 |
+
var $search = $(
|
| 1838 |
+
'<li class="toolset_select2-search toolset_select2-search--inline">' +
|
| 1839 |
+
'<input class="toolset_select2-search__field" type="search" tabindex="-1"' +
|
| 1840 |
+
' autocomplete="off" autocorrect="off" autocapitalize="off"' +
|
| 1841 |
+
' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
|
| 1842 |
+
'</li>'
|
| 1843 |
+
);
|
| 1844 |
+
|
| 1845 |
+
this.$searchContainer = $search;
|
| 1846 |
+
this.$search = $search.find('input');
|
| 1847 |
+
|
| 1848 |
+
var $rendered = decorated.call(this);
|
| 1849 |
+
|
| 1850 |
+
this._transferTabIndex();
|
| 1851 |
+
|
| 1852 |
+
return $rendered;
|
| 1853 |
+
};
|
| 1854 |
+
|
| 1855 |
+
Search.prototype.bind = function (decorated, container, $container) {
|
| 1856 |
+
var self = this;
|
| 1857 |
+
|
| 1858 |
+
decorated.call(this, container, $container);
|
| 1859 |
+
|
| 1860 |
+
container.on('open', function () {
|
| 1861 |
+
self.$search.trigger('focus');
|
| 1862 |
+
});
|
| 1863 |
+
|
| 1864 |
+
container.on('close', function () {
|
| 1865 |
+
self.$search.val('');
|
| 1866 |
+
self.$search.removeAttr('aria-activedescendant');
|
| 1867 |
+
self.$search.trigger('focus');
|
| 1868 |
+
});
|
| 1869 |
+
|
| 1870 |
+
container.on('enable', function () {
|
| 1871 |
+
self.$search.prop('disabled', false);
|
| 1872 |
+
|
| 1873 |
+
self._transferTabIndex();
|
| 1874 |
+
});
|
| 1875 |
+
|
| 1876 |
+
container.on('disable', function () {
|
| 1877 |
+
self.$search.prop('disabled', true);
|
| 1878 |
+
});
|
| 1879 |
+
|
| 1880 |
+
container.on('focus', function (evt) {
|
| 1881 |
+
self.$search.trigger('focus');
|
| 1882 |
+
});
|
| 1883 |
+
|
| 1884 |
+
container.on('results:focus', function (params) {
|
| 1885 |
+
self.$search.attr('aria-activedescendant', params.id);
|
| 1886 |
+
});
|
| 1887 |
+
|
| 1888 |
+
this.$selection.on('focusin', '.toolset_select2-search--inline', function (evt) {
|
| 1889 |
+
self.trigger('focus', evt);
|
| 1890 |
+
});
|
| 1891 |
+
|
| 1892 |
+
this.$selection.on('focusout', '.toolset_select2-search--inline', function (evt) {
|
| 1893 |
+
self._handleBlur(evt);
|
| 1894 |
+
});
|
| 1895 |
+
|
| 1896 |
+
this.$selection.on('keydown', '.toolset_select2-search--inline', function (evt) {
|
| 1897 |
+
evt.stopPropagation();
|
| 1898 |
+
|
| 1899 |
+
self.trigger('keypress', evt);
|
| 1900 |
+
|
| 1901 |
+
self._keyUpPrevented = evt.isDefaultPrevented();
|
| 1902 |
+
|
| 1903 |
+
var key = evt.which;
|
| 1904 |
+
|
| 1905 |
+
if (key === KEYS.BACKSPACE && self.$search.val() === '') {
|
| 1906 |
+
var $previousChoice = self.$searchContainer
|
| 1907 |
+
.prev('.toolset_select2-selection__choice');
|
| 1908 |
+
|
| 1909 |
+
if ($previousChoice.length > 0) {
|
| 1910 |
+
var item = $previousChoice.data('data');
|
| 1911 |
+
|
| 1912 |
+
self.searchRemoveChoice(item);
|
| 1913 |
+
|
| 1914 |
+
evt.preventDefault();
|
| 1915 |
+
}
|
| 1916 |
+
}
|
| 1917 |
+
});
|
| 1918 |
+
|
| 1919 |
+
// Try to detect the IE version should the `documentMode` property that
|
| 1920 |
+
// is stored on the document. This is only implemented in IE and is
|
| 1921 |
+
// slightly cleaner than doing a user agent check.
|
| 1922 |
+
// This property is not available in Edge, but Edge also doesn't have
|
| 1923 |
+
// this bug.
|
| 1924 |
+
var msie = document.documentMode;
|
| 1925 |
+
var disableInputEvents = msie && msie <= 11;
|
| 1926 |
+
|
| 1927 |
+
// Workaround for browsers which do not support the `input` event
|
| 1928 |
+
// This will prevent double-triggering of events for browsers which support
|
| 1929 |
+
// both the `keyup` and `input` events.
|
| 1930 |
+
this.$selection.on(
|
| 1931 |
+
'input.searchcheck',
|
| 1932 |
+
'.toolset_select2-search--inline',
|
| 1933 |
+
function (evt) {
|
| 1934 |
+
// IE will trigger the `input` event when a placeholder is used on a
|
| 1935 |
+
// search box. To get around this issue, we are forced to ignore all
|
| 1936 |
+
// `input` events in IE and keep using `keyup`.
|
| 1937 |
+
if (disableInputEvents) {
|
| 1938 |
+
self.$selection.off('input.search input.searchcheck');
|
| 1939 |
+
return;
|
| 1940 |
+
}
|
| 1941 |
+
|
| 1942 |
+
// Unbind the duplicated `keyup` event
|
| 1943 |
+
self.$selection.off('keyup.search');
|
| 1944 |
+
}
|
| 1945 |
+
);
|
| 1946 |
+
|
| 1947 |
+
this.$selection.on(
|
| 1948 |
+
'keyup.search input.search',
|
| 1949 |
+
'.toolset_select2-search--inline',
|
| 1950 |
+
function (evt) {
|
| 1951 |
+
// IE will trigger the `input` event when a placeholder is used on a
|
| 1952 |
+
// search box. To get around this issue, we are forced to ignore all
|
| 1953 |
+
// `input` events in IE and keep using `keyup`.
|
| 1954 |
+
if (disableInputEvents && evt.type === 'input') {
|
| 1955 |
+
self.$selection.off('input.search input.searchcheck');
|
| 1956 |
+
return;
|
| 1957 |
+
}
|
| 1958 |
+
|
| 1959 |
+
var key = evt.which;
|
| 1960 |
+
|
| 1961 |
+
// We can freely ignore events from modifier keys
|
| 1962 |
+
if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
|
| 1963 |
+
return;
|
| 1964 |
+
}
|
| 1965 |
+
|
| 1966 |
+
// Tabbing will be handled during the `keydown` phase
|
| 1967 |
+
if (key == KEYS.TAB) {
|
| 1968 |
+
return;
|
| 1969 |
+
}
|
| 1970 |
+
|
| 1971 |
+
self.handleSearch(evt);
|
| 1972 |
+
}
|
| 1973 |
+
);
|
| 1974 |
+
};
|
| 1975 |
+
|
| 1976 |
+
/**
|
| 1977 |
+
* This method will transfer the tabindex attribute from the rendered
|
| 1978 |
+
* selection to the search box. This allows for the search box to be used as
|
| 1979 |
+
* the primary focus instead of the selection container.
|
| 1980 |
+
*
|
| 1981 |
+
* @private
|
| 1982 |
+
*/
|
| 1983 |
+
Search.prototype._transferTabIndex = function (decorated) {
|
| 1984 |
+
this.$search.attr('tabindex', this.$selection.attr('tabindex'));
|
| 1985 |
+
this.$selection.attr('tabindex', '-1');
|
| 1986 |
+
};
|
| 1987 |
+
|
| 1988 |
+
Search.prototype.createPlaceholder = function (decorated, placeholder) {
|
| 1989 |
+
this.$search.attr('placeholder', placeholder.text);
|
| 1990 |
+
};
|
| 1991 |
+
|
| 1992 |
+
Search.prototype.update = function (decorated, data) {
|
| 1993 |
+
var searchHadFocus = this.$search[0] == document.activeElement;
|
| 1994 |
+
|
| 1995 |
+
this.$search.attr('placeholder', '');
|
| 1996 |
+
|
| 1997 |
+
decorated.call(this, data);
|
| 1998 |
+
|
| 1999 |
+
this.$selection.find('.toolset_select2-selection__rendered')
|
| 2000 |
+
.append(this.$searchContainer);
|
| 2001 |
+
|
| 2002 |
+
this.resizeSearch();
|
| 2003 |
+
if (searchHadFocus) {
|
| 2004 |
+
this.$search.focus();
|
| 2005 |
+
}
|
| 2006 |
+
};
|
| 2007 |
+
|
| 2008 |
+
Search.prototype.handleSearch = function () {
|
| 2009 |
+
this.resizeSearch();
|
| 2010 |
+
|
| 2011 |
+
if (!this._keyUpPrevented) {
|
| 2012 |
+
var input = this.$search.val();
|
| 2013 |
+
|
| 2014 |
+
this.trigger('query', {
|
| 2015 |
+
term: input
|
| 2016 |
+
});
|
| 2017 |
+
}
|
| 2018 |
+
|
| 2019 |
+
this._keyUpPrevented = false;
|
| 2020 |
+
};
|
| 2021 |
+
|
| 2022 |
+
Search.prototype.searchRemoveChoice = function (decorated, item) {
|
| 2023 |
+
this.trigger('unselect', {
|
| 2024 |
+
data: item
|
| 2025 |
+
});
|
| 2026 |
+
|
| 2027 |
+
this.$search.val(item.text);
|
| 2028 |
+
this.handleSearch();
|
| 2029 |
+
};
|
| 2030 |
+
|
| 2031 |
+
Search.prototype.resizeSearch = function () {
|
| 2032 |
+
this.$search.css('width', '25px');
|
| 2033 |
+
|
| 2034 |
+
var width = '';
|
| 2035 |
+
|
| 2036 |
+
if (this.$search.attr('placeholder') !== '') {
|
| 2037 |
+
width = this.$selection.find('.toolset_select2-selection__rendered').innerWidth();
|
| 2038 |
+
} else {
|
| 2039 |
+
var minimumWidth = this.$search.val().length + 1;
|
| 2040 |
+
|
| 2041 |
+
width = (minimumWidth * 0.75) + 'em';
|
| 2042 |
+
}
|
| 2043 |
+
|
| 2044 |
+
this.$search.css('width', width);
|
| 2045 |
+
};
|
| 2046 |
+
|
| 2047 |
+
return Search;
|
| 2048 |
+
});
|
| 2049 |
+
|
| 2050 |
+
Toolset_S2.define('toolset_select2/selection/eventRelay',[
|
| 2051 |
+
'jquery'
|
| 2052 |
+
], function ($) {
|
| 2053 |
+
function EventRelay () { }
|
| 2054 |
+
|
| 2055 |
+
EventRelay.prototype.bind = function (decorated, container, $container) {
|
| 2056 |
+
var self = this;
|
| 2057 |
+
var relayEvents = [
|
| 2058 |
+
'open', 'opening',
|
| 2059 |
+
'close', 'closing',
|
| 2060 |
+
'select', 'selecting',
|
| 2061 |
+
'unselect', 'unselecting'
|
| 2062 |
+
];
|
| 2063 |
+
|
| 2064 |
+
var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
|
| 2065 |
+
|
| 2066 |
+
decorated.call(this, container, $container);
|
| 2067 |
+
|
| 2068 |
+
container.on('*', function (name, params) {
|
| 2069 |
+
// Ignore events that should not be relayed
|
| 2070 |
+
if ($.inArray(name, relayEvents) === -1) {
|
| 2071 |
+
return;
|
| 2072 |
+
}
|
| 2073 |
+
|
| 2074 |
+
// The parameters should always be an object
|
| 2075 |
+
params = params || {};
|
| 2076 |
+
|
| 2077 |
+
// Generate the jQuery event for the Select2 event
|
| 2078 |
+
var evt = $.Event('toolset_select2:' + name, {
|
| 2079 |
+
params: params
|
| 2080 |
+
});
|
| 2081 |
+
|
| 2082 |
+
self.$element.trigger(evt);
|
| 2083 |
+
|
| 2084 |
+
// Only handle preventable events if it was one
|
| 2085 |
+
if ($.inArray(name, preventableEvents) === -1) {
|
| 2086 |
+
return;
|
| 2087 |
+
}
|
| 2088 |
+
|
| 2089 |
+
params.prevented = evt.isDefaultPrevented();
|
| 2090 |
+
});
|
| 2091 |
+
};
|
| 2092 |
+
|
| 2093 |
+
return EventRelay;
|
| 2094 |
+
});
|
| 2095 |
+
|
| 2096 |
+
Toolset_S2.define('toolset_select2/translation',[
|
| 2097 |
+
'jquery',
|
| 2098 |
+
'require'
|
| 2099 |
+
], function ($, require) {
|
| 2100 |
+
function Translation (dict) {
|
| 2101 |
+
this.dict = dict || {};
|
| 2102 |
+
}
|
| 2103 |
+
|
| 2104 |
+
Translation.prototype.all = function () {
|
| 2105 |
+
return this.dict;
|
| 2106 |
+
};
|
| 2107 |
+
|
| 2108 |
+
Translation.prototype.get = function (key) {
|
| 2109 |
+
return this.dict[key];
|
| 2110 |
+
};
|
| 2111 |
+
|
| 2112 |
+
Translation.prototype.extend = function (translation) {
|
| 2113 |
+
this.dict = $.extend({}, translation.all(), this.dict);
|
| 2114 |
+
};
|
| 2115 |
+
|
| 2116 |
+
// Static functions
|
| 2117 |
+
|
| 2118 |
+
Translation._cache = {};
|
| 2119 |
+
|
| 2120 |
+
Translation.loadPath = function (path) {
|
| 2121 |
+
if (!(path in Translation._cache)) {
|
| 2122 |
+
var translations = require(path);
|
| 2123 |
+
|
| 2124 |
+
Translation._cache[path] = translations;
|
| 2125 |
+
}
|
| 2126 |
+
|
| 2127 |
+
return new Translation(Translation._cache[path]);
|
| 2128 |
+
};
|
| 2129 |
+
|
| 2130 |
+
return Translation;
|
| 2131 |
+
});
|
| 2132 |
+
|
| 2133 |
+
Toolset_S2.define('toolset_select2/diacritics',[
|
| 2134 |
+
|
| 2135 |
+
], function () {
|
| 2136 |
+
var diacritics = {
|
| 2137 |
+
'\u24B6': 'A',
|
| 2138 |
+
'\uFF21': 'A',
|
| 2139 |
+
'\u00C0': 'A',
|
| 2140 |
+
'\u00C1': 'A',
|
| 2141 |
+
'\u00C2': 'A',
|
| 2142 |
+
'\u1EA6': 'A',
|
| 2143 |
+
'\u1EA4': 'A',
|
| 2144 |
+
'\u1EAA': 'A',
|
| 2145 |
+
'\u1EA8': 'A',
|
| 2146 |
+
'\u00C3': 'A',
|
| 2147 |
+
'\u0100': 'A',
|
| 2148 |
+
'\u0102': 'A',
|
| 2149 |
+
'\u1EB0': 'A',
|
| 2150 |
+
'\u1EAE': 'A',
|
| 2151 |
+
'\u1EB4': 'A',
|
| 2152 |
+
'\u1EB2': 'A',
|
| 2153 |
+
'\u0226': 'A',
|
| 2154 |
+
'\u01E0': 'A',
|
| 2155 |
+
'\u00C4': 'A',
|
| 2156 |
+
'\u01DE': 'A',
|
| 2157 |
+
'\u1EA2': 'A',
|
| 2158 |
+
'\u00C5': 'A',
|
| 2159 |
+
'\u01FA': 'A',
|
| 2160 |
+
'\u01CD': 'A',
|
| 2161 |
+
'\u0200': 'A',
|
| 2162 |
+
'\u0202': 'A',
|
| 2163 |
+
'\u1EA0': 'A',
|
| 2164 |
+
'\u1EAC': 'A',
|
| 2165 |
+
'\u1EB6': 'A',
|
| 2166 |
+
'\u1E00': 'A',
|
| 2167 |
+
'\u0104': 'A',
|
| 2168 |
+
'\u023A': 'A',
|
| 2169 |
+
'\u2C6F': 'A',
|
| 2170 |
+
'\uA732': 'AA',
|
| 2171 |
+
'\u00C6': 'AE',
|
| 2172 |
+
'\u01FC': 'AE',
|
| 2173 |
+
'\u01E2': 'AE',
|
| 2174 |
+
'\uA734': 'AO',
|
| 2175 |
+
'\uA736': 'AU',
|
| 2176 |
+
'\uA738': 'AV',
|
| 2177 |
+
'\uA73A': 'AV',
|
| 2178 |
+
'\uA73C': 'AY',
|
| 2179 |
+
'\u24B7': 'B',
|
| 2180 |
+
'\uFF22': 'B',
|
| 2181 |
+
'\u1E02': 'B',
|
| 2182 |
+
'\u1E04': 'B',
|
| 2183 |
+
'\u1E06': 'B',
|
| 2184 |
+
'\u0243': 'B',
|
| 2185 |
+
'\u0182': 'B',
|
| 2186 |
+
'\u0181': 'B',
|
| 2187 |
+
'\u24B8': 'C',
|
| 2188 |
+
'\uFF23': 'C',
|
| 2189 |
+
'\u0106': 'C',
|
| 2190 |
+
'\u0108': 'C',
|
| 2191 |
+
'\u010A': 'C',
|
| 2192 |
+
'\u010C': 'C',
|
| 2193 |
+
'\u00C7': 'C',
|
| 2194 |
+
'\u1E08': 'C',
|
| 2195 |
+
'\u0187': 'C',
|
| 2196 |
+
'\u023B': 'C',
|
| 2197 |
+
'\uA73E': 'C',
|
| 2198 |
+
'\u24B9': 'D',
|
| 2199 |
+
'\uFF24': 'D',
|
| 2200 |
+
'\u1E0A': 'D',
|
| 2201 |
+
'\u010E': 'D',
|
| 2202 |
+
'\u1E0C': 'D',
|
| 2203 |
+
'\u1E10': 'D',
|
| 2204 |
+
'\u1E12': 'D',
|
| 2205 |
+
'\u1E0E': 'D',
|
| 2206 |
+
'\u0110': 'D',
|
| 2207 |
+
'\u018B': 'D',
|
| 2208 |
+
'\u018A': 'D',
|
| 2209 |
+
'\u0189': 'D',
|
| 2210 |
+
'\uA779': 'D',
|
| 2211 |
+
'\u01F1': 'DZ',
|
| 2212 |
+
'\u01C4': 'DZ',
|
| 2213 |
+
'\u01F2': 'Dz',
|
| 2214 |
+
'\u01C5': 'Dz',
|
| 2215 |
+
'\u24BA': 'E',
|
| 2216 |
+
'\uFF25': 'E',
|
| 2217 |
+
'\u00C8': 'E',
|
| 2218 |
+
'\u00C9': 'E',
|
| 2219 |
+
'\u00CA': 'E',
|
| 2220 |
+
'\u1EC0': 'E',
|
| 2221 |
+
'\u1EBE': 'E',
|
| 2222 |
+
'\u1EC4': 'E',
|
| 2223 |
+
'\u1EC2': 'E',
|
| 2224 |
+
'\u1EBC': 'E',
|
| 2225 |
+
'\u0112': 'E',
|
| 2226 |
+
'\u1E14': 'E',
|
| 2227 |
+
'\u1E16': 'E',
|
| 2228 |
+
'\u0114': 'E',
|
| 2229 |
+
'\u0116': 'E',
|
| 2230 |
+
'\u00CB': 'E',
|
| 2231 |
+
'\u1EBA': 'E',
|
| 2232 |
+
'\u011A': 'E',
|
| 2233 |
+
'\u0204': 'E',
|
| 2234 |
+
'\u0206': 'E',
|
| 2235 |
+
'\u1EB8': 'E',
|
| 2236 |
+
'\u1EC6': 'E',
|
| 2237 |
+
'\u0228': 'E',
|
| 2238 |
+
'\u1E1C': 'E',
|
| 2239 |
+
'\u0118': 'E',
|
| 2240 |
+
'\u1E18': 'E',
|
| 2241 |
+
'\u1E1A': 'E',
|
| 2242 |
+
'\u0190': 'E',
|
| 2243 |
+
'\u018E': 'E',
|
| 2244 |
+
'\u24BB': 'F',
|
| 2245 |
+
'\uFF26': 'F',
|
| 2246 |
+
'\u1E1E': 'F',
|
| 2247 |
+
'\u0191': 'F',
|
| 2248 |
+
'\uA77B': 'F',
|
| 2249 |
+
'\u24BC': 'G',
|
| 2250 |
+
'\uFF27': 'G',
|
| 2251 |
+
'\u01F4': 'G',
|
| 2252 |
+
'\u011C': 'G',
|
| 2253 |
+
'\u1E20': 'G',
|
| 2254 |
+
'\u011E': 'G',
|
| 2255 |
+
'\u0120': 'G',
|
| 2256 |
+
'\u01E6': 'G',
|
| 2257 |
+
'\u0122': 'G',
|
| 2258 |
+
'\u01E4': 'G',
|
| 2259 |
+
'\u0193': 'G',
|
| 2260 |
+
'\uA7A0': 'G',
|
| 2261 |
+
'\uA77D': 'G',
|
| 2262 |
+
'\uA77E': 'G',
|
| 2263 |
+
'\u24BD': 'H',
|
| 2264 |
+
'\uFF28': 'H',
|
| 2265 |
+
'\u0124': 'H',
|
| 2266 |
+
'\u1E22': 'H',
|
| 2267 |
+
'\u1E26': 'H',
|
| 2268 |
+
'\u021E': 'H',
|
| 2269 |
+
'\u1E24': 'H',
|
| 2270 |
+
'\u1E28': 'H',
|
| 2271 |
+
'\u1E2A': 'H',
|
| 2272 |
+
'\u0126': 'H',
|
| 2273 |
+
'\u2C67': 'H',
|
| 2274 |
+
'\u2C75': 'H',
|
| 2275 |
+
'\uA78D': 'H',
|
| 2276 |
+
'\u24BE': 'I',
|
| 2277 |
+
'\uFF29': 'I',
|
| 2278 |
+
'\u00CC': 'I',
|
| 2279 |
+
'\u00CD': 'I',
|
| 2280 |
+
'\u00CE': 'I',
|
| 2281 |
+
'\u0128': 'I',
|
| 2282 |
+
'\u012A': 'I',
|
| 2283 |
+
'\u012C': 'I',
|
| 2284 |
+
'\u0130': 'I',
|
| 2285 |
+
'\u00CF': 'I',
|
| 2286 |
+
'\u1E2E': 'I',
|
| 2287 |
+
'\u1EC8': 'I',
|
| 2288 |
+
'\u01CF': 'I',
|
| 2289 |
+
'\u0208': 'I',
|
| 2290 |
+
'\u020A': 'I',
|
| 2291 |
+
'\u1ECA': 'I',
|
| 2292 |
+
'\u012E': 'I',
|
| 2293 |
+
'\u1E2C': 'I',
|
| 2294 |
+
'\u0197': 'I',
|
| 2295 |
+
'\u24BF': 'J',
|
| 2296 |
+
'\uFF2A': 'J',
|
| 2297 |
+
'\u0134': 'J',
|
| 2298 |
+
'\u0248': 'J',
|
| 2299 |
+
'\u24C0': 'K',
|
| 2300 |
+
'\uFF2B': 'K',
|
| 2301 |
+
'\u1E30': 'K',
|
| 2302 |
+
'\u01E8': 'K',
|
| 2303 |
+
'\u1E32': 'K',
|
| 2304 |
+
'\u0136': 'K',
|
| 2305 |
+
'\u1E34': 'K',
|
| 2306 |
+
'\u0198': 'K',
|
| 2307 |
+
'\u2C69': 'K',
|
| 2308 |
+
'\uA740': 'K',
|
| 2309 |
+
'\uA742': 'K',
|
| 2310 |
+
'\uA744': 'K',
|
| 2311 |
+
'\uA7A2': 'K',
|
| 2312 |
+
'\u24C1': 'L',
|
| 2313 |
+
'\uFF2C': 'L',
|
| 2314 |
+
'\u013F': 'L',
|
| 2315 |
+
'\u0139': 'L',
|
| 2316 |
+
'\u013D': 'L',
|
| 2317 |
+
'\u1E36': 'L',
|
| 2318 |
+
'\u1E38': 'L',
|
| 2319 |
+
'\u013B': 'L',
|
| 2320 |
+
'\u1E3C': 'L',
|
| 2321 |
+
'\u1E3A': 'L',
|
| 2322 |
+
'\u0141': 'L',
|
| 2323 |
+
'\u023D': 'L',
|
| 2324 |
+
'\u2C62': 'L',
|
| 2325 |
+
'\u2C60': 'L',
|
| 2326 |
+
'\uA748': 'L',
|
| 2327 |
+
'\uA746': 'L',
|
| 2328 |
+
'\uA780': 'L',
|
| 2329 |
+
'\u01C7': 'LJ',
|
| 2330 |
+
'\u01C8': 'Lj',
|
| 2331 |
+
'\u24C2': 'M',
|
| 2332 |
+
'\uFF2D': 'M',
|
| 2333 |
+
'\u1E3E': 'M',
|
| 2334 |
+
'\u1E40': 'M',
|
| 2335 |
+
'\u1E42': 'M',
|
| 2336 |
+
'\u2C6E': 'M',
|
| 2337 |
+
'\u019C': 'M',
|
| 2338 |
+
'\u24C3': 'N',
|
| 2339 |
+
'\uFF2E': 'N',
|
| 2340 |
+
'\u01F8': 'N',
|
| 2341 |
+
'\u0143': 'N',
|
| 2342 |
+
'\u00D1': 'N',
|
| 2343 |
+
'\u1E44': 'N',
|
| 2344 |
+
'\u0147': 'N',
|
| 2345 |
+
'\u1E46': 'N',
|
| 2346 |
+
'\u0145': 'N',
|
| 2347 |
+
'\u1E4A': 'N',
|
| 2348 |
+
'\u1E48': 'N',
|
| 2349 |
+
'\u0220': 'N',
|
| 2350 |
+
'\u019D': 'N',
|
| 2351 |
+
'\uA790': 'N',
|
| 2352 |
+
'\uA7A4': 'N',
|
| 2353 |
+
'\u01CA': 'NJ',
|
| 2354 |
+
'\u01CB': 'Nj',
|
| 2355 |
+
'\u24C4': 'O',
|
| 2356 |
+
'\uFF2F': 'O',
|
| 2357 |
+
'\u00D2': 'O',
|
| 2358 |
+
'\u00D3': 'O',
|
| 2359 |
+
'\u00D4': 'O',
|
| 2360 |
+
'\u1ED2': 'O',
|
| 2361 |
+
'\u1ED0': 'O',
|
| 2362 |
+
'\u1ED6': 'O',
|
| 2363 |
+
'\u1ED4': 'O',
|
| 2364 |
+
'\u00D5': 'O',
|
| 2365 |
+
'\u1E4C': 'O',
|
| 2366 |
+
'\u022C': 'O',
|
| 2367 |
+
'\u1E4E': 'O',
|
| 2368 |
+
'\u014C': 'O',
|
| 2369 |
+
'\u1E50': 'O',
|
| 2370 |
+
'\u1E52': 'O',
|
| 2371 |
+
'\u014E': 'O',
|
| 2372 |
+
'\u022E': 'O',
|
| 2373 |
+
'\u0230': 'O',
|
| 2374 |
+
'\u00D6': 'O',
|
| 2375 |
+
'\u022A': 'O',
|
| 2376 |
+
'\u1ECE': 'O',
|
| 2377 |
+
'\u0150': 'O',
|
| 2378 |
+
'\u01D1': 'O',
|
| 2379 |
+
'\u020C': 'O',
|
| 2380 |
+
'\u020E': 'O',
|
| 2381 |
+
'\u01A0': 'O',
|
| 2382 |
+
'\u1EDC': 'O',
|
| 2383 |
+
'\u1EDA': 'O',
|
| 2384 |
+
'\u1EE0': 'O',
|
| 2385 |
+
'\u1EDE': 'O',
|
| 2386 |
+
'\u1EE2': 'O',
|
| 2387 |
+
'\u1ECC': 'O',
|
| 2388 |
+
'\u1ED8': 'O',
|
| 2389 |
+
'\u01EA': 'O',
|
| 2390 |
+
'\u01EC': 'O',
|
| 2391 |
+
'\u00D8': 'O',
|
| 2392 |
+
'\u01FE': 'O',
|
| 2393 |
+
'\u0186': 'O',
|
| 2394 |
+
'\u019F': 'O',
|
| 2395 |
+
'\uA74A': 'O',
|
| 2396 |
+
'\uA74C': 'O',
|
| 2397 |
+
'\u01A2': 'OI',
|
| 2398 |
+
'\uA74E': 'OO',
|
| 2399 |
+
'\u0222': 'OU',
|
| 2400 |
+
'\u24C5': 'P',
|
| 2401 |
+
'\uFF30': 'P',
|
| 2402 |
+
'\u1E54': 'P',
|
| 2403 |
+
'\u1E56': 'P',
|
| 2404 |
+
'\u01A4': 'P',
|
| 2405 |
+
'\u2C63': 'P',
|
| 2406 |
+
'\uA750': 'P',
|
| 2407 |
+
'\uA752': 'P',
|
| 2408 |
+
'\uA754': 'P',
|
| 2409 |
+
'\u24C6': 'Q',
|
| 2410 |
+
'\uFF31': 'Q',
|
| 2411 |
+
'\uA756': 'Q',
|
| 2412 |
+
'\uA758': 'Q',
|
| 2413 |
+
'\u024A': 'Q',
|
| 2414 |
+
'\u24C7': 'R',
|
| 2415 |
+
'\uFF32': 'R',
|
| 2416 |
+
'\u0154': 'R',
|
| 2417 |
+
'\u1E58': 'R',
|
| 2418 |
+
'\u0158': 'R',
|
| 2419 |
+
'\u0210': 'R',
|
| 2420 |
+
'\u0212': 'R',
|
| 2421 |
+
'\u1E5A': 'R',
|
| 2422 |
+
'\u1E5C': 'R',
|
| 2423 |
+
'\u0156': 'R',
|
| 2424 |
+
'\u1E5E': 'R',
|
| 2425 |
+
'\u024C': 'R',
|
| 2426 |
+
'\u2C64': 'R',
|
| 2427 |
+
'\uA75A': 'R',
|
| 2428 |
+
'\uA7A6': 'R',
|
| 2429 |
+
'\uA782': 'R',
|
| 2430 |
+
'\u24C8': 'S',
|
| 2431 |
+
'\uFF33': 'S',
|
| 2432 |
+
'\u1E9E': 'S',
|
| 2433 |
+
'\u015A': 'S',
|
| 2434 |
+
'\u1E64': 'S',
|
| 2435 |
+
'\u015C': 'S',
|
| 2436 |
+
'\u1E60': 'S',
|
| 2437 |
+
'\u0160': 'S',
|
| 2438 |
+
'\u1E66': 'S',
|
| 2439 |
+
'\u1E62': 'S',
|
| 2440 |
+
'\u1E68': 'S',
|
| 2441 |
+
'\u0218': 'S',
|
| 2442 |
+
'\u015E': 'S',
|
| 2443 |
+
'\u2C7E': 'S',
|
| 2444 |
+
'\uA7A8': 'S',
|
| 2445 |
+
'\uA784': 'S',
|
| 2446 |
+
'\u24C9': 'T',
|
| 2447 |
+
'\uFF34': 'T',
|
| 2448 |
+
'\u1E6A': 'T',
|
| 2449 |
+
'\u0164': 'T',
|
| 2450 |
+
'\u1E6C': 'T',
|
| 2451 |
+
'\u021A': 'T',
|
| 2452 |
+
'\u0162': 'T',
|
| 2453 |
+
'\u1E70': 'T',
|
| 2454 |
+
'\u1E6E': 'T',
|
| 2455 |
+
'\u0166': 'T',
|
| 2456 |
+
'\u01AC': 'T',
|
| 2457 |
+
'\u01AE': 'T',
|
| 2458 |
+
'\u023E': 'T',
|
| 2459 |
+
'\uA786': 'T',
|
| 2460 |
+
'\uA728': 'TZ',
|
| 2461 |
+
'\u24CA': 'U',
|
| 2462 |
+
'\uFF35': 'U',
|
| 2463 |
+
'\u00D9': 'U',
|
| 2464 |
+
'\u00DA': 'U',
|
| 2465 |
+
'\u00DB': 'U',
|
| 2466 |
+
'\u0168': 'U',
|
| 2467 |
+
'\u1E78': 'U',
|
| 2468 |
+
'\u016A': 'U',
|
| 2469 |
+
'\u1E7A': 'U',
|
| 2470 |
+
'\u016C': 'U',
|
| 2471 |
+
'\u00DC': 'U',
|
| 2472 |
+
'\u01DB': 'U',
|
| 2473 |
+
'\u01D7': 'U',
|
| 2474 |
+
'\u01D5': 'U',
|
| 2475 |
+
'\u01D9': 'U',
|
| 2476 |
+
'\u1EE6': 'U',
|
| 2477 |
+
'\u016E': 'U',
|
| 2478 |
+
'\u0170': 'U',
|
| 2479 |
+
'\u01D3': 'U',
|
| 2480 |
+
'\u0214': 'U',
|
| 2481 |
+
'\u0216': 'U',
|
| 2482 |
+
'\u01AF': 'U',
|
| 2483 |
+
'\u1EEA': 'U',
|
| 2484 |
+
'\u1EE8': 'U',
|
| 2485 |
+
'\u1EEE': 'U',
|
| 2486 |
+
'\u1EEC': 'U',
|
| 2487 |
+
'\u1EF0': 'U',
|
| 2488 |
+
'\u1EE4': 'U',
|
| 2489 |
+
'\u1E72': 'U',
|
| 2490 |
+
'\u0172': 'U',
|
| 2491 |
+
'\u1E76': 'U',
|
| 2492 |
+
'\u1E74': 'U',
|
| 2493 |
+
'\u0244': 'U',
|
| 2494 |
+
'\u24CB': 'V',
|
| 2495 |
+
'\uFF36': 'V',
|
| 2496 |
+
'\u1E7C': 'V',
|
| 2497 |
+
'\u1E7E': 'V',
|
| 2498 |
+
'\u01B2': 'V',
|
| 2499 |
+
'\uA75E': 'V',
|
| 2500 |
+
'\u0245': 'V',
|
| 2501 |
+
'\uA760': 'VY',
|
| 2502 |
+
'\u24CC': 'W',
|
| 2503 |
+
'\uFF37': 'W',
|
| 2504 |
+
'\u1E80': 'W',
|
| 2505 |
+
'\u1E82': 'W',
|
| 2506 |
+
'\u0174': 'W',
|
| 2507 |
+
'\u1E86': 'W',
|
| 2508 |
+
'\u1E84': 'W',
|
| 2509 |
+
'\u1E88': 'W',
|
| 2510 |
+
'\u2C72': 'W',
|
| 2511 |
+
'\u24CD': 'X',
|
| 2512 |
+
'\uFF38': 'X',
|
| 2513 |
+
'\u1E8A': 'X',
|
| 2514 |
+
'\u1E8C': 'X',
|
| 2515 |
+
'\u24CE': 'Y',
|
| 2516 |
+
'\uFF39': 'Y',
|
| 2517 |
+
'\u1EF2': 'Y',
|
| 2518 |
+
'\u00DD': 'Y',
|
| 2519 |
+
'\u0176': 'Y',
|
| 2520 |
+
'\u1EF8': 'Y',
|
| 2521 |
+
'\u0232': 'Y',
|
| 2522 |
+
'\u1E8E': 'Y',
|
| 2523 |
+
'\u0178': 'Y',
|
| 2524 |
+
'\u1EF6': 'Y',
|
| 2525 |
+
'\u1EF4': 'Y',
|
| 2526 |
+
'\u01B3': 'Y',
|
| 2527 |
+
'\u024E': 'Y',
|
| 2528 |
+
'\u1EFE': 'Y',
|
| 2529 |
+
'\u24CF': 'Z',
|
| 2530 |
+
'\uFF3A': 'Z',
|
| 2531 |
+
'\u0179': 'Z',
|
| 2532 |
+
'\u1E90': 'Z',
|
| 2533 |
+
'\u017B': 'Z',
|
| 2534 |
+
'\u017D': 'Z',
|
| 2535 |
+
'\u1E92': 'Z',
|
| 2536 |
+
'\u1E94': 'Z',
|
| 2537 |
+
'\u01B5': 'Z',
|
| 2538 |
+
'\u0224': 'Z',
|
| 2539 |
+
'\u2C7F': 'Z',
|
| 2540 |
+
'\u2C6B': 'Z',
|
| 2541 |
+
'\uA762': 'Z',
|
| 2542 |
+
'\u24D0': 'a',
|
| 2543 |
+
'\uFF41': 'a',
|
| 2544 |
+
'\u1E9A': 'a',
|
| 2545 |
+
'\u00E0': 'a',
|
| 2546 |
+
'\u00E1': 'a',
|
| 2547 |
+
'\u00E2': 'a',
|
| 2548 |
+
'\u1EA7': 'a',
|
| 2549 |
+
'\u1EA5': 'a',
|
| 2550 |
+
'\u1EAB': 'a',
|
| 2551 |
+
'\u1EA9': 'a',
|
| 2552 |
+
'\u00E3': 'a',
|
| 2553 |
+
'\u0101': 'a',
|
| 2554 |
+
'\u0103': 'a',
|
| 2555 |
+
'\u1EB1': 'a',
|
| 2556 |
+
'\u1EAF': 'a',
|
| 2557 |
+
'\u1EB5': 'a',
|
| 2558 |
+
'\u1EB3': 'a',
|
| 2559 |
+
'\u0227': 'a',
|
| 2560 |
+
'\u01E1': 'a',
|
| 2561 |
+
'\u00E4': 'a',
|
| 2562 |
+
'\u01DF': 'a',
|
| 2563 |
+
'\u1EA3': 'a',
|
| 2564 |
+
'\u00E5': 'a',
|
| 2565 |
+
'\u01FB': 'a',
|
| 2566 |
+
'\u01CE': 'a',
|
| 2567 |
+
'\u0201': 'a',
|
| 2568 |
+
'\u0203': 'a',
|
| 2569 |
+
'\u1EA1': 'a',
|
| 2570 |
+
'\u1EAD': 'a',
|
| 2571 |
+
'\u1EB7': 'a',
|
| 2572 |
+
'\u1E01': 'a',
|
| 2573 |
+
'\u0105': 'a',
|
| 2574 |
+
'\u2C65': 'a',
|
| 2575 |
+
'\u0250': 'a',
|
| 2576 |
+
'\uA733': 'aa',
|
| 2577 |
+
'\u00E6': 'ae',
|
| 2578 |
+
'\u01FD': 'ae',
|
| 2579 |
+
'\u01E3': 'ae',
|
| 2580 |
+
'\uA735': 'ao',
|
| 2581 |
+
'\uA737': 'au',
|
| 2582 |
+
'\uA739': 'av',
|
| 2583 |
+
'\uA73B': 'av',
|
| 2584 |
+
'\uA73D': 'ay',
|
| 2585 |
+
'\u24D1': 'b',
|
| 2586 |
+
'\uFF42': 'b',
|
| 2587 |
+
'\u1E03': 'b',
|
| 2588 |
+
'\u1E05': 'b',
|
| 2589 |
+
'\u1E07': 'b',
|
| 2590 |
+
'\u0180': 'b',
|
| 2591 |
+
'\u0183': 'b',
|
| 2592 |
+
'\u0253': 'b',
|
| 2593 |
+
'\u24D2': 'c',
|
| 2594 |
+
'\uFF43': 'c',
|
| 2595 |
+
'\u0107': 'c',
|
| 2596 |
+
'\u0109': 'c',
|
| 2597 |
+
'\u010B': 'c',
|
| 2598 |
+
'\u010D': 'c',
|
| 2599 |
+
'\u00E7': 'c',
|
| 2600 |
+
'\u1E09': 'c',
|
| 2601 |
+
'\u0188': 'c',
|
| 2602 |
+
'\u023C': 'c',
|
| 2603 |
+
'\uA73F': 'c',
|
| 2604 |
+
'\u2184': 'c',
|
| 2605 |
+
'\u24D3': 'd',
|
| 2606 |
+
'\uFF44': 'd',
|
| 2607 |
+
'\u1E0B': 'd',
|
| 2608 |
+
'\u010F': 'd',
|
| 2609 |
+
'\u1E0D': 'd',
|
| 2610 |
+
'\u1E11': 'd',
|
| 2611 |
+
'\u1E13': 'd',
|
| 2612 |
+
'\u1E0F': 'd',
|
| 2613 |
+
'\u0111': 'd',
|
| 2614 |
+
'\u018C': 'd',
|
| 2615 |
+
'\u0256': 'd',
|
| 2616 |
+
'\u0257': 'd',
|
| 2617 |
+
'\uA77A': 'd',
|
| 2618 |
+
'\u01F3': 'dz',
|
| 2619 |
+
'\u01C6': 'dz',
|
| 2620 |
+
'\u24D4': 'e',
|
| 2621 |
+
'\uFF45': 'e',
|
| 2622 |
+
'\u00E8': 'e',
|
| 2623 |
+
'\u00E9': 'e',
|
| 2624 |
+
'\u00EA': 'e',
|
| 2625 |
+
'\u1EC1': 'e',
|
| 2626 |
+
'\u1EBF': 'e',
|
| 2627 |
+
'\u1EC5': 'e',
|
| 2628 |
+
'\u1EC3': 'e',
|
| 2629 |
+
'\u1EBD': 'e',
|
| 2630 |
+
'\u0113': 'e',
|
| 2631 |
+
'\u1E15': 'e',
|
| 2632 |
+
'\u1E17': 'e',
|
| 2633 |
+
'\u0115': 'e',
|
| 2634 |
+
'\u0117': 'e',
|
| 2635 |
+
'\u00EB': 'e',
|
| 2636 |
+
'\u1EBB': 'e',
|
| 2637 |
+
'\u011B': 'e',
|
| 2638 |
+
'\u0205': 'e',
|
| 2639 |
+
'\u0207': 'e',
|
| 2640 |
+
'\u1EB9': 'e',
|
| 2641 |
+
'\u1EC7': 'e',
|
| 2642 |
+
'\u0229': 'e',
|
| 2643 |
+
'\u1E1D': 'e',
|
| 2644 |
+
'\u0119': 'e',
|
| 2645 |
+
'\u1E19': 'e',
|
| 2646 |
+
'\u1E1B': 'e',
|
| 2647 |
+
'\u0247': 'e',
|
| 2648 |
+
'\u025B': 'e',
|
| 2649 |
+
'\u01DD': 'e',
|
| 2650 |
+
'\u24D5': 'f',
|
| 2651 |
+
'\uFF46': 'f',
|
| 2652 |
+
'\u1E1F': 'f',
|
| 2653 |
+
'\u0192': 'f',
|
| 2654 |
+
'\uA77C': 'f',
|
| 2655 |
+
'\u24D6': 'g',
|
| 2656 |
+
'\uFF47': 'g',
|
| 2657 |
+
'\u01F5': 'g',
|
| 2658 |
+
'\u011D': 'g',
|
| 2659 |
+
'\u1E21': 'g',
|
| 2660 |
+
'\u011F': 'g',
|
| 2661 |
+
'\u0121': 'g',
|
| 2662 |
+
'\u01E7': 'g',
|
| 2663 |
+
'\u0123': 'g',
|
| 2664 |
+
'\u01E5': 'g',
|
| 2665 |
+
'\u0260': 'g',
|
| 2666 |
+
'\uA7A1': 'g',
|
| 2667 |
+
'\u1D79': 'g',
|
| 2668 |
+
'\uA77F': 'g',
|
| 2669 |
+
'\u24D7': 'h',
|
| 2670 |
+
'\uFF48': 'h',
|
| 2671 |
+
'\u0125': 'h',
|
| 2672 |
+
'\u1E23': 'h',
|
| 2673 |
+
'\u1E27': 'h',
|
| 2674 |
+
'\u021F': 'h',
|
| 2675 |
+
'\u1E25': 'h',
|
| 2676 |
+
'\u1E29': 'h',
|
| 2677 |
+
'\u1E2B': 'h',
|
| 2678 |
+
'\u1E96': 'h',
|
| 2679 |
+
'\u0127': 'h',
|
| 2680 |
+
'\u2C68': 'h',
|
| 2681 |
+
'\u2C76': 'h',
|
| 2682 |
+
'\u0265': 'h',
|
| 2683 |
+
'\u0195': 'hv',
|
| 2684 |
+
'\u24D8': 'i',
|
| 2685 |
+
'\uFF49': 'i',
|
| 2686 |
+
'\u00EC': 'i',
|
| 2687 |
+
'\u00ED': 'i',
|
| 2688 |
+
'\u00EE': 'i',
|
| 2689 |
+
'\u0129': 'i',
|
| 2690 |
+
'\u012B': 'i',
|
| 2691 |
+
'\u012D': 'i',
|
| 2692 |
+
'\u00EF': 'i',
|
| 2693 |
+
'\u1E2F': 'i',
|
| 2694 |
+
'\u1EC9': 'i',
|
| 2695 |
+
'\u01D0': 'i',
|
| 2696 |
+
'\u0209': 'i',
|
| 2697 |
+
'\u020B': 'i',
|
| 2698 |
+
'\u1ECB': 'i',
|
| 2699 |
+
'\u012F': 'i',
|
| 2700 |
+
'\u1E2D': 'i',
|
| 2701 |
+
'\u0268': 'i',
|
| 2702 |
+
'\u0131': 'i',
|
| 2703 |
+
'\u24D9': 'j',
|
| 2704 |
+
'\uFF4A': 'j',
|
| 2705 |
+
'\u0135': 'j',
|
| 2706 |
+
'\u01F0': 'j',
|
| 2707 |
+
'\u0249': 'j',
|
| 2708 |
+
'\u24DA': 'k',
|
| 2709 |
+
'\uFF4B': 'k',
|
| 2710 |
+
'\u1E31': 'k',
|
| 2711 |
+
'\u01E9': 'k',
|
| 2712 |
+
'\u1E33': 'k',
|
| 2713 |
+
'\u0137': 'k',
|
| 2714 |
+
'\u1E35': 'k',
|
| 2715 |
+
'\u0199': 'k',
|
| 2716 |
+
'\u2C6A': 'k',
|
| 2717 |
+
'\uA741': 'k',
|
| 2718 |
+
'\uA743': 'k',
|
| 2719 |
+
'\uA745': 'k',
|
| 2720 |
+
'\uA7A3': 'k',
|
| 2721 |
+
'\u24DB': 'l',
|
| 2722 |
+
'\uFF4C': 'l',
|
| 2723 |
+
'\u0140': 'l',
|
| 2724 |
+
'\u013A': 'l',
|
| 2725 |
+
'\u013E': 'l',
|
| 2726 |
+
'\u1E37': 'l',
|
| 2727 |
+
'\u1E39': 'l',
|
| 2728 |
+
'\u013C': 'l',
|
| 2729 |
+
'\u1E3D': 'l',
|
| 2730 |
+
'\u1E3B': 'l',
|
| 2731 |
+
'\u017F': 'l',
|
| 2732 |
+
'\u0142': 'l',
|
| 2733 |
+
'\u019A': 'l',
|
| 2734 |
+
'\u026B': 'l',
|
| 2735 |
+
'\u2C61': 'l',
|
| 2736 |
+
'\uA749': 'l',
|
| 2737 |
+
'\uA781': 'l',
|
| 2738 |
+
'\uA747': 'l',
|
| 2739 |
+
'\u01C9': 'lj',
|
| 2740 |
+
'\u24DC': 'm',
|
| 2741 |
+
'\uFF4D': 'm',
|
| 2742 |
+
'\u1E3F': 'm',
|
| 2743 |
+
'\u1E41': 'm',
|
| 2744 |
+
'\u1E43': 'm',
|
| 2745 |
+
'\u0271': 'm',
|
| 2746 |
+
'\u026F': 'm',
|
| 2747 |
+
'\u24DD': 'n',
|
| 2748 |
+
'\uFF4E': 'n',
|
| 2749 |
+
'\u01F9': 'n',
|
| 2750 |
+
'\u0144': 'n',
|
| 2751 |
+
'\u00F1': 'n',
|
| 2752 |
+
'\u1E45': 'n',
|
| 2753 |
+
'\u0148': 'n',
|
| 2754 |
+
'\u1E47': 'n',
|
| 2755 |
+
'\u0146': 'n',
|
| 2756 |
+
'\u1E4B': 'n',
|
| 2757 |
+
'\u1E49': 'n',
|
| 2758 |
+
'\u019E': 'n',
|
| 2759 |
+
'\u0272': 'n',
|
| 2760 |
+
'\u0149': 'n',
|
| 2761 |
+
'\uA791': 'n',
|
| 2762 |
+
'\uA7A5': 'n',
|
| 2763 |
+
'\u01CC': 'nj',
|
| 2764 |
+
'\u24DE': 'o',
|
| 2765 |
+
'\uFF4F': 'o',
|
| 2766 |
+
'\u00F2': 'o',
|
| 2767 |
+
'\u00F3': 'o',
|
| 2768 |
+
'\u00F4': 'o',
|
| 2769 |
+
'\u1ED3': 'o',
|
| 2770 |
+
'\u1ED1': 'o',
|
| 2771 |
+
'\u1ED7': 'o',
|
| 2772 |
+
'\u1ED5': 'o',
|
| 2773 |
+
'\u00F5': 'o',
|
| 2774 |
+
'\u1E4D': 'o',
|
| 2775 |
+
'\u022D': 'o',
|
| 2776 |
+
'\u1E4F': 'o',
|
| 2777 |
+
'\u014D': 'o',
|
| 2778 |
+
'\u1E51': 'o',
|
| 2779 |
+
'\u1E53': 'o',
|
| 2780 |
+
'\u014F': 'o',
|
| 2781 |
+
'\u022F': 'o',
|
| 2782 |
+
'\u0231': 'o',
|
| 2783 |
+
'\u00F6': 'o',
|
| 2784 |
+
'\u022B': 'o',
|
| 2785 |
+
'\u1ECF': 'o',
|
| 2786 |
+
'\u0151': 'o',
|
| 2787 |
+
'\u01D2': 'o',
|
| 2788 |
+
'\u020D': 'o',
|
| 2789 |
+
'\u020F': 'o',
|
| 2790 |
+
'\u01A1': 'o',
|
| 2791 |
+
'\u1EDD': 'o',
|
| 2792 |
+
'\u1EDB': 'o',
|
| 2793 |
+
'\u1EE1': 'o',
|
| 2794 |
+
'\u1EDF': 'o',
|
| 2795 |
+
'\u1EE3': 'o',
|
| 2796 |
+
'\u1ECD': 'o',
|
| 2797 |
+
'\u1ED9': 'o',
|
| 2798 |
+
'\u01EB': 'o',
|
| 2799 |
+
'\u01ED': 'o',
|
| 2800 |
+
'\u00F8': 'o',
|
| 2801 |
+
'\u01FF': 'o',
|
| 2802 |
+
'\u0254': 'o',
|
| 2803 |
+
'\uA74B': 'o',
|
| 2804 |
+
'\uA74D': 'o',
|
| 2805 |
+
'\u0275': 'o',
|
| 2806 |
+
'\u01A3': 'oi',
|
| 2807 |
+
'\u0223': 'ou',
|
| 2808 |
+
'\uA74F': 'oo',
|
| 2809 |
+
'\u24DF': 'p',
|
| 2810 |
+
'\uFF50': 'p',
|
| 2811 |
+
'\u1E55': 'p',
|
| 2812 |
+
'\u1E57': 'p',
|
| 2813 |
+
'\u01A5': 'p',
|
| 2814 |
+
'\u1D7D': 'p',
|
| 2815 |
+
'\uA751': 'p',
|
| 2816 |
+
'\uA753': 'p',
|
| 2817 |
+
'\uA755': 'p',
|
| 2818 |
+
'\u24E0': 'q',
|
| 2819 |
+
'\uFF51': 'q',
|
| 2820 |
+
'\u024B': 'q',
|
| 2821 |
+
'\uA757': 'q',
|
| 2822 |
+
'\uA759': 'q',
|
| 2823 |
+
'\u24E1': 'r',
|
| 2824 |
+
'\uFF52': 'r',
|
| 2825 |
+
'\u0155': 'r',
|
| 2826 |
+
'\u1E59': 'r',
|
| 2827 |
+
'\u0159': 'r',
|
| 2828 |
+
'\u0211': 'r',
|
| 2829 |
+
'\u0213': 'r',
|
| 2830 |
+
'\u1E5B': 'r',
|
| 2831 |
+
'\u1E5D': 'r',
|
| 2832 |
+
'\u0157': 'r',
|
| 2833 |
+
'\u1E5F': 'r',
|
| 2834 |
+
'\u024D': 'r',
|
| 2835 |
+
'\u027D': 'r',
|
| 2836 |
+
'\uA75B': 'r',
|
| 2837 |
+
'\uA7A7': 'r',
|
| 2838 |
+
'\uA783': 'r',
|
| 2839 |
+
'\u24E2': 's',
|
| 2840 |
+
'\uFF53': 's',
|
| 2841 |
+
'\u00DF': 's',
|
| 2842 |
+
'\u015B': 's',
|
| 2843 |
+
'\u1E65': 's',
|
| 2844 |
+
'\u015D': 's',
|
| 2845 |
+
'\u1E61': 's',
|
| 2846 |
+
'\u0161': 's',
|
| 2847 |
+
'\u1E67': 's',
|
| 2848 |
+
'\u1E63': 's',
|
| 2849 |
+
'\u1E69': 's',
|
| 2850 |
+
'\u0219': 's',
|
| 2851 |
+
'\u015F': 's',
|
| 2852 |
+
'\u023F': 's',
|
| 2853 |
+
'\uA7A9': 's',
|
| 2854 |
+
'\uA785': 's',
|
| 2855 |
+
'\u1E9B': 's',
|
| 2856 |
+
'\u24E3': 't',
|
| 2857 |
+
'\uFF54': 't',
|
| 2858 |
+
'\u1E6B': 't',
|
| 2859 |
+
'\u1E97': 't',
|
| 2860 |
+
'\u0165': 't',
|
| 2861 |
+
'\u1E6D': 't',
|
| 2862 |
+
'\u021B': 't',
|
| 2863 |
+
'\u0163': 't',
|
| 2864 |
+
'\u1E71': 't',
|
| 2865 |
+
'\u1E6F': 't',
|
| 2866 |
+
'\u0167': 't',
|
| 2867 |
+
'\u01AD': 't',
|
| 2868 |
+
'\u0288': 't',
|
| 2869 |
+
'\u2C66': 't',
|
| 2870 |
+
'\uA787': 't',
|
| 2871 |
+
'\uA729': 'tz',
|
| 2872 |
+
'\u24E4': 'u',
|
| 2873 |
+
'\uFF55': 'u',
|
| 2874 |
+
'\u00F9': 'u',
|
| 2875 |
+
'\u00FA': 'u',
|
| 2876 |
+
'\u00FB': 'u',
|
| 2877 |
+
'\u0169': 'u',
|
| 2878 |
+
'\u1E79': 'u',
|
| 2879 |
+
'\u016B': 'u',
|
| 2880 |
+
'\u1E7B': 'u',
|
| 2881 |
+
'\u016D': 'u',
|
| 2882 |
+
'\u00FC': 'u',
|
| 2883 |
+
'\u01DC': 'u',
|
| 2884 |
+
'\u01D8': 'u',
|
| 2885 |
+
'\u01D6': 'u',
|
| 2886 |
+
'\u01DA': 'u',
|
| 2887 |
+
'\u1EE7': 'u',
|
| 2888 |
+
'\u016F': 'u',
|
| 2889 |
+
'\u0171': 'u',
|
| 2890 |
+
'\u01D4': 'u',
|
| 2891 |
+
'\u0215': 'u',
|
| 2892 |
+
'\u0217': 'u',
|
| 2893 |
+
'\u01B0': 'u',
|
| 2894 |
+
'\u1EEB': 'u',
|
| 2895 |
+
'\u1EE9': 'u',
|
| 2896 |
+
'\u1EEF': 'u',
|
| 2897 |
+
'\u1EED': 'u',
|
| 2898 |
+
'\u1EF1': 'u',
|
| 2899 |
+
'\u1EE5': 'u',
|
| 2900 |
+
'\u1E73': 'u',
|
| 2901 |
+
'\u0173': 'u',
|
| 2902 |
+
'\u1E77': 'u',
|
| 2903 |
+
'\u1E75': 'u',
|
| 2904 |
+
'\u0289': 'u',
|
| 2905 |
+
'\u24E5': 'v',
|
| 2906 |
+
'\uFF56': 'v',
|
| 2907 |
+
'\u1E7D': 'v',
|
| 2908 |
+
'\u1E7F': 'v',
|
| 2909 |
+
'\u028B': 'v',
|
| 2910 |
+
'\uA75F': 'v',
|
| 2911 |
+
'\u028C': 'v',
|
| 2912 |
+
'\uA761': 'vy',
|
| 2913 |
+
'\u24E6': 'w',
|
| 2914 |
+
'\uFF57': 'w',
|
| 2915 |
+
'\u1E81': 'w',
|
| 2916 |
+
'\u1E83': 'w',
|
| 2917 |
+
'\u0175': 'w',
|
| 2918 |
+
'\u1E87': 'w',
|
| 2919 |
+
'\u1E85': 'w',
|
| 2920 |
+
'\u1E98': 'w',
|
| 2921 |
+
'\u1E89': 'w',
|
| 2922 |
+
'\u2C73': 'w',
|
| 2923 |
+
'\u24E7': 'x',
|
| 2924 |
+
'\uFF58': 'x',
|
| 2925 |
+
'\u1E8B': 'x',
|
| 2926 |
+
'\u1E8D': 'x',
|
| 2927 |
+
'\u24E8': 'y',
|
| 2928 |
+
'\uFF59': 'y',
|
| 2929 |
+
'\u1EF3': 'y',
|
| 2930 |
+
'\u00FD': 'y',
|
| 2931 |
+
'\u0177': 'y',
|
| 2932 |
+
'\u1EF9': 'y',
|
| 2933 |
+
'\u0233': 'y',
|
| 2934 |
+
'\u1E8F': 'y',
|
| 2935 |
+
'\u00FF': 'y',
|
| 2936 |
+
'\u1EF7': 'y',
|
| 2937 |
+
'\u1E99': 'y',
|
| 2938 |
+
'\u1EF5': 'y',
|
| 2939 |
+
'\u01B4': 'y',
|
| 2940 |
+
'\u024F': 'y',
|
| 2941 |
+
'\u1EFF': 'y',
|
| 2942 |
+
'\u24E9': 'z',
|
| 2943 |
+
'\uFF5A': 'z',
|
| 2944 |
+
'\u017A': 'z',
|
| 2945 |
+
'\u1E91': 'z',
|
| 2946 |
+
'\u017C': 'z',
|
| 2947 |
+
'\u017E': 'z',
|
| 2948 |
+
'\u1E93': 'z',
|
| 2949 |
+
'\u1E95': 'z',
|
| 2950 |
+
'\u01B6': 'z',
|
| 2951 |
+
'\u0225': 'z',
|
| 2952 |
+
'\u0240': 'z',
|
| 2953 |
+
'\u2C6C': 'z',
|
| 2954 |
+
'\uA763': 'z',
|
| 2955 |
+
'\u0386': '\u0391',
|
| 2956 |
+
'\u0388': '\u0395',
|
| 2957 |
+
'\u0389': '\u0397',
|
| 2958 |
+
'\u038A': '\u0399',
|
| 2959 |
+
'\u03AA': '\u0399',
|
| 2960 |
+
'\u038C': '\u039F',
|
| 2961 |
+
'\u038E': '\u03A5',
|
| 2962 |
+
'\u03AB': '\u03A5',
|
| 2963 |
+
'\u038F': '\u03A9',
|
| 2964 |
+
'\u03AC': '\u03B1',
|
| 2965 |
+
'\u03AD': '\u03B5',
|
| 2966 |
+
'\u03AE': '\u03B7',
|
| 2967 |
+
'\u03AF': '\u03B9',
|
| 2968 |
+
'\u03CA': '\u03B9',
|
| 2969 |
+
'\u0390': '\u03B9',
|
| 2970 |
+
'\u03CC': '\u03BF',
|
| 2971 |
+
'\u03CD': '\u03C5',
|
| 2972 |
+
'\u03CB': '\u03C5',
|
| 2973 |
+
'\u03B0': '\u03C5',
|
| 2974 |
+
'\u03C9': '\u03C9',
|
| 2975 |
+
'\u03C2': '\u03C3'
|
| 2976 |
+
};
|
| 2977 |
+
|
| 2978 |
+
return diacritics;
|
| 2979 |
+
});
|
| 2980 |
+
|
| 2981 |
+
Toolset_S2.define('toolset_select2/data/base',[
|
| 2982 |
+
'../utils'
|
| 2983 |
+
], function (Utils) {
|
| 2984 |
+
function BaseAdapter ($element, options) {
|
| 2985 |
+
BaseAdapter.__super__.constructor.call(this);
|
| 2986 |
+
}
|
| 2987 |
+
|
| 2988 |
+
Utils.Extend(BaseAdapter, Utils.Observable);
|
| 2989 |
+
|
| 2990 |
+
BaseAdapter.prototype.current = function (callback) {
|
| 2991 |
+
throw new Error('The `current` method must be defined in child classes.');
|
| 2992 |
+
};
|
| 2993 |
+
|
| 2994 |
+
BaseAdapter.prototype.query = function (params, callback) {
|
| 2995 |
+
throw new Error('The `query` method must be defined in child classes.');
|
| 2996 |
+
};
|
| 2997 |
+
|
| 2998 |
+
BaseAdapter.prototype.bind = function (container, $container) {
|
| 2999 |
+
// Can be implemented in subclasses
|
| 3000 |
+
};
|
| 3001 |
+
|
| 3002 |
+
BaseAdapter.prototype.destroy = function () {
|
| 3003 |
+
// Can be implemented in subclasses
|
| 3004 |
+
};
|
| 3005 |
+
|
| 3006 |
+
BaseAdapter.prototype.generateResultId = function (container, data) {
|
| 3007 |
+
var id = container.id + '-result-';
|
| 3008 |
+
|
| 3009 |
+
id += Utils.generateChars(4);
|
| 3010 |
+
|
| 3011 |
+
if (data.id != null) {
|
| 3012 |
+
id += '-' + data.id.toString();
|
| 3013 |
+
} else {
|
| 3014 |
+
id += '-' + Utils.generateChars(4);
|
| 3015 |
+
}
|
| 3016 |
+
return id;
|
| 3017 |
+
};
|
| 3018 |
+
|
| 3019 |
+
return BaseAdapter;
|
| 3020 |
+
});
|
| 3021 |
+
|
| 3022 |
+
Toolset_S2.define('toolset_select2/data/select',[
|
| 3023 |
+
'./base',
|
| 3024 |
+
'../utils',
|
| 3025 |
+
'jquery'
|
| 3026 |
+
], function (BaseAdapter, Utils, $) {
|
| 3027 |
+
function SelectAdapter ($element, options) {
|
| 3028 |
+
this.$element = $element;
|
| 3029 |
+
this.options = options;
|
| 3030 |
+
|
| 3031 |
+
SelectAdapter.__super__.constructor.call(this);
|
| 3032 |
+
}
|
| 3033 |
+
|
| 3034 |
+
Utils.Extend(SelectAdapter, BaseAdapter);
|
| 3035 |
+
|
| 3036 |
+
SelectAdapter.prototype.current = function (callback) {
|
| 3037 |
+
var data = [];
|
| 3038 |
+
var self = this;
|
| 3039 |
+
|
| 3040 |
+
this.$element.find(':selected').each(function () {
|
| 3041 |
+
var $option = $(this);
|
| 3042 |
+
|
| 3043 |
+
var option = self.item($option);
|
| 3044 |
+
|
| 3045 |
+
data.push(option);
|
| 3046 |
+
});
|
| 3047 |
+
|
| 3048 |
+
callback(data);
|
| 3049 |
+
};
|
| 3050 |
+
|
| 3051 |
+
SelectAdapter.prototype.select = function (data) {
|
| 3052 |
+
var self = this;
|
| 3053 |
+
|
| 3054 |
+
data.selected = true;
|
| 3055 |
+
|
| 3056 |
+
// If data.element is a DOM node, use it instead
|
| 3057 |
+
if ($(data.element).is('option')) {
|
| 3058 |
+
data.element.selected = true;
|
| 3059 |
+
|
| 3060 |
+
this.$element.trigger('change');
|
| 3061 |
+
|
| 3062 |
+
return;
|
| 3063 |
+
}
|
| 3064 |
+
|
| 3065 |
+
if (this.$element.prop('multiple')) {
|
| 3066 |
+
this.current(function (currentData) {
|
| 3067 |
+
var val = [];
|
| 3068 |
+
|
| 3069 |
+
data = [data];
|
| 3070 |
+
data.push.apply(data, currentData);
|
| 3071 |
+
|
| 3072 |
+
for (var d = 0; d < data.length; d++) {
|
| 3073 |
+
var id = data[d].id;
|
| 3074 |
+
|
| 3075 |
+
if ($.inArray(id, val) === -1) {
|
| 3076 |
+
val.push(id);
|
| 3077 |
+
}
|
| 3078 |
+
}
|
| 3079 |
+
|
| 3080 |
+
self.$element.val(val);
|
| 3081 |
+
self.$element.trigger('change');
|
| 3082 |
+
});
|
| 3083 |
+
} else {
|
| 3084 |
+
var val = data.id;
|
| 3085 |
+
|
| 3086 |
+
this.$element.val(val);
|
| 3087 |
+
this.$element.trigger('change');
|
| 3088 |
+
}
|
| 3089 |
+
};
|
| 3090 |
+
|
| 3091 |
+
SelectAdapter.prototype.unselect = function (data) {
|
| 3092 |
+
var self = this;
|
| 3093 |
+
|
| 3094 |
+
if (!this.$element.prop('multiple')) {
|
| 3095 |
+
return;
|
| 3096 |
+
}
|
| 3097 |
+
|
| 3098 |
+
data.selected = false;
|
| 3099 |
+
|
| 3100 |
+
if ($(data.element).is('option')) {
|
| 3101 |
+
data.element.selected = false;
|
| 3102 |
+
|
| 3103 |
+
this.$element.trigger('change');
|
| 3104 |
+
|
| 3105 |
+
return;
|
| 3106 |
+
}
|
| 3107 |
+
|
| 3108 |
+
this.current(function (currentData) {
|
| 3109 |
+
var val = [];
|
| 3110 |
+
|
| 3111 |
+
for (var d = 0; d < currentData.length; d++) {
|
| 3112 |
+
var id = currentData[d].id;
|
| 3113 |
+
|
| 3114 |
+
if (id !== data.id && $.inArray(id, val) === -1) {
|
| 3115 |
+
val.push(id);
|
| 3116 |
+
}
|
| 3117 |
+
}
|
| 3118 |
+
|
| 3119 |
+
self.$element.val(val);
|
| 3120 |
+
|
| 3121 |
+
self.$element.trigger('change');
|
| 3122 |
+
});
|
| 3123 |
+
};
|
| 3124 |
+
|
| 3125 |
+
SelectAdapter.prototype.bind = function (container, $container) {
|
| 3126 |
+
var self = this;
|
| 3127 |
+
|
| 3128 |
+
this.container = container;
|
| 3129 |
+
|
| 3130 |
+
container.on('select', function (params) {
|
| 3131 |
+
self.select(params.data);
|
| 3132 |
+
});
|
| 3133 |
+
|
| 3134 |
+
container.on('unselect', function (params) {
|
| 3135 |
+
self.unselect(params.data);
|
| 3136 |
+
});
|
| 3137 |
+
};
|
| 3138 |
+
|
| 3139 |
+
SelectAdapter.prototype.destroy = function () {
|
| 3140 |
+
// Remove anything added to child elements
|
| 3141 |
+
this.$element.find('*').each(function () {
|
| 3142 |
+
// Remove any custom data set by Select2
|
| 3143 |
+
$.removeData(this, 'data');
|
| 3144 |
+
});
|
| 3145 |
+
};
|
| 3146 |
+
|
| 3147 |
+
SelectAdapter.prototype.query = function (params, callback) {
|
| 3148 |
+
var data = [];
|
| 3149 |
+
var self = this;
|
| 3150 |
+
|
| 3151 |
+
var $options = this.$element.children();
|
| 3152 |
+
|
| 3153 |
+
$options.each(function () {
|
| 3154 |
+
var $option = $(this);
|
| 3155 |
+
|
| 3156 |
+
if (!$option.is('option') && !$option.is('optgroup')) {
|
| 3157 |
+
return;
|
| 3158 |
+
}
|
| 3159 |
+
|
| 3160 |
+
var option = self.item($option);
|
| 3161 |
+
|
| 3162 |
+
var matches = self.matches(params, option);
|
| 3163 |
+
|
| 3164 |
+
if (matches !== null) {
|
| 3165 |
+
data.push(matches);
|
| 3166 |
+
}
|
| 3167 |
+
});
|
| 3168 |
+
|
| 3169 |
+
callback({
|
| 3170 |
+
results: data
|
| 3171 |
+
});
|
| 3172 |
+
};
|
| 3173 |
+
|
| 3174 |
+
SelectAdapter.prototype.addOptions = function ($options) {
|
| 3175 |
+
Utils.appendMany(this.$element, $options);
|
| 3176 |
+
};
|
| 3177 |
+
|
| 3178 |
+
SelectAdapter.prototype.option = function (data) {
|
| 3179 |
+
var option;
|
| 3180 |
+
|
| 3181 |
+
if (data.children) {
|
| 3182 |
+
option = document.createElement('optgroup');
|
| 3183 |
+
option.label = data.text;
|
| 3184 |
+
} else {
|
| 3185 |
+
option = document.createElement('option');
|
| 3186 |
+
|
| 3187 |
+
if (option.textContent !== undefined) {
|
| 3188 |
+
option.textContent = data.text;
|
| 3189 |
+
} else {
|
| 3190 |
+
option.innerText = data.text;
|
| 3191 |
+
}
|
| 3192 |
+
}
|
| 3193 |
+
|
| 3194 |
+
if (data.id) {
|
| 3195 |
+
option.value = data.id;
|
| 3196 |
+
}
|
| 3197 |
+
|
| 3198 |
+
if (data.disabled) {
|
| 3199 |
+
option.disabled = true;
|
| 3200 |
+
}
|
| 3201 |
+
|
| 3202 |
+
if (data.selected) {
|
| 3203 |
+
option.selected = true;
|
| 3204 |
+
}
|
| 3205 |
+
|
| 3206 |
+
if (data.title) {
|
| 3207 |
+
option.title = data.title;
|
| 3208 |
+
}
|
| 3209 |
+
|
| 3210 |
+
var $option = $(option);
|
| 3211 |
+
|
| 3212 |
+
var normalizedData = this._normalizeItem(data);
|
| 3213 |
+
normalizedData.element = option;
|
| 3214 |
+
|
| 3215 |
+
// Override the option's data with the combined data
|
| 3216 |
+
$.data(option, 'data', normalizedData);
|
| 3217 |
+
|
| 3218 |
+
return $option;
|
| 3219 |
+
};
|
| 3220 |
+
|
| 3221 |
+
SelectAdapter.prototype.item = function ($option) {
|
| 3222 |
+
var data = {};
|
| 3223 |
+
|
| 3224 |
+
data = $.data($option[0], 'data');
|
| 3225 |
+
|
| 3226 |
+
if (data != null) {
|
| 3227 |
+
return data;
|
| 3228 |
+
}
|
| 3229 |
+
|
| 3230 |
+
if ($option.is('option')) {
|
| 3231 |
+
data = {
|
| 3232 |
+
id: $option.val(),
|
| 3233 |
+
text: $option.text(),
|
| 3234 |
+
disabled: $option.prop('disabled'),
|
| 3235 |
+
selected: $option.prop('selected'),
|
| 3236 |
+
title: $option.prop('title')
|
| 3237 |
+
};
|
| 3238 |
+
} else if ($option.is('optgroup')) {
|
| 3239 |
+
data = {
|
| 3240 |
+
text: $option.prop('label'),
|
| 3241 |
+
children: [],
|
| 3242 |
+
title: $option.prop('title')
|
| 3243 |
+
};
|
| 3244 |
+
|
| 3245 |
+
var $children = $option.children('option');
|
| 3246 |
+
var children = [];
|
| 3247 |
+
|
| 3248 |
+
for (var c = 0; c < $children.length; c++) {
|
| 3249 |
+
var $child = $($children[c]);
|
| 3250 |
+
|
| 3251 |
+
var child = this.item($child);
|
| 3252 |
+
|
| 3253 |
+
children.push(child);
|
| 3254 |
+
}
|
| 3255 |
+
|
| 3256 |
+
data.children = children;
|
| 3257 |
+
}
|
| 3258 |
+
|
| 3259 |
+
data = this._normalizeItem(data);
|
| 3260 |
+
data.element = $option[0];
|
| 3261 |
+
|
| 3262 |
+
$.data($option[0], 'data', data);
|
| 3263 |
+
|
| 3264 |
+
return data;
|
| 3265 |
+
};
|
| 3266 |
+
|
| 3267 |
+
SelectAdapter.prototype._normalizeItem = function (item) {
|
| 3268 |
+
if (!$.isPlainObject(item)) {
|
| 3269 |
+
item = {
|
| 3270 |
+
id: item,
|
| 3271 |
+
text: item
|
| 3272 |
+
};
|
| 3273 |
+
}
|
| 3274 |
+
|
| 3275 |
+
item = $.extend({}, {
|
| 3276 |
+
text: ''
|
| 3277 |
+
}, item);
|
| 3278 |
+
|
| 3279 |
+
var defaults = {
|
| 3280 |
+
selected: false,
|
| 3281 |
+
disabled: false
|
| 3282 |
+
};
|
| 3283 |
+
|
| 3284 |
+
if (item.id != null) {
|
| 3285 |
+
item.id = item.id.toString();
|
| 3286 |
+
}
|
| 3287 |
+
|
| 3288 |
+
if (item.text != null) {
|
| 3289 |
+
item.text = item.text.toString();
|
| 3290 |
+
}
|
| 3291 |
+
|
| 3292 |
+
if (item._resultId == null && item.id && this.container != null) {
|
| 3293 |
+
item._resultId = this.generateResultId(this.container, item);
|
| 3294 |
+
}
|
| 3295 |
+
|
| 3296 |
+
return $.extend({}, defaults, item);
|
| 3297 |
+
};
|
| 3298 |
+
|
| 3299 |
+
SelectAdapter.prototype.matches = function (params, data) {
|
| 3300 |
+
var matcher = this.options.get('matcher');
|
| 3301 |
+
|
| 3302 |
+
return matcher(params, data);
|
| 3303 |
+
};
|
| 3304 |
+
|
| 3305 |
+
return SelectAdapter;
|
| 3306 |
+
});
|
| 3307 |
+
|
| 3308 |
+
Toolset_S2.define('toolset_select2/data/array',[
|
| 3309 |
+
'./select',
|
| 3310 |
+
'../utils',
|
| 3311 |
+
'jquery'
|
| 3312 |
+
], function (SelectAdapter, Utils, $) {
|
| 3313 |
+
function ArrayAdapter ($element, options) {
|
| 3314 |
+
var data = options.get('data') || [];
|
| 3315 |
+
|
| 3316 |
+
ArrayAdapter.__super__.constructor.call(this, $element, options);
|
| 3317 |
+
|
| 3318 |
+
this.addOptions(this.convertToOptions(data));
|
| 3319 |
+
}
|
| 3320 |
+
|
| 3321 |
+
Utils.Extend(ArrayAdapter, SelectAdapter);
|
| 3322 |
+
|
| 3323 |
+
ArrayAdapter.prototype.select = function (data) {
|
| 3324 |
+
var $option = this.$element.find('option').filter(function (i, elm) {
|
| 3325 |
+
return elm.value == data.id.toString();
|
| 3326 |
+
});
|
| 3327 |
+
|
| 3328 |
+
if ($option.length === 0) {
|
| 3329 |
+
$option = this.option(data);
|
| 3330 |
+
|
| 3331 |
+
this.addOptions($option);
|
| 3332 |
+
}
|
| 3333 |
+
|
| 3334 |
+
ArrayAdapter.__super__.select.call(this, data);
|
| 3335 |
+
};
|
| 3336 |
+
|
| 3337 |
+
ArrayAdapter.prototype.convertToOptions = function (data) {
|
| 3338 |
+
var self = this;
|
| 3339 |
+
|
| 3340 |
+
var $existing = this.$element.find('option');
|
| 3341 |
+
var existingIds = $existing.map(function () {
|
| 3342 |
+
return self.item($(this)).id;
|
| 3343 |
+
}).get();
|
| 3344 |
+
|
| 3345 |
+
var $options = [];
|
| 3346 |
+
|
| 3347 |
+
// Filter out all items except for the one passed in the argument
|
| 3348 |
+
function onlyItem (item) {
|
| 3349 |
+
return function () {
|
| 3350 |
+
return $(this).val() == item.id;
|
| 3351 |
+
};
|
| 3352 |
+
}
|
| 3353 |
+
|
| 3354 |
+
for (var d = 0; d < data.length; d++) {
|
| 3355 |
+
var item = this._normalizeItem(data[d]);
|
| 3356 |
+
|
| 3357 |
+
// Skip items which were pre-loaded, only merge the data
|
| 3358 |
+
if ($.inArray(item.id, existingIds) >= 0) {
|
| 3359 |
+
var $existingOption = $existing.filter(onlyItem(item));
|
| 3360 |
+
|
| 3361 |
+
var existingData = this.item($existingOption);
|
| 3362 |
+
var newData = $.extend(true, {}, item, existingData);
|
| 3363 |
+
|
| 3364 |
+
var $newOption = this.option(newData);
|
| 3365 |
+
|
| 3366 |
+
$existingOption.replaceWith($newOption);
|
| 3367 |
+
|
| 3368 |
+
continue;
|
| 3369 |
+
}
|
| 3370 |
+
|
| 3371 |
+
var $option = this.option(item);
|
| 3372 |
+
|
| 3373 |
+
if (item.children) {
|
| 3374 |
+
var $children = this.convertToOptions(item.children);
|
| 3375 |
+
|
| 3376 |
+
Utils.appendMany($option, $children);
|
| 3377 |
+
}
|
| 3378 |
+
|
| 3379 |
+
$options.push($option);
|
| 3380 |
+
}
|
| 3381 |
+
|
| 3382 |
+
return $options;
|
| 3383 |
+
};
|
| 3384 |
+
|
| 3385 |
+
return ArrayAdapter;
|
| 3386 |
+
});
|
| 3387 |
+
|
| 3388 |
+
Toolset_S2.define('toolset_select2/data/ajax',[
|
| 3389 |
+
'./array',
|
| 3390 |
+
'../utils',
|
| 3391 |
+
'jquery'
|
| 3392 |
+
], function (ArrayAdapter, Utils, $) {
|
| 3393 |
+
function AjaxAdapter ($element, options) {
|
| 3394 |
+
this.ajaxOptions = this._applyDefaults(options.get('ajax'));
|
| 3395 |
+
|
| 3396 |
+
if (this.ajaxOptions.processResults != null) {
|
| 3397 |
+
this.processResults = this.ajaxOptions.processResults;
|
| 3398 |
+
}
|
| 3399 |
+
|
| 3400 |
+
AjaxAdapter.__super__.constructor.call(this, $element, options);
|
| 3401 |
+
}
|
| 3402 |
+
|
| 3403 |
+
Utils.Extend(AjaxAdapter, ArrayAdapter);
|
| 3404 |
+
|
| 3405 |
+
AjaxAdapter.prototype._applyDefaults = function (options) {
|
| 3406 |
+
var defaults = {
|
| 3407 |
+
data: function (params) {
|
| 3408 |
+
return $.extend({}, params, {
|
| 3409 |
+
q: params.term
|
| 3410 |
+
});
|
| 3411 |
+
},
|
| 3412 |
+
transport: function (params, success, failure) {
|
| 3413 |
+
var $request = $.ajax(params);
|
| 3414 |
+
|
| 3415 |
+
$request.then(success);
|
| 3416 |
+
$request.fail(failure);
|
| 3417 |
+
|
| 3418 |
+
return $request;
|
| 3419 |
+
}
|
| 3420 |
+
};
|
| 3421 |
+
|
| 3422 |
+
return $.extend({}, defaults, options, true);
|
| 3423 |
+
};
|
| 3424 |
+
|
| 3425 |
+
AjaxAdapter.prototype.processResults = function (results) {
|
| 3426 |
+
return results;
|
| 3427 |
+
};
|
| 3428 |
+
|
| 3429 |
+
AjaxAdapter.prototype.query = function (params, callback) {
|
| 3430 |
+
var matches = [];
|
| 3431 |
+
var self = this;
|
| 3432 |
+
|
| 3433 |
+
if (this._request != null) {
|
| 3434 |
+
// JSONP requests cannot always be aborted
|
| 3435 |
+
if ($.isFunction(this._request.abort)) {
|
| 3436 |
+
this._request.abort();
|
| 3437 |
+
}
|
| 3438 |
+
|
| 3439 |
+
this._request = null;
|
| 3440 |
+
}
|
| 3441 |
+
|
| 3442 |
+
var options = $.extend({
|
| 3443 |
+
type: 'GET'
|
| 3444 |
+
}, this.ajaxOptions);
|
| 3445 |
+
|
| 3446 |
+
if (typeof options.url === 'function') {
|
| 3447 |
+
options.url = options.url.call(this.$element, params);
|
| 3448 |
+
}
|
| 3449 |
+
|
| 3450 |
+
if (typeof options.data === 'function') {
|
| 3451 |
+
options.data = options.data.call(this.$element, params);
|
| 3452 |
+
}
|
| 3453 |
+
|
| 3454 |
+
function request () {
|
| 3455 |
+
var $request = options.transport(options, function (data) {
|
| 3456 |
+
var results = self.processResults(data, params);
|
| 3457 |
+
|
| 3458 |
+
if (self.options.get('debug') && window.console && console.error) {
|
| 3459 |
+
// Check to make sure that the response included a `results` key.
|
| 3460 |
+
if (!results || !results.results || !$.isArray(results.results)) {
|
| 3461 |
+
console.error(
|
| 3462 |
+
'Select2: The AJAX results did not return an array in the ' +
|
| 3463 |
+
'`results` key of the response.'
|
| 3464 |
+
);
|
| 3465 |
+
}
|
| 3466 |
+
}
|
| 3467 |
+
|
| 3468 |
+
callback(results);
|
| 3469 |
+
}, function () {
|
| 3470 |
+
// Attempt to detect if a request was aborted
|
| 3471 |
+
// Only works if the transport exposes a status property
|
| 3472 |
+
if ($request.status && $request.status === '0') {
|
| 3473 |
+
return;
|
| 3474 |
+
}
|
| 3475 |
+
|
| 3476 |
+
self.trigger('results:message', {
|
| 3477 |
+
message: 'errorLoading'
|
| 3478 |
+
});
|
| 3479 |
+
});
|
| 3480 |
+
|
| 3481 |
+
self._request = $request;
|
| 3482 |
+
}
|
| 3483 |
+
|
| 3484 |
+
if (this.ajaxOptions.delay && params.term != null) {
|
| 3485 |
+
if (this._queryTimeout) {
|
| 3486 |
+
window.clearTimeout(this._queryTimeout);
|
| 3487 |
+
}
|
| 3488 |
+
|
| 3489 |
+
this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
|
| 3490 |
+
} else {
|
| 3491 |
+
request();
|
| 3492 |
+
}
|
| 3493 |
+
};
|
| 3494 |
+
|
| 3495 |
+
return AjaxAdapter;
|
| 3496 |
+
});
|
| 3497 |
+
|
| 3498 |
+
Toolset_S2.define('toolset_select2/data/tags',[
|
| 3499 |
+
'jquery'
|
| 3500 |
+
], function ($) {
|
| 3501 |
+
function Tags (decorated, $element, options) {
|
| 3502 |
+
var tags = options.get('tags');
|
| 3503 |
+
|
| 3504 |
+
var createTag = options.get('createTag');
|
| 3505 |
+
|
| 3506 |
+
if (createTag !== undefined) {
|
| 3507 |
+
this.createTag = createTag;
|
| 3508 |
+
}
|
| 3509 |
+
|
| 3510 |
+
var insertTag = options.get('insertTag');
|
| 3511 |
+
|
| 3512 |
+
if (insertTag !== undefined) {
|
| 3513 |
+
this.insertTag = insertTag;
|
| 3514 |
+
}
|
| 3515 |
+
|
| 3516 |
+
decorated.call(this, $element, options);
|
| 3517 |
+
|
| 3518 |
+
if ($.isArray(tags)) {
|
| 3519 |
+
for (var t = 0; t < tags.length; t++) {
|
| 3520 |
+
var tag = tags[t];
|
| 3521 |
+
var item = this._normalizeItem(tag);
|
| 3522 |
+
|
| 3523 |
+
var $option = this.option(item);
|
| 3524 |
+
|
| 3525 |
+
this.$element.append($option);
|
| 3526 |
+
}
|
| 3527 |
+
}
|
| 3528 |
+
}
|
| 3529 |
+
|
| 3530 |
+
Tags.prototype.query = function (decorated, params, callback) {
|
| 3531 |
+
var self = this;
|
| 3532 |
+
|
| 3533 |
+
this._removeOldTags();
|
| 3534 |
+
|
| 3535 |
+
if (params.term == null || params.page != null) {
|
| 3536 |
+
decorated.call(this, params, callback);
|
| 3537 |
+
return;
|
| 3538 |
+
}
|
| 3539 |
+
|
| 3540 |
+
function wrapper (obj, child) {
|
| 3541 |
+
var data = obj.results;
|
| 3542 |
+
|
| 3543 |
+
for (var i = 0; i < data.length; i++) {
|
| 3544 |
+
var option = data[i];
|
| 3545 |
+
|
| 3546 |
+
var checkChildren = (
|
| 3547 |
+
option.children != null &&
|
| 3548 |
+
!wrapper({
|
| 3549 |
+
results: option.children
|
| 3550 |
+
}, true)
|
| 3551 |
+
);
|
| 3552 |
+
|
| 3553 |
+
var checkText = option.text === params.term;
|
| 3554 |
+
|
| 3555 |
+
if (checkText || checkChildren) {
|
| 3556 |
+
if (child) {
|
| 3557 |
+
return false;
|
| 3558 |
+
}
|
| 3559 |
+
|
| 3560 |
+
obj.data = data;
|
| 3561 |
+
callback(obj);
|
| 3562 |
+
|
| 3563 |
+
return;
|
| 3564 |
+
}
|
| 3565 |
+
}
|
| 3566 |
+
|
| 3567 |
+
if (child) {
|
| 3568 |
+
return true;
|
| 3569 |
+
}
|
| 3570 |
+
|
| 3571 |
+
var tag = self.createTag(params);
|
| 3572 |
+
|
| 3573 |
+
if (tag != null) {
|
| 3574 |
+
var $option = self.option(tag);
|
| 3575 |
+
$option.attr('data-toolset_select2-tag', true);
|
| 3576 |
+
|
| 3577 |
+
self.addOptions([$option]);
|
| 3578 |
+
|
| 3579 |
+
self.insertTag(data, tag);
|
| 3580 |
+
}
|
| 3581 |
+
|
| 3582 |
+
obj.results = data;
|
| 3583 |
+
|
| 3584 |
+
callback(obj);
|
| 3585 |
+
}
|
| 3586 |
+
|
| 3587 |
+
decorated.call(this, params, wrapper);
|
| 3588 |
+
};
|
| 3589 |
+
|
| 3590 |
+
Tags.prototype.createTag = function (decorated, params) {
|
| 3591 |
+
var term = $.trim(params.term);
|
| 3592 |
+
|
| 3593 |
+
if (term === '') {
|
| 3594 |
+
return null;
|
| 3595 |
+
}
|
| 3596 |
+
|
| 3597 |
+
return {
|
| 3598 |
+
id: term,
|
| 3599 |
+
text: term
|
| 3600 |
+
};
|
| 3601 |
+
};
|
| 3602 |
+
|
| 3603 |
+
Tags.prototype.insertTag = function (_, data, tag) {
|
| 3604 |
+
data.unshift(tag);
|
| 3605 |
+
};
|
| 3606 |
+
|
| 3607 |
+
Tags.prototype._removeOldTags = function (_) {
|
| 3608 |
+
var tag = this._lastTag;
|
| 3609 |
+
|
| 3610 |
+
var $options = this.$element.find('option[data-toolset_select2-tag]');
|
| 3611 |
+
|
| 3612 |
+
$options.each(function () {
|
| 3613 |
+
if (this.selected) {
|
| 3614 |
+
return;
|
| 3615 |
+
}
|
| 3616 |
+
|
| 3617 |
+
$(this).remove();
|
| 3618 |
+
});
|
| 3619 |
+
};
|
| 3620 |
+
|
| 3621 |
+
return Tags;
|
| 3622 |
+
});
|
| 3623 |
+
|
| 3624 |
+
Toolset_S2.define('toolset_select2/data/tokenizer',[
|
| 3625 |
+
'jquery'
|
| 3626 |
+
], function ($) {
|
| 3627 |
+
function Tokenizer (decorated, $element, options) {
|
| 3628 |
+
var tokenizer = options.get('tokenizer');
|
| 3629 |
+
|
| 3630 |
+
if (tokenizer !== undefined) {
|
| 3631 |
+
this.tokenizer = tokenizer;
|
| 3632 |
+
}
|
| 3633 |
+
|
| 3634 |
+
decorated.call(this, $element, options);
|
| 3635 |
+
}
|
| 3636 |
+
|
| 3637 |
+
Tokenizer.prototype.bind = function (decorated, container, $container) {
|
| 3638 |
+
decorated.call(this, container, $container);
|
| 3639 |
+
|
| 3640 |
+
this.$search = container.dropdown.$search || container.selection.$search ||
|
| 3641 |
+
$container.find('.toolset_select2-search__field');
|
| 3642 |
+
};
|
| 3643 |
+
|
| 3644 |
+
Tokenizer.prototype.query = function (decorated, params, callback) {
|
| 3645 |
+
var self = this;
|
| 3646 |
+
|
| 3647 |
+
function createAndSelect (data) {
|
| 3648 |
+
// Normalize the data object so we can use it for checks
|
| 3649 |
+
var item = self._normalizeItem(data);
|
| 3650 |
+
|
| 3651 |
+
// Check if the data object already exists as a tag
|
| 3652 |
+
// Select it if it doesn't
|
| 3653 |
+
var $existingOptions = self.$element.find('option').filter(function () {
|
| 3654 |
+
return $(this).val() === item.id;
|
| 3655 |
+
});
|
| 3656 |
+
|
| 3657 |
+
// If an existing option wasn't found for it, create the option
|
| 3658 |
+
if (!$existingOptions.length) {
|
| 3659 |
+
var $option = self.option(item);
|
| 3660 |
+
$option.attr('data-toolset_select2-tag', true);
|
| 3661 |
+
|
| 3662 |
+
self._removeOldTags();
|
| 3663 |
+
self.addOptions([$option]);
|
| 3664 |
+
}
|
| 3665 |
+
|
| 3666 |
+
// Select the item, now that we know there is an option for it
|
| 3667 |
+
select(item);
|
| 3668 |
+
}
|
| 3669 |
+
|
| 3670 |
+
function select (data) {
|
| 3671 |
+
self.trigger('select', {
|
| 3672 |
+
data: data
|
| 3673 |
+
});
|
| 3674 |
+
}
|
| 3675 |
+
|
| 3676 |
+
params.term = params.term || '';
|
| 3677 |
+
|
| 3678 |
+
var tokenData = this.tokenizer(params, this.options, createAndSelect);
|
| 3679 |
+
|
| 3680 |
+
if (tokenData.term !== params.term) {
|
| 3681 |
+
// Replace the search term if we have the search box
|
| 3682 |
+
if (this.$search.length) {
|
| 3683 |
+
this.$search.val(tokenData.term);
|
| 3684 |
+
this.$search.focus();
|
| 3685 |
+
}
|
| 3686 |
+
|
| 3687 |
+
params.term = tokenData.term;
|
| 3688 |
+
}
|
| 3689 |
+
|
| 3690 |
+
decorated.call(this, params, callback);
|
| 3691 |
+
};
|
| 3692 |
+
|
| 3693 |
+
Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
|
| 3694 |
+
var separators = options.get('tokenSeparators') || [];
|
| 3695 |
+
var term = params.term;
|
| 3696 |
+
var i = 0;
|
| 3697 |
+
|
| 3698 |
+
var createTag = this.createTag || function (params) {
|
| 3699 |
+
return {
|
| 3700 |
+
id: params.term,
|
| 3701 |
+
text: params.term
|
| 3702 |
+
};
|
| 3703 |
+
};
|
| 3704 |
+
|
| 3705 |
+
while (i < term.length) {
|
| 3706 |
+
var termChar = term[i];
|
| 3707 |
+
|
| 3708 |
+
if ($.inArray(termChar, separators) === -1) {
|
| 3709 |
+
i++;
|
| 3710 |
+
|
| 3711 |
+
continue;
|
| 3712 |
+
}
|
| 3713 |
+
|
| 3714 |
+
var part = term.substr(0, i);
|
| 3715 |
+
var partParams = $.extend({}, params, {
|
| 3716 |
+
term: part
|
| 3717 |
+
});
|
| 3718 |
+
|
| 3719 |
+
var data = createTag(partParams);
|
| 3720 |
+
|
| 3721 |
+
if (data == null) {
|
| 3722 |
+
i++;
|
| 3723 |
+
continue;
|
| 3724 |
+
}
|
| 3725 |
+
|
| 3726 |
+
callback(data);
|
| 3727 |
+
|
| 3728 |
+
// Reset the term to not include the tokenized portion
|
| 3729 |
+
term = term.substr(i + 1) || '';
|
| 3730 |
+
i = 0;
|
| 3731 |
+
}
|
| 3732 |
+
|
| 3733 |
+
return {
|
| 3734 |
+
term: term
|
| 3735 |
+
};
|
| 3736 |
+
};
|
| 3737 |
+
|
| 3738 |
+
return Tokenizer;
|
| 3739 |
+
});
|
| 3740 |
+
|
| 3741 |
+
Toolset_S2.define('toolset_select2/data/minimumInputLength',[
|
| 3742 |
+
|
| 3743 |
+
], function () {
|
| 3744 |
+
function MinimumInputLength (decorated, $e, options) {
|
| 3745 |
+
this.minimumInputLength = options.get('minimumInputLength');
|
| 3746 |
+
|
| 3747 |
+
decorated.call(this, $e, options);
|
| 3748 |
+
}
|
| 3749 |
+
|
| 3750 |
+
MinimumInputLength.prototype.query = function (decorated, params, callback) {
|
| 3751 |
+
params.term = params.term || '';
|
| 3752 |
+
|
| 3753 |
+
if (params.term.length < this.minimumInputLength) {
|
| 3754 |
+
this.trigger('results:message', {
|
| 3755 |
+
message: 'inputTooShort',
|
| 3756 |
+
args: {
|
| 3757 |
+
minimum: this.minimumInputLength,
|
| 3758 |
+
input: params.term,
|
| 3759 |
+
params: params
|
| 3760 |
+
}
|
| 3761 |
+
});
|
| 3762 |
+
|
| 3763 |
+
return;
|
| 3764 |
+
}
|
| 3765 |
+
|
| 3766 |
+
decorated.call(this, params, callback);
|
| 3767 |
+
};
|
| 3768 |
+
|
| 3769 |
+
return MinimumInputLength;
|
| 3770 |
+
});
|
| 3771 |
+
|
| 3772 |
+
Toolset_S2.define('toolset_select2/data/maximumInputLength',[
|
| 3773 |
+
|
| 3774 |
+
], function () {
|
| 3775 |
+
function MaximumInputLength (decorated, $e, options) {
|
| 3776 |
+
this.maximumInputLength = options.get('maximumInputLength');
|
| 3777 |
+
|
| 3778 |
+
decorated.call(this, $e, options);
|
| 3779 |
+
}
|
| 3780 |
+
|
| 3781 |
+
MaximumInputLength.prototype.query = function (decorated, params, callback) {
|
| 3782 |
+
params.term = params.term || '';
|
| 3783 |
+
|
| 3784 |
+
if (this.maximumInputLength > 0 &&
|
| 3785 |
+
params.term.length > this.maximumInputLength) {
|
| 3786 |
+
this.trigger('results:message', {
|
| 3787 |
+
message: 'inputTooLong',
|
| 3788 |
+
args: {
|
| 3789 |
+
maximum: this.maximumInputLength,
|
| 3790 |
+
input: params.term,
|
| 3791 |
+
params: params
|
| 3792 |
+
}
|
| 3793 |
+
});
|
| 3794 |
+
|
| 3795 |
+
return;
|
| 3796 |
+
}
|
| 3797 |
+
|
| 3798 |
+
decorated.call(this, params, callback);
|
| 3799 |
+
};
|
| 3800 |
+
|
| 3801 |
+
return MaximumInputLength;
|
| 3802 |
+
});
|
| 3803 |
+
|
| 3804 |
+
Toolset_S2.define('toolset_select2/data/maximumSelectionLength',[
|
| 3805 |
+
|
| 3806 |
+
], function (){
|
| 3807 |
+
function MaximumSelectionLength (decorated, $e, options) {
|
| 3808 |
+
this.maximumSelectionLength = options.get('maximumSelectionLength');
|
| 3809 |
+
|
| 3810 |
+
decorated.call(this, $e, options);
|
| 3811 |
+
}
|
| 3812 |
+
|
| 3813 |
+
MaximumSelectionLength.prototype.query =
|
| 3814 |
+
function (decorated, params, callback) {
|
| 3815 |
+
var self = this;
|
| 3816 |
+
|
| 3817 |
+
this.current(function (currentData) {
|
| 3818 |
+
var count = currentData != null ? currentData.length : 0;
|
| 3819 |
+
if (self.maximumSelectionLength > 0 &&
|
| 3820 |
+
count >= self.maximumSelectionLength) {
|
| 3821 |
+
self.trigger('results:message', {
|
| 3822 |
+
message: 'maximumSelected',
|
| 3823 |
+
args: {
|
| 3824 |
+
maximum: self.maximumSelectionLength
|
| 3825 |
+
}
|
| 3826 |
+
});
|
| 3827 |
+
return;
|
| 3828 |
+
}
|
| 3829 |
+
decorated.call(self, params, callback);
|
| 3830 |
+
});
|
| 3831 |
+
};
|
| 3832 |
+
|
| 3833 |
+
return MaximumSelectionLength;
|
| 3834 |
+
});
|
| 3835 |
+
|
| 3836 |
+
Toolset_S2.define('toolset_select2/dropdown',[
|
| 3837 |
+
'jquery',
|
| 3838 |
+
'./utils'
|
| 3839 |
+
], function ($, Utils) {
|
| 3840 |
+
function Dropdown ($element, options) {
|
| 3841 |
+
this.$element = $element;
|
| 3842 |
+
this.options = options;
|
| 3843 |
+
|
| 3844 |
+
Dropdown.__super__.constructor.call(this);
|
| 3845 |
+
}
|
| 3846 |
+
|
| 3847 |
+
Utils.Extend(Dropdown, Utils.Observable);
|
| 3848 |
+
|
| 3849 |
+
Dropdown.prototype.render = function () {
|
| 3850 |
+
var $dropdown = $(
|
| 3851 |
+
'<span class="toolset_select2-dropdown">' +
|
| 3852 |
+
'<span class="toolset_select2-results"></span>' +
|
| 3853 |
+
'</span>'
|
| 3854 |
+
);
|
| 3855 |
+
|
| 3856 |
+
$dropdown.attr('dir', this.options.get('dir'));
|
| 3857 |
+
|
| 3858 |
+
this.$dropdown = $dropdown;
|
| 3859 |
+
|
| 3860 |
+
return $dropdown;
|
| 3861 |
+
};
|
| 3862 |
+
|
| 3863 |
+
Dropdown.prototype.bind = function () {
|
| 3864 |
+
// Should be implemented in subclasses
|
| 3865 |
+
};
|
| 3866 |
+
|
| 3867 |
+
Dropdown.prototype.position = function ($dropdown, $container) {
|
| 3868 |
+
// Should be implmented in subclasses
|
| 3869 |
+
};
|
| 3870 |
+
|
| 3871 |
+
Dropdown.prototype.destroy = function () {
|
| 3872 |
+
// Remove the dropdown from the DOM
|
| 3873 |
+
this.$dropdown.remove();
|
| 3874 |
+
};
|
| 3875 |
+
|
| 3876 |
+
return Dropdown;
|
| 3877 |
+
});
|
| 3878 |
+
|
| 3879 |
+
Toolset_S2.define('toolset_select2/dropdown/search',[
|
| 3880 |
+
'jquery',
|
| 3881 |
+
'../utils'
|
| 3882 |
+
], function ($, Utils) {
|
| 3883 |
+
function Search () { }
|
| 3884 |
+
|
| 3885 |
+
Search.prototype.render = function (decorated) {
|
| 3886 |
+
var $rendered = decorated.call(this);
|
| 3887 |
+
|
| 3888 |
+
var $search = $(
|
| 3889 |
+
'<span class="toolset_select2-search toolset_select2-search--dropdown">' +
|
| 3890 |
+
'<input class="toolset_select2-search__field" type="search" tabindex="-1"' +
|
| 3891 |
+
' autocomplete="off" autocorrect="off" autocapitalize="off"' +
|
| 3892 |
+
' spellcheck="false" role="textbox" />' +
|
| 3893 |
+
'</span>'
|
| 3894 |
+
);
|
| 3895 |
+
|
| 3896 |
+
this.$searchContainer = $search;
|
| 3897 |
+
this.$search = $search.find('input');
|
| 3898 |
+
|
| 3899 |
+
$rendered.prepend($search);
|
| 3900 |
+
|
| 3901 |
+
return $rendered;
|
| 3902 |
+
};
|
| 3903 |
+
|
| 3904 |
+
Search.prototype.bind = function (decorated, container, $container) {
|
| 3905 |
+
var self = this;
|
| 3906 |
+
|
| 3907 |
+
decorated.call(this, container, $container);
|
| 3908 |
+
|
| 3909 |
+
this.$search.on('keydown', function (evt) {
|
| 3910 |
+
self.trigger('keypress', evt);
|
| 3911 |
+
|
| 3912 |
+
self._keyUpPrevented = evt.isDefaultPrevented();
|
| 3913 |
+
});
|
| 3914 |
+
|
| 3915 |
+
// Workaround for browsers which do not support the `input` event
|
| 3916 |
+
// This will prevent double-triggering of events for browsers which support
|
| 3917 |
+
// both the `keyup` and `input` events.
|
| 3918 |
+
this.$search.on('input', function (evt) {
|
| 3919 |
+
// Unbind the duplicated `keyup` event
|
| 3920 |
+
$(this).off('keyup');
|
| 3921 |
+
});
|
| 3922 |
+
|
| 3923 |
+
this.$search.on('keyup input', function (evt) {
|
| 3924 |
+
self.handleSearch(evt);
|
| 3925 |
+
});
|
| 3926 |
+
|
| 3927 |
+
container.on('open', function () {
|
| 3928 |
+
self.$search.attr('tabindex', 0);
|
| 3929 |
+
|
| 3930 |
+
self.$search.focus();
|
| 3931 |
+
|
| 3932 |
+
window.setTimeout(function () {
|
| 3933 |
+
self.$search.focus();
|
| 3934 |
+
}, 0);
|
| 3935 |
+
});
|
| 3936 |
+
|
| 3937 |
+
container.on('close', function () {
|
| 3938 |
+
self.$search.attr('tabindex', -1);
|
| 3939 |
+
|
| 3940 |
+
self.$search.val('');
|
| 3941 |
+
});
|
| 3942 |
+
|
| 3943 |
+
container.on('focus', function () {
|
| 3944 |
+
if (container.isOpen()) {
|
| 3945 |
+
self.$search.focus();
|
| 3946 |
+
}
|
| 3947 |
+
});
|
| 3948 |
+
|
| 3949 |
+
container.on('results:all', function (params) {
|
| 3950 |
+
if (params.query.term == null || params.query.term === '') {
|
| 3951 |
+
var showSearch = self.showSearch(params);
|
| 3952 |
+
|
| 3953 |
+
if (showSearch) {
|
| 3954 |
+
self.$searchContainer.removeClass('toolset_select2-search--hide');
|
| 3955 |
+
} else {
|
| 3956 |
+
self.$searchContainer.addClass('toolset_select2-search--hide');
|
| 3957 |
+
}
|
| 3958 |
+
}
|
| 3959 |
+
});
|
| 3960 |
+
};
|
| 3961 |
+
|
| 3962 |
+
Search.prototype.handleSearch = function (evt) {
|
| 3963 |
+
if (!this._keyUpPrevented) {
|
| 3964 |
+
var input = this.$search.val();
|
| 3965 |
+
|
| 3966 |
+
this.trigger('query', {
|
| 3967 |
+
term: input
|
| 3968 |
+
});
|
| 3969 |
+
}
|
| 3970 |
+
|
| 3971 |
+
this._keyUpPrevented = false;
|
| 3972 |
+
};
|
| 3973 |
+
|
| 3974 |
+
Search.prototype.showSearch = function (_, params) {
|
| 3975 |
+
return true;
|
| 3976 |
+
};
|
| 3977 |
+
|
| 3978 |
+
return Search;
|
| 3979 |
+
});
|
| 3980 |
+
|
| 3981 |
+
Toolset_S2.define('toolset_select2/dropdown/hidePlaceholder',[
|
| 3982 |
+
|
| 3983 |
+
], function () {
|
| 3984 |
+
function HidePlaceholder (decorated, $element, options, dataAdapter) {
|
| 3985 |
+
this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
|
| 3986 |
+
|
| 3987 |
+
decorated.call(this, $element, options, dataAdapter);
|
| 3988 |
+
}
|
| 3989 |
+
|
| 3990 |
+
HidePlaceholder.prototype.append = function (decorated, data) {
|
| 3991 |
+
data.results = this.removePlaceholder(data.results);
|
| 3992 |
+
|
| 3993 |
+
decorated.call(this, data);
|
| 3994 |
+
};
|
| 3995 |
+
|
| 3996 |
+
HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
|
| 3997 |
+
if (typeof placeholder === 'string') {
|
| 3998 |
+
placeholder = {
|
| 3999 |
+
id: '',
|
| 4000 |
+
text: placeholder
|
| 4001 |
+
};
|
| 4002 |
+
}
|
| 4003 |
+
|
| 4004 |
+
return placeholder;
|
| 4005 |
+
};
|
| 4006 |
+
|
| 4007 |
+
HidePlaceholder.prototype.removePlaceholder = function (_, data) {
|
| 4008 |
+
var modifiedData = data.slice(0);
|
| 4009 |
+
|
| 4010 |
+
for (var d = data.length - 1; d >= 0; d--) {
|
| 4011 |
+
var item = data[d];
|
| 4012 |
+
|
| 4013 |
+
if (this.placeholder.id === item.id) {
|
| 4014 |
+
modifiedData.splice(d, 1);
|
| 4015 |
+
}
|
| 4016 |
+
}
|
| 4017 |
+
|
| 4018 |
+
return modifiedData;
|
| 4019 |
+
};
|
| 4020 |
+
|
| 4021 |
+
return HidePlaceholder;
|
| 4022 |
+
});
|
| 4023 |
+
|
| 4024 |
+
Toolset_S2.define('toolset_select2/dropdown/infiniteScroll',[
|
| 4025 |
+
'jquery'
|
| 4026 |
+
], function ($) {
|
| 4027 |
+
function InfiniteScroll (decorated, $element, options, dataAdapter) {
|
| 4028 |
+
this.lastParams = {};
|
| 4029 |
+
|
| 4030 |
+
decorated.call(this, $element, options, dataAdapter);
|
| 4031 |
+
|
| 4032 |
+
this.$loadingMore = this.createLoadingMore();
|
| 4033 |
+
this.loading = false;
|
| 4034 |
+
}
|
| 4035 |
+
|
| 4036 |
+
InfiniteScroll.prototype.append = function (decorated, data) {
|
| 4037 |
+
this.$loadingMore.remove();
|
| 4038 |
+
this.loading = false;
|
| 4039 |
+
|
| 4040 |
+
decorated.call(this, data);
|
| 4041 |
+
|
| 4042 |
+
if (this.showLoadingMore(data)) {
|
| 4043 |
+
this.$results.append(this.$loadingMore);
|
| 4044 |
+
}
|
| 4045 |
+
};
|
| 4046 |
+
|
| 4047 |
+
InfiniteScroll.prototype.bind = function (decorated, container, $container) {
|
| 4048 |
+
var self = this;
|
| 4049 |
+
|
| 4050 |
+
decorated.call(this, container, $container);
|
| 4051 |
+
|
| 4052 |
+
container.on('query', function (params) {
|
| 4053 |
+
self.lastParams = params;
|
| 4054 |
+
self.loading = true;
|
| 4055 |
+
});
|
| 4056 |
+
|
| 4057 |
+
container.on('query:append', function (params) {
|
| 4058 |
+
self.lastParams = params;
|
| 4059 |
+
self.loading = true;
|
| 4060 |
+
});
|
| 4061 |
+
|
| 4062 |
+
this.$results.on('scroll', function () {
|
| 4063 |
+
var isLoadMoreVisible = $.contains(
|
| 4064 |
+
document.documentElement,
|
| 4065 |
+
self.$loadingMore[0]
|
| 4066 |
+
);
|
| 4067 |
+
|
| 4068 |
+
if (self.loading || !isLoadMoreVisible) {
|
| 4069 |
+
return;
|
| 4070 |
+
}
|
| 4071 |
+
|
| 4072 |
+
var currentOffset = self.$results.offset().top +
|
| 4073 |
+
self.$results.outerHeight(false);
|
| 4074 |
+
var loadingMoreOffset = self.$loadingMore.offset().top +
|
| 4075 |
+
self.$loadingMore.outerHeight(false);
|
| 4076 |
+
|
| 4077 |
+
if (currentOffset + 50 >= loadingMoreOffset) {
|
| 4078 |
+
self.loadMore();
|
| 4079 |
+
}
|
| 4080 |
+
});
|
| 4081 |
+
};
|
| 4082 |
+
|
| 4083 |
+
InfiniteScroll.prototype.loadMore = function () {
|
| 4084 |
+
this.loading = true;
|
| 4085 |
+
|
| 4086 |
+
var params = $.extend({}, {page: 1}, this.lastParams);
|
| 4087 |
+
|
| 4088 |
+
params.page++;
|
| 4089 |
+
|
| 4090 |
+
this.trigger('query:append', params);
|
| 4091 |
+
};
|
| 4092 |
+
|
| 4093 |
+
InfiniteScroll.prototype.showLoadingMore = function (_, data) {
|
| 4094 |
+
return data.pagination && data.pagination.more;
|
| 4095 |
+
};
|
| 4096 |
+
|
| 4097 |
+
InfiniteScroll.prototype.createLoadingMore = function () {
|
| 4098 |
+
var $option = $(
|
| 4099 |
+
'<li ' +
|
| 4100 |
+
'class="toolset_select2-results__option toolset_select2-results__option--load-more"' +
|
| 4101 |
+
'role="treeitem" aria-disabled="true"></li>'
|
| 4102 |
+
);
|
| 4103 |
+
|
| 4104 |
+
var message = this.options.get('translations').get('loadingMore');
|
| 4105 |
+
|
| 4106 |
+
$option.html(message(this.lastParams));
|
| 4107 |
+
|
| 4108 |
+
return $option;
|
| 4109 |
+
};
|
| 4110 |
+
|
| 4111 |
+
return InfiniteScroll;
|
| 4112 |
+
});
|
| 4113 |
+
|
| 4114 |
+
Toolset_S2.define('toolset_select2/dropdown/attachBody',[
|
| 4115 |
+
'jquery',
|
| 4116 |
+
'../utils'
|
| 4117 |
+
], function ($, Utils) {
|
| 4118 |
+
function AttachBody (decorated, $element, options) {
|
| 4119 |
+
this.$dropdownParent = options.get('dropdownParent') || $(document.body);
|
| 4120 |
+
|
| 4121 |
+
decorated.call(this, $element, options);
|
| 4122 |
+
}
|
| 4123 |
+
|
| 4124 |
+
AttachBody.prototype.bind = function (decorated, container, $container) {
|
| 4125 |
+
var self = this;
|
| 4126 |
+
|
| 4127 |
+
var setupResultsEvents = false;
|
| 4128 |
+
|
| 4129 |
+
decorated.call(this, container, $container);
|
| 4130 |
+
|
| 4131 |
+
container.on('open', function () {
|
| 4132 |
+
self._showDropdown();
|
| 4133 |
+
self._attachPositioningHandler(container);
|
| 4134 |
+
|
| 4135 |
+
if (!setupResultsEvents) {
|
| 4136 |
+
setupResultsEvents = true;
|
| 4137 |
+
|
| 4138 |
+
container.on('results:all', function () {
|
| 4139 |
+
self._positionDropdown();
|
| 4140 |
+
self._resizeDropdown();
|
| 4141 |
+
});
|
| 4142 |
+
|
| 4143 |
+
container.on('results:append', function () {
|
| 4144 |
+
self._positionDropdown();
|
| 4145 |
+
self._resizeDropdown();
|
| 4146 |
+
});
|
| 4147 |
+
}
|
| 4148 |
+
});
|
| 4149 |
+
|
| 4150 |
+
container.on('close', function () {
|
| 4151 |
+
self._hideDropdown();
|
| 4152 |
+
self._detachPositioningHandler(container);
|
| 4153 |
+
});
|
| 4154 |
+
|
| 4155 |
+
this.$dropdownContainer.on('mousedown', function (evt) {
|
| 4156 |
+
evt.stopPropagation();
|
| 4157 |
+
});
|
| 4158 |
+
};
|
| 4159 |
+
|
| 4160 |
+
AttachBody.prototype.destroy = function (decorated) {
|
| 4161 |
+
decorated.call(this);
|
| 4162 |
+
|
| 4163 |
+
this.$dropdownContainer.remove();
|
| 4164 |
+
};
|
| 4165 |
+
|
| 4166 |
+
AttachBody.prototype.position = function (decorated, $dropdown, $container) {
|
| 4167 |
+
// Clone all of the container classes
|
| 4168 |
+
$dropdown.attr('class', $container.attr('class'));
|
| 4169 |
+
|
| 4170 |
+
$dropdown.removeClass('toolset_select2');
|
| 4171 |
+
$dropdown.addClass('toolset_select2-container--open');
|
| 4172 |
+
|
| 4173 |
+
$dropdown.css({
|
| 4174 |
+
position: 'absolute',
|
| 4175 |
+
top: -999999
|
| 4176 |
+
});
|
| 4177 |
+
|
| 4178 |
+
this.$container = $container;
|
| 4179 |
+
};
|
| 4180 |
+
|
| 4181 |
+
AttachBody.prototype.render = function (decorated) {
|
| 4182 |
+
var $container = $('<span></span>');
|
| 4183 |
+
|
| 4184 |
+
var $dropdown = decorated.call(this);
|
| 4185 |
+
$container.append($dropdown);
|
| 4186 |
+
|
| 4187 |
+
this.$dropdownContainer = $container;
|
| 4188 |
+
|
| 4189 |
+
return $container;
|
| 4190 |
+
};
|
| 4191 |
+
|
| 4192 |
+
AttachBody.prototype._hideDropdown = function (decorated) {
|
| 4193 |
+
this.$dropdownContainer.detach();
|
| 4194 |
+
};
|
| 4195 |
+
|
| 4196 |
+
AttachBody.prototype._attachPositioningHandler =
|
| 4197 |
+
function (decorated, container) {
|
| 4198 |
+
var self = this;
|
| 4199 |
+
|
| 4200 |
+
var scrollEvent = 'scroll.toolset_select2.' + container.id;
|
| 4201 |
+
var resizeEvent = 'resize.toolset_select2.' + container.id;
|
| 4202 |
+
var orientationEvent = 'orientationchange.toolset_select2.' + container.id;
|
| 4203 |
+
|
| 4204 |
+
var $watchers = this.$container.parents().filter(Utils.hasScroll);
|
| 4205 |
+
$watchers.each(function () {
|
| 4206 |
+
$(this).data('toolset_select2-scroll-position', {
|
| 4207 |
+
x: $(this).scrollLeft(),
|
| 4208 |
+
y: $(this).scrollTop()
|
| 4209 |
+
});
|
| 4210 |
+
});
|
| 4211 |
+
|
| 4212 |
+
$watchers.on(scrollEvent, function (ev) {
|
| 4213 |
+
var position = $(this).data('toolset_select2-scroll-position');
|
| 4214 |
+
$(this).scrollTop(position.y);
|
| 4215 |
+
});
|
| 4216 |
+
|
| 4217 |
+
$(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
|
| 4218 |
+
function (e) {
|
| 4219 |
+
self._positionDropdown();
|
| 4220 |
+
self._resizeDropdown();
|
| 4221 |
+
});
|
| 4222 |
+
};
|
| 4223 |
+
|
| 4224 |
+
AttachBody.prototype._detachPositioningHandler =
|
| 4225 |
+
function (decorated, container) {
|
| 4226 |
+
var scrollEvent = 'scroll.toolset_select2.' + container.id;
|
| 4227 |
+
var resizeEvent = 'resize.toolset_select2.' + container.id;
|
| 4228 |
+
var orientationEvent = 'orientationchange.toolset_select2.' + container.id;
|
| 4229 |
+
|
| 4230 |
+
var $watchers = this.$container.parents().filter(Utils.hasScroll);
|
| 4231 |
+
$watchers.off(scrollEvent);
|
| 4232 |
+
|
| 4233 |
+
$(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
|
| 4234 |
+
};
|
| 4235 |
+
|
| 4236 |
+
AttachBody.prototype._positionDropdown = function () {
|
| 4237 |
+
var $window = $(window);
|
| 4238 |
+
|
| 4239 |
+
var isCurrentlyAbove = this.$dropdown.hasClass('toolset_select2-dropdown--above');
|
| 4240 |
+
var isCurrentlyBelow = this.$dropdown.hasClass('toolset_select2-dropdown--below');
|
| 4241 |
+
|
| 4242 |
+
var newDirection = null;
|
| 4243 |
+
|
| 4244 |
+
var offset = this.$container.offset();
|
| 4245 |
+
|
| 4246 |
+
offset.bottom = offset.top + this.$container.outerHeight(false);
|
| 4247 |
+
|
| 4248 |
+
var container = {
|
| 4249 |
+
height: this.$container.outerHeight(false)
|
| 4250 |
+
};
|
| 4251 |
+
|
| 4252 |
+
container.top = offset.top;
|
| 4253 |
+
container.bottom = offset.top + container.height;
|
| 4254 |
+
|
| 4255 |
+
var dropdown = {
|
| 4256 |
+
height: this.$dropdown.outerHeight(false)
|
| 4257 |
+
};
|
| 4258 |
+
|
| 4259 |
+
var viewport = {
|
| 4260 |
+
top: $window.scrollTop(),
|
| 4261 |
+
bottom: $window.scrollTop() + $window.height()
|
| 4262 |
+
};
|
| 4263 |
+
|
| 4264 |
+
var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
|
| 4265 |
+
var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
|
| 4266 |
+
|
| 4267 |
+
var css = {
|
| 4268 |
+
left: offset.left,
|
| 4269 |
+
top: container.bottom
|
| 4270 |
+
};
|
| 4271 |
+
|
| 4272 |
+
// Determine what the parent element is to use for calciulating the offset
|
| 4273 |
+
var $offsetParent = this.$dropdownParent;
|
| 4274 |
+
|
| 4275 |
+
// For statically positoned elements, we need to get the element
|
| 4276 |
+
// that is determining the offset
|
| 4277 |
+
if ($offsetParent.css('position') === 'static') {
|
| 4278 |
+
$offsetParent = $offsetParent.offsetParent();
|
| 4279 |
+
}
|
| 4280 |
+
|
| 4281 |
+
var parentOffset = $offsetParent.offset();
|
| 4282 |
+
|
| 4283 |
+
css.top -= parentOffset.top;
|
| 4284 |
+
css.left -= parentOffset.left;
|
| 4285 |
+
|
| 4286 |
+
if (!isCurrentlyAbove && !isCurrentlyBelow) {
|
| 4287 |
+
newDirection = 'below';
|
| 4288 |
+
}
|
| 4289 |
+
|
| 4290 |
+
if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
|
| 4291 |
+
newDirection = 'above';
|
| 4292 |
+
} else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
|
| 4293 |
+
newDirection = 'below';
|
| 4294 |
+
}
|
| 4295 |
+
|
| 4296 |
+
if (newDirection == 'above' ||
|
| 4297 |
+
(isCurrentlyAbove && newDirection !== 'below')) {
|
| 4298 |
+
css.top = container.top - parentOffset.top - dropdown.height;
|
| 4299 |
+
}
|
| 4300 |
+
|
| 4301 |
+
if (newDirection != null) {
|
| 4302 |
+
this.$dropdown
|
| 4303 |
+
.removeClass('toolset_select2-dropdown--below toolset_select2-dropdown--above')
|
| 4304 |
+
.addClass('toolset_select2-dropdown--' + newDirection);
|
| 4305 |
+
this.$container
|
| 4306 |
+
.removeClass('toolset_select2-container--below toolset_select2-container--above')
|
| 4307 |
+
.addClass('toolset_select2-container--' + newDirection);
|
| 4308 |
+
}
|
| 4309 |
+
|
| 4310 |
+
this.$dropdownContainer.css(css);
|
| 4311 |
+
};
|
| 4312 |
+
|
| 4313 |
+
AttachBody.prototype._resizeDropdown = function () {
|
| 4314 |
+
var css = {
|
| 4315 |
+
width: this.$container.outerWidth(false) + 'px'
|
| 4316 |
+
};
|
| 4317 |
+
|
| 4318 |
+
if (this.options.get('dropdownAutoWidth')) {
|
| 4319 |
+
css.minWidth = css.width;
|
| 4320 |
+
css.position = 'relative';
|
| 4321 |
+
css.width = 'auto';
|
| 4322 |
+
}
|
| 4323 |
+
|
| 4324 |
+
this.$dropdown.css(css);
|
| 4325 |
+
};
|
| 4326 |
+
|
| 4327 |
+
AttachBody.prototype._showDropdown = function (decorated) {
|
| 4328 |
+
this.$dropdownContainer.appendTo(this.$dropdownParent);
|
| 4329 |
+
|
| 4330 |
+
this._positionDropdown();
|
| 4331 |
+
this._resizeDropdown();
|
| 4332 |
+
};
|
| 4333 |
+
|
| 4334 |
+
return AttachBody;
|
| 4335 |
+
});
|
| 4336 |
+
|
| 4337 |
+
Toolset_S2.define('toolset_select2/dropdown/minimumResultsForSearch',[
|
| 4338 |
+
|
| 4339 |
+
], function () {
|
| 4340 |
+
function countResults (data) {
|
| 4341 |
+
var count = 0;
|
| 4342 |
+
|
| 4343 |
+
for (var d = 0; d < data.length; d++) {
|
| 4344 |
+
var item = data[d];
|
| 4345 |
+
|
| 4346 |
+
if (item.children) {
|
| 4347 |
+
count += countResults(item.children);
|
| 4348 |
+
} else {
|
| 4349 |
+
count++;
|
| 4350 |
+
}
|
| 4351 |
+
}
|
| 4352 |
+
|
| 4353 |
+
return count;
|
| 4354 |
+
}
|
| 4355 |
+
|
| 4356 |
+
function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
|
| 4357 |
+
this.minimumResultsForSearch = options.get('minimumResultsForSearch');
|
| 4358 |
+
|
| 4359 |
+
if (this.minimumResultsForSearch < 0) {
|
| 4360 |
+
this.minimumResultsForSearch = Infinity;
|
| 4361 |
+
}
|
| 4362 |
+
|
| 4363 |
+
decorated.call(this, $element, options, dataAdapter);
|
| 4364 |
+
}
|
| 4365 |
+
|
| 4366 |
+
MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
|
| 4367 |
+
if (countResults(params.data.results) < this.minimumResultsForSearch) {
|
| 4368 |
+
return false;
|
| 4369 |
+
}
|
| 4370 |
+
|
| 4371 |
+
return decorated.call(this, params);
|
| 4372 |
+
};
|
| 4373 |
+
|
| 4374 |
+
return MinimumResultsForSearch;
|
| 4375 |
+
});
|
| 4376 |
+
|
| 4377 |
+
Toolset_S2.define('toolset_select2/dropdown/selectOnClose',[
|
| 4378 |
+
|
| 4379 |
+
], function () {
|
| 4380 |
+
function SelectOnClose () { }
|
| 4381 |
+
|
| 4382 |
+
SelectOnClose.prototype.bind = function (decorated, container, $container) {
|
| 4383 |
+
var self = this;
|
| 4384 |
+
|
| 4385 |
+
decorated.call(this, container, $container);
|
| 4386 |
+
|
| 4387 |
+
container.on('close', function (params) {
|
| 4388 |
+
self._handleSelectOnClose(params);
|
| 4389 |
+
});
|
| 4390 |
+
};
|
| 4391 |
+
|
| 4392 |
+
SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
|
| 4393 |
+
if (params && params.originalSelect2Event != null) {
|
| 4394 |
+
var event = params.originalSelect2Event;
|
| 4395 |
+
|
| 4396 |
+
// Don't select an item if the close event was triggered from a select or
|
| 4397 |
+
// unselect event
|
| 4398 |
+
if (event._type === 'select' || event._type === 'unselect') {
|
| 4399 |
+
return;
|
| 4400 |
+
}
|
| 4401 |
+
}
|
| 4402 |
+
|
| 4403 |
+
var $highlightedResults = this.getHighlightedResults();
|
| 4404 |
+
|
| 4405 |
+
// Only select highlighted results
|
| 4406 |
+
if ($highlightedResults.length < 1) {
|
| 4407 |
+
return;
|
| 4408 |
+
}
|
| 4409 |
+
|
| 4410 |
+
var data = $highlightedResults.data('data');
|
| 4411 |
+
|
| 4412 |
+
// Don't re-select already selected resulte
|
| 4413 |
+
if (
|
| 4414 |
+
(data.element != null && data.element.selected) ||
|
| 4415 |
+
(data.element == null && data.selected)
|
| 4416 |
+
) {
|
| 4417 |
+
return;
|
| 4418 |
+
}
|
| 4419 |
+
|
| 4420 |
+
this.trigger('select', {
|
| 4421 |
+
data: data
|
| 4422 |
+
});
|
| 4423 |
+
};
|
| 4424 |
+
|
| 4425 |
+
return SelectOnClose;
|
| 4426 |
+
});
|
| 4427 |
+
|
| 4428 |
+
Toolset_S2.define('toolset_select2/dropdown/closeOnSelect',[
|
| 4429 |
+
|
| 4430 |
+
], function () {
|
| 4431 |
+
function CloseOnSelect () { }
|
| 4432 |
+
|
| 4433 |
+
CloseOnSelect.prototype.bind = function (decorated, container, $container) {
|
| 4434 |
+
var self = this;
|
| 4435 |
+
|
| 4436 |
+
decorated.call(this, container, $container);
|
| 4437 |
+
|
| 4438 |
+
container.on('select', function (evt) {
|
| 4439 |
+
self._selectTriggered(evt);
|
| 4440 |
+
});
|
| 4441 |
+
|
| 4442 |
+
container.on('unselect', function (evt) {
|
| 4443 |
+
self._selectTriggered(evt);
|
| 4444 |
+
});
|
| 4445 |
+
};
|
| 4446 |
+
|
| 4447 |
+
CloseOnSelect.prototype._selectTriggered = function (_, evt) {
|
| 4448 |
+
var originalEvent = evt.originalEvent;
|
| 4449 |
+
|
| 4450 |
+
// Don't close if the control key is being held
|
| 4451 |
+
if (originalEvent && originalEvent.ctrlKey) {
|
| 4452 |
+
return;
|
| 4453 |
+
}
|
| 4454 |
+
|
| 4455 |
+
this.trigger('close', {
|
| 4456 |
+
originalEvent: originalEvent,
|
| 4457 |
+
originalSelect2Event: evt
|
| 4458 |
+
});
|
| 4459 |
+
};
|
| 4460 |
+
|
| 4461 |
+
return CloseOnSelect;
|
| 4462 |
+
});
|
| 4463 |
+
|
| 4464 |
+
Toolset_S2.define('toolset_select2/i18n/en',[],function () {
|
| 4465 |
+
// English
|
| 4466 |
+
return {
|
| 4467 |
+
errorLoading: function () {
|
| 4468 |
+
return 'The results could not be loaded.';
|
| 4469 |
+
},
|
| 4470 |
+
inputTooLong: function (args) {
|
| 4471 |
+
var overChars = args.input.length - args.maximum;
|
| 4472 |
+
|
| 4473 |
+
var message = 'Please delete ' + overChars + ' character';
|
| 4474 |
+
|
| 4475 |
+
if (overChars != 1) {
|
| 4476 |
+
message += 's';
|
| 4477 |
+
}
|
| 4478 |
+
|
| 4479 |
+
return message;
|
| 4480 |
+
},
|
| 4481 |
+
inputTooShort: function (args) {
|
| 4482 |
+
var remainingChars = args.minimum - args.input.length;
|
| 4483 |
+
|
| 4484 |
+
var message = 'Please enter ' + remainingChars + ' or more characters';
|
| 4485 |
+
|
| 4486 |
+
return message;
|
| 4487 |
+
},
|
| 4488 |
+
loadingMore: function () {
|
| 4489 |
+
return 'Loading more results…';
|
| 4490 |
+
},
|
| 4491 |
+
maximumSelected: function (args) {
|
| 4492 |
+
var message = 'You can only select ' + args.maximum + ' item';
|
| 4493 |
+
|
| 4494 |
+
if (args.maximum != 1) {
|
| 4495 |
+
message += 's';
|
| 4496 |
+
}
|
| 4497 |
+
|
| 4498 |
+
return message;
|
| 4499 |
+
},
|
| 4500 |
+
noResults: function () {
|
| 4501 |
+
return 'No results found';
|
| 4502 |
+
},
|
| 4503 |
+
searching: function () {
|
| 4504 |
+
return 'Searching…';
|
| 4505 |
+
}
|
| 4506 |
+
};
|
| 4507 |
+
});
|
| 4508 |
+
|
| 4509 |
+
Toolset_S2.define('toolset_select2/defaults',[
|
| 4510 |
+
'jquery',
|
| 4511 |
+
'require',
|
| 4512 |
+
|
| 4513 |
+
'./results',
|
| 4514 |
+
|
| 4515 |
+
'./selection/single',
|
| 4516 |
+
'./selection/multiple',
|
| 4517 |
+
'./selection/placeholder',
|
| 4518 |
+
'./selection/allowClear',
|
| 4519 |
+
'./selection/search',
|
| 4520 |
+
'./selection/eventRelay',
|
| 4521 |
+
|
| 4522 |
+
'./utils',
|
| 4523 |
+
'./translation',
|
| 4524 |
+
'./diacritics',
|
| 4525 |
+
|
| 4526 |
+
'./data/select',
|
| 4527 |
+
'./data/array',
|
| 4528 |
+
'./data/ajax',
|
| 4529 |
+
'./data/tags',
|
| 4530 |
+
'./data/tokenizer',
|
| 4531 |
+
'./data/minimumInputLength',
|
| 4532 |
+
'./data/maximumInputLength',
|
| 4533 |
+
'./data/maximumSelectionLength',
|
| 4534 |
+
|
| 4535 |
+
'./dropdown',
|
| 4536 |
+
'./dropdown/search',
|
| 4537 |
+
'./dropdown/hidePlaceholder',
|
| 4538 |
+
'./dropdown/infiniteScroll',
|
| 4539 |
+
'./dropdown/attachBody',
|
| 4540 |
+
'./dropdown/minimumResultsForSearch',
|
| 4541 |
+
'./dropdown/selectOnClose',
|
| 4542 |
+
'./dropdown/closeOnSelect',
|
| 4543 |
+
|
| 4544 |
+
'./i18n/en'
|
| 4545 |
+
], function ($, require,
|
| 4546 |
+
|
| 4547 |
+
ResultsList,
|
| 4548 |
+
|
| 4549 |
+
SingleSelection, MultipleSelection, Placeholder, AllowClear,
|
| 4550 |
+
SelectionSearch, EventRelay,
|
| 4551 |
+
|
| 4552 |
+
Utils, Translation, DIACRITICS,
|
| 4553 |
+
|
| 4554 |
+
SelectData, ArrayData, AjaxData, Tags, Tokenizer,
|
| 4555 |
+
MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
|
| 4556 |
+
|
| 4557 |
+
Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
|
| 4558 |
+
AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
|
| 4559 |
+
|
| 4560 |
+
EnglishTranslation) {
|
| 4561 |
+
function Defaults () {
|
| 4562 |
+
this.reset();
|
| 4563 |
+
}
|
| 4564 |
+
|
| 4565 |
+
Defaults.prototype.apply = function (options) {
|
| 4566 |
+
options = $.extend(true, {}, this.defaults, options);
|
| 4567 |
+
|
| 4568 |
+
if (options.dataAdapter == null) {
|
| 4569 |
+
if (options.ajax != null) {
|
| 4570 |
+
options.dataAdapter = AjaxData;
|
| 4571 |
+
} else if (options.data != null) {
|
| 4572 |
+
options.dataAdapter = ArrayData;
|
| 4573 |
+
} else {
|
| 4574 |
+
options.dataAdapter = SelectData;
|
| 4575 |
+
}
|
| 4576 |
+
|
| 4577 |
+
if (options.minimumInputLength > 0) {
|
| 4578 |
+
options.dataAdapter = Utils.Decorate(
|
| 4579 |
+
options.dataAdapter,
|
| 4580 |
+
MinimumInputLength
|
| 4581 |
+
);
|
| 4582 |
+
}
|
| 4583 |
+
|
| 4584 |
+
if (options.maximumInputLength > 0) {
|
| 4585 |
+
options.dataAdapter = Utils.Decorate(
|
| 4586 |
+
options.dataAdapter,
|
| 4587 |
+
MaximumInputLength
|
| 4588 |
+
);
|
| 4589 |
+
}
|
| 4590 |
+
|
| 4591 |
+
if (options.maximumSelectionLength > 0) {
|
| 4592 |
+
options.dataAdapter = Utils.Decorate(
|
| 4593 |
+
options.dataAdapter,
|
| 4594 |
+
MaximumSelectionLength
|
| 4595 |
+
);
|
| 4596 |
+
}
|
| 4597 |
+
|
| 4598 |
+
if (options.tags) {
|
| 4599 |
+
options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
|
| 4600 |
+
}
|
| 4601 |
+
|
| 4602 |
+
if (options.tokenSeparators != null || options.tokenizer != null) {
|
| 4603 |
+
options.dataAdapter = Utils.Decorate(
|
| 4604 |
+
options.dataAdapter,
|
| 4605 |
+
Tokenizer
|
| 4606 |
+
);
|
| 4607 |
+
}
|
| 4608 |
+
|
| 4609 |
+
if (options.query != null) {
|
| 4610 |
+
var Query = require(options.amdBase + 'compat/query');
|
| 4611 |
+
|
| 4612 |
+
options.dataAdapter = Utils.Decorate(
|
| 4613 |
+
options.dataAdapter,
|
| 4614 |
+
Query
|
| 4615 |
+
);
|
| 4616 |
+
}
|
| 4617 |
+
|
| 4618 |
+
if (options.initSelection != null) {
|
| 4619 |
+
var InitSelection = require(options.amdBase + 'compat/initSelection');
|
| 4620 |
+
|
| 4621 |
+
options.dataAdapter = Utils.Decorate(
|
| 4622 |
+
options.dataAdapter,
|
| 4623 |
+
InitSelection
|
| 4624 |
+
);
|
| 4625 |
+
}
|
| 4626 |
+
}
|
| 4627 |
+
|
| 4628 |
+
if (options.resultsAdapter == null) {
|
| 4629 |
+
options.resultsAdapter = ResultsList;
|
| 4630 |
+
|
| 4631 |
+
if (options.ajax != null) {
|
| 4632 |
+
options.resultsAdapter = Utils.Decorate(
|
| 4633 |
+
options.resultsAdapter,
|
| 4634 |
+
InfiniteScroll
|
| 4635 |
+
);
|
| 4636 |
+
}
|
| 4637 |
+
|
| 4638 |
+
if (options.placeholder != null) {
|
| 4639 |
+
options.resultsAdapter = Utils.Decorate(
|
| 4640 |
+
options.resultsAdapter,
|
| 4641 |
+
HidePlaceholder
|
| 4642 |
+
);
|
| 4643 |
+
}
|
| 4644 |
+
|
| 4645 |
+
if (options.selectOnClose) {
|
| 4646 |
+
options.resultsAdapter = Utils.Decorate(
|
| 4647 |
+
options.resultsAdapter,
|
| 4648 |
+
SelectOnClose
|
| 4649 |
+
);
|
| 4650 |
+
}
|
| 4651 |
+
}
|
| 4652 |
+
|
| 4653 |
+
if (options.dropdownAdapter == null) {
|
| 4654 |
+
if (options.multiple) {
|
| 4655 |
+
options.dropdownAdapter = Dropdown;
|
| 4656 |
+
} else {
|
| 4657 |
+
var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
|
| 4658 |
+
|
| 4659 |
+
options.dropdownAdapter = SearchableDropdown;
|
| 4660 |
+
}
|
| 4661 |
+
|
| 4662 |
+
if (options.minimumResultsForSearch !== 0) {
|
| 4663 |
+
options.dropdownAdapter = Utils.Decorate(
|
| 4664 |
+
options.dropdownAdapter,
|
| 4665 |
+
MinimumResultsForSearch
|
| 4666 |
+
);
|
| 4667 |
+
}
|
| 4668 |
+
|
| 4669 |
+
if (options.closeOnSelect) {
|
| 4670 |
+
options.dropdownAdapter = Utils.Decorate(
|
| 4671 |
+
options.dropdownAdapter,
|
| 4672 |
+
CloseOnSelect
|
| 4673 |
+
);
|
| 4674 |
+
}
|
| 4675 |
+
|
| 4676 |
+
if (
|
| 4677 |
+
options.dropdownCssClass != null ||
|
| 4678 |
+
options.dropdownCss != null ||
|
| 4679 |
+
options.adaptDropdownCssClass != null
|
| 4680 |
+
) {
|
| 4681 |
+
var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
|
| 4682 |
+
|
| 4683 |
+
options.dropdownAdapter = Utils.Decorate(
|
| 4684 |
+
options.dropdownAdapter,
|
| 4685 |
+
DropdownCSS
|
| 4686 |
+
);
|
| 4687 |
+
}
|
| 4688 |
+
|
| 4689 |
+
options.dropdownAdapter = Utils.Decorate(
|
| 4690 |
+
options.dropdownAdapter,
|
| 4691 |
+
AttachBody
|
| 4692 |
+
);
|
| 4693 |
+
}
|
| 4694 |
+
|
| 4695 |
+
if (options.selectionAdapter == null) {
|
| 4696 |
+
if (options.multiple) {
|
| 4697 |
+
options.selectionAdapter = MultipleSelection;
|
| 4698 |
+
} else {
|
| 4699 |
+
options.selectionAdapter = SingleSelection;
|
| 4700 |
+
}
|
| 4701 |
+
|
| 4702 |
+
// Add the placeholder mixin if a placeholder was specified
|
| 4703 |
+
if (options.placeholder != null) {
|
| 4704 |
+
options.selectionAdapter = Utils.Decorate(
|
| 4705 |
+
options.selectionAdapter,
|
| 4706 |
+
Placeholder
|
| 4707 |
+
);
|
| 4708 |
+
}
|
| 4709 |
+
|
| 4710 |
+
if (options.allowClear) {
|
| 4711 |
+
options.selectionAdapter = Utils.Decorate(
|
| 4712 |
+
options.selectionAdapter,
|
| 4713 |
+
AllowClear
|
| 4714 |
+
);
|
| 4715 |
+
}
|
| 4716 |
+
|
| 4717 |
+
if (options.multiple) {
|
| 4718 |
+
options.selectionAdapter = Utils.Decorate(
|
| 4719 |
+
options.selectionAdapter,
|
| 4720 |
+
SelectionSearch
|
| 4721 |
+
);
|
| 4722 |
+
}
|
| 4723 |
+
|
| 4724 |
+
if (
|
| 4725 |
+
options.containerCssClass != null ||
|
| 4726 |
+
options.containerCss != null ||
|
| 4727 |
+
options.adaptContainerCssClass != null
|
| 4728 |
+
) {
|
| 4729 |
+
var ContainerCSS = require(options.amdBase + 'compat/containerCss');
|
| 4730 |
+
|
| 4731 |
+
options.selectionAdapter = Utils.Decorate(
|
| 4732 |
+
options.selectionAdapter,
|
| 4733 |
+
ContainerCSS
|
| 4734 |
+
);
|
| 4735 |
+
}
|
| 4736 |
+
|
| 4737 |
+
options.selectionAdapter = Utils.Decorate(
|
| 4738 |
+
options.selectionAdapter,
|
| 4739 |
+
EventRelay
|
| 4740 |
+
);
|
| 4741 |
+
}
|
| 4742 |
+
|
| 4743 |
+
if (typeof options.language === 'string') {
|
| 4744 |
+
// Check if the language is specified with a region
|
| 4745 |
+
if (options.language.indexOf('-') > 0) {
|
| 4746 |
+
// Extract the region information if it is included
|
| 4747 |
+
var languageParts = options.language.split('-');
|
| 4748 |
+
var baseLanguage = languageParts[0];
|
| 4749 |
+
|
| 4750 |
+
options.language = [options.language, baseLanguage];
|
| 4751 |
+
} else {
|
| 4752 |
+
options.language = [options.language];
|
| 4753 |
+
}
|
| 4754 |
+
}
|
| 4755 |
+
|
| 4756 |
+
if ($.isArray(options.language)) {
|
| 4757 |
+
var languages = new Translation();
|
| 4758 |
+
options.language.push('en');
|
| 4759 |
+
|
| 4760 |
+
var languageNames = options.language;
|
| 4761 |
+
|
| 4762 |
+
for (var l = 0; l < languageNames.length; l++) {
|
| 4763 |
+
var name = languageNames[l];
|
| 4764 |
+
var language = {};
|
| 4765 |
+
|
| 4766 |
+
try {
|
| 4767 |
+
// Try to load it with the original name
|
| 4768 |
+
language = Translation.loadPath(name);
|
| 4769 |
+
} catch (e) {
|
| 4770 |
+
try {
|
| 4771 |
+
// If we couldn't load it, check if it wasn't the full path
|
| 4772 |
+
name = this.defaults.amdLanguageBase + name;
|
| 4773 |
+
language = Translation.loadPath(name);
|
| 4774 |
+
} catch (ex) {
|
| 4775 |
+
// The translation could not be loaded at all. Sometimes this is
|
| 4776 |
+
// because of a configuration problem, other times this can be
|
| 4777 |
+
// because of how Select2 helps load all possible translation files.
|
| 4778 |
+
if (options.debug && window.console && console.warn) {
|
| 4779 |
+
console.warn(
|
| 4780 |
+
'Select2: The language file for "' + name + '" could not be ' +
|
| 4781 |
+
'automatically loaded. A fallback will be used instead.'
|
| 4782 |
+
);
|
| 4783 |
+
}
|
| 4784 |
+
|
| 4785 |
+
continue;
|
| 4786 |
+
}
|
| 4787 |
+
}
|
| 4788 |
+
|
| 4789 |
+
languages.extend(language);
|
| 4790 |
+
}
|
| 4791 |
+
|
| 4792 |
+
options.translations = languages;
|
| 4793 |
+
} else {
|
| 4794 |
+
var baseTranslation = Translation.loadPath(
|
| 4795 |
+
this.defaults.amdLanguageBase + 'en'
|
| 4796 |
+
);
|
| 4797 |
+
var customTranslation = new Translation(options.language);
|
| 4798 |
+
|
| 4799 |
+
customTranslation.extend(baseTranslation);
|
| 4800 |
+
|
| 4801 |
+
options.translations = customTranslation;
|
| 4802 |
+
}
|
| 4803 |
+
|
| 4804 |
+
return options;
|
| 4805 |
+
};
|
| 4806 |
+
|
| 4807 |
+
Defaults.prototype.reset = function () {
|
| 4808 |
+
function stripDiacritics (text) {
|
| 4809 |
+
// Used 'uni range + named function' from http://jsperf.com/diacritics/18
|
| 4810 |
+
function match(a) {
|
| 4811 |
+
return DIACRITICS[a] || a;
|
| 4812 |
+
}
|
| 4813 |
+
|
| 4814 |
+
return text.replace(/[^\u0000-\u007E]/g, match);
|
| 4815 |
+
}
|
| 4816 |
+
|
| 4817 |
+
function matcher (params, data) {
|
| 4818 |
+
// Always return the object if there is nothing to compare
|
| 4819 |
+
if ($.trim(params.term) === '') {
|
| 4820 |
+
return data;
|
| 4821 |
+
}
|
| 4822 |
+
|
| 4823 |
+
// Do a recursive check for options with children
|
| 4824 |
+
if (data.children && data.children.length > 0) {
|
| 4825 |
+
// Clone the data object if there are children
|
| 4826 |
+
// This is required as we modify the object to remove any non-matches
|
| 4827 |
+
var match = $.extend(true, {}, data);
|
| 4828 |
+
|
| 4829 |
+
// Check each child of the option
|
| 4830 |
+
for (var c = data.children.length - 1; c >= 0; c--) {
|
| 4831 |
+
var child = data.children[c];
|
| 4832 |
+
|
| 4833 |
+
var matches = matcher(params, child);
|
| 4834 |
+
|
| 4835 |
+
// If there wasn't a match, remove the object in the array
|
| 4836 |
+
if (matches == null) {
|
| 4837 |
+
match.children.splice(c, 1);
|
| 4838 |
+
}
|
| 4839 |
+
}
|
| 4840 |
+
|
| 4841 |
+
// If any children matched, return the new object
|
| 4842 |
+
if (match.children.length > 0) {
|
| 4843 |
+
return match;
|
| 4844 |
+
}
|
| 4845 |
+
|
| 4846 |
+
// If there were no matching children, check just the plain object
|
| 4847 |
+
return matcher(params, match);
|
| 4848 |
+
}
|
| 4849 |
+
|
| 4850 |
+
var original = stripDiacritics(data.text).toUpperCase();
|
| 4851 |
+
var term = stripDiacritics(params.term).toUpperCase();
|
| 4852 |
+
|
| 4853 |
+
// Check if the text contains the term
|
| 4854 |
+
if (original.indexOf(term) > -1) {
|
| 4855 |
+
return data;
|
| 4856 |
+
}
|
| 4857 |
+
|
| 4858 |
+
// If it doesn't contain the term, don't return anything
|
| 4859 |
+
return null;
|
| 4860 |
+
}
|
| 4861 |
+
|
| 4862 |
+
this.defaults = {
|
| 4863 |
+
amdBase: './',
|
| 4864 |
+
amdLanguageBase: './i18n/',
|
| 4865 |
+
closeOnSelect: true,
|
| 4866 |
+
debug: false,
|
| 4867 |
+
dropdownAutoWidth: false,
|
| 4868 |
+
escapeMarkup: Utils.escapeMarkup,
|
| 4869 |
+
language: EnglishTranslation,
|
| 4870 |
+
matcher: matcher,
|
| 4871 |
+
minimumInputLength: 0,
|
| 4872 |
+
maximumInputLength: 0,
|
| 4873 |
+
maximumSelectionLength: 0,
|
| 4874 |
+
minimumResultsForSearch: 0,
|
| 4875 |
+
selectOnClose: false,
|
| 4876 |
+
sorter: function (data) {
|
| 4877 |
+
return data;
|
| 4878 |
+
},
|
| 4879 |
+
templateResult: function (result) {
|
| 4880 |
+
return result.text;
|
| 4881 |
+
},
|
| 4882 |
+
templateSelection: function (selection) {
|
| 4883 |
+
return selection.text;
|
| 4884 |
+
},
|
| 4885 |
+
theme: 'default',
|
| 4886 |
+
width: 'resolve'
|
| 4887 |
+
};
|
| 4888 |
+
};
|
| 4889 |
+
|
| 4890 |
+
Defaults.prototype.set = function (key, value) {
|
| 4891 |
+
var camelKey = $.camelCase(key);
|
| 4892 |
+
|
| 4893 |
+
var data = {};
|
| 4894 |
+
data[camelKey] = value;
|
| 4895 |
+
|
| 4896 |
+
var convertedData = Utils._convertData(data);
|
| 4897 |
+
|
| 4898 |
+
$.extend(this.defaults, convertedData);
|
| 4899 |
+
};
|
| 4900 |
+
|
| 4901 |
+
var defaults = new Defaults();
|
| 4902 |
+
|
| 4903 |
+
return defaults;
|
| 4904 |
+
});
|
| 4905 |
+
|
| 4906 |
+
Toolset_S2.define('toolset_select2/options',[
|
| 4907 |
+
'require',
|
| 4908 |
+
'jquery',
|
| 4909 |
+
'./defaults',
|
| 4910 |
+
'./utils'
|
| 4911 |
+
], function (require, $, Defaults, Utils) {
|
| 4912 |
+
function Options (options, $element) {
|
| 4913 |
+
this.options = options;
|
| 4914 |
+
|
| 4915 |
+
if ($element != null) {
|
| 4916 |
+
this.fromElement($element);
|
| 4917 |
+
}
|
| 4918 |
+
|
| 4919 |
+
this.options = Defaults.apply(this.options);
|
| 4920 |
+
|
| 4921 |
+
if ($element && $element.is('input')) {
|
| 4922 |
+
var InputCompat = require(this.get('amdBase') + 'compat/inputData');
|
| 4923 |
+
|
| 4924 |
+
this.options.dataAdapter = Utils.Decorate(
|
| 4925 |
+
this.options.dataAdapter,
|
| 4926 |
+
InputCompat
|
| 4927 |
+
);
|
| 4928 |
+
}
|
| 4929 |
+
}
|
| 4930 |
+
|
| 4931 |
+
Options.prototype.fromElement = function ($e) {
|
| 4932 |
+
var excludedData = ['toolset_select2'];
|
| 4933 |
+
|
| 4934 |
+
if (this.options.multiple == null) {
|
| 4935 |
+
this.options.multiple = $e.prop('multiple');
|
| 4936 |
+
}
|
| 4937 |
+
|
| 4938 |
+
if (this.options.disabled == null) {
|
| 4939 |
+
this.options.disabled = $e.prop('disabled');
|
| 4940 |
+
}
|
| 4941 |
+
|
| 4942 |
+
if (this.options.language == null) {
|
| 4943 |
+
if ($e.prop('lang')) {
|
| 4944 |
+
this.options.language = $e.prop('lang').toLowerCase();
|
| 4945 |
+
} else if ($e.closest('[lang]').prop('lang')) {
|
| 4946 |
+
this.options.language = $e.closest('[lang]').prop('lang');
|
| 4947 |
+
}
|
| 4948 |
+
}
|
| 4949 |
+
|
| 4950 |
+
if (this.options.dir == null) {
|
| 4951 |
+
if ($e.prop('dir')) {
|
| 4952 |
+
this.options.dir = $e.prop('dir');
|
| 4953 |
+
} else if ($e.closest('[dir]').prop('dir')) {
|
| 4954 |
+
this.options.dir = $e.closest('[dir]').prop('dir');
|
| 4955 |
+
} else {
|
| 4956 |
+
this.options.dir = 'ltr';
|
| 4957 |
+
}
|
| 4958 |
+
}
|
| 4959 |
+
|
| 4960 |
+
$e.prop('disabled', this.options.disabled);
|
| 4961 |
+
$e.prop('multiple', this.options.multiple);
|
| 4962 |
+
|
| 4963 |
+
if ($e.data('toolset_select2Tags')) {
|
| 4964 |
+
if (this.options.debug && window.console && console.warn) {
|
| 4965 |
+
console.warn(
|
| 4966 |
+
'Select2: The `data-toolset_select2-tags` attribute has been changed to ' +
|
| 4967 |
+
'use the `data-data` and `data-tags="true"` attributes and will be ' +
|
| 4968 |
+
'removed in future versions of Select2.'
|
| 4969 |
+
);
|
| 4970 |
+
}
|
| 4971 |
+
|
| 4972 |
+
$e.data('data', $e.data('toolset_select2Tags'));
|
| 4973 |
+
$e.data('tags', true);
|
| 4974 |
+
}
|
| 4975 |
+
|
| 4976 |
+
if ($e.data('ajaxUrl')) {
|
| 4977 |
+
if (this.options.debug && window.console && console.warn) {
|
| 4978 |
+
console.warn(
|
| 4979 |
+
'Select2: The `data-ajax-url` attribute has been changed to ' +
|
| 4980 |
+
'`data-ajax--url` and support for the old attribute will be removed' +
|
| 4981 |
+
' in future versions of Select2.'
|
| 4982 |
+
);
|
| 4983 |
+
}
|
| 4984 |
+
|
| 4985 |
+
$e.attr('ajax--url', $e.data('ajaxUrl'));
|
| 4986 |
+
$e.data('ajax--url', $e.data('ajaxUrl'));
|
| 4987 |
+
}
|
| 4988 |
+
|
| 4989 |
+
var dataset = {};
|
| 4990 |
+
|
| 4991 |
+
// Prefer the element's `dataset` attribute if it exists
|
| 4992 |
+
// jQuery 1.x does not correctly handle data attributes with multiple dashes
|
| 4993 |
+
if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
|
| 4994 |
+
dataset = $.extend(true, {}, $e[0].dataset, $e.data());
|
| 4995 |
+
} else {
|
| 4996 |
+
dataset = $e.data();
|
| 4997 |
+
}
|
| 4998 |
+
|
| 4999 |
+
var data = $.extend(true, {}, dataset);
|
| 5000 |
+
|
| 5001 |
+
data = Utils._convertData(data);
|
| 5002 |
+
|
| 5003 |
+
for (var key in data) {
|
| 5004 |
+
if ($.inArray(key, excludedData) > -1) {
|
| 5005 |
+
continue;
|
| 5006 |
+
}
|
| 5007 |
+
|
| 5008 |
+
if ($.isPlainObject(this.options[key])) {
|
| 5009 |
+
$.extend(this.options[key], data[key]);
|
| 5010 |
+
} else {
|
| 5011 |
+
this.options[key] = data[key];
|
| 5012 |
+
}
|
| 5013 |
+
}
|
| 5014 |
+
|
| 5015 |
+
return this;
|
| 5016 |
+
};
|
| 5017 |
+
|
| 5018 |
+
Options.prototype.get = function (key) {
|
| 5019 |
+
return this.options[key];
|
| 5020 |
+
};
|
| 5021 |
+
|
| 5022 |
+
Options.prototype.set = function (key, val) {
|
| 5023 |
+
this.options[key] = val;
|
| 5024 |
+
};
|
| 5025 |
+
|
| 5026 |
+
return Options;
|
| 5027 |
+
});
|
| 5028 |
+
|
| 5029 |
+
Toolset_S2.define('toolset_select2/core',[
|
| 5030 |
+
'jquery',
|
| 5031 |
+
'./options',
|
| 5032 |
+
'./utils',
|
| 5033 |
+
'./keys'
|
| 5034 |
+
], function ($, Options, Utils, KEYS) {
|
| 5035 |
+
var Select2 = function ($element, options) {
|
| 5036 |
+
if ($element.data('toolset_select2') != null) {
|
| 5037 |
+
$element.data('toolset_select2').destroy();
|
| 5038 |
+
}
|
| 5039 |
+
|
| 5040 |
+
this.$element = $element;
|
| 5041 |
+
|
| 5042 |
+
this.id = this._generateId($element);
|
| 5043 |
+
|
| 5044 |
+
options = options || {};
|
| 5045 |
+
|
| 5046 |
+
this.options = new Options(options, $element);
|
| 5047 |
+
|
| 5048 |
+
Select2.__super__.constructor.call(this);
|
| 5049 |
+
|
| 5050 |
+
// Set up the tabindex
|
| 5051 |
+
|
| 5052 |
+
var tabindex = $element.attr('tabindex') || 0;
|
| 5053 |
+
$element.data('old-tabindex', tabindex);
|
| 5054 |
+
$element.attr('tabindex', '-1');
|
| 5055 |
+
|
| 5056 |
+
// Set up containers and adapters
|
| 5057 |
+
|
| 5058 |
+
var DataAdapter = this.options.get('dataAdapter');
|
| 5059 |
+
this.dataAdapter = new DataAdapter($element, this.options);
|
| 5060 |
+
|
| 5061 |
+
var $container = this.render();
|
| 5062 |
+
|
| 5063 |
+
this._placeContainer($container);
|
| 5064 |
+
|
| 5065 |
+
var SelectionAdapter = this.options.get('selectionAdapter');
|
| 5066 |
+
this.selection = new SelectionAdapter($element, this.options);
|
| 5067 |
+
this.$selection = this.selection.render();
|
| 5068 |
+
|
| 5069 |
+
this.selection.position(this.$selection, $container);
|
| 5070 |
+
|
| 5071 |
+
var DropdownAdapter = this.options.get('dropdownAdapter');
|
| 5072 |
+
this.dropdown = new DropdownAdapter($element, this.options);
|
| 5073 |
+
this.$dropdown = this.dropdown.render();
|
| 5074 |
+
|
| 5075 |
+
this.dropdown.position(this.$dropdown, $container);
|
| 5076 |
+
|
| 5077 |
+
var ResultsAdapter = this.options.get('resultsAdapter');
|
| 5078 |
+
this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
|
| 5079 |
+
this.$results = this.results.render();
|
| 5080 |
+
|
| 5081 |
+
this.results.position(this.$results, this.$dropdown);
|
| 5082 |
+
|
| 5083 |
+
// Bind events
|
| 5084 |
+
|
| 5085 |
+
var self = this;
|
| 5086 |
+
|
| 5087 |
+
// Bind the container to all of the adapters
|
| 5088 |
+
this._bindAdapters();
|
| 5089 |
+
|
| 5090 |
+
// Register any DOM event handlers
|
| 5091 |
+
this._registerDomEvents();
|
| 5092 |
+
|
| 5093 |
+
// Register any internal event handlers
|
| 5094 |
+
this._registerDataEvents();
|
| 5095 |
+
this._registerSelectionEvents();
|
| 5096 |
+
this._registerDropdownEvents();
|
| 5097 |
+
this._registerResultsEvents();
|
| 5098 |
+
this._registerEvents();
|
| 5099 |
+
|
| 5100 |
+
// Set the initial state
|
| 5101 |
+
this.dataAdapter.current(function (initialData) {
|
| 5102 |
+
self.trigger('selection:update', {
|
| 5103 |
+
data: initialData
|
| 5104 |
+
});
|
| 5105 |
+
});
|
| 5106 |
+
|
| 5107 |
+
// Hide the original select
|
| 5108 |
+
$element.addClass('toolset_select2-hidden-accessible');
|
| 5109 |
+
$element.attr('aria-hidden', 'true');
|
| 5110 |
+
|
| 5111 |
+
// Synchronize any monitored attributes
|
| 5112 |
+
this._syncAttributes();
|
| 5113 |
+
|
| 5114 |
+
$element.data('toolset_select2', this);
|
| 5115 |
+
};
|
| 5116 |
+
|
| 5117 |
+
Utils.Extend(Select2, Utils.Observable);
|
| 5118 |
+
|
| 5119 |
+
Select2.prototype._generateId = function ($element) {
|
| 5120 |
+
var id = '';
|
| 5121 |
+
|
| 5122 |
+
if ($element.attr('id') != null) {
|
| 5123 |
+
id = $element.attr('id');
|
| 5124 |
+
} else if ($element.attr('name') != null) {
|
| 5125 |
+
id = $element.attr('name') + '-' + Utils.generateChars(2);
|
| 5126 |
+
} else {
|
| 5127 |
+
id = Utils.generateChars(4);
|
| 5128 |
+
}
|
| 5129 |
+
|
| 5130 |
+
id = id.replace(/(:|\.|\[|\]|,)/g, '');
|
| 5131 |
+
id = 'toolset_select2-' + id;
|
| 5132 |
+
|
| 5133 |
+
return id;
|
| 5134 |
+
};
|
| 5135 |
+
|
| 5136 |
+
Select2.prototype._placeContainer = function ($container) {
|
| 5137 |
+
$container.insertAfter(this.$element);
|
| 5138 |
+
|
| 5139 |
+
var width = this._resolveWidth(this.$element, this.options.get('width'));
|
| 5140 |
+
|
| 5141 |
+
if (width != null) {
|
| 5142 |
+
$container.css('width', width);
|
| 5143 |
+
}
|
| 5144 |
+
};
|
| 5145 |
+
|
| 5146 |
+
Select2.prototype._resolveWidth = function ($element, method) {
|
| 5147 |
+
var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
|
| 5148 |
+
|
| 5149 |
+
if (method == 'resolve') {
|
| 5150 |
+
var styleWidth = this._resolveWidth($element, 'style');
|
| 5151 |
+
|
| 5152 |
+
if (styleWidth != null) {
|
| 5153 |
+
return styleWidth;
|
| 5154 |
+
}
|
| 5155 |
+
|
| 5156 |
+
return this._resolveWidth($element, 'element');
|
| 5157 |
+
}
|
| 5158 |
+
|
| 5159 |
+
if (method == 'element') {
|
| 5160 |
+
var elementWidth = $element.outerWidth(false);
|
| 5161 |
+
|
| 5162 |
+
if (elementWidth <= 0) {
|
| 5163 |
+
return 'auto';
|
| 5164 |
+
}
|
| 5165 |
+
|
| 5166 |
+
return elementWidth + 'px';
|
| 5167 |
+
}
|
| 5168 |
+
|
| 5169 |
+
if (method == 'style') {
|
| 5170 |
+
var style = $element.attr('style');
|
| 5171 |
+
|
| 5172 |
+
if (typeof(style) !== 'string') {
|
| 5173 |
+
return null;
|
| 5174 |
+
}
|
| 5175 |
+
|
| 5176 |
+
var attrs = style.split(';');
|
| 5177 |
+
|
| 5178 |
+
for (var i = 0, l = attrs.length; i < l; i = i + 1) {
|
| 5179 |
+
var attr = attrs[i].replace(/\s/g, '');
|
| 5180 |
+
var matches = attr.match(WIDTH);
|
| 5181 |
+
|
| 5182 |
+
if (matches !== null && matches.length >= 1) {
|
| 5183 |
+
return matches[1];
|
| 5184 |
+
}
|
| 5185 |
+
}
|
| 5186 |
+
|
| 5187 |
+
return null;
|
| 5188 |
+
}
|
| 5189 |
+
|
| 5190 |
+
return method;
|
| 5191 |
+
};
|
| 5192 |
+
|
| 5193 |
+
Select2.prototype._bindAdapters = function () {
|
| 5194 |
+
this.dataAdapter.bind(this, this.$container);
|
| 5195 |
+
this.selection.bind(this, this.$container);
|
| 5196 |
+
|
| 5197 |
+
this.dropdown.bind(this, this.$container);
|
| 5198 |
+
this.results.bind(this, this.$container);
|
| 5199 |
+
};
|
| 5200 |
+
|
| 5201 |
+
Select2.prototype._registerDomEvents = function () {
|
| 5202 |
+
var self = this;
|
| 5203 |
+
|
| 5204 |
+
this.$element.on('change.toolset_select2', function () {
|
| 5205 |
+
self.dataAdapter.current(function (data) {
|
| 5206 |
+
self.trigger('selection:update', {
|
| 5207 |
+
data: data
|
| 5208 |
+
});
|
| 5209 |
+
});
|
| 5210 |
+
});
|
| 5211 |
+
|
| 5212 |
+
this.$element.on('focus.toolset_select2', function (evt) {
|
| 5213 |
+
self.trigger('focus', evt);
|
| 5214 |
+
});
|
| 5215 |
+
|
| 5216 |
+
this._syncA = Utils.bind(this._syncAttributes, this);
|
| 5217 |
+
this._syncS = Utils.bind(this._syncSubtree, this);
|
| 5218 |
+
|
| 5219 |
+
if (this.$element[0].attachEvent) {
|
| 5220 |
+
this.$element[0].attachEvent('onpropertychange', this._syncA);
|
| 5221 |
+
}
|
| 5222 |
+
|
| 5223 |
+
var observer = window.MutationObserver ||
|
| 5224 |
+
window.WebKitMutationObserver ||
|
| 5225 |
+
window.MozMutationObserver
|
| 5226 |
+
;
|
| 5227 |
+
|
| 5228 |
+
if (observer != null) {
|
| 5229 |
+
this._observer = new observer(function (mutations) {
|
| 5230 |
+
$.each(mutations, self._syncA);
|
| 5231 |
+
$.each(mutations, self._syncS);
|
| 5232 |
+
});
|
| 5233 |
+
this._observer.observe(this.$element[0], {
|
| 5234 |
+
attributes: true,
|
| 5235 |
+
childList: true,
|
| 5236 |
+
subtree: false
|
| 5237 |
+
});
|
| 5238 |
+
} else if (this.$element[0].addEventListener) {
|
| 5239 |
+
this.$element[0].addEventListener(
|
| 5240 |
+
'DOMAttrModified',
|
| 5241 |
+
self._syncA,
|
| 5242 |
+
false
|
| 5243 |
+
);
|
| 5244 |
+
this.$element[0].addEventListener(
|
| 5245 |
+
'DOMNodeInserted',
|
| 5246 |
+
self._syncS,
|
| 5247 |
+
false
|
| 5248 |
+
);
|
| 5249 |
+
this.$element[0].addEventListener(
|
| 5250 |
+
'DOMNodeRemoved',
|
| 5251 |
+
self._syncS,
|
| 5252 |
+
false
|
| 5253 |
+
);
|
| 5254 |
+
}
|
| 5255 |
+
};
|
| 5256 |
+
|
| 5257 |
+
Select2.prototype._registerDataEvents = function () {
|
| 5258 |
+
var self = this;
|
| 5259 |
+
|
| 5260 |
+
this.dataAdapter.on('*', function (name, params) {
|
| 5261 |
+
self.trigger(name, params);
|
| 5262 |
+
});
|
| 5263 |
+
};
|
| 5264 |
+
|
| 5265 |
+
Select2.prototype._registerSelectionEvents = function () {
|
| 5266 |
+
var self = this;
|
| 5267 |
+
var nonRelayEvents = ['toggle', 'focus'];
|
| 5268 |
+
|
| 5269 |
+
this.selection.on('toggle', function () {
|
| 5270 |
+
self.toggleDropdown();
|
| 5271 |
+
});
|
| 5272 |
+
|
| 5273 |
+
this.selection.on('focus', function (params) {
|
| 5274 |
+
self.focus(params);
|
| 5275 |
+
});
|
| 5276 |
+
|
| 5277 |
+
this.selection.on('*', function (name, params) {
|
| 5278 |
+
if ($.inArray(name, nonRelayEvents) !== -1) {
|
| 5279 |
+
return;
|
| 5280 |
+
}
|
| 5281 |
+
|
| 5282 |
+
self.trigger(name, params);
|
| 5283 |
+
});
|
| 5284 |
+
};
|
| 5285 |
+
|
| 5286 |
+
Select2.prototype._registerDropdownEvents = function () {
|
| 5287 |
+
var self = this;
|
| 5288 |
+
|
| 5289 |
+
this.dropdown.on('*', function (name, params) {
|
| 5290 |
+
self.trigger(name, params);
|
| 5291 |
+
});
|
| 5292 |
+
};
|
| 5293 |
+
|
| 5294 |
+
Select2.prototype._registerResultsEvents = function () {
|
| 5295 |
+
var self = this;
|
| 5296 |
+
|
| 5297 |
+
this.results.on('*', function (name, params) {
|
| 5298 |
+
self.trigger(name, params);
|
| 5299 |
+
});
|
| 5300 |
+
};
|
| 5301 |
+
|
| 5302 |
+
Select2.prototype._registerEvents = function () {
|
| 5303 |
+
var self = this;
|
| 5304 |
+
|
| 5305 |
+
this.on('open', function () {
|
| 5306 |
+
self.$container.addClass('toolset_select2-container--open');
|
| 5307 |
+
});
|
| 5308 |
+
|
| 5309 |
+
this.on('close', function () {
|
| 5310 |
+
self.$container.removeClass('toolset_select2-container--open');
|
| 5311 |
+
});
|
| 5312 |
+
|
| 5313 |
+
this.on('enable', function () {
|
| 5314 |
+
self.$container.removeClass('toolset_select2-container--disabled');
|
| 5315 |
+
});
|
| 5316 |
+
|
| 5317 |
+
this.on('disable', function () {
|
| 5318 |
+
self.$container.addClass('toolset_select2-container--disabled');
|
| 5319 |
+
});
|
| 5320 |
+
|
| 5321 |
+
this.on('blur', function () {
|
| 5322 |
+
self.$container.removeClass('toolset_select2-container--focus');
|
| 5323 |
+
});
|
| 5324 |
+
|
| 5325 |
+
this.on('query', function (params) {
|
| 5326 |
+
if (!self.isOpen()) {
|
| 5327 |
+
self.trigger('open', {});
|
| 5328 |
+
}
|
| 5329 |
+
|
| 5330 |
+
this.dataAdapter.query(params, function (data) {
|
| 5331 |
+
self.trigger('results:all', {
|
| 5332 |
+
data: data,
|
| 5333 |
+
query: params
|
| 5334 |
+
});
|
| 5335 |
+
});
|
| 5336 |
+
});
|
| 5337 |
+
|
| 5338 |
+
this.on('query:append', function (params) {
|
| 5339 |
+
this.dataAdapter.query(params, function (data) {
|
| 5340 |
+
self.trigger('results:append', {
|
| 5341 |
+
data: data,
|
| 5342 |
+
query: params
|
| 5343 |
+
});
|
| 5344 |
+
});
|
| 5345 |
+
});
|
| 5346 |
+
|
| 5347 |
+
this.on('keypress', function (evt) {
|
| 5348 |
+
var key = evt.which;
|
| 5349 |
+
|
| 5350 |
+
if (self.isOpen()) {
|
| 5351 |
+
if (key === KEYS.ESC || key === KEYS.TAB ||
|
| 5352 |
+
(key === KEYS.UP && evt.altKey)) {
|
| 5353 |
+
self.close();
|
| 5354 |
+
|
| 5355 |
+
evt.preventDefault();
|
| 5356 |
+
} else if (key === KEYS.ENTER) {
|
| 5357 |
+
self.trigger('results:select', {});
|
| 5358 |
+
|
| 5359 |
+
evt.preventDefault();
|
| 5360 |
+
} else if ((key === KEYS.SPACE && evt.ctrlKey)) {
|
| 5361 |
+
self.trigger('results:toggle', {});
|
| 5362 |
+
|
| 5363 |
+
evt.preventDefault();
|
| 5364 |
+
} else if (key === KEYS.UP) {
|
| 5365 |
+
self.trigger('results:previous', {});
|
| 5366 |
+
|
| 5367 |
+
evt.preventDefault();
|
| 5368 |
+
} else if (key === KEYS.DOWN) {
|
| 5369 |
+
self.trigger('results:next', {});
|
| 5370 |
+
|
| 5371 |
+
evt.preventDefault();
|
| 5372 |
+
}
|
| 5373 |
+
} else {
|
| 5374 |
+
if (key === KEYS.ENTER || key === KEYS.SPACE ||
|
| 5375 |
+
(key === KEYS.DOWN && evt.altKey)) {
|
| 5376 |
+
self.open();
|
| 5377 |
+
|
| 5378 |
+
evt.preventDefault();
|
| 5379 |
+
}
|
| 5380 |
+
}
|
| 5381 |
+
});
|
| 5382 |
+
};
|
| 5383 |
+
|
| 5384 |
+
Select2.prototype._syncAttributes = function () {
|
| 5385 |
+
this.options.set('disabled', this.$element.prop('disabled'));
|
| 5386 |
+
|
| 5387 |
+
if (this.options.get('disabled')) {
|
| 5388 |
+
if (this.isOpen()) {
|
| 5389 |
+
this.close();
|
| 5390 |
+
}
|
| 5391 |
+
|
| 5392 |
+
this.trigger('disable', {});
|
| 5393 |
+
} else {
|
| 5394 |
+
this.trigger('enable', {});
|
| 5395 |
+
}
|
| 5396 |
+
};
|
| 5397 |
+
|
| 5398 |
+
Select2.prototype._syncSubtree = function (evt, mutations) {
|
| 5399 |
+
var changed = false;
|
| 5400 |
+
var self = this;
|
| 5401 |
+
|
| 5402 |
+
// Ignore any mutation events raised for elements that aren't options or
|
| 5403 |
+
// optgroups. This handles the case when the select element is destroyed
|
| 5404 |
+
if (
|
| 5405 |
+
evt && evt.target && (
|
| 5406 |
+
evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
|
| 5407 |
+
)
|
| 5408 |
+
) {
|
| 5409 |
+
return;
|
| 5410 |
+
}
|
| 5411 |
+
|
| 5412 |
+
if (!mutations) {
|
| 5413 |
+
// If mutation events aren't supported, then we can only assume that the
|
| 5414 |
+
// change affected the selections
|
| 5415 |
+
changed = true;
|
| 5416 |
+
} else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
|
| 5417 |
+
for (var n = 0; n < mutations.addedNodes.length; n++) {
|
| 5418 |
+
var node = mutations.addedNodes[n];
|
| 5419 |
+
|
| 5420 |
+
if (node.selected) {
|
| 5421 |
+
changed = true;
|
| 5422 |
+
}
|
| 5423 |
+
}
|
| 5424 |
+
} else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
|
| 5425 |
+
changed = true;
|
| 5426 |
+
}
|
| 5427 |
+
|
| 5428 |
+
// Only re-pull the data if we think there is a change
|
| 5429 |
+
if (changed) {
|
| 5430 |
+
this.dataAdapter.current(function (currentData) {
|
| 5431 |
+
self.trigger('selection:update', {
|
| 5432 |
+
data: currentData
|
| 5433 |
+
});
|
| 5434 |
+
});
|
| 5435 |
+
}
|
| 5436 |
+
};
|
| 5437 |
+
|
| 5438 |
+
/**
|
| 5439 |
+
* Override the trigger method to automatically trigger pre-events when
|
| 5440 |
+
* there are events that can be prevented.
|
| 5441 |
+
*/
|
| 5442 |
+
Select2.prototype.trigger = function (name, args) {
|
| 5443 |
+
var actualTrigger = Select2.__super__.trigger;
|
| 5444 |
+
var preTriggerMap = {
|
| 5445 |
+
'open': 'opening',
|
| 5446 |
+
'close': 'closing',
|
| 5447 |
+
'select': 'selecting',
|
| 5448 |
+
'unselect': 'unselecting'
|
| 5449 |
+
};
|
| 5450 |
+
|
| 5451 |
+
if (args === undefined) {
|
| 5452 |
+
args = {};
|
| 5453 |
+
}
|
| 5454 |
+
|
| 5455 |
+
if (name in preTriggerMap) {
|
| 5456 |
+
var preTriggerName = preTriggerMap[name];
|
| 5457 |
+
var preTriggerArgs = {
|
| 5458 |
+
prevented: false,
|
| 5459 |
+
name: name,
|
| 5460 |
+
args: args
|
| 5461 |
+
};
|
| 5462 |
+
|
| 5463 |
+
actualTrigger.call(this, preTriggerName, preTriggerArgs);
|
| 5464 |
+
|
| 5465 |
+
if (preTriggerArgs.prevented) {
|
| 5466 |
+
args.prevented = true;
|
| 5467 |
+
|
| 5468 |
+
return;
|
| 5469 |
+
}
|
| 5470 |
+
}
|
| 5471 |
+
|
| 5472 |
+
actualTrigger.call(this, name, args);
|
| 5473 |
+
};
|
| 5474 |
+
|
| 5475 |
+
Select2.prototype.toggleDropdown = function () {
|
| 5476 |
+
if (this.options.get('disabled')) {
|
| 5477 |
+
return;
|
| 5478 |
+
}
|
| 5479 |
+
|
| 5480 |
+
if (this.isOpen()) {
|
| 5481 |
+
this.close();
|
| 5482 |
+
} else {
|
| 5483 |
+
this.open();
|
| 5484 |
+
}
|
| 5485 |
+
};
|
| 5486 |
+
|
| 5487 |
+
Select2.prototype.open = function () {
|
| 5488 |
+
if (this.isOpen()) {
|
| 5489 |
+
return;
|
| 5490 |
+
}
|
| 5491 |
+
|
| 5492 |
+
this.trigger('query', {});
|
| 5493 |
+
};
|
| 5494 |
+
|
| 5495 |
+
Select2.prototype.close = function () {
|
| 5496 |
+
if (!this.isOpen()) {
|
| 5497 |
+
return;
|
| 5498 |
+
}
|
| 5499 |
+
|
| 5500 |
+
this.trigger('close', {});
|
| 5501 |
+
};
|
| 5502 |
+
|
| 5503 |
+
Select2.prototype.isOpen = function () {
|
| 5504 |
+
return this.$container.hasClass('toolset_select2-container--open');
|
| 5505 |
+
};
|
| 5506 |
+
|
| 5507 |
+
Select2.prototype.hasFocus = function () {
|
| 5508 |
+
return this.$container.hasClass('toolset_select2-container--focus');
|
| 5509 |
+
};
|
| 5510 |
+
|
| 5511 |
+
Select2.prototype.focus = function (data) {
|
| 5512 |
+
// No need to re-trigger focus events if we are already focused
|
| 5513 |
+
if (this.hasFocus()) {
|
| 5514 |
+
return;
|
| 5515 |
+
}
|
| 5516 |
+
|
| 5517 |
+
this.$container.addClass('toolset_select2-container--focus');
|
| 5518 |
+
this.trigger('focus', {});
|
| 5519 |
+
};
|
| 5520 |
+
|
| 5521 |
+
Select2.prototype.enable = function (args) {
|
| 5522 |
+
if (this.options.get('debug') && window.console && console.warn) {
|
| 5523 |
+
console.warn(
|
| 5524 |
+
'Select2: The `toolset_select2("enable")` method has been deprecated and will' +
|
| 5525 |
+
' be removed in later Select2 versions. Use $element.prop("disabled")' +
|
| 5526 |
+
' instead.'
|
| 5527 |
+
);
|
| 5528 |
+
}
|
| 5529 |
+
|
| 5530 |
+
if (args == null || args.length === 0) {
|
| 5531 |
+
args = [true];
|
| 5532 |
+
}
|
| 5533 |
+
|
| 5534 |
+
var disabled = !args[0];
|
| 5535 |
+
|
| 5536 |
+
this.$element.prop('disabled', disabled);
|
| 5537 |
+
};
|
| 5538 |
+
|
| 5539 |
+
Select2.prototype.data = function () {
|
| 5540 |
+
if (this.options.get('debug') &&
|
| 5541 |
+
arguments.length > 0 && window.console && console.warn) {
|
| 5542 |
+
console.warn(
|
| 5543 |
+
'Select2: Data can no longer be set using `toolset_select2("data")`. You ' +
|
| 5544 |
+
'should consider setting the value instead using `$element.val()`.'
|
| 5545 |
+
);
|
| 5546 |
+
}
|
| 5547 |
+
|
| 5548 |
+
var data = [];
|
| 5549 |
+
|
| 5550 |
+
this.dataAdapter.current(function (currentData) {
|
| 5551 |
+
data = currentData;
|
| 5552 |
+
});
|
| 5553 |
+
|
| 5554 |
+
return data;
|
| 5555 |
+
};
|
| 5556 |
+
|
| 5557 |
+
Select2.prototype.val = function (args) {
|
| 5558 |
+
if (this.options.get('debug') && window.console && console.warn) {
|
| 5559 |
+
console.warn(
|
| 5560 |
+
'Select2: The `toolset_select2("val")` method has been deprecated and will be' +
|
| 5561 |
+
' removed in later Select2 versions. Use $element.val() instead.'
|
| 5562 |
+
);
|
| 5563 |
+
}
|
| 5564 |
+
|
| 5565 |
+
if (args == null || args.length === 0) {
|
| 5566 |
+
return this.$element.val();
|
| 5567 |
+
}
|
| 5568 |
+
|
| 5569 |
+
var newVal = args[0];
|
| 5570 |
+
|
| 5571 |
+
if ($.isArray(newVal)) {
|
| 5572 |
+
newVal = $.map(newVal, function (obj) {
|
| 5573 |
+
return obj.toString();
|
| 5574 |
+
});
|
| 5575 |
+
}
|
| 5576 |
+
|
| 5577 |
+
this.$element.val(newVal).trigger('change');
|
| 5578 |
+
};
|
| 5579 |
+
|
| 5580 |
+
Select2.prototype.destroy = function () {
|
| 5581 |
+
this.$container.remove();
|
| 5582 |
+
|
| 5583 |
+
if (this.$element[0].detachEvent) {
|
| 5584 |
+
this.$element[0].detachEvent('onpropertychange', this._syncA);
|
| 5585 |
+
}
|
| 5586 |
+
|
| 5587 |
+
if (this._observer != null) {
|
| 5588 |
+
this._observer.disconnect();
|
| 5589 |
+
this._observer = null;
|
| 5590 |
+
} else if (this.$element[0].removeEventListener) {
|
| 5591 |
+
this.$element[0]
|
| 5592 |
+
.removeEventListener('DOMAttrModified', this._syncA, false);
|
| 5593 |
+
this.$element[0]
|
| 5594 |
+
.removeEventListener('DOMNodeInserted', this._syncS, false);
|
| 5595 |
+
this.$element[0]
|
| 5596 |
+
.removeEventListener('DOMNodeRemoved', this._syncS, false);
|
| 5597 |
+
}
|
| 5598 |
+
|
| 5599 |
+
this._syncA = null;
|
| 5600 |
+
this._syncS = null;
|
| 5601 |
+
|
| 5602 |
+
this.$element.off('.toolset_select2');
|
| 5603 |
+
this.$element.attr('tabindex', this.$element.data('old-tabindex'));
|
| 5604 |
+
|
| 5605 |
+
this.$element.removeClass('toolset_select2-hidden-accessible');
|
| 5606 |
+
this.$element.attr('aria-hidden', 'false');
|
| 5607 |
+
this.$element.removeData('toolset_select2');
|
| 5608 |
+
|
| 5609 |
+
this.dataAdapter.destroy();
|
| 5610 |
+
this.selection.destroy();
|
| 5611 |
+
this.dropdown.destroy();
|
| 5612 |
+
this.results.destroy();
|
| 5613 |
+
|
| 5614 |
+
this.dataAdapter = null;
|
| 5615 |
+
this.selection = null;
|
| 5616 |
+
this.dropdown = null;
|
| 5617 |
+
this.results = null;
|
| 5618 |
+
};
|
| 5619 |
+
|
| 5620 |
+
Select2.prototype.render = function () {
|
| 5621 |
+
var $container = $(
|
| 5622 |
+
'<span class="toolset_select2 toolset_select2-container">' +
|
| 5623 |
+
'<span class="selection"></span>' +
|
| 5624 |
+
'<span class="dropdown-wrapper" aria-hidden="true"></span>' +
|
| 5625 |
+
'</span>'
|
| 5626 |
+
);
|
| 5627 |
+
|
| 5628 |
+
$container.attr('dir', this.options.get('dir'));
|
| 5629 |
+
|
| 5630 |
+
this.$container = $container;
|
| 5631 |
+
|
| 5632 |
+
this.$container.addClass('toolset_select2-container--' + this.options.get('theme'));
|
| 5633 |
+
|
| 5634 |
+
$container.data('element', this.$element);
|
| 5635 |
+
|
| 5636 |
+
return $container;
|
| 5637 |
+
};
|
| 5638 |
+
|
| 5639 |
+
return Select2;
|
| 5640 |
+
});
|
| 5641 |
+
|
| 5642 |
+
Toolset_S2.define('jquery-mousewheel',[
|
| 5643 |
+
'jquery'
|
| 5644 |
+
], function ($) {
|
| 5645 |
+
// Used to shim jQuery.mousewheel for non-full builds.
|
| 5646 |
+
return $;
|
| 5647 |
+
});
|
| 5648 |
+
|
| 5649 |
+
Toolset_S2.define('jquery.toolset_select2',[
|
| 5650 |
+
'jquery',
|
| 5651 |
+
'jquery-mousewheel',
|
| 5652 |
+
|
| 5653 |
+
'./toolset_select2/core',
|
| 5654 |
+
'./toolset_select2/defaults'
|
| 5655 |
+
], function ($, _, Select2, Defaults) {
|
| 5656 |
+
if ($.fn.toolset_select2 == null) {
|
| 5657 |
+
// All methods that should return the element
|
| 5658 |
+
var thisMethods = ['open', 'close', 'destroy'];
|
| 5659 |
+
|
| 5660 |
+
$.fn.toolset_select2 = function (options) {
|
| 5661 |
+
options = options || {};
|
| 5662 |
+
|
| 5663 |
+
if (typeof options === 'object') {
|
| 5664 |
+
this.each(function () {
|
| 5665 |
+
var instanceOptions = $.extend(true, {}, options);
|
| 5666 |
+
|
| 5667 |
+
var instance = new Select2($(this), instanceOptions);
|
| 5668 |
+
});
|
| 5669 |
+
|
| 5670 |
+
return this;
|
| 5671 |
+
} else if (typeof options === 'string') {
|
| 5672 |
+
var ret;
|
| 5673 |
+
var args = Array.prototype.slice.call(arguments, 1);
|
| 5674 |
+
|
| 5675 |
+
this.each(function () {
|
| 5676 |
+
var instance = $(this).data('toolset_select2');
|
| 5677 |
+
|
| 5678 |
+
if (instance == null && window.console && console.error) {
|
| 5679 |
+
console.error(
|
| 5680 |
+
'The toolset_select2(\'' + options + '\') method was called on an ' +
|
| 5681 |
+
'element that is not using Select2.'
|
| 5682 |
+
);
|
| 5683 |
+
}
|
| 5684 |
+
|
| 5685 |
+
ret = instance[options].apply(instance, args);
|
| 5686 |
+
});
|
| 5687 |
+
|
| 5688 |
+
// Check if we should be returning `this`
|
| 5689 |
+
if ($.inArray(options, thisMethods) > -1) {
|
| 5690 |
+
return this;
|
| 5691 |
+
}
|
| 5692 |
+
|
| 5693 |
+
return ret;
|
| 5694 |
+
} else {
|
| 5695 |
+
throw new Error('Invalid arguments for Select2: ' + options);
|
| 5696 |
+
}
|
| 5697 |
+
};
|
| 5698 |
+
}
|
| 5699 |
+
|
| 5700 |
+
if ($.fn.toolset_select2.defaults == null) {
|
| 5701 |
+
$.fn.toolset_select2.defaults = Defaults;
|
| 5702 |
+
}
|
| 5703 |
+
|
| 5704 |
+
return Select2;
|
| 5705 |
+
});
|
| 5706 |
+
|
| 5707 |
+
// Return the AMD loader configuration so it can be used outside of this file
|
| 5708 |
+
return {
|
| 5709 |
+
define: Toolset_S2.define,
|
| 5710 |
+
require: Toolset_S2.require
|
| 5711 |
+
};
|
| 5712 |
+
}());
|
| 5713 |
+
|
| 5714 |
+
// Autoload the jQuery bindings
|
| 5715 |
+
// We know that all of the modules exist above this, so we're safe
|
| 5716 |
+
var toolset_select2 = Toolset_S2.require('jquery.toolset_select2');
|
| 5717 |
+
|
| 5718 |
+
// Hold the AMD module references on the jQuery function that was just loaded
|
| 5719 |
+
// This allows Select2 to use the internal loader outside of this file, such
|
| 5720 |
+
// as in the language files.
|
| 5721 |
+
jQuery.fn.toolset_select2.amd = Toolset_S2;
|
| 5722 |
+
|
| 5723 |
+
// Return the Select2 instance for anyone who is importing it.
|
| 5724 |
+
return toolset_select2;
|
| 5725 |
+
}));
|
library/toolset/toolset-common/res/lib/select2/select2.min.js
CHANGED
|
@@ -1,23 +1,3 @@
|
|
| 1 |
-
/*
|
| 2 |
-
Copyright 2014 Igor Vaynberg
|
| 3 |
-
|
| 4 |
-
Version: 3.5.2 Timestamp: Sat Nov 1 14:43:36 EDT 2014
|
| 5 |
-
|
| 6 |
-
This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
|
| 7 |
-
General Public License version 2 (the "GPL License"). You may choose either license to govern your
|
| 8 |
-
use of this software only upon the condition that you accept all of the terms of either the Apache
|
| 9 |
-
License or the GPL License.
|
| 10 |
-
|
| 11 |
-
You may obtain a copy of the Apache License and the GPL License at:
|
| 12 |
-
|
| 13 |
-
http://www.apache.org/licenses/LICENSE-2.0
|
| 14 |
-
http://www.gnu.org/licenses/gpl-2.0.html
|
| 15 |
-
|
| 16 |
-
Unless required by applicable law or agreed to in writing, software distributed under the Apache License
|
| 17 |
-
or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
| 18 |
-
either express or implied. See the Apache License and the GPL License for the specific language governing
|
| 19 |
-
permissions and limitations under the Apache License and the GPL License.
|
| 20 |
-
*/
|
| 21 |
-
!function(a){"undefined"==typeof a.fn.each2&&a.extend(a.fn,{each2:function(b){for(var c=a([0]),d=-1,e=this.length;++d<e&&(c.context=c[0]=this[d])&&b.call(c[0],d,c)!==!1;);return this}})}(jQuery),function(a,b){"use strict";function n(b){var c=a(document.createTextNode(""));b.before(c),c.before(b),c.remove()}function o(a){function b(a){return m[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function p(a,b){for(var c=0,d=b.length;d>c;c+=1)if(r(a,b[c]))return c;return-1}function q(){var b=a(l);b.appendTo(document.body);var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function r(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function s(a,b,c){var d,e,f;if(null===a||a.length<1)return[];for(d=a.split(b),e=0,f=d.length;f>e;e+=1)d[e]=c(d[e]);return d}function t(a){return a.outerWidth(!1)-a.width()}function u(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function v(c){c.on("mousemove",function(c){var d=h;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function w(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function x(a,b){var c=w(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){p(a.target,b.get())>=0&&c(a)})}function y(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus();var e=b.offsetWidth>0||b.offsetHeight>0;e&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function z(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function A(a){a.preventDefault(),a.stopPropagation()}function B(a){a.preventDefault(),a.stopImmediatePropagation()}function C(b){if(!g){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);g=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),g.attr("class","select2-sizer"),a(document.body).append(g)}return g.text(b.val()),g.width()}function D(b,c,d){var e,g,f=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each2(function(){0!==this.indexOf("select2-")&&(g=d(this),g&&f.push(g))})),b.attr("class",f.join(" "))}function E(a,b,c,d){var e=o(a.toUpperCase()).indexOf(o(b.toUpperCase())),f=b.length;return 0>e?(c.push(d(a)),void 0):(c.push(d(a.substring(0,e))),c.push("<span class='select2-match'>"),c.push(d(a.substring(e,e+f))),c.push("</span>"),c.push(d(a.substring(e+f,a.length))),void 0)}function F(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function G(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&"function"==typeof e.abort&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(a,i.page,i);i.callback(b)},error:function(a,b,c){var d={hasError:!0,jqXHR:a,textStatus:b,errorThrown:c};i.callback(d)}}),e=j.call(h,l)},f)}}function H(b){var d,e,c=b,f=function(a){return""+a.text};a.isArray(c)&&(e=c,c={results:e}),a.isFunction(c)===!1&&(e=c,c=function(){return e});var g=c();return g.text&&(f=g.text,a.isFunction(f)||(d=g.text,f=function(a){return a[d]})),function(b){var g,d=b.term,e={results:[]};return""===d?(b.callback(c()),void 0):(g=function(c,e){var h,i;if(c=c[0],c.children){h={};for(i in c)c.hasOwnProperty(i)&&(h[i]=c[i]);h.children=[],a(c.children).each2(function(a,b){g(b,h.children)}),(h.children.length||b.matcher(d,f(h),c))&&e.push(h)}else b.matcher(d,f(c),c)&&e.push(c)},a(c().results).each2(function(a,b){g(b,e.results)}),b.callback(e),void 0)}}function I(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]},h=d?c(e):c;a.isArray(h)&&(a(h).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g))}}function J(b,c){if(a.isFunction(b))return!0;if(!b)return!1;if("string"==typeof b)return!0;throw new Error(c+" must be a string, function, or falsy value")}function K(b,c){if(a.isFunction(b)){var d=Array.prototype.slice.call(arguments,2);return b.apply(c,d)}return b}function L(b){var c=0;return a.each(b,function(a,b){b.children?c+=L(b.children):c++}),c}function M(a,c,d,e){var h,i,j,k,l,f=a,g=!1;if(!e.createSearchChoice||!e.tokenSeparators||e.tokenSeparators.length<1)return b;for(;;){for(i=-1,j=0,k=e.tokenSeparators.length;k>j&&(l=e.tokenSeparators[j],i=a.indexOf(l),!(i>=0));j++);if(0>i)break;if(h=a.substring(0,i),a=a.substring(i+l.length),h.length>0&&(h=e.createSearchChoice.call(this,h,c),h!==b&&null!==h&&e.id(h)!==b&&null!==e.id(h))){for(g=!1,j=0,k=c.length;k>j;j++)if(r(e.id(h),e.id(c[j]))){g=!0;break}g||d(h)}}return f!==a?a:void 0}function N(){var b=this;a.each(arguments,function(a,c){b[c].remove(),b[c]=null})}function O(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2===b){var c,d,e,f,g,i,j,h={x:0,y:0},k={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case k.LEFT:case k.RIGHT:case k.UP:case k.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case k.SHIFT:case k.CTRL:case k.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a}},l="<div class='select2-measure-scrollbar'></div>",m={"\u24b6":"A","\uff21":"A","\xc0":"A","\xc1":"A","\xc2":"A","\u1ea6":"A","\u1ea4":"A","\u1eaa":"A","\u1ea8":"A","\xc3":"A","\u0100":"A","\u0102":"A","\u1eb0":"A","\u1eae":"A","\u1eb4":"A","\u1eb2":"A","\u0226":"A","\u01e0":"A","\xc4":"A","\u01de":"A","\u1ea2":"A","\xc5":"A","\u01fa":"A","\u01cd":"A","\u0200":"A","\u0202":"A","\u1ea0":"A","\u1eac":"A","\u1eb6":"A","\u1e00":"A","\u0104":"A","\u023a":"A","\u2c6f":"A","\ua732":"AA","\xc6":"AE","\u01fc":"AE","\u01e2":"AE","\ua734":"AO","\ua736":"AU","\ua738":"AV","\ua73a":"AV","\ua73c":"AY","\u24b7":"B","\uff22":"B","\u1e02":"B","\u1e04":"B","\u1e06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24b8":"C","\uff23":"C","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\xc7":"C","\u1e08":"C","\u0187":"C","\u023b":"C","\ua73e":"C","\u24b9":"D","\uff24":"D","\u1e0a":"D","\u010e":"D","\u1e0c":"D","\u1e10":"D","\u1e12":"D","\u1e0e":"D","\u0110":"D","\u018b":"D","\u018a":"D","\u0189":"D","\ua779":"D","\u01f1":"DZ","\u01c4":"DZ","\u01f2":"Dz","\u01c5":"Dz","\u24ba":"E","\uff25":"E","\xc8":"E","\xc9":"E","\xca":"E","\u1ec0":"E","\u1ebe":"E","\u1ec4":"E","\u1ec2":"E","\u1ebc":"E","\u0112":"E","\u1e14":"E","\u1e16":"E","\u0114":"E","\u0116":"E","\xcb":"E","\u1eba":"E","\u011a":"E","\u0204":"E","\u0206":"E","\u1eb8":"E","\u1ec6":"E","\u0228":"E","\u1e1c":"E","\u0118":"E","\u1e18":"E","\u1e1a":"E","\u0190":"E","\u018e":"E","\u24bb":"F","\uff26":"F","\u1e1e":"F","\u0191":"F","\ua77b":"F","\u24bc":"G","\uff27":"G","\u01f4":"G","\u011c":"G","\u1e20":"G","\u011e":"G","\u0120":"G","\u01e6":"G","\u0122":"G","\u01e4":"G","\u0193":"G","\ua7a0":"G","\ua77d":"G","\ua77e":"G","\u24bd":"H","\uff28":"H","\u0124":"H","\u1e22":"H","\u1e26":"H","\u021e":"H","\u1e24":"H","\u1e28":"H","\u1e2a":"H","\u0126":"H","\u2c67":"H","\u2c75":"H","\ua78d":"H","\u24be":"I","\uff29":"I","\xcc":"I","\xcd":"I","\xce":"I","\u0128":"I","\u012a":"I","\u012c":"I","\u0130":"I","\xcf":"I","\u1e2e":"I","\u1ec8":"I","\u01cf":"I","\u0208":"I","\u020a":"I","\u1eca":"I","\u012e":"I","\u1e2c":"I","\u0197":"I","\u24bf":"J","\uff2a":"J","\u0134":"J","\u0248":"J","\u24c0":"K","\uff2b":"K","\u1e30":"K","\u01e8":"K","\u1e32":"K","\u0136":"K","\u1e34":"K","\u0198":"K","\u2c69":"K","\ua740":"K","\ua742":"K","\ua744":"K","\ua7a2":"K","\u24c1":"L","\uff2c":"L","\u013f":"L","\u0139":"L","\u013d":"L","\u1e36":"L","\u1e38":"L","\u013b":"L","\u1e3c":"L","\u1e3a":"L","\u0141":"L","\u023d":"L","\u2c62":"L","\u2c60":"L","\ua748":"L","\ua746":"L","\ua780":"L","\u01c7":"LJ","\u01c8":"Lj","\u24c2":"M","\uff2d":"M","\u1e3e":"M","\u1e40":"M","\u1e42":"M","\u2c6e":"M","\u019c":"M","\u24c3":"N","\uff2e":"N","\u01f8":"N","\u0143":"N","\xd1":"N","\u1e44":"N","\u0147":"N","\u1e46":"N","\u0145":"N","\u1e4a":"N","\u1e48":"N","\u0220":"N","\u019d":"N","\ua790":"N","\ua7a4":"N","\u01ca":"NJ","\u01cb":"Nj","\u24c4":"O","\uff2f":"O","\xd2":"O","\xd3":"O","\xd4":"O","\u1ed2":"O","\u1ed0":"O","\u1ed6":"O","\u1ed4":"O","\xd5":"O","\u1e4c":"O","\u022c":"O","\u1e4e":"O","\u014c":"O","\u1e50":"O","\u1e52":"O","\u014e":"O","\u022e":"O","\u0230":"O","\xd6":"O","\u022a":"O","\u1ece":"O","\u0150":"O","\u01d1":"O","\u020c":"O","\u020e":"O","\u01a0":"O","\u1edc":"O","\u1eda":"O","\u1ee0":"O","\u1ede":"O","\u1ee2":"O","\u1ecc":"O","\u1ed8":"O","\u01ea":"O","\u01ec":"O","\xd8":"O","\u01fe":"O","\u0186":"O","\u019f":"O","\ua74a":"O","\ua74c":"O","\u01a2":"OI","\ua74e":"OO","\u0222":"OU","\u24c5":"P","\uff30":"P","\u1e54":"P","\u1e56":"P","\u01a4":"P","\u2c63":"P","\ua750":"P","\ua752":"P","\ua754":"P","\u24c6":"Q","\uff31":"Q","\ua756":"Q","\ua758":"Q","\u024a":"Q","\u24c7":"R","\uff32":"R","\u0154":"R","\u1e58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1e5a":"R","\u1e5c":"R","\u0156":"R","\u1e5e":"R","\u024c":"R","\u2c64":"R","\ua75a":"R","\ua7a6":"R","\ua782":"R","\u24c8":"S","\uff33":"S","\u1e9e":"S","\u015a":"S","\u1e64":"S","\u015c":"S","\u1e60":"S","\u0160":"S","\u1e66":"S","\u1e62":"S","\u1e68":"S","\u0218":"S","\u015e":"S","\u2c7e":"S","\ua7a8":"S","\ua784":"S","\u24c9":"T","\uff34":"T","\u1e6a":"T","\u0164":"T","\u1e6c":"T","\u021a":"T","\u0162":"T","\u1e70":"T","\u1e6e":"T","\u0166":"T","\u01ac":"T","\u01ae":"T","\u023e":"T","\ua786":"T","\ua728":"TZ","\u24ca":"U","\uff35":"U","\xd9":"U","\xda":"U","\xdb":"U","\u0168":"U","\u1e78":"U","\u016a":"U","\u1e7a":"U","\u016c":"U","\xdc":"U","\u01db":"U","\u01d7":"U","\u01d5":"U","\u01d9":"U","\u1ee6":"U","\u016e":"U","\u0170":"U","\u01d3":"U","\u0214":"U","\u0216":"U","\u01af":"U","\u1eea":"U","\u1ee8":"U","\u1eee":"U","\u1eec":"U","\u1ef0":"U","\u1ee4":"U","\u1e72":"U","\u0172":"U","\u1e76":"U","\u1e74":"U","\u0244":"U","\u24cb":"V","\uff36":"V","\u1e7c":"V","\u1e7e":"V","\u01b2":"V","\ua75e":"V","\u0245":"V","\ua760":"VY","\u24cc":"W","\uff37":"W","\u1e80":"W","\u1e82":"W","\u0174":"W","\u1e86":"W","\u1e84":"W","\u1e88":"W","\u2c72":"W","\u24cd":"X","\uff38":"X","\u1e8a":"X","\u1e8c":"X","\u24ce":"Y","\uff39":"Y","\u1ef2":"Y","\xdd":"Y","\u0176":"Y","\u1ef8":"Y","\u0232":"Y","\u1e8e":"Y","\u0178":"Y","\u1ef6":"Y","\u1ef4":"Y","\u01b3":"Y","\u024e":"Y","\u1efe":"Y","\u24cf":"Z","\uff3a":"Z","\u0179":"Z","\u1e90":"Z","\u017b":"Z","\u017d":"Z","\u1e92":"Z","\u1e94":"Z","\u01b5":"Z","\u0224":"Z","\u2c7f":"Z","\u2c6b":"Z","\ua762":"Z","\u24d0":"a","\uff41":"a","\u1e9a":"a","\xe0":"a","\xe1":"a","\xe2":"a","\u1ea7":"a","\u1ea5":"a","\u1eab":"a","\u1ea9":"a","\xe3":"a","\u0101":"a","\u0103":"a","\u1eb1":"a","\u1eaf":"a","\u1eb5":"a","\u1eb3":"a","\u0227":"a","\u01e1":"a","\xe4":"a","\u01df":"a","\u1ea3":"a","\xe5":"a","\u01fb":"a","\u01ce":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1ead":"a","\u1eb7":"a","\u1e01":"a","\u0105":"a","\u2c65":"a","\u0250":"a","\ua733":"aa","\xe6":"ae","\u01fd":"ae","\u01e3":"ae","\ua735":"ao","\ua737":"au","\ua739":"av","\ua73b":"av","\ua73d":"ay","\u24d1":"b","\uff42":"b","\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24d2":"c","\uff43":"c","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\xe7":"c","\u1e09":"c","\u0188":"c","\u023c":"c","\ua73f":"c","\u2184":"c","\u24d3":"d","\uff44":"d","\u1e0b":"d","\u010f":"d","\u1e0d":"d","\u1e11":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u018c":"d","\u0256":"d","\u0257":"d","\ua77a":"d","\u01f3":"dz","\u01c6":"dz","\u24d4":"e","\uff45":"e","\xe8":"e","\xe9":"e","\xea":"e","\u1ec1":"e","\u1ebf":"e","\u1ec5":"e","\u1ec3":"e","\u1ebd":"e","\u0113":"e","\u1e15":"e","\u1e17":"e","\u0115":"e","\u0117":"e","\xeb":"e","\u1ebb":"e","\u011b":"e","\u0205":"e","\u0207":"e","\u1eb9":"e","\u1ec7":"e","\u0229":"e","\u1e1d":"e","\u0119":"e","\u1e19":"e","\u1e1b":"e","\u0247":"e","\u025b":"e","\u01dd":"e","\u24d5":"f","\uff46":"f","\u1e1f":"f","\u0192":"f","\ua77c":"f","\u24d6":"g","\uff47":"g","\u01f5":"g","\u011d":"g","\u1e21":"g","\u011f":"g","\u0121":"g","\u01e7":"g","\u0123":"g","\u01e5":"g","\u0260":"g","\ua7a1":"g","\u1d79":"g","\ua77f":"g","\u24d7":"h","\uff48":"h","\u0125":"h","\u1e23":"h","\u1e27":"h","\u021f":"h","\u1e25":"h","\u1e29":"h","\u1e2b":"h","\u1e96":"h","\u0127":"h","\u2c68":"h","\u2c76":"h","\u0265":"h","\u0195":"hv","\u24d8":"i","\uff49":"i","\xec":"i","\xed":"i","\xee":"i","\u0129":"i","\u012b":"i","\u012d":"i","\xef":"i","\u1e2f":"i","\u1ec9":"i","\u01d0":"i","\u0209":"i","\u020b":"i","\u1ecb":"i","\u012f":"i","\u1e2d":"i","\u0268":"i","\u0131":"i","\u24d9":"j","\uff4a":"j","\u0135":"j","\u01f0":"j","\u0249":"j","\u24da":"k","\uff4b":"k","\u1e31":"k","\u01e9":"k","\u1e33":"k","\u0137":"k","\u1e35":"k","\u0199":"k","\u2c6a":"k","\ua741":"k","\ua743":"k","\ua745":"k","\ua7a3":"k","\u24db":"l","\uff4c":"l","\u0140":"l","\u013a":"l","\u013e":"l","\u1e37":"l","\u1e39":"l","\u013c":"l","\u1e3d":"l","\u1e3b":"l","\u017f":"l","\u0142":"l","\u019a":"l","\u026b":"l","\u2c61":"l","\ua749":"l","\ua781":"l","\ua747":"l","\u01c9":"lj","\u24dc":"m","\uff4d":"m","\u1e3f":"m","\u1e41":"m","\u1e43":"m","\u0271":"m","\u026f":"m","\u24dd":"n","\uff4e":"n","\u01f9":"n","\u0144":"n","\xf1":"n","\u1e45":"n","\u0148":"n","\u1e47":"n","\u0146":"n","\u1e4b":"n","\u1e49":"n","\u019e":"n","\u0272":"n","\u0149":"n","\ua791":"n","\ua7a5":"n","\u01cc":"nj","\u24de":"o","\uff4f":"o","\xf2":"o","\xf3":"o","\xf4":"o","\u1ed3":"o","\u1ed1":"o","\u1ed7":"o","\u1ed5":"o","\xf5":"o","\u1e4d":"o","\u022d":"o","\u1e4f":"o","\u014d":"o","\u1e51":"o","\u1e53":"o","\u014f":"o","\u022f":"o","\u0231":"o","\xf6":"o","\u022b":"o","\u1ecf":"o","\u0151":"o","\u01d2":"o","\u020d":"o","\u020f":"o","\u01a1":"o","\u1edd":"o","\u1edb":"o","\u1ee1":"o","\u1edf":"o","\u1ee3":"o","\u1ecd":"o","\u1ed9":"o","\u01eb":"o","\u01ed":"o","\xf8":"o","\u01ff":"o","\u0254":"o","\ua74b":"o","\ua74d":"o","\u0275":"o","\u01a3":"oi","\u0223":"ou","\ua74f":"oo","\u24df":"p","\uff50":"p","\u1e55":"p","\u1e57":"p","\u01a5":"p","\u1d7d":"p","\ua751":"p","\ua753":"p","\ua755":"p","\u24e0":"q","\uff51":"q","\u024b":"q","\ua757":"q","\ua759":"q","\u24e1":"r","\uff52":"r","\u0155":"r","\u1e59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1e5b":"r","\u1e5d":"r","\u0157":"r","\u1e5f":"r","\u024d":"r","\u027d":"r","\ua75b":"r","\ua7a7":"r","\ua783":"r","\u24e2":"s","\uff53":"s","\xdf":"s","\u015b":"s","\u1e65":"s","\u015d":"s","\u1e61":"s","\u0161":"s","\u1e67":"s","\u1e63":"s","\u1e69":"s","\u0219":"s","\u015f":"s","\u023f":"s","\ua7a9":"s","\ua785":"s","\u1e9b":"s","\u24e3":"t","\uff54":"t","\u1e6b":"t","\u1e97":"t","\u0165":"t","\u1e6d":"t","\u021b":"t","\u0163":"t","\u1e71":"t","\u1e6f":"t","\u0167":"t","\u01ad":"t","\u0288":"t","\u2c66":"t","\ua787":"t","\ua729":"tz","\u24e4":"u","\uff55":"u","\xf9":"u","\xfa":"u","\xfb":"u","\u0169":"u","\u1e79":"u","\u016b":"u","\u1e7b":"u","\u016d":"u","\xfc":"u","\u01dc":"u","\u01d8":"u","\u01d6":"u","\u01da":"u","\u1ee7":"u","\u016f":"u","\u0171":"u","\u01d4":"u","\u0215":"u","\u0217":"u","\u01b0":"u","\u1eeb":"u","\u1ee9":"u","\u1eef":"u","\u1eed":"u","\u1ef1":"u","\u1ee5":"u","\u1e73":"u","\u0173":"u","\u1e77":"u","\u1e75":"u","\u0289":"u","\u24e5":"v","\uff56":"v","\u1e7d":"v","\u1e7f":"v","\u028b":"v","\ua75f":"v","\u028c":"v","\ua761":"vy","\u24e6":"w","\uff57":"w","\u1e81":"w","\u1e83":"w","\u0175":"w","\u1e87":"w","\u1e85":"w","\u1e98":"w","\u1e89":"w","\u2c73":"w","\u24e7":"x","\uff58":"x","\u1e8b":"x","\u1e8d":"x","\u24e8":"y","\uff59":"y","\u1ef3":"y","\xfd":"y","\u0177":"y","\u1ef9":"y","\u0233":"y","\u1e8f":"y","\xff":"y","\u1ef7":"y","\u1e99":"y","\u1ef5":"y","\u01b4":"y","\u024f":"y","\u1eff":"y","\u24e9":"z","\uff5a":"z","\u017a":"z","\u1e91":"z","\u017c":"z","\u017e":"z","\u1e93":"z","\u1e95":"z","\u01b6":"z","\u0225":"z","\u0240":"z","\u2c6c":"z","\ua763":"z","\u0386":"\u0391","\u0388":"\u0395","\u0389":"\u0397","\u038a":"\u0399","\u03aa":"\u0399","\u038c":"\u039f","\u038e":"\u03a5","\u03ab":"\u03a5","\u038f":"\u03a9","\u03ac":"\u03b1","\u03ad":"\u03b5","\u03ae":"\u03b7","\u03af":"\u03b9","\u03ca":"\u03b9","\u0390":"\u03b9","\u03cc":"\u03bf","\u03cd":"\u03c5","\u03cb":"\u03c5","\u03b0":"\u03c5","\u03c9":"\u03c9","\u03c2":"\u03c3"};i=a(document),f=function(){var a=1;return function(){return a++}}(),c=O(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,g=".select2-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2")!==b&&null!==c.element.data("select2")&&c.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=a(".select2-hidden-accessible"),0==this.liveRegion.length&&(this.liveRegion=a("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body)),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+f()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",c.element.attr("title")),this.body=a(document.body),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",c.element.attr("style")),this.container.css(K(c.containerCss,this.opts.element)),this.container.addClass(K(c.containerCssClass,this.opts.element)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",A),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(c.dropdownCssClass,this.opts.element)),this.dropdown.data("select2",this),this.dropdown.on("click",A),this.results=d=this.container.find(g),this.search=e=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",A),v(this.results),this.dropdown.on("mousemove-filtered",g,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",g,this.bind(function(a){this._touchEvent=!0,this.highlightUnderEvent(a)})),this.dropdown.on("touchmove",g,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",g,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),x(80,this.results),this.dropdown.on("scroll-debounced",g,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&0>=f-e?(d.scrollTop(0),A(a)):0>e&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),A(a))}),u(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2-focused")}),e.on("blur",function(){e.removeClass("select2-focused")}),this.dropdown.on("mouseup",g,this.bind(function(b){a(b.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(a){a.stopPropagation()}),this.nextSearchTerm=b,a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),j=j||q(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",c.searchInputPlaceholder)},destroy:function(){var a=this.opts.element,c=a.data("select2"),d=this;this.close(),a.length&&a[0].detachEvent&&d._sync&&a.each(function(){d._sync&&this.detachEvent("onpropertychange",d._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,c!==b&&(c.container.remove(),c.liveRegion.remove(),c.dropdown.remove(),a.show().removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show()),N.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:r(a.attr("locked"),"locked")||r(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:void 0},prepareOpts:function(c){var d,e,g,h,i=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),c=a.extend({},{populateResults:function(d,e,g){var h,j=this.opts.id,k=this.liveRegion;h=function(d,e,l){var m,n,o,p,q,r,s,t,u,v;d=c.sortResults(d,e,g);var w=[];for(m=0,n=d.length;n>m;m+=1)o=d[m],q=o.disabled===!0,p=!q&&j(o)!==b,r=o.children&&o.children.length>0,s=a("<li></li>"),s.addClass("select2-results-dept-"+l),s.addClass("select2-result"),s.addClass(p?"select2-result-selectable":"select2-result-unselectable"),q&&s.addClass("select2-disabled"),r&&s.addClass("select2-result-with-children"),s.addClass(i.opts.formatResultCssClass(o)),s.attr("role","presentation"),t=a(document.createElement("div")),t.addClass("select2-result-label"),t.attr("id","select2-result-label-"+f()),t.attr("role","option"),v=c.formatResult(o,t,g,i.opts.escapeMarkup),v!==b&&(t.html(v),s.append(t)),r&&(u=a("<ul></ul>"),u.addClass("select2-result-sub"),h(o.children,u,l+1),s.append(u)),s.data("select2-data",o),w.push(s[0]);e.append(w),k.text(c.formatMatches(d.length))},h(e,d,0)}},a.fn.select2.defaults,c),"function"!=typeof c.id&&(g=c.id,c.id=function(a){return a[g]}),a.isArray(c.element.data("select2Tags"))){if("tags"in c)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+c.element.attr("id");c.tags=c.element.data("select2Tags")}if(e?(c.query=this.bind(function(a){var f,g,h,c={results:[],more:!1},e=a.term;h=function(b,c){var d;b.is("option")?a.matcher(e,b.text(),b)&&c.push(i.optionToData(b)):b.is("optgroup")&&(d=i.optionToData(b),b.children().each2(function(a,b){h(b,d.children)}),d.children.length>0&&c.push(d))},f=d.children(),this.getPlaceholder()!==b&&f.length>0&&(g=this.getPlaceholderOption(),g&&(f=f.not(g))),f.each2(function(a,b){h(b,c.results)}),a.callback(c)}),c.id=function(a){return a.id}):"query"in c||("ajax"in c?(h=c.element.data("ajax-url"),h&&h.length>0&&(c.ajax.url=h),c.query=G.call(c.element,c.ajax)):"data"in c?c.query=H(c.data):"tags"in c&&(c.query=I(c.tags),c.createSearchChoice===b&&(c.createSearchChoice=function(b){return{id:a.trim(b),text:a.trim(b)}}),c.initSelection===b&&(c.initSelection=function(b,d){var e=[];a(s(b.val(),c.separator,c.transformVal)).each(function(){var b={id:this,text:this},d=c.tags;a.isFunction(d)&&(d=d()),a(d).each(function(){return r(this.id,b.id)?(b=this,!1):void 0}),e.push(b)}),d(e)}))),"function"!=typeof c.query)throw"query function not defined for Select2 "+c.element.attr("id");if("top"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.unshift(b)};else if("bottom"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.push(b)};else if("function"!=typeof c.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return c},monitorSource:function(){var d,c=this.opts.element,e=this;c.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),this._sync=this.bind(function(){var a=c.prop("disabled");a===b&&(a=!1),this.enable(!a);var d=c.prop("readonly");d===b&&(d=!1),this.readonly(d),this.container&&(D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(K(this.opts.containerCssClass,this.opts.element))),this.dropdown&&(D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(this.opts.dropdownCssClass,this.opts.element)))}),c.length&&c[0].attachEvent&&c.each(function(){this.attachEvent("onpropertychange",e._sync)}),d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,d!==b&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new d(function(b){a.each(b,e._sync)}),this.propertyObserver.observe(c.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(b){var c=a.Event("select2-selecting",{val:this.id(b),object:b,choice:b});return this.opts.element.trigger(c),!c.isDefaultPrevented()},triggerChange:function(b){b=b||{},b=a.extend({},b,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(b),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var a=this._enabled&&!this._readonly,b=!a;return a===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",b),this.close(),this.enabledInterface=a,!0)},enable:function(a){a===b&&(a=!0),this._enabled!==a&&(this._enabled=a,this.opts.element.prop("disabled",!a),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(a){a===b&&(a=!1),this._readonly!==a&&(this._readonly=a,this.opts.element.prop("readonly",a),this.enableInterface())},opened:function(){return this.container?this.container.hasClass("select2-dropdown-open"):!1},positionDropdown:function(){var v,w,x,y,z,b=this.dropdown,c=this.container,d=c.offset(),e=c.outerHeight(!1),f=c.outerWidth(!1),g=b.outerHeight(!1),h=a(window),i=h.width(),k=h.height(),l=h.scrollLeft()+i,m=h.scrollTop()+k,n=d.top+e,o=d.left,p=m>=n+g,q=d.top-g>=h.scrollTop(),r=b.outerWidth(!1),s=function(){return l>=o+r},t=function(){return d.left+l+c.outerWidth(!1)>r},u=b.hasClass("select2-drop-above");u?(w=!0,!q&&p&&(x=!0,w=!1)):(w=!1,!p&&q&&(x=!0,w=!0)),x&&(b.hide(),d=this.container.offset(),e=this.container.outerHeight(!1),f=this.container.outerWidth(!1),g=b.outerHeight(!1),l=h.scrollLeft()+i,m=h.scrollTop()+k,n=d.top+e,o=d.left,r=b.outerWidth(!1),b.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(z=a(".select2-results",b)[0],b.addClass("select2-drop-auto-width"),b.css("width",""),r=b.outerWidth(!1)+(z.scrollHeight===z.clientHeight?0:j.width),r>f?f=r:r=f,g=b.outerHeight(!1)):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(v=this.body.offset(),n-=v.top,o-=v.left),!s()&&t()&&(o=d.left+this.container.outerWidth(!1)-r),y={left:o,width:f},w?(y.top=d.top-g,y.bottom="auto",this.container.addClass("select2-drop-above"),b.addClass("select2-drop-above")):(y.top=n,y.bottom="auto",this.container.removeClass("select2-drop-above"),b.removeClass("select2-drop-above")),y=a.extend(y,K(this.opts.dropdownCss,this.opts.element)),b.css(y)},shouldOpen:function(){var b;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(b=a.Event("select2-opening"),this.opts.element.trigger(b),!b.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),i.on("mousemove.select2Event",function(a){h.x=a.pageX,h.y=a.pageY}),!0):!1},opening:function(){var f,b=this.containerEventName,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),f=a("#select2-drop-mask"),0===f.length&&(f=a(document.createElement("div")),f.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),f.hide(),f.appendTo(this.body),f.on("mousedown touchstart click",function(b){n(f);var d,c=a("#select2-drop");c.length>0&&(d=c.data("select2"),d.opts.selectOnBlur&&d.selectHighlighted({noFocus:!0}),d.close(),b.preventDefault(),b.stopPropagation())})),this.dropdown.prev()[0]!==f[0]&&this.dropdown.before(f),a("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),f.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var g=this;this.container.parents().add(window).each(function(){a(this).on(d+" "+c+" "+e,function(){g.opened()&&g.positionDropdown()})})},close:function(){if(this.opened()){var b=this.containerEventName,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.parents().add(window).each(function(){a(this).off(c).off(d).off(e)}),this.clearDropdownAlignmentPreference(),a("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),i.off("mousemove.select2Event"),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(a.Event("select2-close"))}},externalSearch:function(a){this.open(),this.search.val(a),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return K(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var c,d,e,f,g,h,i,j,b=this.results;if(d=this.highlight(),!(0>d)){if(0==d)return b.scrollTop(0),void 0;c=this.findHighlightableChoices().find(".select2-result-label"),e=a(c[d]),j=(e.offset()||{}).top||0,f=j+e.outerHeight(!0),d===c.length-1&&(i=b.find("li.select2-more-results"),i.length>0&&(f=i.offset().top+i.outerHeight(!0))),g=b.offset().top+b.outerHeight(!1),f>g&&b.scrollTop(b.scrollTop()+(f-g)),h=j-b.offset().top,0>h&&"none"!=e.css("display")&&b.scrollTop(b.scrollTop()+h)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(b){for(var c=this.findHighlightableChoices(),d=this.highlight();d>-1&&d<c.length;){d+=b;
|
| 22 |
-
var e=a(c[d]);if(e.hasClass("select2-result-selectable")&&!e.hasClass("select2-disabled")&&!e.hasClass("select2-selected")){this.highlight(d);break}}},highlight:function(b){var d,e,c=this.findHighlightableChoices();return 0===arguments.length?p(c.filter(".select2-highlighted")[0],c.get()):(b>=c.length&&(b=c.length-1),0>b&&(b=0),this.removeHighlight(),d=a(c[b]),d.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",d.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(d.text()),e=d.data("select2-data"),e&&this.opts.element.trigger({type:"select2-highlight",val:this.id(e),choice:e}),void 0)},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(b){var c=a(b.target).closest(".select2-result-selectable");if(c.length>0&&!c.is(".select2-highlighted")){var d=this.findHighlightableChoices();this.highlight(d.index(c))}else 0==c.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var c,a=this.results,b=a.find("li.select2-more-results"),d=this.resultsPage+1,e=this,f=this.search.val(),g=this.context;0!==b.length&&(c=b.offset().top-a.offset().top-a.height(),c<=this.opts.loadMorePadding&&(b.addClass("select2-active"),this.opts.query({element:this.opts.element,term:f,page:d,context:g,matcher:this.opts.matcher,callback:this.bind(function(c){e.opened()&&(e.opts.populateResults.call(this,a,c.results,{term:f,page:d,context:g}),e.postprocessResults(c,!1,!1),c.more===!0?(b.detach().appendTo(a).html(e.opts.escapeMarkup(K(e.opts.formatLoadMore,e.opts.element,d+1))),window.setTimeout(function(){e.loadMoreIfNeeded()},10)):b.remove(),e.positionDropdown(),e.resultsPage=d,e.context=c.context,this.opts.element.trigger({type:"select2-loaded",items:c}))})})))},tokenize:function(){},updateResults:function(c){function m(){d.removeClass("select2-active"),h.positionDropdown(),e.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?h.liveRegion.text(e.text()):h.liveRegion.text(h.opts.formatMatches(e.find('.select2-result-selectable:not(".select2-selected")').length))}function n(a){e.html(a),m()}var g,i,l,d=this.search,e=this.results,f=this.opts,h=this,j=d.val(),k=a.data(this.container,"select2-last-term");if((c===!0||!k||!r(j,k))&&(a.data(this.container,"select2-last-term",j),c===!0||this.showSearchInput!==!1&&this.opened())){l=++this.queryCount;var o=this.getMaximumSelectionSize();if(o>=1&&(g=this.data(),a.isArray(g)&&g.length>=o&&J(f.formatSelectionTooBig,"formatSelectionTooBig")))return n("<li class='select2-selection-limit'>"+K(f.formatSelectionTooBig,f.element,o)+"</li>"),void 0;if(d.val().length<f.minimumInputLength)return J(f.formatInputTooShort,"formatInputTooShort")?n("<li class='select2-no-results'>"+K(f.formatInputTooShort,f.element,d.val(),f.minimumInputLength)+"</li>"):n(""),c&&this.showSearch&&this.showSearch(!0),void 0;if(f.maximumInputLength&&d.val().length>f.maximumInputLength)return J(f.formatInputTooLong,"formatInputTooLong")?n("<li class='select2-no-results'>"+K(f.formatInputTooLong,f.element,d.val(),f.maximumInputLength)+"</li>"):n(""),void 0;f.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2-searching'>"+K(f.formatSearching,f.element)+"</li>"),d.addClass("select2-active"),this.removeHighlight(),i=this.tokenize(),i!=b&&null!=i&&d.val(i),this.resultsPage=1,f.query({element:f.element,term:d.val(),page:this.resultsPage,context:null,matcher:f.matcher,callback:this.bind(function(g){var i;if(l==this.queryCount){if(!this.opened())return this.search.removeClass("select2-active"),void 0;if(g.hasError!==b&&J(f.formatAjaxError,"formatAjaxError"))return n("<li class='select2-ajax-error'>"+K(f.formatAjaxError,f.element,g.jqXHR,g.textStatus,g.errorThrown)+"</li>"),void 0;if(this.context=g.context===b?null:g.context,this.opts.createSearchChoice&&""!==d.val()&&(i=this.opts.createSearchChoice.call(h,d.val(),g.results),i!==b&&null!==i&&h.id(i)!==b&&null!==h.id(i)&&0===a(g.results).filter(function(){return r(h.id(this),h.id(i))}).length&&this.opts.createSearchChoicePosition(g.results,i)),0===g.results.length&&J(f.formatNoMatches,"formatNoMatches"))return n("<li class='select2-no-results'>"+K(f.formatNoMatches,f.element,d.val())+"</li>"),void 0;e.empty(),h.opts.populateResults.call(this,e,g.results,{term:d.val(),page:this.resultsPage,context:null}),g.more===!0&&J(f.formatLoadMore,"formatLoadMore")&&(e.append("<li class='select2-more-results'>"+f.escapeMarkup(K(f.formatLoadMore,f.element,this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(g,c),m(),this.opts.element.trigger({type:"select2-loaded",items:g})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){y(this.search)},selectHighlighted:function(a){if(this._touchMoved)return this.clearTouchMoved(),void 0;var b=this.highlight(),c=this.results.find(".select2-highlighted"),d=c.closest(".select2-result").data("select2-data");d?(this.highlight(b),this.onSelect(d,a)):a&&a.noFocus&&this.close()},getPlaceholder:function(){var a;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((a=this.getPlaceholderOption())!==b?a.text():b)},getPlaceholderOption:function(){if(this.select){var c=this.select.children("option").first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&c||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===a.trim(c.text())&&""===c.val())return c}},initContainerWidth:function(){function c(){var c,d,e,f,g,h;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(c=this.opts.element.attr("style"),c!==b)for(d=c.split(";"),f=0,g=d.length;g>f;f+=1)if(h=d[f].replace(/\s/g,""),e=h.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==e&&e.length>=1)return e[1];return"resolve"===this.opts.width?(c=this.opts.element.css("width"),c.indexOf("%")>0?c:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var d=c.call(this);null!==d&&this.container.css("width",d)}}),d=O(c,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'> </span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'"," aria-autocomplete='list' />"," </div>"," <ul class='select2-results' role='listbox'>"," </ul>","</div>"].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var c,d,e;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),c=this.search.get(0),c.createTextRange?(d=c.createTextRange(),d.collapse(!1),d.select()):c.setSelectionRange&&(e=this.search.val().length,c.setSelectionRange(e,e))),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){a("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),N.call(this,"selection","focusser")},initContainer:function(){var b,g,c=this.container,d=this.dropdown,e=f();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=b=c.find(".select2-choice"),this.focusser=c.find(".select2-focusser"),b.find(".select2-chosen").attr("id","select2-chosen-"+e),this.focusser.attr("aria-labelledby","select2-chosen-"+e),this.results.attr("id","select2-results-"+e),this.search.attr("aria-owns","select2-results-"+e),this.focusser.attr("id","s2id_autogen"+e),g=a("label[for='"+this.opts.element.attr("id")+"']"),this.opts.element.focus(this.bind(function(){this.focus()})),this.focusser.prev().text(g.text()).attr("for",this.focusser.attr("id"));var h=this.opts.element.attr("title");this.opts.element.attr("title",h||g.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(a("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&229!=a.keyCode){if(a.which===k.PAGE_UP||a.which===k.PAGE_DOWN)return A(a),void 0;switch(a.which){case k.UP:case k.DOWN:return this.moveHighlight(a.which===k.UP?-1:1),A(a),void 0;case k.ENTER:return this.selectHighlighted(),A(a),void 0;case k.TAB:return this.selectHighlighted({noFocus:!0}),void 0;case k.ESC:return this.cancel(a),A(a),void 0}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&a.which!==k.TAB&&!k.isControl(a)&&!k.isFunctionKey(a)&&a.which!==k.ESC){if(this.opts.openOnEnter===!1&&a.which===k.ENTER)return A(a),void 0;if(a.which==k.DOWN||a.which==k.UP||a.which==k.ENTER&&this.opts.openOnEnter){if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;return this.open(),A(a),void 0}return a.which==k.DELETE||a.which==k.BACKSPACE?(this.opts.allowClear&&this.clear(),A(a),void 0):void 0}})),u(this.focusser),this.focusser.on("keyup-change input",this.bind(function(a){if(this.opts.minimumResultsForSearch>=0){if(a.stopPropagation(),this.opened())return;this.open()}})),b.on("mousedown touchstart","abbr",this.bind(function(a){this.isInterfaceEnabled()&&(this.clear(),B(a),this.close(),this.selection&&this.selection.focus())})),b.on("mousedown touchstart",this.bind(function(c){n(b),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),A(c)})),d.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),b.on("focus",this.bind(function(a){A(a)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(a.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.hide(),this.setPlaceholder()},clear:function(b){var c=this.selection.data("select2-data");if(c){var d=a.Event("select2-clearing");if(this.opts.element.trigger(d),d.isDefaultPrevented())return;var e=this.getPlaceholderOption();this.opts.element.val(e?e.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),b!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.setPlaceholder(),c.nextSearchTerm=c.opts.nextSearchTerm(a,c.search.val()))})}},isPlaceholderOptionSelected:function(){var a;return this.getPlaceholder()===b?!1:(a=this.getPlaceholderOption())!==b&&a.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val()},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=a.find("option").filter(function(){return this.selected&&!this.disabled});b(c.optionToData(d))}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=c.val(),f=null;b.query({matcher:function(a,c,d){var g=r(e,b.id(d));return g&&(f=d),g},callback:a.isFunction(d)?function(){d(f)}:a.noop})}),b},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&a!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(a,b,c){var d=0,e=this;if(this.findHighlightableChoices().each2(function(a,b){return r(e.id(b.data("select2-data")),e.opts.element.val())?(d=a,!1):void 0}),c!==!1&&(b===!0&&d>=0?this.highlight(d):this.highlight(0)),b===!0){var g=this.opts.minimumResultsForSearch;g>=0&&this.showSearch(L(a.results)>=g)}},showSearch:function(b){this.showSearchInput!==b&&(this.showSearchInput=b,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!b),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!b),a(this.dropdown,this.container).toggleClass("select2-with-searchbox",b))},onSelect:function(a,b){if(this.triggerSelect(a)){var c=this.opts.element.val(),d=this.data();this.opts.element.val(this.id(a)),this.updateSelection(a),this.opts.element.trigger({type:"select2-selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.close(),b&&b.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),r(c,this.id(a))||this.triggerChange({added:a,removed:d})}},updateSelection:function(a){var d,e,c=this.selection.find(".select2-chosen");this.selection.data("select2-data",a),c.empty(),null!==a&&(d=this.opts.formatSelection(a,c,this.opts.escapeMarkup)),d!==b&&c.append(d),e=this.opts.formatSelectionCssClass(a,c),e!==b&&c.addClass(e),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var a,c=!1,d=null,e=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(a=arguments[0],arguments.length>1&&(c=arguments[1]),this.select)this.select.val(a).find("option").filter(function(){return this.selected}).each2(function(a,b){return d=e.optionToData(b),!1}),this.updateSelection(d),this.setPlaceholder(),c&&this.triggerChange({added:d,removed:f});else{if(!a&&0!==a)return this.clear(c),void 0;if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){e.opts.element.val(a?e.id(a):""),e.updateSelection(a),e.setPlaceholder(),c&&e.triggerChange({added:a,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(a){var c,d=!1;return 0===arguments.length?(c=this.selection.data("select2-data"),c==b&&(c=null),c):(arguments.length>1&&(d=arguments[1]),a?(c=this.data(),this.opts.element.val(a?this.id(a):""),this.updateSelection(a),d&&this.triggerChange({added:a,removed:c})):this.clear(d),void 0)}}),e=O(c,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>"," <li class='select2-search-field'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>"," </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return b},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=[];a.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(a,b){d.push(c.optionToData(b))}),b(d)}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=s(c.val(),b.separator,b.transformVal),f=[];b.query({matcher:function(c,d,g){var h=a.grep(e,function(a){return r(a,b.id(g))}).length;return h&&f.push(g),h},callback:a.isFunction(d)?function(){for(var a=[],c=0;c<e.length;c++)for(var g=e[c],h=0;h<f.length;h++){var i=f[h];if(r(g,b.id(i))){a.push(i),f.splice(h,1);break}}d(a)}:a.noop})}),b},selectChoice:function(a){var b=this.container.find(".select2-search-choice-focus");b.length&&a&&a[0]==b[0]||(b.length&&this.opts.element.trigger("choice-deselected",b),b.removeClass("select2-search-choice-focus"),a&&a.length&&(this.close(),a.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",a)))},destroy:function(){a("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),N.call(this,"searchContainer","selection")},initContainer:function(){var c,b=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=c=this.container.find(b);var d=this;this.selection.on("click",".select2-container:not(.select2-container-disabled) .select2-search-choice:not(.select2-locked)",function(){d.search[0].focus(),d.selectChoice(a(this))}),this.search.attr("id","s2id_autogen"+f()),this.search.prev().text(a("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.opts.element.focus(this.bind(function(){this.focus()})),this.search.on("input paste",this.bind(function(){this.search.attr("placeholder")&&0==this.search.val().length||this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){++this.keydowns;var b=c.find(".select2-search-choice-focus"),d=b.prev(".select2-search-choice:not(.select2-locked)"),e=b.next(".select2-search-choice:not(.select2-locked)"),f=z(this.search);if(b.length&&(a.which==k.LEFT||a.which==k.RIGHT||a.which==k.BACKSPACE||a.which==k.DELETE||a.which==k.ENTER)){var g=b;return a.which==k.LEFT&&d.length?g=d:a.which==k.RIGHT?g=e.length?e:null:a.which===k.BACKSPACE?this.unselect(b.first())&&(this.search.width(10),g=d.length?d:e):a.which==k.DELETE?this.unselect(b.first())&&(this.search.width(10),g=e.length?e:null):a.which==k.ENTER&&(g=null),this.selectChoice(g),A(a),g&&g.length||this.open(),void 0}if((a.which===k.BACKSPACE&&1==this.keydowns||a.which==k.LEFT)&&0==f.offset&&!f.length)return this.selectChoice(c.find(".select2-search-choice:not(.select2-locked)").last()),A(a),void 0;if(this.selectChoice(null),this.opened())switch(a.which){case k.UP:case k.DOWN:return this.moveHighlight(a.which===k.UP?-1:1),A(a),void 0;case k.ENTER:return this.selectHighlighted(),A(a),void 0;case k.TAB:return this.selectHighlighted({noFocus:!0}),this.close(),void 0;case k.ESC:return this.cancel(a),A(a),void 0}if(a.which!==k.TAB&&!k.isControl(a)&&!k.isFunctionKey(a)&&a.which!==k.BACKSPACE&&a.which!==k.ESC){if(a.which===k.ENTER){if(this.opts.openOnEnter===!1)return;if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return}this.open(),(a.which===k.PAGE_UP||a.which===k.PAGE_DOWN)&&A(a),a.which===k.ENTER&&A(a)}}})),this.search.on("keyup",this.bind(function(){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(b){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),b.stopImmediatePropagation(),this.opts.element.trigger(a.Event("select2-blur"))})),this.container.on("click",b,this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.open(),this.focusSearch(),b.preventDefault()))})),this.container.on("focus",b,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.hide(),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.clearSearch())})}},clearSearch:function(){var a=this.getPlaceholder(),c=this.getMaxSearchWidth();a!==b&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(a).addClass("select2-default"),this.search.width(c>0?c:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(b){var c=[],d=[],e=this;a(b).each(function(){p(e.id(this),c)<0&&(c.push(e.id(this)),d.push(this))}),b=d,this.selection.find(".select2-search-choice").remove(),a(b).each(function(){e.addSelectedChoice(this)}),e.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer.call(this,a,this.data(),this.bind(this.onSelect),this.opts),null!=a&&a!=b&&(this.search.val(a),a.length>0&&this.open())},onSelect:function(a,c){this.triggerSelect(a)&&""!==a.text&&(this.addSelectedChoice(a),this.opts.element.trigger({type:"selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.clearSearch(),this.updateResults(),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(a,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:a}),c&&c.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(c){var j,k,d=!c.locked,e=a("<li class='select2-search-choice'> <div></div> <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),f=a("<li class='select2-search-choice select2-locked'><div></div></li>"),g=d?e:f,h=this.id(c),i=this.getVal();j=this.opts.formatSelection(c,g.find("div"),this.opts.escapeMarkup),j!=b&&g.find("div").replaceWith(a("<div></div>").html(j)),k=this.opts.formatSelectionCssClass(c,g.find("div")),k!=b&&g.addClass(k),d&&g.find(".select2-search-choice-close").on("mousedown",A).on("click dblclick",this.bind(function(b){this.isInterfaceEnabled()&&(this.unselect(a(b.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),A(b),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),g.data("select2-data",c),g.insertBefore(this.searchContainer),i.push(h),this.setVal(i)},unselect:function(b){var d,e,c=this.getVal();if(b=b.closest(".select2-search-choice"),0===b.length)throw"Invalid argument: "+b+". Must be .select2-search-choice";if(d=b.data("select2-data")){var f=a.Event("select2-removing");if(f.val=this.id(d),f.choice=d,this.opts.element.trigger(f),f.isDefaultPrevented())return!1;for(;(e=p(this.id(d),c))>=0;)c.splice(e,1),this.setVal(c),this.select&&this.postprocessResults();return b.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(d),choice:d}),this.triggerChange({removed:d}),!0}},postprocessResults:function(a,b,c){var d=this.getVal(),e=this.results.find(".select2-result"),f=this.results.find(".select2-result-with-children"),g=this;e.each2(function(a,b){var c=g.id(b.data("select2-data"));p(c,d)>=0&&(b.addClass("select2-selected"),b.find(".select2-result-selectable").addClass("select2-selected"))}),f.each2(function(a,b){b.is(".select2-result-selectable")||0!==b.find(".select2-result-selectable:not(.select2-selected)").length||b.addClass("select2-selected")}),-1==this.highlight()&&c!==!1&&this.opts.closeOnSelect===!0&&g.highlight(0),!this.opts.createSearchChoice&&!e.filter(".select2-result:not(.select2-selected)").length>0&&(!a||a&&!a.more&&0===this.results.find(".select2-no-results").length)&&J(g.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+K(g.opts.formatNoMatches,g.opts.element,g.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-t(this.search)},resizeSearch:function(){var a,b,c,d,e,f=t(this.search);a=C(this.search)+10,b=this.search.offset().left,c=this.selection.width(),d=this.selection.offset().left,e=c-(b-d)-f,a>e&&(e=c-f),40>e&&(e=c-f),0>=e&&(e=a),this.search.width(Math.floor(e))},getVal:function(){var a;return this.select?(a=this.select.val(),null===a?[]:a):(a=this.opts.element.val(),s(a,this.opts.separator,this.opts.transformVal))},setVal:function(b){var c;this.select?this.select.val(b):(c=[],a(b).each(function(){p(this,c)<0&&c.push(this)}),this.opts.element.val(0===c.length?"":c.join(this.opts.separator)))},buildChangeDetails:function(a,b){for(var b=b.slice(0),a=a.slice(0),c=0;c<b.length;c++)for(var d=0;d<a.length;d++)r(this.opts.id(b[c]),this.opts.id(a[d]))&&(b.splice(c,1),c>0&&c--,a.splice(d,1),d--);return{added:b,removed:a}},val:function(c,d){var e,f=this;if(0===arguments.length)return this.getVal();if(e=this.data(),e.length||(e=[]),!c&&0!==c)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),d&&this.triggerChange({added:this.data(),removed:e}),void 0;if(this.setVal(c),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),d&&this.triggerChange(this.buildChangeDetails(e,this.data()));else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var c=a.map(b,f.id);f.setVal(c),f.updateSelection(b),f.clearSearch(),d&&f.triggerChange(f.buildChangeDetails(e,f.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2-data")))}),this.setVal(b),this.triggerChange()},data:function(b,c){var e,f,d=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return a(this).data("select2-data")}).get():(f=this.data(),b||(b=[]),e=a.map(b,function(a){return d.opts.id(a)}),this.setVal(e),this.updateSelection(b),this.clearSearch(),c&&this.triggerChange(this.buildChangeDetails(f,this.data())),void 0)}}),a.fn.select2=function(){var d,e,f,g,h,c=Array.prototype.slice.call(arguments,0),i=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],j=["opened","isFocused","container","dropdown"],k=["val","data"],l={search:"externalSearch"};return this.each(function(){if(0===c.length||"object"==typeof c[0])d=0===c.length?{}:a.extend({},c[0]),d.element=a(this),"select"===d.element.get(0).tagName.toLowerCase()?h=d.element.prop("multiple"):(h=d.multiple||!1,"tags"in d&&(d.multiple=h=!0)),e=h?new window.Select2["class"].multi:new window.Select2["class"].single,e.init(d);else{if("string"!=typeof c[0])throw"Invalid arguments to select2 plugin: "+c;if(p(c[0],i)<0)throw"Unknown method: "+c[0];if(g=b,e=a(this).data("select2"),e===b)return;if(f=c[0],"container"===f?g=e.container:"dropdown"===f?g=e.dropdown:(l[f]&&(f=l[f]),g=e[f].apply(e,c.slice(1))),p(c[0],j)>=0||p(c[0],k)>=0&&1==c.length)return!1}}),g===b?this:g},a.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c,d){var e=[];return E(this.text(a),c.term,e,d),e.join("")},transformVal:function(b){return a.trim(b)},formatSelection:function(a,c,d){return a?d(this.text(a)):b},sortResults:function(a){return a},formatResultCssClass:function(a){return a.css},formatSelectionCssClass:function(){return b},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a==b?null:a.id},text:function(b){return b&&this.data&&this.data.text?a.isFunction(this.data.text)?this.data.text(b):b[this.data.text]:b.text
|
| 23 |
-
},matcher:function(a,b){return o(""+b).toUpperCase().indexOf(o(""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:M,escapeMarkup:F,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return b},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(a){var b="ontouchstart"in window||navigator.msMaxTouchPoints>0;return b?a.opts.minimumResultsForSearch<0?!1:!0:!0}},a.fn.select2.locales=[],a.fn.select2.locales.en={formatMatches:function(a){return 1===a?"One result is available, press enter to select it.":a+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatAjaxError:function(){return"Loading failed"},formatInputTooShort:function(a,b){var c=b-a.length;return"Please enter "+c+" or more character"+(1==c?"":"s")},formatInputTooLong:function(a,b){var c=a.length-b;return"Please delete "+c+" character"+(1==c?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(){return"Loading more results\u2026"},formatSearching:function(){return"Searching\u2026"}},a.extend(a.fn.select2.defaults,a.fn.select2.locales.en),a.fn.select2.ajaxDefaults={transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:G,local:H,tags:I},util:{debounce:w,markMatch:E,escapeMarkup:F,stripDiacritics:o},"class":{"abstract":c,single:d,multi:e}}}}(jQuery);
|
| 1 |
+
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">×</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");
|
| 2 |
+
if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b),d=g.$element.find("option").filter(function(){return a(this).val()===c.id});if(!d.length){var e=g.option(c);e.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([e])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null;
|
| 3 |
+
},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("select2/compat/utils",["jquery"],function(a){function b(b,c,d){var e,f,g=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0===this.indexOf("select2-")&&g.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&(f=d(this),null!=f&&g.push(f))})),b.attr("class",g.join(" "))}return{syncCssClasses:b}}),b.define("select2/compat/containerCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("containerCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptContainerCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("containerCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/dropdownCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("dropdownCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptDropdownCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("dropdownCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/initSelection",["jquery"],function(a){function b(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=c.get("initSelection"),this._isInitialized=!1,a.call(this,b,c)}return b.prototype.current=function(b,c){var d=this;return this._isInitialized?void b.call(this,c):void this.initSelection.call(null,this.$element,function(b){d._isInitialized=!0,a.isArray(b)||(b=[b]),c(b)})},b}),b.define("select2/compat/inputData",["jquery"],function(a){function b(a,b,c){this._currentData=[],this._valueSeparator=c.get("valueSeparator")||",","hidden"===b.prop("type")&&c.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `<select>` element instead."),a.call(this,b,c)}return b.prototype.current=function(b,c){function d(b,c){var e=[];return b.selected||-1!==a.inArray(b.id,c)?(b.selected=!0,e.push(b)):b.selected=!1,b.children&&e.push.apply(e,d(b.children,c)),e}for(var e=[],f=0;f<this._currentData.length;f++){var g=this._currentData[f];e.push.apply(e,d(g,this.$element.val().split(this._valueSeparator)))}c(e)},b.prototype.select=function(b,c){if(this.options.get("multiple")){var d=this.$element.val();d+=this._valueSeparator+c.id,this.$element.val(d),this.$element.trigger("change")}else this.current(function(b){a.map(b,function(a){a.selected=!1})}),this.$element.val(c.id),this.$element.trigger("change")},b.prototype.unselect=function(a,b){var c=this;b.selected=!1,this.current(function(a){for(var d=[],e=0;e<a.length;e++){var f=a[e];b.id!=f.id&&d.push(f.id)}c.$element.val(d.join(c._valueSeparator)),c.$element.trigger("change")})},b.prototype.query=function(a,b,c){for(var d=[],e=0;e<this._currentData.length;e++){var f=this._currentData[e],g=this.matches(b,f);null!==g&&d.push(g)}c({results:d})},b.prototype.addOptions=function(b,c){var d=a.map(c,function(b){return a.data(b[0],"data")});this._currentData.push.apply(this._currentData,d)},b}),b.define("select2/compat/matcher",["jquery"],function(a){function b(b){function c(c,d){var e=a.extend(!0,{},d);if(null==c.term||""===a.trim(c.term))return e;if(d.children){for(var f=d.children.length-1;f>=0;f--){var g=d.children[f],h=b(c.term,g.text,g);h||e.children.splice(f,1)}if(e.children.length>0)return e}return b(c.term,d.text,d)?e:null}return c}return b}),b.define("select2/compat/query",[],function(){function a(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `query` option has been deprecated in favor of a custom data adapter that overrides the `query` method. Support will be removed for the `query` option in future versions of Select2."),a.call(this,b,c)}return a.prototype.query=function(a,b,c){b.callback=c;var d=this.options.get("query");d.call(null,b)},a}),b.define("select2/dropdown/attachContainer",[],function(){function a(a,b,c){a.call(this,b,c)}return a.prototype.position=function(a,b,c){var d=c.find(".dropdown-wrapper");d.append(b),b.addClass("select2-dropdown--below"),c.addClass("select2-container--below")},a}),b.define("select2/dropdown/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$dropdown.on(d.join(" "),function(a){a.stopPropagation()})},a}),b.define("select2/selection/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$selection.on(d.join(" "),function(a){a.stopPropagation()})},a}),function(c){"function"==typeof b.define&&b.define.amd?b.define("jquery-mousewheel",["jquery"],c):"object"==typeof exports?module.exports=c:c(a)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
library/toolset/toolset-common/toolset-common-loader.php
CHANGED
|
@@ -5,11 +5,11 @@ if ( class_exists( 'Toolset_Common_Bootstrap' ) ) {
|
|
| 5 |
};
|
| 6 |
|
| 7 |
if( !defined('TOOLSET_VERSION') ){
|
| 8 |
-
define('TOOLSET_VERSION', '2.2');
|
| 9 |
}
|
| 10 |
|
| 11 |
if ( ! defined('TOOLSET_COMMON_VERSION' ) ) {
|
| 12 |
-
define( 'TOOLSET_COMMON_VERSION', '2.2' );
|
| 13 |
}
|
| 14 |
|
| 15 |
if ( ! defined('TOOLSET_COMMON_PATH' ) ) {
|
|
@@ -43,7 +43,7 @@ if ( ! function_exists( 'toolset_common_boostrap' ) ) {
|
|
| 43 |
&& FORCE_SSL_ADMIN
|
| 44 |
)
|
| 45 |
) {
|
| 46 |
-
define( 'TOOLSET_COMMON_URL',
|
| 47 |
define( 'TOOLSET_COMMON_PROTOCOL', 'https' );
|
| 48 |
} else {
|
| 49 |
define( 'TOOLSET_COMMON_URL', $url );
|
| 5 |
};
|
| 6 |
|
| 7 |
if( !defined('TOOLSET_VERSION') ){
|
| 8 |
+
define('TOOLSET_VERSION', '2.2.2');
|
| 9 |
}
|
| 10 |
|
| 11 |
if ( ! defined('TOOLSET_COMMON_VERSION' ) ) {
|
| 12 |
+
define( 'TOOLSET_COMMON_VERSION', '2.2.2' );
|
| 13 |
}
|
| 14 |
|
| 15 |
if ( ! defined('TOOLSET_COMMON_PATH' ) ) {
|
| 43 |
&& FORCE_SSL_ADMIN
|
| 44 |
)
|
| 45 |
) {
|
| 46 |
+
define( 'TOOLSET_COMMON_URL', str_replace( 'http://', 'https://', $url ) );
|
| 47 |
define( 'TOOLSET_COMMON_PROTOCOL', 'https' );
|
| 48 |
} else {
|
| 49 |
define( 'TOOLSET_COMMON_URL', $url );
|
library/toolset/toolset-common/toolset-forms/api.php
CHANGED
|
@@ -1,18 +1,15 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
/**
|
| 4 |
-
*
|
| 5 |
-
*
|
| 6 |
-
*/
|
| 7 |
-
|
| 8 |
function wptoolset_form( $form_id, $config = array() ){
|
| 9 |
-
|
|
|
|
| 10 |
$html = $wptoolset_forms->form( $form_id, $config );
|
| 11 |
return apply_filters( 'wptoolset_form', $html, $config );
|
| 12 |
}
|
| 13 |
|
| 14 |
function wptoolset_form_field( $form_id, $config, $value = array() ){
|
| 15 |
-
|
|
|
|
| 16 |
$html = $wptoolset_forms->field( $form_id, $config, $value );
|
| 17 |
return apply_filters( 'wptoolset_fieldform', $html, $config, $form_id );
|
| 18 |
}
|
|
@@ -24,42 +21,50 @@ function wptoolset_form_field( $form_id, $config, $value = array() ){
|
|
| 24 |
//}
|
| 25 |
|
| 26 |
function wptoolset_form_validate_field( $form_id, $config, $value ){
|
| 27 |
-
|
|
|
|
| 28 |
return $wptoolset_forms->validate_field( $form_id, $config, $value );
|
| 29 |
}
|
| 30 |
|
| 31 |
function wptoolset_form_conditional_check( $config ){
|
| 32 |
-
|
|
|
|
| 33 |
return $wptoolset_forms->checkConditional( $config );
|
| 34 |
}
|
| 35 |
|
| 36 |
function wptoolset_form_add_conditional( $form_id, $config ){
|
| 37 |
-
|
| 38 |
-
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
function wptoolset_form_filter_types_field( $field, $post_id = null, $_post_wpcf = array() ){
|
| 42 |
-
|
|
|
|
| 43 |
return $wptoolset_forms->filterTypesField( $field, $post_id, $_post_wpcf );
|
| 44 |
}
|
| 45 |
|
| 46 |
function wptoolset_form_field_add_filters( $type ){
|
| 47 |
-
|
|
|
|
| 48 |
$wptoolset_forms->addFieldFilters( $type );
|
| 49 |
}
|
| 50 |
|
| 51 |
function wptoolset_form_get_conditional_data( $post_id ){
|
| 52 |
-
|
|
|
|
| 53 |
return $wptoolset_forms->getConditionalData( $post_id );
|
| 54 |
}
|
| 55 |
|
| 56 |
function wptoolset_strtotime( $date, $format = null ){
|
| 57 |
-
|
|
|
|
| 58 |
return $wptoolset_forms->strtotime( $date, $format );
|
| 59 |
}
|
| 60 |
|
| 61 |
function wptoolset_timetodate( $timestamp, $format = null ){
|
| 62 |
-
|
|
|
|
| 63 |
return $wptoolset_forms->timetodate( $timestamp, $format );
|
| 64 |
}
|
| 65 |
|
|
@@ -75,7 +80,7 @@ function wptoolset_timetodate( $timestamp, $format = null ){
|
|
| 75 |
*
|
| 76 |
* @global object $wpdb
|
| 77 |
*
|
| 78 |
-
* @param string $
|
| 79 |
* @return string Text in the form of a LIKE phrase. Not SQL safe. Run through
|
| 80 |
* wpdb::prepare() before use.
|
| 81 |
*/
|
| 1 |
<?php
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
function wptoolset_form( $form_id, $config = array() ){
|
| 4 |
+
/** @var WPToolset_Forms_Bootstrap $wptoolset_forms */
|
| 5 |
+
global $wptoolset_forms;
|
| 6 |
$html = $wptoolset_forms->form( $form_id, $config );
|
| 7 |
return apply_filters( 'wptoolset_form', $html, $config );
|
| 8 |
}
|
| 9 |
|
| 10 |
function wptoolset_form_field( $form_id, $config, $value = array() ){
|
| 11 |
+
/** @var WPToolset_Forms_Bootstrap $wptoolset_forms */
|
| 12 |
+
global $wptoolset_forms;
|
| 13 |
$html = $wptoolset_forms->field( $form_id, $config, $value );
|
| 14 |
return apply_filters( 'wptoolset_fieldform', $html, $config, $form_id );
|
| 15 |
}
|
| 21 |
//}
|
| 22 |
|
| 23 |
function wptoolset_form_validate_field( $form_id, $config, $value ){
|
| 24 |
+
/** @var WPToolset_Forms_Bootstrap $wptoolset_forms */
|
| 25 |
+
global $wptoolset_forms;
|
| 26 |
return $wptoolset_forms->validate_field( $form_id, $config, $value );
|
| 27 |
}
|
| 28 |
|
| 29 |
function wptoolset_form_conditional_check( $config ){
|
| 30 |
+
/** @var WPToolset_Forms_Bootstrap $wptoolset_forms */
|
| 31 |
+
global $wptoolset_forms;
|
| 32 |
return $wptoolset_forms->checkConditional( $config );
|
| 33 |
}
|
| 34 |
|
| 35 |
function wptoolset_form_add_conditional( $form_id, $config ){
|
| 36 |
+
/** @var WPToolset_Forms_Bootstrap $wptoolset_forms */
|
| 37 |
+
global $wptoolset_forms;
|
| 38 |
+
$wptoolset_forms->addConditional( $form_id, $config );
|
| 39 |
}
|
| 40 |
|
| 41 |
function wptoolset_form_filter_types_field( $field, $post_id = null, $_post_wpcf = array() ){
|
| 42 |
+
/** @var WPToolset_Forms_Bootstrap $wptoolset_forms */
|
| 43 |
+
global $wptoolset_forms;
|
| 44 |
return $wptoolset_forms->filterTypesField( $field, $post_id, $_post_wpcf );
|
| 45 |
}
|
| 46 |
|
| 47 |
function wptoolset_form_field_add_filters( $type ){
|
| 48 |
+
/** @var WPToolset_Forms_Bootstrap $wptoolset_forms */
|
| 49 |
+
global $wptoolset_forms;
|
| 50 |
$wptoolset_forms->addFieldFilters( $type );
|
| 51 |
}
|
| 52 |
|
| 53 |
function wptoolset_form_get_conditional_data( $post_id ){
|
| 54 |
+
/** @var WPToolset_Forms_Bootstrap $wptoolset_forms */
|
| 55 |
+
global $wptoolset_forms;
|
| 56 |
return $wptoolset_forms->getConditionalData( $post_id );
|
| 57 |
}
|
| 58 |
|
| 59 |
function wptoolset_strtotime( $date, $format = null ){
|
| 60 |
+
/** @var WPToolset_Forms_Bootstrap $wptoolset_forms */
|
| 61 |
+
global $wptoolset_forms;
|
| 62 |
return $wptoolset_forms->strtotime( $date, $format );
|
| 63 |
}
|
| 64 |
|
| 65 |
function wptoolset_timetodate( $timestamp, $format = null ){
|
| 66 |
+
/** @var WPToolset_Forms_Bootstrap $wptoolset_forms */
|
| 67 |
+
global $wptoolset_forms;
|
| 68 |
return $wptoolset_forms->timetodate( $timestamp, $format );
|
| 69 |
}
|
| 70 |
|
| 80 |
*
|
| 81 |
* @global object $wpdb
|
| 82 |
*
|
| 83 |
+
* @param string $like The raw text to be escaped.
|
| 84 |
* @return string Text in the form of a LIKE phrase. Not SQL safe. Run through
|
| 85 |
* wpdb::prepare() before use.
|
| 86 |
*/
|
library/toolset/toolset-common/toolset-forms/classes/class.credfile.php
CHANGED
|
@@ -135,15 +135,6 @@ class WPToolset_Field_Credfile extends WPToolset_Field_Textfield {
|
|
| 135 |
$preview_span_input_showhide = ' style="display:none"';
|
| 136 |
}
|
| 137 |
|
| 138 |
-
// if ($name == '_featured_image') {
|
| 139 |
-
// $title = __('Featured Image', 'wpv-views');
|
| 140 |
-
// if (!$is_empty) {
|
| 141 |
-
// if (preg_match('/src="([\w\d\:\/\._-]*)"/', $value, $_v)) {
|
| 142 |
-
// $value = $_v[1];
|
| 143 |
-
// }
|
| 144 |
-
// }
|
| 145 |
-
// }
|
| 146 |
-
|
| 147 |
if (!$is_empty) {
|
| 148 |
$pathinfo = pathinfo($value);
|
| 149 |
// TODO we should check against the allowed mime types, not file extensions
|
|
@@ -184,10 +175,20 @@ class WPToolset_Field_Credfile extends WPToolset_Field_Textfield {
|
|
| 184 |
'#type' => 'markup',
|
| 185 |
'#markup' => '<input type="button" style="display:none" data-action="undo" class="js-wpt-credfile-undo wpt-credfile-undo' . $button_extra_classnames . '" value="' . esc_attr(__('Restore original', 'wpv-views')) . '" />',
|
| 186 |
);
|
| 187 |
-
|
| 188 |
-
//
|
| 189 |
-
//
|
| 190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
$form[] = array(
|
| 192 |
'#type' => 'hidden',
|
| 193 |
'#name' => $name,
|
| 135 |
$preview_span_input_showhide = ' style="display:none"';
|
| 136 |
}
|
| 137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
if (!$is_empty) {
|
| 139 |
$pathinfo = pathinfo($value);
|
| 140 |
// TODO we should check against the allowed mime types, not file extensions
|
| 175 |
'#type' => 'markup',
|
| 176 |
'#markup' => '<input type="button" style="display:none" data-action="undo" class="js-wpt-credfile-undo wpt-credfile-undo' . $button_extra_classnames . '" value="' . esc_attr(__('Restore original', 'wpv-views')) . '" />',
|
| 177 |
);
|
| 178 |
+
|
| 179 |
+
//Attachment id for _featured_image if exists
|
| 180 |
+
//if it does not exists file_upload.js will handle it after file is uploaded
|
| 181 |
+
if ($name == '_featured_image') {
|
| 182 |
+
global $post;
|
| 183 |
+
$post_id = $post->ID;
|
| 184 |
+
$post_thumbnail_id = get_post_thumbnail_id( $post_id );
|
| 185 |
+
if (!empty($post_thumbnail_id))
|
| 186 |
+
$form[] = array(
|
| 187 |
+
'#type' => 'markup',
|
| 188 |
+
'#markup' => "<input id='attachid_" .$id. "' name='attachid_" .$id. "' type='hidden' value='" .$post_thumbnail_id. "'>"
|
| 189 |
+
);
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
$form[] = array(
|
| 193 |
'#type' => 'hidden',
|
| 194 |
'#name' => $name,
|
library/toolset/toolset-common/toolset-forms/classes/class.eforms.php
CHANGED
|
@@ -748,7 +748,17 @@ class Enlimbo_Forms {
|
|
| 748 |
$value = $element['#default_value'];
|
| 749 |
}
|
| 750 |
|
| 751 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 752 |
$element['_render']['element'] .= '"' . $element['_attributes_string'];
|
| 753 |
if (
|
| 754 |
(
|
| 748 |
$value = $element['#default_value'];
|
| 749 |
}
|
| 750 |
|
| 751 |
+
// Decide whether we should use the default value from field definition
|
| 752 |
+
// or the current value this checkbox has (from database, presumably)
|
| 753 |
+
//
|
| 754 |
+
// fixme this logic needs to be reviewed and simplified
|
| 755 |
+
$is_zero = ! preg_match('/^0$/', $element['#value'] );
|
| 756 |
+
$is_empty = empty( $element['#value'] );
|
| 757 |
+
$is_boolean = is_bool( $element['#value'] );
|
| 758 |
+
$use_default_value = ( ( $is_empty && $is_zero ) || $is_boolean );
|
| 759 |
+
$value_output = ( $use_default_value ? $value : esc_attr( $element['#value'] ) );
|
| 760 |
+
$element['_render']['element'] .= $value_output;
|
| 761 |
+
|
| 762 |
$element['_render']['element'] .= '"' . $element['_attributes_string'];
|
| 763 |
if (
|
| 764 |
(
|
library/toolset/toolset-common/toolset-forms/classes/class.fieldconfig.php
CHANGED
|
@@ -61,64 +61,10 @@ if (!class_exists("FieldConfig")) {
|
|
| 61 |
return $this->attr;
|
| 62 |
}
|
| 63 |
|
| 64 |
-
public function setDefaultValue($
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
if (isset($field_arr['data']['date_and_time']) && 'and_time' == $field_arr['data']['date_and_time']) {
|
| 69 |
-
$this->add_time = true;
|
| 70 |
-
}
|
| 71 |
-
if (isset($field_arr['value']['timestamp'])) {
|
| 72 |
-
$this->default_value = array('timestamp' => $field_arr['value']['timestamp']);
|
| 73 |
-
} else {
|
| 74 |
-
//In Edit + Ajax call the object contains array of 5 elements timestamps only 1 and 5 (starting from 0) contains number timestamp
|
| 75 |
-
if (isset($field_arr['value'][1]['timestamp']) &&
|
| 76 |
-
is_numeric($field_arr['value'][1]['timestamp']))
|
| 77 |
-
$this->default_value = array('timestamp' => $field_arr['value'][1]['timestamp']);
|
| 78 |
-
}
|
| 79 |
-
break;
|
| 80 |
-
case 'checkboxes':
|
| 81 |
-
/* Output for Toolset common must be:
|
| 82 |
-
* [option_key] => 1
|
| 83 |
-
*/
|
| 84 |
-
$def = array();
|
| 85 |
-
if (!empty($field_arr['value']))
|
| 86 |
-
foreach ($field_arr['value'] as $n => $value) {
|
| 87 |
-
$def[$value] = 1;
|
| 88 |
-
}
|
| 89 |
-
$this->default_value = $def;
|
| 90 |
-
break;
|
| 91 |
-
|
| 92 |
-
case 'select':
|
| 93 |
-
if (isset($field_arr['attr']['multiple'])) {
|
| 94 |
-
$this->default_value = $field_arr['value'];
|
| 95 |
-
} else {
|
| 96 |
-
if (isset($field_arr['attr']['actual_value'])) {
|
| 97 |
-
//This value is not array if from parent
|
| 98 |
-
if (is_array($field_arr['attr']['actual_value']))
|
| 99 |
-
$this->default_value = isset($field_arr['attr']['actual_value'][0]) ? $field_arr['attr']['actual_value'][0] : null;
|
| 100 |
-
else
|
| 101 |
-
$this->default_value = isset($field_arr['attr']['actual_value']) ? $field_arr['attr']['actual_value'] : null;
|
| 102 |
-
} else {
|
| 103 |
-
$this->default_value = null;
|
| 104 |
-
}
|
| 105 |
-
}
|
| 106 |
-
break;
|
| 107 |
-
|
| 108 |
-
case 'radios':
|
| 109 |
-
$this->default_value = $field_arr['attr']['default'];
|
| 110 |
-
break;
|
| 111 |
-
|
| 112 |
-
case 'checkbox':
|
| 113 |
-
$this->default_value = isset($field_arr['data']['checked']) ? true : false;
|
| 114 |
-
break;
|
| 115 |
-
|
| 116 |
-
default:
|
| 117 |
-
$this->default_value = $field_arr['value'];
|
| 118 |
-
break;
|
| 119 |
-
}
|
| 120 |
-
}
|
| 121 |
-
|
| 122 |
public function setOptions($name, $type, $values, $attrs) {
|
| 123 |
$arr = array();
|
| 124 |
switch ($type) {
|
| 61 |
return $this->attr;
|
| 62 |
}
|
| 63 |
|
| 64 |
+
public function setDefaultValue($value) {
|
| 65 |
+
$this->default_value = $value;
|
| 66 |
+
}
|
| 67 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
public function setOptions($name, $type, $values, $attrs) {
|
| 69 |
$arr = array();
|
| 70 |
switch ($type) {
|
library/toolset/toolset-common/toolset-forms/classes/class.taxonomy.php
CHANGED
|
@@ -16,7 +16,7 @@ class WPToolset_Field_Taxonomy extends WPToolset_Field_Textfield {
|
|
| 16 |
$terms = apply_filters('toolset_filter_taxonomy_terms', wp_get_post_terms(CredForm::$current_postid, $this->getName(), array("fields" => "all")));
|
| 17 |
$i = 0;
|
| 18 |
foreach ($terms as $n => $term) {
|
| 19 |
-
$this->values .= ($i == 0) ? $term->
|
| 20 |
$this->objValues[$term->slug] = $term;
|
| 21 |
$i++;
|
| 22 |
}
|
| 16 |
$terms = apply_filters('toolset_filter_taxonomy_terms', wp_get_post_terms(CredForm::$current_postid, $this->getName(), array("fields" => "all")));
|
| 17 |
$i = 0;
|
| 18 |
foreach ($terms as $n => $term) {
|
| 19 |
+
$this->values .= ($i == 0) ? $term->name : "," . $term->name;
|
| 20 |
$this->objValues[$term->slug] = $term;
|
| 21 |
$i++;
|
| 22 |
}
|
library/toolset/toolset-common/toolset-forms/classes/submit.php
CHANGED
|
@@ -1,17 +1,23 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
function cred_find_wp_config_path() {
|
| 4 |
-
$dir
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
}
|
| 9 |
-
}
|
| 10 |
-
return
|
| 11 |
}
|
| 12 |
|
| 13 |
function cred_get_root_path() {
|
| 14 |
-
return cred_find_wp_config_path();
|
| 15 |
}
|
| 16 |
|
| 17 |
function cred_get_local($url) {
|
|
@@ -108,78 +114,90 @@ if (isset($_REQUEST['nonce']) && check_ajax_referer('ajax_nonce', 'nonce', false
|
|
| 108 |
$upload_overrides = array('test_form' => false);
|
| 109 |
if (!empty($_FILES)) {
|
| 110 |
|
| 111 |
-
|
| 112 |
-
foreach ($_FILES as $
|
| 113 |
-
$
|
|
|
|
|
|
|
|
|
|
| 114 |
}
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
-
|
| 119 |
-
list($fields, $errors) = apply_filters('cred_form_ajax_upload_validate_' . $form_id, array($fields, $errors), $thisform);
|
| 120 |
-
list($fields, $errors) = apply_filters('cred_form_ajax_upload_validate', array($fields, $errors), $thisform);
|
| 121 |
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
}
|
| 137 |
}
|
| 138 |
-
}
|
| 139 |
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
} else {
|
| 174 |
-
$
|
| 175 |
-
$attaches[] = $attach_id;
|
| 176 |
}
|
| 177 |
-
} else {
|
| 178 |
-
$error = true;
|
| 179 |
}
|
| 180 |
}
|
|
|
|
| 181 |
}
|
| 182 |
-
$data = ($error) ? array('result' => false, 'error' => __('There was an error uploading your files', 'wpv-views') . ': ' . $res['error']) : array('files' => $files, 'attaches' => $attaches, 'previews' => $previews, 'delete_nonce' => time());
|
| 183 |
} else {
|
| 184 |
$data = array('result' => false, 'error' => __('Error: Files is too big, Max upload size is', 'wpv-views') . ': ' . ini_get('post_max_size'));
|
| 185 |
}
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
function cred_find_wp_config_path($dir, $file2search) {
|
| 4 |
+
if (file_exists($dir . "/" . $file2search)) {
|
| 5 |
+
return $dir . "/";
|
| 6 |
+
}
|
| 7 |
+
$list = scandir($dir, 1);
|
| 8 |
+
foreach ($list as $ele) {
|
| 9 |
+
if ($ele == '.' || $ele == '..')
|
| 10 |
+
continue;
|
| 11 |
+
$newdir = $dir . "/" . $ele;
|
| 12 |
+
if (is_dir($newdir)) {
|
| 13 |
+
return cred_find_wp_config_path($newdir, $file2search);
|
| 14 |
}
|
| 15 |
+
}
|
| 16 |
+
return "";
|
| 17 |
}
|
| 18 |
|
| 19 |
function cred_get_root_path() {
|
| 20 |
+
return cred_find_wp_config_path($_SERVER['DOCUMENT_ROOT'], "wp-load.php");
|
| 21 |
}
|
| 22 |
|
| 23 |
function cred_get_local($url) {
|
| 114 |
$upload_overrides = array('test_form' => false);
|
| 115 |
if (!empty($_FILES)) {
|
| 116 |
|
| 117 |
+
//Control file size wp_max_upload_size()
|
| 118 |
+
foreach ($_FILES as $uploaded_file) {
|
| 119 |
+
if (filesize($uploaded_file["tmp_name"]) > wp_max_upload_size()) {
|
| 120 |
+
$data = array('result' => false, 'error' => __('Error: Files is too big, Max upload size is', 'wpv-views') . ': ' . number_format((wp_max_upload_size() / 1048576), 2) . " MB");
|
| 121 |
+
break;
|
| 122 |
+
}
|
| 123 |
}
|
| 124 |
+
|
| 125 |
+
//If no size errors
|
| 126 |
+
if (empty($data)) {
|
| 127 |
|
| 128 |
+
$fields = array();
|
| 129 |
+
foreach ($_FILES as $name => $v) {
|
| 130 |
+
$fields[$name]['field_data'] = $v;
|
| 131 |
+
}
|
| 132 |
|
| 133 |
+
$errors = array();
|
|
|
|
|
|
|
| 134 |
|
| 135 |
+
list($fields, $errors) = apply_filters('cred_form_ajax_upload_validate_' . $form_slug, array($fields, $errors), $thisform);
|
| 136 |
+
list($fields, $errors) = apply_filters('cred_form_ajax_upload_validate_' . $form_id, array($fields, $errors), $thisform);
|
| 137 |
+
list($fields, $errors) = apply_filters('cred_form_ajax_upload_validate', array($fields, $errors), $thisform);
|
| 138 |
+
|
| 139 |
+
if (!empty($errors)) {
|
| 140 |
+
foreach ($errors as $fname => $err) {
|
| 141 |
+
$data = array('result' => false, 'error' => $fname . ': ' . $err);
|
| 142 |
+
}
|
| 143 |
+
echo json_encode($data);
|
| 144 |
+
die;
|
| 145 |
+
} else {
|
| 146 |
+
foreach ($_FILES as $file) {
|
| 147 |
+
//For repetitive
|
| 148 |
+
foreach ($file as &$f) {
|
| 149 |
+
if (is_array($f)) {
|
| 150 |
+
foreach ($f as $p) {
|
| 151 |
+
$f = $p;
|
| 152 |
+
break;
|
| 153 |
+
}
|
| 154 |
}
|
| 155 |
}
|
|
|
|
| 156 |
|
| 157 |
+
$res = wp_handle_upload($file, $upload_overrides);
|
| 158 |
+
|
| 159 |
+
if (!isset($res['error'])) {
|
| 160 |
+
//StaticClass::_pre($res);
|
| 161 |
+
|
| 162 |
+
$bname = basename($res['file']);
|
| 163 |
+
$attachment = array(
|
| 164 |
+
'post_mime_type' => $res['type'],
|
| 165 |
+
'post_title' => $bname,
|
| 166 |
+
'post_content' => '',
|
| 167 |
+
'post_status' => 'inherit',
|
| 168 |
+
'post_parent' => $post_id,
|
| 169 |
+
'post_type' => 'attachment',
|
| 170 |
+
'guid' => $res['url'],
|
| 171 |
+
);
|
| 172 |
+
$attach_id = wp_insert_attachment($attachment, $res['file']);
|
| 173 |
+
$attach_data = wp_generate_attachment_metadata($attach_id, $res['file']);
|
| 174 |
+
wp_update_attachment_metadata($attach_id, $attach_data);
|
| 175 |
+
|
| 176 |
+
//Fixing S3 Amazon rewriting compatibility
|
| 177 |
+
if (wp_attachment_is_image($attach_id)) {
|
| 178 |
+
$_rewrited_url = wp_get_attachment_image_src($attach_id, 'full');
|
| 179 |
+
$_rewrited_url_prw = wp_get_attachment_image_src($attach_id);
|
| 180 |
+
$attach_data = wp_generate_attachment_metadata($attach_id, $_rewrited_url);
|
| 181 |
+
} else {
|
| 182 |
+
$_rewrited_url = wp_get_attachment_url($attach_id);
|
| 183 |
+
}
|
| 184 |
|
| 185 |
+
if (isset($_rewrited_url)) {
|
| 186 |
+
$files[] = (is_array($_rewrited_url) && isset($_rewrited_url[0])) ? $_rewrited_url[0] : $_rewrited_url; //$res['url'];
|
| 187 |
+
$attaches[] = $attach_id;
|
| 188 |
+
if (isset($_rewrited_url_prw))
|
| 189 |
+
$previews[] = (is_array($_rewrited_url_prw) && isset($_rewrited_url_prw[0])) ? $_rewrited_url_prw[0] : $_rewrited_url_prw; //$res['url'];
|
| 190 |
+
} else {
|
| 191 |
+
$files[] = $res['url'];
|
| 192 |
+
$attaches[] = $attach_id;
|
| 193 |
+
}
|
| 194 |
} else {
|
| 195 |
+
$error = true;
|
|
|
|
| 196 |
}
|
|
|
|
|
|
|
| 197 |
}
|
| 198 |
}
|
| 199 |
+
$data = ($error) ? array('result' => false, 'error' => __('There was an error uploading your files', 'wpv-views') . ': ' . $res['error']) : array('files' => $files, 'attaches' => $attaches, 'previews' => $previews, 'delete_nonce' => time());
|
| 200 |
}
|
|
|
|
| 201 |
} else {
|
| 202 |
$data = array('result' => false, 'error' => __('Error: Files is too big, Max upload size is', 'wpv-views') . ': ' . ini_get('post_max_size'));
|
| 203 |
}
|
library/toolset/toolset-common/toolset-forms/js/credfile.js
CHANGED
|
@@ -26,12 +26,13 @@ var wptCredfile = (function ($) {
|
|
| 26 |
} else {
|
| 27 |
thiz_undo_button.hide();
|
| 28 |
}
|
| 29 |
-
if (myid == '_featured_image')
|
| 30 |
-
$(
|
| 31 |
-
else {
|
| 32 |
-
if (thiz.closest('.js-wpt-repetitive').length>0) {
|
| 33 |
} else
|
| 34 |
-
$(
|
|
|
|
| 35 |
}
|
| 36 |
thiz_file_input.trigger('change');
|
| 37 |
} else if (credfile_action == 'undo') {
|
|
@@ -42,9 +43,12 @@ var wptCredfile = (function ($) {
|
|
| 42 |
//thiz_delete_button.show();
|
| 43 |
thiz_undo_button.hide();
|
| 44 |
if (myid == '_featured_image')
|
| 45 |
-
$('#attachid_' + myid).
|
| 46 |
-
else
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
| 48 |
}
|
| 49 |
});
|
| 50 |
|
| 26 |
} else {
|
| 27 |
thiz_undo_button.hide();
|
| 28 |
}
|
| 29 |
+
if (myid == '_featured_image') {
|
| 30 |
+
$('#attachid_' + myid).val('');
|
| 31 |
+
} else {
|
| 32 |
+
if (thiz.closest('.js-wpt-repetitive').length > 0) {
|
| 33 |
} else
|
| 34 |
+
$('#' + myid).prop('disabled', false);
|
| 35 |
+
//$("<input type='hidden' id='" + myid + "' name='" + myid + "' value=''>").insertAfter('#' + thiz_hidden_input.attr('id'));
|
| 36 |
}
|
| 37 |
thiz_file_input.trigger('change');
|
| 38 |
} else if (credfile_action == 'undo') {
|
| 43 |
//thiz_delete_button.show();
|
| 44 |
thiz_undo_button.hide();
|
| 45 |
if (myid == '_featured_image')
|
| 46 |
+
$('#attachid_' + myid).val($("input[name='_cred_cred_prefix_post_id']").val());
|
| 47 |
+
else {
|
| 48 |
+
if (thiz.closest('.js-wpt-repetitive').length > 0) {
|
| 49 |
+
} else
|
| 50 |
+
$('#' + myid).prop('disabled', false);
|
| 51 |
+
}
|
| 52 |
}
|
| 53 |
});
|
| 54 |
|
library/toolset/toolset-common/toolset-forms/js/jquery_upload/file_upload.js
CHANGED
|
@@ -126,18 +126,6 @@ jQuery(function () {
|
|
| 126 |
//remove restore button
|
| 127 |
jQuery('#' + id).siblings(".js-wpt-credfile-undo").hide();
|
| 128 |
|
| 129 |
-
|
| 130 |
-
// //add image/file uploaded and button to delete
|
| 131 |
-
// if (isImage(file) && data.result.previews) {
|
| 132 |
-
// var preview = data.result.previews[index];
|
| 133 |
-
// var attachid = data.result.attaches[index];
|
| 134 |
-
// jQuery("<img id='loaded_" + myid + "' src='" + preview + "'><input id='butt_" + myid + "' style='width:100%;margin-top:2px;margin-bottom:2px;' type='button' value='" + settings.delete_text + "' rel='" + preview + "' class='delete_ajax_file'>").insertAfter('#' + jQuery(curr_file).attr('id'));
|
| 135 |
-
// jQuery("<input type='hidden' id='attachid_" + myid + "' name='attachid_" + myid + "' value='" + attachid + "'>").insertAfter('#' + jQuery(curr_file).attr('id'));
|
| 136 |
-
// } else {
|
| 137 |
-
// jQuery("<a id='loaded_" + myid + "' href='" + file + "' target='_blank'>" + file + "</a></label><input id='butt_" + myid + "' style='width:100%;margin-top:2px;margin-bottom:2px;' type='button' value='" + settings.delete_text + "' rel='" + file + "' class='delete_ajax_file'>").insertAfter('#' + jQuery(curr_file).attr('id'));
|
| 138 |
-
// }
|
| 139 |
-
// } else {
|
| 140 |
-
//
|
| 141 |
var preview_span = jQuery('#' + id).siblings(".js-wpt-credfile-preview");
|
| 142 |
|
| 143 |
//add image/file uploaded and button to delete
|
|
@@ -156,13 +144,16 @@ jQuery(function () {
|
|
| 156 |
//append new image and delete button to the span
|
| 157 |
jQuery("<img id='loaded_" + myid + "' src='" + preview + "'>").prependTo(preview_span);
|
| 158 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
}
|
| 160 |
|
| 161 |
-
//<input id='butt_" + myid + "' style='width:100%;margin-top:2px;margin-bottom:2px;' type='button' value='" + settings.delete_text + "' rel='" + preview + "' class='delete_ajax_file'>
|
| 162 |
-
//jQuery("<img id='loaded_" + myid + "' src='" + preview + "'>").insertAfter('#' + jQuery(curr_file).attr('id'));
|
| 163 |
-
//jQuery(".js-wpt-credfile-preview-item").find("img").attr("src", preview);
|
| 164 |
-
//jQuery("<input type='hidden' id='attachid_" + myid + "' name='attachid_" + myid + "' value='" + attachid + "'>").insertAfter('#' + jQuery(curr_file).attr('id'));
|
| 165 |
-
jQuery("#attachid_" + myid).attr("value", attachid);
|
| 166 |
} else {
|
| 167 |
//<input id='butt_" + myid + "' style='width:100%;margin-top:2px;margin-bottom:2px;' type='button' value='" + settings.delete_text + "' rel='" + file + "' class='delete_ajax_file'>
|
| 168 |
jQuery("<a id='loaded_" + myid + "' href='" + file + "' target='_blank'>" + file + "</a></label>").insertAfter('#' + jQuery(curr_file).attr('id'));
|
|
@@ -170,45 +161,6 @@ jQuery(function () {
|
|
| 170 |
if (typeof preview_span !== undefined)
|
| 171 |
jQuery(preview_span).show();
|
| 172 |
|
| 173 |
-
// }
|
| 174 |
-
|
| 175 |
-
//add function to delete button
|
| 176 |
-
// jQuery(document).off('click', "#butt_" + myid, null);
|
| 177 |
-
// jQuery(document).on('click', "#butt_" + myid, function () {
|
| 178 |
-
// if (confirm(settings.delete_confirm_text)) {
|
| 179 |
-
// jQuery("#loaded_" + myid).remove();
|
| 180 |
-
// jQuery("#butt_" + myid).remove();
|
| 181 |
-
// jQuery("#attachid_" + myid).remove();
|
| 182 |
-
//
|
| 183 |
-
// jQuery('#' + id).show();
|
| 184 |
-
// jQuery('#' + id).prop('disabled', false);
|
| 185 |
-
//
|
| 186 |
-
// jQuery('#' + hidden_id).val("");
|
| 187 |
-
// jQuery('#' + hidden_id).prop('disabled', true);
|
| 188 |
-
//
|
| 189 |
-
// jQuery.ajax({
|
| 190 |
-
// url: url,
|
| 191 |
-
// timeout: 10000,
|
| 192 |
-
// type: 'POST',
|
| 193 |
-
// data: {action: 'delete', file: file, nonce: nonce, id: post_id},
|
| 194 |
-
// dataType: 'json',
|
| 195 |
-
// success: function (data)
|
| 196 |
-
// {
|
| 197 |
-
// if (!data.result) {
|
| 198 |
-
// if (data.error)
|
| 199 |
-
// alert(data.error);
|
| 200 |
-
// else
|
| 201 |
-
// alert(settings.delete_alert_text);
|
| 202 |
-
// }
|
| 203 |
-
// credfile_fu_init();
|
| 204 |
-
// },
|
| 205 |
-
// error: function ()
|
| 206 |
-
// {
|
| 207 |
-
// }
|
| 208 |
-
// });
|
| 209 |
-
// }
|
| 210 |
-
// });
|
| 211 |
-
|
| 212 |
wptCredfile.init('body');
|
| 213 |
});
|
| 214 |
credfile_fu_init();
|
|
@@ -237,7 +189,7 @@ jQuery(function () {
|
|
| 237 |
progressall: function (e, data) {
|
| 238 |
var progress = parseInt(data.loaded / data.total * 100, 10);
|
| 239 |
var id = jQuery(curr_file).attr('id');
|
| 240 |
-
|
| 241 |
var wpt_id = jQuery('#' + id).siblings(".meter").attr("id"); //id.replace("_file", "");
|
| 242 |
jQuery('#' + wpt_id).show();
|
| 243 |
//jQuery('#progress_' + wpt_id).css({'width': '100%'});
|
| 126 |
//remove restore button
|
| 127 |
jQuery('#' + id).siblings(".js-wpt-credfile-undo").hide();
|
| 128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
var preview_span = jQuery('#' + id).siblings(".js-wpt-credfile-preview");
|
| 130 |
|
| 131 |
//add image/file uploaded and button to delete
|
| 144 |
//append new image and delete button to the span
|
| 145 |
jQuery("<img id='loaded_" + myid + "' src='" + preview + "'>").prependTo(preview_span);
|
| 146 |
}
|
| 147 |
+
|
| 148 |
+
if (myid == '_featured_image') {
|
| 149 |
+
if (jQuery("#attachid_" + myid).lenght > 0) {
|
| 150 |
+
jQuery("#attachid_" + myid).attr("value", attachid);
|
| 151 |
+
} else {
|
| 152 |
+
jQuery("<input id='attachid_" + myid + "' name='attachid_" + myid + "' type='hidden' value='" + attachid + "'>").appendTo(preview_span.parent());
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
}
|
| 156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
} else {
|
| 158 |
//<input id='butt_" + myid + "' style='width:100%;margin-top:2px;margin-bottom:2px;' type='button' value='" + settings.delete_text + "' rel='" + file + "' class='delete_ajax_file'>
|
| 159 |
jQuery("<a id='loaded_" + myid + "' href='" + file + "' target='_blank'>" + file + "</a></label>").insertAfter('#' + jQuery(curr_file).attr('id'));
|
| 161 |
if (typeof preview_span !== undefined)
|
| 162 |
jQuery(preview_span).show();
|
| 163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
wptCredfile.init('body');
|
| 165 |
});
|
| 166 |
credfile_fu_init();
|
| 189 |
progressall: function (e, data) {
|
| 190 |
var progress = parseInt(data.loaded / data.total * 100, 10);
|
| 191 |
var id = jQuery(curr_file).attr('id');
|
| 192 |
+
|
| 193 |
var wpt_id = jQuery('#' + id).siblings(".meter").attr("id"); //id.replace("_file", "");
|
| 194 |
jQuery('#' + wpt_id).show();
|
| 195 |
//jQuery('#progress_' + wpt_id).css({'width': '100%'});
|
library/toolset/toolset-common/toolset-forms/js/main.js
CHANGED
|
@@ -564,16 +564,18 @@ toolsetForms.CRED_taxonomy = function () {
|
|
| 564 |
jQuery('<input name="' + taxonomy + '_hierarchy" style="display:none" type="hidden">').insertAfter(jQuery('[name="new_tax_text_' + taxonomy + '"]', form));
|
| 565 |
new_taxonomy_input = jQuery('input[name="' + taxonomy + '_hierarchy"]', form);
|
| 566 |
}
|
|
|
|
|
|
|
|
|
|
| 567 |
|
| 568 |
var parent = jQuery('[name="new_tax_select_' + taxonomy + '"]', form).val();
|
| 569 |
-
self._new_taxonomy.push(parent + ',' + new_taxonomy);
|
| 570 |
|
| 571 |
var value = '';
|
| 572 |
-
for (var i = 0; i < self._new_taxonomy.length; i++) {
|
| 573 |
-
value += '{' + self._new_taxonomy[i] + '}';
|
| 574 |
}
|
| 575 |
new_taxonomy_input.val(value);
|
| 576 |
-
|
| 577 |
}
|
| 578 |
|
| 579 |
self._flash_it = function (element) {
|
| 564 |
jQuery('<input name="' + taxonomy + '_hierarchy" style="display:none" type="hidden">').insertAfter(jQuery('[name="new_tax_text_' + taxonomy + '"]', form));
|
| 565 |
new_taxonomy_input = jQuery('input[name="' + taxonomy + '_hierarchy"]', form);
|
| 566 |
}
|
| 567 |
+
|
| 568 |
+
if (typeof self._new_taxonomy[taxonomy] == 'undefined')
|
| 569 |
+
self._new_taxonomy[taxonomy] = new Array();
|
| 570 |
|
| 571 |
var parent = jQuery('[name="new_tax_select_' + taxonomy + '"]', form).val();
|
| 572 |
+
self._new_taxonomy[taxonomy].push(parent + ',' + new_taxonomy);
|
| 573 |
|
| 574 |
var value = '';
|
| 575 |
+
for (var i = 0; i < self._new_taxonomy[taxonomy].length; i++) {
|
| 576 |
+
value += '{' + self._new_taxonomy[taxonomy][i] + '}';
|
| 577 |
}
|
| 578 |
new_taxonomy_input.val(value);
|
|
|
|
| 579 |
}
|
| 580 |
|
| 581 |
self._flash_it = function (element) {
|
library/toolset/toolset-common/user-editors/resource/types/dialog.php
CHANGED
|
@@ -38,7 +38,7 @@ class Toolset_User_Editors_Resource_Views_Dialog_Types {
|
|
| 38 |
wp_enqueue_script(
|
| 39 |
'wpcf-js-embedded',
|
| 40 |
TYPES_RELPATH . '/library/toolset/types/embedded/resources/js/basic.js',
|
| 41 |
-
array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs', '
|
| 42 |
WPCF_VERSION
|
| 43 |
);
|
| 44 |
|
| 38 |
wp_enqueue_script(
|
| 39 |
'wpcf-js-embedded',
|
| 40 |
TYPES_RELPATH . '/library/toolset/types/embedded/resources/js/basic.js',
|
| 41 |
+
array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs', 'toolset_select2'),
|
| 42 |
WPCF_VERSION
|
| 43 |
);
|
| 44 |
|
library/toolset/toolset-common/user-editors/resource/views/dialog/types-fields.php
CHANGED
|
@@ -48,7 +48,7 @@ class Toolset_User_Editors_Resource_Views_Dialog_Types_Fields
|
|
| 48 |
wp_enqueue_script(
|
| 49 |
'wpcf-js-embedded',
|
| 50 |
TYPES_RELPATH . '/library/toolset/types/embedded/resources/js/basic.js',
|
| 51 |
-
array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs', '
|
| 52 |
WPCF_VERSION
|
| 53 |
);
|
| 54 |
|
| 48 |
wp_enqueue_script(
|
| 49 |
'wpcf-js-embedded',
|
| 50 |
TYPES_RELPATH . '/library/toolset/types/embedded/resources/js/basic.js',
|
| 51 |
+
array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs', 'toolset_select2'),
|
| 52 |
WPCF_VERSION
|
| 53 |
);
|
| 54 |
|
library/toolset/toolset-common/utility/dialogs/css/dd-dialogs-forms.css
CHANGED
|
@@ -97,7 +97,7 @@ ul.ddl-form { /* If .ddl-form class is added directly to <ul> element */
|
|
| 97 |
.ddl-form .checkbox,
|
| 98 |
.ddl-form .fields-group,
|
| 99 |
.ddl-form .desc,
|
| 100 |
-
.ddl-form .
|
| 101 |
display: block;
|
| 102 |
float: right;
|
| 103 |
clear: right;
|
|
@@ -127,7 +127,7 @@ ul.ddl-form { /* If .ddl-form class is added directly to <ul> element */
|
|
| 127 |
.ddl-form .checkbox.ddl-form-indent,
|
| 128 |
.ddl-form .fields-group.ddl-form-indent,
|
| 129 |
.ddl-form .desc.ddl-form-indent,
|
| 130 |
-
.ddl-form .
|
| 131 |
width: 534px;
|
| 132 |
}
|
| 133 |
|
|
@@ -191,7 +191,7 @@ ul.ddl-form { /* If .ddl-form class is added directly to <ul> element */
|
|
| 191 |
.ddl-form .fields-group .radio,
|
| 192 |
.ddl-form .fields-group .checkbox,
|
| 193 |
.ddl-form .fields-group .desc,
|
| 194 |
-
.ddl-form .fields-group .
|
| 195 |
float: none;
|
| 196 |
}
|
| 197 |
|
|
@@ -209,7 +209,7 @@ ul.ddl-form { /* If .ddl-form class is added directly to <ul> element */
|
|
| 209 |
.ddl-form .ddl-form-item-fullwidth textarea,
|
| 210 |
.ddl-form .ddl-form-item-fullwidth select,
|
| 211 |
.ddl-form .ddl-form-item-fullwidth .desc,
|
| 212 |
-
.ddl-form .ddl-form-item-fullwidth .ddl-form .
|
| 213 |
.ddl-form .ddl-form-item-fullwidth .fields-group {
|
| 214 |
display: block;
|
| 215 |
width: 100%;
|
|
@@ -246,11 +246,11 @@ ul.ddl-form { /* If .ddl-form class is added directly to <ul> element */
|
|
| 246 |
/* Validation */
|
| 247 |
.ddl-form .invalid,
|
| 248 |
.ddl-form .invalid:focus,
|
| 249 |
-
.ddl-form .invalid .
|
| 250 |
border-color: #e9322d;
|
| 251 |
box-shadow: 0 0 6px #f8b9b7 inset;
|
| 252 |
}
|
| 253 |
-
.ddl-form .invalid.
|
| 254 |
border: none;
|
| 255 |
box-shadow: none;
|
| 256 |
}
|
|
@@ -363,7 +363,7 @@ input#searchbar-input{float:none;}
|
|
| 363 |
.cm-s-default { z-index: 0; }
|
| 364 |
|
| 365 |
/* SHOW MORE POSTS */
|
| 366 |
-
li.
|
| 367 |
i.load-posts-spinner{color:black;}
|
| 368 |
i.load-posts-spinner:hover{color:white;}
|
| 369 |
/* ////// LANGUAGE SWITCHER///////// */
|
| 97 |
.ddl-form .checkbox,
|
| 98 |
.ddl-form .fields-group,
|
| 99 |
.ddl-form .desc,
|
| 100 |
+
.ddl-form .toolset_select2-container {
|
| 101 |
display: block;
|
| 102 |
float: right;
|
| 103 |
clear: right;
|
| 127 |
.ddl-form .checkbox.ddl-form-indent,
|
| 128 |
.ddl-form .fields-group.ddl-form-indent,
|
| 129 |
.ddl-form .desc.ddl-form-indent,
|
| 130 |
+
.ddl-form .toolset_select2-container.ddl-form-indent {
|
| 131 |
width: 534px;
|
| 132 |
}
|
| 133 |
|
| 191 |
.ddl-form .fields-group .radio,
|
| 192 |
.ddl-form .fields-group .checkbox,
|
| 193 |
.ddl-form .fields-group .desc,
|
| 194 |
+
.ddl-form .fields-group .toolset_select2-container {
|
| 195 |
float: none;
|
| 196 |
}
|
| 197 |
|
| 209 |
.ddl-form .ddl-form-item-fullwidth textarea,
|
| 210 |
.ddl-form .ddl-form-item-fullwidth select,
|
| 211 |
.ddl-form .ddl-form-item-fullwidth .desc,
|
| 212 |
+
.ddl-form .ddl-form-item-fullwidth .ddl-form .toolset_select2-container,
|
| 213 |
.ddl-form .ddl-form-item-fullwidth .fields-group {
|
| 214 |
display: block;
|
| 215 |
width: 100%;
|
| 246 |
/* Validation */
|
| 247 |
.ddl-form .invalid,
|
| 248 |
.ddl-form .invalid:focus,
|
| 249 |
+
.ddl-form .invalid .toolset_select2-choices {
|
| 250 |
border-color: #e9322d;
|
| 251 |
box-shadow: 0 0 6px #f8b9b7 inset;
|
| 252 |
}
|
| 253 |
+
.ddl-form .invalid.toolset_select2-container {
|
| 254 |
border: none;
|
| 255 |
box-shadow: none;
|
| 256 |
}
|
| 363 |
.cm-s-default { z-index: 0; }
|
| 364 |
|
| 365 |
/* SHOW MORE POSTS */
|
| 366 |
+
li.toolset_select2-results-dept-0.toolset_select2-result.show-more-posts-options{font-weight:bold;color:#f05a28;}
|
| 367 |
i.load-posts-spinner{color:black;}
|
| 368 |
i.load-posts-spinner:hover{color:white;}
|
| 369 |
/* ////// LANGUAGE SWITCHER///////// */
|
library/toolset/toolset-common/utility/dialogs/js/views/abstract/ddl-abstract-dialog.js
CHANGED
|
@@ -15,7 +15,7 @@ var DDLayout = DDLayout || {};
|
|
| 15 |
this._trigger('refresh');
|
| 16 |
},
|
| 17 |
_allowInteraction: function( event ) {
|
| 18 |
-
return !!$( event.target ).is( ".
|
| 19 |
},
|
| 20 |
_create:function( ){
|
| 21 |
this._super("_create");
|
| 15 |
this._trigger('refresh');
|
| 16 |
},
|
| 17 |
_allowInteraction: function( event ) {
|
| 18 |
+
return !!$( event.target ).is( ".toolset_select2-input" ) || this._super( event );
|
| 19 |
},
|
| 20 |
_create:function( ){
|
| 21 |
this._super("_create");
|
library/toolset/toolset-common/utility/help-videos/toolset-help-videos.php
CHANGED
|
@@ -54,13 +54,13 @@ if( !class_exists('Toolset_HelpVideo') ) {
|
|
| 54 |
|
| 55 |
public function add_register_scripts($scripts)
|
| 56 |
{
|
| 57 |
-
$scripts[] = new Toolset_Script('toolset-help-video', TOOLSET_COMMON_URL . '/utility/help-videos/res/js/toolset-help-videos.js', array('jquery', 'underscore', 'backbone', 'wp-mediaelement', 'toolset-utils'), '1.0', true);
|
| 58 |
return $scripts;
|
| 59 |
}
|
| 60 |
|
| 61 |
public function add_register_styles($styles)
|
| 62 |
{
|
| 63 |
-
$styles[] = new Toolset_Style('toolset-help-video', TOOLSET_COMMON_URL . '/utility/help-videos/res/css/toolset-help-videos.css');
|
| 64 |
return $styles;
|
| 65 |
}
|
| 66 |
|
| 54 |
|
| 55 |
public function add_register_scripts($scripts)
|
| 56 |
{
|
| 57 |
+
$scripts['toolset-help-video'] = new Toolset_Script('toolset-help-video', TOOLSET_COMMON_URL . '/utility/help-videos/res/js/toolset-help-videos.js', array('jquery', 'underscore', 'backbone', 'wp-mediaelement', 'toolset-utils'), '1.0', true);
|
| 58 |
return $scripts;
|
| 59 |
}
|
| 60 |
|
| 61 |
public function add_register_styles($styles)
|
| 62 |
{
|
| 63 |
+
$styles['toolset-help-video'] = new Toolset_Style('toolset-help-video', TOOLSET_COMMON_URL . '/utility/help-videos/res/css/toolset-help-videos.css');
|
| 64 |
return $styles;
|
| 65 |
}
|
| 66 |
|
library/toolset/types/embedded/classes/loader.php
CHANGED
|
@@ -121,7 +121,7 @@ class WPCF_Loader
|
|
| 121 |
$min = '';//WPCF_DEBUG ? '-min' : '';
|
| 122 |
wp_register_script( 'types',
|
| 123 |
WPCF_EMBEDDED_RES_RELPATH . '/js/basic.js',
|
| 124 |
-
array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs', '
|
| 125 |
WPCF_VERSION, true );
|
| 126 |
wp_register_script( 'types-knockout',
|
| 127 |
WPCF_EMBEDDED_RES_RELPATH . '/js/knockout-2.2.1.js',
|
| 121 |
$min = '';//WPCF_DEBUG ? '-min' : '';
|
| 122 |
wp_register_script( 'types',
|
| 123 |
WPCF_EMBEDDED_RES_RELPATH . '/js/basic.js',
|
| 124 |
+
array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs', 'toolset_select2'),
|
| 125 |
WPCF_VERSION, true );
|
| 126 |
wp_register_script( 'types-knockout',
|
| 127 |
WPCF_EMBEDDED_RES_RELPATH . '/js/knockout-2.2.1.js',
|
library/toolset/types/embedded/functions.php
CHANGED
|
@@ -7,28 +7,23 @@
|
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
-
*
|
|
|
|
| 11 |
*
|
| 12 |
-
* @staticvar array $cache
|
| 13 |
* @param type $post_id
|
| 14 |
* @param type $meta_key
|
| 15 |
* @param type $single
|
| 16 |
* @return string
|
| 17 |
*/
|
| 18 |
-
function wpcf_get_post_meta($post_id, $meta_key, $single)
|
| 19 |
-
{
|
| 20 |
-
static $cache = array();
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
if ( $single && isset( $cache[$post_id][$meta_key][0] ) ) {
|
| 27 |
-
return maybe_unserialize( $cache[$post_id][$meta_key][0] );
|
| 28 |
-
} elseif ( !$single && !empty( $cache[$post_id][$meta_key] ) ) {
|
| 29 |
-
return maybe_unserialize( $cache[$post_id][$meta_key] );
|
| 30 |
-
}
|
| 31 |
}
|
|
|
|
|
|
|
| 32 |
return '';
|
| 33 |
}
|
| 34 |
|
|
@@ -541,7 +536,7 @@ function wpcf_enqueue_scripts()
|
|
| 541 |
wp_enqueue_script(
|
| 542 |
'wpcf-js-embedded',
|
| 543 |
WPCF_EMBEDDED_RES_RELPATH . '/js/basic.js',
|
| 544 |
-
array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs', '
|
| 545 |
WPCF_VERSION
|
| 546 |
);
|
| 547 |
wp_localize_script( 'wpcf-js-embedded', 'WPCF_basic', array(
|
|
@@ -585,11 +580,11 @@ function wpcf_enqueue_scripts()
|
|
| 585 |
/**
|
| 586 |
* select2
|
| 587 |
*/
|
| 588 |
-
$select2_version = '
|
| 589 |
-
if ( !wp_script_is('
|
| 590 |
wp_register_script(
|
| 591 |
-
'
|
| 592 |
-
WPCF_EMBEDDED_TOOLSET_RELPATH. '/toolset-common/res/lib/select2/select2.
|
| 593 |
array( 'jquery' ),
|
| 594 |
$select2_version
|
| 595 |
);
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
+
* Returns the post meta or empty string if not available
|
| 11 |
+
* Since 2.3 the function no longer has its own caching.
|
| 12 |
*
|
|
|
|
| 13 |
* @param type $post_id
|
| 14 |
* @param type $meta_key
|
| 15 |
* @param type $single
|
| 16 |
* @return string
|
| 17 |
*/
|
| 18 |
+
function wpcf_get_post_meta($post_id, $meta_key, $single) {
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
$post_meta = get_post_meta( $post_id, $meta_key, $single );
|
| 21 |
+
|
| 22 |
+
if( $post_meta && ! empty( $post_meta ) ) {
|
| 23 |
+
return maybe_unserialize( $post_meta );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
}
|
| 25 |
+
|
| 26 |
+
// no meta data
|
| 27 |
return '';
|
| 28 |
}
|
| 29 |
|
| 536 |
wp_enqueue_script(
|
| 537 |
'wpcf-js-embedded',
|
| 538 |
WPCF_EMBEDDED_RES_RELPATH . '/js/basic.js',
|
| 539 |
+
array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-tabs', 'toolset_select2'),
|
| 540 |
WPCF_VERSION
|
| 541 |
);
|
| 542 |
wp_localize_script( 'wpcf-js-embedded', 'WPCF_basic', array(
|
| 580 |
/**
|
| 581 |
* select2
|
| 582 |
*/
|
| 583 |
+
$select2_version = '4.0.3';
|
| 584 |
+
if ( !wp_script_is('toolset_select2', 'registered') ) {
|
| 585 |
wp_register_script(
|
| 586 |
+
'toolset_select2',
|
| 587 |
+
WPCF_EMBEDDED_TOOLSET_RELPATH. '/toolset-common/res/lib/select2/select2.js',
|
| 588 |
array( 'jquery' ),
|
| 589 |
$select2_version
|
| 590 |
);
|
library/toolset/types/embedded/includes/ajax.php
CHANGED
|
@@ -102,35 +102,9 @@ function wpcf_ajax_embedded() {
|
|
| 102 |
|
| 103 |
$target_post_type = isset( $_GET['post_type_child'] ) ? sanitize_text_field( $_GET['post_type_child'] ) : '';
|
| 104 |
|
| 105 |
-
$has_permissions
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
&& class_exists( 'TAccess_Loader' )
|
| 109 |
-
&& $target_post_type != ''
|
| 110 |
-
) {
|
| 111 |
-
$model = TAccess_Loader::get('MODEL/Access');
|
| 112 |
-
$settings_access = $model->getAccessTypes();
|
| 113 |
-
if ( isset( $settings_access[$target_post_type] ) ) {
|
| 114 |
-
$role = Access_Helper::wpcf_get_current_logged_user_role();
|
| 115 |
-
if ( $role == '' ) {
|
| 116 |
-
$role = 'guest';
|
| 117 |
-
$user_level = 0;
|
| 118 |
-
}
|
| 119 |
-
if ( $role != 'administrator' ) {
|
| 120 |
-
if ( $role != 'guest') {
|
| 121 |
-
$user_level = Access_Helper::wpcf_get_current_logged_user_level( $current_user );
|
| 122 |
-
}
|
| 123 |
-
$has_permissions = Access_Helper::wpcf_access_check_if_user_can( $settings_access[$target_post_type]['permissions']['publish']['role'], $user_level );
|
| 124 |
-
}
|
| 125 |
-
} else if ( ! current_user_can( 'publish_posts' ) ) {
|
| 126 |
-
$has_permissions = false;
|
| 127 |
-
}
|
| 128 |
-
} else {
|
| 129 |
-
if ( ! current_user_can( 'publish_posts' ) ) {
|
| 130 |
-
$has_permissions = false;
|
| 131 |
-
}
|
| 132 |
-
}
|
| 133 |
-
|
| 134 |
if ( ! $has_permissions ) {
|
| 135 |
$output = '<tr><td>' . __( 'You do not have rights to create new items', 'wpcf' ) . '</td></tr>';
|
| 136 |
} else if (
|
| 102 |
|
| 103 |
$target_post_type = isset( $_GET['post_type_child'] ) ? sanitize_text_field( $_GET['post_type_child'] ) : '';
|
| 104 |
|
| 105 |
+
$has_permissions = current_user_can( 'publish_posts' );
|
| 106 |
+
$has_permissions = apply_filters('toolset_access_api_get_post_type_permissions', $has_permissions, $target_post_type, 'publish');
|
| 107 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
if ( ! $has_permissions ) {
|
| 109 |
$output = '<tr><td>' . __( 'You do not have rights to create new items', 'wpcf' ) . '</td></tr>';
|
| 110 |
} else if (
|
library/toolset/types/embedded/includes/post-relationship.php
CHANGED
|
@@ -8,9 +8,16 @@ add_action( 'wpcf_admin_post_init', 'wpcf_pr_admin_post_init_action', 10, 4 );
|
|
| 8 |
add_action( 'save_post', 'wpcf_pr_admin_save_post_hook', 20, 2 ); // Trigger afer main hook
|
| 9 |
if ( is_admin() ) {
|
| 10 |
add_action('wp_ajax_wpcf_relationship_search', 'wpcf_pr_admin_wpcf_relationship_search');
|
|
|
|
| 11 |
add_action('wp_ajax_wpcf_relationship_entry', 'wpcf_pr_admin_wpcf_relationship_entry');
|
|
|
|
| 12 |
add_action('wp_ajax_wpcf_relationship_delete', 'wpcf_pr_admin_wpcf_relationship_delete');
|
|
|
|
| 13 |
add_action('wp_ajax_wpcf_relationship_save', 'wpcf_pr_admin_wpcf_relationship_save');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
}
|
| 15 |
|
| 16 |
/**
|
|
@@ -48,15 +55,16 @@ function wpcf_pr_admin_post_init_action( $post_type, $post, $groups, $wpcf_activ
|
|
| 48 |
wp_register_script(
|
| 49 |
'wpcf-post-relationship',
|
| 50 |
WPCF_EMBEDDED_RELPATH . '/resources/js/post-relationship.js',
|
| 51 |
-
array('jquery', '
|
| 52 |
WPCF_VERSION
|
| 53 |
);
|
| 54 |
wp_localize_script(
|
| 55 |
'wpcf-post-relationship',
|
| 56 |
'wpcf_post_relationship_messages',
|
| 57 |
array(
|
| 58 |
-
'parent_saving'
|
| 59 |
-
'parent_saving_success'
|
|
|
|
| 60 |
)
|
| 61 |
);
|
| 62 |
wp_enqueue_script( 'wpcf-post-relationship');
|
|
@@ -260,18 +268,25 @@ function wpcf_pr_admin_post_meta_box_output( $post, $args )
|
|
| 260 |
$output .= '<div class="belongs">';
|
| 261 |
$form = wpcf_pr_admin_post_meta_box_belongs_form( $post, $post_type, $belongs );
|
| 262 |
if ( isset($form[$post_type]) ) {
|
| 263 |
-
$form[$post_type]['#before'] =
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
}
|
| 276 |
if ( $x = wpcf_form_simple( $form ) ) {
|
| 277 |
$output .= $x;
|
|
@@ -329,6 +344,34 @@ function wpcf_pr_admin_post_meta_box_belongs_form( $post, $type, $belongs )
|
|
| 329 |
}
|
| 330 |
$form = array();
|
| 331 |
$id = esc_attr(sprintf('wpcf_pr_belongs_%d_%s', $post->ID, $type));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
$form[$type] = array(
|
| 333 |
'#type' => 'textfield',
|
| 334 |
'#name' => 'wpcf_pr_belongs[' . $post->ID . '][' . $type . ']',
|
|
@@ -345,9 +388,10 @@ function wpcf_pr_admin_post_meta_box_belongs_form( $post, $type, $belongs )
|
|
| 345 |
),
|
| 346 |
);
|
| 347 |
|
| 348 |
-
if( $
|
| 349 |
-
|
| 350 |
}
|
|
|
|
| 351 |
|
| 352 |
return $form;
|
| 353 |
}
|
|
@@ -594,85 +638,77 @@ function wpcf_pr_admin_wpcf_relationship_check($keys_to_check = array())
|
|
| 594 |
function wpcf_pr_admin_wpcf_relationship_search()
|
| 595 |
{
|
| 596 |
wpcf_pr_admin_wpcf_relationship_check(array('s'));
|
| 597 |
-
|
| 598 |
-
|
| 599 |
-
|
| 600 |
-
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
if ( $the_query->have_posts() ) {
|
| 634 |
-
while ( $the_query->have_posts() ) {
|
| 635 |
-
$the_query->the_post();
|
| 636 |
-
$posts['items'][] = array(
|
| 637 |
-
'ID' => get_the_ID(),
|
| 638 |
-
'parent_id' => isset($_REQUEST['post_id'])? intval($_REQUEST['post_id']):0,
|
| 639 |
-
'edit_link' => html_entity_decode(get_edit_post_link(get_the_ID())),
|
| 640 |
-
'post_title' => get_the_title(),
|
| 641 |
-
'post_type' => get_post_type(),
|
| 642 |
-
);
|
| 643 |
-
}
|
| 644 |
-
}
|
| 645 |
-
/* Restore original Post Data */
|
| 646 |
-
wp_reset_postdata();
|
| 647 |
-
|
| 648 |
-
// @todo If WPML is on, but I truly think this is done in WP_Query directly... worth to check
|
| 649 |
-
$is_translated_post_type = apply_filters( 'wpml_is_translated_post_type', false, esc_attr( $_REQUEST['post_type'] ) );
|
| 650 |
-
if (
|
| 651 |
-
$is_translated_post_type
|
| 652 |
-
&& $active_lang = apply_filters( 'wpml_current_language', false )
|
| 653 |
) {
|
| 654 |
-
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
|
| 658 |
-
|
| 659 |
-
|
| 660 |
-
|
| 661 |
-
|
| 662 |
-
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
|
| 671 |
-
|
| 672 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 673 |
die;
|
| 674 |
}
|
| 675 |
|
|
|
|
| 676 |
function wpcf_pr_admin_wpcf_relationship_entry()
|
| 677 |
{
|
| 678 |
wpcf_pr_admin_wpcf_relationship_check(array('p'));
|
|
@@ -692,6 +728,7 @@ function wpcf_pr_admin_wpcf_relationship_entry()
|
|
| 692 |
die;
|
| 693 |
}
|
| 694 |
|
|
|
|
| 695 |
function wpcf_pr_admin_wpcf_relationship_delete()
|
| 696 |
{
|
| 697 |
wpcf_pr_admin_wpcf_relationship_check();
|
|
@@ -704,6 +741,7 @@ function wpcf_pr_admin_wpcf_relationship_delete()
|
|
| 704 |
die;
|
| 705 |
}
|
| 706 |
|
|
|
|
| 707 |
function wpcf_pr_admin_wpcf_relationship_save()
|
| 708 |
{
|
| 709 |
wpcf_pr_admin_wpcf_relationship_check(array('p'));
|
|
@@ -711,3 +749,27 @@ function wpcf_pr_admin_wpcf_relationship_save()
|
|
| 711 |
die;
|
| 712 |
}
|
| 713 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
add_action( 'save_post', 'wpcf_pr_admin_save_post_hook', 20, 2 ); // Trigger afer main hook
|
| 9 |
if ( is_admin() ) {
|
| 10 |
add_action('wp_ajax_wpcf_relationship_search', 'wpcf_pr_admin_wpcf_relationship_search');
|
| 11 |
+
// Deprecated since the introduction of select v.4
|
| 12 |
add_action('wp_ajax_wpcf_relationship_entry', 'wpcf_pr_admin_wpcf_relationship_entry');
|
| 13 |
+
// Deprecated since the introduction of select v.4
|
| 14 |
add_action('wp_ajax_wpcf_relationship_delete', 'wpcf_pr_admin_wpcf_relationship_delete');
|
| 15 |
+
// Deprecated since the introduction of select v.4
|
| 16 |
add_action('wp_ajax_wpcf_relationship_save', 'wpcf_pr_admin_wpcf_relationship_save');
|
| 17 |
+
// Used since the introduction of select2 v.4
|
| 18 |
+
add_action('wp_ajax_wpcf_relationship_update', 'wpcf_pr_admin_wpcf_relationship_update');
|
| 19 |
+
|
| 20 |
+
add_filter( 'wpcf_pr_belongs_post_numberposts', 'wpcf_pr_belongs_post_numberposts_minimum', PHP_INT_MAX, 1 );
|
| 21 |
}
|
| 22 |
|
| 23 |
/**
|
| 55 |
wp_register_script(
|
| 56 |
'wpcf-post-relationship',
|
| 57 |
WPCF_EMBEDDED_RELPATH . '/resources/js/post-relationship.js',
|
| 58 |
+
array('jquery', 'toolset_select2'),
|
| 59 |
WPCF_VERSION
|
| 60 |
);
|
| 61 |
wp_localize_script(
|
| 62 |
'wpcf-post-relationship',
|
| 63 |
'wpcf_post_relationship_messages',
|
| 64 |
array(
|
| 65 |
+
'parent_saving' => __('Saving post parent.', 'wpcf'),
|
| 66 |
+
'parent_saving_success' => __('Saved.', 'wpcf'),
|
| 67 |
+
'parent_per_page' => apply_filters( 'wpcf_pr_belongs_post_numberposts', 10 )
|
| 68 |
)
|
| 69 |
);
|
| 70 |
wp_enqueue_script( 'wpcf-post-relationship');
|
| 268 |
$output .= '<div class="belongs">';
|
| 269 |
$form = wpcf_pr_admin_post_meta_box_belongs_form( $post, $post_type, $belongs );
|
| 270 |
if ( isset($form[$post_type]) ) {
|
| 271 |
+
$form[$post_type]['#before'] =
|
| 272 |
+
'<p>'
|
| 273 |
+
. sprintf(
|
| 274 |
+
__( 'This <em>%s</em> belongs to <em>%s</em>', 'wpcf' ),
|
| 275 |
+
get_post_type_object($current_post_type)->labels->singular_name,
|
| 276 |
+
$parent_post_type_object->labels->singular_name
|
| 277 |
+
);
|
| 278 |
+
$button_classname = ( $form[$post_type]['#default_value'] > 0 ) ? 'button wpcf-pr-parent-edit js-wpcf-pr-parent-edit' : 'button wpcf-pr-parent-edit js-wpcf-pr-parent-edit disabled';
|
| 279 |
+
$button_style = ( $form[$post_type]['#default_value'] > 0 ) ? '' : 'display:none';
|
| 280 |
+
$form[$post_type]['#after'] =
|
| 281 |
+
'<a'
|
| 282 |
+
. ' href="' . get_edit_post_link( $form[$post_type]['#default_value'] ) . '"'
|
| 283 |
+
. ' style="' . $button_style . '"'
|
| 284 |
+
. ' class="' . $button_classname . '"'
|
| 285 |
+
. ' target="_blank"'
|
| 286 |
+
. '>'
|
| 287 |
+
. $parent_post_type_object->labels->edit_item
|
| 288 |
+
. '</a>'
|
| 289 |
+
. '</p>';
|
| 290 |
}
|
| 291 |
if ( $x = wpcf_form_simple( $form ) ) {
|
| 292 |
$output .= $x;
|
| 344 |
}
|
| 345 |
$form = array();
|
| 346 |
$id = esc_attr(sprintf('wpcf_pr_belongs_%d_%s', $post->ID, $type));
|
| 347 |
+
$belongs_id = isset( $belongs['belongs'][$type] ) ? $belongs['belongs'][$type] : 0;
|
| 348 |
+
|
| 349 |
+
$options_array = array();
|
| 350 |
+
|
| 351 |
+
if ( $belongs_id ) {
|
| 352 |
+
$options_array[ $belongs_id ] = array(
|
| 353 |
+
'#title' => get_the_title( $belongs_id ),
|
| 354 |
+
'#value' => $belongs_id,
|
| 355 |
+
);
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
$form[$type] = array(
|
| 359 |
+
'#type' => 'select',
|
| 360 |
+
'#name' => 'wpcf_pr_belongs[' . $post->ID . '][' . $type . ']',
|
| 361 |
+
'#default_value' => $belongs_id,
|
| 362 |
+
'#id' => $id,
|
| 363 |
+
'#options' => $options_array,
|
| 364 |
+
'#attributes' => array(
|
| 365 |
+
'class' => 'wpcf-pr-belongs',
|
| 366 |
+
'data-loading' => esc_attr__('Please Wait, Loading…', 'wpcf'),
|
| 367 |
+
'data-nounce' => wp_create_nonce($id),
|
| 368 |
+
'data-placeholder' => esc_attr( sprintf( __('Search for %s', 'wpcf'), $temp_type->labels->name ) ),
|
| 369 |
+
'data-post-id' => $post->ID,
|
| 370 |
+
'data-post-type' => esc_attr($type),
|
| 371 |
+
),
|
| 372 |
+
);
|
| 373 |
+
|
| 374 |
+
/*
|
| 375 |
$form[$type] = array(
|
| 376 |
'#type' => 'textfield',
|
| 377 |
'#name' => 'wpcf_pr_belongs[' . $post->ID . '][' . $type . ']',
|
| 388 |
),
|
| 389 |
);
|
| 390 |
|
| 391 |
+
if( $belongs_id != 0 && get_post_status( $belongs_id ) ) {
|
| 392 |
+
//$form[$type]['#attributes']['data-belongs-title'] = get_the_title( $belongs_id );
|
| 393 |
}
|
| 394 |
+
*/
|
| 395 |
|
| 396 |
return $form;
|
| 397 |
}
|
| 638 |
function wpcf_pr_admin_wpcf_relationship_search()
|
| 639 |
{
|
| 640 |
wpcf_pr_admin_wpcf_relationship_check(array('s'));
|
| 641 |
+
|
| 642 |
+
global $wpdb;
|
| 643 |
+
$values_to_prepare = array();
|
| 644 |
+
|
| 645 |
+
$posts_per_page = apply_filters( 'wpcf_pr_belongs_post_numberposts', 10 );
|
| 646 |
+
$post_type = sanitize_text_field( $_REQUEST['post_type'] );
|
| 647 |
+
$post_status = apply_filters( 'wpcf_pr_belongs_post_status', array( 'publish', 'private' ) );
|
| 648 |
+
|
| 649 |
+
$wpml_join = $wpml_where = "";
|
| 650 |
+
$is_translated_post_type = apply_filters( 'wpml_is_translated_post_type', false, $post_type );
|
| 651 |
+
|
| 652 |
+
if ( $is_translated_post_type ) {
|
| 653 |
+
$wpml_current_language = apply_filters( 'wpml_current_language', '' );
|
| 654 |
+
$wpml_join = " JOIN {$wpdb->prefix}icl_translations t ";
|
| 655 |
+
$wpml_where = " AND p.ID = t.element_id AND t.language_code = %s ";
|
| 656 |
+
$values_to_prepare[] = $wpml_current_language;
|
| 657 |
+
}
|
| 658 |
+
|
| 659 |
+
$values_to_prepare[] = sanitize_text_field( $post_type );
|
| 660 |
+
|
| 661 |
+
$search_where = "";
|
| 662 |
+
|
| 663 |
+
if ( isset( $_REQUEST['s'] ) ) {
|
| 664 |
+
$search_term = "";
|
| 665 |
+
if ( method_exists( $wpdb, 'esc_like' ) ) {
|
| 666 |
+
$search_term = '%' . $wpdb->esc_like( $_REQUEST['s'] ) . '%';
|
| 667 |
+
} else {
|
| 668 |
+
$search_term = '%' . like_escape( esc_sql( $_REQUEST['s'] ) ) . '%';
|
| 669 |
+
}
|
| 670 |
+
$search_where = " AND p.post_title LIKE %s ";
|
| 671 |
+
$values_to_prepare[] = $search_term;
|
| 672 |
+
}
|
| 673 |
+
|
| 674 |
+
if (
|
| 675 |
+
isset( $_REQUEST['page'] )
|
| 676 |
+
&& preg_match( '/^\d+$/', $_REQUEST['page'] )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 677 |
) {
|
| 678 |
+
$values_to_prepare[] = (int) $_REQUEST['page'] * $posts_per_page;
|
| 679 |
+
} else {
|
| 680 |
+
$values_to_prepare[] = 0;
|
| 681 |
+
}
|
| 682 |
+
$values_to_prepare[] = $posts_per_page;
|
| 683 |
+
|
| 684 |
+
$parents_available = $wpdb->get_results(
|
| 685 |
+
$wpdb->prepare(
|
| 686 |
+
"SELECT SQL_CALC_FOUND_ROWS p.ID as id, p.post_title as text, p.post_type as type, p.post_status as status
|
| 687 |
+
FROM {$wpdb->posts} p {$wpml_join}
|
| 688 |
+
WHERE p.post_status IN ('" . implode( "','" , $post_status ) . "')
|
| 689 |
+
{$wpml_where}
|
| 690 |
+
AND p.post_type = %s
|
| 691 |
+
{$search_where}
|
| 692 |
+
ORDER BY p.post_title
|
| 693 |
+
LIMIT %d,%d",
|
| 694 |
+
$values_to_prepare
|
| 695 |
+
)
|
| 696 |
+
);
|
| 697 |
+
|
| 698 |
+
$parents_count = $wpdb->get_var('SELECT FOUND_ROWS()');
|
| 699 |
+
|
| 700 |
+
$results = array(
|
| 701 |
+
'items' => $parents_available,
|
| 702 |
+
'total_count' => $parents_count,
|
| 703 |
+
'incomplete_results' => $parents_count > $posts_per_page,
|
| 704 |
+
'posts_per_page' => $posts_per_page,
|
| 705 |
+
);
|
| 706 |
+
|
| 707 |
+
echo json_encode( $results );
|
| 708 |
die;
|
| 709 |
}
|
| 710 |
|
| 711 |
+
// Deprecated since the introduction of select v.4
|
| 712 |
function wpcf_pr_admin_wpcf_relationship_entry()
|
| 713 |
{
|
| 714 |
wpcf_pr_admin_wpcf_relationship_check(array('p'));
|
| 728 |
die;
|
| 729 |
}
|
| 730 |
|
| 731 |
+
// Deprecated since the introduction of select v.4
|
| 732 |
function wpcf_pr_admin_wpcf_relationship_delete()
|
| 733 |
{
|
| 734 |
wpcf_pr_admin_wpcf_relationship_check();
|
| 741 |
die;
|
| 742 |
}
|
| 743 |
|
| 744 |
+
// Deprecated since the introduction of select v.4
|
| 745 |
function wpcf_pr_admin_wpcf_relationship_save()
|
| 746 |
{
|
| 747 |
wpcf_pr_admin_wpcf_relationship_check(array('p'));
|
| 749 |
die;
|
| 750 |
}
|
| 751 |
|
| 752 |
+
function wpcf_pr_admin_wpcf_relationship_update() {
|
| 753 |
+
wpcf_pr_admin_wpcf_relationship_check();
|
| 754 |
+
$post_id = (int) $_REQUEST['post_id'];
|
| 755 |
+
$parent_post_type = sanitize_text_field( $_REQUEST['post_type'] );
|
| 756 |
+
$data = array();
|
| 757 |
+
if (
|
| 758 |
+
isset( $_REQUEST['p'] )
|
| 759 |
+
&& (int) $_REQUEST['p'] > 0
|
| 760 |
+
) {
|
| 761 |
+
update_post_meta( $post_id, sprintf( '_wpcf_belongs_%s_id', $parent_post_type ), (int) $_REQUEST['p'] );
|
| 762 |
+
$data['edit_link'] = admin_url( 'post.php ');
|
| 763 |
+
} else {
|
| 764 |
+
delete_post_meta( $post_id, sprintf( '_wpcf_belongs_%s_id', $parent_post_type ) );
|
| 765 |
+
}
|
| 766 |
+
wp_send_json_success( $data );
|
| 767 |
+
}
|
| 768 |
+
|
| 769 |
+
function wpcf_pr_belongs_post_numberposts_minimum( $posts_per_page ) {
|
| 770 |
+
if ( $posts_per_page < 6 ) {
|
| 771 |
+
$posts_per_page = 7;
|
| 772 |
+
}
|
| 773 |
+
return $posts_per_page;
|
| 774 |
+
}
|
| 775 |
+
|
library/toolset/types/embedded/resources/css/post-relationship.css
CHANGED
|
@@ -35,7 +35,30 @@
|
|
| 35 |
#wpcf-post-relationship .belongs .form-item
|
| 36 |
{
|
| 37 |
padding-top: .5em;
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
.wpcf-pr-sort-DESC,
|
| 35 |
#wpcf-post-relationship .belongs .form-item
|
| 36 |
{
|
| 37 |
padding-top: .5em;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
#wpcf-post-relationship .belongs .select2-container {
|
| 41 |
+
vertical-align: middle;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
#wpcf-post-relationship .belongs .wpcf-pr-parent-edit {
|
| 45 |
+
margin-left: 5px;
|
| 46 |
+
vertical-align: middle;
|
| 47 |
+
-webkit-transition: all 0.5s linear;
|
| 48 |
+
-moz-transition: all 0.5s linear;
|
| 49 |
+
-ms-transition: all 0.5s linear;
|
| 50 |
+
-o-transition: all 0.5s linear;
|
| 51 |
+
transition: all 0.5s linear;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
#wpcf-post-relationship .belongs .wpcf-pr-parent-edit.wpcf-saved {
|
| 55 |
+
box-shadow: 0 0 2px 3px #7ad03a !important;
|
| 56 |
+
border-color: #7ad03a;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
#wpcf-post-relationship .belongs .wpcf-pr-parent-edit.wpcf-deleted {
|
| 60 |
+
box-shadow: 0 0 3px red !important;
|
| 61 |
+
border-color: red;
|
| 62 |
}
|
| 63 |
|
| 64 |
.wpcf-pr-sort-DESC,
|
library/toolset/types/embedded/resources/js/post-relationship.js
CHANGED
|
@@ -1021,118 +1021,94 @@ function wpcfBindSelect2($) {
|
|
| 1021 |
}
|
| 1022 |
|
| 1023 |
function wpcfBindSelect2For( element ) {
|
| 1024 |
-
|
| 1025 |
-
|
| 1026 |
-
|
| 1027 |
-
|
| 1028 |
-
|
| 1029 |
-
|
| 1030 |
-
|
| 1031 |
-
|
| 1032 |
-
|
| 1033 |
-
|
| 1034 |
-
|
| 1035 |
-
|
| 1036 |
-
|
| 1037 |
-
|
| 1038 |
-
|
| 1039 |
-
|
| 1040 |
-
|
| 1041 |
-
|
| 1042 |
-
|
| 1043 |
-
|
| 1044 |
-
|
| 1045 |
-
|
| 1046 |
-
|
| 1047 |
-
|
| 1048 |
-
|
| 1049 |
-
|
| 1050 |
-
|
| 1051 |
-
|
| 1052 |
-
|
| 1053 |
-
|
| 1054 |
-
|
| 1055 |
-
|
| 1056 |
-
|
| 1057 |
-
|
| 1058 |
-
|
| 1059 |
-
|
| 1060 |
-
|
| 1061 |
-
|
| 1062 |
-
|
| 1063 |
-
|
| 1064 |
-
|
| 1065 |
-
|
| 1066 |
-
|
| 1067 |
-
|
| 1068 |
-
|
| 1069 |
-
|
| 1070 |
-
|
| 1071 |
-
|
| 1072 |
-
|
| 1073 |
-
|
| 1074 |
-
|
| 1075 |
-
|
| 1076 |
-
|
| 1077 |
-
|
| 1078 |
-
|
| 1079 |
-
|
| 1080 |
-
|
| 1081 |
-
|
| 1082 |
-
|
| 1083 |
-
|
| 1084 |
-
|
| 1085 |
-
|
| 1086 |
-
|
| 1087 |
-
|
| 1088 |
-
|
| 1089 |
-
|
| 1090 |
-
|
| 1091 |
-
|
| 1092 |
-
|
| 1093 |
-
|
| 1094 |
-
|
| 1095 |
-
|
| 1096 |
-
|
| 1097 |
-
|
| 1098 |
-
|
| 1099 |
-
|
| 1100 |
-
|
| 1101 |
-
|
| 1102 |
-
|
| 1103 |
-
|
| 1104 |
-
|
| 1105 |
-
|
| 1106 |
-
|
| 1107 |
-
|
| 1108 |
-
|
| 1109 |
-
|
| 1110 |
-
|
| 1111 |
-
|
| 1112 |
-
},
|
| 1113 |
-
}).on('select2-clearing', function() {
|
| 1114 |
-
$.ajax({
|
| 1115 |
-
url: ajaxurl,
|
| 1116 |
-
dataType: "json",
|
| 1117 |
-
data: {
|
| 1118 |
-
nounce: $(this).data('nounce'),
|
| 1119 |
-
post_id: $(this).data('post-id'),
|
| 1120 |
-
post_type: $(this).data('post-type'),
|
| 1121 |
-
action: 'wpcf_relationship_delete'
|
| 1122 |
-
}
|
| 1123 |
-
}).done(function(data) {
|
| 1124 |
-
target = $(data.target);
|
| 1125 |
-
$('a.button', target).addClass('disabled').attr('href', '#');
|
| 1126 |
-
parent = target.closest('.belongs');
|
| 1127 |
-
if ( $('.js-message', parent).length == 0 ) {
|
| 1128 |
-
$('a.button', parent).after('<div class="notice notice-success below-h2"><p class="wpcf-relationship-message js-message"></p></div>');
|
| 1129 |
-
}
|
| 1130 |
-
var message = $('.js-message', parent);
|
| 1131 |
-
message.parent().slideDown();
|
| 1132 |
-
message.html(wpcf_post_relationship_messages.parent_saving_success);
|
| 1133 |
-
setTimeout(function(){ message.parent().slideUp(); }, 3000);
|
| 1134 |
-
});
|
| 1135 |
-
} );
|
| 1136 |
}
|
| 1137 |
jQuery(document).ready(function($) {
|
| 1138 |
wpcfBindSelect2($);
|
|
@@ -1168,7 +1144,7 @@ var wpcfInitValueOfSelect2Done = {};
|
|
| 1168 |
|
| 1169 |
function wpcfInitValueOfSelect2( elementID, value ) {
|
| 1170 |
if( wpcfInitValueOfSelect2Done[elementID] != 1 ) {
|
| 1171 |
-
jQuery( '#'+elementID ).
|
| 1172 |
}
|
| 1173 |
|
| 1174 |
wpcfInitValueOfSelect2Done[elementID] = 1;
|
| 1021 |
}
|
| 1022 |
|
| 1023 |
function wpcfBindSelect2For( element ) {
|
| 1024 |
+
var $ = jQuery;
|
| 1025 |
+
element.toolset_select2({
|
| 1026 |
+
allowClear: true,
|
| 1027 |
+
ajax: {
|
| 1028 |
+
url: ajaxurl + '?action=wpcf_relationship_search&nounce='+element.data('nounce'),
|
| 1029 |
+
dataType: 'json',
|
| 1030 |
+
delay: 250,
|
| 1031 |
+
type: 'post',
|
| 1032 |
+
data: function (params) {
|
| 1033 |
+
return {
|
| 1034 |
+
s: params.term,
|
| 1035 |
+
page: params.page,
|
| 1036 |
+
post_id: element.data('post-id'),
|
| 1037 |
+
post_type: element.data('post-type')
|
| 1038 |
+
};
|
| 1039 |
+
},
|
| 1040 |
+
processResults: function (data, params) {
|
| 1041 |
+
params.page = params.page || 1;
|
| 1042 |
+
return {
|
| 1043 |
+
results: data.items,
|
| 1044 |
+
pagination: {
|
| 1045 |
+
more: ( params.page * wpcf_post_relationship_messages.parent_per_page ) < data.total_count
|
| 1046 |
+
}
|
| 1047 |
+
};
|
| 1048 |
+
},
|
| 1049 |
+
cache: false
|
| 1050 |
+
},
|
| 1051 |
+
escapeMarkup: function (markup) { return markup; },
|
| 1052 |
+
minimumInputLength: 2,
|
| 1053 |
+
triggerChange: true,
|
| 1054 |
+
})
|
| 1055 |
+
.on('toolset_select2:select', function( evt ) {
|
| 1056 |
+
$.ajax({
|
| 1057 |
+
url: ajaxurl,
|
| 1058 |
+
dataType: "json",
|
| 1059 |
+
data: {
|
| 1060 |
+
action: 'wpcf_relationship_update',
|
| 1061 |
+
nounce: element.data('nounce'),
|
| 1062 |
+
post_id: element.data('post-id'),
|
| 1063 |
+
post_type: element.data('post-type'),
|
| 1064 |
+
p: element.val()
|
| 1065 |
+
},
|
| 1066 |
+
success: function( response ) {
|
| 1067 |
+
var parent_edit_button = element
|
| 1068 |
+
.closest( '.form-item' )
|
| 1069 |
+
.find( '.js-wpcf-pr-parent-edit' );
|
| 1070 |
+
parent_edit_button
|
| 1071 |
+
.removeClass( 'disabled' )
|
| 1072 |
+
.fadeIn( 'fast' )
|
| 1073 |
+
.addClass( 'wpcf-saved' )
|
| 1074 |
+
.attr( 'href', response.data.edit_link + '?post=' + element.val() + '&action=edit' );
|
| 1075 |
+
setTimeout( function() {
|
| 1076 |
+
parent_edit_button.removeClass( 'wpcf-saved' );
|
| 1077 |
+
},
|
| 1078 |
+
1000
|
| 1079 |
+
);
|
| 1080 |
+
}
|
| 1081 |
+
});
|
| 1082 |
+
})
|
| 1083 |
+
.on('toolset_select2:unselect', function( evt ) {
|
| 1084 |
+
$.ajax({
|
| 1085 |
+
url: ajaxurl,
|
| 1086 |
+
dataType: "json",
|
| 1087 |
+
data: {
|
| 1088 |
+
action: 'wpcf_relationship_update',
|
| 1089 |
+
nounce: element.data('nounce'),
|
| 1090 |
+
post_id: element.data('post-id'),
|
| 1091 |
+
post_type: element.data('post-type'),
|
| 1092 |
+
p: 0
|
| 1093 |
+
},
|
| 1094 |
+
success: function() {
|
| 1095 |
+
var parent_edit_button = element
|
| 1096 |
+
.closest( '.form-item' )
|
| 1097 |
+
.find( '.js-wpcf-pr-parent-edit' );
|
| 1098 |
+
parent_edit_button
|
| 1099 |
+
.addClass( 'disabled wpcf-deleted' )
|
| 1100 |
+
.attr( 'href', '#');
|
| 1101 |
+
setTimeout( function() {
|
| 1102 |
+
parent_edit_button
|
| 1103 |
+
.fadeOut( 500, function() {
|
| 1104 |
+
parent_edit_button.removeClass( 'wpcf-deleted' );
|
| 1105 |
+
});
|
| 1106 |
+
},
|
| 1107 |
+
1000
|
| 1108 |
+
);
|
| 1109 |
+
}
|
| 1110 |
+
});
|
| 1111 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1112 |
}
|
| 1113 |
jQuery(document).ready(function($) {
|
| 1114 |
wpcfBindSelect2($);
|
| 1144 |
|
| 1145 |
function wpcfInitValueOfSelect2( elementID, value ) {
|
| 1146 |
if( wpcfInitValueOfSelect2Done[elementID] != 1 ) {
|
| 1147 |
+
jQuery( '#'+elementID ).toolset_select2( 'val', value );
|
| 1148 |
}
|
| 1149 |
|
| 1150 |
wpcfInitValueOfSelect2Done[elementID] = 1;
|
library/toolset/types/includes/post-relationship.php
CHANGED
|
@@ -14,7 +14,7 @@ function wpcf_post_relationship_init() {
|
|
| 14 |
wp_enqueue_script(
|
| 15 |
'wpcf-post-relationship',
|
| 16 |
WPCF_EMBEDDED_RELPATH . '/resources/js/post-relationship.js',
|
| 17 |
-
array('jquery', '
|
| 18 |
WPCF_VERSION
|
| 19 |
);
|
| 20 |
add_filter('wpcf_meta_box_order_defaults', 'wpcf_post_relationship_add_metabox', 10, 2);
|
| 14 |
wp_enqueue_script(
|
| 15 |
'wpcf-post-relationship',
|
| 16 |
WPCF_EMBEDDED_RELPATH . '/resources/js/post-relationship.js',
|
| 17 |
+
array('jquery', 'toolset_select2'),
|
| 18 |
WPCF_VERSION
|
| 19 |
);
|
| 20 |
add_filter('wpcf_meta_box_order_defaults', 'wpcf_post_relationship_add_metabox', 10, 2);
|
library/twig/twig/CHANGELOG
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
* 1.24.1 (2016-05-30)
|
| 2 |
|
| 3 |
* fixed reserved keywords (forbids true, false, null and none keywords for variables names)
|
| 1 |
+
* 1.25.0 (2016-09-21)
|
| 2 |
+
|
| 3 |
+
* changed the way we store template source in template classes
|
| 4 |
+
* removed usage of realpath in cache keys
|
| 5 |
+
* fixed Twig cache sharing when used with different versions of PHP
|
| 6 |
+
* removed embed parent workaround for simple use cases
|
| 7 |
+
* deprecated the ability to store non Node instances in Node::$nodes
|
| 8 |
+
* deprecated Twig_Environment::getLexer(), Twig_Environment::getParser(), Twig_Environment::getCompiler()
|
| 9 |
+
* deprecated Twig_Compiler::getFilename()
|
| 10 |
+
|
| 11 |
+
* 1.24.2 (2016-09-01)
|
| 12 |
+
|
| 13 |
+
* fixed static callables
|
| 14 |
+
* fixed a potential PHP warning when loading the cache
|
| 15 |
+
* fixed a case where the autoescaping does not work as expected
|
| 16 |
+
|
| 17 |
* 1.24.1 (2016-05-30)
|
| 18 |
|
| 19 |
* fixed reserved keywords (forbids true, false, null and none keywords for variables names)
|
library/twig/twig/doc/api.rst
CHANGED
|
@@ -78,16 +78,16 @@ The following options are available:
|
|
| 78 |
``__toString()`` method that you can use to display the generated nodes
|
| 79 |
(default to ``false``).
|
| 80 |
|
| 81 |
-
* ``charset`` *string (
|
| 82 |
|
| 83 |
The charset used by the templates.
|
| 84 |
|
| 85 |
-
* ``base_template_class`` *string (
|
| 86 |
|
| 87 |
The base template class to use for generated
|
| 88 |
templates.
|
| 89 |
|
| 90 |
-
* ``cache`` *string
|
| 91 |
|
| 92 |
An absolute path where to store the compiled templates, or
|
| 93 |
``false`` to disable caching (which is the default).
|
|
@@ -106,7 +106,7 @@ The following options are available:
|
|
| 106 |
replace them with a ``null`` value. When set to ``true``, Twig throws an
|
| 107 |
exception instead (default to ``false``).
|
| 108 |
|
| 109 |
-
* ``autoescape`` *string
|
| 110 |
|
| 111 |
If set to ``true``, HTML auto-escaping will be enabled by
|
| 112 |
default for all templates (default to ``true``).
|
| 78 |
``__toString()`` method that you can use to display the generated nodes
|
| 79 |
(default to ``false``).
|
| 80 |
|
| 81 |
+
* ``charset`` *string* (defaults to ``utf-8``)
|
| 82 |
|
| 83 |
The charset used by the templates.
|
| 84 |
|
| 85 |
+
* ``base_template_class`` *string* (defaults to ``Twig_Template``)
|
| 86 |
|
| 87 |
The base template class to use for generated
|
| 88 |
templates.
|
| 89 |
|
| 90 |
+
* ``cache`` *string* or ``false``
|
| 91 |
|
| 92 |
An absolute path where to store the compiled templates, or
|
| 93 |
``false`` to disable caching (which is the default).
|
| 106 |
replace them with a ``null`` value. When set to ``true``, Twig throws an
|
| 107 |
exception instead (default to ``false``).
|
| 108 |
|
| 109 |
+
* ``autoescape`` *string* or *boolean*
|
| 110 |
|
| 111 |
If set to ``true``, HTML auto-escaping will be enabled by
|
| 112 |
default for all templates (default to ``true``).
|
library/twig/twig/doc/coding_standards.rst
CHANGED
|
@@ -95,7 +95,7 @@ standards:
|
|
| 95 |
.. code-block:: jinja
|
| 96 |
|
| 97 |
{% block foo %}
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
{% endblock %}
|
| 95 |
.. code-block:: jinja
|
| 96 |
|
| 97 |
{% block foo %}
|
| 98 |
+
{% if true %}
|
| 99 |
+
true
|
| 100 |
+
{% endif %}
|
| 101 |
{% endblock %}
|
library/twig/twig/doc/filters/escape.rst
CHANGED
|
@@ -97,7 +97,7 @@ used in the ``escape`` call) and the second one must be a valid PHP callable:
|
|
| 97 |
.. code-block:: php
|
| 98 |
|
| 99 |
$twig = new Twig_Environment($loader);
|
| 100 |
-
$twig->getExtension('core')->setEscaper('csv', 'csv_escaper')
|
| 101 |
|
| 102 |
When called by Twig, the callable receives the Twig environment instance, the
|
| 103 |
string to escape, and the charset.
|
| 97 |
.. code-block:: php
|
| 98 |
|
| 99 |
$twig = new Twig_Environment($loader);
|
| 100 |
+
$twig->getExtension('core')->setEscaper('csv', 'csv_escaper');
|
| 101 |
|
| 102 |
When called by Twig, the callable receives the Twig environment instance, the
|
| 103 |
string to escape, and the charset.
|
library/twig/twig/doc/tags/macro.rst
CHANGED
|
@@ -13,7 +13,7 @@ Here is a small example of a macro that renders a form element:
|
|
| 13 |
<input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" />
|
| 14 |
{% endmacro %}
|
| 15 |
|
| 16 |
-
Macros
|
| 17 |
|
| 18 |
* Default argument values are defined by using the ``default`` filter in the
|
| 19 |
macro body;
|
|
@@ -31,6 +31,9 @@ variables.
|
|
| 31 |
You can pass the whole context as an argument by using the special
|
| 32 |
``_context`` variable.
|
| 33 |
|
|
|
|
|
|
|
|
|
|
| 34 |
Macros can be defined in any template, and need to be "imported" before being
|
| 35 |
used (see the documentation for the :doc:`import<../tags/import>` tag for more
|
| 36 |
information):
|
|
@@ -83,4 +86,18 @@ import it locally:
|
|
| 83 |
</div>
|
| 84 |
{% endmacro %}
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
.. seealso:: :doc:`from<../tags/from>`, :doc:`import<../tags/import>`
|
| 13 |
<input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" />
|
| 14 |
{% endmacro %}
|
| 15 |
|
| 16 |
+
Macros differ from native PHP functions in a few ways:
|
| 17 |
|
| 18 |
* Default argument values are defined by using the ``default`` filter in the
|
| 19 |
macro body;
|
| 31 |
You can pass the whole context as an argument by using the special
|
| 32 |
``_context`` variable.
|
| 33 |
|
| 34 |
+
Import
|
| 35 |
+
------
|
| 36 |
+
|
| 37 |
Macros can be defined in any template, and need to be "imported" before being
|
| 38 |
used (see the documentation for the :doc:`import<../tags/import>` tag for more
|
| 39 |
information):
|
| 86 |
</div>
|
| 87 |
{% endmacro %}
|
| 88 |
|
| 89 |
+
Named Macro End-Tags
|
| 90 |
+
--------------------
|
| 91 |
+
|
| 92 |
+
Twig allows you to put the name of the macro after the end tag for better
|
| 93 |
+
readability:
|
| 94 |
+
|
| 95 |
+
.. code-block:: jinja
|
| 96 |
+
|
| 97 |
+
{% macro input() %}
|
| 98 |
+
...
|
| 99 |
+
{% endmacro input %}
|
| 100 |
+
|
| 101 |
+
Of course, the name after the ``endmacro`` word must match the macro name.
|
| 102 |
+
|
| 103 |
.. seealso:: :doc:`from<../tags/from>`, :doc:`import<../tags/import>`
|
library/twig/twig/doc/tags/use.rst
CHANGED
|
@@ -10,7 +10,7 @@
|
|
| 10 |
regular templates. It is mainly used by projects that need to make
|
| 11 |
template blocks reusable without using inheritance.
|
| 12 |
|
| 13 |
-
Template inheritance is one of the most powerful Twig
|
| 14 |
limited to single inheritance; a template can only extend one other template.
|
| 15 |
This limitation makes template inheritance simple to understand and easy to
|
| 16 |
debug:
|
| 10 |
regular templates. It is mainly used by projects that need to make
|
| 11 |
template blocks reusable without using inheritance.
|
| 12 |
|
| 13 |
+
Template inheritance is one of the most powerful features of Twig but it is
|
| 14 |
limited to single inheritance; a template can only extend one other template.
|
| 15 |
This limitation makes template inheritance simple to understand and easy to
|
| 16 |
debug:
|
library/twig/twig/doc/templates.rst
CHANGED
|
@@ -59,6 +59,7 @@ Many IDEs support syntax highlighting and auto-completion for Twig:
|
|
| 59 |
* *Notepad++* via the `Notepad++ Twig Highlighter`_
|
| 60 |
* *Emacs* via `web-mode.el`_
|
| 61 |
* *Atom* via the `PHP-twig for atom`_
|
|
|
|
| 62 |
|
| 63 |
Also, `TwigFiddle`_ is an online service that allows you to execute Twig templates
|
| 64 |
from a browser; it supports all versions of Twig.
|
|
@@ -906,3 +907,4 @@ Extension<creating_extensions>` chapter.
|
|
| 906 |
.. _`regular expressions`: http://php.net/manual/en/pcre.pattern.php
|
| 907 |
.. _`PHP-twig for atom`: https://github.com/reesef/php-twig
|
| 908 |
.. _`TwigFiddle`: http://twigfiddle.com/
|
|
|
| 59 |
* *Notepad++* via the `Notepad++ Twig Highlighter`_
|
| 60 |
* *Emacs* via `web-mode.el`_
|
| 61 |
* *Atom* via the `PHP-twig for atom`_
|
| 62 |
+
* *Visual Studio Code* via the `Twig pack`_
|
| 63 |
|
| 64 |
Also, `TwigFiddle`_ is an online service that allows you to execute Twig templates
|
| 65 |
from a browser; it supports all versions of Twig.
|
| 907 |
.. _`regular expressions`: http://php.net/manual/en/pcre.pattern.php
|
| 908 |
.. _`PHP-twig for atom`: https://github.com/reesef/php-twig
|
| 909 |
.. _`TwigFiddle`: http://twigfiddle.com/
|
| 910 |
+
.. _`Twig pack`: https://marketplace.visualstudio.com/items?itemName=bajdzis.vscode-twig-pack
|
library/twig/twig/doc/tests/empty.rst
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
``empty``
|
| 2 |
=========
|
| 3 |
|
| 4 |
-
``empty`` checks if a variable is empty
|
|
|
|
| 5 |
|
| 6 |
.. code-block:: jinja
|
| 7 |
|
| 1 |
``empty``
|
| 2 |
=========
|
| 3 |
|
| 4 |
+
``empty`` checks if a variable is an empty string, an empty array, an empty
|
| 5 |
+
hash, exactly ``false``, or exactly ``null``:
|
| 6 |
|
| 7 |
.. code-block:: jinja
|
| 8 |
|
library/twig/twig/ext/twig/php_twig.h
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
#ifndef PHP_TWIG_H
|
| 16 |
#define PHP_TWIG_H
|
| 17 |
|
| 18 |
-
#define PHP_TWIG_VERSION "1.
|
| 19 |
|
| 20 |
#include "php.h"
|
| 21 |
|
| 15 |
#ifndef PHP_TWIG_H
|
| 16 |
#define PHP_TWIG_H
|
| 17 |
|
| 18 |
+
#define PHP_TWIG_VERSION "1.25.0"
|
| 19 |
|
| 20 |
#include "php.h"
|
| 21 |
|
library/twig/twig/lib/Twig/Cache/Filesystem.php
CHANGED
|
@@ -46,7 +46,9 @@ class Twig_Cache_Filesystem implements Twig_CacheInterface
|
|
| 46 |
*/
|
| 47 |
public function load($key)
|
| 48 |
{
|
| 49 |
-
|
|
|
|
|
|
|
| 50 |
}
|
| 51 |
|
| 52 |
/**
|
| 46 |
*/
|
| 47 |
public function load($key)
|
| 48 |
{
|
| 49 |
+
if (file_exists($key)) {
|
| 50 |
+
@include_once $key;
|
| 51 |
+
}
|
| 52 |
}
|
| 53 |
|
| 54 |
/**
|
library/twig/twig/lib/Twig/Compiler.php
CHANGED
|
@@ -36,8 +36,13 @@ class Twig_Compiler implements Twig_CompilerInterface
|
|
| 36 |
$this->env = $env;
|
| 37 |
}
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
public function getFilename()
|
| 40 |
{
|
|
|
|
|
|
|
| 41 |
return $this->filename;
|
| 42 |
}
|
| 43 |
|
|
@@ -80,6 +85,9 @@ class Twig_Compiler implements Twig_CompilerInterface
|
|
| 80 |
$this->indentation = $indentation;
|
| 81 |
|
| 82 |
if ($node instanceof Twig_Node_Module) {
|
|
|
|
|
|
|
|
|
|
| 83 |
$this->filename = $node->getAttribute('filename');
|
| 84 |
}
|
| 85 |
|
| 36 |
$this->env = $env;
|
| 37 |
}
|
| 38 |
|
| 39 |
+
/**
|
| 40 |
+
* @deprecated since 1.25 (to be removed in 2.0)
|
| 41 |
+
*/
|
| 42 |
public function getFilename()
|
| 43 |
{
|
| 44 |
+
@trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
|
| 45 |
+
|
| 46 |
return $this->filename;
|
| 47 |
}
|
| 48 |
|
| 85 |
$this->indentation = $indentation;
|
| 86 |
|
| 87 |
if ($node instanceof Twig_Node_Module) {
|
| 88 |
+
$node->setFilename($node->getAttribute('filename'));
|
| 89 |
+
|
| 90 |
+
// to be removed in 2.0
|
| 91 |
$this->filename = $node->getAttribute('filename');
|
| 92 |
}
|
| 93 |
|
library/twig/twig/lib/Twig/Environment.php
CHANGED
|
@@ -16,7 +16,7 @@
|
|
| 16 |
*/
|
| 17 |
class Twig_Environment
|
| 18 |
{
|
| 19 |
-
const VERSION = '1.
|
| 20 |
|
| 21 |
protected $charset;
|
| 22 |
protected $loader;
|
|
@@ -312,6 +312,7 @@ class Twig_Environment
|
|
| 312 |
$key = $this->getLoader()->getCacheKey($name);
|
| 313 |
$key .= json_encode(array_keys($this->extensions));
|
| 314 |
$key .= function_exists('twig_template_get_attributes');
|
|
|
|
| 315 |
|
| 316 |
return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '_'.$index);
|
| 317 |
}
|
|
@@ -546,9 +547,13 @@ class Twig_Environment
|
|
| 546 |
* Gets the Lexer instance.
|
| 547 |
*
|
| 548 |
* @return Twig_LexerInterface A Twig_LexerInterface instance
|
|
|
|
|
|
|
| 549 |
*/
|
| 550 |
public function getLexer()
|
| 551 |
{
|
|
|
|
|
|
|
| 552 |
if (null === $this->lexer) {
|
| 553 |
$this->lexer = new Twig_Lexer($this);
|
| 554 |
}
|
|
@@ -578,16 +583,24 @@ class Twig_Environment
|
|
| 578 |
*/
|
| 579 |
public function tokenize($source, $name = null)
|
| 580 |
{
|
| 581 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 582 |
}
|
| 583 |
|
| 584 |
/**
|
| 585 |
* Gets the Parser instance.
|
| 586 |
*
|
| 587 |
* @return Twig_ParserInterface A Twig_ParserInterface instance
|
|
|
|
|
|
|
| 588 |
*/
|
| 589 |
public function getParser()
|
| 590 |
{
|
|
|
|
|
|
|
| 591 |
if (null === $this->parser) {
|
| 592 |
$this->parser = new Twig_Parser($this);
|
| 593 |
}
|
|
@@ -616,16 +629,24 @@ class Twig_Environment
|
|
| 616 |
*/
|
| 617 |
public function parse(Twig_TokenStream $stream)
|
| 618 |
{
|
| 619 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 620 |
}
|
| 621 |
|
| 622 |
/**
|
| 623 |
* Gets the Compiler instance.
|
| 624 |
*
|
| 625 |
* @return Twig_CompilerInterface A Twig_CompilerInterface instance
|
|
|
|
|
|
|
| 626 |
*/
|
| 627 |
public function getCompiler()
|
| 628 |
{
|
|
|
|
|
|
|
| 629 |
if (null === $this->compiler) {
|
| 630 |
$this->compiler = new Twig_Compiler($this);
|
| 631 |
}
|
|
@@ -652,7 +673,11 @@ class Twig_Environment
|
|
| 652 |
*/
|
| 653 |
public function compile(Twig_NodeInterface $node)
|
| 654 |
{
|
| 655 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 656 |
}
|
| 657 |
|
| 658 |
/**
|
|
@@ -668,13 +693,7 @@ class Twig_Environment
|
|
| 668 |
public function compileSource($source, $name = null)
|
| 669 |
{
|
| 670 |
try {
|
| 671 |
-
|
| 672 |
-
|
| 673 |
-
if (isset($source[0])) {
|
| 674 |
-
$compiled .= '/* '.str_replace(array('*/', "\r\n", "\r", "\n"), array('*//* ', "\n", "\n", "*/\n/* "), $source)."*/\n";
|
| 675 |
-
}
|
| 676 |
-
|
| 677 |
-
return $compiled;
|
| 678 |
} catch (Twig_Error $e) {
|
| 679 |
$e->setTemplateFile($name);
|
| 680 |
throw $e;
|
| 16 |
*/
|
| 17 |
class Twig_Environment
|
| 18 |
{
|
| 19 |
+
const VERSION = '1.25.0';
|
| 20 |
|
| 21 |
protected $charset;
|
| 22 |
protected $loader;
|
| 312 |
$key = $this->getLoader()->getCacheKey($name);
|
| 313 |
$key .= json_encode(array_keys($this->extensions));
|
| 314 |
$key .= function_exists('twig_template_get_attributes');
|
| 315 |
+
$key .= ':'.PHP_MAJOR_VERSION.':'.PHP_MINOR_VERSION;
|
| 316 |
|
| 317 |
return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '_'.$index);
|
| 318 |
}
|
| 547 |
* Gets the Lexer instance.
|
| 548 |
*
|
| 549 |
* @return Twig_LexerInterface A Twig_LexerInterface instance
|
| 550 |
+
*
|
| 551 |
+
* @deprecated since 1.25 (to be removed in 2.0)
|
| 552 |
*/
|
| 553 |
public function getLexer()
|
| 554 |
{
|
| 555 |
+
@trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
|
| 556 |
+
|
| 557 |
if (null === $this->lexer) {
|
| 558 |
$this->lexer = new Twig_Lexer($this);
|
| 559 |
}
|
| 583 |
*/
|
| 584 |
public function tokenize($source, $name = null)
|
| 585 |
{
|
| 586 |
+
if (null === $this->lexer) {
|
| 587 |
+
$this->lexer = new Twig_Lexer($this);
|
| 588 |
+
}
|
| 589 |
+
|
| 590 |
+
return $this->lexer->tokenize($source, $name);
|
| 591 |
}
|
| 592 |
|
| 593 |
/**
|
| 594 |
* Gets the Parser instance.
|
| 595 |
*
|
| 596 |
* @return Twig_ParserInterface A Twig_ParserInterface instance
|
| 597 |
+
*
|
| 598 |
+
* @deprecated since 1.25 (to be removed in 2.0)
|
| 599 |
*/
|
| 600 |
public function getParser()
|
| 601 |
{
|
| 602 |
+
@trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
|
| 603 |
+
|
| 604 |
if (null === $this->parser) {
|
| 605 |
$this->parser = new Twig_Parser($this);
|
| 606 |
}
|
| 629 |
*/
|
| 630 |
public function parse(Twig_TokenStream $stream)
|
| 631 |
{
|
| 632 |
+
if (null === $this->parser) {
|
| 633 |
+
$this->parser = new Twig_Parser($this);
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
return $this->parser->parse($stream);
|
| 637 |
}
|
| 638 |
|
| 639 |
/**
|
| 640 |
* Gets the Compiler instance.
|
| 641 |
*
|
| 642 |
* @return Twig_CompilerInterface A Twig_CompilerInterface instance
|
| 643 |
+
*
|
| 644 |
+
* @deprecated since 1.25 (to be removed in 2.0)
|
| 645 |
*/
|
| 646 |
public function getCompiler()
|
| 647 |
{
|
| 648 |
+
@trigger_error(sprintf('The %s() method is deprecated since version 1.25 and will be removed in 2.0.', __FUNCTION__), E_USER_DEPRECATED);
|
| 649 |
+
|
| 650 |
if (null === $this->compiler) {
|
| 651 |
$this->compiler = new Twig_Compiler($this);
|
| 652 |
}
|
| 673 |
*/
|
| 674 |
public function compile(Twig_NodeInterface $node)
|
| 675 |
{
|
| 676 |
+
if (null === $this->compiler) {
|
| 677 |
+
$this->compiler = new Twig_Compiler($this);
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
return $this->compiler->compile($node)->getSource();
|
| 681 |
}
|
| 682 |
|
| 683 |
/**
|
| 693 |
public function compileSource($source, $name = null)
|
| 694 |
{
|
| 695 |
try {
|
| 696 |
+
return $this->compile($this->parse($this->tokenize($source, $name)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 697 |
} catch (Twig_Error $e) {
|
| 698 |
$e->setTemplateFile($name);
|
| 699 |
throw $e;
|
library/twig/twig/lib/Twig/Extension/Core.php
CHANGED
|
@@ -978,7 +978,7 @@ function twig_in_filter($value, $compare)
|
|
| 978 |
* Escapes a string.
|
| 979 |
*
|
| 980 |
* @param Twig_Environment $env A Twig_Environment instance
|
| 981 |
-
* @param
|
| 982 |
* @param string $strategy The escaping strategy
|
| 983 |
* @param string $charset The charset
|
| 984 |
* @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false)
|
| 978 |
* Escapes a string.
|
| 979 |
*
|
| 980 |
* @param Twig_Environment $env A Twig_Environment instance
|
| 981 |
+
* @param mixed $string The value to be escaped
|
| 982 |
* @param string $strategy The escaping strategy
|
| 983 |
* @param string $charset The charset
|
| 984 |
* @param bool $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false)
|
library/twig/twig/lib/Twig/Lexer.php
CHANGED
|
@@ -136,7 +136,7 @@ class Twig_Lexer implements Twig_LexerInterface
|
|
| 136 |
mb_internal_encoding($mbEncoding);
|
| 137 |
}
|
| 138 |
|
| 139 |
-
return new Twig_TokenStream($this->tokens, $this->filename);
|
| 140 |
}
|
| 141 |
|
| 142 |
protected function lexData()
|
| 136 |
mb_internal_encoding($mbEncoding);
|
| 137 |
}
|
| 138 |
|
| 139 |
+
return new Twig_TokenStream($this->tokens, $this->filename, $code);
|
| 140 |
}
|
| 141 |
|
| 142 |
protected function lexData()
|
library/twig/twig/lib/Twig/Loader/Filesystem.php
CHANGED
|
@@ -198,11 +198,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
|
|
| 198 |
|
| 199 |
foreach ($this->paths[$namespace] as $path) {
|
| 200 |
if (is_file($path.'/'.$shortname)) {
|
| 201 |
-
|
| 202 |
-
return $this->cache[$name] = $realpath;
|
| 203 |
-
}
|
| 204 |
-
|
| 205 |
-
return $this->cache[$name] = $path.'/'.$shortname;
|
| 206 |
}
|
| 207 |
}
|
| 208 |
|
|
@@ -257,4 +253,19 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
|
|
| 257 |
}
|
| 258 |
}
|
| 259 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
}
|
| 198 |
|
| 199 |
foreach ($this->paths[$namespace] as $path) {
|
| 200 |
if (is_file($path.'/'.$shortname)) {
|
| 201 |
+
return $this->cache[$name] = $this->normalizePath($path.'/'.$shortname);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
}
|
| 203 |
}
|
| 204 |
|
| 253 |
}
|
| 254 |
}
|
| 255 |
}
|
| 256 |
+
|
| 257 |
+
private function normalizePath($path)
|
| 258 |
+
{
|
| 259 |
+
$parts = explode('/', str_replace('\\', '/', $path));
|
| 260 |
+
$new = array();
|
| 261 |
+
foreach ($parts as $i => $part) {
|
| 262 |
+
if ('..' === $part) {
|
| 263 |
+
array_pop($new);
|
| 264 |
+
} elseif ('.' !== $part && ('' !== $part || 0 === $i)) {
|
| 265 |
+
$new[] = $part;
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
return implode('/', $new);
|
| 270 |
+
}
|
| 271 |
}
|
library/twig/twig/lib/Twig/Node.php
CHANGED
|
@@ -22,6 +22,8 @@ class Twig_Node implements Twig_NodeInterface
|
|
| 22 |
protected $lineno;
|
| 23 |
protected $tag;
|
| 24 |
|
|
|
|
|
|
|
| 25 |
/**
|
| 26 |
* Constructor.
|
| 27 |
*
|
|
@@ -35,6 +37,11 @@ class Twig_Node implements Twig_NodeInterface
|
|
| 35 |
*/
|
| 36 |
public function __construct(array $nodes = array(), array $attributes = array(), $lineno = 0, $tag = null)
|
| 37 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
$this->nodes = $nodes;
|
| 39 |
$this->attributes = $attributes;
|
| 40 |
$this->lineno = $lineno;
|
|
@@ -228,4 +235,19 @@ class Twig_Node implements Twig_NodeInterface
|
|
| 228 |
{
|
| 229 |
return new ArrayIterator($this->nodes);
|
| 230 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
}
|
| 22 |
protected $lineno;
|
| 23 |
protected $tag;
|
| 24 |
|
| 25 |
+
private $filename;
|
| 26 |
+
|
| 27 |
/**
|
| 28 |
* Constructor.
|
| 29 |
*
|
| 37 |
*/
|
| 38 |
public function __construct(array $nodes = array(), array $attributes = array(), $lineno = 0, $tag = null)
|
| 39 |
{
|
| 40 |
+
foreach ($nodes as $name => $node) {
|
| 41 |
+
if (!$node instanceof Twig_NodeInterface) {
|
| 42 |
+
@trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', is_object($node) ? get_class($node) : null === $node ? 'null' : gettype($node), $name, get_class($this)), E_USER_DEPRECATED);
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
$this->nodes = $nodes;
|
| 46 |
$this->attributes = $attributes;
|
| 47 |
$this->lineno = $lineno;
|
| 235 |
{
|
| 236 |
return new ArrayIterator($this->nodes);
|
| 237 |
}
|
| 238 |
+
|
| 239 |
+
public function setFilename($filename)
|
| 240 |
+
{
|
| 241 |
+
$this->filename = $filename;
|
| 242 |
+
foreach ($this->nodes as $node) {
|
| 243 |
+
if (null !== $node) {
|
| 244 |
+
$node->setFilename($filename);
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
public function getFilename()
|
| 250 |
+
{
|
| 251 |
+
return $this->filename;
|
| 252 |
+
}
|
| 253 |
}
|
library/twig/twig/lib/Twig/Node/Embed.php
CHANGED
|
@@ -31,7 +31,7 @@ class Twig_Node_Embed extends Twig_Node_Include
|
|
| 31 |
->write('$this->loadTemplate(')
|
| 32 |
->string($this->getAttribute('filename'))
|
| 33 |
->raw(', ')
|
| 34 |
-
->repr($
|
| 35 |
->raw(', ')
|
| 36 |
->repr($this->getLine())
|
| 37 |
->raw(', ')
|
| 31 |
->write('$this->loadTemplate(')
|
| 32 |
->string($this->getAttribute('filename'))
|
| 33 |
->raw(', ')
|
| 34 |
+
->repr($this->getFilename())
|
| 35 |
->raw(', ')
|
| 36 |
->repr($this->getLine())
|
| 37 |
->raw(', ')
|
library/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php
CHANGED
|
@@ -12,9 +12,9 @@ class Twig_Node_Expression_Binary_FloorDiv extends Twig_Node_Expression_Binary
|
|
| 12 |
{
|
| 13 |
public function compile(Twig_Compiler $compiler)
|
| 14 |
{
|
| 15 |
-
$compiler->raw('
|
| 16 |
parent::compile($compiler);
|
| 17 |
-
$compiler->raw(')
|
| 18 |
}
|
| 19 |
|
| 20 |
public function operator(Twig_Compiler $compiler)
|
| 12 |
{
|
| 13 |
public function compile(Twig_Compiler $compiler)
|
| 14 |
{
|
| 15 |
+
$compiler->raw('(int) floor(');
|
| 16 |
parent::compile($compiler);
|
| 17 |
+
$compiler->raw(')');
|
| 18 |
}
|
| 19 |
|
| 20 |
public function operator(Twig_Compiler $compiler)
|
library/twig/twig/lib/Twig/Node/Expression/Call.php
CHANGED
|
@@ -71,7 +71,7 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
|
|
| 71 |
$first = false;
|
| 72 |
}
|
| 73 |
|
| 74 |
-
if ($this->hasNode('arguments')
|
| 75 |
$callable = $this->hasAttribute('callable') ? $this->getAttribute('callable') : null;
|
| 76 |
|
| 77 |
$arguments = $this->getArguments($callable, $this->getNode('arguments'));
|
|
@@ -240,7 +240,7 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
|
|
| 240 |
array_pop($parameters);
|
| 241 |
} else {
|
| 242 |
$callableName = $r->name;
|
| 243 |
-
if ($r
|
| 244 |
$callableName = $r->getDeclaringClass()->name.'::'.$callableName;
|
| 245 |
}
|
| 246 |
|
| 71 |
$first = false;
|
| 72 |
}
|
| 73 |
|
| 74 |
+
if ($this->hasNode('arguments')) {
|
| 75 |
$callable = $this->hasAttribute('callable') ? $this->getAttribute('callable') : null;
|
| 76 |
|
| 77 |
$arguments = $this->getArguments($callable, $this->getNode('arguments'));
|
| 240 |
array_pop($parameters);
|
| 241 |
} else {
|
| 242 |
$callableName = $r->name;
|
| 243 |
+
if ($r instanceof ReflectionMethod) {
|
| 244 |
$callableName = $r->getDeclaringClass()->name.'::'.$callableName;
|
| 245 |
}
|
| 246 |
|
library/twig/twig/lib/Twig/Node/Expression/GetAttr.php
CHANGED
|
@@ -13,7 +13,12 @@ class Twig_Node_Expression_GetAttr extends Twig_Node_Expression
|
|
| 13 |
{
|
| 14 |
public function __construct(Twig_Node_Expression $node, Twig_Node_Expression $attribute, Twig_Node_Expression $arguments = null, $type, $lineno)
|
| 15 |
{
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
}
|
| 18 |
|
| 19 |
public function compile(Twig_Compiler $compiler)
|
|
@@ -36,10 +41,10 @@ class Twig_Node_Expression_GetAttr extends Twig_Node_Expression
|
|
| 36 |
$needFourth = $this->getAttribute('ignore_strict_check');
|
| 37 |
$needThird = $needFourth || $this->getAttribute('is_defined_test');
|
| 38 |
$needSecond = $needThird || Twig_Template::ANY_CALL !== $this->getAttribute('type');
|
| 39 |
-
$needFirst = $needSecond ||
|
| 40 |
|
| 41 |
if ($needFirst) {
|
| 42 |
-
if (
|
| 43 |
$compiler->raw(', ')->subcompile($this->getNode('arguments'));
|
| 44 |
} else {
|
| 45 |
$compiler->raw(', array()');
|
| 13 |
{
|
| 14 |
public function __construct(Twig_Node_Expression $node, Twig_Node_Expression $attribute, Twig_Node_Expression $arguments = null, $type, $lineno)
|
| 15 |
{
|
| 16 |
+
$nodes = array('node' => $node, 'attribute' => $attribute);
|
| 17 |
+
if (null !== $arguments) {
|
| 18 |
+
$nodes['arguments'] = $arguments;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
parent::__construct($nodes, array('type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false, 'disable_c_ext' => false), $lineno);
|
| 22 |
}
|
| 23 |
|
| 24 |
public function compile(Twig_Compiler $compiler)
|
| 41 |
$needFourth = $this->getAttribute('ignore_strict_check');
|
| 42 |
$needThird = $needFourth || $this->getAttribute('is_defined_test');
|
| 43 |
$needSecond = $needThird || Twig_Template::ANY_CALL !== $this->getAttribute('type');
|
| 44 |
+
$needFirst = $needSecond || $this->hasNode('arguments');
|
| 45 |
|
| 46 |
if ($needFirst) {
|
| 47 |
+
if ($this->hasNode('arguments')) {
|
| 48 |
$compiler->raw(', ')->subcompile($this->getNode('arguments'));
|
| 49 |
} else {
|
| 50 |
$compiler->raw(', array()');
|
library/twig/twig/lib/Twig/Node/Expression/Test.php
CHANGED
|
@@ -12,7 +12,12 @@ class Twig_Node_Expression_Test extends Twig_Node_Expression_Call
|
|
| 12 |
{
|
| 13 |
public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno)
|
| 14 |
{
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
public function compile(Twig_Compiler $compiler)
|
| 12 |
{
|
| 13 |
public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno)
|
| 14 |
{
|
| 15 |
+
$nodes = array('node' => $node);
|
| 16 |
+
if (null !== $arguments) {
|
| 17 |
+
$nodes['arguments'] = $arguments;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
parent::__construct($nodes, array('name' => $name), $lineno);
|
| 21 |
}
|
| 22 |
|
| 23 |
public function compile(Twig_Compiler $compiler)
|
library/twig/twig/lib/Twig/Node/For.php
CHANGED
|
@@ -27,7 +27,12 @@ class Twig_Node_For extends Twig_Node
|
|
| 27 |
$body = new Twig_Node_If(new Twig_Node(array($ifexpr, $body)), null, $lineno, $tag);
|
| 28 |
}
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
}
|
| 32 |
|
| 33 |
public function compile(Twig_Compiler $compiler)
|
|
@@ -40,7 +45,7 @@ class Twig_Node_For extends Twig_Node
|
|
| 40 |
->raw(");\n")
|
| 41 |
;
|
| 42 |
|
| 43 |
-
if (
|
| 44 |
$compiler->write("\$context['_iterated'] = false;\n");
|
| 45 |
}
|
| 46 |
|
|
@@ -69,7 +74,7 @@ class Twig_Node_For extends Twig_Node
|
|
| 69 |
}
|
| 70 |
}
|
| 71 |
|
| 72 |
-
$this->loop->setAttribute('else',
|
| 73 |
$this->loop->setAttribute('with_loop', $this->getAttribute('with_loop'));
|
| 74 |
$this->loop->setAttribute('ifexpr', $this->getAttribute('ifexpr'));
|
| 75 |
|
|
@@ -85,7 +90,7 @@ class Twig_Node_For extends Twig_Node
|
|
| 85 |
->write("}\n")
|
| 86 |
;
|
| 87 |
|
| 88 |
-
if (
|
| 89 |
$compiler
|
| 90 |
->write("if (!\$context['_iterated']) {\n")
|
| 91 |
->indent()
|
| 27 |
$body = new Twig_Node_If(new Twig_Node(array($ifexpr, $body)), null, $lineno, $tag);
|
| 28 |
}
|
| 29 |
|
| 30 |
+
$nodes = array('key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body);
|
| 31 |
+
if (null !== $else) {
|
| 32 |
+
$nodes['else'] = $else;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
parent::__construct($nodes, array('with_loop' => true, 'ifexpr' => null !== $ifexpr), $lineno, $tag);
|
| 36 |
}
|
| 37 |
|
| 38 |
public function compile(Twig_Compiler $compiler)
|
| 45 |
->raw(");\n")
|
| 46 |
;
|
| 47 |
|
| 48 |
+
if ($this->hasNode('else')) {
|
| 49 |
$compiler->write("\$context['_iterated'] = false;\n");
|
| 50 |
}
|
| 51 |
|
| 74 |
}
|
| 75 |
}
|
| 76 |
|
| 77 |
+
$this->loop->setAttribute('else', $this->hasNode('else'));
|
| 78 |
$this->loop->setAttribute('with_loop', $this->getAttribute('with_loop'));
|
| 79 |
$this->loop->setAttribute('ifexpr', $this->getAttribute('ifexpr'));
|
| 80 |
|
| 90 |
->write("}\n")
|
| 91 |
;
|
| 92 |
|
| 93 |
+
if ($this->hasNode('else')) {
|
| 94 |
$compiler
|
| 95 |
->write("if (!\$context['_iterated']) {\n")
|
| 96 |
->indent()
|
library/twig/twig/lib/Twig/Node/If.php
CHANGED
|
@@ -19,7 +19,12 @@ class Twig_Node_If extends Twig_Node
|
|
| 19 |
{
|
| 20 |
public function __construct(Twig_NodeInterface $tests, Twig_NodeInterface $else = null, $lineno, $tag = null)
|
| 21 |
{
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
}
|
| 24 |
|
| 25 |
public function compile(Twig_Compiler $compiler)
|
|
@@ -45,7 +50,7 @@ class Twig_Node_If extends Twig_Node
|
|
| 45 |
;
|
| 46 |
}
|
| 47 |
|
| 48 |
-
if ($this->hasNode('else')
|
| 49 |
$compiler
|
| 50 |
->outdent()
|
| 51 |
->write("} else {\n")
|
| 19 |
{
|
| 20 |
public function __construct(Twig_NodeInterface $tests, Twig_NodeInterface $else = null, $lineno, $tag = null)
|
| 21 |
{
|
| 22 |
+
$nodes = array('tests' => $tests);
|
| 23 |
+
if (null !== $else) {
|
| 24 |
+
$nodes['else'] = $else;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
parent::__construct($nodes, array(), $lineno, $tag);
|
| 28 |
}
|
| 29 |
|
| 30 |
public function compile(Twig_Compiler $compiler)
|
| 50 |
;
|
| 51 |
}
|
| 52 |
|
| 53 |
+
if ($this->hasNode('else')) {
|
| 54 |
$compiler
|
| 55 |
->outdent()
|
| 56 |
->write("} else {\n")
|
library/twig/twig/lib/Twig/Node/Import.php
CHANGED
|
@@ -37,7 +37,7 @@ class Twig_Node_Import extends Twig_Node
|
|
| 37 |
->raw('$this->loadTemplate(')
|
| 38 |
->subcompile($this->getNode('expr'))
|
| 39 |
->raw(', ')
|
| 40 |
-
->repr($
|
| 41 |
->raw(', ')
|
| 42 |
->repr($this->getLine())
|
| 43 |
->raw(')')
|
| 37 |
->raw('$this->loadTemplate(')
|
| 38 |
->subcompile($this->getNode('expr'))
|
| 39 |
->raw(', ')
|
| 40 |
+
->repr($this->getFilename())
|
| 41 |
->raw(', ')
|
| 42 |
->repr($this->getLine())
|
| 43 |
->raw(')')
|
library/twig/twig/lib/Twig/Node/Include.php
CHANGED
|
@@ -19,7 +19,12 @@ class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface
|
|
| 19 |
{
|
| 20 |
public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null)
|
| 21 |
{
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
}
|
| 24 |
|
| 25 |
public function compile(Twig_Compiler $compiler)
|
|
@@ -59,7 +64,7 @@ class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface
|
|
| 59 |
->write('$this->loadTemplate(')
|
| 60 |
->subcompile($this->getNode('expr'))
|
| 61 |
->raw(', ')
|
| 62 |
-
->repr($
|
| 63 |
->raw(', ')
|
| 64 |
->repr($this->getLine())
|
| 65 |
->raw(')')
|
|
@@ -68,7 +73,7 @@ class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface
|
|
| 68 |
|
| 69 |
protected function addTemplateArguments(Twig_Compiler $compiler)
|
| 70 |
{
|
| 71 |
-
if (
|
| 72 |
$compiler->raw(false === $this->getAttribute('only') ? '$context' : 'array()');
|
| 73 |
} elseif (false === $this->getAttribute('only')) {
|
| 74 |
$compiler
|
| 19 |
{
|
| 20 |
public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null)
|
| 21 |
{
|
| 22 |
+
$nodes = array('expr' => $expr);
|
| 23 |
+
if (null !== $variables) {
|
| 24 |
+
$nodes['variables'] = $variables;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
parent::__construct($nodes, array('only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing), $lineno, $tag);
|
| 28 |
}
|
| 29 |
|
| 30 |
public function compile(Twig_Compiler $compiler)
|
| 64 |
->write('$this->loadTemplate(')
|
| 65 |
->subcompile($this->getNode('expr'))
|
| 66 |
->raw(', ')
|
| 67 |
+
->repr($this->getFilename())
|
| 68 |
->raw(', ')
|
| 69 |
->repr($this->getLine())
|
| 70 |
->raw(')')
|
| 73 |
|
| 74 |
protected function addTemplateArguments(Twig_Compiler $compiler)
|
| 75 |
{
|
| 76 |
+
if (!$this->hasNode('variables')) {
|
| 77 |
$compiler->raw(false === $this->getAttribute('only') ? '$context' : 'array()');
|
| 78 |
} elseif (false === $this->getAttribute('only')) {
|
| 79 |
$compiler
|
library/twig/twig/lib/Twig/Node/Module.php
CHANGED
|
@@ -21,11 +21,9 @@
|
|
| 21 |
*/
|
| 22 |
class Twig_Node_Module extends Twig_Node
|
| 23 |
{
|
| 24 |
-
public function __construct(Twig_NodeInterface $body, Twig_Node_Expression $parent = null, Twig_NodeInterface $blocks, Twig_NodeInterface $macros, Twig_NodeInterface $traits, $embeddedTemplates, $filename)
|
| 25 |
{
|
| 26 |
-
|
| 27 |
-
parent::__construct(array(
|
| 28 |
-
'parent' => $parent,
|
| 29 |
'body' => $body,
|
| 30 |
'blocks' => $blocks,
|
| 31 |
'macros' => $macros,
|
|
@@ -35,7 +33,14 @@ class Twig_Node_Module extends Twig_Node
|
|
| 35 |
'constructor_start' => new Twig_Node(),
|
| 36 |
'constructor_end' => new Twig_Node(),
|
| 37 |
'class_end' => new Twig_Node(),
|
| 38 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
'filename' => $filename,
|
| 40 |
'index' => null,
|
| 41 |
'embedded_templates' => $embeddedTemplates,
|
|
@@ -67,7 +72,7 @@ class Twig_Node_Module extends Twig_Node
|
|
| 67 |
if (
|
| 68 |
count($this->getNode('blocks'))
|
| 69 |
|| count($this->getNode('traits'))
|
| 70 |
-
||
|
| 71 |
|| $this->getNode('parent') instanceof Twig_Node_Expression_Constant
|
| 72 |
|| count($this->getNode('constructor_start'))
|
| 73 |
|| count($this->getNode('constructor_end'))
|
|
@@ -89,14 +94,17 @@ class Twig_Node_Module extends Twig_Node
|
|
| 89 |
|
| 90 |
$this->compileDebugInfo($compiler);
|
| 91 |
|
|
|
|
|
|
|
| 92 |
$this->compileClassFooter($compiler);
|
| 93 |
}
|
| 94 |
|
| 95 |
protected function compileGetParent(Twig_Compiler $compiler)
|
| 96 |
{
|
| 97 |
-
if (
|
| 98 |
return;
|
| 99 |
}
|
|
|
|
| 100 |
|
| 101 |
$compiler
|
| 102 |
->write("protected function doGetParent(array \$context)\n", "{\n")
|
|
@@ -112,9 +120,9 @@ class Twig_Node_Module extends Twig_Node
|
|
| 112 |
->raw('$this->loadTemplate(')
|
| 113 |
->subcompile($parent)
|
| 114 |
->raw(', ')
|
| 115 |
-
->repr($
|
| 116 |
->raw(', ')
|
| 117 |
-
->repr($
|
| 118 |
->raw(')')
|
| 119 |
;
|
| 120 |
}
|
|
@@ -149,17 +157,17 @@ class Twig_Node_Module extends Twig_Node
|
|
| 149 |
;
|
| 150 |
|
| 151 |
// parent
|
| 152 |
-
if (
|
| 153 |
$compiler->write("\$this->parent = false;\n\n");
|
| 154 |
-
} elseif ($parent instanceof Twig_Node_Expression_Constant) {
|
| 155 |
$compiler
|
| 156 |
->addDebugInfo($parent)
|
| 157 |
->write('$this->parent = $this->loadTemplate(')
|
| 158 |
->subcompile($parent)
|
| 159 |
->raw(', ')
|
| 160 |
-
->repr($
|
| 161 |
->raw(', ')
|
| 162 |
-
->repr($
|
| 163 |
->raw(");\n")
|
| 164 |
;
|
| 165 |
}
|
|
@@ -277,7 +285,8 @@ class Twig_Node_Module extends Twig_Node
|
|
| 277 |
->subcompile($this->getNode('body'))
|
| 278 |
;
|
| 279 |
|
| 280 |
-
if (
|
|
|
|
| 281 |
$compiler->addDebugInfo($parent);
|
| 282 |
if ($parent instanceof Twig_Node_Expression_Constant) {
|
| 283 |
$compiler->write('$this->parent');
|
|
@@ -330,7 +339,7 @@ class Twig_Node_Module extends Twig_Node
|
|
| 330 |
//
|
| 331 |
// Put another way, a template can be used as a trait if it
|
| 332 |
// only contains blocks and use statements.
|
| 333 |
-
$traitable =
|
| 334 |
if ($traitable) {
|
| 335 |
if ($this->getNode('body') instanceof Twig_Node_Body) {
|
| 336 |
$nodes = $this->getNode('body')->getNode(0);
|
|
@@ -380,6 +389,19 @@ class Twig_Node_Module extends Twig_Node
|
|
| 380 |
->indent()
|
| 381 |
->write(sprintf("return %s;\n", str_replace("\n", '', var_export(array_reverse($compiler->getDebugInfo(), true), true))))
|
| 382 |
->outdent()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 383 |
->write("}\n")
|
| 384 |
;
|
| 385 |
}
|
|
@@ -391,7 +413,7 @@ class Twig_Node_Module extends Twig_Node
|
|
| 391 |
->write(sprintf('%s = $this->loadTemplate(', $var))
|
| 392 |
->subcompile($node)
|
| 393 |
->raw(', ')
|
| 394 |
-
->repr($
|
| 395 |
->raw(', ')
|
| 396 |
->repr($node->getLine())
|
| 397 |
->raw(");\n")
|
| 21 |
*/
|
| 22 |
class Twig_Node_Module extends Twig_Node
|
| 23 |
{
|
| 24 |
+
public function __construct(Twig_NodeInterface $body, Twig_Node_Expression $parent = null, Twig_NodeInterface $blocks, Twig_NodeInterface $macros, Twig_NodeInterface $traits, $embeddedTemplates, $filename, $source = '')
|
| 25 |
{
|
| 26 |
+
$nodes = array(
|
|
|
|
|
|
|
| 27 |
'body' => $body,
|
| 28 |
'blocks' => $blocks,
|
| 29 |
'macros' => $macros,
|
| 33 |
'constructor_start' => new Twig_Node(),
|
| 34 |
'constructor_end' => new Twig_Node(),
|
| 35 |
'class_end' => new Twig_Node(),
|
| 36 |
+
);
|
| 37 |
+
if (null !== $parent) {
|
| 38 |
+
$nodes['parent'] = $parent;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
// embedded templates are set as attributes so that they are only visited once by the visitors
|
| 42 |
+
parent::__construct($nodes, array(
|
| 43 |
+
'source' => $source,
|
| 44 |
'filename' => $filename,
|
| 45 |
'index' => null,
|
| 46 |
'embedded_templates' => $embeddedTemplates,
|
| 72 |
if (
|
| 73 |
count($this->getNode('blocks'))
|
| 74 |
|| count($this->getNode('traits'))
|
| 75 |
+
|| !$this->hasNode('parent')
|
| 76 |
|| $this->getNode('parent') instanceof Twig_Node_Expression_Constant
|
| 77 |
|| count($this->getNode('constructor_start'))
|
| 78 |
|| count($this->getNode('constructor_end'))
|
| 94 |
|
| 95 |
$this->compileDebugInfo($compiler);
|
| 96 |
|
| 97 |
+
$this->compileGetSource($compiler);
|
| 98 |
+
|
| 99 |
$this->compileClassFooter($compiler);
|
| 100 |
}
|
| 101 |
|
| 102 |
protected function compileGetParent(Twig_Compiler $compiler)
|
| 103 |
{
|
| 104 |
+
if (!$this->hasNode('parent')) {
|
| 105 |
return;
|
| 106 |
}
|
| 107 |
+
$parent = $this->getNode('parent');
|
| 108 |
|
| 109 |
$compiler
|
| 110 |
->write("protected function doGetParent(array \$context)\n", "{\n")
|
| 120 |
->raw('$this->loadTemplate(')
|
| 121 |
->subcompile($parent)
|
| 122 |
->raw(', ')
|
| 123 |
+
->repr($this->getAttribute('filename'))
|
| 124 |
->raw(', ')
|
| 125 |
+
->repr($parent->getLine())
|
| 126 |
->raw(')')
|
| 127 |
;
|
| 128 |
}
|
| 157 |
;
|
| 158 |
|
| 159 |
// parent
|
| 160 |
+
if (!$this->hasNode('parent')) {
|
| 161 |
$compiler->write("\$this->parent = false;\n\n");
|
| 162 |
+
} elseif (($parent = $this->getNode('parent')) && $parent instanceof Twig_Node_Expression_Constant) {
|
| 163 |
$compiler
|
| 164 |
->addDebugInfo($parent)
|
| 165 |
->write('$this->parent = $this->loadTemplate(')
|
| 166 |
->subcompile($parent)
|
| 167 |
->raw(', ')
|
| 168 |
+
->repr($this->getAttribute('filename'))
|
| 169 |
->raw(', ')
|
| 170 |
+
->repr($parent->getLine())
|
| 171 |
->raw(");\n")
|
| 172 |
;
|
| 173 |
}
|
| 285 |
->subcompile($this->getNode('body'))
|
| 286 |
;
|
| 287 |
|
| 288 |
+
if ($this->hasNode('parent')) {
|
| 289 |
+
$parent = $this->getNode('parent');
|
| 290 |
$compiler->addDebugInfo($parent);
|
| 291 |
if ($parent instanceof Twig_Node_Expression_Constant) {
|
| 292 |
$compiler->write('$this->parent');
|
| 339 |
//
|
| 340 |
// Put another way, a template can be used as a trait if it
|
| 341 |
// only contains blocks and use statements.
|
| 342 |
+
$traitable = !$this->hasNode('parent') && 0 === count($this->getNode('macros'));
|
| 343 |
if ($traitable) {
|
| 344 |
if ($this->getNode('body') instanceof Twig_Node_Body) {
|
| 345 |
$nodes = $this->getNode('body')->getNode(0);
|
| 389 |
->indent()
|
| 390 |
->write(sprintf("return %s;\n", str_replace("\n", '', var_export(array_reverse($compiler->getDebugInfo(), true), true))))
|
| 391 |
->outdent()
|
| 392 |
+
->write("}\n\n")
|
| 393 |
+
;
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
protected function compileGetSource(Twig_Compiler $compiler)
|
| 397 |
+
{
|
| 398 |
+
$compiler
|
| 399 |
+
->write("public function getSource()\n", "{\n")
|
| 400 |
+
->indent()
|
| 401 |
+
->write('return ')
|
| 402 |
+
->string($this->getAttribute('source'))
|
| 403 |
+
->raw(";\n")
|
| 404 |
+
->outdent()
|
| 405 |
->write("}\n")
|
| 406 |
;
|
| 407 |
}
|
| 413 |
->write(sprintf('%s = $this->loadTemplate(', $var))
|
| 414 |
->subcompile($node)
|
| 415 |
->raw(', ')
|
| 416 |
+
->repr($this->getAttribute('filename'))
|
| 417 |
->raw(', ')
|
| 418 |
->repr($node->getLine())
|
| 419 |
->raw(");\n")
|
library/twig/twig/lib/Twig/NodeVisitor/Escaper.php
CHANGED
|
@@ -38,6 +38,7 @@ class Twig_NodeVisitor_Escaper extends Twig_BaseNodeVisitor
|
|
| 38 |
$this->defaultStrategy = $defaultStrategy;
|
| 39 |
}
|
| 40 |
$this->safeVars = array();
|
|
|
|
| 41 |
} elseif ($node instanceof Twig_Node_AutoEscape) {
|
| 42 |
$this->statusStack[] = $node->getAttribute('value');
|
| 43 |
} elseif ($node instanceof Twig_Node_Block) {
|
|
@@ -57,6 +58,7 @@ class Twig_NodeVisitor_Escaper extends Twig_BaseNodeVisitor
|
|
| 57 |
if ($node instanceof Twig_Node_Module) {
|
| 58 |
$this->defaultStrategy = false;
|
| 59 |
$this->safeVars = array();
|
|
|
|
| 60 |
} elseif ($node instanceof Twig_Node_Expression_Filter) {
|
| 61 |
return $this->preEscapeFilterNode($node, $env);
|
| 62 |
} elseif ($node instanceof Twig_Node_Print) {
|
| 38 |
$this->defaultStrategy = $defaultStrategy;
|
| 39 |
}
|
| 40 |
$this->safeVars = array();
|
| 41 |
+
$this->blocks = array();
|
| 42 |
} elseif ($node instanceof Twig_Node_AutoEscape) {
|
| 43 |
$this->statusStack[] = $node->getAttribute('value');
|
| 44 |
} elseif ($node instanceof Twig_Node_Block) {
|
| 58 |
if ($node instanceof Twig_Node_Module) {
|
| 59 |
$this->defaultStrategy = false;
|
| 60 |
$this->safeVars = array();
|
| 61 |
+
$this->blocks = array();
|
| 62 |
} elseif ($node instanceof Twig_Node_Expression_Filter) {
|
| 63 |
return $this->preEscapeFilterNode($node, $env);
|
| 64 |
} elseif ($node instanceof Twig_Node_Print) {
|
library/twig/twig/lib/Twig/Parser.php
CHANGED
|
@@ -114,7 +114,7 @@ class Twig_Parser implements Twig_ParserInterface
|
|
| 114 |
throw $e;
|
| 115 |
}
|
| 116 |
|
| 117 |
-
$node = new Twig_Node_Module(new Twig_Node_Body(array($body)), $this->parent, new Twig_Node($this->blocks), new Twig_Node($this->macros), new Twig_Node($this->traits), $this->embeddedTemplates, $this->getFilename());
|
| 118 |
|
| 119 |
$traverser = new Twig_NodeTraverser($this->env, $this->visitors);
|
| 120 |
|
| 114 |
throw $e;
|
| 115 |
}
|
| 116 |
|
| 117 |
+
$node = new Twig_Node_Module(new Twig_Node_Body(array($body)), $this->parent, new Twig_Node($this->blocks), new Twig_Node($this->macros), new Twig_Node($this->traits), $this->embeddedTemplates, $this->getFilename(), $stream->getSource());
|
| 118 |
|
| 119 |
$traverser = new Twig_NodeTraverser($this->env, $this->visitors);
|
| 120 |
|
library/twig/twig/lib/Twig/Template.php
CHANGED
|
@@ -42,6 +42,25 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
|
| 42 |
*/
|
| 43 |
abstract public function getTemplateName();
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
/**
|
| 46 |
* @deprecated since 1.20 (to be removed in 2.0)
|
| 47 |
*/
|
|
@@ -320,33 +339,6 @@ abstract class Twig_Template implements Twig_TemplateInterface
|
|
| 320 |
return $this->blocks;
|
| 321 |
}
|
| 322 |
|
| 323 |
-
/**
|
| 324 |
-
* Returns the template source code.
|
| 325 |
-
*
|
| 326 |
-
* @return string|null The template source code or null if it is not available
|
| 327 |
-
*/
|
| 328 |
-
public function getSource()
|
| 329 |
-
{
|
| 330 |
-
$reflector = new ReflectionClass($this);
|
| 331 |
-
$file = $reflector->getFileName();
|
| 332 |
-
|
| 333 |
-
if (!file_exists($file)) {
|
| 334 |
-
return;
|
| 335 |
-
}
|
| 336 |
-
|
| 337 |
-
$source = file($file, FILE_IGNORE_NEW_LINES);
|
| 338 |
-
array_splice($source, 0, $reflector->getEndLine());
|
| 339 |
-
|
| 340 |
-
$i = 0;
|
| 341 |
-
while (isset($source[$i]) && '/* */' === substr_replace($source[$i], '', 3, -2)) {
|
| 342 |
-
$source[$i] = str_replace('*//* ', '*/', substr($source[$i], 3, -2));
|
| 343 |
-
++$i;
|
| 344 |
-
}
|
| 345 |
-
array_splice($source, $i);
|
| 346 |
-
|
| 347 |
-
return implode("\n", $source);
|
| 348 |
-
}
|
| 349 |
-
|
| 350 |
/**
|
| 351 |
* {@inheritdoc}
|
| 352 |
*/
|
| 42 |
*/
|
| 43 |
abstract public function getTemplateName();
|
| 44 |
|
| 45 |
+
/**
|
| 46 |
+
* Returns debug information about the template.
|
| 47 |
+
*
|
| 48 |
+
* @return array Debug information
|
| 49 |
+
*
|
| 50 |
+
* @internal
|
| 51 |
+
*/
|
| 52 |
+
abstract public function getDebugInfo();
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* Returns the template source code.
|
| 56 |
+
*
|
| 57 |
+
* @return string The template source code
|
| 58 |
+
*/
|
| 59 |
+
public function getSource()
|
| 60 |
+
{
|
| 61 |
+
return '';
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
/**
|
| 65 |
* @deprecated since 1.20 (to be removed in 2.0)
|
| 66 |
*/
|
| 339 |
return $this->blocks;
|
| 340 |
}
|
| 341 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
/**
|
| 343 |
* {@inheritdoc}
|
| 344 |
*/
|
library/twig/twig/lib/Twig/TokenParser/Embed.php
CHANGED
|
@@ -22,18 +22,27 @@ class Twig_TokenParser_Embed extends Twig_TokenParser_Include
|
|
| 22 |
|
| 23 |
list($variables, $only, $ignoreMissing) = $this->parseArguments();
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
// inject a fake parent to make the parent() function work
|
| 26 |
$stream->injectTokens(array(
|
| 27 |
new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', $token->getLine()),
|
| 28 |
new Twig_Token(Twig_Token::NAME_TYPE, 'extends', $token->getLine()),
|
| 29 |
-
|
| 30 |
new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', $token->getLine()),
|
| 31 |
));
|
| 32 |
|
| 33 |
$module = $this->parser->parse($stream, array($this, 'decideBlockEnd'), true);
|
| 34 |
|
| 35 |
// override the parent with the correct one
|
| 36 |
-
$
|
|
|
|
|
|
|
| 37 |
|
| 38 |
$this->parser->embedTemplate($module);
|
| 39 |
|
| 22 |
|
| 23 |
list($variables, $only, $ignoreMissing) = $this->parseArguments();
|
| 24 |
|
| 25 |
+
$parentToken = $fakeParentToken = new Twig_Token(Twig_Token::STRING_TYPE, '__parent__', $token->getLine());
|
| 26 |
+
if ($parent instanceof Twig_Node_Expression_Constant) {
|
| 27 |
+
$parentToken = new Twig_Token(Twig_Token::STRING_TYPE, $parent->getAttribute('value'), $token->getLine());
|
| 28 |
+
} elseif ($parent instanceof Twig_Node_Expression_Name) {
|
| 29 |
+
$parentToken = new Twig_Token(Twig_Token::NAME_TYPE, $parent->getAttribute('name'), $token->getLine());
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
// inject a fake parent to make the parent() function work
|
| 33 |
$stream->injectTokens(array(
|
| 34 |
new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', $token->getLine()),
|
| 35 |
new Twig_Token(Twig_Token::NAME_TYPE, 'extends', $token->getLine()),
|
| 36 |
+
$parentToken,
|
| 37 |
new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', $token->getLine()),
|
| 38 |
));
|
| 39 |
|
| 40 |
$module = $this->parser->parse($stream, array($this, 'decideBlockEnd'), true);
|
| 41 |
|
| 42 |
// override the parent with the correct one
|
| 43 |
+
if ($fakeParentToken === $parentToken) {
|
| 44 |
+
$module->setNode('parent', $parent);
|
| 45 |
+
}
|
| 46 |
|
| 47 |
$this->parser->embedTemplate($module);
|
| 48 |
|
library/twig/twig/lib/Twig/TokenStream.php
CHANGED
|
@@ -21,16 +21,20 @@ class Twig_TokenStream
|
|
| 21 |
protected $current = 0;
|
| 22 |
protected $filename;
|
| 23 |
|
|
|
|
|
|
|
| 24 |
/**
|
| 25 |
* Constructor.
|
| 26 |
*
|
| 27 |
-
* @param array $tokens
|
| 28 |
-
* @param string $filename The name of the filename which tokens are associated with
|
|
|
|
| 29 |
*/
|
| 30 |
-
public function __construct(array $tokens, $filename = null)
|
| 31 |
{
|
| 32 |
$this->tokens = $tokens;
|
| 33 |
$this->filename = $filename;
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
/**
|
|
@@ -144,12 +148,22 @@ class Twig_TokenStream
|
|
| 144 |
}
|
| 145 |
|
| 146 |
/**
|
| 147 |
-
* Gets the filename associated with this stream.
|
| 148 |
*
|
| 149 |
-
* @return string
|
| 150 |
*/
|
| 151 |
public function getFilename()
|
| 152 |
{
|
| 153 |
return $this->filename;
|
| 154 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
}
|
| 21 |
protected $current = 0;
|
| 22 |
protected $filename;
|
| 23 |
|
| 24 |
+
private $source;
|
| 25 |
+
|
| 26 |
/**
|
| 27 |
* Constructor.
|
| 28 |
*
|
| 29 |
+
* @param array $tokens An array of tokens
|
| 30 |
+
* @param string $filename|null The name of the filename which tokens are associated with
|
| 31 |
+
* @param string $source|null The source code associated with the tokens
|
| 32 |
*/
|
| 33 |
+
public function __construct(array $tokens, $filename = null, $source = null)
|
| 34 |
{
|
| 35 |
$this->tokens = $tokens;
|
| 36 |
$this->filename = $filename;
|
| 37 |
+
$this->source = $source ? $source : '';
|
| 38 |
}
|
| 39 |
|
| 40 |
/**
|
| 148 |
}
|
| 149 |
|
| 150 |
/**
|
| 151 |
+
* Gets the filename associated with this stream (null if not defined).
|
| 152 |
*
|
| 153 |
+
* @return string|null
|
| 154 |
*/
|
| 155 |
public function getFilename()
|
| 156 |
{
|
| 157 |
return $this->filename;
|
| 158 |
}
|
| 159 |
+
|
| 160 |
+
/**
|
| 161 |
+
* Gets the source code associated with this stream.
|
| 162 |
+
*
|
| 163 |
+
* @return string
|
| 164 |
+
*/
|
| 165 |
+
public function getSource()
|
| 166 |
+
{
|
| 167 |
+
return $this->source;
|
| 168 |
+
}
|
| 169 |
}
|
library/twig/twig/test/Twig/Tests/CompilerTest.php
CHANGED
|
@@ -13,7 +13,7 @@ class Twig_Tests_CompilerTest extends PHPUnit_Framework_TestCase
|
|
| 13 |
{
|
| 14 |
public function testReprNumericValueWithLocale()
|
| 15 |
{
|
| 16 |
-
$compiler = new Twig_Compiler(new Twig_Environment($this->
|
| 17 |
|
| 18 |
$locale = setlocale(LC_NUMERIC, 0);
|
| 19 |
if (false === $locale) {
|
| 13 |
{
|
| 14 |
public function testReprNumericValueWithLocale()
|
| 15 |
{
|
| 16 |
+
$compiler = new Twig_Compiler(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 17 |
|
| 18 |
$locale = setlocale(LC_NUMERIC, 0);
|
| 19 |
if (false === $locale) {
|
library/twig/twig/test/Twig/Tests/EnvironmentTest.php
CHANGED
|
@@ -51,7 +51,8 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 51 |
public function testGlobals()
|
| 52 |
{
|
| 53 |
// globals can be added after calling getGlobals
|
| 54 |
-
|
|
|
|
| 55 |
$twig->addGlobal('foo', 'foo');
|
| 56 |
$twig->getGlobals();
|
| 57 |
$twig->addGlobal('foo', 'bar');
|
|
@@ -59,7 +60,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 59 |
$this->assertEquals('bar', $globals['foo']);
|
| 60 |
|
| 61 |
// globals can be modified after a template has been loaded
|
| 62 |
-
$twig = new Twig_Environment($this->
|
| 63 |
$twig->addGlobal('foo', 'foo');
|
| 64 |
$twig->getGlobals();
|
| 65 |
$twig->loadTemplate('index');
|
|
@@ -68,7 +69,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 68 |
$this->assertEquals('bar', $globals['foo']);
|
| 69 |
|
| 70 |
// globals can be modified after extensions init
|
| 71 |
-
$twig = new Twig_Environment($this->
|
| 72 |
$twig->addGlobal('foo', 'foo');
|
| 73 |
$twig->getGlobals();
|
| 74 |
$twig->getFunctions();
|
|
@@ -94,7 +95,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 94 |
|
| 95 |
/* to be uncomment in Twig 2.0
|
| 96 |
// globals cannot be added after a template has been loaded
|
| 97 |
-
$twig = new Twig_Environment($this->
|
| 98 |
$twig->addGlobal('foo', 'foo');
|
| 99 |
$twig->getGlobals();
|
| 100 |
$twig->loadTemplate('index');
|
|
@@ -106,7 +107,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 106 |
}
|
| 107 |
|
| 108 |
// globals cannot be added after extensions init
|
| 109 |
-
$twig = new Twig_Environment($this->
|
| 110 |
$twig->addGlobal('foo', 'foo');
|
| 111 |
$twig->getGlobals();
|
| 112 |
$twig->getFunctions();
|
|
@@ -118,7 +119,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 118 |
}
|
| 119 |
|
| 120 |
// globals cannot be added after extensions and a template has been loaded
|
| 121 |
-
$twig = new Twig_Environment($this->
|
| 122 |
$twig->addGlobal('foo', 'foo');
|
| 123 |
$twig->getGlobals();
|
| 124 |
$twig->getFunctions();
|
|
@@ -131,7 +132,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 131 |
}
|
| 132 |
|
| 133 |
// test adding globals after a template has been loaded without call to getGlobals
|
| 134 |
-
$twig = new Twig_Environment($this->
|
| 135 |
$twig->loadTemplate('index');
|
| 136 |
try {
|
| 137 |
$twig->addGlobal('bar', 'bar');
|
|
@@ -142,18 +143,6 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 142 |
*/
|
| 143 |
}
|
| 144 |
|
| 145 |
-
public function testCompileSourceInlinesSource()
|
| 146 |
-
{
|
| 147 |
-
$twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'));
|
| 148 |
-
|
| 149 |
-
$source = "<? */*foo*/ ?>\r\nbar\n";
|
| 150 |
-
$expected = "/* <? *//* *foo*//* ?>*/\n/* bar*/\n/* */\n";
|
| 151 |
-
$compiled = $twig->compileSource($source, 'index');
|
| 152 |
-
|
| 153 |
-
$this->assertContains($expected, $compiled);
|
| 154 |
-
$this->assertNotContains('/**', $compiled);
|
| 155 |
-
}
|
| 156 |
-
|
| 157 |
public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate()
|
| 158 |
{
|
| 159 |
$cache = new Twig_Cache_Filesystem($dir = sys_get_temp_dir().'/twig');
|
|
@@ -187,7 +176,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 187 |
$templateName = __FUNCTION__;
|
| 188 |
$templateContent = __FUNCTION__;
|
| 189 |
|
| 190 |
-
$cache = $this->
|
| 191 |
$loader = $this->getMockLoader($templateName, $templateContent);
|
| 192 |
$twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false));
|
| 193 |
|
|
@@ -212,7 +201,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 212 |
$templateName = __FUNCTION__;
|
| 213 |
$templateContent = __FUNCTION__;
|
| 214 |
|
| 215 |
-
$cache = $this->
|
| 216 |
$loader = $this->getMockLoader($templateName, $templateContent);
|
| 217 |
$twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false));
|
| 218 |
|
|
@@ -240,7 +229,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 240 |
$templateName = __FUNCTION__;
|
| 241 |
$templateContent = __FUNCTION__;
|
| 242 |
|
| 243 |
-
$cache = $this->
|
| 244 |
$loader = $this->getMockLoader($templateName, $templateContent);
|
| 245 |
$twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false));
|
| 246 |
|
|
@@ -263,7 +252,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 263 |
|
| 264 |
public function testAddExtension()
|
| 265 |
{
|
| 266 |
-
$twig = new Twig_Environment($this->
|
| 267 |
$twig->addExtension(new Twig_Tests_EnvironmentTest_Extension());
|
| 268 |
|
| 269 |
$this->assertArrayHasKey('test', $twig->getTags());
|
|
@@ -274,7 +263,13 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 274 |
$this->assertArrayHasKey('foo_binary', $twig->getBinaryOperators());
|
| 275 |
$this->assertArrayHasKey('foo_global', $twig->getGlobals());
|
| 276 |
$visitors = $twig->getNodeVisitors();
|
| 277 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
}
|
| 279 |
|
| 280 |
/**
|
|
@@ -282,7 +277,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 282 |
*/
|
| 283 |
public function testAddExtensionWithDeprecatedGetGlobals()
|
| 284 |
{
|
| 285 |
-
$twig = new Twig_Environment($this->
|
| 286 |
$twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithGlobals());
|
| 287 |
|
| 288 |
$this->deprecations = array();
|
|
@@ -301,7 +296,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 301 |
*/
|
| 302 |
public function testRemoveExtension()
|
| 303 |
{
|
| 304 |
-
$twig = new Twig_Environment($this->
|
| 305 |
$twig->addExtension(new Twig_Tests_EnvironmentTest_Extension());
|
| 306 |
$twig->removeExtension('environment_test');
|
| 307 |
|
|
@@ -317,7 +312,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 317 |
|
| 318 |
public function testAddMockExtension()
|
| 319 |
{
|
| 320 |
-
$extension = $this->
|
| 321 |
$extension->expects($this->once())
|
| 322 |
->method('getName')
|
| 323 |
->will($this->returnValue('mock'));
|
|
@@ -333,7 +328,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 333 |
|
| 334 |
public function testInitRuntimeWithAnExtensionUsingInitRuntimeNoDeprecation()
|
| 335 |
{
|
| 336 |
-
$twig = new Twig_Environment($this->
|
| 337 |
$twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime());
|
| 338 |
|
| 339 |
$twig->initRuntime();
|
|
@@ -344,7 +339,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 344 |
*/
|
| 345 |
public function testInitRuntimeWithAnExtensionUsingInitRuntimeDeprecation()
|
| 346 |
{
|
| 347 |
-
$twig = new Twig_Environment($this->
|
| 348 |
$twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime());
|
| 349 |
|
| 350 |
$this->deprecations = array();
|
|
@@ -370,7 +365,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 370 |
*/
|
| 371 |
public function testOverrideExtension()
|
| 372 |
{
|
| 373 |
-
$twig = new Twig_Environment($this->
|
| 374 |
$twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime());
|
| 375 |
|
| 376 |
$this->deprecations = array();
|
|
@@ -387,7 +382,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
|
| 387 |
|
| 388 |
protected function getMockLoader($templateName, $templateContent)
|
| 389 |
{
|
| 390 |
-
$loader = $this->
|
| 391 |
$loader->expects($this->any())
|
| 392 |
->method('getSource')
|
| 393 |
->with($templateName)
|
| 51 |
public function testGlobals()
|
| 52 |
{
|
| 53 |
// globals can be added after calling getGlobals
|
| 54 |
+
|
| 55 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 56 |
$twig->addGlobal('foo', 'foo');
|
| 57 |
$twig->getGlobals();
|
| 58 |
$twig->addGlobal('foo', 'bar');
|
| 60 |
$this->assertEquals('bar', $globals['foo']);
|
| 61 |
|
| 62 |
// globals can be modified after a template has been loaded
|
| 63 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 64 |
$twig->addGlobal('foo', 'foo');
|
| 65 |
$twig->getGlobals();
|
| 66 |
$twig->loadTemplate('index');
|
| 69 |
$this->assertEquals('bar', $globals['foo']);
|
| 70 |
|
| 71 |
// globals can be modified after extensions init
|
| 72 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 73 |
$twig->addGlobal('foo', 'foo');
|
| 74 |
$twig->getGlobals();
|
| 75 |
$twig->getFunctions();
|
| 95 |
|
| 96 |
/* to be uncomment in Twig 2.0
|
| 97 |
// globals cannot be added after a template has been loaded
|
| 98 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 99 |
$twig->addGlobal('foo', 'foo');
|
| 100 |
$twig->getGlobals();
|
| 101 |
$twig->loadTemplate('index');
|
| 107 |
}
|
| 108 |
|
| 109 |
// globals cannot be added after extensions init
|
| 110 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 111 |
$twig->addGlobal('foo', 'foo');
|
| 112 |
$twig->getGlobals();
|
| 113 |
$twig->getFunctions();
|
| 119 |
}
|
| 120 |
|
| 121 |
// globals cannot be added after extensions and a template has been loaded
|
| 122 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 123 |
$twig->addGlobal('foo', 'foo');
|
| 124 |
$twig->getGlobals();
|
| 125 |
$twig->getFunctions();
|
| 132 |
}
|
| 133 |
|
| 134 |
// test adding globals after a template has been loaded without call to getGlobals
|
| 135 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 136 |
$twig->loadTemplate('index');
|
| 137 |
try {
|
| 138 |
$twig->addGlobal('bar', 'bar');
|
| 143 |
*/
|
| 144 |
}
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate()
|
| 147 |
{
|
| 148 |
$cache = new Twig_Cache_Filesystem($dir = sys_get_temp_dir().'/twig');
|
| 176 |
$templateName = __FUNCTION__;
|
| 177 |
$templateContent = __FUNCTION__;
|
| 178 |
|
| 179 |
+
$cache = $this->getMockBuilder('Twig_CacheInterface')->getMock();
|
| 180 |
$loader = $this->getMockLoader($templateName, $templateContent);
|
| 181 |
$twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false));
|
| 182 |
|
| 201 |
$templateName = __FUNCTION__;
|
| 202 |
$templateContent = __FUNCTION__;
|
| 203 |
|
| 204 |
+
$cache = $this->getMockBuilder('Twig_CacheInterface')->getMock();
|
| 205 |
$loader = $this->getMockLoader($templateName, $templateContent);
|
| 206 |
$twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false));
|
| 207 |
|
| 229 |
$templateName = __FUNCTION__;
|
| 230 |
$templateContent = __FUNCTION__;
|
| 231 |
|
| 232 |
+
$cache = $this->getMockBuilder('Twig_CacheInterface')->getMock();
|
| 233 |
$loader = $this->getMockLoader($templateName, $templateContent);
|
| 234 |
$twig = new Twig_Environment($loader, array('cache' => $cache, 'auto_reload' => true, 'debug' => false));
|
| 235 |
|
| 252 |
|
| 253 |
public function testAddExtension()
|
| 254 |
{
|
| 255 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 256 |
$twig->addExtension(new Twig_Tests_EnvironmentTest_Extension());
|
| 257 |
|
| 258 |
$this->assertArrayHasKey('test', $twig->getTags());
|
| 263 |
$this->assertArrayHasKey('foo_binary', $twig->getBinaryOperators());
|
| 264 |
$this->assertArrayHasKey('foo_global', $twig->getGlobals());
|
| 265 |
$visitors = $twig->getNodeVisitors();
|
| 266 |
+
$found = false;
|
| 267 |
+
foreach ($visitors as $visitor) {
|
| 268 |
+
if ($visitor instanceof Twig_Tests_EnvironmentTest_NodeVisitor) {
|
| 269 |
+
$found = true;
|
| 270 |
+
}
|
| 271 |
+
}
|
| 272 |
+
$this->assertTrue($found);
|
| 273 |
}
|
| 274 |
|
| 275 |
/**
|
| 277 |
*/
|
| 278 |
public function testAddExtensionWithDeprecatedGetGlobals()
|
| 279 |
{
|
| 280 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 281 |
$twig->addExtension(new Twig_Tests_EnvironmentTest_Extension_WithGlobals());
|
| 282 |
|
| 283 |
$this->deprecations = array();
|
| 296 |
*/
|
| 297 |
public function testRemoveExtension()
|
| 298 |
{
|
| 299 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 300 |
$twig->addExtension(new Twig_Tests_EnvironmentTest_Extension());
|
| 301 |
$twig->removeExtension('environment_test');
|
| 302 |
|
| 312 |
|
| 313 |
public function testAddMockExtension()
|
| 314 |
{
|
| 315 |
+
$extension = $this->getMockBuilder('Twig_ExtensionInterface')->getMock();
|
| 316 |
$extension->expects($this->once())
|
| 317 |
->method('getName')
|
| 318 |
->will($this->returnValue('mock'));
|
| 328 |
|
| 329 |
public function testInitRuntimeWithAnExtensionUsingInitRuntimeNoDeprecation()
|
| 330 |
{
|
| 331 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 332 |
$twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithoutDeprecationInitRuntime());
|
| 333 |
|
| 334 |
$twig->initRuntime();
|
| 339 |
*/
|
| 340 |
public function testInitRuntimeWithAnExtensionUsingInitRuntimeDeprecation()
|
| 341 |
{
|
| 342 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 343 |
$twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime());
|
| 344 |
|
| 345 |
$this->deprecations = array();
|
| 365 |
*/
|
| 366 |
public function testOverrideExtension()
|
| 367 |
{
|
| 368 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 369 |
$twig->addExtension(new Twig_Tests_EnvironmentTest_ExtensionWithDeprecationInitRuntime());
|
| 370 |
|
| 371 |
$this->deprecations = array();
|
| 382 |
|
| 383 |
protected function getMockLoader($templateName, $templateContent)
|
| 384 |
{
|
| 385 |
+
$loader = $this->getMockBuilder('Twig_LoaderInterface')->getMock();
|
| 386 |
$loader->expects($this->any())
|
| 387 |
->method('getSource')
|
| 388 |
->with($templateName)
|
library/twig/twig/test/Twig/Tests/ExpressionParserTest.php
CHANGED
|
@@ -17,7 +17,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 17 |
*/
|
| 18 |
public function testCanOnlyAssignToNames($template)
|
| 19 |
{
|
| 20 |
-
$env = new Twig_Environment($this->
|
| 21 |
$parser = new Twig_Parser($env);
|
| 22 |
|
| 23 |
$parser->parse($env->tokenize($template, 'index'));
|
|
@@ -46,7 +46,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 46 |
*/
|
| 47 |
public function testArrayExpression($template, $expected)
|
| 48 |
{
|
| 49 |
-
$env = new Twig_Environment($this->
|
| 50 |
$stream = $env->tokenize($template, 'index');
|
| 51 |
$parser = new Twig_Parser($env);
|
| 52 |
|
|
@@ -59,7 +59,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 59 |
*/
|
| 60 |
public function testArraySyntaxError($template)
|
| 61 |
{
|
| 62 |
-
$env = new Twig_Environment($this->
|
| 63 |
$parser = new Twig_Parser($env);
|
| 64 |
|
| 65 |
$parser->parse($env->tokenize($template, 'index'));
|
|
@@ -154,7 +154,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 154 |
*/
|
| 155 |
public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings()
|
| 156 |
{
|
| 157 |
-
$env = new Twig_Environment($this->
|
| 158 |
$stream = $env->tokenize('{{ "a" "b" }}', 'index');
|
| 159 |
$parser = new Twig_Parser($env);
|
| 160 |
|
|
@@ -166,7 +166,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 166 |
*/
|
| 167 |
public function testStringExpression($template, $expected)
|
| 168 |
{
|
| 169 |
-
$env = new Twig_Environment($this->
|
| 170 |
$stream = $env->tokenize($template, 'index');
|
| 171 |
$parser = new Twig_Parser($env);
|
| 172 |
|
|
@@ -225,7 +225,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 225 |
*/
|
| 226 |
public function testAttributeCallDoesNotSupportNamedArguments()
|
| 227 |
{
|
| 228 |
-
$env = new Twig_Environment($this->
|
| 229 |
$parser = new Twig_Parser($env);
|
| 230 |
|
| 231 |
$parser->parse($env->tokenize('{{ foo.bar(name="Foo") }}', 'index'));
|
|
@@ -236,7 +236,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 236 |
*/
|
| 237 |
public function testMacroCallDoesNotSupportNamedArguments()
|
| 238 |
{
|
| 239 |
-
$env = new Twig_Environment($this->
|
| 240 |
$parser = new Twig_Parser($env);
|
| 241 |
|
| 242 |
$parser->parse($env->tokenize('{% from _self import foo %}{% macro foo() %}{% endmacro %}{{ foo(name="Foo") }}', 'index'));
|
|
@@ -248,7 +248,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 248 |
*/
|
| 249 |
public function testMacroDefinitionDoesNotSupportNonNameVariableName()
|
| 250 |
{
|
| 251 |
-
$env = new Twig_Environment($this->
|
| 252 |
$parser = new Twig_Parser($env);
|
| 253 |
|
| 254 |
$parser->parse($env->tokenize('{% macro foo("a") %}{% endmacro %}', 'index'));
|
|
@@ -261,7 +261,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 261 |
*/
|
| 262 |
public function testMacroDefinitionDoesNotSupportNonConstantDefaultValues($template)
|
| 263 |
{
|
| 264 |
-
$env = new Twig_Environment($this->
|
| 265 |
$parser = new Twig_Parser($env);
|
| 266 |
|
| 267 |
$parser->parse($env->tokenize($template, 'index'));
|
|
@@ -280,7 +280,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 280 |
*/
|
| 281 |
public function testMacroDefinitionSupportsConstantDefaultValues($template)
|
| 282 |
{
|
| 283 |
-
$env = new Twig_Environment($this->
|
| 284 |
$parser = new Twig_Parser($env);
|
| 285 |
|
| 286 |
$parser->parse($env->tokenize($template, 'index'));
|
|
@@ -305,7 +305,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 305 |
*/
|
| 306 |
public function testUnknownFunction()
|
| 307 |
{
|
| 308 |
-
$env = new Twig_Environment($this->
|
| 309 |
$parser = new Twig_Parser($env);
|
| 310 |
|
| 311 |
$parser->parse($env->tokenize('{{ cycl() }}', 'index'));
|
|
@@ -317,7 +317,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 317 |
*/
|
| 318 |
public function testUnknownFunctionWithoutSuggestions()
|
| 319 |
{
|
| 320 |
-
$env = new Twig_Environment($this->
|
| 321 |
$parser = new Twig_Parser($env);
|
| 322 |
|
| 323 |
$parser->parse($env->tokenize('{{ foobar() }}', 'index'));
|
|
@@ -329,7 +329,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 329 |
*/
|
| 330 |
public function testUnknownFilter()
|
| 331 |
{
|
| 332 |
-
$env = new Twig_Environment($this->
|
| 333 |
$parser = new Twig_Parser($env);
|
| 334 |
|
| 335 |
$parser->parse($env->tokenize('{{ 1|lowe }}', 'index'));
|
|
@@ -341,7 +341,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 341 |
*/
|
| 342 |
public function testUnknownFilterWithoutSuggestions()
|
| 343 |
{
|
| 344 |
-
$env = new Twig_Environment($this->
|
| 345 |
$parser = new Twig_Parser($env);
|
| 346 |
|
| 347 |
$parser->parse($env->tokenize('{{ 1|foobar }}', 'index'));
|
|
@@ -353,7 +353,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 353 |
*/
|
| 354 |
public function testUnknownTest()
|
| 355 |
{
|
| 356 |
-
$env = new Twig_Environment($this->
|
| 357 |
$parser = new Twig_Parser($env);
|
| 358 |
|
| 359 |
$parser->parse($env->tokenize('{{ 1 is nul }}', 'index'));
|
|
@@ -365,7 +365,7 @@ class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase
|
|
| 365 |
*/
|
| 366 |
public function testUnknownTestWithoutSuggestions()
|
| 367 |
{
|
| 368 |
-
$env = new Twig_Environment($this->
|
| 369 |
$parser = new Twig_Parser($env);
|
| 370 |
|
| 371 |
$parser->parse($env->tokenize('{{ 1 is foobar }}', 'index'));
|
| 17 |
*/
|
| 18 |
public function testCanOnlyAssignToNames($template)
|
| 19 |
{
|
| 20 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 21 |
$parser = new Twig_Parser($env);
|
| 22 |
|
| 23 |
$parser->parse($env->tokenize($template, 'index'));
|
| 46 |
*/
|
| 47 |
public function testArrayExpression($template, $expected)
|
| 48 |
{
|
| 49 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 50 |
$stream = $env->tokenize($template, 'index');
|
| 51 |
$parser = new Twig_Parser($env);
|
| 52 |
|
| 59 |
*/
|
| 60 |
public function testArraySyntaxError($template)
|
| 61 |
{
|
| 62 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 63 |
$parser = new Twig_Parser($env);
|
| 64 |
|
| 65 |
$parser->parse($env->tokenize($template, 'index'));
|
| 154 |
*/
|
| 155 |
public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings()
|
| 156 |
{
|
| 157 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0));
|
| 158 |
$stream = $env->tokenize('{{ "a" "b" }}', 'index');
|
| 159 |
$parser = new Twig_Parser($env);
|
| 160 |
|
| 166 |
*/
|
| 167 |
public function testStringExpression($template, $expected)
|
| 168 |
{
|
| 169 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0));
|
| 170 |
$stream = $env->tokenize($template, 'index');
|
| 171 |
$parser = new Twig_Parser($env);
|
| 172 |
|
| 225 |
*/
|
| 226 |
public function testAttributeCallDoesNotSupportNamedArguments()
|
| 227 |
{
|
| 228 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 229 |
$parser = new Twig_Parser($env);
|
| 230 |
|
| 231 |
$parser->parse($env->tokenize('{{ foo.bar(name="Foo") }}', 'index'));
|
| 236 |
*/
|
| 237 |
public function testMacroCallDoesNotSupportNamedArguments()
|
| 238 |
{
|
| 239 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 240 |
$parser = new Twig_Parser($env);
|
| 241 |
|
| 242 |
$parser->parse($env->tokenize('{% from _self import foo %}{% macro foo() %}{% endmacro %}{{ foo(name="Foo") }}', 'index'));
|
| 248 |
*/
|
| 249 |
public function testMacroDefinitionDoesNotSupportNonNameVariableName()
|
| 250 |
{
|
| 251 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 252 |
$parser = new Twig_Parser($env);
|
| 253 |
|
| 254 |
$parser->parse($env->tokenize('{% macro foo("a") %}{% endmacro %}', 'index'));
|
| 261 |
*/
|
| 262 |
public function testMacroDefinitionDoesNotSupportNonConstantDefaultValues($template)
|
| 263 |
{
|
| 264 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 265 |
$parser = new Twig_Parser($env);
|
| 266 |
|
| 267 |
$parser->parse($env->tokenize($template, 'index'));
|
| 280 |
*/
|
| 281 |
public function testMacroDefinitionSupportsConstantDefaultValues($template)
|
| 282 |
{
|
| 283 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 284 |
$parser = new Twig_Parser($env);
|
| 285 |
|
| 286 |
$parser->parse($env->tokenize($template, 'index'));
|
| 305 |
*/
|
| 306 |
public function testUnknownFunction()
|
| 307 |
{
|
| 308 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 309 |
$parser = new Twig_Parser($env);
|
| 310 |
|
| 311 |
$parser->parse($env->tokenize('{{ cycl() }}', 'index'));
|
| 317 |
*/
|
| 318 |
public function testUnknownFunctionWithoutSuggestions()
|
| 319 |
{
|
| 320 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 321 |
$parser = new Twig_Parser($env);
|
| 322 |
|
| 323 |
$parser->parse($env->tokenize('{{ foobar() }}', 'index'));
|
| 329 |
*/
|
| 330 |
public function testUnknownFilter()
|
| 331 |
{
|
| 332 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 333 |
$parser = new Twig_Parser($env);
|
| 334 |
|
| 335 |
$parser->parse($env->tokenize('{{ 1|lowe }}', 'index'));
|
| 341 |
*/
|
| 342 |
public function testUnknownFilterWithoutSuggestions()
|
| 343 |
{
|
| 344 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 345 |
$parser = new Twig_Parser($env);
|
| 346 |
|
| 347 |
$parser->parse($env->tokenize('{{ 1|foobar }}', 'index'));
|
| 353 |
*/
|
| 354 |
public function testUnknownTest()
|
| 355 |
{
|
| 356 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 357 |
$parser = new Twig_Parser($env);
|
| 358 |
|
| 359 |
$parser->parse($env->tokenize('{{ 1 is nul }}', 'index'));
|
| 365 |
*/
|
| 366 |
public function testUnknownTestWithoutSuggestions()
|
| 367 |
{
|
| 368 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 369 |
$parser = new Twig_Parser($env);
|
| 370 |
|
| 371 |
$parser->parse($env->tokenize('{{ 1 is foobar }}', 'index'));
|
library/twig/twig/test/Twig/Tests/Extension/CoreTest.php
CHANGED
|
@@ -16,7 +16,7 @@ class Twig_Tests_Extension_CoreTest extends PHPUnit_Framework_TestCase
|
|
| 16 |
*/
|
| 17 |
public function testRandomFunction($value, $expectedInArray)
|
| 18 |
{
|
| 19 |
-
$env = new Twig_Environment($this->
|
| 20 |
|
| 21 |
for ($i = 0; $i < 100; ++$i) {
|
| 22 |
$this->assertTrue(in_array(twig_random($env, $value), $expectedInArray, true)); // assertContains() would not consider the type
|
|
@@ -62,18 +62,18 @@ class Twig_Tests_Extension_CoreTest extends PHPUnit_Framework_TestCase
|
|
| 62 |
$max = mt_getrandmax();
|
| 63 |
|
| 64 |
for ($i = 0; $i < 100; ++$i) {
|
| 65 |
-
$val = twig_random(new Twig_Environment($this->
|
| 66 |
$this->assertTrue(is_int($val) && $val >= 0 && $val <= $max);
|
| 67 |
}
|
| 68 |
}
|
| 69 |
|
| 70 |
public function testRandomFunctionReturnsAsIs()
|
| 71 |
{
|
| 72 |
-
$this->assertSame('', twig_random(new Twig_Environment($this->
|
| 73 |
-
$this->assertSame('', twig_random(new Twig_Environment($this->
|
| 74 |
|
| 75 |
$instance = new stdClass();
|
| 76 |
-
$this->assertSame($instance, twig_random(new Twig_Environment($this->
|
| 77 |
}
|
| 78 |
|
| 79 |
/**
|
|
@@ -81,7 +81,7 @@ class Twig_Tests_Extension_CoreTest extends PHPUnit_Framework_TestCase
|
|
| 81 |
*/
|
| 82 |
public function testRandomFunctionOfEmptyArrayThrowsException()
|
| 83 |
{
|
| 84 |
-
twig_random(new Twig_Environment($this->
|
| 85 |
}
|
| 86 |
|
| 87 |
public function testRandomFunctionOnNonUTF8String()
|
|
@@ -90,7 +90,7 @@ class Twig_Tests_Extension_CoreTest extends PHPUnit_Framework_TestCase
|
|
| 90 |
$this->markTestSkipped('needs iconv or mbstring');
|
| 91 |
}
|
| 92 |
|
| 93 |
-
$twig = new Twig_Environment($this->
|
| 94 |
$twig->setCharset('ISO-8859-1');
|
| 95 |
|
| 96 |
$text = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8');
|
|
@@ -106,7 +106,7 @@ class Twig_Tests_Extension_CoreTest extends PHPUnit_Framework_TestCase
|
|
| 106 |
$this->markTestSkipped('needs iconv or mbstring');
|
| 107 |
}
|
| 108 |
|
| 109 |
-
$twig = new Twig_Environment($this->
|
| 110 |
$twig->setCharset('ISO-8859-1');
|
| 111 |
|
| 112 |
$input = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8');
|
|
@@ -117,7 +117,7 @@ class Twig_Tests_Extension_CoreTest extends PHPUnit_Framework_TestCase
|
|
| 117 |
|
| 118 |
public function testCustomEscaper()
|
| 119 |
{
|
| 120 |
-
$twig = new Twig_Environment($this->
|
| 121 |
$twig->getExtension('core')->setEscaper('foo', 'foo_escaper_for_test');
|
| 122 |
|
| 123 |
$this->assertEquals('fooUTF-8', twig_escape_filter($twig, 'foo', 'foo'));
|
|
@@ -130,12 +130,12 @@ class Twig_Tests_Extension_CoreTest extends PHPUnit_Framework_TestCase
|
|
| 130 |
*/
|
| 131 |
public function testUnknownCustomEscaper()
|
| 132 |
{
|
| 133 |
-
twig_escape_filter(new Twig_Environment($this->
|
| 134 |
}
|
| 135 |
|
| 136 |
public function testTwigFirst()
|
| 137 |
{
|
| 138 |
-
$twig = new Twig_Environment($this->
|
| 139 |
$this->assertEquals('a', twig_first($twig, 'abc'));
|
| 140 |
$this->assertEquals(1, twig_first($twig, array(1, 2, 3)));
|
| 141 |
$this->assertSame('', twig_first($twig, null));
|
|
@@ -144,7 +144,7 @@ class Twig_Tests_Extension_CoreTest extends PHPUnit_Framework_TestCase
|
|
| 144 |
|
| 145 |
public function testTwigLast()
|
| 146 |
{
|
| 147 |
-
$twig = new Twig_Environment($this->
|
| 148 |
$this->assertEquals('c', twig_last($twig, 'abc'));
|
| 149 |
$this->assertEquals(3, twig_last($twig, array(1, 2, 3)));
|
| 150 |
$this->assertSame('', twig_last($twig, null));
|
| 16 |
*/
|
| 17 |
public function testRandomFunction($value, $expectedInArray)
|
| 18 |
{
|
| 19 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 20 |
|
| 21 |
for ($i = 0; $i < 100; ++$i) {
|
| 22 |
$this->assertTrue(in_array(twig_random($env, $value), $expectedInArray, true)); // assertContains() would not consider the type
|
| 62 |
$max = mt_getrandmax();
|
| 63 |
|
| 64 |
for ($i = 0; $i < 100; ++$i) {
|
| 65 |
+
$val = twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 66 |
$this->assertTrue(is_int($val) && $val >= 0 && $val <= $max);
|
| 67 |
}
|
| 68 |
}
|
| 69 |
|
| 70 |
public function testRandomFunctionReturnsAsIs()
|
| 71 |
{
|
| 72 |
+
$this->assertSame('', twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), ''));
|
| 73 |
+
$this->assertSame('', twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('charset' => null)), ''));
|
| 74 |
|
| 75 |
$instance = new stdClass();
|
| 76 |
+
$this->assertSame($instance, twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), $instance));
|
| 77 |
}
|
| 78 |
|
| 79 |
/**
|
| 81 |
*/
|
| 82 |
public function testRandomFunctionOfEmptyArrayThrowsException()
|
| 83 |
{
|
| 84 |
+
twig_random(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), array());
|
| 85 |
}
|
| 86 |
|
| 87 |
public function testRandomFunctionOnNonUTF8String()
|
| 90 |
$this->markTestSkipped('needs iconv or mbstring');
|
| 91 |
}
|
| 92 |
|
| 93 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 94 |
$twig->setCharset('ISO-8859-1');
|
| 95 |
|
| 96 |
$text = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8');
|
| 106 |
$this->markTestSkipped('needs iconv or mbstring');
|
| 107 |
}
|
| 108 |
|
| 109 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 110 |
$twig->setCharset('ISO-8859-1');
|
| 111 |
|
| 112 |
$input = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8');
|
| 117 |
|
| 118 |
public function testCustomEscaper()
|
| 119 |
{
|
| 120 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 121 |
$twig->getExtension('core')->setEscaper('foo', 'foo_escaper_for_test');
|
| 122 |
|
| 123 |
$this->assertEquals('fooUTF-8', twig_escape_filter($twig, 'foo', 'foo'));
|
| 130 |
*/
|
| 131 |
public function testUnknownCustomEscaper()
|
| 132 |
{
|
| 133 |
+
twig_escape_filter(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), 'foo', 'bar');
|
| 134 |
}
|
| 135 |
|
| 136 |
public function testTwigFirst()
|
| 137 |
{
|
| 138 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 139 |
$this->assertEquals('a', twig_first($twig, 'abc'));
|
| 140 |
$this->assertEquals(1, twig_first($twig, array(1, 2, 3)));
|
| 141 |
$this->assertSame('', twig_first($twig, null));
|
| 144 |
|
| 145 |
public function testTwigLast()
|
| 146 |
{
|
| 147 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 148 |
$this->assertEquals('c', twig_last($twig, 'abc'));
|
| 149 |
$this->assertEquals(3, twig_last($twig, array(1, 2, 3)));
|
| 150 |
$this->assertSame('', twig_last($twig, null));
|
library/twig/twig/test/Twig/Tests/Fixtures/autoescape/block.test
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--TEST--
|
| 2 |
+
blocks and autoescape
|
| 3 |
+
--TEMPLATE--
|
| 4 |
+
{{ include('unrelated.txt.twig') -}}
|
| 5 |
+
{{ include('template.html.twig') -}}
|
| 6 |
+
--TEMPLATE(unrelated.txt.twig)--
|
| 7 |
+
{% block content %}{% endblock %}
|
| 8 |
+
--TEMPLATE(template.html.twig)--
|
| 9 |
+
{% extends 'parent.html.twig' %}
|
| 10 |
+
{% block content %}
|
| 11 |
+
{{ br -}}
|
| 12 |
+
{% endblock %}
|
| 13 |
+
--TEMPLATE(parent.html.twig)--
|
| 14 |
+
{% set _content = block('content')|raw %}
|
| 15 |
+
{{ _content|raw }}
|
| 16 |
+
--DATA--
|
| 17 |
+
return array('br' => '<br />')
|
| 18 |
+
--CONFIG--
|
| 19 |
+
return array('autoescape' => 'filename')
|
| 20 |
+
--EXPECT--
|
| 21 |
+
<br />
|
library/twig/twig/test/Twig/Tests/Fixtures/tags/embed/complex_dynamic_parent.test
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--TEST--
|
| 2 |
+
"embed" tag
|
| 3 |
+
--TEMPLATE--
|
| 4 |
+
FOO
|
| 5 |
+
{% embed foo ~ ".twig" %}
|
| 6 |
+
{% block c1 %}
|
| 7 |
+
{{ parent() }}
|
| 8 |
+
block1extended
|
| 9 |
+
{% endblock %}
|
| 10 |
+
{% endembed %}
|
| 11 |
+
|
| 12 |
+
BAR
|
| 13 |
+
--TEMPLATE(foo.twig)--
|
| 14 |
+
A
|
| 15 |
+
{% block c1 %}
|
| 16 |
+
block1
|
| 17 |
+
{% endblock %}
|
| 18 |
+
B
|
| 19 |
+
{% block c2 %}
|
| 20 |
+
block2
|
| 21 |
+
{% endblock %}
|
| 22 |
+
C
|
| 23 |
+
--DATA--
|
| 24 |
+
return array('foo' => 'foo')
|
| 25 |
+
--EXPECT--
|
| 26 |
+
FOO
|
| 27 |
+
|
| 28 |
+
A
|
| 29 |
+
block1
|
| 30 |
+
|
| 31 |
+
block1extended
|
| 32 |
+
B
|
| 33 |
+
block2
|
| 34 |
+
C
|
| 35 |
+
BAR
|
library/twig/twig/test/Twig/Tests/Fixtures/tags/embed/dynamic_parent.test
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--TEST--
|
| 2 |
+
"embed" tag
|
| 3 |
+
--TEMPLATE--
|
| 4 |
+
FOO
|
| 5 |
+
{% embed foo %}
|
| 6 |
+
{% block c1 %}
|
| 7 |
+
{{ parent() }}
|
| 8 |
+
block1extended
|
| 9 |
+
{% endblock %}
|
| 10 |
+
{% endembed %}
|
| 11 |
+
|
| 12 |
+
BAR
|
| 13 |
+
--TEMPLATE(foo.twig)--
|
| 14 |
+
A
|
| 15 |
+
{% block c1 %}
|
| 16 |
+
block1
|
| 17 |
+
{% endblock %}
|
| 18 |
+
B
|
| 19 |
+
{% block c2 %}
|
| 20 |
+
block2
|
| 21 |
+
{% endblock %}
|
| 22 |
+
C
|
| 23 |
+
--DATA--
|
| 24 |
+
return array('foo' => 'foo.twig')
|
| 25 |
+
--EXPECT--
|
| 26 |
+
FOO
|
| 27 |
+
|
| 28 |
+
A
|
| 29 |
+
block1
|
| 30 |
+
|
| 31 |
+
block1extended
|
| 32 |
+
B
|
| 33 |
+
block2
|
| 34 |
+
C
|
| 35 |
+
BAR
|
library/twig/twig/test/Twig/Tests/LexerTest.php
CHANGED
|
@@ -14,7 +14,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 14 |
{
|
| 15 |
$template = '{% § %}';
|
| 16 |
|
| 17 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 18 |
$stream = $lexer->tokenize($template);
|
| 19 |
|
| 20 |
$stream->expect(Twig_Token::BLOCK_START_TYPE);
|
|
@@ -25,7 +25,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 25 |
{
|
| 26 |
$template = '{{ §() }}';
|
| 27 |
|
| 28 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 29 |
$stream = $lexer->tokenize($template);
|
| 30 |
|
| 31 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
|
@@ -42,7 +42,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 42 |
|
| 43 |
protected function countToken($template, $type, $value = null)
|
| 44 |
{
|
| 45 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 46 |
$stream = $lexer->tokenize($template);
|
| 47 |
|
| 48 |
$count = 0;
|
|
@@ -67,7 +67,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 67 |
."baz\n"
|
| 68 |
."}}\n";
|
| 69 |
|
| 70 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 71 |
$stream = $lexer->tokenize($template);
|
| 72 |
|
| 73 |
// foo\nbar\n
|
|
@@ -87,7 +87,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 87 |
."baz\n"
|
| 88 |
."}}\n";
|
| 89 |
|
| 90 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 91 |
$stream = $lexer->tokenize($template);
|
| 92 |
|
| 93 |
// foo\nbar
|
|
@@ -102,7 +102,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 102 |
{
|
| 103 |
$template = '{# '.str_repeat('*', 100000).' #}';
|
| 104 |
|
| 105 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 106 |
$lexer->tokenize($template);
|
| 107 |
|
| 108 |
// should not throw an exception
|
|
@@ -112,7 +112,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 112 |
{
|
| 113 |
$template = '{% verbatim %}'.str_repeat('*', 100000).'{% endverbatim %}';
|
| 114 |
|
| 115 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 116 |
$lexer->tokenize($template);
|
| 117 |
|
| 118 |
// should not throw an exception
|
|
@@ -122,7 +122,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 122 |
{
|
| 123 |
$template = '{{ '.str_repeat('x', 100000).' }}';
|
| 124 |
|
| 125 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 126 |
$lexer->tokenize($template);
|
| 127 |
|
| 128 |
// should not throw an exception
|
|
@@ -132,7 +132,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 132 |
{
|
| 133 |
$template = '{% '.str_repeat('x', 100000).' %}';
|
| 134 |
|
| 135 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 136 |
$lexer->tokenize($template);
|
| 137 |
|
| 138 |
// should not throw an exception
|
|
@@ -142,7 +142,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 142 |
{
|
| 143 |
$template = '{{ 922337203685477580700 }}';
|
| 144 |
|
| 145 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 146 |
$stream = $lexer->tokenize($template);
|
| 147 |
$stream->next();
|
| 148 |
$node = $stream->next();
|
|
@@ -155,7 +155,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 155 |
"{{ 'foo \' bar' }}" => 'foo \' bar',
|
| 156 |
'{{ "foo \" bar" }}' => 'foo " bar',
|
| 157 |
);
|
| 158 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 159 |
foreach ($tests as $template => $expected) {
|
| 160 |
$stream = $lexer->tokenize($template);
|
| 161 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
|
@@ -167,7 +167,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 167 |
{
|
| 168 |
$template = 'foo {{ "bar #{ baz + 1 }" }}';
|
| 169 |
|
| 170 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 171 |
$stream = $lexer->tokenize($template);
|
| 172 |
$stream->expect(Twig_Token::TEXT_TYPE, 'foo ');
|
| 173 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
|
@@ -184,7 +184,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 184 |
{
|
| 185 |
$template = '{{ "bar \#{baz+1}" }}';
|
| 186 |
|
| 187 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 188 |
$stream = $lexer->tokenize($template);
|
| 189 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
| 190 |
$stream->expect(Twig_Token::STRING_TYPE, 'bar #{baz+1}');
|
|
@@ -195,7 +195,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 195 |
{
|
| 196 |
$template = '{{ "bar # baz" }}';
|
| 197 |
|
| 198 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 199 |
$stream = $lexer->tokenize($template);
|
| 200 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
| 201 |
$stream->expect(Twig_Token::STRING_TYPE, 'bar # baz');
|
|
@@ -210,7 +210,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 210 |
{
|
| 211 |
$template = '{{ "bar #{x" }}';
|
| 212 |
|
| 213 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 214 |
$lexer->tokenize($template);
|
| 215 |
}
|
| 216 |
|
|
@@ -218,7 +218,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 218 |
{
|
| 219 |
$template = '{{ "bar #{ "foo#{bar}" }" }}';
|
| 220 |
|
| 221 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 222 |
$stream = $lexer->tokenize($template);
|
| 223 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
| 224 |
$stream->expect(Twig_Token::STRING_TYPE, 'bar ');
|
|
@@ -235,7 +235,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 235 |
{
|
| 236 |
$template = '{% foo "bar #{ "foo#{bar}" }" %}';
|
| 237 |
|
| 238 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 239 |
$stream = $lexer->tokenize($template);
|
| 240 |
$stream->expect(Twig_Token::BLOCK_START_TYPE);
|
| 241 |
$stream->expect(Twig_Token::NAME_TYPE, 'foo');
|
|
@@ -253,7 +253,7 @@ class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase
|
|
| 253 |
{
|
| 254 |
$template = "{{ 1 and\n0}}";
|
| 255 |
|
| 256 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 257 |
$stream = $lexer->tokenize($template);
|
| 258 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
| 259 |
$stream->expect(Twig_Token::NUMBER_TYPE, 1);
|
|
@@ -275,7 +275,7 @@ bar
|
|
| 275 |
|
| 276 |
';
|
| 277 |
|
| 278 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 279 |
$lexer->tokenize($template);
|
| 280 |
}
|
| 281 |
|
|
@@ -294,7 +294,7 @@ bar
|
|
| 294 |
|
| 295 |
';
|
| 296 |
|
| 297 |
-
$lexer = new Twig_Lexer(new Twig_Environment($this->
|
| 298 |
$lexer->tokenize($template);
|
| 299 |
}
|
| 300 |
}
|
| 14 |
{
|
| 15 |
$template = '{% § %}';
|
| 16 |
|
| 17 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 18 |
$stream = $lexer->tokenize($template);
|
| 19 |
|
| 20 |
$stream->expect(Twig_Token::BLOCK_START_TYPE);
|
| 25 |
{
|
| 26 |
$template = '{{ §() }}';
|
| 27 |
|
| 28 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 29 |
$stream = $lexer->tokenize($template);
|
| 30 |
|
| 31 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
| 42 |
|
| 43 |
protected function countToken($template, $type, $value = null)
|
| 44 |
{
|
| 45 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 46 |
$stream = $lexer->tokenize($template);
|
| 47 |
|
| 48 |
$count = 0;
|
| 67 |
."baz\n"
|
| 68 |
."}}\n";
|
| 69 |
|
| 70 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 71 |
$stream = $lexer->tokenize($template);
|
| 72 |
|
| 73 |
// foo\nbar\n
|
| 87 |
."baz\n"
|
| 88 |
."}}\n";
|
| 89 |
|
| 90 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 91 |
$stream = $lexer->tokenize($template);
|
| 92 |
|
| 93 |
// foo\nbar
|
| 102 |
{
|
| 103 |
$template = '{# '.str_repeat('*', 100000).' #}';
|
| 104 |
|
| 105 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 106 |
$lexer->tokenize($template);
|
| 107 |
|
| 108 |
// should not throw an exception
|
| 112 |
{
|
| 113 |
$template = '{% verbatim %}'.str_repeat('*', 100000).'{% endverbatim %}';
|
| 114 |
|
| 115 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 116 |
$lexer->tokenize($template);
|
| 117 |
|
| 118 |
// should not throw an exception
|
| 122 |
{
|
| 123 |
$template = '{{ '.str_repeat('x', 100000).' }}';
|
| 124 |
|
| 125 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 126 |
$lexer->tokenize($template);
|
| 127 |
|
| 128 |
// should not throw an exception
|
| 132 |
{
|
| 133 |
$template = '{% '.str_repeat('x', 100000).' %}';
|
| 134 |
|
| 135 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 136 |
$lexer->tokenize($template);
|
| 137 |
|
| 138 |
// should not throw an exception
|
| 142 |
{
|
| 143 |
$template = '{{ 922337203685477580700 }}';
|
| 144 |
|
| 145 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 146 |
$stream = $lexer->tokenize($template);
|
| 147 |
$stream->next();
|
| 148 |
$node = $stream->next();
|
| 155 |
"{{ 'foo \' bar' }}" => 'foo \' bar',
|
| 156 |
'{{ "foo \" bar" }}' => 'foo " bar',
|
| 157 |
);
|
| 158 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 159 |
foreach ($tests as $template => $expected) {
|
| 160 |
$stream = $lexer->tokenize($template);
|
| 161 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
| 167 |
{
|
| 168 |
$template = 'foo {{ "bar #{ baz + 1 }" }}';
|
| 169 |
|
| 170 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 171 |
$stream = $lexer->tokenize($template);
|
| 172 |
$stream->expect(Twig_Token::TEXT_TYPE, 'foo ');
|
| 173 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
| 184 |
{
|
| 185 |
$template = '{{ "bar \#{baz+1}" }}';
|
| 186 |
|
| 187 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 188 |
$stream = $lexer->tokenize($template);
|
| 189 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
| 190 |
$stream->expect(Twig_Token::STRING_TYPE, 'bar #{baz+1}');
|
| 195 |
{
|
| 196 |
$template = '{{ "bar # baz" }}';
|
| 197 |
|
| 198 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 199 |
$stream = $lexer->tokenize($template);
|
| 200 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
| 201 |
$stream->expect(Twig_Token::STRING_TYPE, 'bar # baz');
|
| 210 |
{
|
| 211 |
$template = '{{ "bar #{x" }}';
|
| 212 |
|
| 213 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 214 |
$lexer->tokenize($template);
|
| 215 |
}
|
| 216 |
|
| 218 |
{
|
| 219 |
$template = '{{ "bar #{ "foo#{bar}" }" }}';
|
| 220 |
|
| 221 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 222 |
$stream = $lexer->tokenize($template);
|
| 223 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
| 224 |
$stream->expect(Twig_Token::STRING_TYPE, 'bar ');
|
| 235 |
{
|
| 236 |
$template = '{% foo "bar #{ "foo#{bar}" }" %}';
|
| 237 |
|
| 238 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 239 |
$stream = $lexer->tokenize($template);
|
| 240 |
$stream->expect(Twig_Token::BLOCK_START_TYPE);
|
| 241 |
$stream->expect(Twig_Token::NAME_TYPE, 'foo');
|
| 253 |
{
|
| 254 |
$template = "{{ 1 and\n0}}";
|
| 255 |
|
| 256 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 257 |
$stream = $lexer->tokenize($template);
|
| 258 |
$stream->expect(Twig_Token::VAR_START_TYPE);
|
| 259 |
$stream->expect(Twig_Token::NUMBER_TYPE, 1);
|
| 275 |
|
| 276 |
';
|
| 277 |
|
| 278 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 279 |
$lexer->tokenize($template);
|
| 280 |
}
|
| 281 |
|
| 294 |
|
| 295 |
';
|
| 296 |
|
| 297 |
+
$lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 298 |
$lexer->tokenize($template);
|
| 299 |
}
|
| 300 |
}
|
library/twig/twig/test/Twig/Tests/Loader/ChainTest.php
CHANGED
|
@@ -63,11 +63,11 @@ class Twig_Tests_Loader_ChainTest extends PHPUnit_Framework_TestCase
|
|
| 63 |
|
| 64 |
public function testExists()
|
| 65 |
{
|
| 66 |
-
$loader1 = $this->
|
| 67 |
$loader1->expects($this->once())->method('exists')->will($this->returnValue(false));
|
| 68 |
$loader1->expects($this->never())->method('getSource');
|
| 69 |
|
| 70 |
-
$loader2 = $this->
|
| 71 |
$loader2->expects($this->once())->method('getSource')->will($this->returnValue('content'));
|
| 72 |
|
| 73 |
$loader = new Twig_Loader_Chain();
|
| 63 |
|
| 64 |
public function testExists()
|
| 65 |
{
|
| 66 |
+
$loader1 = $this->getMockBuilder('Twig_Loader_Array')->setMethods(array('exists', 'getSource'))->disableOriginalConstructor()->getMock();
|
| 67 |
$loader1->expects($this->once())->method('exists')->will($this->returnValue(false));
|
| 68 |
$loader1->expects($this->never())->method('getSource');
|
| 69 |
|
| 70 |
+
$loader2 = $this->getMockBuilder('Twig_LoaderInterface')->getMock();
|
| 71 |
$loader2->expects($this->once())->method('getSource')->will($this->returnValue('content'));
|
| 72 |
|
| 73 |
$loader = new Twig_Loader_Chain();
|
library/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php
CHANGED
|
@@ -51,10 +51,11 @@ class Twig_Tests_Loader_FilesystemTest extends PHPUnit_Framework_TestCase
|
|
| 51 |
);
|
| 52 |
}
|
| 53 |
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
| 55 |
{
|
| 56 |
-
$basePath = dirname(__FILE__).'/Fixtures';
|
| 57 |
-
|
| 58 |
$loader = new Twig_Loader_Filesystem(array($basePath.'/normal', $basePath.'/normal_bis'));
|
| 59 |
$loader->setPaths(array($basePath.'/named', $basePath.'/named_bis'), 'named');
|
| 60 |
$loader->addPath($basePath.'/named_ter', 'named');
|
|
@@ -77,15 +78,21 @@ class Twig_Tests_Loader_FilesystemTest extends PHPUnit_Framework_TestCase
|
|
| 77 |
$basePath.'/named_ter',
|
| 78 |
), $loader->getPaths('named'));
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
realpath($loader->getCacheKey('@named/named_absolute.html'))
|
| 83 |
-
);
|
| 84 |
$this->assertEquals("path (final)\n", $loader->getSource('index.html'));
|
| 85 |
$this->assertEquals("path (final)\n", $loader->getSource('@__main__/index.html'));
|
| 86 |
$this->assertEquals("named path (final)\n", $loader->getSource('@named/index.html'));
|
| 87 |
}
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
public function testEmptyConstructor()
|
| 90 |
{
|
| 91 |
$loader = new Twig_Loader_Filesystem();
|
| 51 |
);
|
| 52 |
}
|
| 53 |
|
| 54 |
+
/**
|
| 55 |
+
* @dataProvider getBasePaths
|
| 56 |
+
*/
|
| 57 |
+
public function testPaths($basePath)
|
| 58 |
{
|
|
|
|
|
|
|
| 59 |
$loader = new Twig_Loader_Filesystem(array($basePath.'/normal', $basePath.'/normal_bis'));
|
| 60 |
$loader->setPaths(array($basePath.'/named', $basePath.'/named_bis'), 'named');
|
| 61 |
$loader->addPath($basePath.'/named_ter', 'named');
|
| 78 |
$basePath.'/named_ter',
|
| 79 |
), $loader->getPaths('named'));
|
| 80 |
|
| 81 |
+
// do not use realpath here as it would make the test unuseful
|
| 82 |
+
$this->assertEquals(str_replace('\\', '/', $basePath.'/named_quater/named_absolute.html'), str_replace('\\', '/', $loader->getCacheKey('@named/named_absolute.html')));
|
|
|
|
|
|
|
| 83 |
$this->assertEquals("path (final)\n", $loader->getSource('index.html'));
|
| 84 |
$this->assertEquals("path (final)\n", $loader->getSource('@__main__/index.html'));
|
| 85 |
$this->assertEquals("named path (final)\n", $loader->getSource('@named/index.html'));
|
| 86 |
}
|
| 87 |
|
| 88 |
+
public function getBasePaths()
|
| 89 |
+
{
|
| 90 |
+
return array(
|
| 91 |
+
array(dirname(__FILE__).'/Fixtures'),
|
| 92 |
+
array('test/Twig/Tests/Loader/Fixtures'),
|
| 93 |
+
);
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
public function testEmptyConstructor()
|
| 97 |
{
|
| 98 |
$loader = new Twig_Loader_Filesystem();
|
library/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php
CHANGED
|
@@ -28,7 +28,7 @@ class Twig_Tests_Node_Expression_Binary_FloorDivTest extends Twig_Test_NodeTestC
|
|
| 28 |
$node = new Twig_Node_Expression_Binary_FloorDiv($left, $right, 1);
|
| 29 |
|
| 30 |
return array(
|
| 31 |
-
array($node, '
|
| 32 |
);
|
| 33 |
}
|
| 34 |
}
|
| 28 |
$node = new Twig_Node_Expression_Binary_FloorDiv($left, $right, 1);
|
| 29 |
|
| 30 |
return array(
|
| 31 |
+
array($node, '(int) floor((1 / 2))'),
|
| 32 |
);
|
| 33 |
}
|
| 34 |
}
|
library/twig/twig/test/Twig/Tests/Node/Expression/CallTest.php
CHANGED
|
@@ -105,6 +105,26 @@ class Twig_Tests_Node_Expression_CallTest extends PHPUnit_Framework_TestCase
|
|
| 105 |
public function customFunctionWithArbitraryArguments()
|
| 106 |
{
|
| 107 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
}
|
| 109 |
|
| 110 |
class Twig_Tests_Node_Expression_Call extends Twig_Node_Expression_Call
|
|
@@ -114,3 +134,14 @@ class Twig_Tests_Node_Expression_Call extends Twig_Node_Expression_Call
|
|
| 114 |
return parent::getArguments($callable, $arguments);
|
| 115 |
}
|
| 116 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
public function customFunctionWithArbitraryArguments()
|
| 106 |
{
|
| 107 |
}
|
| 108 |
+
|
| 109 |
+
/**
|
| 110 |
+
* @expectedException LogicException
|
| 111 |
+
* @expectedExceptionMessageRegExp #^The last parameter of "custom_Twig_Tests_Node_Expression_CallTest_function" for function "foo" must be an array with default value, eg\. "array \$arg \= array\(\)"\.$#
|
| 112 |
+
*/
|
| 113 |
+
public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnFunction()
|
| 114 |
+
{
|
| 115 |
+
$node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'foo', 'is_variadic' => true));
|
| 116 |
+
$node->getArguments('custom_Twig_Tests_Node_Expression_CallTest_function', array());
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
/**
|
| 120 |
+
* @expectedException LogicException
|
| 121 |
+
* @expectedExceptionMessageRegExp #^The last parameter of "CallableTestClass\:\:__invoke" for function "foo" must be an array with default value, eg\. "array \$arg \= array\(\)"\.$#
|
| 122 |
+
*/
|
| 123 |
+
public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnObject()
|
| 124 |
+
{
|
| 125 |
+
$node = new Twig_Tests_Node_Expression_Call(array(), array('type' => 'function', 'name' => 'foo', 'is_variadic' => true));
|
| 126 |
+
$node->getArguments(new CallableTestClass(), array());
|
| 127 |
+
}
|
| 128 |
}
|
| 129 |
|
| 130 |
class Twig_Tests_Node_Expression_Call extends Twig_Node_Expression_Call
|
| 134 |
return parent::getArguments($callable, $arguments);
|
| 135 |
}
|
| 136 |
}
|
| 137 |
+
|
| 138 |
+
class CallableTestClass
|
| 139 |
+
{
|
| 140 |
+
public function __invoke($required)
|
| 141 |
+
{
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
function custom_Twig_Tests_Node_Expression_CallTest_function($required)
|
| 146 |
+
{
|
| 147 |
+
}
|
library/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php
CHANGED
|
@@ -25,7 +25,7 @@ class Twig_Tests_Node_Expression_FilterTest extends Twig_Test_NodeTestCase
|
|
| 25 |
|
| 26 |
public function getTests()
|
| 27 |
{
|
| 28 |
-
$environment = new Twig_Environment($this->
|
| 29 |
$environment->addFilter(new Twig_SimpleFilter('bar', 'bar', array('needs_environment' => true)));
|
| 30 |
$environment->addFilter(new Twig_SimpleFilter('barbar', 'twig_tests_filter_barbar', array('needs_context' => true, 'is_variadic' => true)));
|
| 31 |
|
| 25 |
|
| 26 |
public function getTests()
|
| 27 |
{
|
| 28 |
+
$environment = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 29 |
$environment->addFilter(new Twig_SimpleFilter('bar', 'bar', array('needs_environment' => true)));
|
| 30 |
$environment->addFilter(new Twig_SimpleFilter('barbar', 'twig_tests_filter_barbar', array('needs_context' => true, 'is_variadic' => true)));
|
| 31 |
|
library/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php
CHANGED
|
@@ -23,7 +23,7 @@ class Twig_Tests_Node_Expression_FunctionTest extends Twig_Test_NodeTestCase
|
|
| 23 |
|
| 24 |
public function getTests()
|
| 25 |
{
|
| 26 |
-
$environment = new Twig_Environment($this->
|
| 27 |
$environment->addFunction(new Twig_SimpleFunction('foo', 'foo', array()));
|
| 28 |
$environment->addFunction(new Twig_SimpleFunction('bar', 'bar', array('needs_environment' => true)));
|
| 29 |
$environment->addFunction(new Twig_SimpleFunction('foofoo', 'foofoo', array('needs_context' => true)));
|
| 23 |
|
| 24 |
public function getTests()
|
| 25 |
{
|
| 26 |
+
$environment = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 27 |
$environment->addFunction(new Twig_SimpleFunction('foo', 'foo', array()));
|
| 28 |
$environment->addFunction(new Twig_SimpleFunction('bar', 'bar', array('needs_environment' => true)));
|
| 29 |
$environment->addFunction(new Twig_SimpleFunction('foofoo', 'foofoo', array('needs_context' => true)));
|
library/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php
CHANGED
|
@@ -23,8 +23,8 @@ class Twig_Tests_Node_Expression_NameTest extends Twig_Test_NodeTestCase
|
|
| 23 |
$node = new Twig_Node_Expression_Name('foo', 1);
|
| 24 |
$context = new Twig_Node_Expression_Name('_context', 1);
|
| 25 |
|
| 26 |
-
$env = new Twig_Environment($this->
|
| 27 |
-
$env1 = new Twig_Environment($this->
|
| 28 |
|
| 29 |
return array(
|
| 30 |
array($node, "// line 1\n".(PHP_VERSION_ID >= 50400 ? '(isset($context["foo"]) ? $context["foo"] : $this->getContext($context, "foo"))' : '$this->getContext($context, "foo")'), $env),
|
| 23 |
$node = new Twig_Node_Expression_Name('foo', 1);
|
| 24 |
$context = new Twig_Node_Expression_Name('_context', 1);
|
| 25 |
|
| 26 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true));
|
| 27 |
+
$env1 = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => false));
|
| 28 |
|
| 29 |
return array(
|
| 30 |
array($node, "// line 1\n".(PHP_VERSION_ID >= 50400 ? '(isset($context["foo"]) ? $context["foo"] : $this->getContext($context, "foo"))' : '$this->getContext($context, "foo")'), $env),
|
library/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php
CHANGED
|
@@ -25,7 +25,7 @@ class Twig_Tests_Node_Expression_TestTest extends Twig_Test_NodeTestCase
|
|
| 25 |
|
| 26 |
public function getTests()
|
| 27 |
{
|
| 28 |
-
$environment = new Twig_Environment($this->
|
| 29 |
$environment->addTest(new Twig_SimpleTest('barbar', 'twig_tests_test_barbar', array('is_variadic' => true, 'need_context' => true)));
|
| 30 |
|
| 31 |
$tests = array();
|
| 25 |
|
| 26 |
public function getTests()
|
| 27 |
{
|
| 28 |
+
$environment = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 29 |
$environment->addTest(new Twig_SimpleTest('barbar', 'twig_tests_test_barbar', array('is_variadic' => true, 'need_context' => true)));
|
| 30 |
|
| 31 |
$tests = array();
|
library/twig/twig/test/Twig/Tests/Node/ForTest.php
CHANGED
|
@@ -28,7 +28,7 @@ class Twig_Tests_Node_ForTest extends Twig_Test_NodeTestCase
|
|
| 28 |
$this->assertTrue($node->getAttribute('ifexpr'));
|
| 29 |
$this->assertEquals('Twig_Node_If', get_class($node->getNode('body')));
|
| 30 |
$this->assertEquals($body, $node->getNode('body')->getNode('tests')->getNode(1)->getNode(0));
|
| 31 |
-
$this->
|
| 32 |
|
| 33 |
$else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1);
|
| 34 |
$node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
|
| 28 |
$this->assertTrue($node->getAttribute('ifexpr'));
|
| 29 |
$this->assertEquals('Twig_Node_If', get_class($node->getNode('body')));
|
| 30 |
$this->assertEquals($body, $node->getNode('body')->getNode('tests')->getNode(1)->getNode(0));
|
| 31 |
+
$this->assertFalse($node->hasNode('else'));
|
| 32 |
|
| 33 |
$else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 1), 1);
|
| 34 |
$node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 1);
|
library/twig/twig/test/Twig/Tests/Node/IfTest.php
CHANGED
|
@@ -21,7 +21,7 @@ class Twig_Tests_Node_IfTest extends Twig_Test_NodeTestCase
|
|
| 21 |
$node = new Twig_Node_If($t, $else, 1);
|
| 22 |
|
| 23 |
$this->assertEquals($t, $node->getNode('tests'));
|
| 24 |
-
$this->
|
| 25 |
|
| 26 |
$else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1);
|
| 27 |
$node = new Twig_Node_If($t, $else, 1);
|
| 21 |
$node = new Twig_Node_If($t, $else, 1);
|
| 22 |
|
| 23 |
$this->assertEquals($t, $node->getNode('tests'));
|
| 24 |
+
$this->assertFalse($node->hasNode('else'));
|
| 25 |
|
| 26 |
$else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 1), 1);
|
| 27 |
$node = new Twig_Node_If($t, $else, 1);
|
library/twig/twig/test/Twig/Tests/Node/IncludeTest.php
CHANGED
|
@@ -16,7 +16,7 @@ class Twig_Tests_Node_IncludeTest extends Twig_Test_NodeTestCase
|
|
| 16 |
$expr = new Twig_Node_Expression_Constant('foo.twig', 1);
|
| 17 |
$node = new Twig_Node_Include($expr, null, false, false, 1);
|
| 18 |
|
| 19 |
-
$this->
|
| 20 |
$this->assertEquals($expr, $node->getNode('expr'));
|
| 21 |
$this->assertFalse($node->getAttribute('only'));
|
| 22 |
|
| 16 |
$expr = new Twig_Node_Expression_Constant('foo.twig', 1);
|
| 17 |
$node = new Twig_Node_Include($expr, null, false, false, 1);
|
| 18 |
|
| 19 |
+
$this->assertFalse($node->hasNode('variables'));
|
| 20 |
$this->assertEquals($expr, $node->getNode('expr'));
|
| 21 |
$this->assertFalse($node->getAttribute('only'));
|
| 22 |
|
library/twig/twig/test/Twig/Tests/Node/ModuleTest.php
CHANGED
|
@@ -30,7 +30,7 @@ class Twig_Tests_Node_ModuleTest extends Twig_Test_NodeTestCase
|
|
| 30 |
|
| 31 |
public function getTests()
|
| 32 |
{
|
| 33 |
-
$twig = new Twig_Environment($this->
|
| 34 |
|
| 35 |
$tests = array();
|
| 36 |
|
|
@@ -73,6 +73,11 @@ class __TwigTemplate_%x extends Twig_Template
|
|
| 73 |
{
|
| 74 |
return array ( 19 => 1,);
|
| 75 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
}
|
| 77 |
EOF
|
| 78 |
, $twig, true);
|
|
@@ -126,6 +131,11 @@ class __TwigTemplate_%x extends Twig_Template
|
|
| 126 |
{
|
| 127 |
return array ( 26 => 1, 24 => 2, 11 => 1,);
|
| 128 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
}
|
| 130 |
EOF
|
| 131 |
, $twig, true);
|
|
@@ -139,7 +149,7 @@ EOF
|
|
| 139 |
2
|
| 140 |
);
|
| 141 |
|
| 142 |
-
$node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename);
|
| 143 |
$tests[] = array($node, <<<EOF
|
| 144 |
<?php
|
| 145 |
|
|
@@ -174,6 +184,11 @@ class __TwigTemplate_%x extends Twig_Template
|
|
| 174 |
{
|
| 175 |
return array ( 17 => 2, 15 => 4, 9 => 2,);
|
| 176 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
}
|
| 178 |
EOF
|
| 179 |
, $twig, true);
|
| 30 |
|
| 31 |
public function getTests()
|
| 32 |
{
|
| 33 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 34 |
|
| 35 |
$tests = array();
|
| 36 |
|
| 73 |
{
|
| 74 |
return array ( 19 => 1,);
|
| 75 |
}
|
| 76 |
+
|
| 77 |
+
public function getSource()
|
| 78 |
+
{
|
| 79 |
+
return "";
|
| 80 |
+
}
|
| 81 |
}
|
| 82 |
EOF
|
| 83 |
, $twig, true);
|
| 131 |
{
|
| 132 |
return array ( 26 => 1, 24 => 2, 11 => 1,);
|
| 133 |
}
|
| 134 |
+
|
| 135 |
+
public function getSource()
|
| 136 |
+
{
|
| 137 |
+
return "";
|
| 138 |
+
}
|
| 139 |
}
|
| 140 |
EOF
|
| 141 |
, $twig, true);
|
| 149 |
2
|
| 150 |
);
|
| 151 |
|
| 152 |
+
$node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename, '{{ foo }}');
|
| 153 |
$tests[] = array($node, <<<EOF
|
| 154 |
<?php
|
| 155 |
|
| 184 |
{
|
| 185 |
return array ( 17 => 2, 15 => 4, 9 => 2,);
|
| 186 |
}
|
| 187 |
+
|
| 188 |
+
public function getSource()
|
| 189 |
+
{
|
| 190 |
+
return "{{ foo }}";
|
| 191 |
+
}
|
| 192 |
}
|
| 193 |
EOF
|
| 194 |
, $twig, true);
|
library/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php
CHANGED
|
@@ -12,7 +12,7 @@ class Twig_Tests_NodeVisitor_OptimizerTest extends PHPUnit_Framework_TestCase
|
|
| 12 |
{
|
| 13 |
public function testRenderBlockOptimizer()
|
| 14 |
{
|
| 15 |
-
$env = new Twig_Environment($this->
|
| 16 |
|
| 17 |
$stream = $env->parse($env->tokenize('{{ block("foo") }}', 'index'));
|
| 18 |
|
|
@@ -24,7 +24,7 @@ class Twig_Tests_NodeVisitor_OptimizerTest extends PHPUnit_Framework_TestCase
|
|
| 24 |
|
| 25 |
public function testRenderParentBlockOptimizer()
|
| 26 |
{
|
| 27 |
-
$env = new Twig_Environment($this->
|
| 28 |
|
| 29 |
$stream = $env->parse($env->tokenize('{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}', 'index'));
|
| 30 |
|
|
@@ -40,7 +40,7 @@ class Twig_Tests_NodeVisitor_OptimizerTest extends PHPUnit_Framework_TestCase
|
|
| 40 |
return;
|
| 41 |
}
|
| 42 |
|
| 43 |
-
$env = new Twig_Environment($this->
|
| 44 |
$stream = $env->parse($env->tokenize('{{ block(name|lower) }}', 'index'));
|
| 45 |
|
| 46 |
$node = $stream->getNode('body')->getNode(0)->getNode(1);
|
|
@@ -54,7 +54,7 @@ class Twig_Tests_NodeVisitor_OptimizerTest extends PHPUnit_Framework_TestCase
|
|
| 54 |
*/
|
| 55 |
public function testForOptimizer($template, $expected)
|
| 56 |
{
|
| 57 |
-
$env = new Twig_Environment($this->
|
| 58 |
|
| 59 |
$stream = $env->parse($env->tokenize($template, 'index'));
|
| 60 |
|
| 12 |
{
|
| 13 |
public function testRenderBlockOptimizer()
|
| 14 |
{
|
| 15 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 16 |
|
| 17 |
$stream = $env->parse($env->tokenize('{{ block("foo") }}', 'index'));
|
| 18 |
|
| 24 |
|
| 25 |
public function testRenderParentBlockOptimizer()
|
| 26 |
{
|
| 27 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 28 |
|
| 29 |
$stream = $env->parse($env->tokenize('{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}', 'index'));
|
| 30 |
|
| 40 |
return;
|
| 41 |
}
|
| 42 |
|
| 43 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false, 'autoescape' => false));
|
| 44 |
$stream = $env->parse($env->tokenize('{{ block(name|lower) }}', 'index'));
|
| 45 |
|
| 46 |
$node = $stream->getNode('body')->getNode(0)->getNode(1);
|
| 54 |
*/
|
| 55 |
public function testForOptimizer($template, $expected)
|
| 56 |
{
|
| 57 |
+
$env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('cache' => false));
|
| 58 |
|
| 59 |
$stream = $env->parse($env->tokenize($template, 'index'));
|
| 60 |
|
library/twig/twig/test/Twig/Tests/ParserTest.php
CHANGED
|
@@ -16,7 +16,7 @@ class Twig_Tests_ParserTest extends PHPUnit_Framework_TestCase
|
|
| 16 |
public function testSetMacroThrowsExceptionOnReservedMethods()
|
| 17 |
{
|
| 18 |
$parser = $this->getParser();
|
| 19 |
-
$parser->setMacro('parent', $this->
|
| 20 |
}
|
| 21 |
|
| 22 |
/**
|
|
@@ -31,7 +31,7 @@ class Twig_Tests_ParserTest extends PHPUnit_Framework_TestCase
|
|
| 31 |
new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1),
|
| 32 |
new Twig_Token(Twig_Token::EOF_TYPE, '', 1),
|
| 33 |
));
|
| 34 |
-
$parser = new Twig_Parser(new Twig_Environment($this->
|
| 35 |
$parser->parse($stream);
|
| 36 |
}
|
| 37 |
|
|
@@ -47,7 +47,7 @@ class Twig_Tests_ParserTest extends PHPUnit_Framework_TestCase
|
|
| 47 |
new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1),
|
| 48 |
new Twig_Token(Twig_Token::EOF_TYPE, '', 1),
|
| 49 |
));
|
| 50 |
-
$parser = new Twig_Parser(new Twig_Environment($this->
|
| 51 |
$parser->parse($stream);
|
| 52 |
}
|
| 53 |
|
|
@@ -110,7 +110,7 @@ class Twig_Tests_ParserTest extends PHPUnit_Framework_TestCase
|
|
| 110 |
|
| 111 |
public function testParseIsReentrant()
|
| 112 |
{
|
| 113 |
-
$twig = new Twig_Environment($this->
|
| 114 |
'autoescape' => false,
|
| 115 |
'optimizations' => 0,
|
| 116 |
));
|
|
@@ -136,7 +136,7 @@ class Twig_Tests_ParserTest extends PHPUnit_Framework_TestCase
|
|
| 136 |
// see https://github.com/symfony/symfony/issues/4218
|
| 137 |
public function testGetVarName()
|
| 138 |
{
|
| 139 |
-
$twig = new Twig_Environment($this->
|
| 140 |
'autoescape' => false,
|
| 141 |
'optimizations' => 0,
|
| 142 |
));
|
|
@@ -153,7 +153,7 @@ EOF
|
|
| 153 |
|
| 154 |
protected function getParser()
|
| 155 |
{
|
| 156 |
-
$parser = new TestParser(new Twig_Environment($this->
|
| 157 |
$parser->setParent(new Twig_Node());
|
| 158 |
$parser->stream = $this->getMockBuilder('Twig_TokenStream')->disableOriginalConstructor()->getMock();
|
| 159 |
|
| 16 |
public function testSetMacroThrowsExceptionOnReservedMethods()
|
| 17 |
{
|
| 18 |
$parser = $this->getParser();
|
| 19 |
+
$parser->setMacro('parent', $this->getMockBuilder('Twig_Node_Macro')->disableOriginalConstructor()->getMock());
|
| 20 |
}
|
| 21 |
|
| 22 |
/**
|
| 31 |
new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1),
|
| 32 |
new Twig_Token(Twig_Token::EOF_TYPE, '', 1),
|
| 33 |
));
|
| 34 |
+
$parser = new Twig_Parser(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 35 |
$parser->parse($stream);
|
| 36 |
}
|
| 37 |
|
| 47 |
new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1),
|
| 48 |
new Twig_Token(Twig_Token::EOF_TYPE, '', 1),
|
| 49 |
));
|
| 50 |
+
$parser = new Twig_Parser(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 51 |
$parser->parse($stream);
|
| 52 |
}
|
| 53 |
|
| 110 |
|
| 111 |
public function testParseIsReentrant()
|
| 112 |
{
|
| 113 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array(
|
| 114 |
'autoescape' => false,
|
| 115 |
'optimizations' => 0,
|
| 116 |
));
|
| 136 |
// see https://github.com/symfony/symfony/issues/4218
|
| 137 |
public function testGetVarName()
|
| 138 |
{
|
| 139 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array(
|
| 140 |
'autoescape' => false,
|
| 141 |
'optimizations' => 0,
|
| 142 |
));
|
| 153 |
|
| 154 |
protected function getParser()
|
| 155 |
{
|
| 156 |
+
$parser = new TestParser(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
|
| 157 |
$parser->setParent(new Twig_Node());
|
| 158 |
$parser->stream = $this->getMockBuilder('Twig_TokenStream')->disableOriginalConstructor()->getMock();
|
| 159 |
|
library/twig/twig/test/Twig/Tests/TemplateTest.php
CHANGED
|
@@ -84,19 +84,12 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
|
| 84 |
return $tests;
|
| 85 |
}
|
| 86 |
|
| 87 |
-
public function testGetSource()
|
| 88 |
-
{
|
| 89 |
-
$template = new Twig_TemplateTest(new Twig_Environment($this->getMock('Twig_LoaderInterface')), false);
|
| 90 |
-
|
| 91 |
-
$this->assertSame("<? */*bar*/ ?>\n", $template->getSource());
|
| 92 |
-
}
|
| 93 |
-
|
| 94 |
/**
|
| 95 |
* @dataProvider getGetAttributeWithSandbox
|
| 96 |
*/
|
| 97 |
public function testGetAttributeWithSandbox($object, $item, $allowed, $useExt)
|
| 98 |
{
|
| 99 |
-
$twig = new Twig_Environment($this->
|
| 100 |
$policy = new Twig_Sandbox_SecurityPolicy(array(), array(), array(/*method*/), array(/*prop*/), array());
|
| 101 |
$twig->addExtension(new Twig_Extension_Sandbox($policy, !$allowed));
|
| 102 |
$template = new Twig_TemplateTest($twig, $useExt);
|
|
@@ -140,8 +133,8 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
|
| 140 |
*/
|
| 141 |
public function testGetAttributeWithTemplateAsObject($useExt)
|
| 142 |
{
|
| 143 |
-
$template = new Twig_TemplateTest(new Twig_Environment($this->
|
| 144 |
-
$template1 = new Twig_TemplateTest(new Twig_Environment($this->
|
| 145 |
|
| 146 |
$this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string'));
|
| 147 |
$this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
|
|
@@ -180,7 +173,7 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
|
| 180 |
public function testGetAttributeOnArrayWithConfusableKey($useExt = false)
|
| 181 |
{
|
| 182 |
$template = new Twig_TemplateTest(
|
| 183 |
-
new Twig_Environment($this->
|
| 184 |
$useExt
|
| 185 |
);
|
| 186 |
|
|
@@ -219,7 +212,7 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
|
| 219 |
*/
|
| 220 |
public function testGetAttribute($defined, $value, $object, $item, $arguments, $type, $useExt = false)
|
| 221 |
{
|
| 222 |
-
$template = new Twig_TemplateTest(new Twig_Environment($this->
|
| 223 |
|
| 224 |
$this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
|
| 225 |
}
|
|
@@ -229,7 +222,7 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
|
| 229 |
*/
|
| 230 |
public function testGetAttributeStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false, $exceptionMessage = null)
|
| 231 |
{
|
| 232 |
-
$template = new Twig_TemplateTest(new Twig_Environment($this->
|
| 233 |
|
| 234 |
if ($defined) {
|
| 235 |
$this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
|
|
@@ -251,7 +244,7 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
|
| 251 |
*/
|
| 252 |
public function testGetAttributeDefined($defined, $value, $object, $item, $arguments, $type, $useExt = false)
|
| 253 |
{
|
| 254 |
-
$template = new Twig_TemplateTest(new Twig_Environment($this->
|
| 255 |
|
| 256 |
$this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true));
|
| 257 |
}
|
|
@@ -261,7 +254,7 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
|
| 261 |
*/
|
| 262 |
public function testGetAttributeDefinedStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false)
|
| 263 |
{
|
| 264 |
-
$template = new Twig_TemplateTest(new Twig_Environment($this->
|
| 265 |
|
| 266 |
$this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true));
|
| 267 |
}
|
|
@@ -271,7 +264,7 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
|
|
| 271 |
*/
|
| 272 |
public function testGetAttributeCallExceptions($useExt = false)
|
| 273 |
{
|
| 274 |
-
$template = new Twig_TemplateTest(new Twig_Environment($this->
|
| 275 |
|
| 276 |
$object = new Twig_TemplateMagicMethodExceptionObject();
|
| 277 |
|
|
@@ -453,6 +446,11 @@ class Twig_TemplateTest extends Twig_Template
|
|
| 453 |
return array();
|
| 454 |
}
|
| 455 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 456 |
protected function doGetParent(array $context)
|
| 457 |
{
|
| 458 |
}
|
|
@@ -470,8 +468,6 @@ class Twig_TemplateTest extends Twig_Template
|
|
| 470 |
}
|
| 471 |
}
|
| 472 |
}
|
| 473 |
-
/* <? *//* *bar*//* ?>*/
|
| 474 |
-
/* */
|
| 475 |
|
| 476 |
class Twig_TemplateArrayAccessObject implements ArrayAccess
|
| 477 |
{
|
| 84 |
return $tests;
|
| 85 |
}
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
/**
|
| 88 |
* @dataProvider getGetAttributeWithSandbox
|
| 89 |
*/
|
| 90 |
public function testGetAttributeWithSandbox($object, $item, $allowed, $useExt)
|
| 91 |
{
|
| 92 |
+
$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 93 |
$policy = new Twig_Sandbox_SecurityPolicy(array(), array(), array(/*method*/), array(/*prop*/), array());
|
| 94 |
$twig->addExtension(new Twig_Extension_Sandbox($policy, !$allowed));
|
| 95 |
$template = new Twig_TemplateTest($twig, $useExt);
|
| 133 |
*/
|
| 134 |
public function testGetAttributeWithTemplateAsObject($useExt)
|
| 135 |
{
|
| 136 |
+
$template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), $useExt);
|
| 137 |
+
$template1 = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), false);
|
| 138 |
|
| 139 |
$this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string'));
|
| 140 |
$this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
|
| 173 |
public function testGetAttributeOnArrayWithConfusableKey($useExt = false)
|
| 174 |
{
|
| 175 |
$template = new Twig_TemplateTest(
|
| 176 |
+
new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()),
|
| 177 |
$useExt
|
| 178 |
);
|
| 179 |
|
| 212 |
*/
|
| 213 |
public function testGetAttribute($defined, $value, $object, $item, $arguments, $type, $useExt = false)
|
| 214 |
{
|
| 215 |
+
$template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), $useExt);
|
| 216 |
|
| 217 |
$this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
|
| 218 |
}
|
| 222 |
*/
|
| 223 |
public function testGetAttributeStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false, $exceptionMessage = null)
|
| 224 |
{
|
| 225 |
+
$template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true)), $useExt);
|
| 226 |
|
| 227 |
if ($defined) {
|
| 228 |
$this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type));
|
| 244 |
*/
|
| 245 |
public function testGetAttributeDefined($defined, $value, $object, $item, $arguments, $type, $useExt = false)
|
| 246 |
{
|
| 247 |
+
$template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), $useExt);
|
| 248 |
|
| 249 |
$this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true));
|
| 250 |
}
|
| 254 |
*/
|
| 255 |
public function testGetAttributeDefinedStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false)
|
| 256 |
{
|
| 257 |
+
$template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true)), $useExt);
|
| 258 |
|
| 259 |
$this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true));
|
| 260 |
}
|
| 264 |
*/
|
| 265 |
public function testGetAttributeCallExceptions($useExt = false)
|
| 266 |
{
|
| 267 |
+
$template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), $useExt);
|
| 268 |
|
| 269 |
$object = new Twig_TemplateMagicMethodExceptionObject();
|
| 270 |
|
| 446 |
return array();
|
| 447 |
}
|
| 448 |
|
| 449 |
+
public function getSource()
|
| 450 |
+
{
|
| 451 |
+
return '';
|
| 452 |
+
}
|
| 453 |
+
|
| 454 |
protected function doGetParent(array $context)
|
| 455 |
{
|
| 456 |
}
|
| 468 |
}
|
| 469 |
}
|
| 470 |
}
|
|
|
|
|
|
|
| 471 |
|
| 472 |
class Twig_TemplateArrayAccessObject implements ArrayAccess
|
| 473 |
{
|
library/twig/twig/test/Twig/Tests/escapingTest.php
CHANGED
|
@@ -146,7 +146,7 @@ class Twig_Test_EscapingTest extends PHPUnit_Framework_TestCase
|
|
| 146 |
|
| 147 |
protected function setUp()
|
| 148 |
{
|
| 149 |
-
$this->env = new Twig_Environment($this->
|
| 150 |
}
|
| 151 |
|
| 152 |
public function testHtmlEscapingConvertsSpecialChars()
|
| 146 |
|
| 147 |
protected function setUp()
|
| 148 |
{
|
| 149 |
+
$this->env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
|
| 150 |
}
|
| 151 |
|
| 152 |
public function testHtmlEscapingConvertsSpecialChars()
|
readme.txt
CHANGED
|
@@ -151,6 +151,14 @@ Additionally, Types is the only plugin that lets you define parent/child relatio
|
|
| 151 |
|
| 152 |
== Changelog ==
|
| 153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
= 2.2.1 =
|
| 155 |
|
| 156 |
* Fixed path for Toolset Installer
|
| 151 |
|
| 152 |
== Changelog ==
|
| 153 |
|
| 154 |
+
= 2.2.2 =
|
| 155 |
+
|
| 156 |
+
* Toolset Dashboard now supports custom post types created by theme or other plugins
|
| 157 |
+
* Updated select2 to version 4
|
| 158 |
+
* Fixed issue using [types] shortcode in CRED notification
|
| 159 |
+
* Fixed minor incompatibility with the latest version of Toolset Access.
|
| 160 |
+
* Fixed issue with custom values for checkboxes fields not being respected.
|
| 161 |
+
|
| 162 |
= 2.2.1 =
|
| 163 |
|
| 164 |
* Fixed path for Toolset Installer
|
wpcf.php
CHANGED
|
@@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/extend/plugins/types/
|
|
| 5 |
Description: Toolset Types defines custom content in WordPress. Easily create custom post types, fields and taxonomy and connect everything together.
|
| 6 |
Author: OnTheGoSystems
|
| 7 |
Author URI: http://www.onthegosystems.com
|
| 8 |
-
Version: 2.2.
|
| 9 |
License: GPLv2 or later
|
| 10 |
|
| 11 |
Types is free software: you can redistribute it and/or modify
|
|
@@ -28,7 +28,7 @@ if( !function_exists( 'add_action' ) )
|
|
| 28 |
|
| 29 |
// version
|
| 30 |
if( ! defined( 'TYPES_VERSION' ) )
|
| 31 |
-
define( 'TYPES_VERSION', '2.2.
|
| 32 |
|
| 33 |
// backward compatibility
|
| 34 |
if ( ! defined( 'WPCF_VERSION' ) )
|
|
@@ -36,7 +36,7 @@ if ( ! defined( 'WPCF_VERSION' ) )
|
|
| 36 |
|
| 37 |
// release notes
|
| 38 |
if( ! defined( 'TYPES_RELEASE_NOTES' ) )
|
| 39 |
-
define( 'TYPES_RELEASE_NOTES', 'https://wp-types.com/version/types-2-2/?utm_source=typesplugin&utm_campaign=types&utm_medium=release-notes-admin-notice&utm_term=Types 2.2 release notes' );
|
| 40 |
|
| 41 |
/*
|
| 42 |
* Path Constants
|
| 5 |
Description: Toolset Types defines custom content in WordPress. Easily create custom post types, fields and taxonomy and connect everything together.
|
| 6 |
Author: OnTheGoSystems
|
| 7 |
Author URI: http://www.onthegosystems.com
|
| 8 |
+
Version: 2.2.2
|
| 9 |
License: GPLv2 or later
|
| 10 |
|
| 11 |
Types is free software: you can redistribute it and/or modify
|
| 28 |
|
| 29 |
// version
|
| 30 |
if( ! defined( 'TYPES_VERSION' ) )
|
| 31 |
+
define( 'TYPES_VERSION', '2.2.2' );
|
| 32 |
|
| 33 |
// backward compatibility
|
| 34 |
if ( ! defined( 'WPCF_VERSION' ) )
|
| 36 |
|
| 37 |
// release notes
|
| 38 |
if( ! defined( 'TYPES_RELEASE_NOTES' ) )
|
| 39 |
+
define( 'TYPES_RELEASE_NOTES', 'https://wp-types.com/version/types-2-2-2/?utm_source=typesplugin&utm_campaign=types&utm_medium=release-notes-admin-notice&utm_term=Types 2.2 release notes' );
|
| 40 |
|
| 41 |
/*
|
| 42 |
* Path Constants
|
