lxer

Re: Finally! Replace Textile with TinyMCE

if you want to remove the empty tags  like   <p>&nbsp;</p>
then use this code in page_verify.php line 32

Code:
$jobs['description'] = preg_replace('#<(\w+)[^>]*>&nbsp;</\1>#i', '' , $jobs['description']); 

Last edited by lxer (2009-05-28 10:28:17)

evertsemeijn

Re: Finally! Replace Textile with TinyMCE

@lxer I don't know if the user receives all the HTML in the e-mail. Never tested that. Will look into that. Will also try to find a TinyMCE plugin to remove the empty tags.

Hope I can find the time to write a better TinyMCE solution next week. You guys gave me a lot of things I never thought of.

Member of Jobberbase Development Team - Templates/Usability

:: Looking for a jobboard installation and/or custom design? ::

lxer

Re: Finally! Replace Textile with TinyMCE

users don't receive the email with the full text (only the admin), so thats not a big deal after all.
Some of the layout issues i had were the result of pasting text from msWord. theres a plugin in tinymce that handles this,  so that is fixed too now.   

i added these options to tinyMCE
Not sure if these are all needed, but it seems to work

Code:

paste_strip_class_attributes : "all",
paste_remove_spans : true,
paste_remove_styles : true,
paste_auto_cleanup_on_paste : true

Last edited by lxer (2009-05-29 11:06:23)

putypuruty

Re: Finally! Replace Textile with TinyMCE

Hi, guys!

I've played around with this and I think I found a solution for the description validation problem mentioned a few posts earlier.

In _templates/publish-write.tpl, add the following lines

Code:

$('#submit').click(function()
{
   tinyMCE.triggerSave();
});

before this line

