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 »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Possible bug with custom css resource url in civicrm 3.0.1
Pages: [1]

Author Topic: Possible bug with custom css resource url in civicrm 3.0.1  (Read 1510 times)

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Possible bug with custom css resource url in civicrm 3.0.1
October 16, 2009, 03:52:18 am
Hi guys,
this is my first forum post, although been using civicrm for a UK government project for about 6 months now. Great piece of software so thanks a lot for all your hard work.

I have discovered what I think might be a bug in the latest version (3.0.1) with drupal - although please correct me if I am not understanding how it works correctly.

After upgrading my dev server to version 3 and updating the custom templates etc. we are using, I noticed the custom css url is no longer working. We have some custom css we use in addition to the main civicrm.css file, specific to the crm pages on our site. Previously (in v. 2.2.6), we could set a custom css url in 'Administer->Global Settings->Resource urls->Custom CiviCRM CSS URL, and this would replace the main civicrm.css file. In v3.0.1 entering a value in this field appears to remove the main civicrm.css file from the HTML source, but not replace it with the new custom url entered in the box.

I did a bit of digging and it seems to me the problem is in the civicrm drupal module (civicrm/drupal/civicrm.module), in the 'civicrm_html_head()' function.

Code: [Select]
    if ( isset( $config->customCSSURL ) && ! empty( $config->customCSSURL ) ) {
        $head  = "<style type=\"text/css\">@import url({$config->customCSSURL});</style>\n";
    } else {
        drupal_add_css(drupal_get_path('module', 'civicrm') . '/../css/civicrm.css');
    }

Here, the first part of the if statement adds the custom URL to the page head if one is set. This seems to work ok as I did some debug output checks on this value. The problem comes later in the function here:

Code: [Select]
    if ( $includeCommon ) {
        $template =& CRM_Core_Smarty::singleton( );
        $head = $template->fetch( 'CRM/common/jquery.tpl' );
    }

where the head value is again reset to the value of the jquery template, thus wiping out the earlier HTML which adds the css file. My fix was simple, to change the '$head =' to '$head .=':

Code: [Select]
    if ( $includeCommon ) {
        $template =& CRM_Core_Smarty::singleton( );
        $head .= $template->fetch( 'CRM/common/jquery.tpl' );
    }

Is this intentional or a bug? Any chance it could get into the next patch.

Are members of the public allowed to sign up to the JIRA issue queue system and post issues in there or is that just for the core team? If it's allowed I'll happily post an issue in there.

Cheers

Graham

grahamgilchrist

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 3
Re: Possible bug with custom css resource url in civicrm 3.0.1
October 16, 2009, 04:12:58 am
P.S. Also, a nice feature to have, would be the ability to specify an additional css file which the CRM could use, as well as the replacement. In some use cases (i.e.  mine  ;)), we have additional css we want to be loaded, but at the moment I copy the civicrm css file to a new site-specific folder and then add rules to it. Obviously this is not great for upgrades as the CSS file can change between civicrm version and we have to rebuild it with our additional rules. Being able to specify an additional CSS file would mean that we could upgrade the CRM and retain our custom css without having to copy and modify source files each time?

I could not find a hook either which allowed us to insert HTML into the page header - please let me know if I have missed something. I guess I could write a drupal module to add this css for each civi page, but would rather a solution that also worked with standalone?

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Possible bug with custom css resource url in civicrm 3.0.1
October 16, 2009, 04:16:16 am
hi Graham,

Quote
Is this intentional or a bug? Any chance it could get into the next patch.
It's a typo bug.

Issue filed is here : http://issues.civicrm.org/jira/browse/CRM-5242

thanks for catching

kiran
« Last Edit: October 16, 2009, 04:18:29 am by kiran »
You Are Designed To Choose... Defined By Choice.

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Possible bug with custom css resource url in civicrm 3.0.1
October 16, 2009, 04:43:33 am
Oops,
there was already issue filed for this bug : http://issues.civicrm.org/jira/browse/CRM-5241
So http://issues.civicrm.org/jira/browse/CRM-5242 is duplicate.

kiran
You Are Designed To Choose... Defined By Choice.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Possible bug with custom css resource url in civicrm 3.0.1
October 16, 2009, 07:12:36 am
Quote from: grahamgilchrist on October 16, 2009, 03:52:18 am
this is my first forum post, although been using civicrm for a UK government project for about 6 months now. Great piece of software so thanks a lot for all your hard work.

Hey graham:

can you describe what you have been using CiviCRM for and how its working out. Would be great if you can follow that up with a case study here: http://wiki.civicrm.org/confluence/display/CRMDOC/Case+Studies Great way to give back to the project and serves as excellent marketing material for the project :)

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Possible bug with custom css resource url in civicrm 3.0.1

This forum was archived on 2017-11-26.