Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: ADDON: Add an RGB Color Picker Utility to Text Editor (sNews 1.5)  (Read 11782 times)

Keyrocks

  • Doug
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 451
  • Posts: 6288
  • Semantically Challenged
    • snews.ca

READY FOR USE - link button issue solved.

Purpose:
This adds a  new utility button to the Editor functions in the New Article and Edit Article panels in sNews 1.5. If you wish to add color styles directly into your textarea, you can use this to choose your RGB color number, then copy and paste it into the textarea (within the proper tags) to add color to components within your article body.

Step 1: - Download the .zip package from http://snews.ca/d-loads/colorpicker.zip, un-zip it, and copy (or upload) the colorpicker folder into a js folder within your site's root directory. If you don't have a js folder there yet, create one now.

Step 2: - You need a new link button that display under your New Article and Edit Article textarea. Open your snews.php file in your "good" code editor and search for:
Quote
function form_articles($contents)
This function contains the Edit Function link buttons under your textareas. Scroll down until you locate several lines that start with html_input('button', or... search for these lines:
Quote
html_input('button', 'include', '', 'Include', '', 'button', 'onclick="tag(\'include\')"', '', '', '', '', '', '', '', '');
  echo '</p>';
and under these lines, copy and paste the following into place:
Quote
echo '<p>';
   // -------------- link to Jscript Color Picker ------------------
           ?>
        <INPUT TYPE="button" value="Color Picker" onClick="popup = window.open('http://www.your-domain.com/js/colorpicker/cpick.htm', 'PopupPage', 'height=535,width=600,scrollbars=yes,resizable=yes'); return false">
   <?php        // ----------------- END OF Color Picker link -------------------
   echo '</p>';
Then... in the second line of the script... change the absolute URL to the Color Picker Panel so that it has your domain name in it:
Quote
window.open("http://www/your-domain.com/js/colorpicker/cpick.htm",
After saving and/or uploading snews.php (and your new js folder), You will now find a new button, in a new row, under the Edit Function buttons in your New Article and Edit Article Panels. It is easy to use. Hope you find it useful.

Key
« Last Edit: August 22, 2007, 06:09:37 AM by Phil Martin (Philmoz) »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

henrich

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 405
  • Passion for quality and excellence!
    • My personal blog and portofolio
Re: ADDON: Add an RGB Color Picker Utility to Text Editor (sNews 1.5)
« Reply #1 on: February 08, 2008, 10:53:01 AM »

Good one, but here you have a suggestion:

- when clicking on the color picker, before you can select a word, then choose a colour from the picker and press ok, the selected word will have now the new picket colour. Something like this: <span style="color: #ff0000;">blabla</span>

What do you think?
Logged
By(e) Henrich :)
------------------------------
IT related blog

Keyrocks

  • Doug
  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 451
  • Posts: 6288
  • Semantically Challenged
    • snews.ca
Re: ADDON: Add an RGB Color Picker Utility to Text Editor (sNews 1.5)
« Reply #2 on: February 08, 2008, 02:41:19 PM »

Good one, but here you have a suggestion:
- when clicking on the color picker, before you can select a word, then choose a colour from the picker and press ok, the selected word will have now the new picket colour. Something like this: <span style="color: #ff0000;">blabla</span>
What do you think?

If you like it that way... then "make it so" and share it here.
Note that this was posted for use with 1.5. For 1.6... may need some minor changes... I haven't tried using it on 1.6 yet.
If you revise this for 1.6... why not post it as a Mod for 1.6 - Revised... etc.  :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

henrich

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 405
  • Passion for quality and excellence!
    • My personal blog and portofolio
Re: ADDON: Add an RGB Color Picker Utility to Text Editor (sNews 1.5)
« Reply #3 on: February 08, 2008, 03:08:22 PM »

Yes, i can make something, but not with this script, i need another similar free script and i will work also at the buttons cases or something, not sure yet.
Logged
By(e) Henrich :)
------------------------------
IT related blog