Code:
$("#publish_form").validate({

You should also be sure that you have

Code:
description: {required: true}, 

in the rules section (a few lines below, be sure to put it before poster_email: { required: true } if you've removed it).

Hope it helps!

chrisdegrote

Re: Finally! Replace Textile with TinyMCE

Hey all today I gave TinyMCE a new try. But I again don't see any kind of changes.
I've put the test site on http://test.werkict.com/post/ . I truly love this add on because it gives the job poster a great diversity of options. If somebody wants to see the code for this site I will post the code directly.

a proud user of Jobberbase

evertsemeijn

Re: Finally! Replace Textile with TinyMCE

Check the link to tiny_mce.js. On your demosite it's "js/tiny_mce/tiny_mce.js". Try

Code:
{/literal}{$BASE_URL}{literal}js/tiny_mce/tiny_mce.js

where you have the tiny_mce.js in the root js folder. Or try to hardcode (http:hmm/...) the url.

Last edited by evertsemeijn (2009-06-28 18:05:58)

Member of Jobberbase Development Team - Templates/Usability

:: Looking for a jobboard installation and/or custom design? ::

links

Re: Finally! Replace Textile with TinyMCE

@chrisdegrote

You don't have tiny_mce default in the js folder. You have to either copy it or include it from admin using

{$BASE_URL}admin/js/tiny_mce/tiny_mce.js

chrisdegrote

Re: Finally! Replace Textile with TinyMCE

@Links & Chronos thanks for you're fast reply!!! Greatly appreciated wink Also evertsemeijn for posting all the steps big_smile!

It's working at my test site. So I'm posting all the steps I've followed until now. Hopefully In chronical order.

1.
In root_templates/footer.tpl

replace

Code:
 </body></html>

with

Code:
 {literal}
    <script type="text/javascript" src="{/literal}{$BASE_URL}{literal}js/tiny_mce/tiny_mce.js"></script>
    <script language="javascript" type="text/javascript">
        tinyMCE.init({
            mode : "textareas",
            editor_selector : "mceEditor",
            theme: "advanced",
            plugins: "advhr,advimage,table,emotions,media,insertdatetime,directionality",
            theme_advanced_toolbar_align: "left",
            theme_advanced_toolbar_location: "top",
            theme_advanced_buttons1: "bold,italic,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,fontsizeselect,separator,bullist,numlist,separator,link,unlink,separator,undo,redo",
            theme_advanced_buttons2: "",
            theme_advanced_buttons3: "",
            height: "500px",
            width: "420px"
        });
    </script>
    {/literal}
</body>
</html>

2
In root_Templates/footer.tpl

I've changed the

Code:

<script type="text/javascript" src="{/literal}{$BASE_URL}{literal}js/tiny_mce/tiny_mce.js"></script>

with

Code:

<script type="text/javascript" src="{/literal}{$BASE_URL_ADMIN}{literal}js/tiny_mce/tiny_mce.js"></script>

3.
In root_includes/function.escape.php

Code:

$GLOBALS[$variable] = $db->real_escape_string(strip_tags($value));

with

Code:

$GLOBALS[$variable] = $db->real_escape_string(strip_tags($value,'<a><strong><em><ul><p><li><ol><span>'));

4.
In root_templates/publish-write.tpl
replace

Code:

id="description"

with

Code:

id="description" class="mceEditor"

5.
In root page_verify.php

Code:

$jobs['description'] = str_replace(array("\r\n", "\r", "\n"), "<br />", $jobs['description']);

with

Code:

$jobs['description'] = str_replace(array("\r\n", "\r", "\n"), "", $jobs['description']);

6.
In root_templates/publish-write.tpl
before this line

Code:

$("#publish_form").validate({

add this

Code:

$('#submit').click(function()
{
   tinyMCE.triggerSave();
});

7.
putting TinyMCE(package) copy/paste from the admin folder
root/js/

put the code around line 111
footer.tpl

Code:

{/literal}{$BASE_URL}{literal}js/tiny_mce/tiny_mce.js

instead of

Code:

{/literal}{$BASE_URL_ADMIN}{literal}js/tiny_mce/tiny_mce.js

Of course this is not perfect but it works for me now do you've got a comment on this I am willing to edit this post. Thanx again for the support!!

As a bonus I am sending the link for the Tiny MCE extra buttons
With thanks to Tokyoj http://www.jobberbase.com/forum/topic51 … ditor.html

In root_templates/footer.tpl

Buttons 1 for the first row
buttons 2 for the second row
Buttons 3 for the third row

add or replace in between ""

Code:
   theme_advanced_buttons1: "bold,italic,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,fontsizeselect,separator,bullist,numlist,separator,link,unlink,separator,undo,redo",
            theme_advanced_buttons2: "",
            theme_advanced_buttons3: "",
           

look at line 10 & 14 for the options
http://tinymce.moxiecode.com/examples/full.php

for the full example look at
http://tinymce.moxiecode.com/examples/full.php

good luck!!
lol

Last edited by chrisdegrote (2009-06-29 19:35:14)

hobo

Re: Finally! Replace Textile with TinyMCE

You are missing the closing </html> tag a step 1.

putypuruty

Re: Finally! Replace Textile with TinyMCE

@chrisdegrote

I saw that in the tutorial you've integrated my fix for the description validation problem. Thus, you should remove step 6 because description: {required: true}, must remain in publish-write.tpl

navjotjsingh

Re: Finally! Replace Textile with TinyMCE

I tried Integrating TinyMCE on my site...I am facing a problem that it does not show on IE 7.

http://jobs.careertalk.in/post/

evertsemeijn

Re: Finally! Replace Textile with TinyMCE

That a problem within TinyMCE. Try downloading TinyMCE from their website and upload it to the original folder (default in de "admin/js" folder).

Member of Jobberbase Development Team - Templates/Usability

:: Looking for a jobboard installation and/or custom design? ::

navjotjsingh

Re: Finally! Replace Textile with TinyMCE

That fixed it. Thanks.

navjotjsingh

Re: Finally! Replace Textile with TinyMCE

I tried making TinyMCE work in editing posts via Admin but the preview is not showing. What should I do? Its saving and showing TinyMCE in Admin Posts edit page nicely though.

fineluck

Re: Finally! Replace Textile with TinyMCE

any one know why the jobber automatic ignore the <br/>tag?

i try to aovid <p>and use <br/>.

any place i need to change?

fineluck

Re: Finally! Replace Textile with TinyMCE

wow, i just figure out ...

$GLOBALS[$variable] = $db->real_escape_string(strip_tags($value,'<a><strong><em><ul><li><ol><span><br><br/>'));

and add the following codes in tiny_MCE Init

force_br_newlines : true,
forced_root_block : '',

sharma3361

Re: Finally! Replace Textile with TinyMCE

@fineluck : hey do you know how to remove the empty tags in tiny mce .. please explain

chrisdegrote

Re: Finally! Replace Textile with TinyMCE

@sharma3361

I believe the solution posted by fineluck is okay. In my case I made <br /> instead of <br/>. It works now and It doesn't create a lot of whitespace. The second option I didn't implement because it works how I intended. (if I'm wrong please point that out to me)

However if you place a table on my site it gives a lot of whitespace before showing the table. In someway it adds a lot of <br/> tags (10 or more).

I've checked the TinyMCE forum http://tinymce.moxiecode.com/punbb/view … p?id=16805 and there I've found two solutions. The first one doesn't work fix_table_elements: 1 (I don't see any changes) The second one nl2br() seems the cause of the issue. I've looked the information up and it shows that when putting de data in the database it shouldn't be used because it will add <br /> tags. As I've read it should be used for pulling out the data of the database.

Can somebody tell me how to correct/change this?

wink Thanks

Chris

chrisdegrote

Re: Finally! Replace Textile with TinyMCE

Well I've received a clear anwser how to use nl2br http://www.phpinsider.com/smarty-forum/ … 9574#59574 . Apparently you've got to remove the <br/> tags from the function escape according to the admin of the link above. It makes real sense what he is saying.

Where do you add this small line of code like the admin stated?

Code:
{$description|nl2br}

To force the content to be displayed with the breaks or something else that makes sure there's not a lot of whitespace between every written line. (like this forum)

Hope somebody can help me with this?

Thanks smile

Chris

hobo

Re: Finally! Replace Textile with TinyMCE

Maybe in page_job.php

Find:

Code:

//$info['description'] = nl2br($info['description']);
            $info['description'] = str_replace(array("\r\n", "\r", "\n"), "<br />", $info['description']);

There is your <br />
Probably...
Try removing it and see what happens.

wtrevino

Re: Finally! Replace Textile with TinyMCE

Not sure if anyone else had already found this bug which happens with IE6 (go figure!) and IE7 (haven't tested with IE8):

Try submitting the job post form with all fields as empty, the page reloads (unlike with FF, in which validation occurs in the client-side), validation errors are of course triggered BUT TinyMCE dissapears leaving the textarea as normal.

The bug does not occur when the Description field is not empty.

RO-Banen

Re: Finally! Replace Textile with TinyMCE

Hi there,

I've inserted the tinymce editor by these steps.

It works ok, but when I go to step 2 of placing an ad, the text won't show up...

What could this be?

Spike

Re: Finally! Replace Textile with TinyMCE

If I'm starting with 1.8 will these directions work?  I followed all the steps, but nothing on the website has been affected.  TinyMCE is not displayed anyhwere and default textile options are display.  A little frustrated, any ideas?

Ben-1

Re: Finally! Replace Textile with TinyMCE

I have TinyMCE installed in Jobberbase 1.8 but do not work in the Admin.
What should I do?

I've tried installing the tinymce-texteditor and followed the exact steps in this post

Last edited by Ben-1 (2009-10-19 08:18:40)

evertsemeijn

Re: Finally! Replace Textile with TinyMCE

I'll look into it. The best conclusion for now is that it's not working for 1.8 (so please stop posting that it doesn't work)!

If you find the solution before I do please post it here smile

Member of Jobberbase Development Team - Templates/Usability

:: Looking for a jobboard installation and/or custom design? ::