Merge pull request #6006 from aputtu/patch-4
[civicrm-core.git] / CRM / Core / Resources.php
index 89bcdd9632f0b207b649047a0ea2a833ee0c1bd7..d12afab2d06dbc48d90a69ccd4b38fcc4a7bde40 100644 (file)
@@ -3,7 +3,7 @@
   +--------------------------------------------------------------------+
   | CiviCRM version 4.6                                                |
   +--------------------------------------------------------------------+
-  | Copyright CiviCRM LLC (c) 2004-2014                                |
+  | Copyright CiviCRM LLC (c) 2004-2015                                |
   +--------------------------------------------------------------------+
   | This file is a part of CiviCRM.                                    |
   |                                                                    |
@@ -37,7 +37,7 @@
  * should incorporte services for aggregation, minimization, etc.
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -525,7 +525,7 @@ class CRM_Core_Resources {
     $patterns = (array) $patterns;
     $files = array();
     foreach ($patterns as $pattern) {
-      if ($pattern{0} === '/') {
+      if (CRM_Utils_File::isAbsolute($pattern)) {
         // Absolute path.
         $files = array_merge($files, (array) glob($pattern, $flags));
       }
@@ -702,19 +702,28 @@ class CRM_Core_Resources {
       "bower_components/lodash-compat/lodash.min.js",
       "packages/jquery/plugins/jquery.mousewheel$min.js",
       "bower_components/select2/select2$min.js",
-      "bower_components/select2/select2.css",
+      "bower_components/select2/select2$min.css",
       "packages/jquery/plugins/jquery.tableHeader.js",
-      "packages/jquery/plugins/jquery.textarearesizer.js",
       "packages/jquery/plugins/jquery.form$min.js",
       "packages/jquery/plugins/jquery.timeentry$min.js",
       "packages/jquery/plugins/jquery.blockUI$min.js",
-      "packages/jquery/plugins/DataTables/media/js/jquery.dataTables$min.js",
-      "packages/jquery/plugins/DataTables/media/css/jquery.dataTables$min.css",
+      "bower_components/datatables/media/js/jquery.dataTables$min.js",
+      "bower_components/datatables/media/css/jquery.dataTables$min.css",
       "bower_components/jquery-validation/dist/jquery.validate$min.js",
       "packages/jquery/plugins/jquery.ui.datepicker.validation.pack.js",
       "js/Common.js",
       "js/crm.ajax.js",
     );
+    // add wysiwyg editor
+    $editorID = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'editor_id');
+    $editor = CRM_Utils_Array::value($editorID,
+      CRM_Core_OptionGroup::values('wysiwyg_editor', FALSE, FALSE, FALSE, NULL, 'name')
+    );
+    $items[] = "js/wysiwyg/crm.wysiwyg.js";
+    if ($editor == "CKEditor") {
+      $items[] = "bower_components/ckeditor/ckeditor.js";
+      $items[] = "js/wysiwyg/crm.ckeditor.js";
+    }
 
     // These scripts are only needed by back-office users
     if (CRM_Core_Permission::check('access CiviCRM')) {