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

atolExt3WidgetPlugin

Forum to discuss ExtJS and other JS plugins

atolExt3WidgetPlugin

by E_lexy » Fri Oct 23, 2009 4:01 pm

First of all, guys at Atol: Great job!
I have been trying to integrate Extjs with the forms framework, but I wasn't even close to what you guys made.

I have some issues, though:

Shouldn't the PluginExt3FormDoctrine extend BaseFormDoctrine instead of sfFormDoctrine?

Like this there is no place for common doctrine form stuff

In the example it wants to do:
Code: Select all
$this->getUser()->setMessage(

This function probable send the form errors in Json the the output, but I can't find the function, and it is not a default one in SF 1.2.9

I saw that in the sample myApp.js there is:
Code: Select all
 // This command enable component to execute a function send by symfony
      // Use by error to invalidate component
      this.viewport.cascade(atolExt3WidgetPlugin.cascadeFunctionToCall)

When I change this to:
Code: Select all
this.viewport.cascade(PlugTMP.cascadeFunctionToCall);

it seems to actually call the function when you include:
/atolExtsWidgetPlugin/js/submitbutton, /atolExtsWidgetPlugin/js/plug in your view.yml.
The submitbutton is referred to in the classes.
E_lexy
Junior Member
 
Posts: 17
Joined: Mon Apr 14, 2008 6:58 pm
Location: Camarles, Spain

Re: atolExt3WidgetPlugin

by xever » Mon Oct 26, 2009 10:49 am

Hi,

The PluginExt3FormDoctrine class extends sfFormDoctrine and not BaseFormDoctrine, because we don't use form classes generated by Doctrine. That means, we haven't BaseFormDoctrine class in our project.

In future revision of the plugin, we want to add a cli task to generate *Ext3Form classes extending not PluginExt3FormDoctrine, but a new class : BaseExt3FormDoctrine.
This class will be the equivalent to BaseFormDoctrine for Ext3 forms.

I hope my answer is clear enough (sorry for my poor english).
xavier
xever
Junior Member
 
Posts: 7
Joined: Mon Jun 26, 2006 8:13 am
Location: Dijon - France

Re: atolExt3WidgetPlugin

by xever » Mon Oct 26, 2009 11:14 am

There are some mistakes in the readme example.

The setMessage function in the user class coms from another specific class.

The code on this function is simple :

Code: Select all
  public function setMessage($niveau = '', $message = '', $detail = '')
  {
    $this->setFlash('niveau', $niveau);
    $this->setFlash('message', addslashes($message));
    $this->setFlash('detail', $detail);
  }


All references to PlugTMP should be changed to atolExt3WidgetPlugin

A new version (1.0.2) of the plugin is coming soon to fix all these problems.
xavier
xever
Junior Member
 
Posts: 7
Joined: Mon Jun 26, 2006 8:13 am
Location: Dijon - France

Re: atolExt3WidgetPlugin

by E_lexy » Mon Oct 26, 2009 12:03 pm

Hi Xavier,

Thanks for the updates.

In the mean time I have changed some things in subclasses to use the forms with XHR calls.

in my action:
Code: Select all
// instantiate the form
$this->form = new ExtActionForm();
// here we start formatting for oput put as Json
sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url'));
// here comes the Ext stuff
$formPanel = new PluginExt3FormPanel(url_for('action/create'), $this->form);
//optional it works fine without-> $this->getResponse()->setHttpHeader('Content-Type','application/json; charset=utf-8');
// the plugin formats the complete json string
return $this->renderText($formPanel->__toString());


in the js:
Code: Select all
if(!win){
  var win = new Ext.Window({
    id          : 'popup',
    layout      : 'fit',
    width       : 500,
    height      : 300,
    autoScroll  : true,
    closeAction :'hide',
    plain       : true,
    items       : fs,
    modal       : true,
    addFromXHR: function(url, params) {
      Ext.Ajax.request({
        url: url,
        params: params,
        success: function(response) {
          // remove old content
          this.win.removeAll();
          // add new content from Json
          // the extra brackets are there because otherwise it wouldn't evaluate as valid Json
          this.win.add(eval("(" + response.responseText + ")"));
          // apply the content
          this.win.doLayout();
        }
      });
    }
  });



}

Ext.onReady(function(){
  win.render(Ext.getBody()); 
})

/* show window and wrap it around the url supplied
 */
function showWindow(
  submitUrl,
  updateZone)
{
  win.addFromXHR(submitUrl);
  win.show();
}


I did not see a textarea widget. Did you not make it / put it in the release for a reason? Otherwise I will construct one on the basis of TextField and contribute.

Alex
E_lexy
Junior Member
 
Posts: 17
Joined: Mon Apr 14, 2008 6:58 pm
Location: Camarles, Spain

Re: atolExt3WidgetPlugin

by xever » Mon Oct 26, 2009 12:31 pm

The textarea widget will be included in the next release.
xavier
xever
Junior Member
 
Posts: 7
Joined: Mon Jun 26, 2006 8:13 am
Location: Dijon - France

Re: atolExt3WidgetPlugin

by E_lexy » Thu Oct 29, 2009 3:28 pm

Found it! Super. Like the speed of you guys.
E_lexy
Junior Member
 
Posts: 17
Joined: Mon Apr 14, 2008 6:58 pm
Location: Camarles, Spain

Re: atolExt3WidgetPlugin

by szente » Sun May 30, 2010 10:12 am

Hello!

Do you plan to include a file upload widget in this plugin?
szente
Junior Member
 
Posts: 2
Joined: Sun May 30, 2010 10:11 am

Re: atolExt3WidgetPlugin

by nchevobbe » Mon May 31, 2010 9:25 am

Hello!

Do you plan to include a file upload widget in this plugin?


Hi,
We didn't include a file upload widget in our plugin as there is no such component in the ExtJS librairy.

However, you can create a base ExtClass with PluginExt3Base and specify whatever xtype you want.
There are in the js lib of the plugin a file named fileUploadField.js which is an Ext upload file component with a nice image preview.
As it got an xtype, mediafield, you can use it in your base PHP object as below :

Code: Select all
$imgUp= new PluginExt3Base(false,array('xtype'=>'mediafield'));
$imgUp->setAttribute('fieldLabel','File Upload');


Included as a widget of your form, it will return the path to the uploaded file.

We specified the path we wanted our files to be uploaded to extending the sfValidatedFile and specifying the generateFileName function as :

Code: Select all
public function generateFilename()
{
    return sfConfig::get('app_dir_upload', 'uploads').DIRECTORY_SEPARATOR.$this->getOriginalName();
}


Hope it'll help you
nchevobbe
Junior Member
 
Posts: 1
Joined: Mon May 31, 2010 8:51 am

Re: atolExt3WidgetPlugin

by szente » Mon May 31, 2010 10:54 am

Thank you, i will try it tonight.
szente
Junior Member
 
Posts: 2
Joined: Sun May 30, 2010 10:11 am