CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • CiviCRM 3.4.8 / Drupal module Advanced CSS/JS Aggregation conflict
Pages: [1]

Author Topic: CiviCRM 3.4.8 / Drupal module Advanced CSS/JS Aggregation conflict  (Read 1971 times)

TallDavid

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
    • ATO Zeta Mu Alumni
  • CiviCRM version: 3.4.8
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.52
  • PHP version: 5.2.13
CiviCRM 3.4.8 / Drupal module Advanced CSS/JS Aggregation conflict
January 31, 2012, 10:34:16 am
There is a a conflict between CiviCRM 3.4.8 and the Drupal Module Advanced CSS/JS Aggregation 6.x-1.6 (https://drupal.org/project/advagg).  This combination gives a "Javascript must be enabled" error on the CiviCRM Dashboard and significant amounts of CiviCRM functionality is disabled.

CiviCRM 3.4.4 was working fine with  Advanced CSS/JS Aggregation 6.x-1.6, but, the problem occurred after upgrade.  As a work-around I have disabled the Advanced CSS/JS Aggregation module, but, this results in performance degradation.

In the IRC logs (http://irc.civicrm.org/logs/%23civicrm.log.2011-12-15.txt), <Met4physica> reports a similar problem.  Can a change me made to a future CiviCRM version to re-enable compatibility so that performance can be restored?

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviCRM 3.4.8 / Drupal module Advanced CSS/JS Aggregation conflict
January 31, 2012, 10:56:44 pm
Quote
There is a a conflict between CiviCRM 3.4.8 and the Drupal Module Advanced CSS/JS Aggregation 6.x-1.6 (https://drupal.org/project/advagg). 

It would be great if you or someone in the community investigate and submits a patch for this.  Sorry we kind of have limited resources. :(

Kurund
Found this reply helpful? Support CiviCRM

TallDavid

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
    • ATO Zeta Mu Alumni
  • CiviCRM version: 3.4.8
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.52
  • PHP version: 5.2.13
Re: CiviCRM 3.4.8 / Drupal module Advanced CSS/JS Aggregation conflict
February 01, 2012, 07:44:13 am
If a CiviCRM user was to devote resources to investigate / patch this conflict, could we get an test inserted into the test suite to ensure that future versions of CiviCRM were analyzed for this incompatibility prior to release?  Applying resources to fix this conflict would only make sense if some assurance was had that the fix would be permanent.

Now to find a javascript guru who understands JS aggregation, performance and CiviCRM...

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviCRM 3.4.8 / Drupal module Advanced CSS/JS Aggregation conflict
February 01, 2012, 11:34:01 am
Quote
If a CiviCRM user was to devote resources to investigate / patch this conflict, could we get an test inserted into the test suite to ensure that future versions of CiviCRM were analyzed for this incompatibility prior to release?
CiviCRM uses Selenium for web based tests. So yes, you can write a test to ensure javascript works when advagg is installed and submit it along with the patch. IMO this would be ideal.

Quote
Applying resources to fix this conflict would only make sense if some assurance was had that the fix would be permanent.
Yes it would be permanent. We do run all the test regularly and fix the code / test if needed.

Kurund
Found this reply helpful? Support CiviCRM

jimurl

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 0
  • CiviCRM version: 3.4.6
  • CMS version: drupal 6.22
  • MySQL version: 5+
  • PHP version: 5+
CiviCRM 3.4.8 , 4.1.x - Drupal module Advanced CSS/JS Aggregation conflict
August 06, 2012, 02:33:43 pm
This problem persists in CiviCRM 4.1.5. TallDavid, did you find the source of the problem?

[edit] I found the source of the problem: a good part of the process of adding js files to the head of the document was moved between 3.4 and 4.1 . In earlier versions adding js was done in the civicrm_html_head() function around line 50 in drupal/civicrm.module with these lines:

Code: [Select]
      if ( strpos( $line, '.js' ) !== false ) {
               drupal_add_js( drupal_get_path('module', 'civicrm' ) . '/../' . $line );
           } else if ( strpos( $line, '.css' ) !== false ) {
               drupal_add_css( drupal_get_path('module', 'civicrm' ) . '/../' . $line );
           }

Now its handled in the civicrm_preprocess_page() function around line 960.

I fixed the problem in my case; but since I don't know why that drupal_add_js was moved, any fix that is done here can't really be ported back to HEAD unless someone who knows the reason WHY that code was moved can look at this and determine that is is acceptable to move it back to _html_head().

Here is a trivial patch that will make adv_agg play nicely with civicrm; but I am hoping that someone who understands core civicrm will be able to propose a permanent resolution to this problem.

« Last Edit: August 06, 2012, 03:47:25 pm by jimurl »

flug

  • I post frequently
  • ***
  • Posts: 126
  • Karma: 12
Re: CiviCRM 3.4.8 / Drupal module Advanced CSS/JS Aggregation conflict
July 18, 2014, 03:54:05 pm
Summary: Problem when running Drupal Advance CSS/JSS Aggregatin module and civicrm together: "console shows cj is not defined and other js errors."  Basically no js or ajax works within CiviCRM.  Contribution forms are missing the credit card fields (which are loaded via js/ajax).  Civicrm Dashboard items don't show and give a error indicating js must be turned on.  Etc.

The root of this problem has to do with the fact that Drupal & CiviCRM use different versions of JQuery.  CiviCRM calls its version cj and prefixes all jquery calls with cj to differentiate. Whether this works seems to be very dependent on the order in which the jquery and other js modules are loaded.  If you look at the javascript console or errors you see see a large number of "cj not defined" errors.

Here is how I solved (using Drupal 6, Civicrm 4.2.x, Jquery update, advagg module):

 - You'll need the module weights module enabled (it's part of drupal core)
 - Go to admin/build/modules
 - Set weight for JQuery UPdate to 98
 - Weight for Advanced CSS/JS Aggregation   to 99
 - Weight for CiviCRM to 100

Depending on what other modules you have & issues regarding their relative weights, you might need to adjust this a bit--maybe it is 298, 299, and 300 instead of 98, 99, 100.  But the basic idea is that both JQuery Update & AdvAgg must be loaded BEFORE CiviCRM.  AdvAgg needs to be loaded AFTER most other modules but before CiviCRM.

Out of the box AdvAgg has weight of 250, putting it after CiviCRM.  This causes the problem.  Adjusting the module weights appears to solve it.

Related topics from the CiviCRM message boards:

http://forum.civicrm.org/index.php?topic=23203.0 (AdvAgg vs Civicrm & javascript)
http://forum.civicrm.org/index.php?topic=21761.0 (Potential issues/solutions re: CiviCRM & Jquery update)

AdvAgg issue:
https://www.drupal.org/node/1883028#comment-8980701

davyivins

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 2
    • PURCO SA
  • CiviCRM version: 4.5
  • CMS version: Drupal 6.33
  • MySQL version: 5.5.34
  • PHP version: 5.4.33
Re: CiviCRM 3.4.8 / Drupal module Advanced CSS/JS Aggregation conflict
November 09, 2014, 12:20:42 am
In case anyone else finds this post while looking for a way to easily manage module weights in Drupal 6. Try Util module drupal.org/project/util
« Last Edit: November 09, 2014, 12:23:11 am by davyivins »
There are times I love technology...and then there are times I *love* technology :-)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • CiviCRM 3.4.8 / Drupal module Advanced CSS/JS Aggregation conflict

This forum was archived on 2017-11-26.