Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
color.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Nov 2007 at 20:31 UTC
Updated:
20 Feb 2008 at 17:25 UTC
Jump to comment: Most recent file
Comments
Comment #1
hass commentedComment #2
Freso commentedCan hardly be a breaker for beta 3, as that's been out for a little while.
Comment #3
gábor hojtsyGuys, there is no need to mark anything a breaker. If there is code ready, it will be in, otherwise the beta will be out without it. We are not delaying releases on issues without much of an interest.
Comment #4
gábor hojtsyNow that the patch this one depends on is committed, catch on work here :) This patch will also need to fix the IMHO bugos phpdoc on drupal_load_stylesheet():
If the aggregation is turned off, the optimization does not apply to any CSS anyway. So this is bugos.
Comment #5
catchStill applies although it has windows linebreaks, marking to needs work for the phpdoc.
Comment #6
hass commentedOk, new patch attached - hopefully now with UNIX line feed... I've added some more explanations, a few newlines to make the code more readable and updated the patch with the changed function name
_drupal_build_css_path.Comment #7
gábor hojtsyWell, well. I tried to understand what issues are exactly fixed by *this* patch, but the link you gave discusses the fixes which are already in Drupal for @import handling. Also you point towards another issue for RTL stuff. Now that we have color module fixes here, maybe you can do a writeup on what is happening here. Please specify what bugs you found and how you solve them here. It would help a lot of we would not need to cherry-pick information from two other issues which also solved other issues. Thanks.
Comment #8
gábor hojtsyOr to put it another way: it is good to know if we can find more attractive things to market this patch for review here. Like Minnelli is not recolorable in Drupal 6 head, because it does not use style.css, it uses minnelli.css. That's a pretty important problem to solve. Let's have a list of bugs found and approaches taken in this issue!
Comment #9
dvessel commentedSubscribing and testing..
Comment #10
dvessel commentedLet me ask, is this really important? Rewriting rtl styles as it applies to color is really needed? rtl style sheets from what I've seen only apply to positioning and padding, not the actual color.
Did I miss something here? Please enlighten me.
The only thing I found useful is specifying the stylesheet. style.css isn't mandatory anymore and being specific about that would be nice. This would help the issue with Minnelli as Gabor mentioned.
I tested without this patch and rtl seems to work fine with color changes in Garland.
Comment #11
dvessel commentedAnd if you can mention specific issues about this.. What are the issues outside of Garland. Thanks.
Comment #12
hass commentedI will try to answer all question and write up what this fixes at all... might become a little bit longer thread.
@dvessel: possible problems in RTL styles comes up if you have an border-right in LTR that will turn in RTL to a border-left. Then you come in the situation where you must override or set a non existent border-color. Same problem will happen with backround colors. This should be possible in general or we have limits, we do not really want and some themers will complain about. I must search for it, but i know about one or two situations i was made to use this. And the answer about "how" important this is... well - it primarily add's RTL support we current do not have. To allow this support i learned how non-API like tis module has been developed and it limit's all themers. So i tried to re-factor some problematic parts as you can see in
_color_rewrite_stylesheetfor e.g. Many themers like to depend on color module, but cannot use it, while it have so many limits. Later - more about this limits...@garbor: i have never thought about minelli regarding this patch, but i think this should be solved by this patch, too. Not tested with Minelli, but with my themes that includes about ~15 CSS files.
Comment #13
hass commentedSum up what this patch does and fix:
@import url("example.css")isn't possible. With the patch i'm reusing the @import code logic from #113607 and are not made to care about two different logics that make people confused._color_page_alterand i decided to include this performance hit. This becomes a real performance issue if you add ~20 CSS files like i do and then you have 40 files with first byte download, 20 more connections to the webserver, etc._color_rewrite_stylesheetbecomes re-usable. As themer i'm able to call the function whenever i'd like/must. I'm pushing content to the function and get content back. This content is then not saved to a predefined filename. Workaround this problem is really complex and i struggled hardly about this limitation.So - if you ask you - why does this patch do not go *this* or *this* way:
I'd really like to depend with my themes on color module (and many others too - as Gabor said somewhere else) and this looks only possible with the above fixes and the refactoring. I really hope this gives all of you an idea what becomes possible.
I will try to take a look into minelli re-coloring with this patch and we could create a follow up if we want this feature in!? Should only be the configuration option in color.inc - nothing more...
Comment #14
dvessel commentedI agree, need to be changed.
Was never supported so it's not a bug but I think this can solve another problem. See the end.
Agreed, keep it consistent.
Not a bug, your adding a new feature.
That's only true when CSS aggregation is disabled and a big point of aggregation is minimizing requests. If you can colorize your theme, then you can turn on aggregation and solves that problem. I didn't study how your patch deals with this directly but if it fixes that, great. Not critical.
Sounds like an interesting feature.
...see above.
Most of your points are leaning towards advanced features so I don't think it's helping this issue.
Note about the second point:
Instead of trying to automatically re-write the rtl styles (which I see as complicated and duplicates code from drupal_add_css()), why not just give the option to list the main style + the rtl inside color.inc. Looks like your patch is already set to accept multiple styles.
Not exactly related but there were complications with trying to let themes override module rtl styles automatically. To simplify, why not let the theme set it explicitly? Ya know, carry over that same requirement of being explicit with rtl files. If you know how to work with color.module, you surely can handle the extra line adding the extra styles.
About Minnelli.. it's broke and some minor tweaking should fix it. Should not a separate issue since that's a genuine bug.
Comment #15
dvessel commentedIn short, I think the only real issue is getting Minnelli working and tweaking the @import handling so it's more inline with the previous import patch.
RTL handling is not critical IMO but would be nice to fix. Even if it wasn't, there would be workarounds with setting a rtl class and overriding that through the main style sheet. Not ideal but than again, how often would a theme depend on what color a side border is in?
Comment #16
hass commentedCheck out pushbutton's RTL file please and you see how *many* colors, background-colors and borders are inside...
Maybe i added some "advanced features", but they come all together with the refactoring. Keep the current logics and try to extend them to RTL is really bad and looks awful. I started this way in the early beginnings and it would add additional variables to the var table and doesn't make things better and easier. Only ends up with another major drupal release with an color.module no theme other then garland can use.
Module overrides: If you add a module css you need to extend the css array in color.inc. That's how it is designed.
Please let me say - i don't like to create a color module fork. Without most of the above themers need to do so if they want the color module features in a non-core theme :-(((. We should help the people and not limit them as today.
Comment #17
hass commentedAside about aggregated CSS files i think you are wrong. If you have both style.css in the array and the recolored style.css the resulting aggregated and compressed CSS file contain both file contents. This results in the doubled file size - if compressed or not. Ok, requests are reduced, but file size is doubled.
Comment #18
hass commentedAdding an RTL file to the settings file would be strange and not consistent, too. Everywhere in D6 we only add the LTR file and the RTL is auto detected. Why should we break with this logic now!? See theme.info file, drupal_add_css etc.
Please rethink if this really needs work. I don't think so until you find a bug and i don't know what i should change in "bug free" code. I won't like to waste my time with turning the wheel back to the crippled module we currently have. This patch got much brain (over 2 weeks work "try to understand this suboptimal existing code"/rework/rework/throw away/refactoring...) and look over some things not working over 1 year since D5. Mixing Minnelli stuff with this case is no good idea, while total different part of D6.
Comment #19
hass commentedWhile trying to support minnelli as re-colorable theme i found a relative path bug in my latest patch. I took over the '../' path correction from
_drupal_build_css_pathin common.inc and fixed this small bug this way.Additional you find the small minnelli patch attached that makes minnelli color.module aware.
Comment #20
hass commentedComment #21
dvessel commentedHass, there's nothing wrong with rolling the Minnelli patch together. It is a color issue and it's doesn't complicate it further.
The other points I'll leave up to others to judge but code wise, there is an error where it does the split.
from "_color_rewrite_stylesheet()":
That function runs multiple times and the "Don't touch" string isn't always present so it will spit out a notice.
Comment #22
hass commented@dvessel: WELL, there is a different EALL bug (see http://drupal.org/node/183374)... Dries complained about my workaround, but i don't know how to solve in a different way... maybe you know!? chx told me anywhere D6 will not EALL compliant.... i have no idea whats the priority about this...
Comment #23
dvessel commentedChecking for the string works. Here it is, fixed the notice and the help docs changed removing references to style.css. Everything else is the same.
I was going to make a simpler patch partly based on your code Hass, but I'll wait for what Gabor thinks.
[edit: and this does include the fix to Minnelli.]
Comment #24
hass commentedThat patch looks fine for me, too. Thank you for the addition of missing help text and the E_ALL notice fix.
EDIT: Aside, I'd like to mention that re-coloring of IE hack files becomes possible with this patch. Something we shouldn't miss, too.
Comment #25
gábor hojtsyReviewed the latest patch:
- the code has weak comments... I find it quite hard to understand some of them like "// Add the non-colored stylesheet as we cannot use if/else in following loop.". So why cannot you use if/else? This sounds like a weak technical reason, but it might not be. I am confused.
- pulling out original styles looks like a good idea
- With the variable changes I wonder what happens on update... this is our first release, where color module needs to be upgraded... Because styles changed, color settings will need to be updated as well, right? This is not actually related, but people should be aware of this. What is related, is that the stylesheet variable is dropped, so as soon as it is dropped, the styles will not show up anyway. This should be on the upgrade path too (ie. do not leave unused variable in the database).
- Rewrite theme stylesheets has the exact same long code block copied twice. Why not make up a one or two element array and loop over that. Now whenever you modify something, you need to do it twice. This looks ugly.
- Hass, you use case about the CSS property in color.inc does not seem common. Why not use the built-in .info file based CSS discovery, which also handles inherited CSS files? The css property in color.inc seems like a superfluous extra place to specify the same as you did already in your theme .info file (or which was discovered by Drupal based on your .info file) for most themes.
Comment #26
hass commentedThe problem here is, we might not have a recolored stylesheet for every css file a theme have. In this case we end up without a file. I have no idea how to do in a different way.
1. i'm adding the original stylesheet to the css array
2. i'm looping over this array and try to find a matching colored css file - then if found - overwrite with a colored css file and unset the original.
This is all done to keep the original stylesheet order intact (for correct css overriding).
Yep, but this is very simple (move single value 'stylesheet' into array structure and save inside 'stylesheets'). I must ask where we should do this? system update? Until now i thought we do not support this and users must change their custom theme to an default core theme with default setting and can change this back after upgrade. Please give me a hint where in system update and we will implement this simple upgrade. No css files needs to be rewritten for this step.
i will think about a better way later... i find this ugly too, but it looks more readable and this change might not easy... we will see later
Not really. The way is the only working solution.
1. If i use .info files i may miss files that get's added dynamically
2. .info files may not contain all files or theme settings page does not invoke this files. So we don't have a chance to get this info. We could only give some "hate" to the people who changed this... but i think they have some good reasons.
So color.inc allows us to add N css files that must/should be recolored. Think about files you don't like to recolor e.g. minnelli.css. This files are not added to color.inc then. On the other side your .info file have all files listed and this could cause some harm - or people must use "Color Module: Don't touch" as first line in their css... doesn't make much sense. But nevertheless the ".info" file is not available on theme settings page if you have an admin theme... so - no way to solve this this way.
Color.inc look like a very common use and only possible way in such a special case...
Comment #27
gábor hojtsy1. Understandable, refine that comment please.
2. I mean if people upgrade their core Drupal 5 site to core Drupal 6 (no contrib module or theme, but a recolored Garland), because Garland's CSS was modified, they need to somehow run the recoloring process, right? So as part of the update, we would need to affect the settings array and possibly run recoloring on all themes, which were colored before. This later issue might need to go to another bug report, I would not like to overload this issue with more tasks, just realized that we have a problem here.
3. The long block of code seems to be the same so an array(original style, rtl style) or array(original style) if there was no rtl style and a foreach on the array with the same code block seems logical to me.
4. Ah. I am not buying all this stuff about the .info files. You can load the theme .info file whenever you wish. But I am buying the reasoning that you only need a subset of your styles recolored, so you can specify those. For *this* reason, a separate css array seems to be workable.
So tasks to do:
- fix the code comments (1)
- provide upgrade path for variable (2)
- clean up repeated code (3)
Comment #28
hass commented- comment fixed
- upgrade path added to system.install (net tested yet - i will do in ~10 hours). Note: i used
list_themesto upgrade customized garland/minnelli themes, too.- cleaned up repeated code
Comment #29
gábor hojtsyWell, this looks much better now. I hope you can take some time with testing this more, and dvessel or someone else can also look into it soon. I only see some code comments not looking nice, but those I can always fix myself, instead of playing this back and forth. Now concentrate on testing.
Comment #30
gábor hojtsyRetitled to be more to the point on what are we fixing, it is marginally RTL related.
Comment #31
hass commentedAfter Gabor's latest commit #91233 the patch in #28 have a failed hunk. Updated patch attached.
Testing:
1. I've done a plain D5 installation
2. recolored Garland (default theme)
3. recolored Minnelli
4. Upgraded to D6.
5. Both theme 'stylesheet' variables have been upgraded into the 'stylesheets' arrays, themes are kept recolored after upgrade.
This patch is RTBC for me...
Comment #32
dvessel commentedIt works, so marking RTBC.
Comment #33
gábor hojtsyI went through the code comments, and edited them for better English usage (as far as I know :). Also made the Don't touch string a variable as it is used multiple times, so now it is more evident. Committed.
Comment #34
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #35
jprieto commentedforgive my ignorance
but I think there are MANY drupal users out there -- just like me -- who love D6, like the Garland theme, but just want to be able to change the color combinations.
so you got a patch here
great!
NOW......
How is it applied?
Why can't a file be created, so that when I upload into my site, it will override the existing file with the bug, and we all get a nice sleep?
Can anyone explaine how us -- not php savvy -- can apply this fix?
do we have to write some code? or can we just upload a file (patch)?
if a patch is just a file or files with coding entered or edited -- why can't the corrected file -- AS A WHOLE -- be provided?
please help
Comment #36
gábor hojtsyjprieto: This is included in Drupal 6, no need to apply anything yourself.
Comment #37
moortrommler commentedim really not into coding, except for html, but I just installed the latest drupal 6 and when i tried to change the colorset in the minelli AND garland theme to, lets say, teal top, all i get is a theme without any css. plain html, like you can see on blog.fefe.de for example (not my site, but it looks like it after using the color switcher in drupal.) so if you think this is patched. tell me whats wrong. and please tell me if you want a screenshot. hard to find info on this if you are a fresh drupal starter btw, i hope i didnt do anything wrong with posting this. but as this is "fixed" but doesnt work, i didnt know better.
greetings moortrommler
Comment #38
hass commentedPlease open a new case. This one is fixed and closed.