Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Pages: [1] 2 3

Author Topic: [MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)  (Read 23962 times)

sevir

  • Newbie
  • *
  • Karma: 0
  • Posts: 21
    • http://www.sevir.org
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« on: October 10, 2006, 02:32:14 PM »

It is my first mod, I only use sNews since last Saturday :P .

Let see, I want edit somethimes with an advanced editor like TinyMCE, the problem is that TinyMCE fuck all my XHTML valid :( (insert imgs without close / , the same with br and the horrible mce_href attribute). Then I'd want unable/disable the advanced editor.

This is my mod:

1. I download TinyMCE latest version
2. I download iBrowser plugin for TinyMCE
3. I decompress TinyMCE jscripts folder in my sNews root folder
4. In snews.php file I edit this lines:

    line 1157:
    html_input('button', '', '', 'Include', '', 'button', 'onclick="tags(\'include\')"', '', '', '', '', '', '', '', '');
    I change for:
    html_input('button', '', '', 'Include', '', 'button', 'onclick="tags(\'include\')"', '', '', '', '', '', '', '', '');
   if (isset($_GET["richarea"])){
      html_input('button', '', '', 'Simple Editor', '', 'button', 'onclick="document.location=document.location.href.substr(0,document.location.href.indexOf(\'&richarea=\'))"', '', '', '', '', '', '', '', '');
   }else{
      html_input('button', '', '', 'Word Editor', '', 'button', 'onclick="document.location=document.location + \'&richarea=\'"', '', '', '', '', '', '', '', '');
   }

    line 1864:
       
    I change for:
           
   
   if (isset($_GET["richarea"])){
?>
   
   
   }
?>




And that is all!! You can see the toogle button under the textarea :D
Logged

Mika

  • Hero Member
  • *****
  • Karma: 9
  • Posts: 1377
    • http://www.ni5ni6.com/
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #1 on: October 10, 2006, 02:56:48 PM »

hello sevir and thx for the mod. :)

could you, please, provide a working copy of your modded sNews.php file for download?
Logged
http://www.ni5ni6.com/ - Tutorials, Mods and How-To's about sNews CMS
sNews 1.6 Developers Edition - commented sNews 1.6 version

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #2 on: October 10, 2006, 03:07:40 PM »

Yes, please... this sound interesting, but would be greatly appriciated if viewable... You don't have a demo online do you ?
Logged
"It's only dead fish that goes with the flow... "
Updated

sevir

  • Newbie
  • *
  • Karma: 0
  • Posts: 21
    • http://www.sevir.org
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #3 on: October 11, 2006, 12:56:17 AM »

Of course, sorry. You can download the mod version here:
http://www.sevir.org/pub/tools/snews15_ES+tinyMCE.zip

I don't have a live demo because, I test all in my site ;-) . I make this screencast demo:
http://www.sevir.org/pub/tools/snews_tinymce.htm
Logged

mininovax

  • Newbie
  • *
  • Karma: 1
  • Posts: 44
    • http://www.ondapc.net
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #4 on: November 30, 2006, 04:35:20 PM »

what would be nice as well, is if the toogle button could pass the form variable to the regular editor.

If you are in HTML edit mode, and then you hit the TOOGLE button for TINYMCE, you lose all the values you entered before.

As well as if you are in TINYMCE mode and you click on the button for HTML mode, you will lose all of the information you input before.

A fix for this would be very interesting, as it would make the application work seamless -- back and forth between WYSIWYG -- and -- HTML

Anyone up for the challenge? Mika, Patric, Keyrocks ?

I know that the value should probably be input somewhere in the following lines

Code: [Select]
if (isset($_GET["richarea"])){
html_input('button', '', '', 'HTML', '', 'button', 'onclick="document.location=document.location.href.substr(0,document.location.href.indexOf(\'&richarea=\'))"', '', '', '', '', '', '', '', '');
}else{
html_input('button', '', '', 'WYSIWYG', '', 'button', 'onclick="document.location=document.location + \'&richarea=\'"', '', '', '', '', '', '', '', '');
}
probably in one of the "', '', '', '', '', '', '', '', '');   ----- But where exactly, i do not know.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #5 on: November 30, 2006, 10:47:24 PM »

TOOGLE  or Toggle... Potato or Potaato... Tomato or Tomaato... it's all the same to me. Are we talking about a TOGGLE button or a TOOGLE button here... are they one and the same? Or... is TOOGLE the name of the mod itself?  :rolleyes:

Sorry... got carried away there... no... I don't have any time to lay on this one right now... tied up working a coupla other sNews-related projects right now that are not mod-related... and I kinda have to get them done by sometime Friday afternoon cause I'm taking the weekend off for some serious partying till the end of Sunday :)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

