CRM-16354 add base wyswyig interface
[civicrm-core.git] / CRM / Core / Resources.php
index b46698fac7a7578e0e8a607ce781e22aa2d21e68..7af9603017b565b626c326e9d278aeab5316d7f9 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$
  *
  */
@@ -387,6 +387,7 @@ class CRM_Core_Resources {
     foreach ((array) $text as $str) {
       $translated = ts($str, array(
         'domain' => ($domain == 'civicrm') ? NULL : array($domain, NULL),
+        'raw' => TRUE,
       ));
 
       // We only need to push this string to client if the translation
@@ -603,7 +604,6 @@ class CRM_Core_Resources {
       // Add global settings
       $settings = array(
         'config' => array(
-          'ajaxPopupsEnabled' => $this->ajaxPopupsEnabled,
           'isFrontend' => $config->userFrameworkFrontend,
         ),
       );
@@ -676,6 +676,7 @@ class CRM_Core_Resources {
         'contactCreate' => CRM_Core_BAO_UFGroup::getCreateLinks(),
         'filters' => self::getEntityRefFilters(),
       ),
+      'ajaxPopupsEnabled' => self::singleton()->ajaxPopupsEnabled,
     );
     print CRM_Core_Smarty::singleton()->fetchWith('CRM/common/l10n.js.tpl', $vars);
     CRM_Utils_System::civiExit();
@@ -700,8 +701,8 @@ class CRM_Core_Resources {
       "bower_components/jquery-ui/themes/smoothness/jquery-ui$min.css",
       "bower_components/lodash-compat/lodash.min.js",
       "packages/jquery/plugins/jquery.mousewheel$min.js",
-      "packages/jquery/plugins/select2/select2$min.js",
-      "packages/jquery/plugins/select2/select2.css",
+      "bower_components/select2/select2$min.js",
+      "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",
@@ -709,11 +710,23 @@ class CRM_Core_Resources {
       "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",
-      "packages/jquery/plugins/jquery.validate$min.js",
+      "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')
+    );
+    $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')) {