View Full Version : Color Picker for Admin CP Style Properties
OK, a few people mentioned they want this so here goes:
popup color-picker for the Administration Control Panel's Style Properties page
(where you select the colours for your BB style theme(s)).
The hack is extremely easy to install:
1) Download the attachment.
2) Upload colors.gif and picker.php to your forums' /admin/ directory.
3) Open admin/style.php and find:
if ($iscolor) {
echo "20\" onchange=\"updatecolor(this.form.preview$idvalue,this.value,' $idvalue')\" id=\"$idvalue\">\n";
echo "<input type=\"button\" disabled value=\" \" id=\"preview$idvalue\" style=\"background-color:$itemarray[replaceword]\">";
Replace with:
if ($iscolor) {
echo "20\" onchange=\"updatecolor(this.form.preview$idvalue,this.value,' $idvalue')\" id=\"$idvalue\">\n";
echo "<input type=\"button\" onclick=\"window.open('picker.php?fieldname=$name&idvalue=$idvalue','color','width=202,height=124,le ft=539,top=450');\" value=\" Click to Pick \" id=\"preview$idvalue\" style=\"background-color:$itemarray[replaceword]; font-weight: bold\">";
Save the file and upload it to /admin/
That's it!
Demonstration
Now, go to your style editor page, and click on any
button next to one of the colour value fields:
http://www.atlasf1.com/personal/bira/picker1.gif
When you click on a button next to the color value you
need to fill, a small pop-up window will jump:
http://www.atlasf1.com/personal/bira/picker2.gif
For an alternative colour chart, scroll down to post #25
Clicking on any of the colours will immediately fill in its
respective value in the correct field, as well as change
the background colour of the respective button.
http://www.atlasf1.com/personal/bira/picker3.gif
Enjoy :)
Cheers,
Bira
IMPORTANT COMMENT ABOUT BROWSERS:
This hack has been tested and functions on IE 5, 5.5, 6; Netscape 4.7, 6.2, and Opera 6.
HOWEVER, the background color of the buttons will change ONLY in IE. The value will be passed to the form field just fine (you can see the text changing), but the background colour for the button will NOT change (it remains that default beige-grey) in any browser except IE.
I repeat: THE HACK WILL WORK ON ALL BROWSERS. It's only the display that is impared.
this has been tested on versions 2.0.1, 2.0.3 and 2.2.1.
squawell
12-06-2001, 02:40 AM
this hack is nice!!
when u want to change style that will be useful!
thankz bira!!:D adn it work!!
SirSteve
12-06-2001, 03:51 AM
Works great!
Crinos
12-06-2001, 04:15 AM
Hmm, weird, doesn't seem to be working for me ... I followed the instructions to the letter, and uploaded the files ... I can see the "Click to Pick" buttons and when I click on it the color chart pops up ... but when I try and choose a color, it doesn't fill in the RGB info in the field ...
I don't think I installed it wrong, since the instructions are pretty straightforward ....
Crinos what browser are you using?
Crinos
12-06-2001, 07:19 AM
IE 5.5
Admin
12-06-2001, 01:24 PM
Same as Crinos, I can see the pop up, but when clicking on the squares nothing happens. :(
Love the hack though, it's gonna make life really easier!
212rikanmofo
12-06-2001, 04:15 PM
yup same here, installed the hack, but when i pick a color it doesn't change the field. I'm using IE6.
SirSteve
12-06-2001, 05:46 PM
Works for me on IE 6...
Admin
12-06-2001, 05:54 PM
Using IE 6 btw. :)
I am assuming all you guys have javascript enabled?
This is so weird. :confused:
Crinos
12-06-2001, 09:54 PM
[QUOTE]Originally posted by bira
I am assuming all you guys have javascript enabled?
Try something:
download the attachment in this post and upload this new picker.html to your /admin/ dir. Then try using it again and let me know.
Thanks
errmm... actually uploading the attachment would be noce :D
Crinos
12-07-2001, 04:31 AM
Tried it ... still doesn't put the RGB code into the field :(
I tried it on IE 5.5, Mozilla, Opera and Netscape 6 ... no go :(
I wonder what's wrong ... it worked for the first ones who tried it ....
Thanks though...
I have an idea where the problem may be.
Crinos, can you please e-mail me a copy of your style.php to goren@atlasf1.com ?
Thanks :)
ok, got it....
Those who can't get the script to work, please do the following:
1) rename picker.html to picker.php
2) in style.php, replace:
onclick=\"window.open('picker.html
to
onclick=\"window.open('picker.php
save & upload, and give it a try.
Let me know please :)
Admin
12-07-2001, 10:49 AM
D'oh, putting
<?php echo $fieldname ?>
and calling it .html. :p
Working great now! :)
yeah, it occured to me that some people here may not have .html parsed as php in their httpd.conf :o (which, I must admit, I'm surprised you don't)
KuraFire
12-07-2001, 12:10 PM
[QUOTE]Originally posted by bira
yeah, it occured to me that some people here may not have .html parsed as php in their httpd.conf :o (which, I must admit, I'm surprised you don't)
KuraFire
12-07-2001, 12:14 PM
btw, you might want to edit the instructions.txt file in the zip in the attachment, to edit the .html into .php (to make it working) - in case people cut and paste from the instructions file instead of from this thread. Will prevent them from coming here and complaining it doesn't work and that they did exactly what the instructions say - the instructions are kinda wrong now. :)
server load doesn't change one bit. If you parse html via php and there's not a single php code in that file, it will just output it and that's that. There's nothing to execute, hence there's no memory needed.
But I get your point about shared servers. In any event, it was a complete oversight on my part and I apologise. What surprises me is that none of you got a javascript error! getting a <?php echo $something ?> smack in the middle of a javascript should have immediately triggered a javascript syntax error for you. You probably have the option to disable all errors in your browser selected. Shame on you, developers! :D
[QUOTE]Originally posted by KuraFire
btw, you might want to edit the instructions.txt file in the zip in the attachment, to edit the .html into .php (to make it working) - in case people cut and paste from the instructions file instead of from this thread. Will prevent them from coming here and complaining it doesn't work and that they did exactly what the instructions say - the instructions are kinda wrong now. :)
At a friend's request, I also made an alternative colours chart:
http://www.atlasf1.com/personal/bira/alternative-picker.gif
If you rather use this one than the original one included in the hack (first post), then please:
1) download the attached file, rename it to picker.php
2) in style.php, instead of:
window.open('picker.php?fieldname=$name&idvalue=$idvalue','color','width=202,height=124,le ft=539,top=450')
use:
window.open('picker.php?fieldname=$name&idvalue=$idvalue','color','width=202,height=147,le ft=539,top=450')
Admin
12-07-2001, 02:11 PM
I think I'm gonna try something, instead of hard-coding all the colors in the file, maybe you can use a FOR loop to go through all the colors... or maybe half the colors. :)
FireFly, what for? :confused:
Crinos
12-07-2001, 05:16 PM
[QUOTE]Originally posted by bira
yeah, it occured to me that some people here may not have .html parsed as php in their httpd.conf :o (which, I must admit, I'm surprised you don't)
KuraFire
12-07-2001, 09:22 PM
[QUOTE]Originally posted by bira
server load doesn't change one bit. If you parse html via php and there's not a single php code in that file, it will just output it and that's that. There's nothing to execute, hence there's no memory needed.
But I get your point about shared servers. In any event, it was a complete oversight on my part and I apologise. What surprises me is that none of you got a javascript error! getting a <?php echo $something ?> smack in the middle of a javascript should have immediately triggered a javascript syntax error for you. You probably have the option to disable all errors in your browser selected. Shame on you, developers! :D
Originally posted by KuraFire
Uhm, why would that give a javascript error?? The PHP is parsed out of there before it reaches the browser, and javascript isn't processed until it reaches the browser.
Or am I talking nonsense??
Well, if you have <?php echo $something ?> in the middle of the javascript, and that page is not parsed through php, then the <?...?> code is outputted to the client as part of the php/script source. And, when java parses the script, it stubles on illegal elements that shouldn't be there.
[QUOTE]Originally posted by KuraFire
Also: if a server parses .html files, doesn't that mean it Checks the entire .html file to see if there is any PHP code inside it, anywhere? I do believe that that's what parsing is.. :/
And if so, it _would_ provide some extra server loads if you do it on a large scale (100+ visits per minute) - all those php, asp, etc. tutorials speak about how you shouldn't use .php extensions if you don't have any PHP in the file, to prevent needless server parsing, i.e. server loads.
Axel Foley
12-10-2001, 03:03 PM
[QUOTE]Originally posted by bira
I already did that. I uploaded a new zip file when I updated the first post :)
Axel, I had the exact same problem with Tommy Boy's zip file - it's bloody IE's cache.
Clear your cache (or just the specific zip filename) and you'll be able to download the new file :)
Wayne Luke
12-14-2001, 07:03 PM
I guess there is no way to do this with the full spectrum of colors?
Wayne there's a free java applet that behaves like this:
http://javaboutique.internet.com/ColorPicker/
if you're interested, I can find it and give out the instructions of how to use it instead of the 2 palettes I offered above
Wayne Luke
12-14-2001, 10:03 PM
Thanks.. That will help. I will see if I can integrate it, shouldn't be to hard to do.
Sadie Frost
12-19-2001, 12:56 PM
Awesome! The easiest hack I've ever installed (not that it's a long list lol). Great job!
:)
Bedhead
12-29-2001, 12:18 PM
Great work.
Things are gonna be quicker with this.
Thanks.
Sadie Frost
01-02-2002, 12:47 PM
wluke - if you get it working, it would be great if you could post how you did it? :) Thanks!
Hoffi
01-02-2002, 03:56 PM
It works great!
I use the alternative Picker, but it's not closing after i select a color, but thats no problem. So i can redecide. ;)
So one wish and it's perfect! To build an own Picker, or Color-libraries in the Database.
Smallville
01-13-2002, 05:01 AM
I probably did something stupid, but I get this when trying to do anything with the style.php file (add, modify, etc.)
Parse error: parse error in /home/thechar/public_html/admin/style.php on line 458
What's wrong and what can I do to fix it?
Bison
03-22-2003, 06:45 PM
Nice ... [Click Install]
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.