sevir

  • Newbie
  • *
  • Karma: 0
  • Posts: 21
    • http://www.sevir.org
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #6 on: December 01, 2006, 01:13:13 PM »

By now, I don't hava any time (maybe this weekend... some minutes...) I know the "small" bug :P, in a first time the mod was a very very simple patch for me, I will have to change the code in the future because I have using sNews in some comercial websites.

It would be very simple save the textarea text in the cookie session for save the changes without touching the database.

I don't like the idea of incorporate some about HTML editor in sNews in the main project simply because sNews has a good core, simple code and it is very easy customize it.

Quote from: mininovax
what would be nice as well, is if the toogle button could pass the form variable to the regular editor.

If you are in HTML edit mode, and then you hit the TOOGLE button for TINYMCE, you lose all the values you entered before.

As well as if you are in TINYMCE mode and you click on the button for HTML mode, you will lose all of the information you input before.

A fix for this would be very interesting, as it would make the application work seamless -- back and forth between WYSIWYG -- and -- HTML

Anyone up for the challenge? Mika, Patric, Keyrocks ?

I know that the value should probably be input somewhere in the following lines

Code: [Select]
if (isset($_GET["richarea"])){
html_input('button', '', '', 'HTML', '', 'button', 'onclick="document.location=document.location.href.substr(0,document.location.href.indexOf(\'&richarea=\'))"', '', '', '', '', '', '', '', '');
}else{
html_input('button', '', '', 'WYSIWYG', '', 'button', 'onclick="document.location=document.location + \'&richarea=\'"', '', '', '', '', '', '', '', '');
}
probably in one of the "', '', '', '', '', '', '', '', '');   ----- But where exactly, i do not know.
Logged

mininovax

  • Newbie
  • *
  • Karma: 1
  • Posts: 44
    • http://www.ondapc.net
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #7 on: December 01, 2006, 05:20:23 PM »

Quote from: sevir
It would be very simple save the textarea text in the cookie session for save the changes without touching the database.

I don't like the idea of incorporate some about HTML editor in sNews in the main project simply because sNews has a good core, simple code and it is very easy customize it.
No, cookie is not a viable solution: there is a limit as to how much a cookie will store, approximately 4096-byte limit ... I think.

So, cookie storing is out of the question as it would limit the content.

I think the solution is either to store the value as a "POST" variable that is distinct to the other post variables... something like $_POST['wyswiyg'];

Code: [Select]
if ( isset($_GET["wyswiyg"]) ) {
// DO YOUR $_POST['wysiwyg'] LOGIC HERE
} else {
// DO YOUR MYSQL LOGIC HERE
}
?>
Logged

Vorsoron

  • Newbie
  • *
  • Karma: 0
  • Posts: 25
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #8 on: December 06, 2006, 02:01:28 AM »

Now if this MOD worked with 1.5.30
Logged

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #9 on: December 08, 2006, 11:22:16 PM »

Quote from: Vorsoron
Now if this MOD worked with 1.5.30
It does!

I just changed a couple of thing to the original MOD:

sevir  mod:
1. download TinyMCE latest version
2. decompress TinyMCE jscripts folder in my sNews root folder
3. In snews.php file edit this lines:
After:
Code: [Select]
html_input('button', 'include', '', 'Include', '', 'button', 'onclick="tag(\'include\')"', '', '', '', '', '', '', '', '');
echo '</p>';
Include the following:
Code: [Select]
//RICH EDITOR BUTTON 1ST PART BEGINGS
 if (isset($_GET["richarea"])){
        html_input('button', '', '', 'Simple Editor', '', 'button', 'onclick="document.location=document.location.href.substr(0,document.location.href.indexOf(\'&richarea=\'))"', '', '', '', '', '', '', '', '');
    }else{
        html_input('button', '', '', 'Word Editor', '', 'button', 'onclick="document.location=document.location + \'&richarea=\'"', '', '', '', '', '', '', '', '');
    }
//RICH EDITOR BUTTON 1ST PART ENDS
Almost at the end replace:
Code: [Select]
</script>With the following:
Code: [Select]
</script>
    
<?php
    
