This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » plugins » Javascript plugins » atolExt3WidgetPlugin
atolExt3WidgetPlugin [message #87241] Fri, 23 October 2009 16:01 Go to next message
E_lexy  is currently offline E_lexy
Messages: 16
Registered: April 2008
Location: Camarles, Spain
Junior Member
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:
$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:
 // 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:
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.

[Updated on: Fri, 23 October 2009 17:16]

Re: atolExt3WidgetPlugin [message #87387 is a reply to message #87241 ] Mon, 26 October 2009 09:49 Go to previous messageGo to next message
xever  is currently offline xever
Messages: 7
Registered: June 2006
Location: Dijon - France
Junior Member
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).

[Updated on: Mon, 26 October 2009 16:12]


xavier
Re: atolExt3WidgetPlugin [message #87388 is a reply to message #87241 ] Mon, 26 October 2009 10:14 Go to previous messageGo to next message
xever  is currently offline xever
Messages: 7
Registered: June 2006
Location: Dijon - France
Junior Member
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 :

  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.

[Updated on: Mon, 26 October 2009 16:11]


xavier
Re: atolExt3WidgetPlugin [message #87391 is a reply to message #87388 ] Mon, 26 October 2009 11:03 Go to previous messageGo to next message
E_lexy  is currently offline E_lexy
Messages: 16
Registered: April 2008
Location: Camarles, Spain
Junior Member
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:
// 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:
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

[Updated on: Mon, 26 October 2009 11:15]

Re: atolExt3WidgetPlugin [message #87393 is a reply to message #87391 ] Mon, 26 October 2009 11:31 Go to previous messageGo to next message
xever  is currently offline xever
Messages: 7
Registered: June 2006
Location: Dijon - France
Junior Member
The textarea widget will be included in the next release.

[Updated on: Mon, 26 October 2009 16:10]


xavier
Re: atolExt3WidgetPlugin [message #87573 is a reply to message #87393 ] Thu, 29 October 2009 14:28 Go to previous messageGo to next message
E_lexy  is currently offline E_lexy
Messages: 16
Registered: April 2008
Location: Camarles, Spain
Junior Member
Found it! Super. Like the speed of you guys.

[Updated on: Thu, 29 October 2009 22:14]

Re: atolExt3WidgetPlugin [message #100047 is a reply to message #87241 ] Sun, 30 May 2010 10:12 Go to previous messageGo to next message
szente  is currently offline szente
Messages: 2
Registered: May 2010
Junior Member
Hello!

Do you plan to include a file upload widget in this plugin?
Re: atolExt3WidgetPlugin [message #100083 is a reply to message #100047 ] Mon, 31 May 2010 09:25 Go to previous messageGo to next message
nchevobbe  is currently offline nchevobbe
Messages: 1
Registered: May 2010
Junior Member
Quote:

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 :

$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 :

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


Hope it'll help you
Re: atolExt3WidgetPlugin [message #100091 is a reply to message #100083 ] Mon, 31 May 2010 10:54 Go to previous message
szente  is currently offline szente
Messages: 2
Registered: May 2010
Junior Member
Thank you, i will try it tonight.
Previous Topic:using ajax in firefox & internet explorer
Next Topic:JQgrid header searchable
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software