1. #31
    Ext User
    Join Date
    May 2010
    Posts
    3
    Vote Rating
    0
    Trii is on a distinguished road

      0  

    Default


    Quote Originally Posted by Andrew Peacock View Post
    Thanks Trii... I came to the same conclusion myself shortly afterwards. I typed that discovery into a post here, but I guess I forgot to press "submit". But thanks anyway - I appreciate your help.

    Whilst you and I are here.... I don't suppose you've got any thoughts about how to use this integration in a polling process? I don't have a scooby where to start.

    (Scooby => Scooby Doo => clue)

    Regards,
    Andy
    Look into Ext.util.TaskRunner() You can use that to start a task that calls an arbitrary callback every interval. It's hard to give you a more detailed response without knowing more about what you are trying to poll and when you should start and when you should end. you can use your callback on the executeHooks to register a polling task with the task runner

  2. #32
    Sencha User
    Join Date
    Mar 2010
    Posts
    47
    Vote Rating
    0
    Andrew Peacock is on a distinguished road

      0  

    Thumbs up


    Ah! Thanks Trii. I'd kind of glossed over that, misinterpreting what it was. But yes, that looks like it'll do the trick!

    Thanks again for all your help,
    Andy

  3. #33
    Ext JS Premium Member
    Join Date
    May 2007
    Posts
    44
    Vote Rating
    0
    netsuo is on a distinguished road

      0  

    Default


    Hi all,

    I'm using this ExtDirect integration a lot and I found something that I want to change. If you setup a DirectStore with the "api" parameters (code below), "baseParams" are received server-side in one object, not multiples parameters.

    DirectStore (incomplete code):
    PHP Code:
            this.store = new Ext.data.DirectStore(
            {        
                
    pruneModifiedRecordtrue,
                
    autoLoadtrue,
                
    api
                {
                    
    read    Ext.php.get.Store,
                    
    create  Ext.php.set.StoreCreate,
                    
    update  Ext.php.set.StoreUpdate,
                    
    destroy Ext.php.del.Store
                
    },
                
    baseParams:
                {
                    
    databaseTable'jos_gtr_batiment_bat',
                    
    displayField'nom_BAT',
                    
    valueField'id_BAT',
                    
    idField'id_BAT',
                    
    returnAllFieldstrue
                
    }, 
    Doing code above, I have to setup this PHP class:
    PHP Code:
    class del 
    {    

        function 
    Store($datas)
        {        
            
    $database_table $datas->databaseTable;
            
    $idField $datas->idField
    But I want to achieve this:
    PHP Code:
    class del 
    {    

        function 
    Store($databaseTable,$displayField,$valueField,$idField$returnAllFields)
        { 
    Any advice on how to do that ?

    Thanks,

    Stephane
    Hi from Switzerland !

  4. #34
    Sencha Premium Member
    Join Date
    Feb 2009
    Posts
    316
    Vote Rating
    3
    azuroff will become famous soon enough

      0  

    Default


    Since I didn't see anything in the .zip file itself, what license is this code released under?

  5. #35
    Sencha User j.bruni's Avatar
    Join Date
    Jun 2009
    Location
    Uberlândia, MG, Brazil
    Posts
    105
    Vote Rating
    7
    j.bruni is on a distinguished road

      0  

    Default


    Quote Originally Posted by azuroff View Post
    Since I didn't see anything in the .zip file itself, what license is this code released under?
    Sorry. In my ignorance, I see the whole licensing issue as complicated, and I never spent the time reading and studying it enough to have a good comprehension of the characteristics and differences between the most known open source licenses...

    All I can tell is that what I currently think about the code license is something like:

    1. You are free to do anything you want with it.
    2. You are responsible for the consequences of the code usage (meaning: the author is not responsible if you misuse, or use it in an unsafe manner, etc.)
    3. I will be happy if you don't remove the "author" comment in the code.

    Hmmm... maybe I should add these words as a "license.txt" in the zip?

  6. #36
    Sencha User j.bruni's Avatar
    Join Date
    Jun 2009
    Location
    Uberlândia, MG, Brazil
    Posts
    105
    Vote Rating
    7
    j.bruni is on a distinguished road

      0  

    Arrow New Version Available

    New Version Available


    A new version has been released today.

    Just go to post #1 of this thread, and the new ZIP file is there.

    Five new configuration options were added, four of them of callback type: "declare_method_function", "authorization_function", "transform_result_function", and "transform_response_function"

    Now, you are able to specify an "authorization_function", where you can check the user permissions and return true or false accordingly, allowing the API call or not.

    With the "transform_result_function", you can modify the result of the API method call after its execution, but before it is sent to the client-side.

    Finally, with the "transform_response_function", you can modify the response structure. This allows to fire server-side events, and to send extra server side data together with the RPC result.

    I am too busy to write detailed instructions about the new features.

    Here is some sample code:

    PHP Code:
    // New configuration option
    ExtDirect::$id 'my_api';

    // All "function" configurations accept parameters of callback type
    ExtDirect::$transform_result_function   'transform_result';
    ExtDirect::$transform_response_function 'transform_response';
    ExtDirect::$declare_method_function     'declare_method';
    ExtDirect::$authorization_function      'authorize';

        function 
    transform_result$action$result )
        {
            if ( 
    $action->form_handler )
                
    $result = array( 'success' => $result );
            
            return 
    $result;
            
    // return modified result
        
    }
        
        function 
    transform_response$action$response )
        {
            
    $response['error_msg']   = MyFramework::$errors;
            
    $response['success_msg'] = MyFramework::$success;
            return 
    $response;
            
    // return modified response
        
    }
        
        function 
    declare_method$class$method )
        {
            
    $key $class '::' $method;
            return 
    in_array$keyMyFramework::$user->permissions );
            
    // return boolean - declare the method in the API or not
        
    }
        
        function 
    authorize$action )
        {
            return 
    declare_method$action->action$action->method );
            
    // return boolean - authorize the action call or not
        
    }

    // Types of the parameters received by the functions are:
    // $action - ExtDirectAction
    // $result - array
    // $response - array
    // $class - string
    // $method - string 
    Feedback is appreciated.

    Thanks!

  7. #37
    Ext JS Premium Member
    Join Date
    May 2008
    Posts
    372
    Vote Rating
    4
    ttbgwt is on a distinguished road

      0  

    Default


    Excellent Job! This is a great Ext.Direct implementation. Has there been any updates to this since August?

  8. #38
    Ext JS Premium Member
    Join Date
    May 2008
    Posts
    372
    Vote Rating
    4
    ttbgwt is on a distinguished road

      0  

    Default


    Do you have an example on how to configure and load a DirectStore using your implementation?

  9. #39
    Sencha User j.bruni's Avatar
    Join Date
    Jun 2009
    Location
    Uberlândia, MG, Brazil
    Posts
    105
    Vote Rating
    7
    j.bruni is on a distinguished road

      0  

    Default


    Quote Originally Posted by ttbgwt View Post
    Excellent Job! This is a great Ext.Direct implementation. Has there been any updates to this since August?
    No updates since August. This is currently the latest version. (Today is October 26, 2010.)

  10. #40
    Sencha User j.bruni's Avatar
    Join Date
    Jun 2009
    Location
    Uberlândia, MG, Brazil
    Posts
    105
    Vote Rating
    7
    j.bruni is on a distinguished road

      0  

    Default


    Quote Originally Posted by ttbgwt View Post
    Do you have an example on how to configure and load a DirectStore using your implementation?
    I have developed a PHP / MySQL application (a basic CMS) making intensive use of this implementation. In the future, when this CMS is more mature, I want to open source it too.

    Several components data are loaded using DirectStore (treepanel, treegrid, grid, list, etc.) - in the server side, the data source is MySQL (or Memcached).

    I do not have a simple/small sample to post, but if you specify more details about what do you want, I may help.