if (isset($_GET["richarea"])){
?>

    <script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
        tinyMCE.init({
            mode : "textareas",
            cleanup : false,
            language : "en",
            theme : "advanced",
            content_css : "../../css/style.css",
            plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,ibrowser,flash,searchreplace,print,contextmenu,paste,directionality,fullscreen",
            theme_advanced_buttons4 : "fontselect,fontsizeselect",
            theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
            theme_advanced_buttons5: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator,tablecontrols,separator",
            theme_advanced_buttons3_add: "emotions,iespell,ibrowser,flash,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
            theme_advanced_toolbar_location : "top",
            theme_advanced_toolbar_align : "left",
            theme_advanced_statusbar_location : "bottom",
            content_css : "example_word.css",
            plugi2n_insertdate_dateFormat : "%Y-%m-%d",
            plugi2n_insertdate_timeFormat : "%H:%M:%S",
            external_link_list_url : "example_link_list.js",
            external_image_list_url : "example_image_list.js",
            flash_external_list_url : "example_flash_list.js",
            file_browser_callback : "fileBrowserCallBack",
            paste_use_dialog : false,
            theme_advanced_resizing : true,
            theme_advanced_resize_horizontal : false,
            theme_advanced_link_targets : "_something=My somthing;_something2=My somthing2;_something3=My somthing3;",
            paste_auto_cleanup_on_paste : true,
            paste_convert_headers_to_strong : false,
            paste_strip_class_attributes : "all",
            paste_remove_spans : false,
            paste_remove_styles : false        
        });
    </script>
<?php
    
}
?>
It works Great!
  
I realized that doing that will give make the snews.php ends as follows:
Code: [Select]
   </script>
<?php
    
}
?>

<?php ?>
Is that correct or should I delete the following:
Code: [Select]
<?php
    
}
« Last Edit: February 21, 2009, 02:35:42 PM by Joost »
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #10 on: December 08, 2006, 11:40:44 PM »

Quote
   
That all depends on what's happening here.
The first  The Curly-bracket is a closing bracket that would have matched up with an opening one further back in another PHP script... and together they enclosed a block of PHP script that was being served. Then the ?> is the tag that closes and ends the PHP session.

What you have up there is the same thing twice. My code editor (PHP Designer) does a neat thing when I put the cursor on a curly bracket - it gets a red flashing background on it and it's mate (either an opening or closing one) also gets a red flashing background so it's easy to see if it is related to another or just left over as an orphan. If it's an orphan, there's no red flashing happening.

A quick way to test is to cut a portion of a script off the page, save it, test view the site... and if it isn't functioning, you know you removed something that has to be there... then you paste it back into place, save, etc. That's the way I do it (hehe).
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Zucye

  • Sr. Member
  • ****
  • Karma: 5
  • Posts: 347
    • Simplemente una Mujer
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #11 on: December 08, 2006, 11:45:54 PM »

Quote from: keyrocks
Quote
<?php    }    ?>    <?php   }   ?>
That all depends on what's happening here.
I will check that later.  I have to go now.
But everything seems to work.  That should mean that is ok. Right???
« Last Edit: February 21, 2009, 02:35:59 PM by Joost »
Logged
We can always learn from our failures, not so much from obvious success - C. Robinson (W. Disney). :)

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #12 on: December 08, 2006, 11:46:44 PM »

Right!
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

modis

  • Newbie
  • *
  • Karma: 0
  • Posts: 11
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #13 on: December 14, 2006, 10:19:42 AM »

Just can't figure out what's going on with that ending…

After changing the 1.5.30 script with sevirs/Zucye mod I get a functioning TinyMCE editor no problem (nice), but I also get //RICH EDITOR 2nd PART Ends printed at the top of every page after logging in.

OK, no problem, there must be something going on with that ending:

Code: [Select]
//]]>

//RICH EDITOR 2nd  PART Begings

   
    if (isset($_GET["richarea"])){
?>
   
   
    }
?>
//RICH EDITOR 2nd  PART Ends

But no matter what I seem to change in that ending, it just seems to break the entire script—an error in line 955 is reported:

Code: [Select]
echo '';What could be going on?!

(Actually, I'd rather use FCKeditor, but can't get that to work with 1.5.30… sevir??? ;) )

peter

ps. Sorry for being such a hopeless noob.  :(
Logged

Cesboa

  • Newbie
  • *
  • Karma: 0
  • Posts: 2
    • http://www.wouz.dk
[MOD] Toogle button: Simple Editor / TinyMCE Editor (sNews 1.5)
« Reply #14 on: December 14, 2006, 01:55:46 PM »

modis ->

I have a sNews 1.5.30 version with integrated FCKEditor, and some other addons (like article authoring) I haven't posted anything here in this forum yet....

www.wouz.dk/download/snews_with_FCK.zip

Just download FCK and put it in the root dir... There are still somethings that needs to be fixed, but it basically workes... Later on I will write a article on www.wouz.dk with our modifications and "how-to's"   :)
Logged
Pages: [1] 2 3