Download & Extend

Color panes feature

Project:Panels
Version:6.x-3.0-rc1
Component:Plugins - styles
Category:task
Priority:normal
Assigned:slip
Status:closed (won't fix)

Issue Summary

Merlinofchaos told me he'd like a style plugin that allows users to change colors like they can change the colors garland uses. This is a ROUGH patch of that feature. :) But it works. Check out the attached screenshot for an example.

Any advice on improving the code/interface would be much appreciated!

AttachmentSize
color_panels.patch22.64 KB
color_panels.jpg222.77 KB

Comments

#1

+ /* This prefix/suffix hack below can't be the best way to do this... Should
+ * I be using a CTools AJAX respond command? I wasn't sure how to set this
+ * up
+ */
+ '#prefix' => 'Drupal.Panels.Color.addFarbtastic("#pane-'.$pid.'");',
+ '#suffix' => '',

This should be done with a behavior, probably in color.js that looks something like this:

Drupal.behaviors.PanelsColorSettings = function() {
  $('.some-class-to-signify-farbtastic-should-be-attached:not(.panels-color-processed)')
    .addClass('panels-color-processed')
    .each(function() {
      Drupal.Panels.Color.addFarbtastic($(this).attr('id'));
    });
}

Roughly.

Second, we probably shouldn't name it color.js as themes can override javascript files (at least, they can with css files and I think javascript is the same way) and color.js is too generic. Let's name it panels-color.js

I'll have more later, but that's clearly the big messy thing that can be cleaned up.

#2

+function panels_render_print_color_css($style, $display, $idstr, $where) {
+  ctools_include('css');
+  $css_id = 'color_panels:' . $idstr;
+
+  $css = _panels_render_print_color_css($style, $idstr);
+  /* Unfortunately for now we're doing this the older/uglier way
+   * Otherwise proper cache files will have to be flushed when settings
+   * are changed */
+  drupal_set_html_head("<style type=\"text/css\" media=\"all\">\n$css</style>\n"); 
+}

Instead of this, we can use CTools CSS caching functions.

We can use ctools_css_clear() when the style settings form is submitted and ctools_css_retrieve() to get the filename and ctools_css_store() if it doesn't come up with a filename. That should cover all of our bases. All we need to do is be sure to come up with a unique ID -- you can look at how the 'rounded corners' style does it, which has to solve the exact same problem.

#3

I have not tried this patch yet, but colored panels would be amazing! I will definitely keep an eye on this.

#4

Awesome! I'm glad people are excited about this. I've done work to fix the issues merlinofchaos discussed above, but I need to do a bit more. I'll have a new version up ASAP and then start thinking about some more improvements.

#5

Very cool. Subscribing

#6

+1 Suscribing

#7

+1 Suscribing

#8

Just wondering if there are any updates for this patch, I know you are probably very busy Slip, just wondering if this will still be moving forward. It Sound really great
Regards, Lowell

#9

This would be really cool. But how should I use this patch? Where should I copy it? Please give me instructions. Plz plz plz

#10

drupal-boss - May 31, 2009 - 19:20
This would be really cool. But how should I use this patch? Where should I copy it? Please give me instructions. Plz plz plz

Have you seen this documentation ? http://drupal.org/node/60108

#11

Thanx

#12

mcreature,

Yeah, I managed to update it to account for merlinofchaos' advice but didn't roll a patch. Then I was studying the best way to be able to make it so we can change to the color of images to do rounded edges and drop shadows etc. But then I got really, really busy. :(

If somebody wants to do some work that would be hugely appreciated :). But I'll try to post the more recent patch soon, and I'm even considering taking a fair amount of time off from work to contribute to the Drupal modules I love, so this would get a lot more attention.

#13

Thanks for your response Slip. Looking forward to the patch if and when you get time to post it.
The extra functionality your working on sounds great. I am not versed with panels enough to help with the patch, but I would certainly be willing to help with testing where I can.

#14

+1 Suscribing

#15

Hey slip, any updates? If you're very busy, could you at least post a patch with your most recent work? It could be valuable if somebody else wants to finish it. =)

#16

sorry, yeah, that was lame of me... I'll get it ready for posting right now.

I'm also going to do some more work on it today because things have slowed down a bit.

#17

Version:6.x-3.0-beta1» 6.x-3.0-beta4

Here's an updated patch mostly addressing merlinofchaos's suggestions and updated to apply to 3.0 beta 4.

AttachmentSize
color-panels-456840-17.patch 23.86 KB

#18

Slip, some time ago I fiddled around with transparent, rounded corners for a panel style and eventually made it work. It might give you an idea of an approach you might use: http://drupal.org/node/218960#comment-864840. If you keep the rounded corners transparent, you can change the color of the theme or the panels and still have things match up.

#19

Here's the latest patch. It features rounded edges as shown in the screenshot. I haven't cleaned it up too much but thought I'd release it so people wouldn't think I'd abandoned this project. There might be some issues with my original color panels style because I haven't played with that since doing a ton of work, so just stick to rounded corners if you want to play with it. O, and I've only tried it with FF3.

The new code lets plugins specify images and then allow the user to change colors of those images. Only one color in the image is allowed but semi-transparencies + transparencies are possible.

Caching of images and stylesheets needs work. Merlinofchaos or somebody else could probably give me some pointers there in regards to ctools. It'd even be cool if we could use imagecache, but that might be far-fetched.

Anyways, I should post another update soon.

AttachmentSize
round.png 87.97 KB
color-panels-456840-19.patch 36.96 KB

#20

follow

#21

Ugh, just realized the patch doesn't seem to include the png file I'm attaching. Other than that it seems to work. I'll include it in the next patch automatically.

It needs to be copied here:
panels/plugins/styles/color_corners/

AttachmentSize
corner-bits2.png 441 bytes

#22

Slip, thank you for the patch. I am trying to test, but I'm having trouble applying the patch. I am trying to patch against 6.x-3.0 beta 4, and I've put the patch into my panels module folder. Using the command "patch < color-panels.patch" the patch cannot find the files it's supposed to update. My apologies for my lack of understanding here, but I would really like to try this out. Any help in applying this patch would be appreciated. I would also work with a pre-patched tarball, if you are inclined to post that here. Thanks, Slip.

#23

He made it from the modules directory, ont panels; try patch -p1

#24

Merlin, thank you. The -p1 command did the trick for patching with the patch file in the panels module directory.

#25

ohh, should I make it from inside of panels or is it ok to make it from the modules directory?

bomarmonk, great, thanks for testing! Definitely let me know about any more problems.

Also, I've discovered a bunch of caching issues and I'll release a new version today.

#26

It's best generate patches from inside the module directory as most folks are used to using -p0. If it's easier to do it this way it is fine.

I played with this for a few minutes (wanted to do longer but I'm a little too tired to work on something so involved) and on first review, this really spews notice errors. I recommend turning E_NOTICE on (I think you edit bootstrap.inc to do this) and you'll see what I mean. Most of it is unquoted strings in the .inc files but there appeared to be some tests for non-existing variables in display-edit or display-render

#27

In trying this, my panels admin links vanish from the main dashboard (except for the links under the "By module" page) and the panels page configuration links were missing from here as well. Reverting back to beta solved the problems, so I'm guessing there are some issues to be resolved with this patch. I am using a local install of Drupal with XAMPP on a Windows Vista machine and the rootcandy admin theme, so my install is somewhat unique. I am really looking forward to this functionality in panels, so hopefully the bugs can get ironed out and this can eventually get added to the development branch. I will retest with the next patch.

#28

Here's the latest patch. Don't forget to download the PNG from above as well.

bomarmonk, thanks for testing! Your issue is very strange. I'm not sure this patch will address that problem. I guess you could try switching to Garland to eliminate the theme as the culprit. But I'm not sure what the issue is. I'll have to investigate.

merlinofchaos, I'm having trouble finding out how to turn on those messages. I thought that was a php.ini setting ?

AttachmentSize
color-panels-456840-28.patch 38.02 KB

#29

I switched to Garland, but I still do not get a panels admin link for adding or listing panels pages. This is with your latest patch. I also get an unsupported operands error when trying to add a new panel page. If I go to http://localhost/mysite/admin/build/panels, I simply get the list of other site-building links. Also, if I try admin/build/panels/settings/panel-page, I cannot get to the settings for panel pages (it just goes to the base site building page that lists the links to other module's settings).

#30

Slip, it appears that I needed to disable the panels module, uninstall the panels module, delete the old panels folder, replace it with the patched version of panels, then enable and reinstall panels. This made the admin links appear in their proper place. I'll give you another update after further testing. I've downloaded the image file to the prescribed location and I'm trying out the styles. Thanks again for working on this.

#31

The color panel has notched corners at this point. See the attached image.

AttachmentSize
color-panel.jpg 37.14 KB

#32

It looks like the color panes work really well. I just can't get the rounded corners to look rounded at this point. Is the image you posted earlier the right image?

#33

Maybe related to your earlier comment on caching, it would be nice to be able to save a certain pane or panel style, name it, and then reuse it with other panels or panes.

#34

bomarmonk: Yes, that's on the list of things that we'll want to do as this feature matures. Probably for a later issue though.

#35

bomarmonk, cool, glad you got the colors working. The screenshots are correct. The code successfully changes the colors of rounded edges (for me at least). Are you sure you're using the right style? I've added two. One is called Color Panes and the other is Color rounded edges or something similar.

#36

Slip, I get a notched edge, not a rounded corner. I am using the rounded style and the colors are changed appropriately. It just looks like the old Atari 2600 days with low resolution sprites. It might have to do with the image file. I'll try updating that file. Maybe I saved it incorrectly or something.

#37

bomarmonk,

It sounds like GD isn't installed or working properly. Can you run phpinfo() to check if it's enable and which version it is? I'll add some code to the next patch to ensure that it's installed and enabled.

Also, the images would be stored directories inside of sites/default/files/panels_color or wherever your files directory is. Could you check if there are any images in there?

#38

I think that's the problem-- the folders are there, but there aren't any files in them. I'll try to fix this. A warning, as you mentioned, would help people like me to get this working.

#39

Merlinofchaos,

I found out how to get those notices to appear. I had to edit includes/common.inc. So, next step will be to fix them.

#40

Slip, my install reports that the GD toolkit "is installed and working properly." The images are generated normally for my theme (which uses the color module). I'll try creating another rounded corner pane and see if I can give you any more information about the trouble I am having.

#41

Version:6.x-3.0-beta4» 6.x-3.0-rc1
Status:needs work» needs review

Attached (in the post below... whoops) is the latest patch.

I fixed those php notices merlinofchoas mentioned (think I got'em all) and updated it to rc1.

bomarmonk, I'm not sure what your issue is. Do you have php error reporting turned on? An error message would be helpful. Did you place corner-bits2.png in /panels/plugins/styles/color_corners ? What are the contents of /files/panels_color ? For most of my testing I've been making pages through admin/build/pages but I've also done nodes and I believe mini panels. Any more information would be appreciated!

It'd be nice if somebody else could give it a try?

#42

here's the patch

AttachmentSize
color-panels-rc1-456840-42.patch 38.3 KB

#43

Hi! I just install panels-RC1 with your last patch and put png file. I can't see anything new in panels (nothing colors) except this error: file_get_contents(sites/all/modules/panels/panels/js/panels-color.js): failed to open stream: No such file or directory /var/www/apache2/html/includes/locale.inc string 1689.

Could you please attach patched version of RC-1 Panels?

#44

Sorry, it was my problem. Now i see color panes feature.

Please, attach patched version.

#45

I think it'll be very coll, if we can choose corner color. I mean to colors for colored round corners: one for body and one for round corner.

#46

subscribing

#47

Slip, great patch!

Just a quick note, I can partly confirm the problem posted by bonarmonk. The problem is probably not GD related, because some of the rounded corners work. If I just select rounded corners for a region -> everything is alright. The problems start when I try to nest rounded corners like you did in your screenshot.

If I select rounded corners in different colors for both region and content, the inner corners only work, when "each region" is selected in the container dropdown. Otherwise the corners are broken like in the screenshot.

Also the "color panes" do not seem to apply fill settings.

#48

drupal24,

Yay! thanks for testing.

> Also the "color panes" do not seem to apply fill settings.
What do you mean by fill settings?

Anyways, it's strange that I haven't experienced the rounded problem you two have found. However, the code is a bit messy (as merlinofchaos and I have discussed ;) so I'm going to dedicate a day soon to cleaning it up. I expect to have a new patch by the end of the week, and hopefully I'll either find this problem, or just restructure the code in a more logical, less buggy way.

#49

subscribing

#50

> Also the "color panes" do not seem to apply fill settings.
What do you mean by fill settings?

Something like this (maybe there were some changes in panels?). Just a quick hack to illustrate, what wasn't working, maybe other classes are better.

/panels/plugins/styles/color_panels/color_panels.inc (working copy)
@@ -24,16 +24,16 @@
                        'selector' => array('.inner-pane'), 'attr' => 'border',
                        'additional' => '1px solid'),
                  array('label' => 'Background', 'default_value' => '#FFFFFF',
-                       'selector' => array(), 'attr' => 'background-color'),
+                       'selector' => array('.inner-pane'), 'attr' => 'background-color'),
                  array('label' => 'Header Background',
                        'default_value' => '#3D9CD7',
-                       'selector' => array('h2.title'),
+                       'selector' => array('.pane-title'),
                        'attr' => 'background-color'),
                  array('label' => 'Header Text Color',
                        'default_value' => '#FFFFFF',
-                       'selector' => array('h2.title'), 'attr' => 'color'),
+                       'selector' => array('.pane-title'), 'attr' => 'color'),
                  array('label' => 'Text Color', 'default_value' => '#000000',
-                       'selector' => array(), 'attr' => 'color'),
+                       'selector' => array('.inner-pane'), 'attr' => 'color'),
                ),
       'hook theme' => array(
         'panels_color_panels_box' => array(

What do you think about introducing border color for the colored rounded corners?

#51

Thank you for nice work !
subscribing....

#52

What is the status?

#53

Status:needs review» needs work

I got a bit busy..

The code pretty much needs to be reworked and cleaned so it's on the same level as panels and can be added to the project. I'm assuming Merlin still desires a feature like this. I haven't really had the time to work on this and the most recently attached patch is the latest code I've worked on. I'd still like to work on this, but I'm not sure when so if anybody wants to take over, they're welcome.

#54

Also, please post a message here or send me a private message to let me know if you do decide to start significant work on this so we don't duplicate efforts in the off chance that I start working on it again.

#55

would it be possible to integrate with the color picker module? just a thought.

#56

Status:needs work» closed (won't fix)

Thanks for the basic work on this, slip.

I just dedicated the last 2 weeks to bringing this one home. I have checked it in, and some of it is in CTools and some of it is in Panels.

If you cvs up CTools and Panels, you can activate the panels stylizer module. Currently it needs a few more styles, which I hope to get from volunteers who are a little better with photoshop than I am.

It also needs some documentation. I'll try to work on that this week.

nobody click here