diff --git a/.htaccess b/.htaccess
index 7ccb6a2f629d04aad6cead1c22bf81156bb0a04a..440cabc6de02b3ea9c42603c7e191d96831c8c4a 100644
--- a/.htaccess
+++ b/.htaccess
@@ -3,7 +3,7 @@
 #
 
 # Protect files and directories from prying eyes.
-<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
+<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock))$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
   Order allow,deny
 </FilesMatch>
 
@@ -141,3 +141,9 @@ DirectoryIndex index.php index.html index.htm
     </FilesMatch>
   </IfModule>
 </IfModule>
+
+# Add headers to all responses.
+<IfModule mod_headers.c>
+  # Disable content sniffing, since it's an attack vector.
+  Header always set X-Content-Type-Options nosniff
+</IfModule>
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index b4972a60b49f99709e49c81a29d0d4cb9b2b8647..32f27bee4d491d7329e0ed68fe1e6836c8f0b6c8 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,4 +1,32 @@
 
+Drupal 7.42, 2016-02-03
+-----------------------
+- Stopped invoking hook_flush_caches() on every cron run, since some modules
+  use that hook for expensive operations that are only needed on cache clears.
+- Changed the default .htaccess and web.config to block Composer-related files.
+- Added static caching to module_load_include() to improve performance.
+- Fixed double-encoding bugs in select field widgets provided by the Options
+  module. The fix deprecates the 'strip_tags' property on option widgets and
+  replaces it with a new 'strip_tags_and_unescape' property (minor data
+  structure change).
+- Improved MySQL 5.7 support by changing the MySQL database driver to stop
+  using the ANSI SQL mode alias, which has different meanings for different
+  MySQL versions.
+- Fixed a regression introduced in Drupal 7.39 which prevented autocomplete
+  functionality from working on servers that are not configured to
+  automatically recognize index.php.
+- Updated the Archive_Tar PEAR package to the latest 1.4.0 release, to fix bugs
+  with tar file handling on various operating systems.
+- Fixed fatal errors on node preview when a field is displayed in the node
+  teaser but hidden in the full node view. The fix removes a
+  field_attach_prepare_view() call from the node_preview() function since it is
+  redundant with one in the node preview theme layer.
+- Improved the description of the "Trimmed" format option on text fields
+  (translatable string change, and minor UI and data structure change).
+- Numerous small bug fixes.
+- Numerous API documentation improvements.
+- Additional automated test coverage.
+
 Drupal 7.41, 2015-10-21
 -----------------------
 - Fixed security issues (open redirect). See SA-CORE-2015-004.
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 53462f27c983f4c91985938aafefcf272a900260..3d0854b2827c73cf44c99868b9a0ba39d5c23752 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -8,7 +8,7 @@
 /**
  * The current system version.
  */
-define('VERSION', '7.41');
+define('VERSION', '7.42');
 
 /**
  * Core API compatibility.
@@ -2827,10 +2827,14 @@ function language_list($field = 'language') {
 }
 
 /**
- * Returns the default language used on the site
+ * Returns the default language, as an object, or one of its properties.
  *
  * @param $property
- *   Optional property of the language object to return
+ *   (optional) The property of the language object to return.
+ *
+ * @return
+ *   Either the language object for the default language used on the site,
+ *   or the property of that object named in the $property parameter.
  */
 function language_default($property = NULL) {
   $language = variable_get('language_default', (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''));
diff --git a/includes/database/mysql/database.inc b/includes/database/mysql/database.inc
index fdf9271be97aa5bf4f342ac40b2804839217062e..a96b053c0a424274a9e5fa4817186586dc6e5426 100644
--- a/includes/database/mysql/database.inc
+++ b/includes/database/mysql/database.inc
@@ -81,7 +81,7 @@ class DatabaseConnection_mysql extends DatabaseConnection {
       'init_commands' => array(),
     );
     $connection_options['init_commands'] += array(
-      'sql_mode' => "SET sql_mode = 'ANSI,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER'",
+      'sql_mode' => "SET sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER'",
     );
     // Execute initial commands.
     foreach ($connection_options['init_commands'] as $sql) {
diff --git a/includes/form.inc b/includes/form.inc
index f1691adf343a6bcdb6d1d64705c5677acea062b6..baadcef282be542551195b8f5e628591df35ee48 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -3385,9 +3385,12 @@ function form_process_container($element, &$form_state) {
 /**
  * Returns HTML to wrap child elements in a container.
  *
- * Used for grouped form items. Can also be used as a #theme_wrapper for any
+ * Used for grouped form items. Can also be used as a theme wrapper for any
  * renderable element, to surround it with a <div> and add attributes such as
- * classes or an HTML id.
+ * classes or an HTML ID.
+ *
+ * See the @link forms_api_reference.html Form API reference @endlink for more
+ * information on the #theme_wrappers render array property.
  *
  * @param $variables
  *   An associative array containing:
@@ -3979,7 +3982,12 @@ function form_process_autocomplete($element) {
     // browser interpreting the path plus search string as an actual file.
     $current_clean_url = isset($GLOBALS['conf']['clean_url']) ? $GLOBALS['conf']['clean_url'] : NULL;
     $GLOBALS['conf']['clean_url'] = 0;
-    $element['#autocomplete_input']['#url_value'] = url($element['#autocomplete_path'], array('absolute' => TRUE));
+    // Force the script path to 'index.php', in case the server is not
+    // configured to find it automatically. Normally it is the responsibility
+    // of the site to do this themselves using hook_url_outbound_alter() (see
+    // url()) but since this code is forcing non-clean URLs on sites that don't
+    // normally use them, it is done here instead.
+    $element['#autocomplete_input']['#url_value'] = url($element['#autocomplete_path'], array('absolute' => TRUE, 'script' => 'index.php'));
     $GLOBALS['conf']['clean_url'] = $current_clean_url;
   }
   return $element;
diff --git a/includes/install.inc b/includes/install.inc
index 2b55589f88aaa50fdca243d2b842d3dc9ec21209..5e1d3c6326897eb15f51e26d112248dbc614b06f 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -750,7 +750,7 @@ function drupal_install_system() {
 /**
  * Uninstalls a given list of disabled modules.
  *
- * @param array $module_list
+ * @param string[] $module_list
  *   The modules to uninstall. It is the caller's responsibility to ensure that
  *   all modules in this list have already been disabled before this function
  *   is called.
@@ -769,6 +769,7 @@ function drupal_install_system() {
  *   included in $module_list).
  *
  * @see module_disable()
+ * @see module_enable()
  */
 function drupal_uninstall_modules($module_list = array(), $uninstall_dependents = TRUE) {
   if ($uninstall_dependents) {
diff --git a/includes/mail.inc b/includes/mail.inc
index 0275922be0837d384b76f014e802cd2da441da68..0e5c17804c385420751168b23b48cf33c3ddf133 100644
--- a/includes/mail.inc
+++ b/includes/mail.inc
@@ -566,7 +566,7 @@ function _drupal_wrap_mail_line(&$line, $key, $values) {
   // Use soft-breaks only for purely quoted or unindented text.
   $line = wordwrap($line, 77 - $values['length'], $values['soft'] ? " \n" : "\n");
   // Break really long words at the maximum width allowed.
-  $line = wordwrap($line, 996 - $values['length'], $values['soft'] ? " \n" : "\n");
+  $line = wordwrap($line, 996 - $values['length'], $values['soft'] ? " \n" : "\n", TRUE);
 }
 
 /**
diff --git a/includes/module.inc b/includes/module.inc
index 7bf619b47973391b56649dfce65795ab552c19f8..68c8b8ef4c43a1b09635bbb30e45452b6804a57b 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -320,16 +320,27 @@ function module_load_install($module) {
  *   The name of the included file, if successful; FALSE otherwise.
  */
 function module_load_include($type, $module, $name = NULL) {
+  static $files = array();
+
   if (!isset($name)) {
     $name = $module;
   }
 
+  $key = $type . ':' . $module . ':' . $name;
+  if (isset($files[$key])) {
+    return $files[$key];
+  }
+
   if (function_exists('drupal_get_path')) {
     $file = DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . "/$name.$type";
     if (is_file($file)) {
       require_once $file;
+      $files[$key] = $file;
       return $file;
     }
+    else {
+      $files[$key] = FALSE;
+    }
   }
   return FALSE;
 }
@@ -365,20 +376,22 @@ function module_load_all_includes($type, $name = NULL) {
  * - Invoke hook_modules_installed().
  * - Invoke hook_modules_enabled().
  *
- * @param $module_list
+ * @param string[] $module_list
  *   An array of module names.
- * @param $enable_dependencies
+ * @param bool $enable_dependencies
  *   If TRUE, dependencies will automatically be added and enabled in the
  *   correct order. This incurs a significant performance cost, so use FALSE
  *   if you know $module_list is already complete and in the correct order.
  *
- * @return
+ * @return bool
  *   FALSE if one or more dependencies are missing, TRUE otherwise.
  *
  * @see hook_install()
  * @see hook_enable()
  * @see hook_modules_installed()
  * @see hook_modules_enabled()
+ * @see module_disable()
+ * @see drupal_uninstall_modules()
  */
 function module_enable($module_list, $enable_dependencies = TRUE) {
   if ($enable_dependencies) {
@@ -505,12 +518,15 @@ function module_enable($module_list, $enable_dependencies = TRUE) {
 /**
  * Disables a given set of modules.
  *
- * @param $module_list
+ * @param string[] $module_list
  *   An array of module names.
- * @param $disable_dependents
+ * @param bool $disable_dependents
  *   If TRUE, dependent modules will automatically be added and disabled in the
  *   correct order. This incurs a significant performance cost, so use FALSE
  *   if you know $module_list is already complete and in the correct order.
+ *
+ * @see drupal_uninstall_modules()
+ * @see module_enable()
  */
 function module_disable($module_list, $disable_dependents = TRUE) {
   if ($disable_dependents) {
@@ -722,6 +738,7 @@ function module_implements($hook, $sort = FALSE, $reset = FALSE) {
     drupal_static_reset('module_hook_info');
     drupal_static_reset('drupal_alter');
     cache_clear_all('hook_info', 'cache_bootstrap');
+    cache_clear_all('system_cache_tables', 'cache');
     return;
   }
 
diff --git a/includes/theme.inc b/includes/theme.inc
index 1accdceaf05e7ce2a7ac0e47532aab0fc6b552e7..ff54d6e2c542fa9315bd1f7d4d897670b50e6e51 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -1809,7 +1809,8 @@ function theme_links($variables) {
     foreach ($links as $key => $link) {
       $class = array($key);
 
-      // Add first, last and active classes to the list of links to help out themers.
+      // Add first, last and active classes to the list of links to help out
+      // themers.
       if ($i == 1) {
         $class[] = 'first';
       }
@@ -1827,7 +1828,8 @@ function theme_links($variables) {
         $output .= l($link['title'], $link['href'], $link);
       }
       elseif (!empty($link['title'])) {
-        // Some links are actually not links, but we wrap these in <span> for adding title and class attributes.
+        // Some links are actually not links, but we wrap these in <span> for
+        // adding title and class attributes.
         if (empty($link['html'])) {
           $link['title'] = check_plain($link['title']);
         }
diff --git a/modules/block/block.module b/modules/block/block.module
index 405a9537aa9de72083b56750d6ef003c32c4031c..ca41da71cf99d73002a666cd124ae2df7636b147 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -16,7 +16,7 @@ define('BLOCK_REGION_NONE', -1);
 define('BLOCK_CUSTOM_FIXED', 0);
 
 /**
- *  Shows this block by default, but lets individual users hide it.
+ * Shows this block by default, but lets individual users hide it.
  */
 define('BLOCK_CUSTOM_ENABLED', 1);
 
@@ -59,6 +59,7 @@ function block_help($path, $arg) {
       $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can <a href="@block-add">add custom blocks</a>, which are then listed on the <a href="@blocks">Blocks administration page</a>. Once created, custom blocks behave just like default and module-generated blocks.', array('@blocks' => url('admin/structure/block'), '@block-add' => url('admin/structure/block/add'))) . '</dd>';
       $output .= '</dl>';
       return $output;
+
     case 'admin/structure/block/add':
       return '<p>' . t('Use this page to create a new custom block.') . '</p>';
   }
@@ -189,6 +190,7 @@ function _block_themes_access($theme) {
  * @param $theme
  *   The theme whose blocks are being configured. If not set, the default theme
  *   is assumed.
+ *
  * @return
  *   The theme that should be used for the block configuration page, or NULL
  *   to indicate that the default theme should be used.
@@ -343,7 +345,10 @@ function _block_get_renderable_array($list = array()) {
     // to perform contextual actions on the help block, and the links needlessly
     // draw attention on it.
     if ($key != 'system_main' && $key != 'system_help') {
-      $build[$key]['#contextual_links']['block'] = array('admin/structure/block/manage', array($block->module, $block->delta));
+      $build[$key]['#contextual_links']['block'] = array(
+        'admin/structure/block/manage',
+        array($block->module, $block->delta),
+      );
     }
 
     $build[$key] += array(
@@ -386,18 +391,20 @@ function _block_rehash($theme = NULL) {
   // Gather the blocks defined by modules.
   foreach (module_implements('block_info') as $module) {
     $module_blocks = module_invoke($module, 'block_info');
+    $delta_list = array();
     foreach ($module_blocks as $delta => $block) {
       // Compile a condition to retrieve this block from the database.
-      $condition = db_and()
-        ->condition('module', $module)
-        ->condition('delta', $delta);
-      $or->condition($condition);
       // Add identifiers.
+      $delta_list[] = $delta;
       $block['module'] = $module;
-      $block['delta']  = $delta;
-      $block['theme']  = $theme;
+      $block['delta'] = $delta;
+      $block['theme'] = $theme;
       $current_blocks[$module][$delta] = $block;
     }
+    if (!empty($delta_list)) {
+      $condition = db_and()->condition('module', $module)->condition('delta', $delta_list);
+      $or->condition($condition);
+    }
   }
   // Save the blocks defined in code for alter context.
   $code_blocks = $current_blocks;
@@ -644,7 +651,8 @@ function block_theme_initialize($theme) {
     $regions = system_region_list($theme, REGIONS_VISIBLE);
     $result = db_query("SELECT * FROM {block} WHERE theme = :theme", array(':theme' => $default_theme), array('fetch' => PDO::FETCH_ASSOC));
     foreach ($result as $block) {
-      // If the region isn't supported by the theme, assign the block to the theme's default region.
+      // If the region isn't supported by the theme, assign the block to the
+      // theme's default region.
       if ($block['status'] && !isset($regions[$block['region']])) {
         $block['region'] = system_default_region($theme);
       }
@@ -812,17 +820,18 @@ function block_block_list_alter(&$blocks) {
       // with different case. Ex: /Page, /page, /PAGE.
       $pages = drupal_strtolower($block->pages);
       if ($block->visibility < BLOCK_VISIBILITY_PHP) {
-        // Convert the Drupal path to lowercase
+        // Convert the Drupal path to lowercase.
         $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
         // Compare the lowercase internal and lowercase path alias (if any).
         $page_match = drupal_match_path($path, $pages);
         if ($path != $_GET['q']) {
           $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
         }
-        // When $block->visibility has a value of 0 (BLOCK_VISIBILITY_NOTLISTED),
-        // the block is displayed on all pages except those listed in $block->pages.
-        // When set to 1 (BLOCK_VISIBILITY_LISTED), it is displayed only on those
-        // pages listed in $block->pages.
+        // When $block->visibility has a value of 0
+        // (BLOCK_VISIBILITY_NOTLISTED), the block is displayed on all pages
+        // except those listed in $block->pages. When set to 1
+        // (BLOCK_VISIBILITY_LISTED), it is displayed only on those pages
+        // listed in $block->pages.
         $page_match = !($block->visibility xor $page_match);
       }
       elseif (module_exists('php')) {
@@ -845,7 +854,8 @@ function block_block_list_alter(&$blocks) {
  * Render the content and subject for a set of blocks.
  *
  * @param $region_blocks
- *   An array of block objects such as returned for one region by _block_load_blocks().
+ *   An array of block objects such as returned for one region by
+ *   _block_load_blocks().
  *
  * @return
  *   An array of visible blocks as expected by drupal_render().
@@ -953,6 +963,8 @@ function _block_render_blocks($region_blocks) {
  * Theme and language contexts are automatically differentiated.
  *
  * @param $block
+ *   The block to get the cache_id from.
+ *
  * @return
  *   The string used as cache_id for the block.
  */
diff --git a/modules/dblog/dblog.module b/modules/dblog/dblog.module
index 9183eed69aeb9dbf7be1aa73e5b32d23f31ed81f..eb79faffcd27af25effe1474ac4a6125e7da5955 100644
--- a/modules/dblog/dblog.module
+++ b/modules/dblog/dblog.module
@@ -144,17 +144,20 @@ function _dblog_get_message_types() {
  * Note: Some values may be truncated to meet database column size restrictions.
  */
 function dblog_watchdog(array $log_entry) {
+  if (!function_exists('drupal_substr')) {
+    require_once DRUPAL_ROOT . '/includes/unicode.inc';
+  }
   Database::getConnection('default', 'default')->insert('watchdog')
     ->fields(array(
       'uid' => $log_entry['uid'],
-      'type' => substr($log_entry['type'], 0, 64),
+      'type' => drupal_substr($log_entry['type'], 0, 64),
       'message' => $log_entry['message'],
       'variables' => serialize($log_entry['variables']),
       'severity' => $log_entry['severity'],
-      'link' => substr($log_entry['link'], 0, 255),
+      'link' => drupal_substr($log_entry['link'], 0, 255),
       'location' => $log_entry['request_uri'],
       'referer' => $log_entry['referer'],
-      'hostname' => substr($log_entry['ip'], 0, 128),
+      'hostname' => drupal_substr($log_entry['ip'], 0, 128),
       'timestamp' => $log_entry['timestamp'],
     ))
     ->execute();
diff --git a/modules/dblog/dblog.test b/modules/dblog/dblog.test
index bf409c9465e9b62e113c8b860a97c5ed82c8f16e..03308aff7b0afd4eb2a4f04b25c70ccd7c508bee 100644
--- a/modules/dblog/dblog.test
+++ b/modules/dblog/dblog.test
@@ -119,13 +119,16 @@ class DBLogTestCase extends DrupalWebTestCase {
   private function generateLogEntries($count, $type = 'custom', $severity = WATCHDOG_NOTICE) {
     global $base_root;
 
+    // Make it just a little bit harder to pass the link part of the test.
+    $link = urldecode('/content/xo%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A%E9%85%B1%E5%87%89%E6%8B%8C%E7%B4%A0%E9%B8%A1%E7%85%A7%E7%83%A7%E9%B8%A1%E9%BB%84%E7%8E%AB%E7%91%B0-%E7%A7%91%E5%B7%9E%E7%9A%84%E5%B0%8F%E4%B9%9D%E5%AF%A8%E6%B2%9F%E7%BB%9D%E7%BE%8E%E9%AB%98%E5%B1%B1%E6%B9%96%E6%B3%8A-lake-isabelle');
+
     // Prepare the fields to be logged
     $log = array(
       'type'        => $type,
       'message'     => 'Log entry added to test the dblog row limit.',
       'variables'   => array(),
       'severity'    => $severity,
-      'link'        => NULL,
+      'link'        => $link,
       'user'        => $this->big_user,
       'uid'         => isset($this->big_user->uid) ? $this->big_user->uid : 0,
       'request_uri' => $base_root . request_uri(),
@@ -634,4 +637,3 @@ class DBLogTestCase extends DrupalWebTestCase {
     $this->assertLink(html_entity_decode($message_text), 0, $message);
   }
 }
-
diff --git a/modules/field/modules/options/options.module b/modules/field/modules/options/options.module
index 3862ba778748d852feabeaf0dac2953997845929..041b84a663fa16db6ffdcbeb6d97bd28d02c9029 100644
--- a/modules/field/modules/options/options.module
+++ b/modules/field/modules/options/options.module
@@ -185,6 +185,7 @@ function _options_properties($type, $multiple, $required, $has_value) {
   $base = array(
     'filter_xss' => FALSE,
     'strip_tags' => FALSE,
+    'strip_tags_and_unescape' => FALSE,
     'empty_option' => FALSE,
     'optgroups' => FALSE,
   );
@@ -195,7 +196,7 @@ function _options_properties($type, $multiple, $required, $has_value) {
     case 'select':
       $properties = array(
         // Select boxes do not support any HTML tag.
-        'strip_tags' => TRUE,
+        'strip_tags_and_unescape' => TRUE,
         'optgroups' => TRUE,
       );
       if ($multiple) {
@@ -271,9 +272,16 @@ function _options_prepare_options(&$options, $properties) {
       _options_prepare_options($options[$value], $properties);
     }
     else {
+      // The 'strip_tags' option is deprecated. Use 'strip_tags_and_unescape'
+      // when plain text is required (and where the output will be run through
+      // check_plain() before being inserted back into HTML) or 'filter_xss'
+      // when HTML is required.
       if ($properties['strip_tags']) {
         $options[$value] = strip_tags($label);
       }
+      if ($properties['strip_tags_and_unescape']) {
+        $options[$value] = decode_entities(strip_tags($label));
+      }
       if ($properties['filter_xss']) {
         $options[$value] = field_filter_xss($label);
       }
diff --git a/modules/field/modules/options/options.test b/modules/field/modules/options/options.test
index 7183311b2d3719b8f45cf301fc56726f08af5791..0e19f52ffab67f1ffa3ba7bc3b68db223df18769 100644
--- a/modules/field/modules/options/options.test
+++ b/modules/field/modules/options/options.test
@@ -24,7 +24,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
       'cardinality' => 1,
       'settings' => array(
         // Make sure that 0 works as an option.
-        'allowed_values' => array(0 => 'Zero', 1 => 'One', 2 => 'Some <script>dangerous</script> & unescaped <strong>markup</strong>'),
+        'allowed_values' => array(0 => 'Zero', 1 => 'One', 2 => 'Some <script>dangerous</script> & unescaped <strong>markup</strong>',  3 => 'Some HTML encoded markup with &lt; &amp; &gt;'),
       ),
     );
     $this->card_1 = field_create_field($this->card_1);
@@ -233,6 +233,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
     $this->assertNoOptionSelected("edit-card-1-$langcode", 1);
     $this->assertNoOptionSelected("edit-card-1-$langcode", 2);
     $this->assertRaw('Some dangerous &amp; unescaped markup', 'Option text was properly filtered.');
+    $this->assertRaw('Some HTML encoded markup with &lt; &amp; &gt;', 'HTML entities in option text were properly handled and not double-encoded');
 
     // Submit form: select invalid 'none' option.
     $edit = array("card_1[$langcode]" => '_none');
diff --git a/modules/field/modules/text/text.module b/modules/field/modules/text/text.module
index 68fc3cb44bc230da1960031e36ca2d7787e3d000..bf0d29d5a1ff65f37cb2319afa8a26d85fc49ee7 100644
--- a/modules/field/modules/text/text.module
+++ b/modules/field/modules/text/text.module
@@ -223,11 +223,13 @@ function text_field_formatter_settings_form($field, $instance, $view_mode, $form
 
   if (strpos($display['type'], '_trimmed') !== FALSE) {
     $element['trim_length'] = array(
-      '#title' => t('Trim length'),
+      '#title' => t('Trimmed limit'),
       '#type' => 'textfield',
+      '#field_suffix' => t('characters'),
       '#size' => 10,
       '#default_value' => $settings['trim_length'],
       '#element_validate' => array('element_validate_integer_positive'),
+      '#description' => t('If the summary is not set, the trimmed %label field will be shorter than this character limit.', array('%label' => $instance['label'])),
       '#required' => TRUE,
     );
   }
@@ -245,7 +247,7 @@ function text_field_formatter_settings_summary($field, $instance, $view_mode) {
   $summary = '';
 
   if (strpos($display['type'], '_trimmed') !== FALSE) {
-    $summary = t('Trim length') . ': ' . check_plain($settings['trim_length']);
+    $summary = t('Trimmed limit: @trim_length characters', array('@trim_length' => $settings['trim_length']));
   }
 
   return $summary;
diff --git a/modules/image/image.module b/modules/image/image.module
index a4ca5915899a1b5509188a77b7b79f3b8db8a1f4..17b61961f28b1f84081b1db26ee4822ba43522c9 100644
--- a/modules/image/image.module
+++ b/modules/image/image.module
@@ -840,8 +840,8 @@ function image_style_deliver($style, $scheme) {
       file_download($scheme, file_uri_target($derivative_uri));
     }
     else {
-      $headers = module_invoke_all('file_download', $image_uri);
-      if (in_array(-1, $headers) || empty($headers)) {
+      $headers = file_download_headers($image_uri);
+      if (empty($headers)) {
         return MENU_ACCESS_DENIED;
       }
       if (count($headers)) {
diff --git a/modules/image/image.test b/modules/image/image.test
index 87d803a532d11884755cd90d3a8d2571217fa09d..42f8d8bca9c639ae4bc9c7dcbc362a8df2473992 100644
--- a/modules/image/image.test
+++ b/modules/image/image.test
@@ -201,6 +201,22 @@ class ImageStylesPathAndUrlTestCase extends DrupalWebTestCase {
     $this->assertResponse(404, 'Accessing an image style URL with a source image that does not exist provides a 404 error response.');
   }
 
+  /**
+   * Test that we do not pass an array to drupal_add_http_header.
+   */
+  function testImageContentTypeHeaders() {
+    $files = $this->drupalGetTestFiles('image');
+    $file = array_shift($files);
+    // Copy the test file to private folder.
+    $private_file = file_copy($file, 'private://', FILE_EXISTS_RENAME);
+    // Tell image_module_test module to return the headers we want to test.
+    variable_set('image_module_test_invalid_headers', $private_file->uri);
+    // Invoke image_style_deliver so it will try to set headers.
+    $generated_url = image_style_url($this->style_name, $private_file->uri);
+    $this->drupalGet($generated_url);
+    variable_del('image_module_test_invalid_headers');
+  }
+
   /**
    * Test image_style_url().
    */
diff --git a/modules/image/tests/image_module_test.module b/modules/image/tests/image_module_test.module
index 8a322fb97de384574d6ae8bd5e2880dec5473c53..fc66d9b8b7c60314c2ef047f0aab052690d8fdd9 100644
--- a/modules/image/tests/image_module_test.module
+++ b/modules/image/tests/image_module_test.module
@@ -9,6 +9,9 @@ function image_module_test_file_download($uri) {
   if (variable_get('image_module_test_file_download', FALSE) == $uri) {
     return array('X-Image-Owned-By' => 'image_module_test');
   }
+  if (variable_get('image_module_test_invalid_headers', FALSE) == $uri) {
+    return array('Content-Type' => 'image/png');
+  }
 }
 
 /**
diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc
index 145be7ad9a6b36fb8640628162ccbafd4cc3616c..eead4ea988a33215d7816d5cfce7a9f6b56c0d5d 100644
--- a/modules/node/node.admin.inc
+++ b/modules/node/node.admin.inc
@@ -508,14 +508,17 @@ function node_admin_nodes() {
   $options = array();
   foreach ($nodes as $node) {
     $langcode = entity_language('node', $node);
-    $l_options = $langcode != LANGUAGE_NONE && isset($languages[$langcode]) ? array('language' => $languages[$langcode]) : array();
+    $uri = entity_uri('node', $node);
+    if ($langcode != LANGUAGE_NONE && isset($languages[$langcode])) {
+      $uri['options']['language'] = $languages[$langcode];
+    }
     $options[$node->nid] = array(
       'title' => array(
         'data' => array(
           '#type' => 'link',
           '#title' => $node->title,
-          '#href' => 'node/' . $node->nid,
-          '#options' => $l_options,
+          '#href' => $uri['path'],
+          '#options' => $uri['options'],
           '#suffix' => ' ' . theme('mark', array('type' => node_mark($node->nid, $node->changed))),
         ),
       ),
diff --git a/modules/node/node.module b/modules/node/node.module
index f892d1c2c99bca16107492f34cedd1884d496881..1d88834cd7c9c048d9241c31f3028b87502b3796 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -2953,7 +2953,10 @@ function node_search_validate($form, &$form_state) {
  * system. When adding a node listing to your module, be sure to use a dynamic
  * query created by db_select() and add a tag of "node_access". This will allow
  * modules dealing with node access to ensure only nodes to which the user has
- * access are retrieved, through the use of hook_query_TAG_alter().
+ * access are retrieved, through the use of hook_query_TAG_alter(). Tagging a
+ * query with "node_access" does not check the published/unpublished status of
+ * nodes, so the base query is responsible for ensuring that unpublished nodes
+ * are not displayed to inappropriate users.
  *
  * Note: Even a single module returning NODE_ACCESS_DENY from hook_node_access()
  * will block access to the node. Therefore, implementers should take care to
@@ -3685,7 +3688,7 @@ function _node_access_rebuild_batch_operation(&$context) {
     // Initiate multistep processing.
     $context['sandbox']['progress'] = 0;
     $context['sandbox']['current_node'] = 0;
-    $context['sandbox']['max'] = db_query('SELECT COUNT(DISTINCT nid) FROM {node}')->fetchField();
+    $context['sandbox']['max'] = db_query('SELECT COUNT(nid) FROM {node}')->fetchField();
   }
 
   // Process the next 20 nodes.
diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc
index cc3908e3cd9367c6f584a7abb4c8d40e8867989d..72b0ea7ce3358593a9b4fcf02d9a25e900710320 100644
--- a/modules/node/node.pages.inc
+++ b/modules/node/node.pages.inc
@@ -396,7 +396,6 @@ function node_preview($node) {
 
     $cloned_node->changed = REQUEST_TIME;
     $nodes = array($cloned_node->nid => $cloned_node);
-    field_attach_prepare_view('node', $nodes, 'full');
 
     // Display a preview of the node.
     if (!form_get_errors()) {
diff --git a/modules/node/node.test b/modules/node/node.test
index 5c9118ebbd46bea38a5a1485e7775d4368b52561..4ffc88e806ae19aa3076114364cd2568823f8c60 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -457,10 +457,70 @@ class PagePreviewTestCase extends DrupalWebTestCase {
   }
 
   function setUp() {
-    parent::setUp();
+    parent::setUp(array('taxonomy', 'node'));
 
     $web_user = $this->drupalCreateUser(array('edit own page content', 'create page content'));
     $this->drupalLogin($web_user);
+
+    // Add a vocabulary so we can test different view modes.
+    $vocabulary = (object) array(
+      'name' => $this->randomName(),
+      'description' => $this->randomName(),
+      'machine_name' => drupal_strtolower($this->randomName()),
+      'help' => '',
+      'nodes' => array('page' => 'page'),
+    );
+    taxonomy_vocabulary_save($vocabulary);
+
+    $this->vocabulary = $vocabulary;
+
+    // Add a term to the vocabulary.
+    $term = (object) array(
+      'name' => $this->randomName(),
+      'description' => $this->randomName(),
+      // Use the first available text format.
+      'format' => db_query_range('SELECT format FROM {filter_format}', 0, 1)->fetchField(),
+      'vid' => $this->vocabulary->vid,
+      'vocabulary_machine_name' => $vocabulary->machine_name,
+    );
+    taxonomy_term_save($term);
+
+    $this->term = $term;
+
+    // Set up a field and instance.
+    $this->field_name = drupal_strtolower($this->randomName());
+    $this->field = array(
+      'field_name' => $this->field_name,
+      'type' => 'taxonomy_term_reference',
+      'settings' => array(
+        'allowed_values' => array(
+          array(
+            'vocabulary' => $this->vocabulary->machine_name,
+            'parent' => '0',
+          ),
+        ),
+      )
+    );
+
+    field_create_field($this->field);
+    $this->instance = array(
+      'field_name' => $this->field_name,
+      'entity_type' => 'node',
+      'bundle' => 'page',
+      'widget' => array(
+        'type' => 'options_select',
+      ),
+      // Hide on full display but render on teaser.
+      'display' => array(
+        'default' => array(
+          'type' => 'hidden',
+        ),
+        'teaser' => array(
+          'type' => 'taxonomy_term_reference_link',
+        ),
+      ),
+    );
+    field_create_instance($this->instance);
   }
 
   /**
@@ -470,21 +530,26 @@ class PagePreviewTestCase extends DrupalWebTestCase {
     $langcode = LANGUAGE_NONE;
     $title_key = "title";
     $body_key = "body[$langcode][0][value]";
+    $term_key = "{$this->field_name}[$langcode]";
 
     // Fill in node creation form and preview node.
     $edit = array();
     $edit[$title_key] = $this->randomName(8);
     $edit[$body_key] = $this->randomName(16);
+    $edit[$term_key] = $this->term->tid;
     $this->drupalPost('node/add/page', $edit, t('Preview'));
 
-    // Check that the preview is displaying the title and body.
+    // Check that the preview is displaying the title, body, and term.
     $this->assertTitle(t('Preview | Drupal'), 'Basic page title is preview.');
     $this->assertText($edit[$title_key], 'Title displayed.');
     $this->assertText($edit[$body_key], 'Body displayed.');
+    $this->assertText($this->term->name, 'Term displayed.');
 
-    // Check that the title and body fields are displayed with the correct values.
+    // Check that the title, body, and term fields are displayed with the
+    // correct values.
     $this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
     $this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
+    $this->assertFieldByName($term_key, $edit[$term_key], 'Term field displayed.');
   }
 
   /**
@@ -494,6 +559,7 @@ class PagePreviewTestCase extends DrupalWebTestCase {
     $langcode = LANGUAGE_NONE;
     $title_key = "title";
     $body_key = "body[$langcode][0][value]";
+    $term_key = "{$this->field_name}[$langcode]";
     // Force revision on "Basic page" content.
     variable_set('node_options_page', array('status', 'revision'));
 
@@ -501,17 +567,21 @@ class PagePreviewTestCase extends DrupalWebTestCase {
     $edit = array();
     $edit[$title_key] = $this->randomName(8);
     $edit[$body_key] = $this->randomName(16);
+    $edit[$term_key] = $this->term->tid;
     $edit['log'] = $this->randomName(32);
     $this->drupalPost('node/add/page', $edit, t('Preview'));
 
-    // Check that the preview is displaying the title and body.
+    // Check that the preview is displaying the title, body, and term.
     $this->assertTitle(t('Preview | Drupal'), 'Basic page title is preview.');
     $this->assertText($edit[$title_key], 'Title displayed.');
     $this->assertText($edit[$body_key], 'Body displayed.');
+    $this->assertText($this->term->name, 'Term displayed.');
 
-    // Check that the title and body fields are displayed with the correct values.
+    // Check that the title, body, and term fields are displayed with the
+    // correct values.
     $this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
     $this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
+    $this->assertFieldByName($term_key, $edit[$term_key], 'Term field displayed.');
 
     // Check that the log field has the correct value.
     $this->assertFieldByName('log', $edit['log'], 'Log field displayed.');
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index bfc72bf93bf8940d43f547bb974450524e990b40..336e44563d7a38fe30fb5a969a5a70a2a7bd69c5 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -631,9 +631,6 @@ function poll_delete($node) {
  *   The node object to load.
  */
 function poll_block_latest_poll_view($node) {
-  global $user;
-  $output = '';
-
   // This is necessary for shared objects because PHP doesn't copy objects, but
   // passes them by reference.  So when the objects are cached it can result in
   // the wrong output being displayed on subsequent calls.  The cloning and
@@ -674,9 +671,6 @@ function poll_block_latest_poll_view($node) {
  * Implements hook_view().
  */
 function poll_view($node, $view_mode) {
-  global $user;
-  $output = '';
-
   if (!empty($node->allowvotes) && empty($node->show_results)) {
     $node->content['poll_view_voting'] = drupal_get_form('poll_view_voting', $node);
   }
@@ -694,7 +688,7 @@ function poll_view($node, $view_mode) {
 function poll_teaser($node) {
   $teaser = NULL;
   if (is_array($node->choice)) {
-    foreach ($node->choice as $k => $choice) {
+    foreach ($node->choice as $choice) {
       if ($choice['chtext'] != '') {
         $teaser .= '* ' . check_plain($choice['chtext']) . "\n";
       }
diff --git a/modules/profile/profile.test b/modules/profile/profile.test
index 6cb07391e5ad607d5556387c6393546c1b1aa19a..189247143b825d779fbb6a74e6b075d3c7795330 100644
--- a/modules/profile/profile.test
+++ b/modules/profile/profile.test
@@ -342,7 +342,7 @@ class ProfileTestAutocomplete extends ProfileTestCase {
     // Autocomplete always uses non-clean URLs.
     $current_clean_url = isset($GLOBALS['conf']['clean_url']) ? $GLOBALS['conf']['clean_url'] : NULL;
     $GLOBALS['conf']['clean_url'] = 0;
-    $autocomplete_url = url('profile/autocomplete/' . $field['fid'], array('absolute' => TRUE));
+    $autocomplete_url = url('profile/autocomplete/' . $field['fid'], array('absolute' => TRUE, 'script' => 'index.php'));
     $GLOBALS['conf']['clean_url'] = $current_clean_url;
     $autocomplete_id = drupal_html_id('edit-' . $field['form_name'] . '-autocomplete');
     $autocomplete_html = '<input type="hidden" id="' . $autocomplete_id . '" value="' . $autocomplete_url . '" disabled="disabled" class="autocomplete" />';
diff --git a/modules/search/search.pages.inc b/modules/search/search.pages.inc
index 9dd00a6de7e35749c479c189761370c68d988dd4..2123dd75a9e5d5177c77d4870b880373609e689f 100644
--- a/modules/search/search.pages.inc
+++ b/modules/search/search.pages.inc
@@ -49,7 +49,7 @@ function search_view($module = NULL, $keys = '') {
   // which will get us back to this page callback. In other words, the search
   // form submits with POST but redirects to GET. This way we can keep
   // the search query URL clean as a whistle.
-  if (empty($_POST['form_id']) || $_POST['form_id'] != 'search_form') {
+  if (empty($_POST['form_id']) || ($_POST['form_id'] != 'search_form' && $_POST['form_id'] != 'search_block_form')) {
     $conditions =  NULL;
     if (isset($info['conditions_callback']) && function_exists($info['conditions_callback'])) {
       // Build an optional array of more search conditions.
diff --git a/modules/search/search.test b/modules/search/search.test
index 5ee5870d4fc9f2dbb39a96e3f90d42f3c6894052..913d198911de5d22145070d08f68dbdd0e1dc04d 100644
--- a/modules/search/search.test
+++ b/modules/search/search.test
@@ -666,6 +666,24 @@ class SearchBlockTestCase extends DrupalWebTestCase {
       url('search/node/', array('absolute' => TRUE)),
       'Redirected to correct url.'
     );
+
+    // Test that after entering a too-short keyword in the form, you can then
+    // search again with a longer keyword. First test using the block form.
+    $terms = array('search_block_form' => 'a');
+    $this->drupalPost('node', $terms, t('Search'));
+    $this->assertText('You must include at least one positive keyword with 3 characters or more');
+    $terms = array('search_block_form' => 'foo');
+    $this->drupalPost(NULL, $terms, t('Search'));
+    $this->assertNoText('You must include at least one positive keyword with 3 characters or more');
+    $this->assertText('Your search yielded no results');
+
+    // Same test again, using the search page form for the second search this time.
+    $terms = array('search_block_form' => 'a');
+    $this->drupalPost('node', $terms, t('Search'));
+    $terms = array('keys' => 'foo');
+    $this->drupalPost(NULL, $terms, t('Search'));
+    $this->assertNoText('You must include at least one positive keyword with 3 characters or more');
+    $this->assertText('Your search yielded no results');
   }
 }
 
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index bf1e9c31c77415a5b36ac8eee426195d09141257..aed66fa2a239b1141b53ad3db34b2f0b06144a2b 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -2584,6 +2584,11 @@ class DrupalWebTestCase extends DrupalTestCase {
    *
    * @param $xpath
    *   The xpath string to use in the search.
+   * @param array $arguments
+   *   An array of arguments with keys in the form ':name' matching the
+   *   placeholders in the query. The values may be either strings or numeric
+   *   values.
+   *
    * @return
    *   The return value of the xpath search. For details on the xpath string
    *   format and return values see the SimpleXML documentation,
diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test
index d46c6ec8fcb27ace458ce2dc82ee92b0b0a2f191..3d038ac95f13d03d5bd05feb2594e9664739d6ae 100644
--- a/modules/simpletest/tests/bootstrap.test
+++ b/modules/simpletest/tests/bootstrap.test
@@ -152,7 +152,7 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
     $this->drupalLogin($user);
     $this->drupalGet('', array(), array('If-Modified-Since: ' . $last_modified, 'If-None-Match: ' . $etag));
     $this->assertResponse(200, 'Conditional request returned 200 OK for authenticated user.');
-    $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), 'Absense of Page was not cached.');
+    $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), 'Absence of Page was not cached.');
     $this->assertFalse($this->drupalGetHeader('ETag'), 'ETag HTTP headers are not present for logged in users.');
     $this->assertFalse($this->drupalGetHeader('Last-Modified'), 'Last-Modified HTTP headers are not present for logged in users.');
   }
diff --git a/modules/simpletest/tests/mail.test b/modules/simpletest/tests/mail.test
index 70a43cb45a98c04eb96c769d4f2126d26b667895..3e40e13a89f6ffc3307eb10e375685ada70a56fa 100644
--- a/modules/simpletest/tests/mail.test
+++ b/modules/simpletest/tests/mail.test
@@ -441,7 +441,7 @@ class DrupalHtmlToTextTestCase extends DrupalWebTestCase {
    * <CRLF> is 1000 characters."
    */
   function testVeryLongLineWrap() {
-    $input = 'Drupal<br /><p>' . str_repeat('x', 2100) . '</><br />Drupal';
+    $input = 'Drupal<br /><p>' . str_repeat('x', 2100) . '</p><br />Drupal';
     $output = drupal_html_to_text($input);
     // This awkward construct comes from includes/mail.inc lines 8-13.
     $eol = variable_get('mail_line_endings', MAIL_LINE_ENDINGS);
@@ -455,7 +455,6 @@ class DrupalHtmlToTextTestCase extends DrupalWebTestCase {
       $maximum_line_length = max($maximum_line_length, strlen($line . $eol));
     }
     $verbose = 'Maximum line length found was ' . $maximum_line_length . ' octets.';
-    // @todo This should assert that $maximum_line_length <= 1000.
-    $this->pass($verbose);
+    $this->assertTrue($maximum_line_length <= 1000, $verbose);
   }
 }
diff --git a/modules/system/system.module b/modules/system/system.module
index 39de758edbac4b62c318bb7c7882dee659ad00e4..362bdd445e6389722b064283e2b51c75d9fd1eee 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -3056,8 +3056,20 @@ function system_cron() {
     }
   }
 
-  $core = array('cache', 'cache_path', 'cache_filter', 'cache_page', 'cache_form', 'cache_menu');
-  $cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
+  // Delete expired cache entries.
+  // Avoid invoking hook_flush_cashes() on every cron run because some modules
+  // use this hook to perform expensive rebuilding operations (which are only
+  // designed to happen on full cache clears), rather than just returning a
+  // list of cache tables to be cleared.
+  $cache_object = cache_get('system_cache_tables');
+  if (empty($cache_object)) {
+    $core = array('cache', 'cache_path', 'cache_filter', 'cache_page', 'cache_form', 'cache_menu');
+    $cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
+    cache_set('system_cache_tables', $cache_tables);
+  }
+  else {
+    $cache_tables = $cache_object->data;
+  }
   foreach ($cache_tables as $table) {
     cache_clear_all(NULL, $table);
   }
diff --git a/modules/system/system.tar.inc b/modules/system/system.tar.inc
index 32bf7f066e5cc9173ac34ab88e42d3e384539cee..86e4e3de4a775112847efd0f3b4f243c2e820a0e 100644
--- a/modules/system/system.tar.inc
+++ b/modules/system/system.tar.inc
@@ -30,81 +30,148 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- *
- * @category    File_Formats
- * @package     Archive_Tar
- * @author      Vincent Blavet <vincent@phpconcept.net>
- * @copyright   1997-2008 The Authors
- * @license     http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version     CVS: Id: Tar.php,v 1.43 2008/10/30 17:58:42 dufuz Exp
- * @link        http://pear.php.net/package/Archive_Tar
+ * @category  File_Formats
+ * @package   Archive_Tar
+ * @author    Vincent Blavet <vincent@phpconcept.net>
+ * @copyright 1997-2010 The Authors
+ * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @version   CVS: $Id$
+ * @link      http://pear.php.net/package/Archive_Tar
+ */
+
+ /**
+ * Note on Drupal 8 porting.
+ * This file origin is Tar.php, release 1.4.0 (stable) with some code
+ * from PEAR.php, release 1.9.5 (stable) both at http://pear.php.net.
+ * To simplify future porting from pear of this file, you should not
+ * do cosmetic or other non significant changes to this file.
+ * The following changes have been done:
+ *  Added namespace Drupal\Core\Archiver.
+ *  Removed require_once 'PEAR.php'.
+ *  Added defintion of OS_WINDOWS taken from PEAR.php.
+ *  Renamed class to ArchiveTar.
+ *  Removed extends PEAR from class.
+ *  Removed call parent:: __construct().
+ *  Changed PEAR::loadExtension($extname) to this->loadExtension($extname).
+ *  Added function loadExtension() taken from PEAR.php.
+ *  Changed all calls of unlink() to drupal_unlink().
+ *  Changed $this->error_object = &$this->raiseError($p_message)
+ *  to throw new \Exception($p_message).
+ */
+
+ /**
+ * Note on Drupal 7 backporting from Drupal 8.
+ * File origin is core/lib/Drupal/Core/Archiver/ArchiveTar.php from Drupal 8.
+ * The following changes have been done:
+ *  Removed namespace Drupal\Core\Archiver.
+ *  Renamed class to Archive_Tar.
+ *  Changed \Exception to Exception.
  */
 
-//require_once 'PEAR.php';
-//
-//
-define ('ARCHIVE_TAR_ATT_SEPARATOR', 90001);
-define ('ARCHIVE_TAR_END_BLOCK', pack("a512", ''));
+
+// Drupal removal require_once 'PEAR.php'.
+
+// Drupal addition OS_WINDOWS as defined in PEAR.php.
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+    define('OS_WINDOWS', true);
+} else {
+    define('OS_WINDOWS', false);
+}
+
+define('ARCHIVE_TAR_ATT_SEPARATOR', 90001);
+define('ARCHIVE_TAR_END_BLOCK', pack("a512", ''));
+
+if (!function_exists('gzopen') && function_exists('gzopen64')) {
+    function gzopen($filename, $mode, $use_include_path = 0)
+    {
+        return gzopen64($filename, $mode, $use_include_path);
+    }
+}
+
+if (!function_exists('gztell') && function_exists('gztell64')) {
+    function gztell($zp)
+    {
+        return gztell64($zp);
+    }
+}
+
+if (!function_exists('gzseek') && function_exists('gzseek64')) {
+    function gzseek($zp, $offset, $whence = SEEK_SET)
+    {
+        return gzseek64($zp, $offset, $whence);
+    }
+}
 
 /**
-* Creates a (compressed) Tar archive
-*
-* @author   Vincent Blavet <vincent@phpconcept.net>
-* @version  Revision: 1.43
-* @license  http://www.opensource.org/licenses/bsd-license.php New BSD License
-* @package  Archive_Tar
-*/
-class Archive_Tar // extends PEAR
+ * Creates a (compressed) Tar archive
+ *
+ * @package Archive_Tar
+ * @author  Vincent Blavet <vincent@phpconcept.net>
+ * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @version $Revision$
+ */
+// Drupal change class Archive_Tar extends PEAR.
+class Archive_Tar
 {
     /**
-    * @var string Name of the Tar
-    */
-    var $_tarname='';
+     * @var string Name of the Tar
+     */
+    public $_tarname = '';
 
     /**
-    * @var boolean if true, the Tar file will be gzipped
-    */
-    var $_compress=false;
+     * @var boolean if true, the Tar file will be gzipped
+     */
+    public $_compress = false;
 
     /**
-    * @var string Type of compression : 'none', 'gz' or 'bz2'
-    */
-    var $_compress_type='none';
+     * @var string Type of compression : 'none', 'gz', 'bz2' or 'lzma2'
+     */
+    public $_compress_type = 'none';
 
     /**
-    * @var string Explode separator
-    */
-    var $_separator=' ';
+     * @var string Explode separator
+     */
+    public $_separator = ' ';
 
     /**
-    * @var file descriptor
-    */
-    var $_file=0;
+     * @var file descriptor
+     */
+    public $_file = 0;
 
     /**
-    * @var string Local Tar name of a remote Tar (http:// or ftp://)
-    */
-    var $_temp_tarname='';
+     * @var string Local Tar name of a remote Tar (http:// or ftp://)
+     */
+    public $_temp_tarname = '';
 
-    // {{{ constructor
     /**
-    * Archive_Tar Class constructor. This flavour of the constructor only
-    * declare a new Archive_Tar object, identifying it by the name of the
-    * tar file.
-    * If the compress argument is set the tar will be read or created as a
-    * gzip or bz2 compressed TAR file.
-    *
-    * @param    string  $p_tarname  The name of the tar archive to create
-    * @param    string  $p_compress can be null, 'gz' or 'bz2'. This
-    *                   parameter indicates if gzip or bz2 compression
-    *                   is required.  For compatibility reason the
-    *                   boolean value 'true' means 'gz'.
-    * @access public
-    */
-//    function Archive_Tar($p_tarname, $p_compress = null)
-    function __construct($p_tarname, $p_compress = null)
+     * @var string regular expression for ignoring files or directories
+     */
+    public $_ignore_regexp = '';
+
+    /**
+     * @var object PEAR_Error object
+     */
+    public $error_object = null;
+
+    /**
+     * Archive_Tar Class constructor. This flavour of the constructor only
+     * declare a new Archive_Tar object, identifying it by the name of the
+     * tar file.
+     * If the compress argument is set the tar will be read or created as a
+     * gzip or bz2 compressed TAR file.
+     *
+     * @param string $p_tarname The name of the tar archive to create
+     * @param string $p_compress can be null, 'gz', 'bz2' or 'lzma2'. This
+     *               parameter indicates if gzip, bz2 or lzma2 compression
+     *               is required.  For compatibility reason the
+     *               boolean value 'true' means 'gz'.
+     *
+     * @return bool
+     */
+    public function __construct($p_tarname, $p_compress = null)
     {
-//        $this->PEAR();
+        // Drupal removal parent::__construct().
+
         $this->_compress = false;
         $this->_compress_type = 'none';
         if (($p_compress === null) || ($p_compress == '')) {
@@ -116,10 +183,13 @@ class Archive_Tar // extends PEAR
                     if ($data == "\37\213") {
                         $this->_compress = true;
                         $this->_compress_type = 'gz';
-                    // No sure it's enought for a magic code ....
+                        // No sure it's enought for a magic code ....
                     } elseif ($data == "BZ") {
                         $this->_compress = true;
                         $this->_compress_type = 'bz2';
+                    } elseif (file_get_contents($p_tarname, false, null, 1, 4) == '7zXZ') {
+                        $this->_compress = true;
+                        $this->_compress_type = 'lzma2';
                     }
                 }
             } else {
@@ -129,151 +199,177 @@ class Archive_Tar // extends PEAR
                     $this->_compress = true;
                     $this->_compress_type = 'gz';
                 } elseif ((substr($p_tarname, -3) == 'bz2') ||
-                          (substr($p_tarname, -2) == 'bz')) {
+                    (substr($p_tarname, -2) == 'bz')
+                ) {
                     $this->_compress = true;
                     $this->_compress_type = 'bz2';
+                } else {
+                    if (substr($p_tarname, -2) == 'xz') {
+                        $this->_compress = true;
+                        $this->_compress_type = 'lzma2';
+                    }
                 }
             }
         } else {
             if (($p_compress === true) || ($p_compress == 'gz')) {
                 $this->_compress = true;
                 $this->_compress_type = 'gz';
-            } else if ($p_compress == 'bz2') {
-                $this->_compress = true;
-                $this->_compress_type = 'bz2';
             } else {
-                die("Unsupported compression type '$p_compress'\n".
-                    "Supported types are 'gz' and 'bz2'.\n");
-                return false;
+                if ($p_compress == 'bz2') {
+                    $this->_compress = true;
+                    $this->_compress_type = 'bz2';
+                } else {
+                    if ($p_compress == 'lzma2') {
+                        $this->_compress = true;
+                        $this->_compress_type = 'lzma2';
+                    } else {
+                        $this->_error(
+                            "Unsupported compression type '$p_compress'\n" .
+                            "Supported types are 'gz', 'bz2' and 'lzma2'.\n"
+                        );
+                        return false;
+                    }
+                }
             }
         }
         $this->_tarname = $p_tarname;
-        if ($this->_compress) { // assert zlib or bz2 extension support
-            if ($this->_compress_type == 'gz')
+        if ($this->_compress) { // assert zlib or bz2 or xz extension support
+            if ($this->_compress_type == 'gz') {
                 $extname = 'zlib';
-            else if ($this->_compress_type == 'bz2')
-                $extname = 'bz2';
+            } else {
+                if ($this->_compress_type == 'bz2') {
+                    $extname = 'bz2';
+                } else {
+                    if ($this->_compress_type == 'lzma2') {
+                        $extname = 'xz';
+                    }
+                }
+            }
 
             if (!extension_loaded($extname)) {
-//                PEAR::loadExtension($extname);
+                // Drupal change PEAR::loadExtension($extname).
                 $this->loadExtension($extname);
             }
             if (!extension_loaded($extname)) {
-                die("The extension '$extname' couldn't be found.\n".
-                    "Please make sure your version of PHP was built ".
-                    "with '$extname' support.\n");
+                $this->_error(
+                    "The extension '$extname' couldn't be found.\n" .
+                    "Please make sure your version of PHP was built " .
+                    "with '$extname' support.\n"
+                );
                 return false;
             }
         }
     }
-    // }}}
 
+    public function __destruct()
+    {
+        $this->_close();
+        // ----- Look for a local copy to delete
+        if ($this->_temp_tarname != '') {
+            @drupal_unlink($this->_temp_tarname);
+        }
+    }
+
+    // Drupal addition from PEAR.php.
     /**
     * OS independent PHP extension load. Remember to take care
     * on the correct extension name for case sensitive OSes.
-    * The function is the copy of PEAR::loadExtension().
     *
     * @param string $ext The extension name
     * @return bool Success or not on the dl() call
     */
     function loadExtension($ext)
     {
-        if (!extension_loaded($ext)) {
-            // if either returns true dl() will produce a FATAL error, stop that
-            if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) {
-                return false;
-            }
+        if (extension_loaded($ext)) {
+            return true;
+        }
 
-            if (OS_WINDOWS) {
-                $suffix = '.dll';
-            } elseif (PHP_OS == 'HP-UX') {
-                $suffix = '.sl';
-            } elseif (PHP_OS == 'AIX') {
-                $suffix = '.a';
-            } elseif (PHP_OS == 'OSX') {
-                $suffix = '.bundle';
-            } else {
-                $suffix = '.so';
-            }
+        // if either returns true dl() will produce a FATAL error, stop that
+        if (
+            function_exists('dl') === false ||
+            ini_get('enable_dl') != 1 ||
+            ini_get('safe_mode') == 1
+        ) {
+            return false;
+        }
 
-            return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
+        if (OS_WINDOWS) {
+            $suffix = '.dll';
+        } elseif (PHP_OS == 'HP-UX') {
+            $suffix = '.sl';
+        } elseif (PHP_OS == 'AIX') {
+            $suffix = '.a';
+        } elseif (PHP_OS == 'OSX') {
+            $suffix = '.bundle';
+        } else {
+            $suffix = '.so';
         }
 
-        return true;
+        return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
     }
 
 
-    // {{{ destructor
-//    function _Archive_Tar()
-    function __destruct()
-    {
-        $this->_close();
-        // ----- Look for a local copy to delete
-        if ($this->_temp_tarname != '')
-            @drupal_unlink($this->_temp_tarname);
-//        $this->_PEAR();
-    }
-    // }}}
-
-    // {{{ create()
     /**
-    * This method creates the archive file and add the files / directories
-    * that are listed in $p_filelist.
-    * If a file with the same name exist and is writable, it is replaced
-    * by the new tar.
-    * The method return false and a PEAR error text.
-    * The $p_filelist parameter can be an array of string, each string
-    * representing a filename or a directory name with their path if
-    * needed. It can also be a single string with names separated by a
-    * single blank.
-    * For each directory added in the archive, the files and
-    * sub-directories are also added.
-    * See also createModify() method for more details.
-    *
-    * @param array  $p_filelist An array of filenames and directory names, or a
-	*                           single string with names separated by a single
-	*                           blank space.
-    * @return                   true on success, false on error.
-    * @see createModify()
-    * @access public
-    */
-    function create($p_filelist)
+     * This method creates the archive file and add the files / directories
+     * that are listed in $p_filelist.
+     * If a file with the same name exist and is writable, it is replaced
+     * by the new tar.
+     * The method return false and a PEAR error text.
+     * The $p_filelist parameter can be an array of string, each string
+     * representing a filename or a directory name with their path if
+     * needed. It can also be a single string with names separated by a
+     * single blank.
+     * For each directory added in the archive, the files and
+     * sub-directories are also added.
+     * See also createModify() method for more details.
+     *
+     * @param array $p_filelist An array of filenames and directory names, or a
+     *              single string with names separated by a single
+     *              blank space.
+     *
+     * @return true on success, false on error.
+     * @see    createModify()
+     */
+    public function create($p_filelist)
     {
         return $this->createModify($p_filelist, '', '');
     }
-    // }}}
 
-    // {{{ add()
     /**
-    * This method add the files / directories that are listed in $p_filelist in
-    * the archive. If the archive does not exist it is created.
-    * The method return false and a PEAR error text.
-    * The files and directories listed are only added at the end of the archive,
-    * even if a file with the same name is already archived.
-    * See also createModify() method for more details.
-    *
-    * @param array  $p_filelist An array of filenames and directory names, or a
-	*                           single string with names separated by a single
-	*                           blank space.
-    * @return                   true on success, false on error.
-    * @see createModify()
-    * @access public
-    */
-    function add($p_filelist)
+     * This method add the files / directories that are listed in $p_filelist in
+     * the archive. If the archive does not exist it is created.
+     * The method return false and a PEAR error text.
+     * The files and directories listed are only added at the end of the archive,
+     * even if a file with the same name is already archived.
+     * See also createModify() method for more details.
+     *
+     * @param array $p_filelist An array of filenames and directory names, or a
+     *              single string with names separated by a single
+     *              blank space.
+     *
+     * @return true on success, false on error.
+     * @see    createModify()
+     * @access public
+     */
+    public function add($p_filelist)
     {
         return $this->addModify($p_filelist, '', '');
     }
-    // }}}
 
-    // {{{ extract()
-    function extract($p_path='')
+    /**
+     * @param string $p_path
+     * @param bool $p_preserve
+     * @return bool
+     */
+    public function extract($p_path = '', $p_preserve = false)
     {
-        return $this->extractModify($p_path, '');
+        return $this->extractModify($p_path, '', $p_preserve);
     }
-    // }}}
 
-    // {{{ listContent()
-    function listContent()
+    /**
+     * @return array|int
+     */
+    public function listContent()
     {
         $v_list_detail = array();
 
@@ -287,57 +383,56 @@ class Archive_Tar // extends PEAR
 
         return $v_list_detail;
     }
-    // }}}
 
-    // {{{ createModify()
     /**
-    * This method creates the archive file and add the files / directories
-    * that are listed in $p_filelist.
-    * If the file already exists and is writable, it is replaced by the
-    * new tar. It is a create and not an add. If the file exists and is
-    * read-only or is a directory it is not replaced. The method return
-    * false and a PEAR error text.
-    * The $p_filelist parameter can be an array of string, each string
-    * representing a filename or a directory name with their path if
-    * needed. It can also be a single string with names separated by a
-    * single blank.
-    * The path indicated in $p_remove_dir will be removed from the
-    * memorized path of each file / directory listed when this path
-    * exists. By default nothing is removed (empty path '')
-    * The path indicated in $p_add_dir will be added at the beginning of
-    * the memorized path of each file / directory listed. However it can
-    * be set to empty ''. The adding of a path is done after the removing
-    * of path.
-    * The path add/remove ability enables the user to prepare an archive
-    * for extraction in a different path than the origin files are.
-    * See also addModify() method for file adding properties.
-    *
-    * @param array  $p_filelist     An array of filenames and directory names,
-	*                               or a single string with names separated by
-	*                               a single blank space.
-    * @param string $p_add_dir      A string which contains a path to be added
-	*                               to the memorized path of each element in
-	*                               the list.
-    * @param string $p_remove_dir   A string which contains a path to be
-	*                               removed from the memorized path of each
-	*                               element in the list, when relevant.
-    * @return boolean               true on success, false on error.
-    * @access public
-    * @see addModify()
-    */
-    function createModify($p_filelist, $p_add_dir, $p_remove_dir='')
+     * This method creates the archive file and add the files / directories
+     * that are listed in $p_filelist.
+     * If the file already exists and is writable, it is replaced by the
+     * new tar. It is a create and not an add. If the file exists and is
+     * read-only or is a directory it is not replaced. The method return
+     * false and a PEAR error text.
+     * The $p_filelist parameter can be an array of string, each string
+     * representing a filename or a directory name with their path if
+     * needed. It can also be a single string with names separated by a
+     * single blank.
+     * The path indicated in $p_remove_dir will be removed from the
+     * memorized path of each file / directory listed when this path
+     * exists. By default nothing is removed (empty path '')
+     * The path indicated in $p_add_dir will be added at the beginning of
+     * the memorized path of each file / directory listed. However it can
+     * be set to empty ''. The adding of a path is done after the removing
+     * of path.
+     * The path add/remove ability enables the user to prepare an archive
+     * for extraction in a different path than the origin files are.
+     * See also addModify() method for file adding properties.
+     *
+     * @param array $p_filelist An array of filenames and directory names,
+     *                             or a single string with names separated by
+     *                             a single blank space.
+     * @param string $p_add_dir A string which contains a path to be added
+     *                             to the memorized path of each element in
+     *                             the list.
+     * @param string $p_remove_dir A string which contains a path to be
+     *                             removed from the memorized path of each
+     *                             element in the list, when relevant.
+     *
+     * @return boolean true on success, false on error.
+     * @see addModify()
+     */
+    public function createModify($p_filelist, $p_add_dir, $p_remove_dir = '')
     {
         $v_result = true;
 
-        if (!$this->_openWrite())
+        if (!$this->_openWrite()) {
             return false;
+        }
 
         if ($p_filelist != '') {
-            if (is_array($p_filelist))
+            if (is_array($p_filelist)) {
                 $v_list = $p_filelist;
-            elseif (is_string($p_filelist))
+            } elseif (is_string($p_filelist)) {
                 $v_list = explode($this->_separator, $p_filelist);
-            else {
+            } else {
                 $this->_cleanFile();
                 $this->_error('Invalid file list');
                 return false;
@@ -349,67 +444,69 @@ class Archive_Tar // extends PEAR
         if ($v_result) {
             $this->_writeFooter();
             $this->_close();
-        } else
+        } else {
             $this->_cleanFile();
+        }
 
         return $v_result;
     }
-    // }}}
 
-    // {{{ addModify()
     /**
-    * This method add the files / directories listed in $p_filelist at the
-    * end of the existing archive. If the archive does not yet exists it
-    * is created.
-    * The $p_filelist parameter can be an array of string, each string
-    * representing a filename or a directory name with their path if
-    * needed. It can also be a single string with names separated by a
-    * single blank.
-    * The path indicated in $p_remove_dir will be removed from the
-    * memorized path of each file / directory listed when this path
-    * exists. By default nothing is removed (empty path '')
-    * The path indicated in $p_add_dir will be added at the beginning of
-    * the memorized path of each file / directory listed. However it can
-    * be set to empty ''. The adding of a path is done after the removing
-    * of path.
-    * The path add/remove ability enables the user to prepare an archive
-    * for extraction in a different path than the origin files are.
-    * If a file/dir is already in the archive it will only be added at the
-    * end of the archive. There is no update of the existing archived
-    * file/dir. However while extracting the archive, the last file will
-    * replace the first one. This results in a none optimization of the
-    * archive size.
-    * If a file/dir does not exist the file/dir is ignored. However an
-    * error text is send to PEAR error.
-    * If a file/dir is not readable the file/dir is ignored. However an
-    * error text is send to PEAR error.
-    *
-    * @param array      $p_filelist     An array of filenames and directory
-	*                                   names, or a single string with names
-	*                                   separated by a single blank space.
-    * @param string     $p_add_dir      A string which contains a path to be
-	*                                   added to the memorized path of each
-	*                                   element in the list.
-    * @param string     $p_remove_dir   A string which contains a path to be
-	*                                   removed from the memorized path of
-	*                                   each element in the list, when
-    *                                   relevant.
-    * @return                           true on success, false on error.
-    * @access public
-    */
-    function addModify($p_filelist, $p_add_dir, $p_remove_dir='')
+     * This method add the files / directories listed in $p_filelist at the
+     * end of the existing archive. If the archive does not yet exists it
+     * is created.
+     * The $p_filelist parameter can be an array of string, each string
+     * representing a filename or a directory name with their path if
+     * needed. It can also be a single string with names separated by a
+     * single blank.
+     * The path indicated in $p_remove_dir will be removed from the
+     * memorized path of each file / directory listed when this path
+     * exists. By default nothing is removed (empty path '')
+     * The path indicated in $p_add_dir will be added at the beginning of
+     * the memorized path of each file / directory listed. However it can
+     * be set to empty ''. The adding of a path is done after the removing
+     * of path.
+     * The path add/remove ability enables the user to prepare an archive
+     * for extraction in a different path than the origin files are.
+     * If a file/dir is already in the archive it will only be added at the
+     * end of the archive. There is no update of the existing archived
+     * file/dir. However while extracting the archive, the last file will
+     * replace the first one. This results in a none optimization of the
+     * archive size.
+     * If a file/dir does not exist the file/dir is ignored. However an
+     * error text is send to PEAR error.
+     * If a file/dir is not readable the file/dir is ignored. However an
+     * error text is send to PEAR error.
+     *
+     * @param array $p_filelist An array of filenames and directory
+     *                             names, or a single string with names
+     *                             separated by a single blank space.
+     * @param string $p_add_dir A string which contains a path to be
+     *                             added to the memorized path of each
+     *                             element in the list.
+     * @param string $p_remove_dir A string which contains a path to be
+     *                             removed from the memorized path of
+     *                             each element in the list, when
+     *                             relevant.
+     *
+     * @return true on success, false on error.
+     */
+    public function addModify($p_filelist, $p_add_dir, $p_remove_dir = '')
     {
         $v_result = true;
 
-        if (!$this->_isArchive())
-            $v_result = $this->createModify($p_filelist, $p_add_dir,
-			                                $p_remove_dir);
-        else {
-            if (is_array($p_filelist))
+        if (!$this->_isArchive()) {
+            $v_result = $this->createModify(
+                $p_filelist,
+                $p_add_dir,
+                $p_remove_dir
+            );
+        } else {
+            if (is_array($p_filelist)) {
                 $v_list = $p_filelist;
-            elseif (is_string($p_filelist))
+            } elseif (is_string($p_filelist)) {
                 $v_list = explode($this->_separator, $p_filelist);
-            else {
+            } else {
                 $this->_error('Invalid file list');
                 return false;
             }
@@ -419,24 +516,41 @@ class Archive_Tar // extends PEAR
 
         return $v_result;
     }
-    // }}}
 
-    // {{{ addString()
     /**
-    * This method add a single string as a file at the
-    * end of the existing archive. If the archive does not yet exists it
-    * is created.
-    *
-    * @param string     $p_filename     A string which contains the full
-	*                                   filename path that will be associated
-	*                                   with the string.
-    * @param string     $p_string       The content of the file added in
-	*                                   the archive.
-    * @return                           true on success, false on error.
-    * @access public
-    */
-    function addString($p_filename, $p_string)
+     * This method add a single string as a file at the
+     * end of the existing archive. If the archive does not yet exists it
+     * is created.
+     *
+     * @param string $p_filename A string which contains the full
+     *                           filename path that will be associated
+     *                           with the string.
+     * @param string $p_string The content of the file added in
+     *                           the archive.
+     * @param bool|int $p_datetime A custom date/time (unix timestamp)
+     *                           for the file (optional).
+     * @param array $p_params An array of optional params:
+     *                               stamp => the datetime (replaces
+     *                                   datetime above if it exists)
+     *                               mode => the permissions on the
+     *                                   file (600 by default)
+     *                               type => is this a link?  See the
+     *                                   tar specification for details.
+     *                                   (default = regular file)
+     *                               uid => the user ID of the file
+     *                                   (default = 0 = root)
+     *                               gid => the group ID of the file
+     *                                   (default = 0 = root)
+     *
+     * @return true on success, false on error.
+     */
+    public function addString($p_filename, $p_string, $p_datetime = false, $p_params = array())
     {
+        $p_stamp = @$p_params["stamp"] ? $p_params["stamp"] : ($p_datetime ? $p_datetime : time());
+        $p_mode = @$p_params["mode"] ? $p_params["mode"] : 0600;
+        $p_type = @$p_params["type"] ? $p_params["type"] : "";
+        $p_uid = @$p_params["uid"] ? $p_params["uid"] : "";
+        $p_gid = @$p_params["gid"] ? $p_params["gid"] : "";
         $v_result = true;
 
         if (!$this->_isArchive()) {
@@ -446,11 +560,12 @@ class Archive_Tar // extends PEAR
             $this->_close();
         }
 
-        if (!$this->_openAppend())
+        if (!$this->_openAppend()) {
             return false;
+        }
 
         // Need to check the get back to the temporary file ? ....
-        $v_result = $this->_addString($p_filename, $p_string);
+        $v_result = $this->_addString($p_filename, $p_string, $p_datetime, $p_params);
 
         $this->_writeFooter();
 
@@ -458,131 +573,138 @@ class Archive_Tar // extends PEAR
 
         return $v_result;
     }
-    // }}}
 
-    // {{{ extractModify()
     /**
-    * This method extract all the content of the archive in the directory
-    * indicated by $p_path. When relevant the memorized path of the
-    * files/dir can be modified by removing the $p_remove_path path at the
-    * beginning of the file/dir path.
-    * While extracting a file, if the directory path does not exists it is
-    * created.
-    * While extracting a file, if the file already exists it is replaced
-    * without looking for last modification date.
-    * While extracting a file, if the file already exists and is write
-    * protected, the extraction is aborted.
-    * While extracting a file, if a directory with the same name already
-    * exists, the extraction is aborted.
-    * While extracting a directory, if a file with the same name already
-    * exists, the extraction is aborted.
-    * While extracting a file/directory if the destination directory exist
-    * and is write protected, or does not exist but can not be created,
-    * the extraction is aborted.
-    * If after extraction an extracted file does not show the correct
-    * stored file size, the extraction is aborted.
-    * When the extraction is aborted, a PEAR error text is set and false
-    * is returned. However the result can be a partial extraction that may
-    * need to be manually cleaned.
-    *
-    * @param string $p_path         The path of the directory where the
-	*                               files/dir need to by extracted.
-    * @param string $p_remove_path  Part of the memorized path that can be
-	*                               removed if present at the beginning of
-	*                               the file/dir path.
-    * @return boolean               true on success, false on error.
-    * @access public
-    * @see extractList()
-    */
-    function extractModify($p_path, $p_remove_path)
+     * This method extract all the content of the archive in the directory
+     * indicated by $p_path. When relevant the memorized path of the
+     * files/dir can be modified by removing the $p_remove_path path at the
+     * beginning of the file/dir path.
+     * While extracting a file, if the directory path does not exists it is
+     * created.
+     * While extracting a file, if the file already exists it is replaced
+     * without looking for last modification date.
+     * While extracting a file, if the file already exists and is write
+     * protected, the extraction is aborted.
+     * While extracting a file, if a directory with the same name already
+     * exists, the extraction is aborted.
+     * While extracting a directory, if a file with the same name already
+     * exists, the extraction is aborted.
+     * While extracting a file/directory if the destination directory exist
+     * and is write protected, or does not exist but can not be created,
+     * the extraction is aborted.
+     * If after extraction an extracted file does not show the correct
+     * stored file size, the extraction is aborted.
+     * When the extraction is aborted, a PEAR error text is set and false
+     * is returned. However the result can be a partial extraction that may
+     * need to be manually cleaned.
+     *
+     * @param string $p_path The path of the directory where the
+     *                               files/dir need to by extracted.
+     * @param string $p_remove_path Part of the memorized path that can be
+     *                               removed if present at the beginning of
+     *                               the file/dir path.
+     * @param boolean $p_preserve Preserve user/group ownership of files
+     *
+     * @return boolean true on success, false on error.
+     * @see    extractList()
+     */
+    public function extractModify($p_path, $p_remove_path, $p_preserve = false)
     {
         $v_result = true;
         $v_list_detail = array();
 
         if ($v_result = $this->_openRead()) {
-            $v_result = $this->_extractList($p_path, $v_list_detail,
-			                                "complete", 0, $p_remove_path);
+            $v_result = $this->_extractList(
+                $p_path,
+                $v_list_detail,
+                "complete",
+                0,
+                $p_remove_path,
+                $p_preserve
+            );
             $this->_close();
         }
 
         return $v_result;
     }
-    // }}}
 
-    // {{{ extractInString()
     /**
-    * This method extract from the archive one file identified by $p_filename.
-    * The return value is a string with the file content, or NULL on error.
-    * @param string $p_filename     The path of the file to extract in a string.
-    * @return                       a string with the file content or NULL.
-    * @access public
-    */
-    function extractInString($p_filename)
+     * This method extract from the archive one file identified by $p_filename.
+     * The return value is a string with the file content, or NULL on error.
+     *
+     * @param string $p_filename The path of the file to extract in a string.
+     *
+     * @return a string with the file content or NULL.
+     */
+    public function extractInString($p_filename)
     {
         if ($this->_openRead()) {
             $v_result = $this->_extractInString($p_filename);
             $this->_close();
         } else {
-            $v_result = NULL;
+            $v_result = null;
         }
 
         return $v_result;
     }
-    // }}}
 
-    // {{{ extractList()
     /**
-    * This method extract from the archive only the files indicated in the
-    * $p_filelist. These files are extracted in the current directory or
-    * in the directory indicated by the optional $p_path parameter.
-    * If indicated the $p_remove_path can be used in the same way as it is
-    * used in extractModify() method.
-    * @param array  $p_filelist     An array of filenames and directory names,
-	*                               or a single string with names separated
-	*                               by a single blank space.
-    * @param string $p_path         The path of the directory where the
-	*                               files/dir need to by extracted.
-    * @param string $p_remove_path  Part of the memorized path that can be
-	*                               removed if present at the beginning of
-	*                               the file/dir path.
-    * @return                       true on success, false on error.
-    * @access public
-    * @see extractModify()
-    */
-    function extractList($p_filelist, $p_path='', $p_remove_path='')
+     * This method extract from the archive only the files indicated in the
+     * $p_filelist. These files are extracted in the current directory or
+     * in the directory indicated by the optional $p_path parameter.
+     * If indicated the $p_remove_path can be used in the same way as it is
+     * used in extractModify() method.
+     *
+     * @param array $p_filelist An array of filenames and directory names,
+     *                               or a single string with names separated
+     *                               by a single blank space.
+     * @param string $p_path The path of the directory where the
+     *                               files/dir need to by extracted.
+     * @param string $p_remove_path Part of the memorized path that can be
+     *                               removed if present at the beginning of
+     *                               the file/dir path.
+     * @param boolean $p_preserve Preserve user/group ownership of files
+     *
+     * @return true on success, false on error.
+     * @see    extractModify()
+     */
+    public function extractList($p_filelist, $p_path = '', $p_remove_path = '', $p_preserve = false)
     {
         $v_result = true;
         $v_list_detail = array();
 
-        if (is_array($p_filelist))
+        if (is_array($p_filelist)) {
             $v_list = $p_filelist;
-        elseif (is_string($p_filelist))
+        } elseif (is_string($p_filelist)) {
             $v_list = explode($this->_separator, $p_filelist);
-        else {
+        } else {
             $this->_error('Invalid string list');
             return false;
         }
 
         if ($v_result = $this->_openRead()) {
-            $v_result = $this->_extractList($p_path, $v_list_detail, "partial",
-			                                $v_list, $p_remove_path);
+            $v_result = $this->_extractList(
+                $p_path,
+                $v_list_detail,
+                "partial",
+                $v_list,
+                $p_remove_path,
+                $p_preserve
+            );
             $this->_close();
         }
 
         return $v_result;
     }
-    // }}}
 
-    // {{{ setAttribute()
     /**
-    * This method set specific attributes of the archive. It uses a variable
-    * list of parameters, in the format attribute code + attribute values :
-    * $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ',');
-    * @param mixed $argv            variable list of attributes and values
-    * @return                       true on success, false on error.
-    * @access public
-    */
-    function setAttribute()
+     * This method set specific attributes of the archive. It uses a variable
+     * list of parameters, in the format attribute code + attribute values :
+     * $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ',');
+     *
+     * @return true on success, false on error.
+     */
+    public function setAttribute()
     {
         $v_result = true;
 
@@ -592,30 +714,32 @@ class Archive_Tar // extends PEAR
         }
 
         // ----- Get the arguments
-        $v_att_list = &func_get_args();
+        $v_att_list = & func_get_args();
 
         // ----- Read the attributes
-        $i=0;
-        while ($i<$v_size) {
+        $i = 0;
+        while ($i < $v_size) {
 
             // ----- Look for next option
             switch ($v_att_list[$i]) {
                 // ----- Look for options that request a string value
                 case ARCHIVE_TAR_ATT_SEPARATOR :
                     // ----- Check the number of parameters
-                    if (($i+1) >= $v_size) {
-                        $this->_error('Invalid number of parameters for '
-						              .'attribute ARCHIVE_TAR_ATT_SEPARATOR');
+                    if (($i + 1) >= $v_size) {
+                        $this->_error(
+                            'Invalid number of parameters for '
+                            . 'attribute ARCHIVE_TAR_ATT_SEPARATOR'
+                        );
                         return false;
                     }
 
                     // ----- Get the value
-                    $this->_separator = $v_att_list[$i+1];
+                    $this->_separator = $v_att_list[$i + 1];
                     $i++;
-                break;
+                    break;
 
                 default :
-                    $this->_error('Unknow attribute code '.$v_att_list[$i].'');
+                    $this->_error('Unknown attribute code ' . $v_att_list[$i] . '');
                     return false;
             }
 
@@ -625,151 +749,248 @@ class Archive_Tar // extends PEAR
 
         return $v_result;
     }
-    // }}}
 
-    // {{{ _error()
-    function _error($p_message)
+    /**
+     * This method sets the regular expression for ignoring files and directories
+     * at import, for example:
+     * $arch->setIgnoreRegexp("#CVS|\.svn#");
+     *
+     * @param string $regexp regular expression defining which files or directories to ignore
+     */
+    public function setIgnoreRegexp($regexp)
+    {
+        $this->_ignore_regexp = $regexp;
+    }
+
+    /**
+     * This method sets the regular expression for ignoring all files and directories
+     * matching the filenames in the array list at import, for example:
+     * $arch->setIgnoreList(array('CVS', '.svn', 'bin/tool'));
+     *
+     * @param array $list a list of file or directory names to ignore
+     *
+     * @access public
+     */
+    public function setIgnoreList($list)
+    {
+        $regexp = str_replace(array('#', '.', '^', '$'), array('\#', '\.', '\^', '\$'), $list);
+        $regexp = '#/' . join('$|/', $list) . '#';
+        $this->setIgnoreRegexp($regexp);
+    }
+
+    /**
+     * @param string $p_message
+     */
+    public function _error($p_message)
     {
-        // ----- To be completed
-//        $this->raiseError($p_message);
+        // Drupal change $this->error_object = $this->raiseError($p_message).
         throw new Exception($p_message);
     }
-    // }}}
 
-    // {{{ _warning()
-    function _warning($p_message)
+    /**
+     * @param string $p_message
+     */
+    public function _warning($p_message)
     {
-        // ----- To be completed
-//        $this->raiseError($p_message);
+        // Drupal change $this->error_object = $this->raiseError($p_message).
         throw new Exception($p_message);
     }
-    // }}}
 
-    // {{{ _isArchive()
-    function _isArchive($p_filename=NULL)
+    /**
+     * @param string $p_filename
+     * @return bool
+     */
+    public function _isArchive($p_filename = null)
     {
-        if ($p_filename == NULL) {
+        if ($p_filename == null) {
             $p_filename = $this->_tarname;
         }
         clearstatcache();
         return @is_file($p_filename) && !@is_link($p_filename);
     }
-    // }}}
 
-    // {{{ _openWrite()
-    function _openWrite()
+    /**
+     * @return bool
+     */
+    public function _openWrite()
     {
-        if ($this->_compress_type == 'gz')
+        if ($this->_compress_type == 'gz' && function_exists('gzopen')) {
             $this->_file = @gzopen($this->_tarname, "wb9");
-        else if ($this->_compress_type == 'bz2')
-            $this->_file = @bzopen($this->_tarname, "w");
-        else if ($this->_compress_type == 'none')
-            $this->_file = @fopen($this->_tarname, "wb");
-        else
-            $this->_error('Unknown or missing compression type ('
-			              .$this->_compress_type.')');
+        } else {
+            if ($this->_compress_type == 'bz2' && function_exists('bzopen')) {
+                $this->_file = @bzopen($this->_tarname, "w");
+            } else {
+                if ($this->_compress_type == 'lzma2' && function_exists('xzopen')) {
+                    $this->_file = @xzopen($this->_tarname, 'w');
+                } else {
+                    if ($this->_compress_type == 'none') {
+                        $this->_file = @fopen($this->_tarname, "wb");
+                    } else {
+                        $this->_error(
+                            'Unknown or missing compression type ('
+                            . $this->_compress_type . ')'
+                        );
+                        return false;
+                    }
+                }
+            }
+        }
 
         if ($this->_file == 0) {
-            $this->_error('Unable to open in write mode \''
-			              .$this->_tarname.'\'');
+            $this->_error(
+                'Unable to open in write mode \''
+                . $this->_tarname . '\''
+            );
             return false;
         }
 
         return true;
     }
-    // }}}
 
-    // {{{ _openRead()
-    function _openRead()
+    /**
+     * @return bool
+     */
+    public function _openRead()
     {
         if (strtolower(substr($this->_tarname, 0, 7)) == 'http://') {
 
-          // ----- Look if a local copy need to be done
-          if ($this->_temp_tarname == '') {
-              $this->_temp_tarname = uniqid('tar').'.tmp';
-              if (!$v_file_from = @fopen($this->_tarname, 'rb')) {
-                $this->_error('Unable to open in read mode \''
-				              .$this->_tarname.'\'');
-                $this->_temp_tarname = '';
-                return false;
-              }
-              if (!$v_file_to = @fopen($this->_temp_tarname, 'wb')) {
-                $this->_error('Unable to open in write mode \''
-				              .$this->_temp_tarname.'\'');
-                $this->_temp_tarname = '';
-                return false;
-              }
-              while ($v_data = @fread($v_file_from, 1024))
-                  @fwrite($v_file_to, $v_data);
-              @fclose($v_file_from);
-              @fclose($v_file_to);
-          }
+            // ----- Look if a local copy need to be done
+            if ($this->_temp_tarname == '') {
+                $this->_temp_tarname = uniqid('tar') . '.tmp';
+                if (!$v_file_from = @fopen($this->_tarname, 'rb')) {
+                    $this->_error(
+                        'Unable to open in read mode \''
+                        . $this->_tarname . '\''
+                    );
+                    $this->_temp_tarname = '';
+                    return false;
+                }
+                if (!$v_file_to = @fopen($this->_temp_tarname, 'wb')) {
+                    $this->_error(
+                        'Unable to open in write mode \''
+                        . $this->_temp_tarname . '\''
+                    );
+                    $this->_temp_tarname = '';
+                    return false;
+                }
+                while ($v_data = @fread($v_file_from, 1024)) {
+                    @fwrite($v_file_to, $v_data);
+                }
+                @fclose($v_file_from);
+                @fclose($v_file_to);
+            }
 
-          // ----- File to open if the local copy
-          $v_filename = $this->_temp_tarname;
+            // ----- File to open if the local copy
+            $v_filename = $this->_temp_tarname;
+        } else {
+            // ----- File to open if the normal Tar file
 
-        } else
-          // ----- File to open if the normal Tar file
-          $v_filename = $this->_tarname;
+            $v_filename = $this->_tarname;
+        }
 
-        if ($this->_compress_type == 'gz')
+        if ($this->_compress_type == 'gz' && function_exists('gzopen')) {
             $this->_file = @gzopen($v_filename, "rb");
-        else if ($this->_compress_type == 'bz2')
-            $this->_file = @bzopen($v_filename, "r");
-        else if ($this->_compress_type == 'none')
-            $this->_file = @fopen($v_filename, "rb");
-        else
-            $this->_error('Unknown or missing compression type ('
-			              .$this->_compress_type.')');
+        } else {
+            if ($this->_compress_type == 'bz2' && function_exists('bzopen')) {
+                $this->_file = @bzopen($v_filename, "r");
+            } else {
+                if ($this->_compress_type == 'lzma2' && function_exists('xzopen')) {
+                    $this->_file = @xzopen($v_filename, "r");
+                } else {
+                    if ($this->_compress_type == 'none') {
+                        $this->_file = @fopen($v_filename, "rb");
+                    } else {
+                        $this->_error(
+                            'Unknown or missing compression type ('
+                            . $this->_compress_type . ')'
+                        );
+                        return false;
+                    }
+                }
+            }
+        }
 
         if ($this->_file == 0) {
-            $this->_error('Unable to open in read mode \''.$v_filename.'\'');
+            $this->_error('Unable to open in read mode \'' . $v_filename . '\'');
             return false;
         }
 
         return true;
     }
-    // }}}
 
-    // {{{ _openReadWrite()
-    function _openReadWrite()
+    /**
+     * @return bool
+     */
+    public function _openReadWrite()
     {
-        if ($this->_compress_type == 'gz')
+        if ($this->_compress_type == 'gz') {
             $this->_file = @gzopen($this->_tarname, "r+b");
-        else if ($this->_compress_type == 'bz2') {
-            $this->_error('Unable to open bz2 in read/write mode \''
-			              .$this->_tarname.'\' (limitation of bz2 extension)');
-            return false;
-        } else if ($this->_compress_type == 'none')
-            $this->_file = @fopen($this->_tarname, "r+b");
-        else
-            $this->_error('Unknown or missing compression type ('
-			              .$this->_compress_type.')');
+        } else {
+            if ($this->_compress_type == 'bz2') {
+                $this->_error(
+                    'Unable to open bz2 in read/write mode \''
+                    . $this->_tarname . '\' (limitation of bz2 extension)'
+                );
+                return false;
+            } else {
+                if ($this->_compress_type == 'lzma2') {
+                    $this->_error(
+                        'Unable to open lzma2 in read/write mode \''
+                        . $this->_tarname . '\' (limitation of lzma2 extension)'
+                    );
+                    return false;
+                } else {
+                    if ($this->_compress_type == 'none') {
+                        $this->_file = @fopen($this->_tarname, "r+b");
+                    } else {
+                        $this->_error(
+                            'Unknown or missing compression type ('
+                            . $this->_compress_type . ')'
+                        );
+                        return false;
+                    }
+                }
+            }
+        }
 
         if ($this->_file == 0) {
-            $this->_error('Unable to open in read/write mode \''
-			              .$this->_tarname.'\'');
+            $this->_error(
+                'Unable to open in read/write mode \''
+                . $this->_tarname . '\''
+            );
             return false;
         }
 
         return true;
     }
-    // }}}
 
-    // {{{ _close()
-    function _close()
+    /**
+     * @return bool
+     */
+    public function _close()
     {
         //if (isset($this->_file)) {
         if (is_resource($this->_file)) {
-            if ($this->_compress_type == 'gz')
+            if ($this->_compress_type == 'gz') {
                 @gzclose($this->_file);
-            else if ($this->_compress_type == 'bz2')
-                @bzclose($this->_file);
-            else if ($this->_compress_type == 'none')
-                @fclose($this->_file);
-            else
-                $this->_error('Unknown or missing compression type ('
-				              .$this->_compress_type.')');
+            } else {
+                if ($this->_compress_type == 'bz2') {
+                    @bzclose($this->_file);
+                } else {
+                    if ($this->_compress_type == 'lzma2') {
+                        @xzclose($this->_file);
+                    } else {
+                        if ($this->_compress_type == 'none') {
+                            @fclose($this->_file);
+                        } else {
+                            $this->_error(
+                                'Unknown or missing compression type ('
+                                . $this->_compress_type . ')'
+                            );
+                        }
+                    }
+                }
+            }
 
             $this->_file = 0;
         }
@@ -783,10 +1004,11 @@ class Archive_Tar // extends PEAR
 
         return true;
     }
-    // }}}
 
-    // {{{ _cleanFile()
-    function _cleanFile()
+    /**
+     * @return bool
+     */
+    public function _cleanFile()
     {
         $this->_close();
 
@@ -803,296 +1025,419 @@ class Archive_Tar // extends PEAR
 
         return true;
     }
-    // }}}
 
-    // {{{ _writeBlock()
-    function _writeBlock($p_binary_data, $p_len=null)
+    /**
+     * @param mixed $p_binary_data
+     * @param integer $p_len
+     * @return bool
+     */
+    public function _writeBlock($p_binary_data, $p_len = null)
     {
-      if (is_resource($this->_file)) {
-          if ($p_len === null) {
-              if ($this->_compress_type == 'gz')
-                  @gzputs($this->_file, $p_binary_data);
-              else if ($this->_compress_type == 'bz2')
-                  @bzwrite($this->_file, $p_binary_data);
-              else if ($this->_compress_type == 'none')
-                  @fputs($this->_file, $p_binary_data);
-              else
-                  $this->_error('Unknown or missing compression type ('
-				                .$this->_compress_type.')');
-          } else {
-              if ($this->_compress_type == 'gz')
-                  @gzputs($this->_file, $p_binary_data, $p_len);
-              else if ($this->_compress_type == 'bz2')
-                  @bzwrite($this->_file, $p_binary_data, $p_len);
-              else if ($this->_compress_type == 'none')
-                  @fputs($this->_file, $p_binary_data, $p_len);
-              else
-                  $this->_error('Unknown or missing compression type ('
-				                .$this->_compress_type.')');
-
-          }
-      }
-      return true;
+        if (is_resource($this->_file)) {
+            if ($p_len === null) {
+                if ($this->_compress_type == 'gz') {
+                    @gzputs($this->_file, $p_binary_data);
+                } else {
+                    if ($this->_compress_type == 'bz2') {
+                        @bzwrite($this->_file, $p_binary_data);
+                    } else {
+                        if ($this->_compress_type == 'lzma2') {
+                            @xzwrite($this->_file, $p_binary_data);
+                        } else {
+                            if ($this->_compress_type == 'none') {
+                                @fputs($this->_file, $p_binary_data);
+                            } else {
+                                $this->_error(
+                                    'Unknown or missing compression type ('
+                                    . $this->_compress_type . ')'
+                                );
+                            }
+                        }
+                    }
+                }
+            } else {
+                if ($this->_compress_type == 'gz') {
+                    @gzputs($this->_file, $p_binary_data, $p_len);
+                } else {
+                    if ($this->_compress_type == 'bz2') {
+                        @bzwrite($this->_file, $p_binary_data, $p_len);
+                    } else {
+                        if ($this->_compress_type == 'lzma2') {
+                            @xzwrite($this->_file, $p_binary_data, $p_len);
+                        } else {
+                            if ($this->_compress_type == 'none') {
+                                @fputs($this->_file, $p_binary_data, $p_len);
+                            } else {
+                                $this->_error(
+                                    'Unknown or missing compression type ('
+                                    . $this->_compress_type . ')'
+                                );
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return true;
     }
-    // }}}
 
-    // {{{ _readBlock()
-    function _readBlock()
+    /**
+     * @return null|string
+     */
+    public function _readBlock()
     {
-      $v_block = null;
-      if (is_resource($this->_file)) {
-          if ($this->_compress_type == 'gz')
-              $v_block = @gzread($this->_file, 512);
-          else if ($this->_compress_type == 'bz2')
-              $v_block = @bzread($this->_file, 512);
-          else if ($this->_compress_type == 'none')
-              $v_block = @fread($this->_file, 512);
-          else
-              $this->_error('Unknown or missing compression type ('
-			                .$this->_compress_type.')');
-      }
-      return $v_block;
+        $v_block = null;
+        if (is_resource($this->_file)) {
+            if ($this->_compress_type == 'gz') {
+                $v_block = @gzread($this->_file, 512);
+            } else {
+                if ($this->_compress_type == 'bz2') {
+                    $v_block = @bzread($this->_file, 512);
+                } else {
+                    if ($this->_compress_type == 'lzma2') {
+                        $v_block = @xzread($this->_file, 512);
+                    } else {
+                        if ($this->_compress_type == 'none') {
+                            $v_block = @fread($this->_file, 512);
+                        } else {
+                            $this->_error(
+                                'Unknown or missing compression type ('
+                                . $this->_compress_type . ')'
+                            );
+                        }
+                    }
+                }
+            }
+        }
+        return $v_block;
     }
-    // }}}
 
-    // {{{ _jumpBlock()
-    function _jumpBlock($p_len=null)
-    {
-      if (is_resource($this->_file)) {
-          if ($p_len === null)
-              $p_len = 1;
-
-          if ($this->_compress_type == 'gz') {
-              @gzseek($this->_file, gztell($this->_file)+($p_len*512));
-          }
-          else if ($this->_compress_type == 'bz2') {
-              // ----- Replace missing bztell() and bzseek()
-              for ($i=0; $i<$p_len; $i++)
-                  $this->_readBlock();
-          } else if ($this->_compress_type == 'none')
-              @fseek($this->_file, ftell($this->_file)+($p_len*512));
-          else
-              $this->_error('Unknown or missing compression type ('
-			                .$this->_compress_type.')');
-
-      }
-      return true;
-    }
-    // }}}
+    /**
+     * @param null $p_len
+     * @return bool
+     */
+    public function _jumpBlock($p_len = null)
+    {
+        if (is_resource($this->_file)) {
+            if ($p_len === null) {
+                $p_len = 1;
+            }
+
+            if ($this->_compress_type == 'gz') {
+                @gzseek($this->_file, gztell($this->_file) + ($p_len * 512));
+            } else {
+                if ($this->_compress_type == 'bz2') {
+                    // ----- Replace missing bztell() and bzseek()
+                    for ($i = 0; $i < $p_len; $i++) {
+                        $this->_readBlock();
+                    }
+                } else {
+                    if ($this->_compress_type == 'lzma2') {
+                        // ----- Replace missing xztell() and xzseek()
+                        for ($i = 0; $i < $p_len; $i++) {
+                            $this->_readBlock();
+                        }
+                    } else {
+                        if ($this->_compress_type == 'none') {
+                            @fseek($this->_file, $p_len * 512, SEEK_CUR);
+                        } else {
+                            $this->_error(
+                                'Unknown or missing compression type ('
+                                . $this->_compress_type . ')'
+                            );
+                        }
+                    }
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
+     * @return bool
+     */
+    public function _writeFooter()
+    {
+        if (is_resource($this->_file)) {
+            // ----- Write the last 0 filled block for end of archive
+            $v_binary_data = pack('a1024', '');
+            $this->_writeBlock($v_binary_data);
+        }
+        return true;
+    }
+
+    /**
+     * @param array $p_list
+     * @param string $p_add_dir
+     * @param string $p_remove_dir
+     * @return bool
+     */
+    public function _addList($p_list, $p_add_dir, $p_remove_dir)
+    {
+        $v_result = true;
+        $v_header = array();
+
+        // ----- Remove potential windows directory separator
+        $p_add_dir = $this->_translateWinPath($p_add_dir);
+        $p_remove_dir = $this->_translateWinPath($p_remove_dir, false);
+
+        if (!$this->_file) {
+            $this->_error('Invalid file descriptor');
+            return false;
+        }
+
+        if (sizeof($p_list) == 0) {
+            return true;
+        }
+
+        foreach ($p_list as $v_filename) {
+            if (!$v_result) {
+                break;
+            }
+
+            // ----- Skip the current tar name
+            if ($v_filename == $this->_tarname) {
+                continue;
+            }
+
+            if ($v_filename == '') {
+                continue;
+            }
+
+            // ----- ignore files and directories matching the ignore regular expression
+            if ($this->_ignore_regexp && preg_match($this->_ignore_regexp, '/' . $v_filename)) {
+                $this->_warning("File '$v_filename' ignored");
+                continue;
+            }
+
+            if (!file_exists($v_filename) && !is_link($v_filename)) {
+                $this->_warning("File '$v_filename' does not exist");
+                continue;
+            }
+
+            // ----- Add the file or directory header
+            if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir)) {
+                return false;
+            }
+
+            if (@is_dir($v_filename) && !@is_link($v_filename)) {
+                if (!($p_hdir = opendir($v_filename))) {
+                    $this->_warning("Directory '$v_filename' can not be read");
+                    continue;
+                }
+                while (false !== ($p_hitem = readdir($p_hdir))) {
+                    if (($p_hitem != '.') && ($p_hitem != '..')) {
+                        if ($v_filename != ".") {
+                            $p_temp_list[0] = $v_filename . '/' . $p_hitem;
+                        } else {
+                            $p_temp_list[0] = $p_hitem;
+                        }
+
+                        $v_result = $this->_addList(
+                            $p_temp_list,
+                            $p_add_dir,
+                            $p_remove_dir
+                        );
+                    }
+                }
+
+                unset($p_temp_list);
+                unset($p_hdir);
+                unset($p_hitem);
+            }
+        }
 
-    // {{{ _writeFooter()
-    function _writeFooter()
-    {
-      if (is_resource($this->_file)) {
-          // ----- Write the last 0 filled block for end of archive
-          $v_binary_data = pack('a1024', '');
-          $this->_writeBlock($v_binary_data);
-      }
-      return true;
+        return $v_result;
     }
-    // }}}
 
-    // {{{ _addList()
-    function _addList($p_list, $p_add_dir, $p_remove_dir)
+    /**
+     * @param string $p_filename
+     * @param mixed $p_header
+     * @param string $p_add_dir
+     * @param string $p_remove_dir
+     * @param null $v_stored_filename
+     * @return bool
+     */
+    public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $v_stored_filename = null)
     {
-      $v_result=true;
-      $v_header = array();
+        if (!$this->_file) {
+            $this->_error('Invalid file descriptor');
+            return false;
+        }
 
-      // ----- Remove potential windows directory separator
-      $p_add_dir = $this->_translateWinPath($p_add_dir);
-      $p_remove_dir = $this->_translateWinPath($p_remove_dir, false);
+        if ($p_filename == '') {
+            $this->_error('Invalid file name');
+            return false;
+        }
 
-      if (!$this->_file) {
-          $this->_error('Invalid file descriptor');
-          return false;
-      }
+        if (is_null($v_stored_filename)) {
+            // ----- Calculate the stored filename
+            $p_filename = $this->_translateWinPath($p_filename, false);
+            $v_stored_filename = $p_filename;
 
-      if (sizeof($p_list) == 0)
-          return true;
+            if (strcmp($p_filename, $p_remove_dir) == 0) {
+                return true;
+            }
 
-      foreach ($p_list as $v_filename) {
-          if (!$v_result) {
-              break;
-          }
+            if ($p_remove_dir != '') {
+                if (substr($p_remove_dir, -1) != '/') {
+                    $p_remove_dir .= '/';
+                }
 
-        // ----- Skip the current tar name
-        if ($v_filename == $this->_tarname)
-            continue;
+                if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir) {
+                    $v_stored_filename = substr($p_filename, strlen($p_remove_dir));
+                }
+            }
 
-        if ($v_filename == '')
-            continue;
+            $v_stored_filename = $this->_translateWinPath($v_stored_filename);
+            if ($p_add_dir != '') {
+                if (substr($p_add_dir, -1) == '/') {
+                    $v_stored_filename = $p_add_dir . $v_stored_filename;
+                } else {
+                    $v_stored_filename = $p_add_dir . '/' . $v_stored_filename;
+                }
+            }
 
-        if (!file_exists($v_filename)) {
-            $this->_warning("File '$v_filename' does not exist");
-            continue;
+            $v_stored_filename = $this->_pathReduction($v_stored_filename);
         }
 
-        // ----- Add the file or directory header
-        if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir))
-            return false;
+        if ($this->_isArchive($p_filename)) {
+            if (($v_file = @fopen($p_filename, "rb")) == 0) {
+                $this->_warning(
+                    "Unable to open file '" . $p_filename
+                    . "' in binary read mode"
+                );
+                return true;
+            }
 
-        if (@is_dir($v_filename) && !@is_link($v_filename)) {
-            if (!($p_hdir = opendir($v_filename))) {
-                $this->_warning("Directory '$v_filename' can not be read");
-                continue;
+            if (!$this->_writeHeader($p_filename, $v_stored_filename)) {
+                return false;
             }
-            while (false !== ($p_hitem = readdir($p_hdir))) {
-                if (($p_hitem != '.') && ($p_hitem != '..')) {
-                    if ($v_filename != ".")
-                        $p_temp_list[0] = $v_filename.'/'.$p_hitem;
-                    else
-                        $p_temp_list[0] = $p_hitem;
-
-                    $v_result = $this->_addList($p_temp_list,
-					                            $p_add_dir,
-												$p_remove_dir);
-                }
+
+            while (($v_buffer = fread($v_file, 512)) != '') {
+                $v_binary_data = pack("a512", "$v_buffer");
+                $this->_writeBlock($v_binary_data);
             }
 
-            unset($p_temp_list);
-            unset($p_hdir);
-            unset($p_hitem);
+            fclose($v_file);
+        } else {
+            // ----- Only header for dir
+            if (!$this->_writeHeader($p_filename, $v_stored_filename)) {
+                return false;
+            }
         }
-      }
 
-      return $v_result;
+        return true;
     }
-    // }}}
 
-    // {{{ _addFile()
-    function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir)
+    /**
+     * @param string $p_filename
+     * @param string $p_string
+     * @param bool $p_datetime
+     * @param array $p_params
+     * @return bool
+     */
+    public function _addString($p_filename, $p_string, $p_datetime = false, $p_params = array())
     {
-      if (!$this->_file) {
-          $this->_error('Invalid file descriptor');
-          return false;
-      }
-
-      if ($p_filename == '') {
-          $this->_error('Invalid file name');
-          return false;
-      }
-
-      // ----- Calculate the stored filename
-      $p_filename = $this->_translateWinPath($p_filename, false);;
-      $v_stored_filename = $p_filename;
-      if (strcmp($p_filename, $p_remove_dir) == 0) {
-          return true;
-      }
-      if ($p_remove_dir != '') {
-          if (substr($p_remove_dir, -1) != '/')
-              $p_remove_dir .= '/';
-
-          if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir)
-              $v_stored_filename = substr($p_filename, strlen($p_remove_dir));
-      }
-      $v_stored_filename = $this->_translateWinPath($v_stored_filename);
-      if ($p_add_dir != '') {
-          if (substr($p_add_dir, -1) == '/')
-              $v_stored_filename = $p_add_dir.$v_stored_filename;
-          else
-              $v_stored_filename = $p_add_dir.'/'.$v_stored_filename;
-      }
-
-      $v_stored_filename = $this->_pathReduction($v_stored_filename);
-
-      if ($this->_isArchive($p_filename)) {
-          if (($v_file = @fopen($p_filename, "rb")) == 0) {
-              $this->_warning("Unable to open file '".$p_filename
-			                  ."' in binary read mode");
-              return true;
-          }
-
-          if (!$this->_writeHeader($p_filename, $v_stored_filename))
-              return false;
-
-          while (($v_buffer = fread($v_file, 512)) != '') {
-              $v_binary_data = pack("a512", "$v_buffer");
-              $this->_writeBlock($v_binary_data);
-          }
-
-          fclose($v_file);
-
-      } else {
-          // ----- Only header for dir
-          if (!$this->_writeHeader($p_filename, $v_stored_filename))
-              return false;
-      }
-
-      return true;
-    }
-    // }}}
+        $p_stamp = @$p_params["stamp"] ? $p_params["stamp"] : ($p_datetime ? $p_datetime : time());
+        $p_mode = @$p_params["mode"] ? $p_params["mode"] : 0600;
+        $p_type = @$p_params["type"] ? $p_params["type"] : "";
+        $p_uid = @$p_params["uid"] ? $p_params["uid"] : 0;
+        $p_gid = @$p_params["gid"] ? $p_params["gid"] : 0;
+        if (!$this->_file) {
+            $this->_error('Invalid file descriptor');
+            return false;
+        }
 
-    // {{{ _addString()
-    function _addString($p_filename, $p_string)
-    {
-      if (!$this->_file) {
-          $this->_error('Invalid file descriptor');
-          return false;
-      }
-
-      if ($p_filename == '') {
-          $this->_error('Invalid file name');
-          return false;
-      }
-
-      // ----- Calculate the stored filename
-      $p_filename = $this->_translateWinPath($p_filename, false);;
-
-      if (!$this->_writeHeaderBlock($p_filename, strlen($p_string),
-	                                  time(), 384, "", 0, 0))
-          return false;
-
-      $i=0;
-      while (($v_buffer = substr($p_string, (($i++)*512), 512)) != '') {
-          $v_binary_data = pack("a512", $v_buffer);
-          $this->_writeBlock($v_binary_data);
-      }
-
-      return true;
+        if ($p_filename == '') {
+            $this->_error('Invalid file name');
+            return false;
+        }
+
+        // ----- Calculate the stored filename
+        $p_filename = $this->_translateWinPath($p_filename, false);
+
+        // ----- If datetime is not specified, set current time
+        if ($p_datetime === false) {
+            $p_datetime = time();
+        }
+
+        if (!$this->_writeHeaderBlock(
+            $p_filename,
+            strlen($p_string),
+            $p_stamp,
+            $p_mode,
+            $p_type,
+            $p_uid,
+            $p_gid
+        )
+        ) {
+            return false;
+        }
+
+        $i = 0;
+        while (($v_buffer = substr($p_string, (($i++) * 512), 512)) != '') {
+            $v_binary_data = pack("a512", $v_buffer);
+            $this->_writeBlock($v_binary_data);
+        }
+
+        return true;
     }
-    // }}}
 
-    // {{{ _writeHeader()
-    function _writeHeader($p_filename, $p_stored_filename)
+    /**
+     * @param string $p_filename
+     * @param string $p_stored_filename
+     * @return bool
+     */
+    public function _writeHeader($p_filename, $p_stored_filename)
     {
-        if ($p_stored_filename == '')
+        if ($p_stored_filename == '') {
             $p_stored_filename = $p_filename;
+        }
         $v_reduce_filename = $this->_pathReduction($p_stored_filename);
 
         if (strlen($v_reduce_filename) > 99) {
-          if (!$this->_writeLongHeader($v_reduce_filename))
-            return false;
+            if (!$this->_writeLongHeader($v_reduce_filename)) {
+                return false;
+            }
         }
 
         $v_info = lstat($p_filename);
-        $v_uid = sprintf("%6s ", DecOct($v_info[4]));
-        $v_gid = sprintf("%6s ", DecOct($v_info[5]));
-        $v_perms = sprintf("%6s ", DecOct($v_info['mode']));
+        $v_uid = sprintf("%07s", DecOct($v_info[4]));
+        $v_gid = sprintf("%07s", DecOct($v_info[5]));
+        $v_perms = sprintf("%07s", DecOct($v_info['mode'] & 000777));
 
-        $v_mtime = sprintf("%11s", DecOct($v_info['mode']));
+        $v_mtime = sprintf("%011s", DecOct($v_info['mtime']));
 
         $v_linkname = '';
 
         if (@is_link($p_filename)) {
-          $v_typeflag = '2';
-          $v_linkname = readlink($p_filename);
-          $v_size = sprintf("%11s ", DecOct(0));
+            $v_typeflag = '2';
+            $v_linkname = readlink($p_filename);
+            $v_size = sprintf("%011s", DecOct(0));
         } elseif (@is_dir($p_filename)) {
-          $v_typeflag = "5";
-          $v_size = sprintf("%11s ", DecOct(0));
+            $v_typeflag = "5";
+            $v_size = sprintf("%011s", DecOct(0));
         } else {
-          $v_typeflag = '';
-          clearstatcache();
-          $v_size = sprintf("%11s ", DecOct($v_info['size']));
+            $v_typeflag = '0';
+            clearstatcache();
+            $v_size = sprintf("%011s", DecOct($v_info['size']));
         }
 
-        $v_magic = '';
+        $v_magic = 'ustar ';
 
-        $v_version = '';
+        $v_version = ' ';
 
-        $v_uname = '';
+        if (function_exists('posix_getpwuid')) {
+            $userinfo = posix_getpwuid($v_info[4]);
+            $groupinfo = posix_getgrgid($v_info[5]);
 
-        $v_gname = '';
+            $v_uname = $userinfo['name'];
+            $v_gname = $groupinfo['name'];
+        } else {
+            $v_uname = '';
+            $v_gname = '';
+        }
 
         $v_devmajor = '';
 
@@ -1100,31 +1445,49 @@ class Archive_Tar // extends PEAR
 
         $v_prefix = '';
 
-        $v_binary_data_first = pack("a100a8a8a8a12A12",
-		                            $v_reduce_filename, $v_perms, $v_uid,
-									$v_gid, $v_size, $v_mtime);
-        $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
-		                           $v_typeflag, $v_linkname, $v_magic,
-								   $v_version, $v_uname, $v_gname,
-								   $v_devmajor, $v_devminor, $v_prefix, '');
+        $v_binary_data_first = pack(
+            "a100a8a8a8a12a12",
+            $v_reduce_filename,
+            $v_perms,
+            $v_uid,
+            $v_gid,
+            $v_size,
+            $v_mtime
+        );
+        $v_binary_data_last = pack(
+            "a1a100a6a2a32a32a8a8a155a12",
+            $v_typeflag,
+            $v_linkname,
+            $v_magic,
+            $v_version,
+            $v_uname,
+            $v_gname,
+            $v_devmajor,
+            $v_devminor,
+            $v_prefix,
+            ''
+        );
 
         // ----- Calculate the checksum
         $v_checksum = 0;
         // ..... First part of the header
-        for ($i=0; $i<148; $i++)
-            $v_checksum += ord(substr($v_binary_data_first,$i,1));
+        for ($i = 0; $i < 148; $i++) {
+            $v_checksum += ord(substr($v_binary_data_first, $i, 1));
+        }
         // ..... Ignore the checksum value and replace it by ' ' (space)
-        for ($i=148; $i<156; $i++)
+        for ($i = 148; $i < 156; $i++) {
             $v_checksum += ord(' ');
+        }
         // ..... Last part of the header
-        for ($i=156, $j=0; $i<512; $i++, $j++)
-            $v_checksum += ord(substr($v_binary_data_last,$j,1));
+        for ($i = 156, $j = 0; $i < 512; $i++, $j++) {
+            $v_checksum += ord(substr($v_binary_data_last, $j, 1));
+        }
 
         // ----- Write the first 148 bytes of the header in the archive
         $this->_writeBlock($v_binary_data_first, 148);
 
         // ----- Write the calculated checksum
-        $v_checksum = sprintf("%6s ", DecOct($v_checksum));
+        $v_checksum = sprintf("%06s ", DecOct($v_checksum));
         $v_binary_data = pack("a8", $v_checksum);
         $this->_writeBlock($v_binary_data, 8);
 
@@ -1133,40 +1496,62 @@ class Archive_Tar // extends PEAR
 
         return true;
     }
-    // }}}
 
-    // {{{ _writeHeaderBlock()
-    function _writeHeaderBlock($p_filename, $p_size, $p_mtime=0, $p_perms=0,
-	                           $p_type='', $p_uid=0, $p_gid=0)
-    {
+    /**
+     * @param string $p_filename
+     * @param int $p_size
+     * @param int $p_mtime
+     * @param int $p_perms
+     * @param string $p_type
+     * @param int $p_uid
+     * @param int $p_gid
+     * @return bool
+     */
+    public function _writeHeaderBlock(
+        $p_filename,
+        $p_size,
+        $p_mtime = 0,
+        $p_perms = 0,
+        $p_type = '',
+        $p_uid = 0,
+        $p_gid = 0
+    ) {
         $p_filename = $this->_pathReduction($p_filename);
 
         if (strlen($p_filename) > 99) {
-          if (!$this->_writeLongHeader($p_filename))
-            return false;
+            if (!$this->_writeLongHeader($p_filename)) {
+                return false;
+            }
         }
 
         if ($p_type == "5") {
-          $v_size = sprintf("%11s ", DecOct(0));
+            $v_size = sprintf("%011s", DecOct(0));
         } else {
-          $v_size = sprintf("%11s ", DecOct($p_size));
+            $v_size = sprintf("%011s", DecOct($p_size));
         }
 
-        $v_uid = sprintf("%6s ", DecOct($p_uid));
-        $v_gid = sprintf("%6s ", DecOct($p_gid));
-        $v_perms = sprintf("%6s ", DecOct($p_perms));
+        $v_uid = sprintf("%07s", DecOct($p_uid));
+        $v_gid = sprintf("%07s", DecOct($p_gid));
+        $v_perms = sprintf("%07s", DecOct($p_perms & 000777));
 
         $v_mtime = sprintf("%11s", DecOct($p_mtime));
 
         $v_linkname = '';
 
-        $v_magic = '';
+        $v_magic = 'ustar ';
 
-        $v_version = '';
+        $v_version = ' ';
 
-        $v_uname = '';
+        if (function_exists('posix_getpwuid')) {
+            $userinfo = posix_getpwuid($p_uid);
+            $groupinfo = posix_getgrgid($p_gid);
 
-        $v_gname = '';
+            $v_uname = $userinfo['name'];
+            $v_gname = $groupinfo['name'];
+        } else {
+            $v_uname = '';
+            $v_gname = '';
+        }
 
         $v_devmajor = '';
 
@@ -1174,31 +1559,49 @@ class Archive_Tar // extends PEAR
 
         $v_prefix = '';
 
-        $v_binary_data_first = pack("a100a8a8a8a12A12",
-		                            $p_filename, $v_perms, $v_uid, $v_gid,
-									$v_size, $v_mtime);
-        $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
-		                           $p_type, $v_linkname, $v_magic,
-								   $v_version, $v_uname, $v_gname,
-								   $v_devmajor, $v_devminor, $v_prefix, '');
+        $v_binary_data_first = pack(
+            "a100a8a8a8a12A12",
+            $p_filename,
+            $v_perms,
+            $v_uid,
+            $v_gid,
+            $v_size,
+            $v_mtime
+        );
+        $v_binary_data_last = pack(
+            "a1a100a6a2a32a32a8a8a155a12",
+            $p_type,
+            $v_linkname,
+            $v_magic,
+            $v_version,
+            $v_uname,
+            $v_gname,
+            $v_devmajor,
+            $v_devminor,
+            $v_prefix,
+            ''
+        );
 
         // ----- Calculate the checksum
         $v_checksum = 0;
         // ..... First part of the header
-        for ($i=0; $i<148; $i++)
-            $v_checksum += ord(substr($v_binary_data_first,$i,1));
+        for ($i = 0; $i < 148; $i++) {
+            $v_checksum += ord(substr($v_binary_data_first, $i, 1));
+        }
         // ..... Ignore the checksum value and replace it by ' ' (space)
-        for ($i=148; $i<156; $i++)
+        for ($i = 148; $i < 156; $i++) {
             $v_checksum += ord(' ');
+        }
         // ..... Last part of the header
-        for ($i=156, $j=0; $i<512; $i++, $j++)
-            $v_checksum += ord(substr($v_binary_data_last,$j,1));
+        for ($i = 156, $j = 0; $i < 512; $i++, $j++) {
+            $v_checksum += ord(substr($v_binary_data_last, $j, 1));
+        }
 
         // ----- Write the first 148 bytes of the header in the archive
         $this->_writeBlock($v_binary_data_first, 148);
 
         // ----- Write the calculated checksum
-        $v_checksum = sprintf("%6s ", DecOct($v_checksum));
+        $v_checksum = sprintf("%06s ", DecOct($v_checksum));
         $v_binary_data = pack("a8", $v_checksum);
         $this->_writeBlock($v_binary_data, 8);
 
@@ -1207,10 +1610,12 @@ class Archive_Tar // extends PEAR
 
         return true;
     }
-    // }}}
 
-    // {{{ _writeLongHeader()
-    function _writeLongHeader($p_filename)
+    /**
+     * @param string $p_filename
+     * @return bool
+     */
+    public function _writeLongHeader($p_filename)
     {
         $v_size = sprintf("%11s ", DecOct(strlen($p_filename)));
 
@@ -1232,30 +1637,49 @@ class Archive_Tar // extends PEAR
 
         $v_prefix = '';
 
-        $v_binary_data_first = pack("a100a8a8a8a12A12",
-		                            '././@LongLink', 0, 0, 0, $v_size, 0);
-        $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
-		                           $v_typeflag, $v_linkname, $v_magic,
-								   $v_version, $v_uname, $v_gname,
-								   $v_devmajor, $v_devminor, $v_prefix, '');
+        $v_binary_data_first = pack(
+            "a100a8a8a8a12a12",
+            '././@LongLink',
+            0,
+            0,
+            0,
+            $v_size,
+            0
+        );
+        $v_binary_data_last = pack(
+            "a1a100a6a2a32a32a8a8a155a12",
+            $v_typeflag,
+            $v_linkname,
+            $v_magic,
+            $v_version,
+            $v_uname,
+            $v_gname,
+            $v_devmajor,
+            $v_devminor,
+            $v_prefix,
+            ''
+        );
 
         // ----- Calculate the checksum
         $v_checksum = 0;
         // ..... First part of the header
-        for ($i=0; $i<148; $i++)
-            $v_checksum += ord(substr($v_binary_data_first,$i,1));
+        for ($i = 0; $i < 148; $i++) {
+            $v_checksum += ord(substr($v_binary_data_first, $i, 1));
+        }
         // ..... Ignore the checksum value and replace it by ' ' (space)
-        for ($i=148; $i<156; $i++)
+        for ($i = 148; $i < 156; $i++) {
             $v_checksum += ord(' ');
+        }
         // ..... Last part of the header
-        for ($i=156, $j=0; $i<512; $i++, $j++)
-            $v_checksum += ord(substr($v_binary_data_last,$j,1));
+        for ($i = 156, $j = 0; $i < 512; $i++, $j++) {
+            $v_checksum += ord(substr($v_binary_data_last, $j, 1));
+        }
 
         // ----- Write the first 148 bytes of the header in the archive
         $this->_writeBlock($v_binary_data_first, 148);
 
         // ----- Write the calculated checksum
-        $v_checksum = sprintf("%6s ", DecOct($v_checksum));
+        $v_checksum = sprintf("%06s ", DecOct($v_checksum));
         $v_binary_data = pack("a8", $v_checksum);
         $this->_writeBlock($v_binary_data, 8);
 
@@ -1263,27 +1687,30 @@ class Archive_Tar // extends PEAR
         $this->_writeBlock($v_binary_data_last, 356);
 
         // ----- Write the filename as content of the block
-        $i=0;
-        while (($v_buffer = substr($p_filename, (($i++)*512), 512)) != '') {
+        $i = 0;
+        while (($v_buffer = substr($p_filename, (($i++) * 512), 512)) != '') {
             $v_binary_data = pack("a512", "$v_buffer");
             $this->_writeBlock($v_binary_data);
         }
 
         return true;
     }
-    // }}}
 
-    // {{{ _readHeader()
-    function _readHeader($v_binary_data, &$v_header)
+    /**
+     * @param mixed $v_binary_data
+     * @param mixed $v_header
+     * @return bool
+     */
+    public function _readHeader($v_binary_data, &$v_header)
     {
-        if (strlen($v_binary_data)==0) {
+        if (strlen($v_binary_data) == 0) {
             $v_header['filename'] = '';
             return true;
         }
 
         if (strlen($v_binary_data) != 512) {
             $v_header['filename'] = '';
-            $this->_error('Invalid block size : '.strlen($v_binary_data));
+            $this->_error('Invalid block size : ' . strlen($v_binary_data));
             return false;
         }
 
@@ -1293,19 +1720,32 @@ class Archive_Tar // extends PEAR
         // ----- Calculate the checksum
         $v_checksum = 0;
         // ..... First part of the header
-        for ($i=0; $i<148; $i++)
-            $v_checksum+=ord(substr($v_binary_data,$i,1));
+        for ($i = 0; $i < 148; $i++) {
+            $v_checksum += ord(substr($v_binary_data, $i, 1));
+        }
         // ..... Ignore the checksum value and replace it by ' ' (space)
-        for ($i=148; $i<156; $i++)
+        for ($i = 148; $i < 156; $i++) {
             $v_checksum += ord(' ');
+        }
         // ..... Last part of the header
-        for ($i=156; $i<512; $i++)
-           $v_checksum+=ord(substr($v_binary_data,$i,1));
+        for ($i = 156; $i < 512; $i++) {
+            $v_checksum += ord(substr($v_binary_data, $i, 1));
+        }
 
-        $v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/"
-		                 ."a8checksum/a1typeflag/a100link/a6magic/a2version/"
-						 ."a32uname/a32gname/a8devmajor/a8devminor",
-						 $v_binary_data);
+        if (version_compare(PHP_VERSION, "5.5.0-dev") < 0) {
+            $fmt = "a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/" .
+                "a8checksum/a1typeflag/a100link/a6magic/a2version/" .
+                "a32uname/a32gname/a8devmajor/a8devminor/a131prefix";
+        } else {
+            $fmt = "Z100filename/Z8mode/Z8uid/Z8gid/Z12size/Z12mtime/" .
+                "Z8checksum/Z1typeflag/Z100link/Z6magic/Z2version/" .
+                "Z32uname/Z32gname/Z8devmajor/Z8devminor/Z131prefix";
+        }
+        $v_data = unpack($fmt, $v_binary_data);
+
+        if (strlen($v_data["prefix"]) > 0) {
+            $v_data["filename"] = "$v_data[prefix]/$v_data[filename]";
+        }
 
         // ----- Extract the checksum
         $v_header['checksum'] = OctDec(trim($v_data['checksum']));
@@ -1313,20 +1753,25 @@ class Archive_Tar // extends PEAR
             $v_header['filename'] = '';
 
             // ----- Look for last block (empty block)
-            if (($v_checksum == 256) && ($v_header['checksum'] == 0))
+            if (($v_checksum == 256) && ($v_header['checksum'] == 0)) {
                 return true;
+            }
 
-            $this->_error('Invalid checksum for file "'.$v_data['filename']
-			              .'" : '.$v_checksum.' calculated, '
-						  .$v_header['checksum'].' expected');
+            $this->_error(
+                'Invalid checksum for file "' . $v_data['filename']
+                . '" : ' . $v_checksum . ' calculated, '
+                . $v_header['checksum'] . ' expected'
+            );
             return false;
         }
 
         // ----- Extract the properties
-        $v_header['filename'] = trim($v_data['filename']);
+        $v_header['filename'] = rtrim($v_data['filename'], "\0");
         if ($this->_maliciousFilename($v_header['filename'])) {
-            $this->_error('Malicious .tar detected, file "' . $v_header['filename'] .
-                '" will not install in desired directory tree');
+            $this->_error(
+                'Malicious .tar detected, file "' . $v_header['filename'] .
+                '" will not install in desired directory tree'
+            );
             return false;
         }
         $v_header['mode'] = OctDec(trim($v_data['mode']));
@@ -1335,11 +1780,11 @@ class Archive_Tar // extends PEAR
         $v_header['size'] = OctDec(trim($v_data['size']));
         $v_header['mtime'] = OctDec(trim($v_data['mtime']));
         if (($v_header['typeflag'] = $v_data['typeflag']) == "5") {
-          $v_header['size'] = 0;
+            $v_header['size'] = 0;
         }
         $v_header['link'] = trim($v_data['link']);
         /* ----- All these fields are removed form the header because
-		they do not carry interesting info
+        they do not carry interesting info
         $v_header[magic] = trim($v_data[magic]);
         $v_header[version] = trim($v_data[version]);
         $v_header[uname] = trim($v_data[uname]);
@@ -1350,17 +1795,15 @@ class Archive_Tar // extends PEAR
 
         return true;
     }
-    // }}}
 
-    // {{{ _maliciousFilename()
     /**
      * Detect and report a malicious file name
      *
      * @param string $file
+     *
      * @return bool
-     * @access private
      */
-    function _maliciousFilename($file)
+    private function _maliciousFilename($file)
     {
         if (strpos($file, '/../') !== false) {
             return true;
@@ -1370,386 +1813,507 @@ class Archive_Tar // extends PEAR
         }
         return false;
     }
-    // }}}
 
-    // {{{ _readLongHeader()
-    function _readLongHeader(&$v_header)
+    /**
+     * @param $v_header
+     * @return bool
+     */
+    public function _readLongHeader(&$v_header)
     {
-      $v_filename = '';
-      $n = floor($v_header['size']/512);
-      for ($i=0; $i<$n; $i++) {
-        $v_content = $this->_readBlock();
-        $v_filename .= $v_content;
-      }
-      if (($v_header['size'] % 512) != 0) {
-        $v_content = $this->_readBlock();
-        $v_filename .= $v_content;
-      }
-
-      // ----- Read the next header
-      $v_binary_data = $this->_readBlock();
-
-      if (!$this->_readHeader($v_binary_data, $v_header))
-        return false;
+        $v_filename = '';
+        $v_filesize = $v_header['size'];
+        $n = floor($v_header['size'] / 512);
+        for ($i = 0; $i < $n; $i++) {
+            $v_content = $this->_readBlock();
+            $v_filename .= $v_content;
+        }
+        if (($v_header['size'] % 512) != 0) {
+            $v_content = $this->_readBlock();
+            $v_filename .= $v_content;
+        }
 
-      $v_filename = trim($v_filename);
-      $v_header['filename'] = $v_filename;
+        // ----- Read the next header
+        $v_binary_data = $this->_readBlock();
+
+        if (!$this->_readHeader($v_binary_data, $v_header)) {
+            return false;
+        }
+
+        $v_filename = rtrim(substr($v_filename, 0, $v_filesize), "\0");
+        $v_header['filename'] = $v_filename;
         if ($this->_maliciousFilename($v_filename)) {
-            $this->_error('Malicious .tar detected, file "' . $v_filename .
-                '" will not install in desired directory tree');
+            $this->_error(
+                'Malicious .tar detected, file "' . $v_filename .
+                '" will not install in desired directory tree'
+            );
             return false;
-      }
+        }
 
-      return true;
+        return true;
     }
-    // }}}
 
-    // {{{ _extractInString()
     /**
-    * This method extract from the archive one file identified by $p_filename.
-    * The return value is a string with the file content, or NULL on error.
-    * @param string $p_filename     The path of the file to extract in a string.
-    * @return                       a string with the file content or NULL.
-    * @access private
-    */
-    function _extractInString($p_filename)
+     * This method extract from the archive one file identified by $p_filename.
+     * The return value is a string with the file content, or null on error.
+     *
+     * @param string $p_filename The path of the file to extract in a string.
+     *
+     * @return a string with the file content or null.
+     */
+    private function _extractInString($p_filename)
     {
         $v_result_str = "";
 
-        While (strlen($v_binary_data = $this->_readBlock()) != 0)
-        {
-          if (!$this->_readHeader($v_binary_data, $v_header))
-            return NULL;
-
-          if ($v_header['filename'] == '')
-            continue;
-
-          // ----- Look for long filename
-          if ($v_header['typeflag'] == 'L') {
-            if (!$this->_readLongHeader($v_header))
-              return NULL;
-          }
-
-          if ($v_header['filename'] == $p_filename) {
-              if ($v_header['typeflag'] == "5") {
-                  $this->_error('Unable to extract in string a directory '
-				                .'entry {'.$v_header['filename'].'}');
-                  return NULL;
-              } else {
-                  $n = floor($v_header['size']/512);
-                  for ($i=0; $i<$n; $i++) {
-                      $v_result_str .= $this->_readBlock();
-                  }
-                  if (($v_header['size'] % 512) != 0) {
-                      $v_content = $this->_readBlock();
-                      $v_result_str .= substr($v_content, 0,
-					                          ($v_header['size'] % 512));
-                  }
-                  return $v_result_str;
-              }
-          } else {
-              $this->_jumpBlock(ceil(($v_header['size']/512)));
-          }
-        }
-
-        return NULL;
-    }
-    // }}}
+        while (strlen($v_binary_data = $this->_readBlock()) != 0) {
+            if (!$this->_readHeader($v_binary_data, $v_header)) {
+                return null;
+            }
 
-    // {{{ _extractList()
-    function _extractList($p_path, &$p_list_detail, $p_mode,
-	                      $p_file_list, $p_remove_path)
-    {
-    $v_result=true;
-    $v_nb = 0;
-    $v_extract_all = true;
-    $v_listing = false;
-
-    $p_path = $this->_translateWinPath($p_path, false);
-    if ($p_path == '' || (substr($p_path, 0, 1) != '/'
-	    && substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) {
-      $p_path = "./".$p_path;
-    }
-    $p_remove_path = $this->_translateWinPath($p_remove_path);
-
-    // ----- Look for path to remove format (should end by /)
-    if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/'))
-      $p_remove_path .= '/';
-    $p_remove_path_size = strlen($p_remove_path);
-
-    switch ($p_mode) {
-      case "complete" :
-        $v_extract_all = TRUE;
-        $v_listing = FALSE;
-      break;
-      case "partial" :
-          $v_extract_all = FALSE;
-          $v_listing = FALSE;
-      break;
-      case "list" :
-          $v_extract_all = FALSE;
-          $v_listing = TRUE;
-      break;
-      default :
-        $this->_error('Invalid extract mode ('.$p_mode.')');
-        return false;
+            if ($v_header['filename'] == '') {
+                continue;
+            }
+
+            // ----- Look for long filename
+            if ($v_header['typeflag'] == 'L') {
+                if (!$this->_readLongHeader($v_header)) {
+                    return null;
+                }
+            }
+
+            if ($v_header['filename'] == $p_filename) {
+                if ($v_header['typeflag'] == "5") {
+                    $this->_error(
+                        'Unable to extract in string a directory '
+                        . 'entry {' . $v_header['filename'] . '}'
+                    );
+                    return null;
+                } else {
+                    $n = floor($v_header['size'] / 512);
+                    for ($i = 0; $i < $n; $i++) {
+                        $v_result_str .= $this->_readBlock();
+                    }
+                    if (($v_header['size'] % 512) != 0) {
+                        $v_content = $this->_readBlock();
+                        $v_result_str .= substr(
+                            $v_content,
+                            0,
+                            ($v_header['size'] % 512)
+                        );
+                    }
+                    return $v_result_str;
+                }
+            } else {
+                $this->_jumpBlock(ceil(($v_header['size'] / 512)));
+            }
+        }
+
+        return null;
     }
 
-    clearstatcache();
+    /**
+     * @param string $p_path
+     * @param string $p_list_detail
+     * @param string $p_mode
+     * @param string $p_file_list
+     * @param string $p_remove_path
+     * @param bool $p_preserve
+     * @return bool
+     */
+    public function _extractList(
+        $p_path,
+        &$p_list_detail,
+        $p_mode,
+        $p_file_list,
+        $p_remove_path,
+        $p_preserve = false
+    ) {
+        $v_result = true;
+        $v_nb = 0;
+        $v_extract_all = true;
+        $v_listing = false;
+
+        $p_path = $this->_translateWinPath($p_path, false);
+        if ($p_path == '' || (substr($p_path, 0, 1) != '/'
+                && substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))
+        ) {
+            $p_path = "./" . $p_path;
+        }
+        $p_remove_path = $this->_translateWinPath($p_remove_path);
+
+        // ----- Look for path to remove format (should end by /)
+        if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/')) {
+            $p_remove_path .= '/';
+        }
+        $p_remove_path_size = strlen($p_remove_path);
 
-    while (strlen($v_binary_data = $this->_readBlock()) != 0)
-    {
-      $v_extract_file = FALSE;
-      $v_extraction_stopped = 0;
+        switch ($p_mode) {
+            case "complete" :
+                $v_extract_all = true;
+                $v_listing = false;
+                break;
+            case "partial" :
+                $v_extract_all = false;
+                $v_listing = false;
+                break;
+            case "list" :
+                $v_extract_all = false;
+                $v_listing = true;
+                break;
+            default :
+                $this->_error('Invalid extract mode (' . $p_mode . ')');
+                return false;
+        }
 
-      if (!$this->_readHeader($v_binary_data, $v_header))
-        return false;
+        clearstatcache();
 
-      if ($v_header['filename'] == '') {
-        continue;
-      }
-
-      // ----- Look for long filename
-      if ($v_header['typeflag'] == 'L') {
-        if (!$this->_readLongHeader($v_header))
-          return false;
-      }
-
-      if ((!$v_extract_all) && (is_array($p_file_list))) {
-        // ----- By default no unzip if the file is not found
-        $v_extract_file = false;
-
-        for ($i=0; $i<sizeof($p_file_list); $i++) {
-          // ----- Look if it is a directory
-          if (substr($p_file_list[$i], -1) == '/') {
-            // ----- Look if the directory is in the filename path
-            if ((strlen($v_header['filename']) > strlen($p_file_list[$i]))
-			    && (substr($v_header['filename'], 0, strlen($p_file_list[$i]))
-				    == $p_file_list[$i])) {
-              $v_extract_file = TRUE;
-              break;
+        while (strlen($v_binary_data = $this->_readBlock()) != 0) {
+            $v_extract_file = false;
+            $v_extraction_stopped = 0;
+
+            if (!$this->_readHeader($v_binary_data, $v_header)) {
+                return false;
+            }
+
+            if ($v_header['filename'] == '') {
+                continue;
             }
-          }
-
-          // ----- It is a file, so compare the file names
-          elseif ($p_file_list[$i] == $v_header['filename']) {
-            $v_extract_file = TRUE;
-            break;
-          }
-        }
-      } else {
-        $v_extract_file = TRUE;
-      }
-
-      // ----- Look if this file need to be extracted
-      if (($v_extract_file) && (!$v_listing))
-      {
-        if (($p_remove_path != '')
-            && (substr($v_header['filename'], 0, $p_remove_path_size)
-			    == $p_remove_path))
-          $v_header['filename'] = substr($v_header['filename'],
-		                                 $p_remove_path_size);
-        if (($p_path != './') && ($p_path != '/')) {
-          while (substr($p_path, -1) == '/')
-            $p_path = substr($p_path, 0, strlen($p_path)-1);
-
-          if (substr($v_header['filename'], 0, 1) == '/')
-              $v_header['filename'] = $p_path.$v_header['filename'];
-          else
-            $v_header['filename'] = $p_path.'/'.$v_header['filename'];
-        }
-        if (file_exists($v_header['filename'])) {
-          if (   (@is_dir($v_header['filename']))
-		      && ($v_header['typeflag'] == '')) {
-            $this->_error('File '.$v_header['filename']
-			              .' already exists as a directory');
-            return false;
-          }
-          if (   ($this->_isArchive($v_header['filename']))
-		      && ($v_header['typeflag'] == "5")) {
-            $this->_error('Directory '.$v_header['filename']
-			              .' already exists as a file');
-            return false;
-          }
-          if (!is_writeable($v_header['filename'])) {
-            $this->_error('File '.$v_header['filename']
-			              .' already exists and is write protected');
-            return false;
-          }
-          if (filemtime($v_header['filename']) > $v_header['mtime']) {
-            // To be completed : An error or silent no replace ?
-          }
-        }
-
-        // ----- Check the directory availability and create it if necessary
-        elseif (($v_result
-		         = $this->_dirCheck(($v_header['typeflag'] == "5"
-				                    ?$v_header['filename']
-									:dirname($v_header['filename'])))) != 1) {
-            $this->_error('Unable to create path for '.$v_header['filename']);
-            return false;
-        }
 
-        if ($v_extract_file) {
-          if ($v_header['typeflag'] == "5") {
-            if (!@file_exists($v_header['filename'])) {
-                // Drupal integration.
-                // Changed the code to use drupal_mkdir() instead of mkdir().
-                if (!@drupal_mkdir($v_header['filename'], 0777)) {
-                    $this->_error('Unable to create directory {'
-					              .$v_header['filename'].'}');
+            // ----- Look for long filename
+            if ($v_header['typeflag'] == 'L') {
+                if (!$this->_readLongHeader($v_header)) {
                     return false;
                 }
             }
-          } elseif ($v_header['typeflag'] == "2") {
-              if (@file_exists($v_header['filename'])) {
-                  @drupal_unlink($v_header['filename']);
-              }
-              if (!@symlink($v_header['link'], $v_header['filename'])) {
-                  $this->_error('Unable to extract symbolic link {'
-                                .$v_header['filename'].'}');
-                  return false;
-              }
-          } else {
-              if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) {
-                  $this->_error('Error while opening {'.$v_header['filename']
-				                .'} in write binary mode');
-                  return false;
-              } else {
-                  $n = floor($v_header['size']/512);
-                  for ($i=0; $i<$n; $i++) {
-                      $v_content = $this->_readBlock();
-                      fwrite($v_dest_file, $v_content, 512);
-                  }
-            if (($v_header['size'] % 512) != 0) {
-              $v_content = $this->_readBlock();
-              fwrite($v_dest_file, $v_content, ($v_header['size'] % 512));
-            }
 
-            @fclose($v_dest_file);
+            // ignore extended / pax headers
+            if ($v_header['typeflag'] == 'x' || $v_header['typeflag'] == 'g') {
+                $this->_jumpBlock(ceil(($v_header['size'] / 512)));
+                continue;
+            }
 
-            // ----- Change the file mode, mtime
-            @touch($v_header['filename'], $v_header['mtime']);
-            if ($v_header['mode'] & 0111) {
-                // make file executable, obey umask
-                $mode = fileperms($v_header['filename']) | (~umask() & 0111);
-                @chmod($v_header['filename'], $mode);
+            if ((!$v_extract_all) && (is_array($p_file_list))) {
+                // ----- By default no unzip if the file is not found
+                $v_extract_file = false;
+
+                for ($i = 0; $i < sizeof($p_file_list); $i++) {
+                    // ----- Look if it is a directory
+                    if (substr($p_file_list[$i], -1) == '/') {
+                        // ----- Look if the directory is in the filename path
+                        if ((strlen($v_header['filename']) > strlen($p_file_list[$i]))
+                            && (substr($v_header['filename'], 0, strlen($p_file_list[$i]))
+                                == $p_file_list[$i])
+                        ) {
+                            $v_extract_file = true;
+                            break;
+                        }
+                    } // ----- It is a file, so compare the file names
+                    elseif ($p_file_list[$i] == $v_header['filename']) {
+                        $v_extract_file = true;
+                        break;
+                    }
+                }
+            } else {
+                $v_extract_file = true;
             }
-          }
-
-          // ----- Check the file size
-          clearstatcache();
-          if (filesize($v_header['filename']) != $v_header['size']) {
-              $this->_error('Extracted file '.$v_header['filename']
-			                .' does not have the correct file size \''
-							.filesize($v_header['filename'])
-							.'\' ('.$v_header['size']
-							.' expected). Archive may be corrupted.');
-              return false;
-          }
-          }
-        } else {
-          $this->_jumpBlock(ceil(($v_header['size']/512)));
-        }
-      } else {
-          $this->_jumpBlock(ceil(($v_header['size']/512)));
-      }
 
-      /* TBC : Seems to be unused ...
-      if ($this->_compress)
-        $v_end_of_file = @gzeof($this->_file);
-      else
-        $v_end_of_file = @feof($this->_file);
-        */
+            // ----- Look if this file need to be extracted
+            if (($v_extract_file) && (!$v_listing)) {
+                if (($p_remove_path != '')
+                    && (substr($v_header['filename'] . '/', 0, $p_remove_path_size)
+                        == $p_remove_path)
+                ) {
+                    $v_header['filename'] = substr(
+                        $v_header['filename'],
+                        $p_remove_path_size
+                    );
+                    if ($v_header['filename'] == '') {
+                        continue;
+                    }
+                }
+                if (($p_path != './') && ($p_path != '/')) {
+                    while (substr($p_path, -1) == '/') {
+                        $p_path = substr($p_path, 0, strlen($p_path) - 1);
+                    }
 
-      if ($v_listing || $v_extract_file || $v_extraction_stopped) {
-        // ----- Log extracted files
-        if (($v_file_dir = dirname($v_header['filename']))
-		    == $v_header['filename'])
-          $v_file_dir = '';
-        if ((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == ''))
-          $v_file_dir = '/';
+                    if (substr($v_header['filename'], 0, 1) == '/') {
+                        $v_header['filename'] = $p_path . $v_header['filename'];
+                    } else {
+                        $v_header['filename'] = $p_path . '/' . $v_header['filename'];
+                    }
+                }
+                if (file_exists($v_header['filename'])) {
+                    if ((@is_dir($v_header['filename']))
+                        && ($v_header['typeflag'] == '')
+                    ) {
+                        $this->_error(
+                            'File ' . $v_header['filename']
+                            . ' already exists as a directory'
+                        );
+                        return false;
+                    }
+                    if (($this->_isArchive($v_header['filename']))
+                        && ($v_header['typeflag'] == "5")
+                    ) {
+                        $this->_error(
+                            'Directory ' . $v_header['filename']
+                            . ' already exists as a file'
+                        );
+                        return false;
+                    }
+                    if (!is_writeable($v_header['filename'])) {
+                        $this->_error(
+                            'File ' . $v_header['filename']
+                            . ' already exists and is write protected'
+                        );
+                        return false;
+                    }
+                    if (filemtime($v_header['filename']) > $v_header['mtime']) {
+                        // To be completed : An error or silent no replace ?
+                    }
+                } // ----- Check the directory availability and create it if necessary
+                elseif (($v_result
+                        = $this->_dirCheck(
+                        ($v_header['typeflag'] == "5"
+                            ? $v_header['filename']
+                            : dirname($v_header['filename']))
+                    )) != 1
+                ) {
+                    $this->_error('Unable to create path for ' . $v_header['filename']);
+                    return false;
+                }
 
-        $p_list_detail[$v_nb++] = $v_header;
-        if (is_array($p_file_list) && (count($p_list_detail) == count($p_file_list))) {
-            return true;
+                if ($v_extract_file) {
+                    if ($v_header['typeflag'] == "5") {
+                        if (!@file_exists($v_header['filename'])) {
+                            if (!@mkdir($v_header['filename'], 0777)) {
+                                $this->_error(
+                                    'Unable to create directory {'
+                                    . $v_header['filename'] . '}'
+                                );
+                                return false;
+                            }
+                        }
+                    } elseif ($v_header['typeflag'] == "2") {
+                        if (@file_exists($v_header['filename'])) {
+                            @drupal_unlink($v_header['filename']);
+                        }
+                        if (!@symlink($v_header['link'], $v_header['filename'])) {
+                            $this->_error(
+                                'Unable to extract symbolic link {'
+                                . $v_header['filename'] . '}'
+                            );
+                            return false;
+                        }
+                    } else {
+                        if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) {
+                            $this->_error(
+                                'Error while opening {' . $v_header['filename']
+                                . '} in write binary mode'
+                            );
+                            return false;
+                        } else {
+                            $n = floor($v_header['size'] / 512);
+                            for ($i = 0; $i < $n; $i++) {
+                                $v_content = $this->_readBlock();
+                                fwrite($v_dest_file, $v_content, 512);
+                            }
+                            if (($v_header['size'] % 512) != 0) {
+                                $v_content = $this->_readBlock();
+                                fwrite($v_dest_file, $v_content, ($v_header['size'] % 512));
+                            }
+
+                            @fclose($v_dest_file);
+
+                            if ($p_preserve) {
+                                @chown($v_header['filename'], $v_header['uid']);
+                                @chgrp($v_header['filename'], $v_header['gid']);
+                            }
+
+                            // ----- Change the file mode, mtime
+                            @touch($v_header['filename'], $v_header['mtime']);
+                            if ($v_header['mode'] & 0111) {
+                                // make file executable, obey umask
+                                $mode = fileperms($v_header['filename']) | (~umask() & 0111);
+                                @chmod($v_header['filename'], $mode);
+                            }
+                        }
+
+                        // ----- Check the file size
+                        clearstatcache();
+                        if (!is_file($v_header['filename'])) {
+                            $this->_error(
+                                'Extracted file ' . $v_header['filename']
+                                . 'does not exist. Archive may be corrupted.'
+                            );
+                            return false;
+                        }
+
+                        $filesize = filesize($v_header['filename']);
+                        if ($filesize != $v_header['size']) {
+                            $this->_error(
+                                'Extracted file ' . $v_header['filename']
+                                . ' does not have the correct file size \''
+                                . $filesize
+                                . '\' (' . $v_header['size']
+                                . ' expected). Archive may be corrupted.'
+                            );
+                            return false;
+                        }
+                    }
+                } else {
+                    $this->_jumpBlock(ceil(($v_header['size'] / 512)));
+                }
+            } else {
+                $this->_jumpBlock(ceil(($v_header['size'] / 512)));
+            }
+
+            /* TBC : Seems to be unused ...
+            if ($this->_compress)
+              $v_end_of_file = @gzeof($this->_file);
+            else
+              $v_end_of_file = @feof($this->_file);
+              */
+
+            if ($v_listing || $v_extract_file || $v_extraction_stopped) {
+                // ----- Log extracted files
+                if (($v_file_dir = dirname($v_header['filename']))
+                    == $v_header['filename']
+                ) {
+                    $v_file_dir = '';
+                }
+                if ((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == '')) {
+                    $v_file_dir = '/';
+                }
+
+                $p_list_detail[$v_nb++] = $v_header;
+                if (is_array($p_file_list) && (count($p_list_detail) == count($p_file_list))) {
+                    return true;
+                }
+            }
         }
-      }
-    }
 
         return true;
     }
-    // }}}
 
-    // {{{ _openAppend()
-    function _openAppend()
+    /**
+     * @return bool
+     */
+    public function _openAppend()
     {
-        if (filesize($this->_tarname) == 0)
-          return $this->_openWrite();
+        if (filesize($this->_tarname) == 0) {
+            return $this->_openWrite();
+        }
 
         if ($this->_compress) {
             $this->_close();
 
-            if (!@rename($this->_tarname, $this->_tarname.".tmp")) {
-                $this->_error('Error while renaming \''.$this->_tarname
-				              .'\' to temporary file \''.$this->_tarname
-							  .'.tmp\'');
+            if (!@rename($this->_tarname, $this->_tarname . ".tmp")) {
+                $this->_error(
+                    'Error while renaming \'' . $this->_tarname
+                    . '\' to temporary file \'' . $this->_tarname
+                    . '.tmp\''
+                );
                 return false;
             }
 
-            if ($this->_compress_type == 'gz')
-                $v_temp_tar = @gzopen($this->_tarname.".tmp", "rb");
-            elseif ($this->_compress_type == 'bz2')
-                $v_temp_tar = @bzopen($this->_tarname.".tmp", "r");
+            if ($this->_compress_type == 'gz') {
+                $v_temp_tar = @gzopen($this->_tarname . ".tmp", "rb");
+            } elseif ($this->_compress_type == 'bz2') {
+                $v_temp_tar = @bzopen($this->_tarname . ".tmp", "r");
+            } elseif ($this->_compress_type == 'lzma2') {
+                $v_temp_tar = @xzopen($this->_tarname . ".tmp", "r");
+            }
+
 
             if ($v_temp_tar == 0) {
-                $this->_error('Unable to open file \''.$this->_tarname
-				              .'.tmp\' in binary read mode');
-                @rename($this->_tarname.".tmp", $this->_tarname);
+                $this->_error(
+                    'Unable to open file \'' . $this->_tarname
+                    . '.tmp\' in binary read mode'
+                );
+                @rename($this->_tarname . ".tmp", $this->_tarname);
                 return false;
             }
 
             if (!$this->_openWrite()) {
-                @rename($this->_tarname.".tmp", $this->_tarname);
+                @rename($this->_tarname . ".tmp", $this->_tarname);
                 return false;
             }
 
             if ($this->_compress_type == 'gz') {
+                $end_blocks = 0;
+
                 while (!@gzeof($v_temp_tar)) {
                     $v_buffer = @gzread($v_temp_tar, 512);
-                    if ($v_buffer == ARCHIVE_TAR_END_BLOCK) {
+                    if ($v_buffer == ARCHIVE_TAR_END_BLOCK || strlen($v_buffer) == 0) {
+                        $end_blocks++;
                         // do not copy end blocks, we will re-make them
                         // after appending
                         continue;
+                    } elseif ($end_blocks > 0) {
+                        for ($i = 0; $i < $end_blocks; $i++) {
+                            $this->_writeBlock(ARCHIVE_TAR_END_BLOCK);
+                        }
+                        $end_blocks = 0;
                     }
                     $v_binary_data = pack("a512", $v_buffer);
                     $this->_writeBlock($v_binary_data);
                 }
 
                 @gzclose($v_temp_tar);
-            }
-            elseif ($this->_compress_type == 'bz2') {
+            } elseif ($this->_compress_type == 'bz2') {
+                $end_blocks = 0;
+
                 while (strlen($v_buffer = @bzread($v_temp_tar, 512)) > 0) {
-                    if ($v_buffer == ARCHIVE_TAR_END_BLOCK) {
+                    if ($v_buffer == ARCHIVE_TAR_END_BLOCK || strlen($v_buffer) == 0) {
+                        $end_blocks++;
+                        // do not copy end blocks, we will re-make them
+                        // after appending
                         continue;
+                    } elseif ($end_blocks > 0) {
+                        for ($i = 0; $i < $end_blocks; $i++) {
+                            $this->_writeBlock(ARCHIVE_TAR_END_BLOCK);
+                        }
+                        $end_blocks = 0;
                     }
                     $v_binary_data = pack("a512", $v_buffer);
                     $this->_writeBlock($v_binary_data);
                 }
 
                 @bzclose($v_temp_tar);
-            }
+            } elseif ($this->_compress_type == 'lzma2') {
+                $end_blocks = 0;
+
+                while (strlen($v_buffer = @xzread($v_temp_tar, 512)) > 0) {
+                    if ($v_buffer == ARCHIVE_TAR_END_BLOCK || strlen($v_buffer) == 0) {
+                        $end_blocks++;
+                        // do not copy end blocks, we will re-make them
+                        // after appending
+                        continue;
+                    } elseif ($end_blocks > 0) {
+                        for ($i = 0; $i < $end_blocks; $i++) {
+                            $this->_writeBlock(ARCHIVE_TAR_END_BLOCK);
+                        }
+                        $end_blocks = 0;
+                    }
+                    $v_binary_data = pack("a512", $v_buffer);
+                    $this->_writeBlock($v_binary_data);
+                }
 
-            if (!@drupal_unlink($this->_tarname.".tmp")) {
-                $this->_error('Error while deleting temporary file \''
-				              .$this->_tarname.'.tmp\'');
+                @xzclose($v_temp_tar);
             }
 
+            if (!@drupal_unlink($this->_tarname . ".tmp")) {
+                $this->_error(
+                    'Error while deleting temporary file \''
+                    . $this->_tarname . '.tmp\''
+                );
+            }
         } else {
             // ----- For not compressed tar, just add files before the last
-			//       one or two 512 bytes block
-            if (!$this->_openReadWrite())
-               return false;
+            //       one or two 512 bytes block
+            if (!$this->_openReadWrite()) {
+                return false;
+            }
 
             clearstatcache();
             $v_size = filesize($this->_tarname);
@@ -1760,32 +2324,34 @@ class Archive_Tar // extends PEAR
             fseek($this->_file, $v_size - 1024);
             if (fread($this->_file, 512) == ARCHIVE_TAR_END_BLOCK) {
                 fseek($this->_file, $v_size - 1024);
-            }
-            elseif (fread($this->_file, 512) == ARCHIVE_TAR_END_BLOCK) {
+            } elseif (fread($this->_file, 512) == ARCHIVE_TAR_END_BLOCK) {
                 fseek($this->_file, $v_size - 512);
             }
         }
 
         return true;
     }
-    // }}}
 
-    // {{{ _append()
-    function _append($p_filelist, $p_add_dir='', $p_remove_dir='')
+    /**
+     * @param $p_filelist
+     * @param string $p_add_dir
+     * @param string $p_remove_dir
+     * @return bool
+     */
+    public function _append($p_filelist, $p_add_dir = '', $p_remove_dir = '')
     {
-        if (!$this->_openAppend())
+        if (!$this->_openAppend()) {
             return false;
+        }
 
-        if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir))
-           $this->_writeFooter();
+        if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir)) {
+            $this->_writeFooter();
+        }
 
         $this->_close();
 
         return true;
     }
-    // }}}
-
-    // {{{ _dirCheck()
 
     /**
      * Check if a directory exists and create it (including parent
@@ -1793,24 +2359,25 @@ class Archive_Tar // extends PEAR
      *
      * @param string $p_dir directory to check
      *
-     * @return bool TRUE if the directory exists or was created
+     * @return bool true if the directory exists or was created
      */
-    function _dirCheck($p_dir)
+    public function _dirCheck($p_dir)
     {
         clearstatcache();
-        if ((@is_dir($p_dir)) || ($p_dir == ''))
+        if ((@is_dir($p_dir)) || ($p_dir == '')) {
             return true;
+        }
 
         $p_parent_dir = dirname($p_dir);
 
         if (($p_parent_dir != $p_dir) &&
             ($p_parent_dir != '') &&
-            (!$this->_dirCheck($p_parent_dir)))
-             return false;
+            (!$this->_dirCheck($p_parent_dir))
+        ) {
+            return false;
+        }
 
-        // Drupal integration.
-        // Changed the code to use drupal_mkdir() instead of mkdir().
-        if (!@drupal_mkdir($p_dir, 0777)) {
+        if (!@mkdir($p_dir, 0777)) {
             $this->_error("Unable to create directory '$p_dir'");
             return false;
         }
@@ -1818,10 +2385,6 @@ class Archive_Tar // extends PEAR
         return true;
     }
 
-    // }}}
-
-    // {{{ _pathReduction()
-
     /**
      * Compress path by changing for example "/dir/foo/../bar" to "/dir/bar",
      * rand emove double slashes.
@@ -1829,11 +2392,8 @@ class Archive_Tar // extends PEAR
      * @param string $p_dir path to reduce
      *
      * @return string reduced path
-     *
-     * @access private
-     *
      */
-    function _pathReduction($p_dir)
+    private function _pathReduction($p_dir)
     {
         $v_result = '';
 
@@ -1843,50 +2403,57 @@ class Archive_Tar // extends PEAR
             $v_list = explode('/', $p_dir);
 
             // ----- Study directories from last to first
-            for ($i=sizeof($v_list)-1; $i>=0; $i--) {
+            for ($i = sizeof($v_list) - 1; $i >= 0; $i--) {
                 // ----- Look for current path
                 if ($v_list[$i] == ".") {
                     // ----- Ignore this directory
                     // Should be the first $i=0, but no check is done
-                }
-                else if ($v_list[$i] == "..") {
-                    // ----- Ignore it and ignore the $i-1
-                    $i--;
-                }
-                else if (   ($v_list[$i] == '')
-				         && ($i!=(sizeof($v_list)-1))
-						 && ($i!=0)) {
-                    // ----- Ignore only the double '//' in path,
-                    // but not the first and last /
                 } else {
-                    $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?'/'
-					            .$v_result:'');
+                    if ($v_list[$i] == "..") {
+                        // ----- Ignore it and ignore the $i-1
+                        $i--;
+                    } else {
+                        if (($v_list[$i] == '')
+                            && ($i != (sizeof($v_list) - 1))
+                            && ($i != 0)
+                        ) {
+                            // ----- Ignore only the double '//' in path,
+                            // but not the first and last /
+                        } else {
+                            $v_result = $v_list[$i] . ($i != (sizeof($v_list) - 1) ? '/'
+                                    . $v_result : '');
+                        }
+                    }
                 }
             }
         }
-        $v_result = strtr($v_result, '\\', '/');
+
+        if (defined('OS_WINDOWS') && OS_WINDOWS) {
+            $v_result = strtr($v_result, '\\', '/');
+        }
+
         return $v_result;
     }
 
-    // }}}
-
-    // {{{ _translateWinPath()
-    function _translateWinPath($p_path, $p_remove_disk_letter=true)
+    /**
+     * @param $p_path
+     * @param bool $p_remove_disk_letter
+     * @return string
+     */
+    public function _translateWinPath($p_path, $p_remove_disk_letter = true)
     {
-      if (defined('OS_WINDOWS') && OS_WINDOWS) {
-          // ----- Look for potential disk letter
-          if (   ($p_remove_disk_letter)
-		      && (($v_position = strpos($p_path, ':')) != false)) {
-              $p_path = substr($p_path, $v_position+1);
-          }
-          // ----- Change potential windows directory separator
-          if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
-              $p_path = strtr($p_path, '\\', '/');
-          }
-      }
-      return $p_path;
+        if (defined('OS_WINDOWS') && OS_WINDOWS) {
+            // ----- Look for potential disk letter
+            if (($p_remove_disk_letter)
+                && (($v_position = strpos($p_path, ':')) != false)
+            ) {
+                $p_path = substr($p_path, $v_position + 1);
+            }
+            // ----- Change potential windows directory separator
+            if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) {
+                $p_path = strtr($p_path, '\\', '/');
+            }
+        }
+        return $p_path;
     }
-    // }}}
-
 }
-?>
diff --git a/modules/system/system.test b/modules/system/system.test
index 2865bbb2526ce3b3ae4889d7814688de56da25ca..bc764dde5bb863ff445cbe44186fbe93819f1229 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -905,6 +905,29 @@ class CronRunTestCase extends DrupalWebTestCase {
     $result = variable_get('common_test_cron');
     $this->assertEqual($result, 'success', 'Cron correctly handles exceptions thrown during hook_cron() invocations.');
   }
+
+  /**
+   * Tests that hook_flush_caches() is not invoked on every single cron run.
+   *
+   * @see system_cron()
+   */
+  public function testCronCacheExpiration() {
+    module_enable(array('system_cron_test'));
+    variable_del('system_cron_test_flush_caches');
+
+    // Invoke cron the first time: hook_flush_caches() should be called and then
+    // get cached.
+    drupal_cron_run();
+    $this->assertEqual(variable_get('system_cron_test_flush_caches'), 1, 'hook_flush_caches() was invoked the first time.');
+    $cache = cache_get('system_cache_tables');
+    $this->assertEqual(empty($cache), FALSE, 'Cache is filled with cache table data.');
+
+    // Run cron again and ensure that hook_flush_caches() is not called.
+    variable_del('system_cron_test_flush_caches');
+    drupal_cron_run();
+    $this->assertNull(variable_get('system_cron_test_flush_caches'), 'hook_flush_caches() was not invoked the second time.');
+  }
+
 }
 
 /**
diff --git a/modules/system/tests/system_cron_test.info b/modules/system/tests/system_cron_test.info
new file mode 100644
index 0000000000000000000000000000000000000000..3d171ccc48a83aa59ade213da856424a378d7b95
--- /dev/null
+++ b/modules/system/tests/system_cron_test.info
@@ -0,0 +1,6 @@
+name = System Cron Test
+description = 'Support module for testing the system_cron().'
+package = Testing
+version = VERSION
+core = 7.x
+hidden = TRUE
diff --git a/modules/system/tests/system_cron_test.module b/modules/system/tests/system_cron_test.module
new file mode 100644
index 0000000000000000000000000000000000000000..9ef80e23134ff473140eaa01005cd7bf96db6e8a
--- /dev/null
+++ b/modules/system/tests/system_cron_test.module
@@ -0,0 +1,15 @@
+<?php
+
+/**
+ * @file
+ * Helper module for CronRunTestCase::testCronCacheExpiration().
+ */
+
+/**
+ * Implements hook_flush_caches().
+ */
+function system_cron_test_flush_caches() {
+  // Set a variable to indicate that this hook was invoked.
+  variable_set('system_cron_test_flush_caches', 1);
+  return array();
+}
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index e147c1cab1fb1f818306b3f4ee20b8539a9778f7..554d6d2ab916f39020403fce75d321e7b81a7acf 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -25,7 +25,7 @@ function taxonomy_help($path, $arg) {
       $output .= '<h3>' . t('Uses') . '</h3>';
       $output .= '<dl>';
       $output .= '<dt>' . t('Creating vocabularies') . '</dt>';
-      $output .= '<dd>' . t('Users with sufficient <a href="@perm">permissions</a> can create <em>vocabularies</em> and <em>terms</em> through the <a href="@taxo">Taxonomy page</a>. The page listing the terms provides a drag-and-drop interface for controlling the order of the terms and sub-terms within a vocabulary, in a hierarchical fashion. A <em>controlled vocabulary</em> classifying music by genre with terms and sub-terms could look as follows:', array('@taxo' => url('admin/structure/taxonomy'), '@perm' => url('admin/people/permissions', array('fragment'=>'module-taxonomy'))));
+      $output .= '<dd>' . t('Users with sufficient <a href="@perm">permissions</a> can create <em>vocabularies</em> and <em>terms</em> through the <a href="@taxo">Taxonomy page</a>. The page listing the terms provides a drag-and-drop interface for controlling the order of the terms and sub-terms within a vocabulary, in a hierarchical fashion. A <em>controlled vocabulary</em> classifying music by genre with terms and sub-terms could look as follows:', array('@taxo' => url('admin/structure/taxonomy'), '@perm' => url('admin/people/permissions', array('fragment' => 'module-taxonomy'))));
       $output .= '<ul><li>' . t('<em>vocabulary</em>: Music') . '</li>';
       $output .= '<ul><li>' . t('<em>term</em>: Jazz') . '</li>';
       $output .= '<ul><li>' . t('<em>sub-term</em>: Swing') . '</li>';
diff --git a/modules/user/user.module b/modules/user/user.module
index afb411998799468999e7f78a3b3c89903c03c1bd..c33aa098245fd524a0aa0f67f22510c242803d36 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -958,6 +958,8 @@ function user_search_access() {
  */
 function user_search_execute($keys = NULL, $conditions = NULL) {
   $find = array();
+  // Escape for LIKE matching.
+  $keys = db_like($keys);
   // Replace wildcards with MySQL/PostgreSQL wildcards.
   $keys = preg_replace('!\*+!', '%', $keys);
   $query = db_select('users')->extend('PagerDefault');
@@ -967,13 +969,13 @@ function user_search_execute($keys = NULL, $conditions = NULL) {
     // and they don't need to be restricted to only active users.
     $query->fields('users', array('mail'));
     $query->condition(db_or()->
-      condition('name', '%' . db_like($keys) . '%', 'LIKE')->
-      condition('mail', '%' . db_like($keys) . '%', 'LIKE'));
+      condition('name', '%' . $keys . '%', 'LIKE')->
+      condition('mail', '%' . $keys . '%', 'LIKE'));
   }
   else {
     // Regular users can only search via usernames, and we do not show them
     // blocked accounts.
-    $query->condition('name', '%' . db_like($keys) . '%', 'LIKE')
+    $query->condition('name', '%' . $keys . '%', 'LIKE')
       ->condition('status', 1);
   }
   $uids = $query
@@ -3663,12 +3665,7 @@ function user_form_process_password_confirm($element) {
   );
 
   $element['#attached']['js'][] = drupal_get_path('module', 'user') . '/user.js';
-  // Ensure settings are only added once per page.
-  static $already_added = FALSE;
-  if (!$already_added) {
-    $already_added = TRUE;
-    $element['#attached']['js'][] = array('data' => $js_settings, 'type' => 'setting');
-  }
+  $element['#attached']['js'][] = array('data' => $js_settings, 'type' => 'setting');
 
   return $element;
 }
diff --git a/modules/user/user.test b/modules/user/user.test
index 97d23b44cd04a71c90c88ff044872a2a88b14e55..b9729c507f613b90727a7e5bc97a2f4b5a6da146 100644
--- a/modules/user/user.test
+++ b/modules/user/user.test
@@ -2230,6 +2230,20 @@ class UserUserSearchTestCase extends DrupalWebTestCase {
     $this->drupalPost('search/user/', $edit, t('Search'));
     $this->assertText($keys);
 
+    // Verify that wildcard search works.
+    $keys = $user1->name;
+    $keys = substr($keys, 0, 2) . '*' . substr($keys, 4, 2);
+    $edit = array('keys' => $keys);
+    $this->drupalPost('search/user/', $edit, t('Search'));
+    $this->assertText($user1->name, 'Search for username wildcard resulted in user name on page for administrative user.');
+
+    // Verify that wildcard search works for email.
+    $keys = $user1->mail;
+    $keys = substr($keys, 0, 2) . '*' . substr($keys, 4, 2);
+    $edit = array('keys' => $keys);
+    $this->drupalPost('search/user/', $edit, t('Search'));
+    $this->assertText($user1->name, 'Search for email wildcard resulted in user name on page for administrative user.');
+
     // Create a blocked user.
     $blocked_user = $this->drupalCreateUser();
     $edit = array('status' => 0);
diff --git a/profiles/wcm_base/CHANGELOG.txt b/profiles/wcm_base/CHANGELOG.txt
index f66afaba98b4d3fc5a18bb2dadd55aa09fade65c..eb99c95a1a5b04f7c9e91b3c66d1ed3fbbfc9d49 100644
--- a/profiles/wcm_base/CHANGELOG.txt
+++ b/profiles/wcm_base/CHANGELOG.txt
@@ -1,3 +1,7 @@
+WCM Base 7.x-1.x, 2016-02-05
+----------------------------
+- WCM Base: Drupal core upgraded to 7.42
+
 WCM Base 7.x-1.x, 2016-02-04
 ----------------------------
 - OCIO Media: Patches to allow per-extension file size limits and fix bugs.
diff --git a/profiles/wcm_base/libraries/chosen/.gitignore b/profiles/wcm_base/libraries/chosen/.gitignore
deleted file mode 100644
index 4de164c8375d4935610f552379a0edf9aabf8a33..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
-.DS_Store
-node_modules
-.project
-public/*.js
-public/*.css
-public/bower.json
-chosen.zip
-.sass-cache
-.ruby-version
-.rbenv-gemsets
-.grunt
-_SpecRunner.html
-spec/public
diff --git a/profiles/wcm_base/libraries/chosen/.travis.yml b/profiles/wcm_base/libraries/chosen/.travis.yml
deleted file mode 100644
index 3862043f9cd976dedfc8b6e53cc08e11908c0f02..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/.travis.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-language: node_js
-
-node_js:
-  - "0.10"
-
-before_install:
-  - npm install -g grunt-cli
-  - gem install bundler
-  - bundle install
-before_script: grunt build
-
-after_success: ./bower-publish.sh
-
-env:
-  global:
-    secure: FHc3fAbJDydJywQ3HcFrTxqyAmmKbiAwP5Bi3qIzvXXCKNYbZb45iSjrMPFq7sHQR/evxDKl3zzBd8k6lvx0Sr77GDkmbN7HjI22fb3wu1Pi3WhmIM90/70ATs6hSZunsNEHCtQa4fDFM3NYeOeiwHFX8HQ9tVlqtjeAZngONL8=
diff --git a/profiles/wcm_base/libraries/chosen/Gemfile b/profiles/wcm_base/libraries/chosen/Gemfile
deleted file mode 100644
index e85f28cbaff1cfded6be467a5c00087aa96847e3..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/Gemfile
+++ /dev/null
@@ -1,3 +0,0 @@
-source "https://rubygems.org"
-
-gem 'compass'
diff --git a/profiles/wcm_base/libraries/chosen/Gemfile.lock b/profiles/wcm_base/libraries/chosen/Gemfile.lock
deleted file mode 100644
index b82fc3554b4bbcd60d4d460d627f3a726033cd43..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/Gemfile.lock
+++ /dev/null
@@ -1,16 +0,0 @@
-GEM
-  remote: https://rubygems.org/
-  specs:
-    chunky_png (1.2.8)
-    compass (0.12.2)
-      chunky_png (~> 1.2)
-      fssm (>= 0.2.7)
-      sass (~> 3.1)
-    fssm (0.2.10)
-    sass (3.2.9)
-
-PLATFORMS
-  ruby
-
-DEPENDENCIES
-  compass
diff --git a/profiles/wcm_base/libraries/chosen/Gruntfile.coffee b/profiles/wcm_base/libraries/chosen/Gruntfile.coffee
deleted file mode 100644
index ef2107b7c9d3f3a863522ebd6d0bb2f24d435c92..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/Gruntfile.coffee
+++ /dev/null
@@ -1,155 +0,0 @@
-module.exports = (grunt) ->
-  require('load-grunt-tasks')(grunt);
-
-  version = ->
-    grunt.file.readJSON("package.json").version
-  version_tag = ->
-    "v#{version()}"
-
-  grunt.initConfig
-    pkg: grunt.file.readJSON("package.json")
-    comments: """
-/*!
-Chosen, a Select Box Enhancer for jQuery and Prototype
-by Patrick Filler for Harvest, http://getharvest.com
-
-Version <%= pkg.version %>
-Full source at https://github.com/harvesthq/chosen
-Copyright (c) 2011-<%= grunt.template.today('yyyy') %> Harvest http://getharvest.com
-
-MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
-This file is generated by `grunt build`, do not edit it by hand.
-*/
-\n
-"""
-    minified_comments: "/* Chosen #{version_tag()} | (c) 2011-<%= grunt.template.today('yyyy') %> by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */\n"
-
-    concat:
-      options:
-        banner: "<%= comments %>"
-      jquery:
-        src: ["public/chosen.jquery.js"]
-        dest: "public/chosen.jquery.js"
-      proto:
-        src: ["public/chosen.proto.js"]
-        dest: "public/chosen.proto.js"
-      css:
-        src: ["public/chosen.css"]
-        dest: "public/chosen.css"
-
-    coffee:
-      options:
-        join: true
-      compile:
-        files:
-          'public/chosen.jquery.js': ['coffee/lib/select-parser.coffee', 'coffee/lib/abstract-chosen.coffee', 'coffee/chosen.jquery.coffee']
-          'public/chosen.proto.js': ['coffee/lib/select-parser.coffee', 'coffee/lib/abstract-chosen.coffee', 'coffee/chosen.proto.coffee']
-          'spec/public/jquery_specs.js': 'spec/jquery/*.spec.coffee'
-          'spec/public/proto_specs.js': 'spec/proto/*.spec.coffee'
-
-    uglify:
-      options:
-        mangle:
-          except: ['jQuery', 'AbstractChosen', 'Chosen', 'SelectParser']
-        banner: "<%= minified_comments %>"
-      minified_chosen_js:
-        files:
-          'public/chosen.jquery.min.js': ['public/chosen.jquery.js']
-          'public/chosen.proto.min.js': ['public/chosen.proto.js']
-
-    compass:
-      chosen_css:
-        options:
-          bundleExec: true
-          specify: ['sass/chosen.scss']
-
-    cssmin:
-      minified_chosen_css:
-        options:
-          banner: "<%= minified_comments %>"
-          keepSpecialComments: 0
-        src: 'public/chosen.css'
-        dest: 'public/chosen.min.css'
-
-    watch:
-      scripts:
-        files: ['coffee/**/*.coffee', 'sass/*.scss']
-        tasks: ['build']
-
-    dom_munger:
-      latest_version:
-        src: ['public/index.html', 'public/index.proto.html', 'public/options.html']
-        options:
-          callback: ($) ->
-            $("#latest-version").text(version_tag())
-    zip:
-      chosen:
-        cwd: 'public/'
-        src: ['public/**/*']
-        dest: "chosen_#{version_tag()}.zip"
-
-    'gh-pages':
-      options:
-        base: 'public',
-        message: "Updated to new Chosen version #{version()}"
-      src: ['**']
-
-    jasmine:
-      jquery:
-        src: [ 'public/chosen.jquery.js' ]
-        options:
-          vendor: [ 'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' ]
-          specs: 'spec/public/jquery_specs.js'
-      proto:
-        src: [ 'public/chosen.proto.js' ]
-        options:
-          vendor: [
-            'https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js',
-            'public/docsupport/event.simulate.js'
-          ]
-          specs: 'spec/public/proto_specs.js'
-
-  grunt.registerTask 'default', ['build']
-  grunt.registerTask 'build', ['coffee', 'compass', 'concat', 'uglify', 'cssmin', 'package-bower']
-  grunt.registerTask 'prep-release', ['build', 'dom_munger:latest_version', 'zip:chosen','package-jquery']
-  grunt.registerTask 'test',  ['coffee', 'jasmine']
-
-  grunt.registerTask 'publish-release', ['gh-pages']
-
-  grunt.registerTask 'package-jquery', 'Generate a jquery.json manifest file from package.json', () ->
-    src = "package.json"
-    dest = "chosen.jquery.json"
-    pkg = grunt.file.readJSON(src)
-    json1 =
-      "name": pkg.name
-      "description": pkg.description
-      "version": version()
-      "licenses": pkg.licenses
-    json2 = pkg.jqueryJSON
-    json1[key] = json2[key] for key of json2
-    json1.author.name = pkg.author
-    grunt.file.write('chosen.jquery.json', JSON.stringify(json1, null, 2) + "\n")
-
-  grunt.registerTask 'package-bower', 'Generate a bower.json manifest file from package.json', () ->
-    pkg = grunt.file.readJSON("package.json")
-    bowerjson = pkg.bowerJSON
-    jqueryjson = pkg.jqueryJSON
-
-    bower =
-      "name": pkg.name
-      "description": pkg.description
-      "version": version()
-      "main": bowerjson.main
-      "license": pkg.licenses
-      "ignore": []
-      "keywords": jqueryjson.keywords
-      "authors": jqueryjson.maintainers
-      "homepage": jqueryjson.homepage
-      "repository": pkg.repository
-      "dependencies": jqueryjson.dependencies
-      "devDependencies": []
-
-    grunt.file.write("public/bower.json", JSON.stringify(bower, null, 2) + "\n")
-
-  grunt.registerTask 'cleanup-bower', 'Delete generated bower.json file', () ->
-    grunt.file.delete("public/bower.json")
diff --git a/profiles/wcm_base/libraries/chosen/LICENSE.md b/profiles/wcm_base/libraries/chosen/LICENSE.md
deleted file mode 100644
index 26fa97e46d53cce7861ee23fb30792b03d093dac..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/LICENSE.md
+++ /dev/null
@@ -1,23 +0,0 @@
-#### Chosen
-- by Patrick Filler for [Harvest](http://getharvest.com)
-- Copyright (c) 2011-2015 by Harvest
-
-Available for use under the [MIT License](http://en.wikipedia.org/wiki/MIT_License)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/profiles/wcm_base/libraries/chosen/README.md b/profiles/wcm_base/libraries/chosen/README.md
deleted file mode 100644
index 1550abf829df8a1f7978e0fa703e6547803dae0c..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# Chosen
-
-Chosen is a library for making long, unwieldy select boxes more user friendly.
-
-- jQuery support: 1.4+
-- Prototype support: 1.7+
-
-For **documentation**, usage, and examples, see:
-http://harvesthq.github.io/chosen/
-
-For **downloads**, see:
-https://github.com/harvesthq/chosen/releases/
-
-### Bower Installation
-
-Chosen is available for Bower installation:
-`bower install chosen`
-
-The compiled files for the Bower package are automatically generated and stored in a [2nd Chosen repository](https://github.com/harvesthq/bower-chosen). No pull requests will be accepted to that repository.
-
-### Contributing to this project
-
-We welcome all to participate in making Chosen the best software it can be. The repository is maintained by only a few people, but has accepted contributions from over 50 authors after reviewing hundreds of pull requests related to thousands of issues. You can help reduce the maintainers' workload (and increase your chance of having an accepted contribution to Chosen) by following the
-[guidelines for contributing](contributing.md).
-
-* [Bug reports](contributing.md#bugs)
-* [Feature requests](contributing.md#features)
-* [Pull requests](contributing.md#pull-requests)
-
-### Chosen Credits
-
-- Concept and development by [Patrick Filler](http://patrickfiller.com) for [Harvest](http://getharvest.com/).
-- Design and CSS by [Matthew Lettini](http://matthewlettini.com/)
-- Repository maintained by [@pfiller](http://github.com/pfiller), [@kenearley](http://github.com/kenearley), [@stof](http://github.com/stof), [@koenpunt](http://github.com/koenpunt), and [@tjschuck](http://github.com/tjschuck).
-- Chosen includes [contributions by many fine folks](https://github.com/harvesthq/chosen/contributors).
diff --git a/profiles/wcm_base/libraries/chosen/bower-publish.sh b/profiles/wcm_base/libraries/chosen/bower-publish.sh
deleted file mode 100755
index cb3f56e75b85f2db11c249c056e1607d985a6392..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/bower-publish.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-
-CURRENT_BRANCH=`git name-rev --name-only HEAD`
-
-if [ $CURRENT_BRANCH != 'master' ] ; then
-  echo "Build not on master. Skipped bower-chosen release"
-  exit 0
-fi
-
-git config --global user.email "notmyemail@bower-chosen.lol"
-git config --global user.name "bower-chosen"
-
-git clone https://pfiller:${GH_TOKEN}@github.com/harvesthq/bower-chosen.git
-rm -rf bower-chosen/*
-cp public/bower.json public/*.png public/chosen.jquery.js public/chosen.css bower-chosen/
-cd bower-chosen
-
-LATEST_VERSION=$(git diff bower.json | grep version | cut -d':' -f2 | cut -d'"' -f2 | tail -1)
-
-if [ -z $LATEST_VERSION ] ; then
-  echo "No Chosen version change. Skipped tagging"
-else
-  echo "Chosen version changed. Tagging version ${LATEST_VERSION}\n"
-  git tag -a "v${LATEST_VERSION}" -m "Version ${LATEST_VERSION}"
-fi
-
-git remote set-url origin https://pfiller:${GH_TOKEN}@github.com/harvesthq/bower-chosen.git
-
-git add -A
-git commit -m "Chosen build to bower-chosen"
-git push origin master
-git push origin --tags
-
-echo "Chosen published to harvesthq/bower-chosen"
diff --git a/profiles/wcm_base/libraries/chosen/chosen.jquery.json b/profiles/wcm_base/libraries/chosen/bower.json
similarity index 74%
rename from profiles/wcm_base/libraries/chosen/chosen.jquery.json
rename to profiles/wcm_base/libraries/chosen/bower.json
index 9842a3488fd97952036963a0d39760917b56952c..c1db786a6e92606875f171498a143dc9886fcc8a 100644
--- a/profiles/wcm_base/libraries/chosen/chosen.jquery.json
+++ b/profiles/wcm_base/libraries/chosen/bower.json
@@ -2,13 +2,19 @@
   "name": "chosen",
   "description": "Chosen is a JavaScript plugin that makes long, unwieldy select boxes much more user-friendly. It is currently available in both jQuery and Prototype flavors.",
   "version": "1.4.2",
-  "licenses": [
+  "main": [
+    "chosen.jquery.min.js",
+    "chosen.css",
+    "chosen-sprite@2x.png",
+    "chosen-sprite.png"
+  ],
+  "license": [
     {
       "type": "MIT",
       "url": "https://github.com/harvesthq/chosen/blob/master/LICENSE.md"
     }
   ],
-  "title": "Chosen",
+  "ignore": [],
   "keywords": [
     "select",
     "multiselect",
@@ -17,11 +23,7 @@
     "input",
     "ui"
   ],
-  "author": {
-    "url": "http://getharvest.com",
-    "name": "harvest"
-  },
-  "maintainers": [
+  "authors": [
     {
       "name": "Patrick Filler",
       "url": "https://github.com/pfiller"
@@ -39,11 +41,13 @@
       "url": "https://github.com/koenpunt"
     }
   ],
-  "download": "https://github.com/harvesthq/chosen/releases",
   "homepage": "http://harvesthq.github.io/chosen/",
-  "docs": "http://harvesthq.github.io/chosen/",
-  "bugs": "https://github.com/harvesthq/chosen/issues",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/harvesthq/chosen"
+  },
   "dependencies": {
     "jquery": ">=1.4.4"
-  }
+  },
+  "devDependencies": []
 }
diff --git a/profiles/wcm_base/libraries/chosen/public/chosen-sprite.png b/profiles/wcm_base/libraries/chosen/chosen-sprite.png
similarity index 100%
rename from profiles/wcm_base/libraries/chosen/public/chosen-sprite.png
rename to profiles/wcm_base/libraries/chosen/chosen-sprite.png
diff --git a/profiles/wcm_base/libraries/chosen/public/chosen-sprite@2x.png b/profiles/wcm_base/libraries/chosen/chosen-sprite@2x.png
similarity index 100%
rename from profiles/wcm_base/libraries/chosen/public/chosen-sprite@2x.png
rename to profiles/wcm_base/libraries/chosen/chosen-sprite@2x.png
diff --git a/profiles/wcm_base/libraries/chosen/chosen.css b/profiles/wcm_base/libraries/chosen/chosen.css
new file mode 100644
index 0000000000000000000000000000000000000000..e7ea092259366447a75f7d59947b562818acdfa2
--- /dev/null
+++ b/profiles/wcm_base/libraries/chosen/chosen.css
@@ -0,0 +1,450 @@
+/*!
+Chosen, a Select Box Enhancer for jQuery and Prototype
+by Patrick Filler for Harvest, http://getharvest.com
+
+Version 1.4.2
+Full source at https://github.com/harvesthq/chosen
+Copyright (c) 2011-2015 Harvest http://getharvest.com
+
+MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
+This file is generated by `grunt build`, do not edit it by hand.
+*/
+
+/* @group Base */
+.chosen-container {
+  position: relative;
+  display: inline-block;
+  vertical-align: middle;
+  font-size: 13px;
+  zoom: 1;
+  *display: inline;
+  -webkit-user-select: none;
+  -moz-user-select: none;
+  user-select: none;
+}
+.chosen-container * {
+  -webkit-box-sizing: border-box;
+  -moz-box-sizing: border-box;
+  box-sizing: border-box;
+}
+.chosen-container .chosen-drop {
+  position: absolute;
+  top: 100%;
+  left: -9999px;
+  z-index: 1010;
+  width: 100%;
+  border: 1px solid #aaa;
+  border-top: 0;
+  background: #fff;
+  box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
+}
+.chosen-container.chosen-with-drop .chosen-drop {
+  left: 0;
+}
+.chosen-container a {
+  cursor: pointer;
+}
+.chosen-container .search-choice .group-name, .chosen-container .chosen-single .group-name {
+  margin-right: 4px;
+  overflow: hidden;
+  white-space: nowrap;
+  text-overflow: ellipsis;
+  font-weight: normal;
+  color: #999999;
+}
+.chosen-container .search-choice .group-name:after, .chosen-container .chosen-single .group-name:after {
+  content: ":";
+  padding-left: 2px;
+  vertical-align: top;
+}
+
+/* @end */
+/* @group Single Chosen */
+.chosen-container-single .chosen-single {
+  position: relative;
+  display: block;
+  overflow: hidden;
+  padding: 0 0 0 8px;
+  height: 25px;
+  border: 1px solid #aaa;
+  border-radius: 5px;
+  background-color: #fff;
+  background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
+  background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
+  background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
+  background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
+  background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
+  background-clip: padding-box;
+  box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
+  color: #444;
+  text-decoration: none;
+  white-space: nowrap;
+  line-height: 24px;
+}
+.chosen-container-single .chosen-default {
+  color: #999;
+}
+.chosen-container-single .chosen-single span {
+  display: block;
+  overflow: hidden;
+  margin-right: 26px;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.chosen-container-single .chosen-single-with-deselect span {
+  margin-right: 38px;
+}
+.chosen-container-single .chosen-single abbr {
+  position: absolute;
+  top: 6px;
+  right: 26px;
+  display: block;
+  width: 12px;
+  height: 12px;
+  background: url('chosen-sprite.png') -42px 1px no-repeat;
+  font-size: 1px;
+}
+.chosen-container-single .chosen-single abbr:hover {
+  background-position: -42px -10px;
+}
+.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
+  background-position: -42px -10px;
+}
+.chosen-container-single .chosen-single div {
+  position: absolute;
+  top: 0;
+  right: 0;
+  display: block;
+  width: 18px;
+  height: 100%;
+}
+.chosen-container-single .chosen-single div b {
+  display: block;
+  width: 100%;
+  height: 100%;
+  background: url('chosen-sprite.png') no-repeat 0px 2px;
+}
+.chosen-container-single .chosen-search {
+  position: relative;
+  z-index: 1010;
+  margin: 0;
+  padding: 3px 4px;
+  white-space: nowrap;
+}
+.chosen-container-single .chosen-search input[type="text"] {
+  margin: 1px 0;
+  padding: 4px 20px 4px 5px;
+  width: 100%;
+  height: auto;
+  outline: 0;
+  border: 1px solid #aaa;
+  background: white url('chosen-sprite.png') no-repeat 100% -20px;
+  background: url('chosen-sprite.png') no-repeat 100% -20px;
+  font-size: 1em;
+  font-family: sans-serif;
+  line-height: normal;
+  border-radius: 0;
+}
+.chosen-container-single .chosen-drop {
+  margin-top: -1px;
+  border-radius: 0 0 4px 4px;
+  background-clip: padding-box;
+}
+.chosen-container-single.chosen-container-single-nosearch .chosen-search {
+  position: absolute;
+  left: -9999px;
+}
+
+/* @end */
+/* @group Results */
+.chosen-container .chosen-results {
+  color: #444;
+  position: relative;
+  overflow-x: hidden;
+  overflow-y: auto;
+  margin: 0 4px 4px 0;
+  padding: 0 0 0 4px;
+  max-height: 240px;
+  -webkit-overflow-scrolling: touch;
+}
+.chosen-container .chosen-results li {
+  display: none;
+  margin: 0;
+  padding: 5px 6px;
+  list-style: none;
+  line-height: 15px;
+  word-wrap: break-word;
+  -webkit-touch-callout: none;
+}
+.chosen-container .chosen-results li.active-result {
+  display: list-item;
+  cursor: pointer;
+}
+.chosen-container .chosen-results li.disabled-result {
+  display: list-item;
+  color: #ccc;
+  cursor: default;
+}
+.chosen-container .chosen-results li.highlighted {
+  background-color: #3875d7;
+  background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
+  background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
+  background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
+  background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
+  background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
+  color: #fff;
+}
+.chosen-container .chosen-results li.no-results {
+  color: #777;
+  display: list-item;
+  background: #f4f4f4;
+}
+.chosen-container .chosen-results li.group-result {
+  display: list-item;
+  font-weight: bold;
+  cursor: default;
+}
+.chosen-container .chosen-results li.group-option {
+  padding-left: 15px;
+}
+.chosen-container .chosen-results li em {
+  font-style: normal;
+  text-decoration: underline;
+}
+
+/* @end */
+/* @group Multi Chosen */
+.chosen-container-multi .chosen-choices {
+  position: relative;
+  overflow: hidden;
+  margin: 0;
+  padding: 0 5px;
+  width: 100%;
+  height: auto !important;
+  height: 1%;
+  border: 1px solid #aaa;
+  background-color: #fff;
+  background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
+  background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
+  background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
+  background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
+  background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
+  cursor: text;
+}
+.chosen-container-multi .chosen-choices li {
+  float: left;
+  list-style: none;
+}
+.chosen-container-multi .chosen-choices li.search-field {
+  margin: 0;
+  padding: 0;
+  white-space: nowrap;
+}
+.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
+  margin: 1px 0;
+  padding: 0;
+  height: 25px;
+  outline: 0;
+  border: 0 !important;
+  background: transparent !important;
+  box-shadow: none;
+  color: #999;
+  font-size: 100%;
+  font-family: sans-serif;
+  line-height: normal;
+  border-radius: 0;
+}
+.chosen-container-multi .chosen-choices li.search-choice {
+  position: relative;
+  margin: 3px 5px 3px 0;
+  padding: 3px 20px 3px 5px;
+  border: 1px solid #aaa;
+  max-width: 100%;
+  border-radius: 3px;
+  background-color: #eeeeee;
+  background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
+  background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+  background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+  background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+  background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+  background-size: 100% 19px;
+  background-repeat: repeat-x;
+  background-clip: padding-box;
+  box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
+  color: #333;
+  line-height: 13px;
+  cursor: default;
+}
+.chosen-container-multi .chosen-choices li.search-choice span {
+  word-wrap: break-word;
+}
+.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
+  position: absolute;
+  top: 4px;
+  right: 3px;
+  display: block;
+  width: 12px;
+  height: 12px;
+  background: url('chosen-sprite.png') -42px 1px no-repeat;
+  font-size: 1px;
+}
+.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
+  background-position: -42px -10px;
+}
+.chosen-container-multi .chosen-choices li.search-choice-disabled {
+  padding-right: 5px;
+  border: 1px solid #ccc;
+  background-color: #e4e4e4;
+  background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
+  background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+  background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+  background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+  background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
+  color: #666;
+}
+.chosen-container-multi .chosen-choices li.search-choice-focus {
+  background: #d4d4d4;
+}
+.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
+  background-position: -42px -10px;
+}
+.chosen-container-multi .chosen-results {
+  margin: 0;
+  padding: 0;
+}
+.chosen-container-multi .chosen-drop .result-selected {
+  display: list-item;
+  color: #ccc;
+  cursor: default;
+}
+
+/* @end */
+/* @group Active  */
+.chosen-container-active .chosen-single {
+  border: 1px solid #5897fb;
+  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
+}
+.chosen-container-active.chosen-with-drop .chosen-single {
+  border: 1px solid #aaa;
+  -moz-border-radius-bottomright: 0;
+  border-bottom-right-radius: 0;
+  -moz-border-radius-bottomleft: 0;
+  border-bottom-left-radius: 0;
+  background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
+  background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
+  background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
+  background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
+  background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
+  box-shadow: 0 1px 0 #fff inset;
+}
+.chosen-container-active.chosen-with-drop .chosen-single div {
+  border-left: none;
+  background: transparent;
+}
+.chosen-container-active.chosen-with-drop .chosen-single div b {
+  background-position: -18px 2px;
+}
+.chosen-container-active .chosen-choices {
+  border: 1px solid #5897fb;
+  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
+}
+.chosen-container-active .chosen-choices li.search-field input[type="text"] {
+  color: #222 !important;
+}
+
+/* @end */
+/* @group Disabled Support */
+.chosen-disabled {
+  opacity: 0.5 !important;
+  cursor: default;
+}
+.chosen-disabled .chosen-single {
+  cursor: default;
+}
+.chosen-disabled .chosen-choices .search-choice .search-choice-close {
+  cursor: default;
+}
+
+/* @end */
+/* @group Right to Left */
+.chosen-rtl {
+  text-align: right;
+}
+.chosen-rtl .chosen-single {
+  overflow: visible;
+  padding: 0 8px 0 0;
+}
+.chosen-rtl .chosen-single span {
+  margin-right: 0;
+  margin-left: 26px;
+  direction: rtl;
+}
+.chosen-rtl .chosen-single-with-deselect span {
+  margin-left: 38px;
+}
+.chosen-rtl .chosen-single div {
+  right: auto;
+  left: 3px;
+}
+.chosen-rtl .chosen-single abbr {
+  right: auto;
+  left: 26px;
+}
+.chosen-rtl .chosen-choices li {
+  float: right;
+}
+.chosen-rtl .chosen-choices li.search-field input[type="text"] {
+  direction: rtl;
+}
+.chosen-rtl .chosen-choices li.search-choice {
+  margin: 3px 5px 3px 0;
+  padding: 3px 5px 3px 19px;
+}
+.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
+  right: auto;
+  left: 4px;
+}
+.chosen-rtl.chosen-container-single-nosearch .chosen-search,
+.chosen-rtl .chosen-drop {
+  left: 9999px;
+}
+.chosen-rtl.chosen-container-single .chosen-results {
+  margin: 0 0 4px 4px;
+  padding: 0 4px 0 0;
+}
+.chosen-rtl .chosen-results li.group-option {
+  padding-right: 15px;
+  padding-left: 0;
+}
+.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
+  border-right: none;
+}
+.chosen-rtl .chosen-search input[type="text"] {
+  padding: 4px 5px 4px 20px;
+  background: white url('chosen-sprite.png') no-repeat -30px -20px;
+  background: url('chosen-sprite.png') no-repeat -30px -20px;
+  direction: rtl;
+}
+.chosen-rtl.chosen-container-single .chosen-single div b {
+  background-position: 6px 2px;
+}
+.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
+  background-position: -12px 2px;
+}
+
+/* @end */
+/* @group Retina compatibility */
+@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi), only screen and (min-resolution: 1.5dppx) {
+  .chosen-rtl .chosen-search input[type="text"],
+  .chosen-container-single .chosen-single abbr,
+  .chosen-container-single .chosen-single div b,
+  .chosen-container-single .chosen-search input[type="text"],
+  .chosen-container-multi .chosen-choices .search-choice .search-choice-close,
+  .chosen-container .chosen-results-scroll-down span,
+  .chosen-container .chosen-results-scroll-up span {
+    background-image: url('chosen-sprite@2x.png') !important;
+    background-size: 52px 37px !important;
+    background-repeat: no-repeat !important;
+  }
+}
+/* @end */
diff --git a/profiles/wcm_base/libraries/chosen/chosen.jquery.js b/profiles/wcm_base/libraries/chosen/chosen.jquery.js
new file mode 100644
index 0000000000000000000000000000000000000000..929a9ca214162470281fe25a039b17b1a534b08f
--- /dev/null
+++ b/profiles/wcm_base/libraries/chosen/chosen.jquery.js
@@ -0,0 +1,1257 @@
+/*!
+Chosen, a Select Box Enhancer for jQuery and Prototype
+by Patrick Filler for Harvest, http://getharvest.com
+
+Version 1.4.2
+Full source at https://github.com/harvesthq/chosen
+Copyright (c) 2011-2015 Harvest http://getharvest.com
+
+MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
+This file is generated by `grunt build`, do not edit it by hand.
+*/
+
+(function() {
+  var $, AbstractChosen, Chosen, SelectParser, _ref,
+    __hasProp = {}.hasOwnProperty,
+    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+  SelectParser = (function() {
+    function SelectParser() {
+      this.options_index = 0;
+      this.parsed = [];
+    }
+
+    SelectParser.prototype.add_node = function(child) {
+      if (child.nodeName.toUpperCase() === "OPTGROUP") {
+        return this.add_group(child);
+      } else {
+        return this.add_option(child);
+      }
+    };
+
+    SelectParser.prototype.add_group = function(group) {
+      var group_position, option, _i, _len, _ref, _results;
+      group_position = this.parsed.length;
+      this.parsed.push({
+        array_index: group_position,
+        group: true,
+        label: this.escapeExpression(group.label),
+        title: group.title ? group.title : void 0,
+        children: 0,
+        disabled: group.disabled,
+        classes: group.className
+      });
+      _ref = group.childNodes;
+      _results = [];
+      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+        option = _ref[_i];
+        _results.push(this.add_option(option, group_position, group.disabled));
+      }
+      return _results;
+    };
+
+    SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
+      if (option.nodeName.toUpperCase() === "OPTION") {
+        if (option.text !== "") {
+          if (group_position != null) {
+            this.parsed[group_position].children += 1;
+          }
+          this.parsed.push({
+            array_index: this.parsed.length,
+            options_index: this.options_index,
+            value: option.value,
+            text: option.text,
+            html: option.innerHTML,
+            title: option.title ? option.title : void 0,
+            selected: option.selected,
+            disabled: group_disabled === true ? group_disabled : option.disabled,
+            group_array_index: group_position,
+            group_label: group_position != null ? this.parsed[group_position].label : null,
+            classes: option.className,
+            style: option.style.cssText
+          });
+        } else {
+          this.parsed.push({
+            array_index: this.parsed.length,
+            options_index: this.options_index,
+            empty: true
+          });
+        }
+        return this.options_index += 1;
+      }
+    };
+
+    SelectParser.prototype.escapeExpression = function(text) {
+      var map, unsafe_chars;
+      if ((text == null) || text === false) {
+        return "";
+      }
+      if (!/[\&\<\>\"\'\`]/.test(text)) {
+        return text;
+      }
+      map = {
+        "<": "&lt;",
+        ">": "&gt;",
+        '"': "&quot;",
+        "'": "&#x27;",
+        "`": "&#x60;"
+      };
+      unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
+      return text.replace(unsafe_chars, function(chr) {
+        return map[chr] || "&amp;";
+      });
+    };
+
+    return SelectParser;
+
+  })();
+
+  SelectParser.select_to_array = function(select) {
+    var child, parser, _i, _len, _ref;
+    parser = new SelectParser();
+    _ref = select.childNodes;
+    for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+      child = _ref[_i];
+      parser.add_node(child);
+    }
+    return parser.parsed;
+  };
+
+  AbstractChosen = (function() {
+    function AbstractChosen(form_field, options) {
+      this.form_field = form_field;
+      this.options = options != null ? options : {};
+      if (!AbstractChosen.browser_is_supported()) {
+        return;
+      }
+      this.is_multiple = this.form_field.multiple;
+      this.set_default_text();
+      this.set_default_values();
+      this.setup();
+      this.set_up_html();
+      this.register_observers();
+      this.on_ready();
+    }
+
+    AbstractChosen.prototype.set_default_values = function() {
+      var _this = this;
+      this.click_test_action = function(evt) {
+        return _this.test_active_click(evt);
+      };
+      this.activate_action = function(evt) {
+        return _this.activate_field(evt);
+      };
+      this.active_field = false;
+      this.mouse_on_container = false;
+      this.results_showing = false;
+      this.result_highlighted = null;
+      this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
+      this.disable_search_threshold = this.options.disable_search_threshold || 0;
+      this.disable_search = this.options.disable_search || false;
+      this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
+      this.group_search = this.options.group_search != null ? this.options.group_search : true;
+      this.search_contains = this.options.search_contains || false;
+      this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
+      this.max_selected_options = this.options.max_selected_options || Infinity;
+      this.inherit_select_classes = this.options.inherit_select_classes || false;
+      this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
+      this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
+      return this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
+    };
+
+    AbstractChosen.prototype.set_default_text = function() {
+      if (this.form_field.getAttribute("data-placeholder")) {
+        this.default_text = this.form_field.getAttribute("data-placeholder");
+      } else if (this.is_multiple) {
+        this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
+      } else {
+        this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
+      }
+      return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
+    };
+
+    AbstractChosen.prototype.choice_label = function(item) {
+      if (this.include_group_label_in_selected && (item.group_label != null)) {
+        return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
+      } else {
+        return item.html;
+      }
+    };
+
+    AbstractChosen.prototype.mouse_enter = function() {
+      return this.mouse_on_container = true;
+    };
+
+    AbstractChosen.prototype.mouse_leave = function() {
+      return this.mouse_on_container = false;
+    };
+
+    AbstractChosen.prototype.input_focus = function(evt) {
+      var _this = this;
+      if (this.is_multiple) {
+        if (!this.active_field) {
+          return setTimeout((function() {
+            return _this.container_mousedown();
+          }), 50);
+        }
+      } else {
+        if (!this.active_field) {
+          return this.activate_field();
+        }
+      }
+    };
+
+    AbstractChosen.prototype.input_blur = function(evt) {
+      var _this = this;
+      if (!this.mouse_on_container) {
+        this.active_field = false;
+        return setTimeout((function() {
+          return _this.blur_test();
+        }), 100);
+      }
+    };
+
+    AbstractChosen.prototype.results_option_build = function(options) {
+      var content, data, _i, _len, _ref;
+      content = '';
+      _ref = this.results_data;
+      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+        data = _ref[_i];
+        if (data.group) {
+          content += this.result_add_group(data);
+        } else {
+          content += this.result_add_option(data);
+        }
+        if (options != null ? options.first : void 0) {
+          if (data.selected && this.is_multiple) {
+            this.choice_build(data);
+          } else if (data.selected && !this.is_multiple) {
+            this.single_set_selected_text(this.choice_label(data));
+          }
+        }
+      }
+      return content;
+    };
+
+    AbstractChosen.prototype.result_add_option = function(option) {
+      var classes, option_el;
+      if (!option.search_match) {
+        return '';
+      }
+      if (!this.include_option_in_results(option)) {
+        return '';
+      }
+      classes = [];
+      if (!option.disabled && !(option.selected && this.is_multiple)) {
+        classes.push("active-result");
+      }
+      if (option.disabled && !(option.selected && this.is_multiple)) {
+        classes.push("disabled-result");
+      }
+      if (option.selected) {
+        classes.push("result-selected");
+      }
+      if (option.group_array_index != null) {
+        classes.push("group-option");
+      }
+      if (option.classes !== "") {
+        classes.push(option.classes);
+      }
+      option_el = document.createElement("li");
+      option_el.className = classes.join(" ");
+      option_el.style.cssText = option.style;
+      option_el.setAttribute("data-option-array-index", option.array_index);
+      option_el.innerHTML = option.search_text;
+      if (option.title) {
+        option_el.title = option.title;
+      }
+      return this.outerHTML(option_el);
+    };
+
+    AbstractChosen.prototype.result_add_group = function(group) {
+      var classes, group_el;
+      if (!(group.search_match || group.group_match)) {
+        return '';
+      }
+      if (!(group.active_options > 0)) {
+        return '';
+      }
+      classes = [];
+      classes.push("group-result");
+      if (group.classes) {
+        classes.push(group.classes);
+      }
+      group_el = document.createElement("li");
+      group_el.className = classes.join(" ");
+      group_el.innerHTML = group.search_text;
+      if (group.title) {
+        group_el.title = group.title;
+      }
+      return this.outerHTML(group_el);
+    };
+
+    AbstractChosen.prototype.results_update_field = function() {
+      this.set_default_text();
+      if (!this.is_multiple) {
+        this.results_reset_cleanup();
+      }
+      this.result_clear_highlight();
+      this.results_build();
+      if (this.results_showing) {
+        return this.winnow_results();
+      }
+    };
+
+    AbstractChosen.prototype.reset_single_select_options = function() {
+      var result, _i, _len, _ref, _results;
+      _ref = this.results_data;
+      _results = [];
+      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+        result = _ref[_i];
+        if (result.selected) {
+          _results.push(result.selected = false);
+        } else {
+          _results.push(void 0);
+        }
+      }
+      return _results;
+    };
+
+    AbstractChosen.prototype.results_toggle = function() {
+      if (this.results_showing) {
+        return this.results_hide();
+      } else {
+        return this.results_show();
+      }
+    };
+
+    AbstractChosen.prototype.results_search = function(evt) {
+      if (this.results_showing) {
+        return this.winnow_results();
+      } else {
+        return this.results_show();
+      }
+    };
+
+    AbstractChosen.prototype.winnow_results = function() {
+      var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
+      this.no_results_clear();
+      results = 0;
+      searchText = this.get_search_text();
+      escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
+      zregex = new RegExp(escapedSearchText, 'i');
+      regex = this.get_search_regex(escapedSearchText);
+      _ref = this.results_data;
+      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+        option = _ref[_i];
+        option.search_match = false;
+        results_group = null;
+        if (this.include_option_in_results(option)) {
+          if (option.group) {
+            option.group_match = false;
+            option.active_options = 0;
+          }
+          if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
+            results_group = this.results_data[option.group_array_index];
+            if (results_group.active_options === 0 && results_group.search_match) {
+              results += 1;
+            }
+            results_group.active_options += 1;
+          }
+          option.search_text = option.group ? option.label : option.html;
+          if (!(option.group && !this.group_search)) {
+            option.search_match = this.search_string_match(option.search_text, regex);
+            if (option.search_match && !option.group) {
+              results += 1;
+            }
+            if (option.search_match) {
+              if (searchText.length) {
+                startpos = option.search_text.search(zregex);
+                text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
+                option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
+              }
+              if (results_group != null) {
+                results_group.group_match = true;
+              }
+            } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
+              option.search_match = true;
+            }
+          }
+        }
+      }
+      this.result_clear_highlight();
+      if (results < 1 && searchText.length) {
+        this.update_results_content("");
+        return this.no_results(searchText);
+      } else {
+        this.update_results_content(this.results_option_build());
+        return this.winnow_results_set_highlight();
+      }
+    };
+
+    AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
+      var regex_anchor;
+      regex_anchor = this.search_contains ? "" : "^";
+      return new RegExp(regex_anchor + escaped_search_string, 'i');
+    };
+
+    AbstractChosen.prototype.search_string_match = function(search_string, regex) {
+      var part, parts, _i, _len;
+      if (regex.test(search_string)) {
+        return true;
+      } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
+        parts = search_string.replace(/\[|\]/g, "").split(" ");
+        if (parts.length) {
+          for (_i = 0, _len = parts.length; _i < _len; _i++) {
+            part = parts[_i];
+            if (regex.test(part)) {
+              return true;
+            }
+          }
+        }
+      }
+    };
+
+    AbstractChosen.prototype.choices_count = function() {
+      var option, _i, _len, _ref;
+      if (this.selected_option_count != null) {
+        return this.selected_option_count;
+      }
+      this.selected_option_count = 0;
+      _ref = this.form_field.options;
+      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+        option = _ref[_i];
+        if (option.selected) {
+          this.selected_option_count += 1;
+        }
+      }
+      return this.selected_option_count;
+    };
+
+    AbstractChosen.prototype.choices_click = function(evt) {
+      evt.preventDefault();
+      if (!(this.results_showing || this.is_disabled)) {
+        return this.results_show();
+      }
+    };
+
+    AbstractChosen.prototype.keyup_checker = function(evt) {
+      var stroke, _ref;
+      stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
+      this.search_field_scale();
+      switch (stroke) {
+        case 8:
+          if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
+            return this.keydown_backstroke();
+          } else if (!this.pending_backstroke) {
+            this.result_clear_highlight();
+            return this.results_search();
+          }
+          break;
+        case 13:
+          evt.preventDefault();
+          if (this.results_showing) {
+            return this.result_select(evt);
+          }
+          break;
+        case 27:
+          if (this.results_showing) {
+            this.results_hide();
+          }
+          return true;
+        case 9:
+        case 38:
+        case 40:
+        case 16:
+        case 91:
+        case 17:
+          break;
+        default:
+          return this.results_search();
+      }
+    };
+
+    AbstractChosen.prototype.clipboard_event_checker = function(evt) {
+      var _this = this;
+      return setTimeout((function() {
+        return _this.results_search();
+      }), 50);
+    };
+
+    AbstractChosen.prototype.container_width = function() {
+      if (this.options.width != null) {
+        return this.options.width;
+      } else {
+        return "" + this.form_field.offsetWidth + "px";
+      }
+    };
+
+    AbstractChosen.prototype.include_option_in_results = function(option) {
+      if (this.is_multiple && (!this.display_selected_options && option.selected)) {
+        return false;
+      }
+      if (!this.display_disabled_options && option.disabled) {
+        return false;
+      }
+      if (option.empty) {
+        return false;
+      }
+      return true;
+    };
+
+    AbstractChosen.prototype.search_results_touchstart = function(evt) {
+      this.touch_started = true;
+      return this.search_results_mouseover(evt);
+    };
+
+    AbstractChosen.prototype.search_results_touchmove = function(evt) {
+      this.touch_started = false;
+      return this.search_results_mouseout(evt);
+    };
+
+    AbstractChosen.prototype.search_results_touchend = function(evt) {
+      if (this.touch_started) {
+        return this.search_results_mouseup(evt);
+      }
+    };
+
+    AbstractChosen.prototype.outerHTML = function(element) {
+      var tmp;
+      if (element.outerHTML) {
+        return element.outerHTML;
+      }
+      tmp = document.createElement("div");
+      tmp.appendChild(element);
+      return tmp.innerHTML;
+    };
+
+    AbstractChosen.browser_is_supported = function() {
+      if (window.navigator.appName === "Microsoft Internet Explorer") {
+        return document.documentMode >= 8;
+      }
+      if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
+        return false;
+      }
+      if (/Android/i.test(window.navigator.userAgent)) {
+        if (/Mobile/i.test(window.navigator.userAgent)) {
+          return false;
+        }
+      }
+      return true;
+    };
+
+    AbstractChosen.default_multiple_text = "Select Some Options";
+
+    AbstractChosen.default_single_text = "Select an Option";
+
+    AbstractChosen.default_no_result_text = "No results match";
+
+    return AbstractChosen;
+
+  })();
+
+  $ = jQuery;
+
+  $.fn.extend({
+    chosen: function(options) {
+      if (!AbstractChosen.browser_is_supported()) {
+        return this;
+      }
+      return this.each(function(input_field) {
+        var $this, chosen;
+        $this = $(this);
+        chosen = $this.data('chosen');
+        if (options === 'destroy' && chosen instanceof Chosen) {
+          chosen.destroy();
+        } else if (!(chosen instanceof Chosen)) {
+          $this.data('chosen', new Chosen(this, options));
+        }
+      });
+    }
+  });
+
+  Chosen = (function(_super) {
+    __extends(Chosen, _super);
+
+    function Chosen() {
+      _ref = Chosen.__super__.constructor.apply(this, arguments);
+      return _ref;
+    }
+
+    Chosen.prototype.setup = function() {
+      this.form_field_jq = $(this.form_field);
+      this.current_selectedIndex = this.form_field.selectedIndex;
+      return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
+    };
+
+    Chosen.prototype.set_up_html = function() {
+      var container_classes, container_props;
+      container_classes = ["chosen-container"];
+      container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
+      if (this.inherit_select_classes && this.form_field.className) {
+        container_classes.push(this.form_field.className);
+      }
+      if (this.is_rtl) {
+        container_classes.push("chosen-rtl");
+      }
+      container_props = {
+        'class': container_classes.join(' '),
+        'style': "width: " + (this.container_width()) + ";",
+        'title': this.form_field.title
+      };
+      if (this.form_field.id.length) {
+        container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
+      }
+      this.container = $("<div />", container_props);
+      if (this.is_multiple) {
+        this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
+      } else {
+        this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
+      }
+      this.form_field_jq.hide().after(this.container);
+      this.dropdown = this.container.find('div.chosen-drop').first();
+      this.search_field = this.container.find('input').first();
+      this.search_results = this.container.find('ul.chosen-results').first();
+      this.search_field_scale();
+      this.search_no_results = this.container.find('li.no-results').first();
+      if (this.is_multiple) {
+        this.search_choices = this.container.find('ul.chosen-choices').first();
+        this.search_container = this.container.find('li.search-field').first();
+      } else {
+        this.search_container = this.container.find('div.chosen-search').first();
+        this.selected_item = this.container.find('.chosen-single').first();
+      }
+      this.results_build();
+      this.set_tab_index();
+      return this.set_label_behavior();
+    };
+
+    Chosen.prototype.on_ready = function() {
+      return this.form_field_jq.trigger("chosen:ready", {
+        chosen: this
+      });
+    };
+
+    Chosen.prototype.register_observers = function() {
+      var _this = this;
+      this.container.bind('touchstart.chosen', function(evt) {
+        _this.container_mousedown(evt);
+        return evt.preventDefault();
+      });
+      this.container.bind('touchend.chosen', function(evt) {
+        _this.container_mouseup(evt);
+        return evt.preventDefault();
+      });
+      this.container.bind('mousedown.chosen', function(evt) {
+        _this.container_mousedown(evt);
+      });
+      this.container.bind('mouseup.chosen', function(evt) {
+        _this.container_mouseup(evt);
+      });
+      this.container.bind('mouseenter.chosen', function(evt) {
+        _this.mouse_enter(evt);
+      });
+      this.container.bind('mouseleave.chosen', function(evt) {
+        _this.mouse_leave(evt);
+      });
+      this.search_results.bind('mouseup.chosen', function(evt) {
+        _this.search_results_mouseup(evt);
+      });
+      this.search_results.bind('mouseover.chosen', function(evt) {
+        _this.search_results_mouseover(evt);
+      });
+      this.search_results.bind('mouseout.chosen', function(evt) {
+        _this.search_results_mouseout(evt);
+      });
+      this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
+        _this.search_results_mousewheel(evt);
+      });
+      this.search_results.bind('touchstart.chosen', function(evt) {
+        _this.search_results_touchstart(evt);
+      });
+      this.search_results.bind('touchmove.chosen', function(evt) {
+        _this.search_results_touchmove(evt);
+      });
+      this.search_results.bind('touchend.chosen', function(evt) {
+        _this.search_results_touchend(evt);
+      });
+      this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
+        _this.results_update_field(evt);
+      });
+      this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
+        _this.activate_field(evt);
+      });
+      this.form_field_jq.bind("chosen:open.chosen", function(evt) {
+        _this.container_mousedown(evt);
+      });
+      this.form_field_jq.bind("chosen:close.chosen", function(evt) {
+        _this.input_blur(evt);
+      });
+      this.search_field.bind('blur.chosen', function(evt) {
+        _this.input_blur(evt);
+      });
+      this.search_field.bind('keyup.chosen', function(evt) {
+        _this.keyup_checker(evt);
+      });
+      this.search_field.bind('keydown.chosen', function(evt) {
+        _this.keydown_checker(evt);
+      });
+      this.search_field.bind('focus.chosen', function(evt) {
+        _this.input_focus(evt);
+      });
+      this.search_field.bind('cut.chosen', function(evt) {
+        _this.clipboard_event_checker(evt);
+      });
+      this.search_field.bind('paste.chosen', function(evt) {
+        _this.clipboard_event_checker(evt);
+      });
+      if (this.is_multiple) {
+        return this.search_choices.bind('click.chosen', function(evt) {
+          _this.choices_click(evt);
+        });
+      } else {
+        return this.container.bind('click.chosen', function(evt) {
+          evt.preventDefault();
+        });
+      }
+    };
+
+    Chosen.prototype.destroy = function() {
+      $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
+      if (this.search_field[0].tabIndex) {
+        this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
+      }
+      this.container.remove();
+      this.form_field_jq.removeData('chosen');
+      return this.form_field_jq.show();
+    };
+
+    Chosen.prototype.search_field_disabled = function() {
+      this.is_disabled = this.form_field_jq[0].disabled;
+      if (this.is_disabled) {
+        this.container.addClass('chosen-disabled');
+        this.search_field[0].disabled = true;
+        if (!this.is_multiple) {
+          this.selected_item.unbind("focus.chosen", this.activate_action);
+        }
+        return this.close_field();
+      } else {
+        this.container.removeClass('chosen-disabled');
+        this.search_field[0].disabled = false;
+        if (!this.is_multiple) {
+          return this.selected_item.bind("focus.chosen", this.activate_action);
+        }
+      }
+    };
+
+    Chosen.prototype.container_mousedown = function(evt) {
+      if (!this.is_disabled) {
+        if (evt && evt.type === "mousedown" && !this.results_showing) {
+          evt.preventDefault();
+        }
+        if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
+          if (!this.active_field) {
+            if (this.is_multiple) {
+              this.search_field.val("");
+            }
+            $(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
+            this.results_show();
+          } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
+            evt.preventDefault();
+            this.results_toggle();
+          }
+          return this.activate_field();
+        }
+      }
+    };
+
+    Chosen.prototype.container_mouseup = function(evt) {
+      if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
+        return this.results_reset(evt);
+      }
+    };
+
+    Chosen.prototype.search_results_mousewheel = function(evt) {
+      var delta;
+      if (evt.originalEvent) {
+        delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
+      }
+      if (delta != null) {
+        evt.preventDefault();
+        if (evt.type === 'DOMMouseScroll') {
+          delta = delta * 40;
+        }
+        return this.search_results.scrollTop(delta + this.search_results.scrollTop());
+      }
+    };
+
+    Chosen.prototype.blur_test = function(evt) {
+      if (!this.active_field && this.container.hasClass("chosen-container-active")) {
+        return this.close_field();
+      }
+    };
+
+    Chosen.prototype.close_field = function() {
+      $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
+      this.active_field = false;
+      this.results_hide();
+      this.container.removeClass("chosen-container-active");
+      this.clear_backstroke();
+      this.show_search_field_default();
+      return this.search_field_scale();
+    };
+
+    Chosen.prototype.activate_field = function() {
+      this.container.addClass("chosen-container-active");
+      this.active_field = true;
+      this.search_field.val(this.search_field.val());
+      return this.search_field.focus();
+    };
+
+    Chosen.prototype.test_active_click = function(evt) {
+      var active_container;
+      active_container = $(evt.target).closest('.chosen-container');
+      if (active_container.length && this.container[0] === active_container[0]) {
+        return this.active_field = true;
+      } else {
+        return this.close_field();
+      }
+    };
+
+    Chosen.prototype.results_build = function() {
+      this.parsing = true;
+      this.selected_option_count = null;
+      this.results_data = SelectParser.select_to_array(this.form_field);
+      if (this.is_multiple) {
+        this.search_choices.find("li.search-choice").remove();
+      } else if (!this.is_multiple) {
+        this.single_set_selected_text();
+        if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
+          this.search_field[0].readOnly = true;
+          this.container.addClass("chosen-container-single-nosearch");
+        } else {
+          this.search_field[0].readOnly = false;
+          this.container.removeClass("chosen-container-single-nosearch");
+        }
+      }
+      this.update_results_content(this.results_option_build({
+        first: true
+      }));
+      this.search_field_disabled();
+      this.show_search_field_default();
+      this.search_field_scale();
+      return this.parsing = false;
+    };
+
+    Chosen.prototype.result_do_highlight = function(el) {
+      var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
+      if (el.length) {
+        this.result_clear_highlight();
+        this.result_highlight = el;
+        this.result_highlight.addClass("highlighted");
+        maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
+        visible_top = this.search_results.scrollTop();
+        visible_bottom = maxHeight + visible_top;
+        high_top = this.result_highlight.position().top + this.search_results.scrollTop();
+        high_bottom = high_top + this.result_highlight.outerHeight();
+        if (high_bottom >= visible_bottom) {
+          return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
+        } else if (high_top < visible_top) {
+          return this.search_results.scrollTop(high_top);
+        }
+      }
+    };
+
+    Chosen.prototype.result_clear_highlight = function() {
+      if (this.result_highlight) {
+        this.result_highlight.removeClass("highlighted");
+      }
+      return this.result_highlight = null;
+    };
+
+    Chosen.prototype.results_show = function() {
+      if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
+        this.form_field_jq.trigger("chosen:maxselected", {
+          chosen: this
+        });
+        return false;
+      }
+      this.container.addClass("chosen-with-drop");
+      this.results_showing = true;
+      this.search_field.focus();
+      this.search_field.val(this.search_field.val());
+      this.winnow_results();
+      return this.form_field_jq.trigger("chosen:showing_dropdown", {
+        chosen: this
+      });
+    };
+
+    Chosen.prototype.update_results_content = function(content) {
+      return this.search_results.html(content);
+    };
+
+    Chosen.prototype.results_hide = function() {
+      if (this.results_showing) {
+        this.result_clear_highlight();
+        this.container.removeClass("chosen-with-drop");
+        this.form_field_jq.trigger("chosen:hiding_dropdown", {
+          chosen: this
+        });
+      }
+      return this.results_showing = false;
+    };
+
+    Chosen.prototype.set_tab_index = function(el) {
+      var ti;
+      if (this.form_field.tabIndex) {
+        ti = this.form_field.tabIndex;
+        this.form_field.tabIndex = -1;
+        return this.search_field[0].tabIndex = ti;
+      }
+    };
+
+    Chosen.prototype.set_label_behavior = function() {
+      var _this = this;
+      this.form_field_label = this.form_field_jq.parents("label");
+      if (!this.form_field_label.length && this.form_field.id.length) {
+        this.form_field_label = $("label[for='" + this.form_field.id + "']");
+      }
+      if (this.form_field_label.length > 0) {
+        return this.form_field_label.bind('click.chosen', function(evt) {
+          if (_this.is_multiple) {
+            return _this.container_mousedown(evt);
+          } else {
+            return _this.activate_field();
+          }
+        });
+      }
+    };
+
+    Chosen.prototype.show_search_field_default = function() {
+      if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
+        this.search_field.val(this.default_text);
+        return this.search_field.addClass("default");
+      } else {
+        this.search_field.val("");
+        return this.search_field.removeClass("default");
+      }
+    };
+
+    Chosen.prototype.search_results_mouseup = function(evt) {
+      var target;
+      target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
+      if (target.length) {
+        this.result_highlight = target;
+        this.result_select(evt);
+        return this.search_field.focus();
+      }
+    };
+
+    Chosen.prototype.search_results_mouseover = function(evt) {
+      var target;
+      target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
+      if (target) {
+        return this.result_do_highlight(target);
+      }
+    };
+
+    Chosen.prototype.search_results_mouseout = function(evt) {
+      if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
+        return this.result_clear_highlight();
+      }
+    };
+
+    Chosen.prototype.choice_build = function(item) {
+      var choice, close_link,
+        _this = this;
+      choice = $('<li />', {
+        "class": "search-choice"
+      }).html("<span>" + (this.choice_label(item)) + "</span>");
+      if (item.disabled) {
+        choice.addClass('search-choice-disabled');
+      } else {
+        close_link = $('<a />', {
+          "class": 'search-choice-close',
+          'data-option-array-index': item.array_index
+        });
+        close_link.bind('click.chosen', function(evt) {
+          return _this.choice_destroy_link_click(evt);
+        });
+        choice.append(close_link);
+      }
+      return this.search_container.before(choice);
+    };
+
+    Chosen.prototype.choice_destroy_link_click = function(evt) {
+      evt.preventDefault();
+      evt.stopPropagation();
+      if (!this.is_disabled) {
+        return this.choice_destroy($(evt.target));
+      }
+    };
+
+    Chosen.prototype.choice_destroy = function(link) {
+      if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
+        this.show_search_field_default();
+        if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
+          this.results_hide();
+        }
+        link.parents('li').first().remove();
+        return this.search_field_scale();
+      }
+    };
+
+    Chosen.prototype.results_reset = function() {
+      this.reset_single_select_options();
+      this.form_field.options[0].selected = true;
+      this.single_set_selected_text();
+      this.show_search_field_default();
+      this.results_reset_cleanup();
+      this.form_field_jq.trigger("change");
+      if (this.active_field) {
+        return this.results_hide();
+      }
+    };
+
+    Chosen.prototype.results_reset_cleanup = function() {
+      this.current_selectedIndex = this.form_field.selectedIndex;
+      return this.selected_item.find("abbr").remove();
+    };
+
+    Chosen.prototype.result_select = function(evt) {
+      var high, item;
+      if (this.result_highlight) {
+        high = this.result_highlight;
+        this.result_clear_highlight();
+        if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
+          this.form_field_jq.trigger("chosen:maxselected", {
+            chosen: this
+          });
+          return false;
+        }
+        if (this.is_multiple) {
+          high.removeClass("active-result");
+        } else {
+          this.reset_single_select_options();
+        }
+        high.addClass("result-selected");
+        item = this.results_data[high[0].getAttribute("data-option-array-index")];
+        item.selected = true;
+        this.form_field.options[item.options_index].selected = true;
+        this.selected_option_count = null;
+        if (this.is_multiple) {
+          this.choice_build(item);
+        } else {
+          this.single_set_selected_text(this.choice_label(item));
+        }
+        if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
+          this.results_hide();
+        }
+        this.search_field.val("");
+        if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
+          this.form_field_jq.trigger("change", {
+            'selected': this.form_field.options[item.options_index].value
+          });
+        }
+        this.current_selectedIndex = this.form_field.selectedIndex;
+        evt.preventDefault();
+        return this.search_field_scale();
+      }
+    };
+
+    Chosen.prototype.single_set_selected_text = function(text) {
+      if (text == null) {
+        text = this.default_text;
+      }
+      if (text === this.default_text) {
+        this.selected_item.addClass("chosen-default");
+      } else {
+        this.single_deselect_control_build();
+        this.selected_item.removeClass("chosen-default");
+      }
+      return this.selected_item.find("span").html(text);
+    };
+
+    Chosen.prototype.result_deselect = function(pos) {
+      var result_data;
+      result_data = this.results_data[pos];
+      if (!this.form_field.options[result_data.options_index].disabled) {
+        result_data.selected = false;
+        this.form_field.options[result_data.options_index].selected = false;
+        this.selected_option_count = null;
+        this.result_clear_highlight();
+        if (this.results_showing) {
+          this.winnow_results();
+        }
+        this.form_field_jq.trigger("change", {
+          deselected: this.form_field.options[result_data.options_index].value
+        });
+        this.search_field_scale();
+        return true;
+      } else {
+        return false;
+      }
+    };
+
+    Chosen.prototype.single_deselect_control_build = function() {
+      if (!this.allow_single_deselect) {
+        return;
+      }
+      if (!this.selected_item.find("abbr").length) {
+        this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
+      }
+      return this.selected_item.addClass("chosen-single-with-deselect");
+    };
+
+    Chosen.prototype.get_search_text = function() {
+      return $('<div/>').text($.trim(this.search_field.val())).html();
+    };
+
+    Chosen.prototype.winnow_results_set_highlight = function() {
+      var do_high, selected_results;
+      selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
+      do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
+      if (do_high != null) {
+        return this.result_do_highlight(do_high);
+      }
+    };
+
+    Chosen.prototype.no_results = function(terms) {
+      var no_results_html;
+      no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
+      no_results_html.find("span").first().html(terms);
+      this.search_results.append(no_results_html);
+      return this.form_field_jq.trigger("chosen:no_results", {
+        chosen: this
+      });
+    };
+
+    Chosen.prototype.no_results_clear = function() {
+      return this.search_results.find(".no-results").remove();
+    };
+
+    Chosen.prototype.keydown_arrow = function() {
+      var next_sib;
+      if (this.results_showing && this.result_highlight) {
+        next_sib = this.result_highlight.nextAll("li.active-result").first();
+        if (next_sib) {
+          return this.result_do_highlight(next_sib);
+        }
+      } else {
+        return this.results_show();
+      }
+    };
+
+    Chosen.prototype.keyup_arrow = function() {
+      var prev_sibs;
+      if (!this.results_showing && !this.is_multiple) {
+        return this.results_show();
+      } else if (this.result_highlight) {
+        prev_sibs = this.result_highlight.prevAll("li.active-result");
+        if (prev_sibs.length) {
+          return this.result_do_highlight(prev_sibs.first());
+        } else {
+          if (this.choices_count() > 0) {
+            this.results_hide();
+          }
+          return this.result_clear_highlight();
+        }
+      }
+    };
+
+    Chosen.prototype.keydown_backstroke = function() {
+      var next_available_destroy;
+      if (this.pending_backstroke) {
+        this.choice_destroy(this.pending_backstroke.find("a").first());
+        return this.clear_backstroke();
+      } else {
+        next_available_destroy = this.search_container.siblings("li.search-choice").last();
+        if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
+          this.pending_backstroke = next_available_destroy;
+          if (this.single_backstroke_delete) {
+            return this.keydown_backstroke();
+          } else {
+            return this.pending_backstroke.addClass("search-choice-focus");
+          }
+        }
+      }
+    };
+
+    Chosen.prototype.clear_backstroke = function() {
+      if (this.pending_backstroke) {
+        this.pending_backstroke.removeClass("search-choice-focus");
+      }
+      return this.pending_backstroke = null;
+    };
+
+    Chosen.prototype.keydown_checker = function(evt) {
+      var stroke, _ref1;
+      stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
+      this.search_field_scale();
+      if (stroke !== 8 && this.pending_backstroke) {
+        this.clear_backstroke();
+      }
+      switch (stroke) {
+        case 8:
+          this.backstroke_length = this.search_field.val().length;
+          break;
+        case 9:
+          if (this.results_showing && !this.is_multiple) {
+            this.result_select(evt);
+          }
+          this.mouse_on_container = false;
+          break;
+        case 13:
+          if (this.results_showing) {
+            evt.preventDefault();
+          }
+          break;
+        case 32:
+          if (this.disable_search) {
+            evt.preventDefault();
+          }
+          break;
+        case 38:
+          evt.preventDefault();
+          this.keyup_arrow();
+          break;
+        case 40:
+          evt.preventDefault();
+          this.keydown_arrow();
+          break;
+      }
+    };
+
+    Chosen.prototype.search_field_scale = function() {
+      var div, f_width, h, style, style_block, styles, w, _i, _len;
+      if (this.is_multiple) {
+        h = 0;
+        w = 0;
+        style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
+        styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
+        for (_i = 0, _len = styles.length; _i < _len; _i++) {
+          style = styles[_i];
+          style_block += style + ":" + this.search_field.css(style) + ";";
+        }
+        div = $('<div />', {
+          'style': style_block
+        });
+        div.text(this.search_field.val());
+        $('body').append(div);
+        w = div.width() + 25;
+        div.remove();
+        f_width = this.container.outerWidth();
+        if (w > f_width - 10) {
+          w = f_width - 10;
+        }
+        return this.search_field.css({
+          'width': w + 'px'
+        });
+      }
+    };
+
+    return Chosen;
+
+  })(AbstractChosen);
+
+}).call(this);
diff --git a/profiles/wcm_base/libraries/chosen/chosen.jquery.min.js b/profiles/wcm_base/libraries/chosen/chosen.jquery.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..22e386584572c6e5919a9f23326d275782e3034c
--- /dev/null
+++ b/profiles/wcm_base/libraries/chosen/chosen.jquery.min.js
@@ -0,0 +1,2 @@
+/* Chosen v1.4.2 | (c) 2011-2015 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
+(function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,title:a.title?a.title:void 0,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,group_label:null!=b?this.parsed[b].label:null,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&amp;"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.choice_label=function(a){return this.include_group_label_in_selected&&null!=a.group_label?"<b class='group-name'>"+a.group_label+"</b>"+a.html:a.html},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(c)));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.result_add_group=function(a){var b,c;return a.search_match||a.group_match?a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),b.search_text=b.group?b.label:b.html,(!b.group||this.group_search)&&(b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b;return b=this.search_contains?"":"^",new RegExp(b+a,"i")},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(){var a=this;return setTimeout(function(){return a.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),a=jQuery,a.fn.extend({chosen:function(b){return AbstractChosen.browser_is_supported()?this.each(function(){var c,d;c=a(this),d=c.data("chosen"),"destroy"===b&&d instanceof Chosen?d.destroy():d instanceof Chosen||c.data("chosen",new Chosen(this,b))}):this}}),Chosen=function(c){function Chosen(){return b=Chosen.__super__.constructor.apply(this,arguments)}return d(Chosen,c),Chosen.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},Chosen.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("<div />",c),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},Chosen.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.bind("touchstart.chosen",function(b){return a.container_mousedown(b),b.preventDefault()}),this.container.bind("touchend.chosen",function(b){return a.container_mouseup(b),b.preventDefault()}),this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.search_results.bind("touchstart.chosen",function(b){a.search_results_touchstart(b)}),this.search_results.bind("touchmove.chosen",function(b){a.search_results_touchmove(b)}),this.search_results.bind("touchend.chosen",function(b){a.search_results_touchend(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.form_field_jq.bind("chosen:close.chosen",function(b){a.input_blur(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.search_field.bind("cut.chosen",function(b){a.clipboard_event_checker(b)}),this.search_field.bind("paste.chosen",function(b){a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},Chosen.prototype.destroy=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},Chosen.prototype.container_mousedown=function(b){return this.is_disabled||(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return a.originalEvent&&(b=a.originalEvent.deltaY||-a.originalEvent.wheelDelta||a.originalEvent.detail),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(b){var c;return c=a(b.target).closest(".chosen-container"),c.length&&this.container[0]===c[0]?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.html(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var b=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},Chosen.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(b){var c,d,e=this;return c=a("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(b)+"</span>"),b.disabled?c.addClass("search-choice-disabled"):(d=a("<a />",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},Chosen.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):this.reset_single_select_options(),b.addClass("result-selected"),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(this.choice_label(c)),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,a.preventDefault(),this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return a("<div/>").text(a.trim(this.search_field.val())).html()},Chosen.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;j>i;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return b=a("<div />",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},Chosen}(AbstractChosen)}).call(this);
\ No newline at end of file
diff --git a/profiles/wcm_base/libraries/chosen/chosen.min.css b/profiles/wcm_base/libraries/chosen/chosen.min.css
new file mode 100644
index 0000000000000000000000000000000000000000..5ca6159cff8b16a5f635182aef8ca8f01b39020f
--- /dev/null
+++ b/profiles/wcm_base/libraries/chosen/chosen.min.css
@@ -0,0 +1,3 @@
+/* Chosen v1.4.2 | (c) 2011-2015 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
+
+.chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;zoom:1;*display:inline;-webkit-user-select:none;-moz-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;left:-9999px;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;box-shadow:0 4px 5px rgba(0,0,0,.15)}.chosen-container.chosen-with-drop .chosen-drop{left:0}.chosen-container a{cursor:pointer}.chosen-container .search-choice .group-name,.chosen-container .chosen-single .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .search-choice .group-name:after,.chosen-container .chosen-single .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),color-stop(100%,#f4f4f4));background:-webkit-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-moz-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-o-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:#fff url(chosen-sprite.png) no-repeat 100% -20px;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;left:-9999px}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:-webkit-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-moz-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-o-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto!important;height:1%;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(1%,#eee),color-stop(15%,#fff));background-image:-webkit-linear-gradient(#eee 1%,#fff 15%);background-image:-moz-linear-gradient(#eee 1%,#fff 15%);background-image:-o-linear-gradient(#eee 1%,#fff 15%);background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:transparent!important;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;-moz-border-radius-bottomright:0;border-bottom-right-radius:0;-moz-border-radius-bottomleft:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#eee),color-stop(80%,#fff));background-image:-webkit-linear-gradient(#eee 20%,#fff 80%);background-image:-moz-linear-gradient(#eee 20%,#fff 80%);background-image:-o-linear-gradient(#eee 20%,#fff 80%);background-image:linear-gradient(#eee 20%,#fff 80%);box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:0;background:transparent}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single-nosearch .chosen-search,.chosen-rtl .chosen-drop{left:9999px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:0}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:#fff url(chosen-sprite.png) no-repeat -30px -20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-rtl .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-container-single .chosen-search input[type=text],.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
\ No newline at end of file
diff --git a/profiles/wcm_base/libraries/chosen/chosen.proto.js b/profiles/wcm_base/libraries/chosen/chosen.proto.js
new file mode 100644
index 0000000000000000000000000000000000000000..aabf0869364ddf6253a239907fc68240563beb5e
--- /dev/null
+++ b/profiles/wcm_base/libraries/chosen/chosen.proto.js
@@ -0,0 +1,1276 @@
+/*!
+Chosen, a Select Box Enhancer for jQuery and Prototype
+by Patrick Filler for Harvest, http://getharvest.com
+
+Version 1.4.2
+Full source at https://github.com/harvesthq/chosen
+Copyright (c) 2011-2015 Harvest http://getharvest.com
+
+MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
+This file is generated by `grunt build`, do not edit it by hand.
+*/
+
+(function() {
+  var AbstractChosen, SelectParser, _ref,
+    __hasProp = {}.hasOwnProperty,
+    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+  SelectParser = (function() {
+    function SelectParser() {
+      this.options_index = 0;
+      this.parsed = [];
+    }
+
+    SelectParser.prototype.add_node = function(child) {
+      if (child.nodeName.toUpperCase() === "OPTGROUP") {
+        return this.add_group(child);
+      } else {
+        return this.add_option(child);
+      }
+    };
+
+    SelectParser.prototype.add_group = function(group) {
+      var group_position, option, _i, _len, _ref, _results;
+      group_position = this.parsed.length;
+      this.parsed.push({
+        array_index: group_position,
+        group: true,
+        label: this.escapeExpression(group.label),
+        title: group.title ? group.title : void 0,
+        children: 0,
+        disabled: group.disabled,
+        classes: group.className
+      });
+      _ref = group.childNodes;
+      _results = [];
+      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+        option = _ref[_i];
+        _results.push(this.add_option(option, group_position, group.disabled));
+      }
+      return _results;
+    };
+
+    SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
+      if (option.nodeName.toUpperCase() === "OPTION") {
+        if (option.text !== "") {
+          if (group_position != null) {
+            this.parsed[group_position].children += 1;
+          }
+          this.parsed.push({
+            array_index: this.parsed.length,
+            options_index: this.options_index,
+            value: option.value,
+            text: option.text,
+            html: option.innerHTML,
+            title: option.title ? option.title : void 0,
+            selected: option.selected,
+            disabled: group_disabled === true ? group_disabled : option.disabled,
+            group_array_index: group_position,
+            group_label: group_position != null ? this.parsed[group_position].label : null,
+            classes: option.className,
+            style: option.style.cssText
+          });
+        } else {
+          this.parsed.push({
+            array_index: this.parsed.length,
+            options_index: this.options_index,
+            empty: true
+          });
+        }
+        return this.options_index += 1;
+      }
+    };
+
+    SelectParser.prototype.escapeExpression = function(text) {
+      var map, unsafe_chars;
+      if ((text == null) || text === false) {
+        return "";
+      }
+      if (!/[\&\<\>\"\'\`]/.test(text)) {
+        return text;
+      }
+      map = {
+        "<": "&lt;",
+        ">": "&gt;",
+        '"': "&quot;",
+        "'": "&#x27;",
+        "`": "&#x60;"
+      };
+      unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
+      return text.replace(unsafe_chars, function(chr) {
+        return map[chr] || "&amp;";
+      });
+    };
+
+    return SelectParser;
+
+  })();
+
+  SelectParser.select_to_array = function(select) {
+    var child, parser, _i, _len, _ref;
+    parser = new SelectParser();
+    _ref = select.childNodes;
+    for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+      child = _ref[_i];
+      parser.add_node(child);
+    }
+    return parser.parsed;
+  };
+
+  AbstractChosen = (function() {
+    function AbstractChosen(form_field, options) {
+      this.form_field = form_field;
+      this.options = options != null ? options : {};
+      if (!AbstractChosen.browser_is_supported()) {
+        return;
+      }
+      this.is_multiple = this.form_field.multiple;
+      this.set_default_text();
+      this.set_default_values();
+      this.setup();
+      this.set_up_html();
+      this.register_observers();
+      this.on_ready();
+    }
+
+    AbstractChosen.prototype.set_default_values = function() {
+      var _this = this;
+      this.click_test_action = function(evt) {
+        return _this.test_active_click(evt);
+      };
+      this.activate_action = function(evt) {
+        return _this.activate_field(evt);
+      };
+      this.active_field = false;
+      this.mouse_on_container = false;
+      this.results_showing = false;
+      this.result_highlighted = null;
+      this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
+      this.disable_search_threshold = this.options.disable_search_threshold || 0;
+      this.disable_search = this.options.disable_search || false;
+      this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
+      this.group_search = this.options.group_search != null ? this.options.group_search : true;
+      this.search_contains = this.options.search_contains || false;
+      this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
+      this.max_selected_options = this.options.max_selected_options || Infinity;
+      this.inherit_select_classes = this.options.inherit_select_classes || false;
+      this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
+      this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
+      return this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
+    };
+
+    AbstractChosen.prototype.set_default_text = function() {
+      if (this.form_field.getAttribute("data-placeholder")) {
+        this.default_text = this.form_field.getAttribute("data-placeholder");
+      } else if (this.is_multiple) {
+        this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
+      } else {
+        this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
+      }
+      return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
+    };
+
+    AbstractChosen.prototype.choice_label = function(item) {
+      if (this.include_group_label_in_selected && (item.group_label != null)) {
+        return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
+      } else {
+        return item.html;
+      }
+    };
+
+    AbstractChosen.prototype.mouse_enter = function() {
+      return this.mouse_on_container = true;
+    };
+
+    AbstractChosen.prototype.mouse_leave = function() {
+      return this.mouse_on_container = false;
+    };
+
+    AbstractChosen.prototype.input_focus = function(evt) {
+      var _this = this;
+      if (this.is_multiple) {
+        if (!this.active_field) {
+          return setTimeout((function() {
+            return _this.container_mousedown();
+          }), 50);
+        }
+      } else {
+        if (!this.active_field) {
+          return this.activate_field();
+        }
+      }
+    };
+
+    AbstractChosen.prototype.input_blur = function(evt) {
+      var _this = this;
+      if (!this.mouse_on_container) {
+        this.active_field = false;
+        return setTimeout((function() {
+          return _this.blur_test();
+        }), 100);
+      }
+    };
+
+    AbstractChosen.prototype.results_option_build = function(options) {
+      var content, data, _i, _len, _ref;
+      content = '';
+      _ref = this.results_data;
+      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+        data = _ref[_i];
+        if (data.group) {
+          content += this.result_add_group(data);
+        } else {
+          content += this.result_add_option(data);
+        }
+        if (options != null ? options.first : void 0) {
+          if (data.selected && this.is_multiple) {
+            this.choice_build(data);
+          } else if (data.selected && !this.is_multiple) {
+            this.single_set_selected_text(this.choice_label(data));
+          }
+        }
+      }
+      return content;
+    };
+
+    AbstractChosen.prototype.result_add_option = function(option) {
+      var classes, option_el;
+      if (!option.search_match) {
+        return '';
+      }
+      if (!this.include_option_in_results(option)) {
+        return '';
+      }
+      classes = [];
+      if (!option.disabled && !(option.selected && this.is_multiple)) {
+        classes.push("active-result");
+      }
+      if (option.disabled && !(option.selected && this.is_multiple)) {
+        classes.push("disabled-result");
+      }
+      if (option.selected) {
+        classes.push("result-selected");
+      }
+      if (option.group_array_index != null) {
+        classes.push("group-option");
+      }
+      if (option.classes !== "") {
+        classes.push(option.classes);
+      }
+      option_el = document.createElement("li");
+      option_el.className = classes.join(" ");
+      option_el.style.cssText = option.style;
+      option_el.setAttribute("data-option-array-index", option.array_index);
+      option_el.innerHTML = option.search_text;
+      if (option.title) {
+        option_el.title = option.title;
+      }
+      return this.outerHTML(option_el);
+    };
+
+    AbstractChosen.prototype.result_add_group = function(group) {
+      var classes, group_el;
+      if (!(group.search_match || group.group_match)) {
+        return '';
+      }
+      if (!(group.active_options > 0)) {
+        return '';
+      }
+      classes = [];
+      classes.push("group-result");
+      if (group.classes) {
+        classes.push(group.classes);
+      }
+      group_el = document.createElement("li");
+      group_el.className = classes.join(" ");
+      group_el.innerHTML = group.search_text;
+      if (group.title) {
+        group_el.title = group.title;
+      }
+      return this.outerHTML(group_el);
+    };
+
+    AbstractChosen.prototype.results_update_field = function() {
+      this.set_default_text();
+      if (!this.is_multiple) {
+        this.results_reset_cleanup();
+      }
+      this.result_clear_highlight();
+      this.results_build();
+      if (this.results_showing) {
+        return this.winnow_results();
+      }
+    };
+
+    AbstractChosen.prototype.reset_single_select_options = function() {
+      var result, _i, _len, _ref, _results;
+      _ref = this.results_data;
+      _results = [];
+      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+        result = _ref[_i];
+        if (result.selected) {
+          _results.push(result.selected = false);
+        } else {
+          _results.push(void 0);
+        }
+      }
+      return _results;
+    };
+
+    AbstractChosen.prototype.results_toggle = function() {
+      if (this.results_showing) {
+        return this.results_hide();
+      } else {
+        return this.results_show();
+      }
+    };
+
+    AbstractChosen.prototype.results_search = function(evt) {
+      if (this.results_showing) {
+        return this.winnow_results();
+      } else {
+        return this.results_show();
+      }
+    };
+
+    AbstractChosen.prototype.winnow_results = function() {
+      var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
+      this.no_results_clear();
+      results = 0;
+      searchText = this.get_search_text();
+      escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
+      zregex = new RegExp(escapedSearchText, 'i');
+      regex = this.get_search_regex(escapedSearchText);
+      _ref = this.results_data;
+      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+        option = _ref[_i];
+        option.search_match = false;
+        results_group = null;
+        if (this.include_option_in_results(option)) {
+          if (option.group) {
+            option.group_match = false;
+            option.active_options = 0;
+          }
+          if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
+            results_group = this.results_data[option.group_array_index];
+            if (results_group.active_options === 0 && results_group.search_match) {
+              results += 1;
+            }
+            results_group.active_options += 1;
+          }
+          option.search_text = option.group ? option.label : option.html;
+          if (!(option.group && !this.group_search)) {
+            option.search_match = this.search_string_match(option.search_text, regex);
+            if (option.search_match && !option.group) {
+              results += 1;
+            }
+            if (option.search_match) {
+              if (searchText.length) {
+                startpos = option.search_text.search(zregex);
+                text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
+                option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
+              }
+              if (results_group != null) {
+                results_group.group_match = true;
+              }
+            } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
+              option.search_match = true;
+            }
+          }
+        }
+      }
+      this.result_clear_highlight();
+      if (results < 1 && searchText.length) {
+        this.update_results_content("");
+        return this.no_results(searchText);
+      } else {
+        this.update_results_content(this.results_option_build());
+        return this.winnow_results_set_highlight();
+      }
+    };
+
+    AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
+      var regex_anchor;
+      regex_anchor = this.search_contains ? "" : "^";
+      return new RegExp(regex_anchor + escaped_search_string, 'i');
+    };
+
+    AbstractChosen.prototype.search_string_match = function(search_string, regex) {
+      var part, parts, _i, _len;
+      if (regex.test(search_string)) {
+        return true;
+      } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
+        parts = search_string.replace(/\[|\]/g, "").split(" ");
+        if (parts.length) {
+          for (_i = 0, _len = parts.length; _i < _len; _i++) {
+            part = parts[_i];
+            if (regex.test(part)) {
+              return true;
+            }
+          }
+        }
+      }
+    };
+
+    AbstractChosen.prototype.choices_count = function() {
+      var option, _i, _len, _ref;
+      if (this.selected_option_count != null) {
+        return this.selected_option_count;
+      }
+      this.selected_option_count = 0;
+      _ref = this.form_field.options;
+      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+        option = _ref[_i];
+        if (option.selected) {
+          this.selected_option_count += 1;
+        }
+      }
+      return this.selected_option_count;
+    };
+
+    AbstractChosen.prototype.choices_click = function(evt) {
+      evt.preventDefault();
+      if (!(this.results_showing || this.is_disabled)) {
+        return this.results_show();
+      }
+    };
+
+    AbstractChosen.prototype.keyup_checker = function(evt) {
+      var stroke, _ref;
+      stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
+      this.search_field_scale();
+      switch (stroke) {
+        case 8:
+          if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
+            return this.keydown_backstroke();
+          } else if (!this.pending_backstroke) {
+            this.result_clear_highlight();
+            return this.results_search();
+          }
+          break;
+        case 13:
+          evt.preventDefault();
+          if (this.results_showing) {
+            return this.result_select(evt);
+          }
+          break;
+        case 27:
+          if (this.results_showing) {
+            this.results_hide();
+          }
+          return true;
+        case 9:
+        case 38:
+        case 40:
+        case 16:
+        case 91:
+        case 17:
+          break;
+        default:
+          return this.results_search();
+      }
+    };
+
+    AbstractChosen.prototype.clipboard_event_checker = function(evt) {
+      var _this = this;
+      return setTimeout((function() {
+        return _this.results_search();
+      }), 50);
+    };
+
+    AbstractChosen.prototype.container_width = function() {
+      if (this.options.width != null) {
+        return this.options.width;
+      } else {
+        return "" + this.form_field.offsetWidth + "px";
+      }
+    };
+
+    AbstractChosen.prototype.include_option_in_results = function(option) {
+      if (this.is_multiple && (!this.display_selected_options && option.selected)) {
+        return false;
+      }
+      if (!this.display_disabled_options && option.disabled) {
+        return false;
+      }
+      if (option.empty) {
+        return false;
+      }
+      return true;
+    };
+
+    AbstractChosen.prototype.search_results_touchstart = function(evt) {
+      this.touch_started = true;
+      return this.search_results_mouseover(evt);
+    };
+
+    AbstractChosen.prototype.search_results_touchmove = function(evt) {
+      this.touch_started = false;
+      return this.search_results_mouseout(evt);
+    };
+
+    AbstractChosen.prototype.search_results_touchend = function(evt) {
+      if (this.touch_started) {
+        return this.search_results_mouseup(evt);
+      }
+    };
+
+    AbstractChosen.prototype.outerHTML = function(element) {
+      var tmp;
+      if (element.outerHTML) {
+        return element.outerHTML;
+      }
+      tmp = document.createElement("div");
+      tmp.appendChild(element);
+      return tmp.innerHTML;
+    };
+
+    AbstractChosen.browser_is_supported = function() {
+      if (window.navigator.appName === "Microsoft Internet Explorer") {
+        return document.documentMode >= 8;
+      }
+      if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
+        return false;
+      }
+      if (/Android/i.test(window.navigator.userAgent)) {
+        if (/Mobile/i.test(window.navigator.userAgent)) {
+          return false;
+        }
+      }
+      return true;
+    };
+
+    AbstractChosen.default_multiple_text = "Select Some Options";
+
+    AbstractChosen.default_single_text = "Select an Option";
+
+    AbstractChosen.default_no_result_text = "No results match";
+
+    return AbstractChosen;
+
+  })();
+
+  this.Chosen = (function(_super) {
+    __extends(Chosen, _super);
+
+    function Chosen() {
+      _ref = Chosen.__super__.constructor.apply(this, arguments);
+      return _ref;
+    }
+
+    Chosen.prototype.setup = function() {
+      this.current_selectedIndex = this.form_field.selectedIndex;
+      return this.is_rtl = this.form_field.hasClassName("chosen-rtl");
+    };
+
+    Chosen.prototype.set_default_values = function() {
+      Chosen.__super__.set_default_values.call(this);
+      this.single_temp = new Template('<a class="chosen-single chosen-default" tabindex="-1"><span>#{default}</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
+      this.multi_temp = new Template('<ul class="chosen-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
+      return this.no_results_temp = new Template('<li class="no-results">' + this.results_none_found + ' "<span>#{terms}</span>"</li>');
+    };
+
+    Chosen.prototype.set_up_html = function() {
+      var container_classes, container_props;
+      container_classes = ["chosen-container"];
+      container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
+      if (this.inherit_select_classes && this.form_field.className) {
+        container_classes.push(this.form_field.className);
+      }
+      if (this.is_rtl) {
+        container_classes.push("chosen-rtl");
+      }
+      container_props = {
+        'class': container_classes.join(' '),
+        'style': "width: " + (this.container_width()) + ";",
+        'title': this.form_field.title
+      };
+      if (this.form_field.id.length) {
+        container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
+      }
+      this.container = this.is_multiple ? new Element('div', container_props).update(this.multi_temp.evaluate({
+        "default": this.default_text
+      })) : new Element('div', container_props).update(this.single_temp.evaluate({
+        "default": this.default_text
+      }));
+      this.form_field.hide().insert({
+        after: this.container
+      });
+      this.dropdown = this.container.down('div.chosen-drop');
+      this.search_field = this.container.down('input');
+      this.search_results = this.container.down('ul.chosen-results');
+      this.search_field_scale();
+      this.search_no_results = this.container.down('li.no-results');
+      if (this.is_multiple) {
+        this.search_choices = this.container.down('ul.chosen-choices');
+        this.search_container = this.container.down('li.search-field');
+      } else {
+        this.search_container = this.container.down('div.chosen-search');
+        this.selected_item = this.container.down('.chosen-single');
+      }
+      this.results_build();
+      this.set_tab_index();
+      return this.set_label_behavior();
+    };
+
+    Chosen.prototype.on_ready = function() {
+      return this.form_field.fire("chosen:ready", {
+        chosen: this
+      });
+    };
+
+    Chosen.prototype.register_observers = function() {
+      var _this = this;
+      this.container.observe("touchstart", function(evt) {
+        _this.container_mousedown(evt);
+        return evt.preventDefault();
+      });
+      this.container.observe("touchend", function(evt) {
+        _this.container_mouseup(evt);
+        return evt.preventDefault();
+      });
+      this.container.observe("mousedown", function(evt) {
+        return _this.container_mousedown(evt);
+      });
+      this.container.observe("mouseup", function(evt) {
+        return _this.container_mouseup(evt);
+      });
+      this.container.observe("mouseenter", function(evt) {
+        return _this.mouse_enter(evt);
+      });
+      this.container.observe("mouseleave", function(evt) {
+        return _this.mouse_leave(evt);
+      });
+      this.search_results.observe("mouseup", function(evt) {
+        return _this.search_results_mouseup(evt);
+      });
+      this.search_results.observe("mouseover", function(evt) {
+        return _this.search_results_mouseover(evt);
+      });
+      this.search_results.observe("mouseout", function(evt) {
+        return _this.search_results_mouseout(evt);
+      });
+      this.search_results.observe("mousewheel", function(evt) {
+        return _this.search_results_mousewheel(evt);
+      });
+      this.search_results.observe("DOMMouseScroll", function(evt) {
+        return _this.search_results_mousewheel(evt);
+      });
+      this.search_results.observe("touchstart", function(evt) {
+        return _this.search_results_touchstart(evt);
+      });
+      this.search_results.observe("touchmove", function(evt) {
+        return _this.search_results_touchmove(evt);
+      });
+      this.search_results.observe("touchend", function(evt) {
+        return _this.search_results_touchend(evt);
+      });
+      this.form_field.observe("chosen:updated", function(evt) {
+        return _this.results_update_field(evt);
+      });
+      this.form_field.observe("chosen:activate", function(evt) {
+        return _this.activate_field(evt);
+      });
+      this.form_field.observe("chosen:open", function(evt) {
+        return _this.container_mousedown(evt);
+      });
+      this.form_field.observe("chosen:close", function(evt) {
+        return _this.input_blur(evt);
+      });
+      this.search_field.observe("blur", function(evt) {
+        return _this.input_blur(evt);
+      });
+      this.search_field.observe("keyup", function(evt) {
+        return _this.keyup_checker(evt);
+      });
+      this.search_field.observe("keydown", function(evt) {
+        return _this.keydown_checker(evt);
+      });
+      this.search_field.observe("focus", function(evt) {
+        return _this.input_focus(evt);
+      });
+      this.search_field.observe("cut", function(evt) {
+        return _this.clipboard_event_checker(evt);
+      });
+      this.search_field.observe("paste", function(evt) {
+        return _this.clipboard_event_checker(evt);
+      });
+      if (this.is_multiple) {
+        return this.search_choices.observe("click", function(evt) {
+          return _this.choices_click(evt);
+        });
+      } else {
+        return this.container.observe("click", function(evt) {
+          return evt.preventDefault();
+        });
+      }
+    };
+
+    Chosen.prototype.destroy = function() {
+      this.container.ownerDocument.stopObserving("click", this.click_test_action);
+      this.form_field.stopObserving();
+      this.container.stopObserving();
+      this.search_results.stopObserving();
+      this.search_field.stopObserving();
+      if (this.form_field_label != null) {
+        this.form_field_label.stopObserving();
+      }
+      if (this.is_multiple) {
+        this.search_choices.stopObserving();
+        this.container.select(".search-choice-close").each(function(choice) {
+          return choice.stopObserving();
+        });
+      } else {
+        this.selected_item.stopObserving();
+      }
+      if (this.search_field.tabIndex) {
+        this.form_field.tabIndex = this.search_field.tabIndex;
+      }
+      this.container.remove();
+      return this.form_field.show();
+    };
+
+    Chosen.prototype.search_field_disabled = function() {
+      this.is_disabled = this.form_field.disabled;
+      if (this.is_disabled) {
+        this.container.addClassName('chosen-disabled');
+        this.search_field.disabled = true;
+        if (!this.is_multiple) {
+          this.selected_item.stopObserving("focus", this.activate_action);
+        }
+        return this.close_field();
+      } else {
+        this.container.removeClassName('chosen-disabled');
+        this.search_field.disabled = false;
+        if (!this.is_multiple) {
+          return this.selected_item.observe("focus", this.activate_action);
+        }
+      }
+    };
+
+    Chosen.prototype.container_mousedown = function(evt) {
+      if (!this.is_disabled) {
+        if (evt && evt.type === "mousedown" && !this.results_showing) {
+          evt.stop();
+        }
+        if (!((evt != null) && evt.target.hasClassName("search-choice-close"))) {
+          if (!this.active_field) {
+            if (this.is_multiple) {
+              this.search_field.clear();
+            }
+            this.container.ownerDocument.observe("click", this.click_test_action);
+            this.results_show();
+          } else if (!this.is_multiple && evt && (evt.target === this.selected_item || evt.target.up("a.chosen-single"))) {
+            this.results_toggle();
+          }
+          return this.activate_field();
+        }
+      }
+    };
+
+    Chosen.prototype.container_mouseup = function(evt) {
+      if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
+        return this.results_reset(evt);
+      }
+    };
+
+    Chosen.prototype.search_results_mousewheel = function(evt) {
+      var delta;
+      delta = evt.deltaY || -evt.wheelDelta || evt.detail;
+      if (delta != null) {
+        evt.preventDefault();
+        if (evt.type === 'DOMMouseScroll') {
+          delta = delta * 40;
+        }
+        return this.search_results.scrollTop = delta + this.search_results.scrollTop;
+      }
+    };
+
+    Chosen.prototype.blur_test = function(evt) {
+      if (!this.active_field && this.container.hasClassName("chosen-container-active")) {
+        return this.close_field();
+      }
+    };
+
+    Chosen.prototype.close_field = function() {
+      this.container.ownerDocument.stopObserving("click", this.click_test_action);
+      this.active_field = false;
+      this.results_hide();
+      this.container.removeClassName("chosen-container-active");
+      this.clear_backstroke();
+      this.show_search_field_default();
+      return this.search_field_scale();
+    };
+
+    Chosen.prototype.activate_field = function() {
+      this.container.addClassName("chosen-container-active");
+      this.active_field = true;
+      this.search_field.value = this.search_field.value;
+      return this.search_field.focus();
+    };
+
+    Chosen.prototype.test_active_click = function(evt) {
+      if (evt.target.up('.chosen-container') === this.container) {
+        return this.active_field = true;
+      } else {
+        return this.close_field();
+      }
+    };
+
+    Chosen.prototype.results_build = function() {
+      this.parsing = true;
+      this.selected_option_count = null;
+      this.results_data = SelectParser.select_to_array(this.form_field);
+      if (this.is_multiple) {
+        this.search_choices.select("li.search-choice").invoke("remove");
+      } else if (!this.is_multiple) {
+        this.single_set_selected_text();
+        if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
+          this.search_field.readOnly = true;
+          this.container.addClassName("chosen-container-single-nosearch");
+        } else {
+          this.search_field.readOnly = false;
+          this.container.removeClassName("chosen-container-single-nosearch");
+        }
+      }
+      this.update_results_content(this.results_option_build({
+        first: true
+      }));
+      this.search_field_disabled();
+      this.show_search_field_default();
+      this.search_field_scale();
+      return this.parsing = false;
+    };
+
+    Chosen.prototype.result_do_highlight = function(el) {
+      var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
+      this.result_clear_highlight();
+      this.result_highlight = el;
+      this.result_highlight.addClassName("highlighted");
+      maxHeight = parseInt(this.search_results.getStyle('maxHeight'), 10);
+      visible_top = this.search_results.scrollTop;
+      visible_bottom = maxHeight + visible_top;
+      high_top = this.result_highlight.positionedOffset().top;
+      high_bottom = high_top + this.result_highlight.getHeight();
+      if (high_bottom >= visible_bottom) {
+        return this.search_results.scrollTop = (high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0;
+      } else if (high_top < visible_top) {
+        return this.search_results.scrollTop = high_top;
+      }
+    };
+
+    Chosen.prototype.result_clear_highlight = function() {
+      if (this.result_highlight) {
+        this.result_highlight.removeClassName('highlighted');
+      }
+      return this.result_highlight = null;
+    };
+
+    Chosen.prototype.results_show = function() {
+      if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
+        this.form_field.fire("chosen:maxselected", {
+          chosen: this
+        });
+        return false;
+      }
+      this.container.addClassName("chosen-with-drop");
+      this.results_showing = true;
+      this.search_field.focus();
+      this.search_field.value = this.search_field.value;
+      this.winnow_results();
+      return this.form_field.fire("chosen:showing_dropdown", {
+        chosen: this
+      });
+    };
+
+    Chosen.prototype.update_results_content = function(content) {
+      return this.search_results.update(content);
+    };
+
+    Chosen.prototype.results_hide = function() {
+      if (this.results_showing) {
+        this.result_clear_highlight();
+        this.container.removeClassName("chosen-with-drop");
+        this.form_field.fire("chosen:hiding_dropdown", {
+          chosen: this
+        });
+      }
+      return this.results_showing = false;
+    };
+
+    Chosen.prototype.set_tab_index = function(el) {
+      var ti;
+      if (this.form_field.tabIndex) {
+        ti = this.form_field.tabIndex;
+        this.form_field.tabIndex = -1;
+        return this.search_field.tabIndex = ti;
+      }
+    };
+
+    Chosen.prototype.set_label_behavior = function() {
+      var _this = this;
+      this.form_field_label = this.form_field.up("label");
+      if (this.form_field_label == null) {
+        this.form_field_label = $$("label[for='" + this.form_field.id + "']").first();
+      }
+      if (this.form_field_label != null) {
+        return this.form_field_label.observe("click", function(evt) {
+          if (_this.is_multiple) {
+            return _this.container_mousedown(evt);
+          } else {
+            return _this.activate_field();
+          }
+        });
+      }
+    };
+
+    Chosen.prototype.show_search_field_default = function() {
+      if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
+        this.search_field.value = this.default_text;
+        return this.search_field.addClassName("default");
+      } else {
+        this.search_field.value = "";
+        return this.search_field.removeClassName("default");
+      }
+    };
+
+    Chosen.prototype.search_results_mouseup = function(evt) {
+      var target;
+      target = evt.target.hasClassName("active-result") ? evt.target : evt.target.up(".active-result");
+      if (target) {
+        this.result_highlight = target;
+        this.result_select(evt);
+        return this.search_field.focus();
+      }
+    };
+
+    Chosen.prototype.search_results_mouseover = function(evt) {
+      var target;
+      target = evt.target.hasClassName("active-result") ? evt.target : evt.target.up(".active-result");
+      if (target) {
+        return this.result_do_highlight(target);
+      }
+    };
+
+    Chosen.prototype.search_results_mouseout = function(evt) {
+      if (evt.target.hasClassName('active-result') || evt.target.up('.active-result')) {
+        return this.result_clear_highlight();
+      }
+    };
+
+    Chosen.prototype.choice_build = function(item) {
+      var choice, close_link,
+        _this = this;
+      choice = new Element('li', {
+        "class": "search-choice"
+      }).update("<span>" + (this.choice_label(item)) + "</span>");
+      if (item.disabled) {
+        choice.addClassName('search-choice-disabled');
+      } else {
+        close_link = new Element('a', {
+          href: '#',
+          "class": 'search-choice-close',
+          rel: item.array_index
+        });
+        close_link.observe("click", function(evt) {
+          return _this.choice_destroy_link_click(evt);
+        });
+        choice.insert(close_link);
+      }
+      return this.search_container.insert({
+        before: choice
+      });
+    };
+
+    Chosen.prototype.choice_destroy_link_click = function(evt) {
+      evt.preventDefault();
+      evt.stopPropagation();
+      if (!this.is_disabled) {
+        return this.choice_destroy(evt.target);
+      }
+    };
+
+    Chosen.prototype.choice_destroy = function(link) {
+      if (this.result_deselect(link.readAttribute("rel"))) {
+        this.show_search_field_default();
+        if (this.is_multiple && this.choices_count() > 0 && this.search_field.value.length < 1) {
+          this.results_hide();
+        }
+        link.up('li').remove();
+        return this.search_field_scale();
+      }
+    };
+
+    Chosen.prototype.results_reset = function() {
+      this.reset_single_select_options();
+      this.form_field.options[0].selected = true;
+      this.single_set_selected_text();
+      this.show_search_field_default();
+      this.results_reset_cleanup();
+      if (typeof Event.simulate === 'function') {
+        this.form_field.simulate("change");
+      }
+      if (this.active_field) {
+        return this.results_hide();
+      }
+    };
+
+    Chosen.prototype.results_reset_cleanup = function() {
+      var deselect_trigger;
+      this.current_selectedIndex = this.form_field.selectedIndex;
+      deselect_trigger = this.selected_item.down("abbr");
+      if (deselect_trigger) {
+        return deselect_trigger.remove();
+      }
+    };
+
+    Chosen.prototype.result_select = function(evt) {
+      var high, item;
+      if (this.result_highlight) {
+        high = this.result_highlight;
+        this.result_clear_highlight();
+        if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
+          this.form_field.fire("chosen:maxselected", {
+            chosen: this
+          });
+          return false;
+        }
+        if (this.is_multiple) {
+          high.removeClassName("active-result");
+        } else {
+          this.reset_single_select_options();
+        }
+        high.addClassName("result-selected");
+        item = this.results_data[high.getAttribute("data-option-array-index")];
+        item.selected = true;
+        this.form_field.options[item.options_index].selected = true;
+        this.selected_option_count = null;
+        if (this.is_multiple) {
+          this.choice_build(item);
+        } else {
+          this.single_set_selected_text(this.choice_label(item));
+        }
+        if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
+          this.results_hide();
+        }
+        this.search_field.value = "";
+        if (typeof Event.simulate === 'function' && (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex)) {
+          this.form_field.simulate("change");
+        }
+        this.current_selectedIndex = this.form_field.selectedIndex;
+        evt.preventDefault();
+        return this.search_field_scale();
+      }
+    };
+
+    Chosen.prototype.single_set_selected_text = function(text) {
+      if (text == null) {
+        text = this.default_text;
+      }
+      if (text === this.default_text) {
+        this.selected_item.addClassName("chosen-default");
+      } else {
+        this.single_deselect_control_build();
+        this.selected_item.removeClassName("chosen-default");
+      }
+      return this.selected_item.down("span").update(text);
+    };
+
+    Chosen.prototype.result_deselect = function(pos) {
+      var result_data;
+      result_data = this.results_data[pos];
+      if (!this.form_field.options[result_data.options_index].disabled) {
+        result_data.selected = false;
+        this.form_field.options[result_data.options_index].selected = false;
+        this.selected_option_count = null;
+        this.result_clear_highlight();
+        if (this.results_showing) {
+          this.winnow_results();
+        }
+        if (typeof Event.simulate === 'function') {
+          this.form_field.simulate("change");
+        }
+        this.search_field_scale();
+        return true;
+      } else {
+        return false;
+      }
+    };
+
+    Chosen.prototype.single_deselect_control_build = function() {
+      if (!this.allow_single_deselect) {
+        return;
+      }
+      if (!this.selected_item.down("abbr")) {
+        this.selected_item.down("span").insert({
+          after: "<abbr class=\"search-choice-close\"></abbr>"
+        });
+      }
+      return this.selected_item.addClassName("chosen-single-with-deselect");
+    };
+
+    Chosen.prototype.get_search_text = function() {
+      return this.search_field.value.strip().escapeHTML();
+    };
+
+    Chosen.prototype.winnow_results_set_highlight = function() {
+      var do_high;
+      if (!this.is_multiple) {
+        do_high = this.search_results.down(".result-selected.active-result");
+      }
+      if (do_high == null) {
+        do_high = this.search_results.down(".active-result");
+      }
+      if (do_high != null) {
+        return this.result_do_highlight(do_high);
+      }
+    };
+
+    Chosen.prototype.no_results = function(terms) {
+      this.search_results.insert(this.no_results_temp.evaluate({
+        terms: terms
+      }));
+      return this.form_field.fire("chosen:no_results", {
+        chosen: this
+      });
+    };
+
+    Chosen.prototype.no_results_clear = function() {
+      var nr, _results;
+      nr = null;
+      _results = [];
+      while (nr = this.search_results.down(".no-results")) {
+        _results.push(nr.remove());
+      }
+      return _results;
+    };
+
+    Chosen.prototype.keydown_arrow = function() {
+      var next_sib;
+      if (this.results_showing && this.result_highlight) {
+        next_sib = this.result_highlight.next('.active-result');
+        if (next_sib) {
+          return this.result_do_highlight(next_sib);
+        }
+      } else {
+        return this.results_show();
+      }
+    };
+
+    Chosen.prototype.keyup_arrow = function() {
+      var actives, prevs, sibs;
+      if (!this.results_showing && !this.is_multiple) {
+        return this.results_show();
+      } else if (this.result_highlight) {
+        sibs = this.result_highlight.previousSiblings();
+        actives = this.search_results.select("li.active-result");
+        prevs = sibs.intersect(actives);
+        if (prevs.length) {
+          return this.result_do_highlight(prevs.first());
+        } else {
+          if (this.choices_count() > 0) {
+            this.results_hide();
+          }
+          return this.result_clear_highlight();
+        }
+      }
+    };
+
+    Chosen.prototype.keydown_backstroke = function() {
+      var next_available_destroy;
+      if (this.pending_backstroke) {
+        this.choice_destroy(this.pending_backstroke.down("a"));
+        return this.clear_backstroke();
+      } else {
+        next_available_destroy = this.search_container.siblings().last();
+        if (next_available_destroy && next_available_destroy.hasClassName("search-choice") && !next_available_destroy.hasClassName("search-choice-disabled")) {
+          this.pending_backstroke = next_available_destroy;
+          if (this.pending_backstroke) {
+            this.pending_backstroke.addClassName("search-choice-focus");
+          }
+          if (this.single_backstroke_delete) {
+            return this.keydown_backstroke();
+          } else {
+            return this.pending_backstroke.addClassName("search-choice-focus");
+          }
+        }
+      }
+    };
+
+    Chosen.prototype.clear_backstroke = function() {
+      if (this.pending_backstroke) {
+        this.pending_backstroke.removeClassName("search-choice-focus");
+      }
+      return this.pending_backstroke = null;
+    };
+
+    Chosen.prototype.keydown_checker = function(evt) {
+      var stroke, _ref1;
+      stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
+      this.search_field_scale();
+      if (stroke !== 8 && this.pending_backstroke) {
+        this.clear_backstroke();
+      }
+      switch (stroke) {
+        case 8:
+          this.backstroke_length = this.search_field.value.length;
+          break;
+        case 9:
+          if (this.results_showing && !this.is_multiple) {
+            this.result_select(evt);
+          }
+          this.mouse_on_container = false;
+          break;
+        case 13:
+          if (this.results_showing) {
+            evt.preventDefault();
+          }
+          break;
+        case 32:
+          if (this.disable_search) {
+            evt.preventDefault();
+          }
+          break;
+        case 38:
+          evt.preventDefault();
+          this.keyup_arrow();
+          break;
+        case 40:
+          evt.preventDefault();
+          this.keydown_arrow();
+          break;
+      }
+    };
+
+    Chosen.prototype.search_field_scale = function() {
+      var div, f_width, h, style, style_block, styles, w, _i, _len;
+      if (this.is_multiple) {
+        h = 0;
+        w = 0;
+        style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
+        styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
+        for (_i = 0, _len = styles.length; _i < _len; _i++) {
+          style = styles[_i];
+          style_block += style + ":" + this.search_field.getStyle(style) + ";";
+        }
+        div = new Element('div', {
+          'style': style_block
+        }).update(this.search_field.value.escapeHTML());
+        document.body.appendChild(div);
+        w = Element.measure(div, 'width') + 25;
+        div.remove();
+        f_width = this.container.getWidth();
+        if (w > f_width - 10) {
+          w = f_width - 10;
+        }
+        return this.search_field.setStyle({
+          'width': w + 'px'
+        });
+      }
+    };
+
+    return Chosen;
+
+  })(AbstractChosen);
+
+}).call(this);
diff --git a/profiles/wcm_base/libraries/chosen/chosen.proto.min.js b/profiles/wcm_base/libraries/chosen/chosen.proto.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..581b30932ac720edc657a3e7a87fbb23a026c7ff
--- /dev/null
+++ b/profiles/wcm_base/libraries/chosen/chosen.proto.min.js
@@ -0,0 +1,2 @@
+/* Chosen v1.4.2 | (c) 2011-2015 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
+(function(){var AbstractChosen,SelectParser,a,b={}.hasOwnProperty,c=function(a,c){function d(){this.constructor=a}for(var e in c)b.call(c,e)&&(a[e]=c[e]);return d.prototype=c.prototype,a.prototype=new d,a.__super__=c.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,title:a.title?a.title:void 0,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,group_label:null!=b?this.parsed[b].label:null,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&amp;"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.choice_label=function(a){return this.include_group_label_in_selected&&null!=a.group_label?"<b class='group-name'>"+a.group_label+"</b>"+a.html:a.html},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(c)));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.result_add_group=function(a){var b,c;return a.search_match||a.group_match?a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),b.search_text=b.group?b.label:b.html,(!b.group||this.group_search)&&(b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b;return b=this.search_contains?"":"^",new RegExp(b+a,"i")},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(){var a=this;return setTimeout(function(){return a.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),this.Chosen=function(b){function Chosen(){return a=Chosen.__super__.constructor.apply(this,arguments)}return c(Chosen,b),Chosen.prototype.setup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field.hasClassName("chosen-rtl")},Chosen.prototype.set_default_values=function(){return Chosen.__super__.set_default_values.call(this),this.single_temp=new Template('<a class="chosen-single chosen-default" tabindex="-1"><span>#{default}</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.multi_temp=new Template('<ul class="chosen-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'),this.no_results_temp=new Template('<li class="no-results">'+this.results_none_found+' "<span>#{terms}</span>"</li>')},Chosen.prototype.set_up_html=function(){var a,b;return a=["chosen-container"],a.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&a.push(this.form_field.className),this.is_rtl&&a.push("chosen-rtl"),b={"class":a.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(b.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=this.is_multiple?new Element("div",b).update(this.multi_temp.evaluate({"default":this.default_text})):new Element("div",b).update(this.single_temp.evaluate({"default":this.default_text})),this.form_field.hide().insert({after:this.container}),this.dropdown=this.container.down("div.chosen-drop"),this.search_field=this.container.down("input"),this.search_results=this.container.down("ul.chosen-results"),this.search_field_scale(),this.search_no_results=this.container.down("li.no-results"),this.is_multiple?(this.search_choices=this.container.down("ul.chosen-choices"),this.search_container=this.container.down("li.search-field")):(this.search_container=this.container.down("div.chosen-search"),this.selected_item=this.container.down(".chosen-single")),this.results_build(),this.set_tab_index(),this.set_label_behavior()},Chosen.prototype.on_ready=function(){return this.form_field.fire("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.observe("touchstart",function(b){return a.container_mousedown(b),b.preventDefault()}),this.container.observe("touchend",function(b){return a.container_mouseup(b),b.preventDefault()}),this.container.observe("mousedown",function(b){return a.container_mousedown(b)}),this.container.observe("mouseup",function(b){return a.container_mouseup(b)}),this.container.observe("mouseenter",function(b){return a.mouse_enter(b)}),this.container.observe("mouseleave",function(b){return a.mouse_leave(b)}),this.search_results.observe("mouseup",function(b){return a.search_results_mouseup(b)}),this.search_results.observe("mouseover",function(b){return a.search_results_mouseover(b)}),this.search_results.observe("mouseout",function(b){return a.search_results_mouseout(b)}),this.search_results.observe("mousewheel",function(b){return a.search_results_mousewheel(b)}),this.search_results.observe("DOMMouseScroll",function(b){return a.search_results_mousewheel(b)}),this.search_results.observe("touchstart",function(b){return a.search_results_touchstart(b)}),this.search_results.observe("touchmove",function(b){return a.search_results_touchmove(b)}),this.search_results.observe("touchend",function(b){return a.search_results_touchend(b)}),this.form_field.observe("chosen:updated",function(b){return a.results_update_field(b)}),this.form_field.observe("chosen:activate",function(b){return a.activate_field(b)}),this.form_field.observe("chosen:open",function(b){return a.container_mousedown(b)}),this.form_field.observe("chosen:close",function(b){return a.input_blur(b)}),this.search_field.observe("blur",function(b){return a.input_blur(b)}),this.search_field.observe("keyup",function(b){return a.keyup_checker(b)}),this.search_field.observe("keydown",function(b){return a.keydown_checker(b)}),this.search_field.observe("focus",function(b){return a.input_focus(b)}),this.search_field.observe("cut",function(b){return a.clipboard_event_checker(b)}),this.search_field.observe("paste",function(b){return a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.observe("click",function(b){return a.choices_click(b)}):this.container.observe("click",function(a){return a.preventDefault()})},Chosen.prototype.destroy=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.form_field.stopObserving(),this.container.stopObserving(),this.search_results.stopObserving(),this.search_field.stopObserving(),null!=this.form_field_label&&this.form_field_label.stopObserving(),this.is_multiple?(this.search_choices.stopObserving(),this.container.select(".search-choice-close").each(function(a){return a.stopObserving()})):this.selected_item.stopObserving(),this.search_field.tabIndex&&(this.form_field.tabIndex=this.search_field.tabIndex),this.container.remove(),this.form_field.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled,this.is_disabled?(this.container.addClassName("chosen-disabled"),this.search_field.disabled=!0,this.is_multiple||this.selected_item.stopObserving("focus",this.activate_action),this.close_field()):(this.container.removeClassName("chosen-disabled"),this.search_field.disabled=!1,this.is_multiple?void 0:this.selected_item.observe("focus",this.activate_action))},Chosen.prototype.container_mousedown=function(a){return this.is_disabled||(a&&"mousedown"===a.type&&!this.results_showing&&a.stop(),null!=a&&a.target.hasClassName("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!a||a.target!==this.selected_item&&!a.target.up("a.chosen-single")||this.results_toggle():(this.is_multiple&&this.search_field.clear(),this.container.ownerDocument.observe("click",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return b=a.deltaY||-a.wheelDelta||a.detail,null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop=b+this.search_results.scrollTop):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClassName("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClassName("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClassName("chosen-container-active"),this.active_field=!0,this.search_field.value=this.search_field.value,this.search_field.focus()},Chosen.prototype.test_active_click=function(a){return a.target.up(".chosen-container")===this.container?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.select("li.search-choice").invoke("remove"):this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field.readOnly=!0,this.container.addClassName("chosen-container-single-nosearch")):(this.search_field.readOnly=!1,this.container.removeClassName("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;return this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClassName("highlighted"),d=parseInt(this.search_results.getStyle("maxHeight"),10),f=this.search_results.scrollTop,e=d+f,c=this.result_highlight.positionedOffset().top,b=c+this.result_highlight.getHeight(),b>=e?this.search_results.scrollTop=b-d>0?b-d:0:f>c?this.search_results.scrollTop=c:void 0},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClassName("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.container.addClassName("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.value=this.search_field.value,this.winnow_results(),this.form_field.fire("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.update(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClassName("chosen-with-drop"),this.form_field.fire("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field.tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var a=this;return this.form_field_label=this.form_field.up("label"),null==this.form_field_label&&(this.form_field_label=$$("label[for='"+this.form_field.id+"']").first()),null!=this.form_field_label?this.form_field_label.observe("click",function(b){return a.is_multiple?a.container_mousedown(b):a.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.value=this.default_text,this.search_field.addClassName("default")):(this.search_field.value="",this.search_field.removeClassName("default"))},Chosen.prototype.search_results_mouseup=function(a){var b;return b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result"),b?(this.result_highlight=b,this.result_select(a),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(a){var b;return b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result"),b?this.result_do_highlight(b):void 0},Chosen.prototype.search_results_mouseout=function(a){return a.target.hasClassName("active-result")||a.target.up(".active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(a){var b,c,d=this;return b=new Element("li",{"class":"search-choice"}).update("<span>"+this.choice_label(a)+"</span>"),a.disabled?b.addClassName("search-choice-disabled"):(c=new Element("a",{href:"#","class":"search-choice-close",rel:a.array_index}),c.observe("click",function(a){return d.choice_destroy_link_click(a)}),b.insert(c)),this.search_container.insert({before:b})},Chosen.prototype.choice_destroy_link_click=function(a){return a.preventDefault(),a.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a.target)},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a.readAttribute("rel"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.value.length<1&&this.results_hide(),a.up("li").remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),"function"==typeof Event.simulate&&this.form_field.simulate("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){var a;return this.current_selectedIndex=this.form_field.selectedIndex,a=this.selected_item.down("abbr"),a?a.remove():void 0},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClassName("active-result"):this.reset_single_select_options(),b.addClassName("result-selected"),c=this.results_data[b.getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(this.choice_label(c)),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.value="","function"!=typeof Event.simulate||!this.is_multiple&&this.form_field.selectedIndex===this.current_selectedIndex||this.form_field.simulate("change"),this.current_selectedIndex=this.form_field.selectedIndex,a.preventDefault(),this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClassName("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClassName("chosen-default")),this.selected_item.down("span").update(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),"function"==typeof Event.simulate&&this.form_field.simulate("change"),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.down("abbr")||this.selected_item.down("span").insert({after:'<abbr class="search-choice-close"></abbr>'}),this.selected_item.addClassName("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return this.search_field.value.strip().escapeHTML()},Chosen.prototype.winnow_results_set_highlight=function(){var a;return this.is_multiple||(a=this.search_results.down(".result-selected.active-result")),null==a&&(a=this.search_results.down(".active-result")),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(a){return this.search_results.insert(this.no_results_temp.evaluate({terms:a})),this.form_field.fire("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){var a,b;for(a=null,b=[];a=this.search_results.down(".no-results");)b.push(a.remove());return b},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.next(".active-result"))?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a,b,c;return this.results_showing||this.is_multiple?this.result_highlight?(c=this.result_highlight.previousSiblings(),a=this.search_results.select("li.active-result"),b=c.intersect(a),b.length?this.result_do_highlight(b.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.down("a")),this.clear_backstroke()):(a=this.search_container.siblings().last(),a&&a.hasClassName("search-choice")&&!a.hasClassName("search-choice-disabled")?(this.pending_backstroke=a,this.pending_backstroke&&this.pending_backstroke.addClassName("search-choice-focus"),this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClassName("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClassName("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.value.length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var a,b,c,d,e,f,g,h,i;if(this.is_multiple){for(c=0,g=0,e="position:absolute; left: -1000px; top: -1000px; display:none;",f=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],h=0,i=f.length;i>h;h++)d=f[h],e+=d+":"+this.search_field.getStyle(d)+";";return a=new Element("div",{style:e}).update(this.search_field.value.escapeHTML()),document.body.appendChild(a),g=Element.measure(a,"width")+25,a.remove(),b=this.container.getWidth(),g>b-10&&(g=b-10),this.search_field.setStyle({width:g+"px"})}},Chosen}(AbstractChosen)}).call(this);
\ No newline at end of file
diff --git a/profiles/wcm_base/libraries/chosen/coffee/chosen.jquery.coffee b/profiles/wcm_base/libraries/chosen/coffee/chosen.jquery.coffee
deleted file mode 100644
index fbabf9280fd1d716e1697314ad121d97dfaee0d0..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/coffee/chosen.jquery.coffee
+++ /dev/null
@@ -1,513 +0,0 @@
-$ = jQuery
-
-$.fn.extend({
-  chosen: (options) ->
-    # Do no harm and return as soon as possible for unsupported browsers, namely IE6 and IE7
-    # Continue on if running IE document type but in compatibility mode
-    return this unless AbstractChosen.browser_is_supported()
-    this.each (input_field) ->
-      $this = $ this
-      chosen = $this.data('chosen')
-      if options is 'destroy'
-        if chosen instanceof Chosen
-          chosen.destroy()
-        return
-      unless chosen instanceof Chosen
-        $this.data('chosen', new Chosen(this, options))
-
-      return
-
-})
-
-class Chosen extends AbstractChosen
-
-  setup: ->
-    @form_field_jq = $ @form_field
-    @current_selectedIndex = @form_field.selectedIndex
-    @is_rtl = @form_field_jq.hasClass "chosen-rtl"
-
-  set_up_html: ->
-    container_classes = ["chosen-container"]
-    container_classes.push "chosen-container-" + (if @is_multiple then "multi" else "single")
-    container_classes.push @form_field.className if @inherit_select_classes && @form_field.className
-    container_classes.push "chosen-rtl" if @is_rtl
-
-    container_props =
-      'class': container_classes.join ' '
-      'style': "width: #{this.container_width()};"
-      'title': @form_field.title
-
-    container_props.id = @form_field.id.replace(/[^\w]/g, '_') + "_chosen" if @form_field.id.length
-
-    @container = ($ "<div />", container_props)
-
-    if @is_multiple
-      @container.html '<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + @default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'
-    else
-      @container.html '<a class="chosen-single chosen-default"><span>' + @default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'
-
-    @form_field_jq.hide().after @container
-    @dropdown = @container.find('div.chosen-drop').first()
-
-    @search_field = @container.find('input').first()
-    @search_results = @container.find('ul.chosen-results').first()
-    this.search_field_scale()
-
-    @search_no_results = @container.find('li.no-results').first()
-
-    if @is_multiple
-      @search_choices = @container.find('ul.chosen-choices').first()
-      @search_container = @container.find('li.search-field').first()
-    else
-      @search_container = @container.find('div.chosen-search').first()
-      @selected_item = @container.find('.chosen-single').first()
-
-    this.results_build()
-    this.set_tab_index()
-    this.set_label_behavior()
-
-  on_ready: ->
-    @form_field_jq.trigger("chosen:ready", {chosen: this})
-
-  register_observers: ->
-    @container.bind 'touchstart.chosen', (evt) => this.container_mousedown(evt); evt.preventDefault()
-    @container.bind 'touchend.chosen', (evt) => this.container_mouseup(evt); evt.preventDefault()
-
-    @container.bind 'mousedown.chosen', (evt) => this.container_mousedown(evt); return
-    @container.bind 'mouseup.chosen', (evt) => this.container_mouseup(evt); return
-    @container.bind 'mouseenter.chosen', (evt) => this.mouse_enter(evt); return
-    @container.bind 'mouseleave.chosen', (evt) => this.mouse_leave(evt); return
-
-    @search_results.bind 'mouseup.chosen', (evt) => this.search_results_mouseup(evt); return
-    @search_results.bind 'mouseover.chosen', (evt) => this.search_results_mouseover(evt); return
-    @search_results.bind 'mouseout.chosen', (evt) => this.search_results_mouseout(evt); return
-    @search_results.bind 'mousewheel.chosen DOMMouseScroll.chosen', (evt) => this.search_results_mousewheel(evt); return
-
-    @search_results.bind 'touchstart.chosen', (evt) => this.search_results_touchstart(evt); return
-    @search_results.bind 'touchmove.chosen', (evt) => this.search_results_touchmove(evt); return
-    @search_results.bind 'touchend.chosen', (evt) => this.search_results_touchend(evt); return
-
-    @form_field_jq.bind "chosen:updated.chosen", (evt) => this.results_update_field(evt); return
-    @form_field_jq.bind "chosen:activate.chosen", (evt) => this.activate_field(evt); return
-    @form_field_jq.bind "chosen:open.chosen", (evt) => this.container_mousedown(evt); return
-    @form_field_jq.bind "chosen:close.chosen", (evt) => this.input_blur(evt); return
-
-    @search_field.bind 'blur.chosen', (evt) => this.input_blur(evt); return
-    @search_field.bind 'keyup.chosen', (evt) => this.keyup_checker(evt); return
-    @search_field.bind 'keydown.chosen', (evt) => this.keydown_checker(evt); return
-    @search_field.bind 'focus.chosen', (evt) => this.input_focus(evt); return
-    @search_field.bind 'cut.chosen', (evt) => this.clipboard_event_checker(evt); return
-    @search_field.bind 'paste.chosen', (evt) => this.clipboard_event_checker(evt); return
-
-    if @is_multiple
-      @search_choices.bind 'click.chosen', (evt) => this.choices_click(evt); return
-    else
-      @container.bind 'click.chosen', (evt) -> evt.preventDefault(); return # gobble click of anchor
-
-  destroy: ->
-    $(@container[0].ownerDocument).unbind "click.chosen", @click_test_action
-    if @search_field[0].tabIndex
-      @form_field_jq[0].tabIndex = @search_field[0].tabIndex
-
-    @container.remove()
-    @form_field_jq.removeData('chosen')
-    @form_field_jq.show()
-
-  search_field_disabled: ->
-    @is_disabled = @form_field_jq[0].disabled
-    if(@is_disabled)
-      @container.addClass 'chosen-disabled'
-      @search_field[0].disabled = true
-      @selected_item.unbind "focus.chosen", @activate_action if !@is_multiple
-      this.close_field()
-    else
-      @container.removeClass 'chosen-disabled'
-      @search_field[0].disabled = false
-      @selected_item.bind "focus.chosen", @activate_action if !@is_multiple
-
-  container_mousedown: (evt) ->
-    if !@is_disabled
-      if evt and evt.type is "mousedown" and not @results_showing
-        evt.preventDefault()
-
-      if not (evt? and ($ evt.target).hasClass "search-choice-close")
-        if not @active_field
-          @search_field.val "" if @is_multiple
-          $(@container[0].ownerDocument).bind 'click.chosen', @click_test_action
-          this.results_show()
-        else if not @is_multiple and evt and (($(evt.target)[0] == @selected_item[0]) || $(evt.target).parents("a.chosen-single").length)
-          evt.preventDefault()
-          this.results_toggle()
-
-        this.activate_field()
-
-  container_mouseup: (evt) ->
-    this.results_reset(evt) if evt.target.nodeName is "ABBR" and not @is_disabled
-
-  search_results_mousewheel: (evt) ->
-    delta = evt.originalEvent.deltaY or -evt.originalEvent.wheelDelta or evt.originalEvent.detail if evt.originalEvent
-    if delta?
-      evt.preventDefault()
-      delta = delta * 40 if evt.type is 'DOMMouseScroll'
-      @search_results.scrollTop(delta + @search_results.scrollTop())
-
-  blur_test: (evt) ->
-    this.close_field() if not @active_field and @container.hasClass "chosen-container-active"
-
-  close_field: ->
-    $(@container[0].ownerDocument).unbind "click.chosen", @click_test_action
-
-    @active_field = false
-    this.results_hide()
-
-    @container.removeClass "chosen-container-active"
-    this.clear_backstroke()
-
-    this.show_search_field_default()
-    this.search_field_scale()
-
-  activate_field: ->
-    @container.addClass "chosen-container-active"
-    @active_field = true
-
-    @search_field.val(@search_field.val())
-    @search_field.focus()
-
-
-  test_active_click: (evt) ->
-    active_container = $(evt.target).closest('.chosen-container')
-    if active_container.length and @container[0] == active_container[0]
-      @active_field = true
-    else
-      this.close_field()
-
-  results_build: ->
-    @parsing = true
-    @selected_option_count = null
-
-    @results_data = SelectParser.select_to_array @form_field
-
-    if @is_multiple
-      @search_choices.find("li.search-choice").remove()
-    else if not @is_multiple
-      this.single_set_selected_text()
-      if @disable_search or @form_field.options.length <= @disable_search_threshold
-        @search_field[0].readOnly = true
-        @container.addClass "chosen-container-single-nosearch"
-      else
-        @search_field[0].readOnly = false
-        @container.removeClass "chosen-container-single-nosearch"
-
-    this.update_results_content this.results_option_build({first:true})
-
-    this.search_field_disabled()
-    this.show_search_field_default()
-    this.search_field_scale()
-
-    @parsing = false
-
-  result_do_highlight: (el) ->
-    if el.length
-      this.result_clear_highlight()
-
-      @result_highlight = el
-      @result_highlight.addClass "highlighted"
-
-      maxHeight = parseInt @search_results.css("maxHeight"), 10
-      visible_top = @search_results.scrollTop()
-      visible_bottom = maxHeight + visible_top
-
-      high_top = @result_highlight.position().top + @search_results.scrollTop()
-      high_bottom = high_top + @result_highlight.outerHeight()
-
-      if high_bottom >= visible_bottom
-        @search_results.scrollTop if (high_bottom - maxHeight) > 0 then (high_bottom - maxHeight) else 0
-      else if high_top < visible_top
-        @search_results.scrollTop high_top
-
-  result_clear_highlight: ->
-    @result_highlight.removeClass "highlighted" if @result_highlight
-    @result_highlight = null
-
-  results_show: ->
-    if @is_multiple and @max_selected_options <= this.choices_count()
-      @form_field_jq.trigger("chosen:maxselected", {chosen: this})
-      return false
-
-    @container.addClass "chosen-with-drop"
-    @results_showing = true
-
-    @search_field.focus()
-    @search_field.val @search_field.val()
-
-    this.winnow_results()
-    @form_field_jq.trigger("chosen:showing_dropdown", {chosen: this})
-
-  update_results_content: (content) ->
-    @search_results.html content
-
-  results_hide: ->
-    if @results_showing
-      this.result_clear_highlight()
-
-      @container.removeClass "chosen-with-drop"
-      @form_field_jq.trigger("chosen:hiding_dropdown", {chosen: this})
-
-    @results_showing = false
-
-
-  set_tab_index: (el) ->
-    if @form_field.tabIndex
-      ti = @form_field.tabIndex
-      @form_field.tabIndex = -1
-      @search_field[0].tabIndex = ti
-
-  set_label_behavior: ->
-    @form_field_label = @form_field_jq.parents("label") # first check for a parent label
-    if not @form_field_label.length and @form_field.id.length
-      @form_field_label = $("label[for='#{@form_field.id}']") #next check for a for=#{id}
-
-    if @form_field_label.length > 0
-      @form_field_label.bind 'click.chosen', (evt) => if @is_multiple then this.container_mousedown(evt) else this.activate_field()
-
-  show_search_field_default: ->
-    if @is_multiple and this.choices_count() < 1 and not @active_field
-      @search_field.val(@default_text)
-      @search_field.addClass "default"
-    else
-      @search_field.val("")
-      @search_field.removeClass "default"
-
-  search_results_mouseup: (evt) ->
-    target = if $(evt.target).hasClass "active-result" then $(evt.target) else $(evt.target).parents(".active-result").first()
-    if target.length
-      @result_highlight = target
-      this.result_select(evt)
-      @search_field.focus()
-
-  search_results_mouseover: (evt) ->
-    target = if $(evt.target).hasClass "active-result" then $(evt.target) else $(evt.target).parents(".active-result").first()
-    this.result_do_highlight( target ) if target
-
-  search_results_mouseout: (evt) ->
-    this.result_clear_highlight() if $(evt.target).hasClass "active-result" or $(evt.target).parents('.active-result').first()
-
-  choice_build: (item) ->
-    choice = $('<li />', { class: "search-choice" }).html("<span>#{this.choice_label(item)}</span>")
-
-    if item.disabled
-      choice.addClass 'search-choice-disabled'
-    else
-      close_link = $('<a />', { class: 'search-choice-close', 'data-option-array-index': item.array_index })
-      close_link.bind 'click.chosen', (evt) => this.choice_destroy_link_click(evt)
-      choice.append close_link
-
-    @search_container.before  choice
-
-  choice_destroy_link_click: (evt) ->
-    evt.preventDefault()
-    evt.stopPropagation()
-    this.choice_destroy $(evt.target) unless @is_disabled
-
-  choice_destroy: (link) ->
-    if this.result_deselect( link[0].getAttribute("data-option-array-index") )
-      this.show_search_field_default()
-
-      this.results_hide() if @is_multiple and this.choices_count() > 0 and @search_field.val().length < 1
-
-      link.parents('li').first().remove()
-
-      this.search_field_scale()
-
-  results_reset: ->
-    this.reset_single_select_options()
-    @form_field.options[0].selected = true
-    this.single_set_selected_text()
-    this.show_search_field_default()
-    this.results_reset_cleanup()
-    @form_field_jq.trigger "change"
-    this.results_hide() if @active_field
-
-  results_reset_cleanup: ->
-    @current_selectedIndex = @form_field.selectedIndex
-    @selected_item.find("abbr").remove()
-
-  result_select: (evt) ->
-    if @result_highlight
-      high = @result_highlight
-
-      this.result_clear_highlight()
-
-      if @is_multiple and @max_selected_options <= this.choices_count()
-        @form_field_jq.trigger("chosen:maxselected", {chosen: this})
-        return false
-
-      if @is_multiple
-        high.removeClass("active-result")
-      else
-        this.reset_single_select_options()
-
-      high.addClass("result-selected")
-
-      item = @results_data[ high[0].getAttribute("data-option-array-index") ]
-      item.selected = true
-
-      @form_field.options[item.options_index].selected = true
-      @selected_option_count = null
-
-      if @is_multiple
-        this.choice_build item
-      else
-        this.single_set_selected_text(this.choice_label(item))
-
-      this.results_hide() unless (evt.metaKey or evt.ctrlKey) and @is_multiple
-      this.show_search_field_default()
-
-      @form_field_jq.trigger "change", {'selected': @form_field.options[item.options_index].value} if @is_multiple || @form_field.selectedIndex != @current_selectedIndex
-      @current_selectedIndex = @form_field.selectedIndex
-
-      evt.preventDefault()
-
-      this.search_field_scale()
-
-  single_set_selected_text: (text=@default_text) ->
-    if text is @default_text
-      @selected_item.addClass("chosen-default")
-    else
-      this.single_deselect_control_build()
-      @selected_item.removeClass("chosen-default")
-
-    @selected_item.find("span").html(text)
-
-  result_deselect: (pos) ->
-    result_data = @results_data[pos]
-
-    if not @form_field.options[result_data.options_index].disabled
-      result_data.selected = false
-
-      @form_field.options[result_data.options_index].selected = false
-      @selected_option_count = null
-
-      this.result_clear_highlight()
-      this.winnow_results() if @results_showing
-
-      @form_field_jq.trigger "change", {deselected: @form_field.options[result_data.options_index].value}
-      this.search_field_scale()
-
-      return true
-    else
-      return false
-
-  single_deselect_control_build: ->
-    return unless @allow_single_deselect
-    @selected_item.find("span").first().after "<abbr class=\"search-choice-close\"></abbr>" unless @selected_item.find("abbr").length
-    @selected_item.addClass("chosen-single-with-deselect")
-
-  get_search_text: ->
-    $('<div/>').text($.trim(@search_field.val())).html()
-
-  winnow_results_set_highlight: ->
-    selected_results = if not @is_multiple then @search_results.find(".result-selected.active-result") else []
-    do_high = if selected_results.length then selected_results.first() else @search_results.find(".active-result").first()
-
-    this.result_do_highlight do_high if do_high?
-
-  no_results: (terms) ->
-    no_results_html = $('<li class="no-results">' + @results_none_found + ' "<span></span>"</li>')
-    no_results_html.find("span").first().html(terms)
-
-    @search_results.append no_results_html
-    @form_field_jq.trigger("chosen:no_results", {chosen:this})
-
-  no_results_clear: ->
-    @search_results.find(".no-results").remove()
-
-  keydown_arrow: ->
-    if @results_showing and @result_highlight
-      next_sib = @result_highlight.nextAll("li.active-result").first()
-      this.result_do_highlight next_sib if next_sib
-    else
-      this.results_show()
-
-  keyup_arrow: ->
-    if not @results_showing and not @is_multiple
-      this.results_show()
-    else if @result_highlight
-      prev_sibs = @result_highlight.prevAll("li.active-result")
-
-      if prev_sibs.length
-        this.result_do_highlight prev_sibs.first()
-      else
-        this.results_hide() if this.choices_count() > 0
-        this.result_clear_highlight()
-
-  keydown_backstroke: ->
-    if @pending_backstroke
-      this.choice_destroy @pending_backstroke.find("a").first()
-      this.clear_backstroke()
-    else
-      next_available_destroy = @search_container.siblings("li.search-choice").last()
-      if next_available_destroy.length and not next_available_destroy.hasClass("search-choice-disabled")
-        @pending_backstroke = next_available_destroy
-        if @single_backstroke_delete
-          @keydown_backstroke()
-        else
-          @pending_backstroke.addClass "search-choice-focus"
-
-  clear_backstroke: ->
-    @pending_backstroke.removeClass "search-choice-focus" if @pending_backstroke
-    @pending_backstroke = null
-
-  keydown_checker: (evt) ->
-    stroke = evt.which ? evt.keyCode
-    this.search_field_scale()
-
-    this.clear_backstroke() if stroke != 8 and this.pending_backstroke
-
-    switch stroke
-      when 8
-        @backstroke_length = this.search_field.val().length
-        break
-      when 9
-        this.result_select(evt) if this.results_showing and not @is_multiple
-        @mouse_on_container = false
-        break
-      when 13
-        evt.preventDefault() if this.results_showing
-        break
-      when 32
-        evt.preventDefault() if @disable_search
-        break
-      when 38
-        evt.preventDefault()
-        this.keyup_arrow()
-        break
-      when 40
-        evt.preventDefault()
-        this.keydown_arrow()
-        break
-
-  search_field_scale: ->
-    if @is_multiple
-      h = 0
-      w = 0
-
-      style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"
-      styles = ['font-size','font-style', 'font-weight', 'font-family','line-height', 'text-transform', 'letter-spacing']
-
-      for style in styles
-        style_block += style + ":" + @search_field.css(style) + ";"
-
-      div = $('<div />', { 'style' : style_block })
-      div.text @search_field.val()
-      $('body').append div
-
-      w = div.width() + 25
-      div.remove()
-
-      f_width = @container.outerWidth()
-
-      if( w > f_width - 10 )
-        w = f_width - 10
-
-      @search_field.css({'width': w + 'px'})
diff --git a/profiles/wcm_base/libraries/chosen/coffee/chosen.proto.coffee b/profiles/wcm_base/libraries/chosen/coffee/chosen.proto.coffee
deleted file mode 100644
index 9e3ae0840dec2d3888143764adf988b6563e8a01..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/coffee/chosen.proto.coffee
+++ /dev/null
@@ -1,507 +0,0 @@
-class @Chosen extends AbstractChosen
-
-  setup: ->
-    @current_selectedIndex = @form_field.selectedIndex
-    @is_rtl = @form_field.hasClassName "chosen-rtl"
-
-  set_default_values: ->
-    super()
-
-    # HTML Templates
-    @single_temp = new Template('<a class="chosen-single chosen-default"><span>#{default}</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>')
-    @multi_temp = new Template('<ul class="chosen-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>')
-    @no_results_temp = new Template('<li class="no-results">' + @results_none_found + ' "<span>#{terms}</span>"</li>')
-
-  set_up_html: ->
-    container_classes = ["chosen-container"]
-    container_classes.push "chosen-container-" + (if @is_multiple then "multi" else "single")
-    container_classes.push @form_field.className if @inherit_select_classes && @form_field.className
-    container_classes.push "chosen-rtl" if @is_rtl
-
-    container_props =
-      'class': container_classes.join ' '
-      'style': "width: #{this.container_width()};"
-      'title': @form_field.title
-
-    container_props.id = @form_field.id.replace(/[^\w]/g, '_') + "_chosen" if @form_field.id.length
-
-    @container = if @is_multiple then new Element('div', container_props).update( @multi_temp.evaluate({ "default": @default_text}) ) else new Element('div', container_props).update( @single_temp.evaluate({ "default":@default_text }) )
-
-    @form_field.hide().insert({ after: @container })
-    @dropdown = @container.down('div.chosen-drop')
-
-    @search_field = @container.down('input')
-    @search_results = @container.down('ul.chosen-results')
-    this.search_field_scale()
-
-    @search_no_results = @container.down('li.no-results')
-
-    if @is_multiple
-      @search_choices = @container.down('ul.chosen-choices')
-      @search_container = @container.down('li.search-field')
-    else
-      @search_container = @container.down('div.chosen-search')
-      @selected_item = @container.down('.chosen-single')
-
-    this.results_build()
-    this.set_tab_index()
-    this.set_label_behavior()
-
-  on_ready: ->
-    @form_field.fire("chosen:ready", {chosen: this})
-
-  register_observers: ->
-    @container.observe "touchstart", (evt) => this.container_mousedown(evt); evt.preventDefault()
-    @container.observe "touchend", (evt) => this.container_mouseup(evt); evt.preventDefault()
-
-    @container.observe "mousedown", (evt) => this.container_mousedown(evt)
-    @container.observe "mouseup", (evt) => this.container_mouseup(evt)
-    @container.observe "mouseenter", (evt) => this.mouse_enter(evt)
-    @container.observe "mouseleave", (evt) => this.mouse_leave(evt)
-
-    @search_results.observe "mouseup", (evt) => this.search_results_mouseup(evt)
-    @search_results.observe "mouseover", (evt) => this.search_results_mouseover(evt)
-    @search_results.observe "mouseout", (evt) => this.search_results_mouseout(evt)
-    @search_results.observe "mousewheel", (evt) => this.search_results_mousewheel(evt)
-    @search_results.observe "DOMMouseScroll", (evt) => this.search_results_mousewheel(evt)
-
-    @search_results.observe "touchstart", (evt) => this.search_results_touchstart(evt)
-    @search_results.observe "touchmove", (evt) => this.search_results_touchmove(evt)
-    @search_results.observe "touchend", (evt) => this.search_results_touchend(evt)
-
-    @form_field.observe "chosen:updated", (evt) => this.results_update_field(evt)
-    @form_field.observe "chosen:activate", (evt) => this.activate_field(evt)
-    @form_field.observe "chosen:open", (evt) => this.container_mousedown(evt)
-    @form_field.observe "chosen:close", (evt) => this.input_blur(evt)
-
-    @search_field.observe "blur", (evt) => this.input_blur(evt)
-    @search_field.observe "keyup", (evt) => this.keyup_checker(evt)
-    @search_field.observe "keydown", (evt) => this.keydown_checker(evt)
-    @search_field.observe "focus", (evt) => this.input_focus(evt)
-    @search_field.observe "cut", (evt) => this.clipboard_event_checker(evt)
-    @search_field.observe "paste", (evt) => this.clipboard_event_checker(evt)
-
-    if @is_multiple
-      @search_choices.observe "click", (evt) => this.choices_click(evt)
-    else
-      @container.observe "click", (evt) => evt.preventDefault() # gobble click of anchor
-
-  destroy: ->
-    @container.ownerDocument.stopObserving "click", @click_test_action
-
-    @form_field.stopObserving()
-    @container.stopObserving()
-    @search_results.stopObserving()
-    @search_field.stopObserving()
-    @form_field_label.stopObserving() if @form_field_label?
-
-    if @is_multiple
-      @search_choices.stopObserving()
-      @container.select(".search-choice-close").each (choice) ->
-        choice.stopObserving()
-    else
-      @selected_item.stopObserving()
-
-    if @search_field.tabIndex
-      @form_field.tabIndex = @search_field.tabIndex
-
-    @container.remove()
-    @form_field.show()
-
-  search_field_disabled: ->
-    @is_disabled = @form_field.disabled
-    if(@is_disabled)
-      @container.addClassName 'chosen-disabled'
-      @search_field.disabled = true
-      @selected_item.stopObserving "focus", @activate_action if !@is_multiple
-      this.close_field()
-    else
-      @container.removeClassName 'chosen-disabled'
-      @search_field.disabled = false
-      @selected_item.observe "focus", @activate_action if !@is_multiple
-
-  container_mousedown: (evt) ->
-    if !@is_disabled
-      if evt and evt.type is "mousedown" and not @results_showing
-        evt.stop()
-
-      if not (evt? and evt.target.hasClassName "search-choice-close")
-        if not @active_field
-          @search_field.clear() if @is_multiple
-          @container.ownerDocument.observe "click", @click_test_action
-          this.results_show()
-        else if not @is_multiple and evt and (evt.target is @selected_item || evt.target.up("a.chosen-single"))
-          this.results_toggle()
-
-        this.activate_field()
-
-  container_mouseup: (evt) ->
-    this.results_reset(evt) if evt.target.nodeName is "ABBR" and not @is_disabled
-
-  search_results_mousewheel: (evt) ->
-    delta = evt.deltaY or -evt.wheelDelta or evt.detail
-    if delta?
-      evt.preventDefault()
-      delta = delta * 40 if evt.type is 'DOMMouseScroll'
-      @search_results.scrollTop = delta + @search_results.scrollTop
-
-  blur_test: (evt) ->
-    this.close_field() if not @active_field and @container.hasClassName("chosen-container-active")
-
-  close_field: ->
-    @container.ownerDocument.stopObserving "click", @click_test_action
-
-    @active_field = false
-    this.results_hide()
-
-    @container.removeClassName "chosen-container-active"
-    this.clear_backstroke()
-
-    this.show_search_field_default()
-    this.search_field_scale()
-
-  activate_field: ->
-    @container.addClassName "chosen-container-active"
-    @active_field = true
-
-    @search_field.value = @search_field.value
-    @search_field.focus()
-
-  test_active_click: (evt) ->
-    if evt.target.up('.chosen-container') is @container
-      @active_field = true
-    else
-      this.close_field()
-
-  results_build: ->
-    @parsing = true
-    @selected_option_count = null
-
-    @results_data = SelectParser.select_to_array @form_field
-
-    if @is_multiple
-      @search_choices.select("li.search-choice").invoke("remove")
-    else if not @is_multiple
-      this.single_set_selected_text()
-      if @disable_search or @form_field.options.length <= @disable_search_threshold
-        @search_field.readOnly = true
-        @container.addClassName "chosen-container-single-nosearch"
-      else
-        @search_field.readOnly = false
-        @container.removeClassName "chosen-container-single-nosearch"
-
-    this.update_results_content this.results_option_build({first:true})
-
-    this.search_field_disabled()
-    this.show_search_field_default()
-    this.search_field_scale()
-
-    @parsing = false
-
-  result_do_highlight: (el) ->
-      this.result_clear_highlight()
-
-      @result_highlight = el
-      @result_highlight.addClassName "highlighted"
-
-      maxHeight = parseInt @search_results.getStyle('maxHeight'), 10
-      visible_top = @search_results.scrollTop
-      visible_bottom = maxHeight + visible_top
-
-      high_top = @result_highlight.positionedOffset().top
-      high_bottom = high_top + @result_highlight.getHeight()
-
-      if high_bottom >= visible_bottom
-        @search_results.scrollTop = if (high_bottom - maxHeight) > 0 then (high_bottom - maxHeight) else 0
-      else if high_top < visible_top
-        @search_results.scrollTop = high_top
-
-  result_clear_highlight: ->
-    @result_highlight.removeClassName('highlighted') if @result_highlight
-    @result_highlight = null
-
-  results_show: ->
-    if @is_multiple and @max_selected_options <= this.choices_count()
-      @form_field.fire("chosen:maxselected", {chosen: this})
-      return false
-
-    @container.addClassName "chosen-with-drop"
-    @results_showing = true
-
-    @search_field.focus()
-    @search_field.value = @search_field.value
-
-    this.winnow_results()
-    @form_field.fire("chosen:showing_dropdown", {chosen: this})
-
-  update_results_content: (content) ->
-    @search_results.update content
-
-  results_hide: ->
-    if @results_showing
-      this.result_clear_highlight()
-
-      @container.removeClassName "chosen-with-drop"
-      @form_field.fire("chosen:hiding_dropdown", {chosen: this})
-
-    @results_showing = false
-
-
-  set_tab_index: (el) ->
-    if @form_field.tabIndex
-      ti = @form_field.tabIndex
-      @form_field.tabIndex = -1
-      @search_field.tabIndex = ti
-
-  set_label_behavior: ->
-    @form_field_label = @form_field.up("label") # first check for a parent label
-    if not @form_field_label?
-      @form_field_label = $$("label[for='#{@form_field.id}']").first() #next check for a for=#{id}
-
-    if @form_field_label?
-      @form_field_label.observe "click", (evt) => if @is_multiple then this.container_mousedown(evt) else this.activate_field()
-
-  show_search_field_default: ->
-    if @is_multiple and this.choices_count() < 1 and not @active_field
-      @search_field.value = @default_text
-      @search_field.addClassName "default"
-    else
-      @search_field.value = ""
-      @search_field.removeClassName "default"
-
-  search_results_mouseup: (evt) ->
-    target = if evt.target.hasClassName("active-result") then evt.target else evt.target.up(".active-result")
-    if target
-      @result_highlight = target
-      this.result_select(evt)
-      @search_field.focus()
-
-  search_results_mouseover: (evt) ->
-    target = if evt.target.hasClassName("active-result") then evt.target else evt.target.up(".active-result")
-    this.result_do_highlight( target ) if target
-
-  search_results_mouseout: (evt) ->
-    this.result_clear_highlight() if evt.target.hasClassName('active-result') or evt.target.up('.active-result')
-
-  choice_build: (item) ->
-    choice = new Element('li', { class: "search-choice" }).update("<span>#{this.choice_label(item)}</span>")
-
-    if item.disabled
-      choice.addClassName 'search-choice-disabled'
-    else
-      close_link = new Element('a', { href: '#', class: 'search-choice-close', rel: item.array_index })
-      close_link.observe "click", (evt) => this.choice_destroy_link_click(evt)
-      choice.insert close_link
-
-    @search_container.insert { before: choice }
-
-  choice_destroy_link_click: (evt) ->
-    evt.preventDefault()
-    evt.stopPropagation()
-    this.choice_destroy evt.target unless @is_disabled
-
-  choice_destroy: (link) ->
-    if this.result_deselect link.readAttribute("rel")
-      this.show_search_field_default()
-
-      this.results_hide() if @is_multiple and this.choices_count() > 0 and @search_field.value.length < 1
-
-      link.up('li').remove()
-
-      this.search_field_scale()
-
-  results_reset: ->
-    this.reset_single_select_options()
-    @form_field.options[0].selected = true
-    this.single_set_selected_text()
-    this.show_search_field_default()
-    this.results_reset_cleanup()
-    @form_field.simulate("change") if typeof Event.simulate is 'function'
-    this.results_hide() if @active_field
-
-  results_reset_cleanup: ->
-    @current_selectedIndex = @form_field.selectedIndex
-    deselect_trigger = @selected_item.down("abbr")
-    deselect_trigger.remove() if(deselect_trigger)
-
-  result_select: (evt) ->
-    if @result_highlight
-      high = @result_highlight
-      this.result_clear_highlight()
-
-      if @is_multiple and @max_selected_options <= this.choices_count()
-        @form_field.fire("chosen:maxselected", {chosen: this})
-        return false
-
-      if @is_multiple
-        high.removeClassName("active-result")
-      else
-        this.reset_single_select_options()
-
-      high.addClassName("result-selected")
-
-      item = @results_data[ high.getAttribute("data-option-array-index") ]
-      item.selected = true
-
-      @form_field.options[item.options_index].selected = true
-      @selected_option_count = null
-
-      if @is_multiple
-        this.choice_build item
-      else
-        this.single_set_selected_text(this.choice_label(item))
-
-      this.results_hide() unless (evt.metaKey or evt.ctrlKey) and @is_multiple
-      this.show_search_field_default()
-
-      @form_field.simulate("change") if typeof Event.simulate is 'function' && (@is_multiple || @form_field.selectedIndex != @current_selectedIndex)
-      @current_selectedIndex = @form_field.selectedIndex
-
-      evt.preventDefault()
-
-      this.search_field_scale()
-
-  single_set_selected_text: (text=@default_text) ->
-    if text is @default_text
-      @selected_item.addClassName("chosen-default")
-    else
-      this.single_deselect_control_build()
-      @selected_item.removeClassName("chosen-default")
-
-    @selected_item.down("span").update(text)
-
-  result_deselect: (pos) ->
-    result_data = @results_data[pos]
-
-    if not @form_field.options[result_data.options_index].disabled
-      result_data.selected = false
-
-      @form_field.options[result_data.options_index].selected = false
-      @selected_option_count = null
-
-      this.result_clear_highlight()
-      this.winnow_results() if @results_showing
-
-      @form_field.simulate("change") if typeof Event.simulate is 'function'
-      this.search_field_scale()
-      return true
-    else
-      return false
-
-  single_deselect_control_build: ->
-    return unless @allow_single_deselect
-    @selected_item.down("span").insert { after: "<abbr class=\"search-choice-close\"></abbr>" } unless @selected_item.down("abbr")
-    @selected_item.addClassName("chosen-single-with-deselect")
-
-  get_search_text: ->
-    @search_field.value.strip().escapeHTML()
-
-  winnow_results_set_highlight: ->
-    if not @is_multiple
-      do_high = @search_results.down(".result-selected.active-result")
-
-    if not do_high?
-      do_high = @search_results.down(".active-result")
-
-    this.result_do_highlight do_high if do_high?
-
-  no_results: (terms) ->
-    @search_results.insert @no_results_temp.evaluate( terms: terms )
-    @form_field.fire("chosen:no_results", {chosen: this})
-
-  no_results_clear: ->
-    nr = null
-    nr.remove() while nr = @search_results.down(".no-results")
-
-
-  keydown_arrow: ->
-    if @results_showing and @result_highlight
-      next_sib = @result_highlight.next('.active-result')
-      this.result_do_highlight next_sib if next_sib
-    else
-      this.results_show()
-
-  keyup_arrow: ->
-    if not @results_showing and not @is_multiple
-      this.results_show()
-    else if @result_highlight
-      sibs = @result_highlight.previousSiblings()
-      actives = @search_results.select("li.active-result")
-      prevs = sibs.intersect(actives)
-
-      if prevs.length
-        this.result_do_highlight prevs.first()
-      else
-        this.results_hide() if this.choices_count() > 0
-        this.result_clear_highlight()
-
-  keydown_backstroke: ->
-    if @pending_backstroke
-      this.choice_destroy @pending_backstroke.down("a")
-      this.clear_backstroke()
-    else
-      next_available_destroy = @search_container.siblings().last()
-      if next_available_destroy and next_available_destroy.hasClassName("search-choice") and not next_available_destroy.hasClassName("search-choice-disabled")
-        @pending_backstroke = next_available_destroy
-        @pending_backstroke.addClassName("search-choice-focus") if @pending_backstroke
-        if @single_backstroke_delete
-          @keydown_backstroke()
-        else
-          @pending_backstroke.addClassName("search-choice-focus")
-
-  clear_backstroke: ->
-    @pending_backstroke.removeClassName("search-choice-focus") if @pending_backstroke
-    @pending_backstroke = null
-
-  keydown_checker: (evt) ->
-    stroke = evt.which ? evt.keyCode
-    this.search_field_scale()
-
-    this.clear_backstroke() if stroke != 8 and this.pending_backstroke
-
-    switch stroke
-      when 8
-        @backstroke_length = this.search_field.value.length
-        break
-      when 9
-        this.result_select(evt) if this.results_showing and not @is_multiple
-        @mouse_on_container = false
-        break
-      when 13
-        evt.preventDefault() if this.results_showing
-        break
-      when 32
-        evt.preventDefault() if @disable_search
-        break
-      when 38
-        evt.preventDefault()
-        this.keyup_arrow()
-        break
-      when 40
-        evt.preventDefault()
-        this.keydown_arrow()
-        break
-
-  search_field_scale: ->
-    if @is_multiple
-      h = 0
-      w = 0
-
-      style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"
-      styles = ['font-size','font-style', 'font-weight', 'font-family','line-height', 'text-transform', 'letter-spacing']
-
-      for style in styles
-        style_block += style + ":" + @search_field.getStyle(style) + ";"
-
-      div = new Element('div', { 'style' : style_block }).update(@search_field.value.escapeHTML())
-      document.body.appendChild(div)
-
-      w = Element.measure(div, 'width') + 25
-      div.remove()
-
-      f_width = @container.getWidth()
-
-      if( w > f_width-10 )
-        w = f_width - 10
-
-      @search_field.setStyle({'width': w + 'px'})
diff --git a/profiles/wcm_base/libraries/chosen/coffee/lib/abstract-chosen.coffee b/profiles/wcm_base/libraries/chosen/coffee/lib/abstract-chosen.coffee
deleted file mode 100644
index 15f7ba6e84f4faa0684f5d399d7061b8cc59220f..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/coffee/lib/abstract-chosen.coffee
+++ /dev/null
@@ -1,304 +0,0 @@
-class AbstractChosen
-
-  constructor: (@form_field, @options={}) ->
-    return unless AbstractChosen.browser_is_supported()
-    @is_multiple = @form_field.multiple
-    this.set_default_text()
-    this.set_default_values()
-
-    this.setup()
-
-    this.set_up_html()
-    this.register_observers()
-    # instantiation done, fire ready
-    this.on_ready()
-
-  set_default_values: ->
-    @click_test_action = (evt) => this.test_active_click(evt)
-    @activate_action = (evt) => this.activate_field(evt)
-    @active_field = false
-    @mouse_on_container = false
-    @results_showing = false
-    @result_highlighted = null
-    @allow_single_deselect = if @options.allow_single_deselect? and @form_field.options[0]? and @form_field.options[0].text is "" then @options.allow_single_deselect else false
-    @disable_search_threshold = @options.disable_search_threshold || 0
-    @disable_search = @options.disable_search || false
-    @enable_split_word_search = if @options.enable_split_word_search? then @options.enable_split_word_search else true
-    @group_search = if @options.group_search? then @options.group_search else true
-    @search_contains = @options.search_contains || false
-    @single_backstroke_delete = if @options.single_backstroke_delete? then @options.single_backstroke_delete else true
-    @max_selected_options = @options.max_selected_options || Infinity
-    @inherit_select_classes = @options.inherit_select_classes || false
-    @display_selected_options = if @options.display_selected_options? then @options.display_selected_options else true
-    @display_disabled_options = if @options.display_disabled_options? then @options.display_disabled_options else true
-    @include_group_label_in_selected = @options.include_group_label_in_selected || false
-    @max_shown_results = @options.max_shown_results || Number.POSITIVE_INFINITY
-
-  set_default_text: ->
-    if @form_field.getAttribute("data-placeholder")
-      @default_text = @form_field.getAttribute("data-placeholder")
-    else if @is_multiple
-      @default_text = @options.placeholder_text_multiple || @options.placeholder_text || AbstractChosen.default_multiple_text
-    else
-      @default_text = @options.placeholder_text_single || @options.placeholder_text || AbstractChosen.default_single_text
-
-    @results_none_found = @form_field.getAttribute("data-no_results_text") || @options.no_results_text || AbstractChosen.default_no_result_text
-
-  choice_label: (item) ->
-    if @include_group_label_in_selected and item.group_label?
-      "<b class='group-name'>#{item.group_label}</b>#{item.html}"
-    else
-      item.html
-
-  mouse_enter: -> @mouse_on_container = true
-  mouse_leave: -> @mouse_on_container = false
-
-  input_focus: (evt) ->
-    if @is_multiple
-      setTimeout (=> this.container_mousedown()), 50 unless @active_field
-    else
-      @activate_field() unless @active_field
-
-  input_blur: (evt) ->
-    if not @mouse_on_container
-      @active_field = false
-      setTimeout (=> this.blur_test()), 100
-
-  results_option_build: (options) ->
-    content = ''
-    shown_results = 0
-    for data in @results_data
-      data_content = ''
-      if data.group
-        data_content = this.result_add_group data
-      else
-        data_content = this.result_add_option data
-      if data_content != ''
-        shown_results++
-        content += data_content
-
-      # this select logic pins on an awkward flag
-      # we can make it better
-      if options?.first
-        if data.selected and @is_multiple
-          this.choice_build data
-        else if data.selected and not @is_multiple
-          this.single_set_selected_text(this.choice_label(data))
-
-      if shown_results >= @max_shown_results
-        break
-
-    content
-
-  result_add_option: (option) ->
-    return '' unless option.search_match
-    return '' unless this.include_option_in_results(option)
-
-    classes = []
-    classes.push "active-result" if !option.disabled and !(option.selected and @is_multiple)
-    classes.push "disabled-result" if option.disabled and !(option.selected and @is_multiple)
-    classes.push "result-selected" if option.selected
-    classes.push "group-option" if option.group_array_index?
-    classes.push option.classes if option.classes != ""
-
-    option_el = document.createElement("li")
-    option_el.className = classes.join(" ")
-    option_el.style.cssText = option.style
-    option_el.setAttribute("data-option-array-index", option.array_index)
-    option_el.innerHTML = option.search_text
-    option_el.title = option.title if option.title
-
-    this.outerHTML(option_el)
-
-  result_add_group: (group) ->
-    return '' unless group.search_match || group.group_match
-    return '' unless group.active_options > 0
-
-    classes = []
-    classes.push "group-result"
-    classes.push group.classes if group.classes
-
-    group_el = document.createElement("li")
-    group_el.className = classes.join(" ")
-    group_el.innerHTML = group.search_text
-    group_el.title = group.title if group.title
-
-    this.outerHTML(group_el)
-
-  results_update_field: ->
-    this.set_default_text()
-    this.results_reset_cleanup() if not @is_multiple
-    this.result_clear_highlight()
-    this.results_build()
-    this.winnow_results() if @results_showing
-
-  reset_single_select_options: () ->
-    for result in @results_data
-      result.selected = false if result.selected
-
-  results_toggle: ->
-    if @results_showing
-      this.results_hide()
-    else
-      this.results_show()
-
-  results_search: (evt) ->
-    if @results_showing
-      this.winnow_results()
-    else
-      this.results_show()
-
-  winnow_results: ->
-    this.no_results_clear()
-
-    results = 0
-
-    searchText = this.get_search_text()
-    escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
-    zregex = new RegExp(escapedSearchText, 'i')
-    regex = this.get_search_regex(escapedSearchText)
-
-    for option in @results_data
-
-      option.search_match = false
-      results_group = null
-
-      if this.include_option_in_results(option)
-
-        if option.group
-          option.group_match = false
-          option.active_options = 0
-
-        if option.group_array_index? and @results_data[option.group_array_index]
-          results_group = @results_data[option.group_array_index]
-          results += 1 if results_group.active_options is 0 and results_group.search_match
-          results_group.active_options += 1
-
-        option.search_text = if option.group then option.label else option.html
-
-        unless option.group and not @group_search
-          option.search_match = this.search_string_match(option.search_text, regex)
-          results += 1 if option.search_match and not option.group
-
-          if option.search_match
-            if searchText.length
-              startpos = option.search_text.search zregex
-              text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length)
-              option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos)
-
-            results_group.group_match = true if results_group?
-
-          else if option.group_array_index? and @results_data[option.group_array_index].search_match
-            option.search_match = true
-
-    this.result_clear_highlight()
-
-    if results < 1 and searchText.length
-      this.update_results_content ""
-      this.no_results searchText
-    else
-      this.update_results_content this.results_option_build()
-      this.winnow_results_set_highlight()
-
-  get_search_regex: (escaped_search_string) ->
-    regex_anchor = if @search_contains then "" else "^"
-    new RegExp(regex_anchor + escaped_search_string, 'i')
-
-  search_string_match: (search_string, regex) ->
-    if regex.test search_string
-      return true
-    else if @enable_split_word_search and (search_string.indexOf(" ") >= 0 or search_string.indexOf("[") == 0)
-      #TODO: replace this substitution of /\[\]/ with a list of characters to skip.
-      parts = search_string.replace(/\[|\]/g, "").split(" ")
-      if parts.length
-        for part in parts
-          if regex.test part
-            return true
-
-  choices_count: ->
-    return @selected_option_count if @selected_option_count?
-
-    @selected_option_count = 0
-    for option in @form_field.options
-      @selected_option_count += 1 if option.selected
-
-    return @selected_option_count
-
-  choices_click: (evt) ->
-    evt.preventDefault()
-    this.results_show() unless @results_showing or @is_disabled
-
-  keyup_checker: (evt) ->
-    stroke = evt.which ? evt.keyCode
-    this.search_field_scale()
-
-    switch stroke
-      when 8
-        if @is_multiple and @backstroke_length < 1 and this.choices_count() > 0
-          this.keydown_backstroke()
-        else if not @pending_backstroke
-          this.result_clear_highlight()
-          this.results_search()
-      when 13
-        evt.preventDefault()
-        this.result_select(evt) if this.results_showing
-      when 27
-        this.results_hide() if @results_showing
-        return true
-      when 9, 38, 40, 16, 91, 17, 18
-        # don't do anything on these keys
-      else this.results_search()
-
-  clipboard_event_checker: (evt) ->
-    setTimeout (=> this.results_search()), 50
-
-  container_width: ->
-    return if @options.width? then @options.width else "#{@form_field.offsetWidth}px"
-
-  include_option_in_results: (option) ->
-    return false if @is_multiple and (not @display_selected_options and option.selected)
-    return false if not @display_disabled_options and option.disabled
-    return false if option.empty
-
-    return true
-
-  search_results_touchstart: (evt) ->
-    @touch_started = true
-    this.search_results_mouseover(evt)
-
-  search_results_touchmove: (evt) ->
-    @touch_started = false
-    this.search_results_mouseout(evt)
-
-  search_results_touchend: (evt) ->
-    this.search_results_mouseup(evt) if @touch_started
-
-  outerHTML: (element) ->
-    return element.outerHTML if element.outerHTML
-    tmp = document.createElement("div")
-    tmp.appendChild(element)
-    tmp.innerHTML
-
-  # class methods and variables ============================================================
-
-  @browser_is_supported: ->
-    if /iP(od|hone)/i.test(window.navigator.userAgent)
-      return false
-    if /Android/i.test(window.navigator.userAgent)
-      return false if /Mobile/i.test(window.navigator.userAgent)
-    if /IEMobile/i.test(window.navigator.userAgent)
-      return false
-    if /Windows Phone/i.test(window.navigator.userAgent)
-      return false
-    if /BlackBerry/i.test(window.navigator.userAgent)
-      return false
-    if /BB10/i.test(window.navigator.userAgent)
-      return false
-    if window.navigator.appName is "Microsoft Internet Explorer"
-      return document.documentMode >= 8
-    return true
-
-  @default_multiple_text: "Select Some Options"
-  @default_single_text: "Select an Option"
-  @default_no_result_text: "No results match"
-
diff --git a/profiles/wcm_base/libraries/chosen/coffee/lib/select-parser.coffee b/profiles/wcm_base/libraries/chosen/coffee/lib/select-parser.coffee
deleted file mode 100644
index 3cd0637b2d0bb52e3425a52b9efb2bd2e6745127..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/coffee/lib/select-parser.coffee
+++ /dev/null
@@ -1,68 +0,0 @@
-class SelectParser
-
-  constructor: ->
-    @options_index = 0
-    @parsed = []
-
-  add_node: (child) ->
-    if child.nodeName.toUpperCase() is "OPTGROUP"
-      this.add_group child
-    else
-      this.add_option child
-
-  add_group: (group) ->
-    group_position = @parsed.length
-    @parsed.push
-      array_index: group_position
-      group: true
-      label: this.escapeExpression(group.label)
-      title: group.title if group.title
-      children: 0
-      disabled: group.disabled,
-      classes: group.className
-    this.add_option( option, group_position, group.disabled ) for option in group.childNodes
-
-  add_option: (option, group_position, group_disabled) ->
-    if option.nodeName.toUpperCase() is "OPTION"
-      if option.text != ""
-        if group_position?
-          @parsed[group_position].children += 1
-        @parsed.push
-          array_index: @parsed.length
-          options_index: @options_index
-          value: option.value
-          text: option.text
-          html: option.innerHTML
-          title: option.title if option.title
-          selected: option.selected
-          disabled: if group_disabled is true then group_disabled else option.disabled
-          group_array_index: group_position
-          group_label: if group_position? then @parsed[group_position].label else null
-          classes: option.className
-          style: option.style.cssText
-      else
-        @parsed.push
-          array_index: @parsed.length
-          options_index: @options_index
-          empty: true
-      @options_index += 1
-
-  escapeExpression: (text) ->
-    if not text? or text is false
-      return ""
-    unless /[\&\<\>\"\'\`]/.test(text)
-      return text
-    map =
-      "<": "&lt;"
-      ">": "&gt;"
-      '"': "&quot;"
-      "'": "&#x27;"
-      "`": "&#x60;"
-    unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g
-    text.replace unsafe_chars, (chr) ->
-      map[chr] || "&amp;"
-
-SelectParser.select_to_array = (select) ->
-  parser = new SelectParser()
-  parser.add_node( child ) for child in select.childNodes
-  parser.parsed
diff --git a/profiles/wcm_base/libraries/chosen/config.rb b/profiles/wcm_base/libraries/chosen/config.rb
deleted file mode 100644
index a9f6692151edba504fc12125b1952becd8e244ff..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/config.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-http_path = "/"
-css_dir = "public"
-sass_dir = "sass"
-images_dir = "public"
-
-relative_assets = true
-line_comments = false
-asset_cache_buster :none
\ No newline at end of file
diff --git a/profiles/wcm_base/libraries/chosen/contributing.md b/profiles/wcm_base/libraries/chosen/contributing.md
deleted file mode 100644
index 2b3d5e1bf35c9d01b5ddea2dcf61120acec05546..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/contributing.md
+++ /dev/null
@@ -1,190 +0,0 @@
-# Contributing to this project
-
-Please take a moment to review this document in order to make the contribution
-process easy and effective for everyone involved.
-
-Following these guidelines will help us get back to you more quickly, and will
-show that you care about making Chosen better just like we do. In return, we'll
-do our best to respond to your issue or pull request as soon as possible with
-the same respect.
-
-_**Please Note:** These guidelines are adapted from [@necolas](https://github.com/necolas)'s
-[issue-guidelines](https://github.com/necolas/issue-guidelines) and serve as
-an excellent starting point for contributing to any open source project._
-
-
-## Using the issue tracker
-
-The [issue tracker](https://github.com/harvesthq/chosen/issues) is the
-preferred channel for [bug reports](#bugs), [features requests](#features)
-and [submitting pull requests](#pull-requests), but please respect the
-following restrictions:
-
-* Support issues or usage question that are not bugs should be posted on
-[Stack Overflow, using the `chosen.js`](http://stackoverflow.com/questions/tagged/chosen.js) tag
-(related tags: [`jquery-chosen`](http://stackoverflow.com/questions/tagged/jquery-chosen),
-[`prototype-chosen`](http://stackoverflow.com/questions/tagged/prototype-chosen)).
-
-* Please **do not** derail or troll issues. Keep the discussion on topic and
-  respect the opinions of others.
-
-
-<a name="bugs"></a>
-## Bug reports
-
-A bug is a _demonstrable problem_ that is caused by the code in the repository.
-Good bug reports are extremely helpful &mdash; thank you!
-
-Guidelines for bug reports:
-
-1. **Use the [GitHub issue search](https://github.com/harvesthq/chosen/search?type=Issues)** &mdash; check if the issue has already been
-   reported.
-
-2. **Check if the bug has already been fixed** &mdash; try to reproduce it using the
-   repository's latest `master` changes.
-
-3. **Isolate the problem** &mdash; ideally create a [reduced test
-   case](http://css-tricks.com/6263-reduced-test-cases/) and a live example
-   (perhaps a [fiddle](http://jsfiddle.net)).
-
-A good bug report shouldn't leave others needing to contact you for more
-information. Please try to be as detailed as possible in your report. What is
-your environment? What steps will reproduce the issue? What browser(s) and OS
-experience the problem? What outcome did you expect, and how did it differ from
-what you actually saw? All these details will help people to fix any potential
-bugs.
-
-Example:
-
-> Short and descriptive example bug report title
->
-> A summary of the issue and the browser/OS environment in which it occurs. If
-> suitable, include the steps required to reproduce the bug.
->
-> 1. This is the first step
-> 2. This is the second step
-> 3. Further steps, etc.
->
-> `<url>` - a link to the reduced test case
->
-> Any other information you want to share that is relevant to the issue being
-> reported. This might include the lines of code that you have identified as
-> causing the bug, and potential solutions (and your opinions on their
-> merits).
-
-**Note:** In an effort to keep open issues to a manageable number, we will close any issues
-that do not provide enough information for us to be able to work on a solution.
-You will be encouraged to provide the necessary details, after which we will reopen the issue.
-
-<a name="features"></a>
-## Feature requests
-
-Feature requests are welcome. But take a moment to find out whether your idea
-fits with the scope and aims of the project. It's up to *you* to make a strong
-case to convince the project's developers of the merits of this feature. Please
-provide as much detail and context as possible.
-
-Building something great means choosing features carefully especially because it
-is much, much easier to add features than it is to take them away. Additions
-to Chosen will be evaluated on a combination of scope (how well it fits into the
-project), maintenance burden and general usefulness.
-
-Creating something great often means saying no to seemingly good ideas. Don't
-dispair if your feature request isn't accepted, take action! Fork the
-repository, build your idea and share it with others. We released Chosen under
-the MIT License for this purpose precisely. Open source works best when smart
-and dedicated people riff off of each others' ideas to make even greater things.
-
-
-
-<a name="pull-requests"></a>
-## Pull requests
-
-Good pull requests &mdash; patches, improvements, new features &mdash; are a fantastic help.
-They should remain focused in scope and avoid containing unrelated commits.
-
-**Please ask first** before embarking on any significant pull request (e.g.
-implementing features, refactoring code, porting to a different language),
-otherwise you risk spending a lot of time working on something that the
-project's developers might not want to merge into the project. You can solicit
-feedback and opinions in an open feature request thread or create a new one.
-
-Please use the [git flow for pull requests](#git-flow) and follow Chosen's
-[code conventions](#code-conventions) before submitting your work. Adhering to
-these guidelines is the best way to get your work included in Chosen.
-
-<a name="git-flow"></a>
-#### Git Flow for pull requests
-
-1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
-   and configure the remotes:
-
-   ```bash
-   # Clone your fork of the repo into the current directory
-   git clone git@github.com:<YOUR_USERNAME>/chosen.git
-   # Navigate to the newly cloned directory
-   cd chosen
-   # Assign the original repo to a remote called "upstream"
-   git remote add upstream https://github.com/harvesthq/chosen
-   ```
-
-2. If you cloned a while ago, get the latest changes from upstream:
-
-   ```bash
-   git checkout master
-   git pull upstream master
-   ```
-
-3. Create a new topic branch (off the main project development branch) to
-   contain your feature, change, or fix:
-
-   ```bash
-   git checkout -b <topic-branch-name>
-   ```
-
-4. Commit your changes in logical chunks. Please adhere to these [git commit
-   message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
-   or your code is unlikely be merged into the main project. Use Git's
-   [interactive rebase](https://help.github.com/articles/interactive-rebase)
-   feature to tidy up your commits before making them public.
-
-5. Locally merge (or rebase) the upstream development branch into your topic branch:
-
-   ```bash
-   git pull [--rebase] upstream master
-   ```
-
-6. Push your topic branch up to your fork:
-
-   ```bash
-   git push origin <topic-branch-name>
-   ```
-
-7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
-    with a clear title and description.
-
-**IMPORTANT**: By submitting a patch, you agree to allow the project owner to
-license your work under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
-
-<a name="code-conventions"></a>
-#### Chosen Code Conventions
-
-1. Make all changes in CoffeeScript files, **not** JavaScript files.
-2. Use [Grunt](#grunt) to build the JavaScript files.
-3. For feature changes, update both jQuery *and* Prototype versions
-4. Don't manually update the version number in `package.json`. This is done using a Grunt task on deployment.
-
-<a name="grunt"></a>
-#### Using CoffeeScript and Grunt
-
-
-To install all development dependencies, in the project's root directory, run
-
-    npm install && gem install bundler && bundle install
-
-Once you're configured, building the JavaScript from the command line is easy:
-
-    grunt build                # build Chosen from source
-    grunt watch                # watch coffee/ for changes and build Chosen
-
-If you're interested, you can find the task in [Gruntfile.coffee](https://github.com/harvesthq/chosen/blob/master/Gruntfile.coffee).
diff --git a/profiles/wcm_base/libraries/chosen/public/docsupport/chosen.png b/profiles/wcm_base/libraries/chosen/docsupport/chosen.png
similarity index 100%
rename from profiles/wcm_base/libraries/chosen/public/docsupport/chosen.png
rename to profiles/wcm_base/libraries/chosen/docsupport/chosen.png
diff --git a/profiles/wcm_base/libraries/chosen/public/docsupport/oss-credit.png b/profiles/wcm_base/libraries/chosen/docsupport/oss-credit.png
similarity index 100%
rename from profiles/wcm_base/libraries/chosen/public/docsupport/oss-credit.png
rename to profiles/wcm_base/libraries/chosen/docsupport/oss-credit.png
diff --git a/profiles/wcm_base/libraries/chosen/public/docsupport/prism.css b/profiles/wcm_base/libraries/chosen/docsupport/prism.css
similarity index 100%
rename from profiles/wcm_base/libraries/chosen/public/docsupport/prism.css
rename to profiles/wcm_base/libraries/chosen/docsupport/prism.css
diff --git a/profiles/wcm_base/libraries/chosen/public/docsupport/prism.js b/profiles/wcm_base/libraries/chosen/docsupport/prism.js
similarity index 100%
rename from profiles/wcm_base/libraries/chosen/public/docsupport/prism.js
rename to profiles/wcm_base/libraries/chosen/docsupport/prism.js
diff --git a/profiles/wcm_base/libraries/chosen/public/docsupport/style.css b/profiles/wcm_base/libraries/chosen/docsupport/style.css
similarity index 100%
rename from profiles/wcm_base/libraries/chosen/public/docsupport/style.css
rename to profiles/wcm_base/libraries/chosen/docsupport/style.css
diff --git a/profiles/wcm_base/libraries/chosen/public/index.html b/profiles/wcm_base/libraries/chosen/index.html
similarity index 99%
rename from profiles/wcm_base/libraries/chosen/public/index.html
rename to profiles/wcm_base/libraries/chosen/index.html
index 7e3ed19b5c1c7ce198f7967ea54a29a48dfab471..3ecdeaa7a317d2d95b9832dc18c5da72b31df56a 100644
--- a/profiles/wcm_base/libraries/chosen/public/index.html
+++ b/profiles/wcm_base/libraries/chosen/index.html
@@ -1209,7 +1209,7 @@
 
       <h2><a name="hide-search-on-single-select" class="anchor" href="#hide-search-on-single-select">Hide Search on Single Select</a></h2>
       <div class="side-by-side clearfix">
-        <p>The <code>disable_search_threshold</code> option can be specified to hide the search input on single selects if there are <i>n</i> or fewer options.</p>
+        <p>The disable_search_threshold option can be specified to hide the search input on single selects if there are fewer than (n) options.</p>
         <pre><code class="language-javascript">$(".chosen-select").chosen({disable_search_threshold: 10});</code></pre>
         <p></p>
         <div>
@@ -1326,12 +1326,12 @@
         </div>
       </div>
 
-      <h2><a name="change-update-events" class="anchor" href="#change-update-events">Observing, Updating, and Destroying Chosen</a></h2>
+      <h2><a name="change-update-events" class="anchor" href="#change-update-events">Change / Update Events</a></h2>
       <div class="side-by-side clearfix">
         <ul>
           <li>
-            <h3>Observing Form Field Changes</h3>
-            <p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event on the original form field. That let's you do something like this:</p>
+            <h3>Form Field Change</h3>
+            <p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event* on the original form field. That let's you do something like this:</p>
             <pre><code class="language-javascript">$("#form_field").chosen().change( &hellip; );</code></pre>
           </li>
           <li>
@@ -1339,11 +1339,6 @@
             <p>If you need to update the options in your select field and want Chosen to pick up the changes, you'll need to trigger the "chosen:updated" event on the field. Chosen will re-build itself based on the updated content.</p>
               <pre><code class="language-javascript">$("#form_field").trigger("chosen:updated");</code></pre>
           </li>
-          <li>
-            <h3>Destroying Chosen</h3>
-            <p>To destroy Chosen and revert back to the native select:</p>
-              <pre><code class="language-javascript">$("#form_field").chosen("destroy");</code></pre>
-          </li>
         </ul>
       </div>
 
diff --git a/profiles/wcm_base/libraries/chosen/public/index.proto.html b/profiles/wcm_base/libraries/chosen/index.proto.html
similarity index 99%
rename from profiles/wcm_base/libraries/chosen/public/index.proto.html
rename to profiles/wcm_base/libraries/chosen/index.proto.html
index cc611ccc06cad7cde3503e42dfa65019fd3f133b..08091f762529266f5121fe31fd5688a6176a2315 100644
--- a/profiles/wcm_base/libraries/chosen/public/index.proto.html
+++ b/profiles/wcm_base/libraries/chosen/index.proto.html
@@ -1210,7 +1210,7 @@
 
       <h2><a name="hide-search-on-single-select" class="anchor" href="#hide-search-on-single-select">Hide Search on Single Select</a></h2>
       <div class="side-by-side clearfix">
-        <p>The <code>disable_search_threshold</code> option can be specified to hide the search input on single selects if there are <i>n</i> or fewer options.</p>
+        <p>The disable_search_threshold option can be specified to hide the search input on single selects if there are fewer than (n) options.</p>
         <pre><code class="language-javascript"> new Chosen($("chosen_select_field"),{disable_search_threshold: 10}); </code></pre>
         <p></p>
         <div>
@@ -1327,12 +1327,12 @@
         </div>
       </div>
 
-      <h2><a name="change-update-events" class="anchor" href="#change-update-events">Observing, Updating, and Destroying Chosen</a></h2>
+      <h2><a name="change-update-events" class="anchor" href="#change-update-events">Change / Update Events</a></h2>
       <div class="side-by-side clearfix">
         <ul>
           <li>
-            <h3>Observing Form Field Changes</h3>
-            <p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event on the original form field. That let's you do something like this:</p>
+            <h3>Form Field Change</h3>
+            <p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event* on the original form field. That let's you do something like this:</p>
             <pre><code class="language-javascript">$("#form_field").chosen().change( &hellip; );</code></pre>
             <p><strong>Note:</strong> Prototype doesn't offer support for triggering standard browser events. <a href="https://github.com/kangax/protolicious/blob/5b56fdafcd7d7662c9d648534225039b2e78e371/event.simulate.js">Event.simulate</a> is required to trigger the change event when using the Prototype version.</p>
           </li>
@@ -1341,14 +1341,6 @@
             <p>If you need to update the options in your select field and want Chosen to pick up the changes, you'll need to trigger the "chosen:updated" event on the field. Chosen will re-build itself based on the updated content.</p>
             <pre><code class="language-javascript">Event.fire($("form_field"), "chosen:updated");</code></pre>
           </li>
-          <li>
-            <h3>Destroying Chosen</h3>
-            <p>To destroy Chosen and revert back to the native select, call <code class="language-javascript">destroy</code> on the Chosen instance:</p>
-              <pre><code class="language-javascript">chosen = new Chosen($("form_field"));
-
-// ...later
-chosen.destroy();</code></pre>
-          </li>
         </ul>
       </div>
 
diff --git a/profiles/wcm_base/libraries/chosen/public/options.html b/profiles/wcm_base/libraries/chosen/options.html
similarity index 97%
rename from profiles/wcm_base/libraries/chosen/public/options.html
rename to profiles/wcm_base/libraries/chosen/options.html
index ada5afa735f86c702e1131db47c28fb490d8e620..92a646e1953eacaa6516ed72ba7e28fcb453c59c 100644
--- a/profiles/wcm_base/libraries/chosen/public/options.html
+++ b/profiles/wcm_base/libraries/chosen/options.html
@@ -48,7 +48,7 @@
         <tr>
           <td>disable_search_threshold</td>
           <td>0</td>
-          <td>Hide the search input on single selects if there are <i>n</i> or fewer options.</td>
+          <td>Hide the search input on single selects if there are fewer than (n) options.</td>
         </tr>
         <tr>
           <td>enable_split_word_search</td>
@@ -116,13 +116,6 @@
             <p>By default, Chosen only shows the text of a selected option. Setting this option to <code class="language-javascript">true</code> will show the text and group (if any) of the selected option.</p>
           </td>
         </tr>
-        <tr>
-          <td>max_shown_results</td>
-          <td>Infinity</td>
-          <td>
-            <p>Only show the first (n) matching options in the results. This can be used to increase performance for selects with very many options.</p>
-          </td>
-        </tr>
       </table>
 
       <h2><a name="attributes" class="anchor" href="#attributes">Attributes</a></h2>
diff --git a/profiles/wcm_base/libraries/chosen/package.json b/profiles/wcm_base/libraries/chosen/package.json
deleted file mode 100644
index 21256f001b0160db9f0e72780cd6eaf280d12b72..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/package.json
+++ /dev/null
@@ -1,85 +0,0 @@
-{
-  "author": "harvest",
-  "name": "chosen",
-  "version": "1.4.2",
-  "description": "Chosen is a JavaScript plugin that makes select boxes user-friendly. It is currently available in both jQuery and Prototype flavors.",
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/harvesthq/chosen"
-  },
-  "engines": {
-    "node": ">=0.4.0"
-  },
-  "scripts": {
-    "test": "grunt test"
-  },
-  "dependencies": {},
-  "devDependencies": {
-    "coffee-script": ">= 1.6",
-    "grunt": "~0.4.1",
-    "grunt-contrib-coffee": "~0.6.4",
-    "grunt-contrib-compass": "~0.5.0",
-    "grunt-contrib-concat": "~0.1.3",
-    "grunt-contrib-cssmin": "~0.6.1",
-    "grunt-contrib-jasmine": "~0.5.1",
-    "grunt-contrib-uglify": "~0.2.0",
-    "grunt-contrib-watch": "~0.3.1",
-    "grunt-dom-munger": "~2.0.1",
-    "grunt-gh-pages": "~0.10.0",
-    "grunt-zip": "~0.9.2",
-    "load-grunt-tasks": "^3.0.0"
-  },
-  "licenses": [
-    {
-      "type": "MIT",
-      "url": "https://github.com/harvesthq/chosen/blob/master/LICENSE.md"
-    }
-  ],
-  "bowerJSON":{
-    "main": [
-      "chosen.jquery.js",
-      "chosen.css",
-      "chosen-sprite@2x.png",
-      "chosen-sprite.png"
-    ]
-  },
-  "jqueryJSON": {
-    "title": "Chosen",
-    "keywords": [
-      "select",
-      "multiselect",
-      "dropdown",
-      "form",
-      "input",
-      "ui"
-    ],
-    "author": {
-      "url": "http://getharvest.com"
-    },
-    "maintainers": [
-      {
-        "name": "Patrick Filler",
-        "url": "https://github.com/pfiller"
-      },
-      {
-        "name": "Christophe Coevoet",
-        "url": "https://github.com/stof"
-      },
-      {
-        "name": "Ken Earley",
-        "url": "https://github.com/kenearley"
-      },
-      {
-        "name": "Koen Punt",
-        "url": "https://github.com/koenpunt"
-      }
-    ],
-    "download": "https://github.com/harvesthq/chosen/releases",
-    "homepage": "http://harvesthq.github.io/chosen/",
-    "docs": "http://harvesthq.github.io/chosen/",
-    "bugs": "https://github.com/harvesthq/chosen/issues",
-    "dependencies": {
-      "jquery": ">=1.4.4"
-    }
-  }
-}
diff --git a/profiles/wcm_base/libraries/chosen/public/docsupport/event.simulate.js b/profiles/wcm_base/libraries/chosen/public/docsupport/event.simulate.js
deleted file mode 100644
index 964457b8b4a47a866054be296114191728e91f5a..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/public/docsupport/event.simulate.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Event.simulate(@element, eventName[, options]) -> Element
- * 
- * - @element: element to fire event on
- * - eventName: name of event to fire (only MouseEvents and HTMLEvents interfaces are supported)
- * - options: optional object to fine-tune event properties - pointerX, pointerY, ctrlKey, etc.
- *
- *    $('foo').simulate('click'); // => fires "click" event on an element with id=foo
- *
- **/
-(function(){
-  
-  var eventMatchers = {
-    'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
-    'MouseEvents': /^(?:click|dblclick|mouse(?:down|up|over|move|out))$/
-  }
-  var defaultOptions = {
-    pointerX: 0,
-    pointerY: 0,
-    button: 0,
-    ctrlKey: false,
-    altKey: false,
-    shiftKey: false,
-    metaKey: false,
-    bubbles: true,
-    cancelable: true
-  }
-  
-  Event.simulate = function(element, eventName) {
-    var options = Object.extend(Object.clone(defaultOptions), arguments[2] || { });
-    var oEvent, eventType = null;
-    
-    element = $(element);
-    
-    for (var name in eventMatchers) {
-      if (eventMatchers[name].test(eventName)) { eventType = name; break; }
-    }
-
-    if (!eventType)
-      throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');
-
-    if (document.createEvent) {
-      oEvent = document.createEvent(eventType);
-      if (eventType == 'HTMLEvents') {
-        oEvent.initEvent(eventName, options.bubbles, options.cancelable);
-      }
-      else {
-        oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView, 
-          options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
-          options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element);
-      }
-      element.dispatchEvent(oEvent);
-    }
-    else {
-      options.clientX = options.pointerX;
-      options.clientY = options.pointerY;
-      oEvent = Object.extend(document.createEventObject(), options);
-      element.fireEvent('on' + eventName, oEvent);
-    }
-    return element;
-  }
-  
-  Element.addMethods({ simulate: Event.simulate });
-})();
\ No newline at end of file
diff --git a/profiles/wcm_base/libraries/chosen/sass/chosen.scss b/profiles/wcm_base/libraries/chosen/sass/chosen.scss
deleted file mode 100644
index a392719c4a704b2eb6ba9eabe30f09ea67d7bb34..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/sass/chosen.scss
+++ /dev/null
@@ -1,431 +0,0 @@
-@import "compass/css3/box-sizing";
-@import "compass/css3/images";
-@import "compass/css3/user-interface";
-
-$chosen-sprite: image-url('chosen-sprite.png') !default;
-$chosen-sprite-retina: image-url('chosen-sprite@2x.png') !default;
-
-/* @group Base */
-.chosen-container {
-  position: relative;
-  display: inline-block;
-  vertical-align: middle;
-  font-size: 13px;
-  @include user-select(none);
-  * {
-    @include box-sizing(border-box);
-  }
-  .chosen-drop {
-    position: absolute;
-    top: 100%;
-    left: -9999px;
-    z-index: 1010;
-    width: 100%;
-    border: 1px solid #aaa;
-    border-top: 0;
-    background: #fff;
-    box-shadow: 0 4px 5px rgba(#000,.15);
-  }
-  &.chosen-with-drop .chosen-drop {
-    left: 0;
-  }
-  a{
-    cursor: pointer;
-  }
-
-  .search-choice, .chosen-single{
-    .group-name{
-      margin-right: 4px;
-      overflow: hidden;
-      white-space: nowrap;
-      text-overflow: ellipsis;
-      font-weight: normal;
-      color: #999999;
-      &:after {
-        content: ":";
-        padding-left: 2px;
-        vertical-align: top;
-      }
-    }
-  }
-}
-/* @end */
-
-/* @group Single Chosen */
-.chosen-container-single{
-  .chosen-single {
-    position: relative;
-    display: block;
-    overflow: hidden;
-    padding: 0 0 0 8px;
-    height: 25px;
-    border: 1px solid #aaa;
-    border-radius: 5px;
-    background-color: #fff;
-    @include background(linear-gradient(#fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%));
-    background-clip: padding-box;
-    box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(#000,.1);
-    color: #444;
-    text-decoration: none;
-    white-space: nowrap;
-    line-height: 24px;
-  }
-  .chosen-default {
-    color: #999;
-  }
-  .chosen-single span {
-    display: block;
-    overflow: hidden;
-    margin-right: 26px;
-    text-overflow: ellipsis;
-    white-space: nowrap;
-  }
-  .chosen-single-with-deselect span {
-    margin-right: 38px;
-  }
-  .chosen-single abbr {
-    position: absolute;
-    top: 6px;
-    right: 26px;
-    display: block;
-    width: 12px;
-    height: 12px;
-    background: $chosen-sprite -42px 1px no-repeat;
-    font-size: 1px;
-    &:hover {
-      background-position: -42px -10px;
-    }
-  }
-  &.chosen-disabled .chosen-single abbr:hover {
-    background-position: -42px -10px;
-  }
-  .chosen-single div {
-    position: absolute;
-    top: 0;
-    right: 0;
-    display: block;
-    width: 18px;
-    height: 100%;
-    b {
-      display: block;
-      width: 100%;
-      height: 100%;
-      background: $chosen-sprite no-repeat 0px 2px;
-    }
-  }
-  .chosen-search {
-    position: relative;
-    z-index: 1010;
-    margin: 0;
-    padding: 3px 4px;
-    white-space: nowrap;
-    input[type="text"] {
-      margin: 1px 0;
-      padding: 4px 20px 4px 5px;
-      width: 100%;
-      height: auto;
-      outline: 0;
-      border: 1px solid #aaa;
-      background: #fff $chosen-sprite no-repeat 100% -20px;
-      @include background($chosen-sprite no-repeat 100% -20px);
-      font-size: 1em;
-      font-family: sans-serif;
-      line-height: normal;
-      border-radius: 0;
-    }
-  }
-  .chosen-drop {
-    margin-top: -1px;
-    border-radius: 0 0 4px 4px;
-    background-clip: padding-box;
-  }
-  &.chosen-container-single-nosearch .chosen-search {
-    position: absolute;
-    left: -9999px;
-  }
-}
-/* @end */
-
-/* @group Results */
-.chosen-container .chosen-results {
-  color: #444;
-  position: relative;
-  overflow-x: hidden;
-  overflow-y: auto;
-  margin: 0 4px 4px 0;
-  padding: 0 0 0 4px;
-  max-height: 240px;
-  -webkit-overflow-scrolling: touch;
-  li {
-    display: none;
-    margin: 0;
-    padding: 5px 6px;
-    list-style: none;
-    line-height: 15px;
-    word-wrap: break-word;
-    -webkit-touch-callout: none;
-    &.active-result {
-      display: list-item;
-      cursor: pointer;
-    }
-    &.disabled-result {
-      display: list-item;
-      color: #ccc;
-      cursor: default;
-    }
-    &.highlighted {
-      background-color: #3875d7;
-      @include background-image(linear-gradient(#3875d7 20%, #2a62bc 90%));
-      color: #fff;
-    }
-    &.no-results {
-      color: #777;
-      display: list-item;
-      background: #f4f4f4;
-    }
-    &.group-result {
-      display: list-item;
-      font-weight: bold;
-      cursor: default;
-    }
-    &.group-option {
-      padding-left: 15px;
-    }
-    em {
-      font-style: normal;
-      text-decoration: underline;
-    }
-  }
-}
-/* @end */
-
-/* @group Multi Chosen */
-.chosen-container-multi{
-  .chosen-choices {
-    position: relative;
-    overflow: hidden;
-    margin: 0;
-    padding: 0 5px;
-    width: 100%;
-    height: auto !important;
-    height: 1%;
-    border: 1px solid #aaa;
-    background-color: #fff;
-    @include background-image(linear-gradient(#eee 1%, #fff 15%));
-    cursor: text;
-  }
-  .chosen-choices li {
-    float: left;
-    list-style: none;
-    &.search-field {
-      margin: 0;
-      padding: 0;
-      white-space: nowrap;
-      input[type="text"] {
-        margin: 1px 0;
-        padding: 0;
-        height: 25px;
-        outline: 0;
-        border: 0 !important;
-        background: transparent !important;
-        box-shadow: none;
-        color: #999;
-        font-size: 100%;
-        font-family: sans-serif;
-        line-height: normal;
-        border-radius: 0;
-      }
-    }
-    &.search-choice {
-      position: relative;
-      margin: 3px 5px 3px 0;
-      padding: 3px 20px 3px 5px;
-      border: 1px solid #aaa;
-      max-width: 100%;
-      border-radius: 3px;
-      background-color: #eeeeee;
-      @include background-image(linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%));
-      background-size: 100% 19px;
-      background-repeat: repeat-x;
-      background-clip: padding-box;
-      box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(#000,.05);
-      color: #333;
-      line-height: 13px;
-      cursor: default;
-      span {
-        word-wrap: break-word;
-      }
-      .search-choice-close {
-        position: absolute;
-        top: 4px;
-        right: 3px;
-        display: block;
-        width: 12px;
-        height: 12px;
-        background: $chosen-sprite -42px 1px no-repeat;
-        font-size: 1px;
-        &:hover {
-          background-position: -42px -10px;
-        }
-      }
-    }
-    &.search-choice-disabled {
-      padding-right: 5px;
-      border: 1px solid #ccc;
-      background-color: #e4e4e4;
-      @include background-image(linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%));
-      color: #666;
-    }
-    &.search-choice-focus {
-      background: #d4d4d4;
-      .search-choice-close {
-        background-position: -42px -10px;
-      }
-    }
-  }
-  .chosen-results {
-    margin: 0;
-    padding: 0;
-  }
-  .chosen-drop .result-selected {
-    display: list-item;
-    color: #ccc;
-    cursor: default;
-  }
-}
-/* @end */
-
-/* @group Active  */
-.chosen-container-active{
-  .chosen-single {
-    border: 1px solid #5897fb;
-    box-shadow: 0 0 5px rgba(#000,.3);
-  }
-  &.chosen-with-drop{
-    .chosen-single {
-      border: 1px solid #aaa;
-      -moz-border-radius-bottomright: 0;
-      border-bottom-right-radius: 0;
-      -moz-border-radius-bottomleft: 0;
-      border-bottom-left-radius: 0;
-      @include background-image(linear-gradient(#eee 20%, #fff 80%));
-      box-shadow: 0 1px 0 #fff inset;
-    }
-    .chosen-single div {
-      border-left: none;
-      background: transparent;
-      b {
-        background-position: -18px 2px;
-      }
-    }
-  }
-  .chosen-choices {
-    border: 1px solid #5897fb;
-    box-shadow: 0 0 5px rgba(#000,.3);
-    li.search-field input[type="text"] {
-      color: #222 !important;
-    }
-  }
-}
-/* @end */
-
-/* @group Disabled Support */
-.chosen-disabled {
-  opacity: 0.5 !important;
-  cursor: default;
-  .chosen-single {
-    cursor: default;
-  }
-  .chosen-choices .search-choice .search-choice-close {
-    cursor: default;
-  }
-}
-/* @end */
-
-/* @group Right to Left */
-.chosen-rtl {
-  text-align: right;
-  .chosen-single {
-    overflow: visible;
-    padding: 0 8px 0 0;
-  }
-  .chosen-single span {
-    margin-right: 0;
-    margin-left: 26px;
-    direction: rtl;
-  }
-  .chosen-single-with-deselect span {
-    margin-left: 38px;
-  }
-  .chosen-single div {
-    right: auto;
-    left: 3px;
-  }
-  .chosen-single abbr {
-    right: auto;
-    left: 26px;
-  }
-  .chosen-choices li {
-    float: right;
-    &.search-field input[type="text"] {
-      direction: rtl;
-    }
-    &.search-choice {
-      margin: 3px 5px 3px 0;
-      padding: 3px 5px 3px 19px;
-      .search-choice-close {
-        right: auto;
-        left: 4px;
-      }
-    }
-  }
-  &.chosen-container-single-nosearch .chosen-search,
-  .chosen-drop {
-    left: 9999px;
-  }
-  &.chosen-container-single .chosen-results {
-    margin: 0 0 4px 4px;
-    padding: 0 4px 0 0;
-  }
-  .chosen-results li.group-option {
-    padding-right: 15px;
-    padding-left: 0;
-  }
-  &.chosen-container-active.chosen-with-drop .chosen-single div {
-    border-right: none;
-  }
-  .chosen-search input[type="text"] {
-    padding: 4px 5px 4px 20px;
-    background: #fff $chosen-sprite no-repeat -30px -20px;
-    @include background($chosen-sprite no-repeat -30px -20px);
-    direction: rtl;
-  }
-  &.chosen-container-single{
-    .chosen-single div b {
-      background-position: 6px 2px;
-    }
-    &.chosen-with-drop{
-      .chosen-single div b {
-        background-position: -12px 2px;
-      }
-    }
-  }
-}
-
-/* @end */
-
-/* @group Retina compatibility */
-@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi), only screen and (min-resolution: 1.5dppx) {
-  .chosen-rtl .chosen-search input[type="text"],
-  .chosen-container-single .chosen-single abbr,
-  .chosen-container-single .chosen-single div b,
-  .chosen-container-single .chosen-search input[type="text"],
-  .chosen-container-multi .chosen-choices .search-choice .search-choice-close,
-  .chosen-container .chosen-results-scroll-down span,
-  .chosen-container .chosen-results-scroll-up span {
-    background-image: $chosen-sprite-retina !important;
-    background-size: 52px 37px !important;
-    background-repeat: no-repeat !important;
-  }
-}
-/* @end */
diff --git a/profiles/wcm_base/libraries/chosen/spec/jquery/basic.spec.coffee b/profiles/wcm_base/libraries/chosen/spec/jquery/basic.spec.coffee
deleted file mode 100644
index 918be661c0b4ba91ddc037b8d9e61f2da6b1b82c..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/spec/jquery/basic.spec.coffee
+++ /dev/null
@@ -1,33 +0,0 @@
-describe "Basic setup", ->
-  it "should add chosen to jQuery object", ->
-    expect(jQuery.fn.chosen).toBeDefined()
-
-  it "should create very basic chosen", ->
-    tmpl = "
-      <select data-placeholder='Choose a Country...'>
-        <option value=''></option>
-        <option value='United States'>United States</option>
-        <option value='United Kingdom'>United Kingdom</option>
-        <option value='Afghanistan'>Afghanistan</option>
-      </select>
-    "
-    div = $("<div>").html(tmpl)
-    select = div.find("select")
-    expect(select.size()).toBe(1)
-    select.chosen()
-    # very simple check that the necessary elements have been created
-    ["container", "container-single", "single", "default"].forEach (clazz)->
-      el = div.find(".chosen-#{clazz}")
-      expect(el.size()).toBe(1)
-
-    # test a few interactions
-    expect(select.val()).toBe ""
-
-    container = div.find(".chosen-container")
-    container.trigger("mousedown") # open the drop
-    expect(container.hasClass("chosen-container-active")).toBe true
-    #select an item
-    container.find(".active-result").last().trigger("mouseup")
-
-    expect(select.val()).toBe "Afghanistan"
-
diff --git a/profiles/wcm_base/libraries/chosen/spec/jquery/max_shown_results.spec.coffee b/profiles/wcm_base/libraries/chosen/spec/jquery/max_shown_results.spec.coffee
deleted file mode 100644
index e37cb23b4757cb8b62d4fc9e109f2502ff440d66..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/spec/jquery/max_shown_results.spec.coffee
+++ /dev/null
@@ -1,64 +0,0 @@
-describe "search", ->
-  it "should display only matching items when entering a search term", ->
-    tmpl = "
-          <select data-placeholder='Choose a Country...'>
-            <option value=''></option>
-            <option value='United States'>United States</option>
-            <option value='United Kingdom'>United Kingdom</option>
-            <option value='Afghanistan'>Afghanistan</option>
-          </select>
-        "
-    div = $("<div>").html(tmpl)
-    select = div.find("select")
-    select.chosen()
-
-    container = div.find(".chosen-container")
-    container.trigger("mousedown") # open the drop
-    # Expect all results to be shown
-    results = div.find(".active-result")
-    expect(results.size()).toBe(3)
-
-    # Enter some text in the search field.
-    search_field = div.find(".chosen-search input").first()
-    search_field.val("Afgh")
-    search_field.trigger('keyup')
-
-    # Expect to only have one result: 'Afghanistan'.
-    results = div.find(".active-result")
-    expect(results.size()).toBe(1)
-    expect(results.first().text()).toBe "Afghanistan"
-
-  it "should only show max_shown_results items in results", ->
-    tmpl = "
-          <select data-placeholder='Choose a Country...'>
-            <option value=''></option>
-            <option value='United States'>United States</option>
-            <option value='United Kingdom'>United Kingdom</option>
-            <option value='Afghanistan'>Afghanistan</option>
-          </select>
-        "
-    div = $("<div>").html(tmpl)
-    select = div.find("select")
-    select.chosen({max_shown_results: 1 })
-
-    container = div.find(".chosen-container")
-    container.trigger("mousedown") # open the drop
-    results = div.find(".active-result")
-    expect(results.size()).toBe(1)
-
-    # Enter some text in the search field.
-    search_field = div.find(".chosen-search input").first()
-    search_field.val("United")
-    search_field.trigger("keyup")
-
-    # Showing only one result: the one that occurs first.
-    results = div.find(".active-result")
-    expect(results.size()).toBe(1)
-    expect(results.first().text()).toBe "United States"
-
-    # Showing still only one result, but not the first one.
-    search_field.val("United Ki")
-    search_field.trigger("keyup")
-    results = div.find(".active-result")
-    expect(results.size()).toBe(1)
-    expect(results.first().text()).toBe "United Kingdom"
diff --git a/profiles/wcm_base/libraries/chosen/spec/proto/basic.spec.coffee b/profiles/wcm_base/libraries/chosen/spec/proto/basic.spec.coffee
deleted file mode 100644
index ac5f3102848b01ac2ab38c243cf127bcd47a5919..0000000000000000000000000000000000000000
--- a/profiles/wcm_base/libraries/chosen/spec/proto/basic.spec.coffee
+++ /dev/null
@@ -1,37 +0,0 @@
-describe "Basic setup", ->
-  it "should add expose a Chosen global", ->
-    expect(Chosen).toBeDefined()
-
-  it "should create very basic chosen", ->
-    tmpl = "
-      <select data-placeholder='Choose a Country...'>
-        <option value=''></option>
-        <option value='United States'>United States</option>
-        <option value='United Kingdom'>United Kingdom</option>
-        <option value='Afghanistan'>Afghanistan</option>
-      </select>
-    "
-
-    div = new Element("div")
-    document.body.insert(div)
-    div.update(tmpl)
-    select = div.down("select")
-    expect(select).toBeDefined()
-    new Chosen(select)
-    # very simple check that the necessary elements have been created
-    ["container", "container-single", "single", "default"].forEach (clazz)->
-      el = div.down(".chosen-#{clazz}")
-      expect(el).toBeDefined()
-
-    # test a few interactions
-    expect($F(select)).toBe ""
-
-    container = div.down(".chosen-container")
-    container.simulate("mousedown") # open the drop
-    expect(container.hasClassName("chosen-container-active")).toBe true
-
-    #select an item
-    container.select(".active-result").last().simulate("mouseup")
-
-    expect($F(select)).toBe "Afghanistan"
-    div.remove()
diff --git a/profiles/wcm_base/modules/contrib/admin/PATCHES.txt b/profiles/wcm_base/modules/contrib/admin/PATCHES.txt
index 0de9d4c58bb2ce55a552d90f4f8261daa8e36a84..d6a705e115ccc61f6d0b475e6c75677ab19cd761 100644
--- a/profiles/wcm_base/modules/contrib/admin/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/admin/PATCHES.txt
@@ -1,4 +1,4 @@
 The following patches have been applied to this project:
 - http://drupal.org/files/1334804-admin-jquery-updated-6.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/administerusersbyrole/PATCHES.txt b/profiles/wcm_base/modules/contrib/administerusersbyrole/PATCHES.txt
index 85feeab4d6b0d6b5309b3af2384a29a2656ccbd2..a8af5d6d17cd58bf2654a3cc634b535e6859a751 100644
--- a/profiles/wcm_base/modules/contrib/administerusersbyrole/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/administerusersbyrole/PATCHES.txt
@@ -1,4 +1,4 @@
 The following patches have been applied to this project:
 - http://drupal.org/files/issues/administerusersbyrole-can_create_user_ajax_submit-2557473-13-D7.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/better_exposed_filters/PATCHES.txt b/profiles/wcm_base/modules/contrib/better_exposed_filters/PATCHES.txt
index c74d33744677f6fdd7e55d99c00d2d30b3a97934..922031ec3c8ffae74f5602ef6b518c261f3fe9ee 100644
--- a/profiles/wcm_base/modules/contrib/better_exposed_filters/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/better_exposed_filters/PATCHES.txt
@@ -1,4 +1,4 @@
 The following patches have been applied to this project:
 - http://drupal.org/files/issues/bef-placeholder_support-2560321-2.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/breakpoints/PATCHES.txt b/profiles/wcm_base/modules/contrib/breakpoints/PATCHES.txt
index 92968bc18e34825cddbdedc5adb664663e442a48..bd8feba4b63914414c5f1403322f29ef8360d92b 100644
--- a/profiles/wcm_base/modules/contrib/breakpoints/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/breakpoints/PATCHES.txt
@@ -1,4 +1,4 @@
 The following patches have been applied to this project:
 - https://www.drupal.org/files/issues/2415363-breakpoints-menu_rebuild-13.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/chosen/PATCHES.txt b/profiles/wcm_base/modules/contrib/chosen/PATCHES.txt
new file mode 100644
index 0000000000000000000000000000000000000000..778363e1e83a4e2a4ac9208c116f94e05664f114
--- /dev/null
+++ b/profiles/wcm_base/modules/contrib/chosen/PATCHES.txt
@@ -0,0 +1,4 @@
+The following patches have been applied to this project:
+- http://drupal.org/files/issues/chosen-remove_none_option-2117827-7.patch
+
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/chosen/chosen.module b/profiles/wcm_base/modules/contrib/chosen/chosen.module
index e54378dc28769b856ca530b35f41ae1aaaab84ac..412a64757ae6237c67867eb18803091180c7a161 100644
--- a/profiles/wcm_base/modules/contrib/chosen/chosen.module
+++ b/profiles/wcm_base/modules/contrib/chosen/chosen.module
@@ -197,6 +197,9 @@ function chosen_pre_render_select($element) {
   }
 
   if (isset($element['#field_name']) && !empty($element['#multiple'])) {
+    // Remove '_none' from multi-select options.
+    unset($element['#options']['_none']);
+
     $field = field_info_field($element['#field_name']);
     if ($field['cardinality'] != FIELD_CARDINALITY_UNLIMITED && $field['cardinality'] > 1) {
       $element['#attributes']['data-cardinality'] = $field['cardinality'];
diff --git a/profiles/wcm_base/modules/contrib/ctools/PATCHES.txt b/profiles/wcm_base/modules/contrib/ctools/PATCHES.txt
index 5a7ea8106df25b639609e176207df9fb8fc61f93..6655a0adbd9e4ebbb69b995c58e83cc007146403 100644
--- a/profiles/wcm_base/modules/contrib/ctools/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/ctools/PATCHES.txt
@@ -2,4 +2,4 @@ The following patches have been applied to this project:
 - http://drupal.org/files/issues/ctools-readd_access_callback_params-2209775-24.patch
 - http://drupal.org/files/issues/views_content-keyword-substitution-1910608-33.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/defaultconfig/PATCHES.txt b/profiles/wcm_base/modules/contrib/defaultconfig/PATCHES.txt
index a646afe941f5caecd4b3216d250706eb36dbe56b..db91ce586758e0b961c835d43e24505c72449cc2 100644
--- a/profiles/wcm_base/modules/contrib/defaultconfig/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/defaultconfig/PATCHES.txt
@@ -2,4 +2,4 @@ The following patches have been applied to this project:
 - http://drupal.org/files/issues/defaultconfig-rebuild-2008178-14.patch
 - http://drupal.org/files/issues/1900574.defaultconfig.undefinedindex_20.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/defaultcontent/PATCHES.txt b/profiles/wcm_base/modules/contrib/defaultcontent/PATCHES.txt
index 120241d93a15a205f2319ea03a7e986ba2dbe52a..0d26fb0873493428ed36e223458a76d266dd0382 100644
--- a/profiles/wcm_base/modules/contrib/defaultcontent/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/defaultcontent/PATCHES.txt
@@ -2,4 +2,4 @@ The following patches have been applied to this project:
 - http://drupal.org/files/1754428-allow-node-export-alter.patch
 - http://drupal.org/files/1757782-cannot-import-menu-hierarchy-8.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/features/PATCHES.txt b/profiles/wcm_base/modules/contrib/features/PATCHES.txt
index d1c847fe4671522beff31958e14374b7d54b4b0b..47fe1854a30ae8e8f1b0246e383858eea865716b 100644
--- a/profiles/wcm_base/modules/contrib/features/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/features/PATCHES.txt
@@ -1,4 +1,4 @@
 The following patches have been applied to this project:
 - https://drupal.org/files/issues/export_shorcuts_sets-986968-36.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/file_entity/PATCHES.txt b/profiles/wcm_base/modules/contrib/file_entity/PATCHES.txt
index 9d9176658435124c956d5874bb05440d67d17801..7ceeba7090c1934465c77f83d5fe12581ec678b2 100644
--- a/profiles/wcm_base/modules/contrib/file_entity/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/file_entity/PATCHES.txt
@@ -2,4 +2,4 @@ The following patches have been applied to this project:
 - http://drupal.org/files/issues/file_entity-file-size-limit-per-file-type-2530656-3.patch
 - http://drupal.org/files/issues/file_entity-notice_undefined_offset_menu_translate-2533816-4.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/jquery_update/PATCHES.txt b/profiles/wcm_base/modules/contrib/jquery_update/PATCHES.txt
index f6dfcf6a7abce873341758d8911f9c56c830e910..2f41873b1abd313b2a7ffbd741f8042c8872b804 100644
--- a/profiles/wcm_base/modules/contrib/jquery_update/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/jquery_update/PATCHES.txt
@@ -1,4 +1,4 @@
 The following patches have been applied to this project:
 - http://drupal.org/files/issues/jquery_update-autoheight_fix-2241973-7.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/manualcrop/PATCHES.txt b/profiles/wcm_base/modules/contrib/manualcrop/PATCHES.txt
index 6627972d7ced0971579e99600ab056ddb2c2851f..9e864c1d439f4ae278f191004f4bbf2c6cffce04 100644
--- a/profiles/wcm_base/modules/contrib/manualcrop/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/manualcrop/PATCHES.txt
@@ -1,4 +1,4 @@
 The following patches have been applied to this project:
 - http://drupal.org/files/issues/manualcrop-two-crop-tools-2237835.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/media/PATCHES.txt b/profiles/wcm_base/modules/contrib/media/PATCHES.txt
index 559ef41bda73f1af7f4070ab08a21873ec06883c..0148d1e31c20dde8ce67a83a63082882fb8ce6f5 100644
--- a/profiles/wcm_base/modules/contrib/media/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/media/PATCHES.txt
@@ -3,4 +3,4 @@ The following patches have been applied to this project:
 - http://drupal.org/files/issues/media-alt_and_title_double-2308487-9.patch
 - http://drupal.org/files/issues/media-file-name-focus-2084287-2.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/media_vimeo/PATCHES.txt b/profiles/wcm_base/modules/contrib/media_vimeo/PATCHES.txt
index 2a840b039580f7095f76e119b9e6e381393538cb..804e03144e2da21292104471ada8434606a09166 100644
--- a/profiles/wcm_base/modules/contrib/media_vimeo/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/media_vimeo/PATCHES.txt
@@ -1,4 +1,4 @@
 The following patches have been applied to this project:
 - https://www.drupal.org/files/issues/no_exception_handling-2446199-1.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/panelizer/PATCHES.txt b/profiles/wcm_base/modules/contrib/panelizer/PATCHES.txt
index 8cbf64475227bfccf5b6b15f8f28165df46dc1f0..fcd582b1c81c7e8ef47b15b0e07e10fff2133416 100644
--- a/profiles/wcm_base/modules/contrib/panelizer/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/panelizer/PATCHES.txt
@@ -2,4 +2,4 @@ The following patches have been applied to this project:
 - http://drupal.org/files/issues/array-to-object-on-update-1623536-26.patch
 - http://www.drupal.org/files/issues/panelizer-search_api-2416505-3.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/panels/PATCHES.txt b/profiles/wcm_base/modules/contrib/panels/PATCHES.txt
index a0f87b265a3c6c31690cb66238e50819dea2ac34..4e1cdbff7b3b5cd54b6bbfe3273a1450cb3645d0 100644
--- a/profiles/wcm_base/modules/contrib/panels/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/panels/PATCHES.txt
@@ -3,4 +3,4 @@ The following patches have been applied to this project:
 - https://www.drupal.org/files/issues/panels-focus-add-content-tab-2390803-13.patch
 - https://www.drupal.org/files/issues/panels-1588212-10.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/pathauto/PATCHES.txt b/profiles/wcm_base/modules/contrib/pathauto/PATCHES.txt
index 85b2e6350c365470c54275c5fdc0246e34a8b023..267648ff56b12148743fc2627cbb47e83bcb693a 100644
--- a/profiles/wcm_base/modules/contrib/pathauto/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/pathauto/PATCHES.txt
@@ -1,4 +1,4 @@
 The following patches have been applied to this project:
 - http://drupal.org/files/issues/pathauto-persist-936222-195-pathauto-state.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/private/PATCHES.txt b/profiles/wcm_base/modules/contrib/private/PATCHES.txt
index bb0d78321672923cd51e7e9389517d2113e10bc6..7d310d0fec4c79352fe35970be38ecebd92d42d4 100644
--- a/profiles/wcm_base/modules/contrib/private/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/private/PATCHES.txt
@@ -1,4 +1,4 @@
 The following patches have been applied to this project:
 - http://drupal.org/files/issues/private-bypasses_content_type_edit_permissions-2660598-2.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/search_api_db/PATCHES.txt b/profiles/wcm_base/modules/contrib/search_api_db/PATCHES.txt
index f078ccc4f97e381796a8d76df1d1e84310cb0ee9..1694c453a40e88b1fdd2165a429980ff335cbe3b 100644
--- a/profiles/wcm_base/modules/contrib/search_api_db/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/search_api_db/PATCHES.txt
@@ -3,4 +3,4 @@ The following patches have been applied to this project:
 - https://www.drupal.org/files/issues/2436341-search_api_db-updb-1.patch
 - https://www.drupal.org/files/issues/2343371-search_api_db-update-table-8.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/simplesamlphp_auth/PATCHES.txt b/profiles/wcm_base/modules/contrib/simplesamlphp_auth/PATCHES.txt
index 7fcd2a87eb25d9010b7e1eaed28f05a631e2c5ae..1a1f14c77a4164f278f56db2215c2dfc825c7ec3 100644
--- a/profiles/wcm_base/modules/contrib/simplesamlphp_auth/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/simplesamlphp_auth/PATCHES.txt
@@ -1,4 +1,4 @@
 The following patches have been applied to this project:
 - http://drupal.org/files/issues/simplesamlphp_auth-admin-users-cannot-other-users-9291915-8.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/uuid_features/PATCHES.txt b/profiles/wcm_base/modules/contrib/uuid_features/PATCHES.txt
index c4ed3d96e18065be35729bd5d4c060921e62933a..dc5e6bbe3d6c8677f122dfd4228bf9a741bd0567 100644
--- a/profiles/wcm_base/modules/contrib/uuid_features/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/uuid_features/PATCHES.txt
@@ -1,4 +1,4 @@
 The following patches have been applied to this project:
 - http://drupal.org/files/issues/uuid_features-2220837-path-and-pathauto-for-node-3.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/views/PATCHES.txt b/profiles/wcm_base/modules/contrib/views/PATCHES.txt
index 5d9f8a35a694df498ead390ee77a6d017807a12f..fe3925a5131598578b140cf482d47d592f138275 100644
--- a/profiles/wcm_base/modules/contrib/views/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/views/PATCHES.txt
@@ -2,4 +2,4 @@ The following patches have been applied to this project:
 - http://drupal.org/files/views-exposed-sorts-2037469-1.patch
 - http://drupal.org/files/issues/views-ajax-nginx-1036962-71.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/views_autocomplete_filters/PATCHES.txt b/profiles/wcm_base/modules/contrib/views_autocomplete_filters/PATCHES.txt
index b04596a6cf11bf95d3cfd25f11718c7eee754de2..85fee513b6624680267a34053744adbc9cd0ecee 100644
--- a/profiles/wcm_base/modules/contrib/views_autocomplete_filters/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/views_autocomplete_filters/PATCHES.txt
@@ -2,4 +2,4 @@ The following patches have been applied to this project:
 - http://www.drupal.org/files/issues/views_autocomplete_filters-cache-2374709-2.patch
 - http://www.drupal.org/files/issues/views_autocomplete_filters-content-pane-2317351-4.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/modules/contrib/workbench_moderation/PATCHES.txt b/profiles/wcm_base/modules/contrib/workbench_moderation/PATCHES.txt
index b468405ce94fd0a20c60d42ccc1a27f6e4f0c483..09cc1d58b250e1e171be931d9df445a2b8042d31 100644
--- a/profiles/wcm_base/modules/contrib/workbench_moderation/PATCHES.txt
+++ b/profiles/wcm_base/modules/contrib/workbench_moderation/PATCHES.txt
@@ -2,4 +2,4 @@ The following patches have been applied to this project:
 - http://drupal.org/files/playnicewithpanels-1285090-22.patch
 - http://drupal.org/files/issues/view_all_unpublished-1492118-64.patch
 
-This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
+This file was automatically generated by Drush Make (http://drupal.org/project/drush).
diff --git a/profiles/wcm_base/wcm_base.make b/profiles/wcm_base/wcm_base.make
index 1e3f00b13db60b53ef9e2dfeda01e6f3ad732b59..d651aeaccd294d6201fd423223615d7d47b471c2 100644
--- a/profiles/wcm_base/wcm_base.make
+++ b/profiles/wcm_base/wcm_base.make
@@ -13,6 +13,7 @@ projects[calendar][subdir] = contrib
 
 projects[chosen][version] = 2.0-beta4
 projects[chosen][subdir] = contrib
+projects[chosen][patch][2117827] = http://drupal.org/files/issues/chosen-remove_none_option-2117827-7.patch
 
 projects[conditional_fields][version] = 3.0-alpha2
 projects[conditional_fields][subdir] = contrib
@@ -392,7 +393,7 @@ libraries[ocio_modernizr][download][branch] = 7.x-1.x
 
 libraries[chosen][directory_name] = chosen
 libraries[chosen][download][type] = "get"
-libraries[chosen][download][url] = https://github.com/harvesthq/chosen/archive/master.zip
+libraries[chosen][download][url] = https://github.com/harvesthq/chosen/releases/download/1.4.2/chosen_v1.4.2.zip
 libraries[chosen][destination] = libraries
 
 
diff --git a/web.config b/web.config
index 09983d92542ed094f9bd061af6c07adfdd745b91..c6fb5c843e415810ba96dd1a3cc65bab990b8227 100644
--- a/web.config
+++ b/web.config
@@ -6,7 +6,7 @@
     <rewrite>
       <rules>
         <rule name="Protect files and directories from prying eyes" stopProcessing="true">
-          <match url="\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$" />
+          <match url="\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock))$" />
           <action type="CustomResponse" statusCode="403" subStatusCode="0" statusReason="Forbidden" statusDescription="Access is forbidden." />
         </rule>
         <rule name="Force simple error message for requests for non-existent favicon.ico" stopProcessing="true">