This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Admin with sfWidgetFormTextareaTinyMCE and I18n

Forum to discuss ExtJS and other JS plugins

Admin with sfWidgetFormTextareaTinyMCE and I18n

by keeper » Fri Jan 16, 2009 7:09 pm

Hi everybody, I'm trying to add TinyMCE to a I18n field in admin generator with Symfony 1.2.2.
I reached the point where I can go to the admin page, see the editors (one for each language) and post the form, but somehow the content of the TinyMCE field isn't posted (and, obviously, doesn't get saved to the DB).

I'm using sfFormExtraPlugin v.1.0.7 and TinyMCE 3.2.1.1

This is the code inside my Form:
Code: Select all
     $this->setWidget('content', new sfWidgetFormTextareaTinyMCE(
        array(
           'width' => 400,
           'height' => 300,
           'theme' => 'simple',
        ),array(
           'class' => 'tinyMCE',
        )
     ));


Thanks in advance.
keeper
Junior Member
 
Posts: 9
Joined: Tue Dec 02, 2008 12:16 pm

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by keeper » Fri Jan 23, 2009 4:06 pm

I found the solution: the plugin gives to every field its own tinymce.init so every textarea gets initialized N times.
This is the error.
I changed the plugin response() method to this:
<ul type="square">
<li>"mode" is now "exact"
<li>insted of giving a "class" it generates the control id by itself
</ul>
Code here:
Code: Select all
    $js = sprintf(<<<EOF
<script type="text/javascript">
  tinyMCE.init({
    mode:                              "exact",
    theme:                             "%s",
    elements:                          "%s",
    %s
    %s
    theme_advanced_toolbar_location:   "top",
    theme_advanced_toolbar_align:      "left",
    theme_advanced_statusbar_location: "bottom",
    theme_advanced_resizing:           true
    %s
  });
</script>
EOF
    ,
      $this->getOption('theme'),
      $this->generateId($name),
      $this->getOption('width')  ? sprintf('width:                             "%spx",', $this->getOption('width')) : '',
      $this->getOption('height') ? sprintf('height:                            "%spx",', $this->getOption('height')) : '',
      $this->getOption('config') ? ", ".$this->getOption('config') : ''
    );
keeper
Junior Member
 
Posts: 9
Joined: Tue Dec 02, 2008 12:16 pm

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by aaron » Mon Feb 02, 2009 7:58 pm

Thanks dude. You rock!
aaron
Junior Member
 
Posts: 19
Joined: Fri Dec 12, 2008 7:08 pm

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by ramshot » Mon Feb 09, 2009 3:35 pm

Thank you. This saved my day. The plugin should really be updated with this. :)~ :-)~ :smile:
ramshot
Junior Member
 
Posts: 7
Joined: Fri Nov 28, 2008 11:01 am

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by Pauli2 » Sat Mar 14, 2009 1:38 pm

Wooo :shock: !!

Thank you so much !
You really saved my time !
Pauli2
Junior Member
 
Posts: 25
Joined: Wed Feb 14, 2007 9:03 pm

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by moray » Tue Mar 31, 2009 3:39 pm

Hi all,
I don't know what I am doing wrong, but this is driving me crazy...
I followed all the instructions to get the sfWidgetFormTextareaTinyMCE widget work with the admin generator but all I get is:

Fatal error: Class 'sfWidgetFormTextareaTinyMCE' not found in .../lib/form/doctrine/MemberForm.class.php on line 30

The plugin sfFormExtraPlugin is correctly installed but it seems the widget classes don't get included.
I tried to regenerate the forms and of course cleaned the cache...nothing...

any help appreciated.
thnx

C.
moray
Junior Member
 
Posts: 4
Joined: Tue Mar 31, 2009 3:13 pm

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by aaron » Wed Apr 01, 2009 6:28 pm

Sounds like symfony doesn't know where to find the plugin. I think you need to run
Code: Select all
symfony plugin:publish-assets
That should create the needed links.
aaron
Junior Member
 
Posts: 19
Joined: Fri Dec 12, 2008 7:08 pm

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by moray » Thu Apr 02, 2009 10:56 pm

infact...I forgot I had this in config/ProjectConfiguration.class.php

$this->enablePlugins(array('sfDoctrinePlugin'));
$this->disablePlugins(array('sfPropelPlugin'));

...of course I have to add the plugin manually...

C.
moray
Junior Member
 
Posts: 4
Joined: Tue Mar 31, 2009 3:13 pm

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by danieli » Wed Apr 08, 2009 2:03 pm

OMG this was driving me crazy!!! :o~ :-o~ :eek: If I knew the plugin was buggy I would have done it by hand...
Thank you very very much for sharing the solution! :)~ :-)~ :smile:
danieli
Member
 
Posts: 34
Joined: Thu Nov 08, 2007 7:59 pm
Location: Città del Capo

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by jmiridis » Tue Apr 14, 2009 8:56 pm

Hi keeper

Trying to figure out a multi-language admin generated interface I found your post above where you say:

"I reached the point where I can go to the admin page, see the editors (ONE FOR EACH LANGUAGE)..."

which lets me suppose that you have found a solution on how to generate a form with multiple input fields for the same i18n column.

If so, would you share this information? May be this topic is not the right place, so here's my email too [url=mailto:jorgo@miridis.com]jorgo@miridis.com[/url]

Jorgo
jmiridis
Junior Member
 
Posts: 20
Joined: Sun Apr 12, 2009 5:32 pm

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by leehandong » Sun Apr 19, 2009 4:04 pm

I have do it, but it not work in backend.
it only work in frontend. please tell me why ?
leehandong
Junior Member
 
Posts: 8
Joined: Wed Apr 08, 2009 11:42 am
Location: vn

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by keeper » Tue Apr 21, 2009 9:03 pm

To embed I18n forms in admin generator, just modify the model like this:
Code: Select all
class JobeetCategoryForm extends BaseJobeetCategoryForm
{
  public function configure()
  {
    unset($this['jobeet_category_affiliate_list']);
 
    $this->embedI18n(array('en', 'fr'));
    $this->widgetSchema->setLabel('en', 'English');
    $this->widgetSchema->setLabel('fr', 'French');
  }
}

For reference look here: http://www.symfony-project.org/jobeet/1_2/Propel/en/19
keeper
Junior Member
 
Posts: 9
Joined: Tue Dec 02, 2008 12:16 pm

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by jmiridis » Thu Apr 23, 2009 4:14 pm

Ups. It's all out there, right?
I hadn't worked that far into the Jobeet Tutorial.

Thank you very much for pointing me to the right spot ;)~ ;-)~ :wink:
jmiridis
Junior Member
 
Posts: 20
Joined: Sun Apr 12, 2009 5:32 pm

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by leehandong » Fri Apr 24, 2009 9:07 pm

I done it but it not run in backend, only run in frontend. why ???
please how do it ?
leehandong
Junior Member
 
Posts: 8
Joined: Wed Apr 08, 2009 11:42 am
Location: vn

Re: Admin with sfWidgetFormTextareaTinyMCE and I18n

by jmiridis » Mon Apr 27, 2009 2:29 am

I have experimented with the code from the Jobeet Tutorial and could get it to work if I generate the module with propel:generate-admin.

When using propel:init-admin the actions generated in the cache work comletely different and do not handle any embedded forms.

Do you know if it is possible at all to have I18n forms INITIATED?

Thanks
Jorgo
jmiridis
Junior Member
 
Posts: 20
Joined: Sun Apr 12, 2009 5:32 pm