Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 30

Thread: PHP - MySQL - ExtJS - Admin

  1. #11
    Sencha User j.bruni's Avatar
    Join Date
    Jun 2009
    Location
    Uberlndia, MG, Brazil
    Posts
    106

    Default

    Quote Originally Posted by olof View Post
    Can anyone give me a hint on where I would hack this to force it to a specific table?

    Rich
    A "quick and dirty" solution is to change
    PHP Code:
    $view->set'tables'$this->db->getTables() ); 
    to
    PHP Code:
    $view->set'tables''[["table_name","table_alias"]]' ); 
    This is at PHP_MySQL_ExtJS_Admin.php file (line 69, in "Ganesha 2" release). It is inside the "getHTML" method from "PHP_MySQL_ExtJS_Admin" class.

    Let me know if this is sufficient for your current needs.

    A "security warning": note that the API will still accept commands for every table. If a hacker user sends a command trying to change another table data, it will succeed. As I said , this is merely a "quick and dirty" solution. The best way would be to add a configuration like "allowed_tables" and code the API functions to perform the appropriate checkings...

  2. #12
    Sencha User j.bruni's Avatar
    Join Date
    Jun 2009
    Location
    Uberlndia, MG, Brazil
    Posts
    106

    Lightbulb Another approach

    Quote Originally Posted by olof View Post
    Can anyone give me a hint on where I would hack this to force it to a specific table?

    Rich
    You may be also wanting to set a specific table to be automatically opened when the application runs.

    To accomplish it, go for pmea_template.js file (line 80 at "Ganesha 2" release), and add the following lines after it:

    PHP Code:
        Ext.pmea.EditorGridPanel.superclass.initComponent.applythisarguments );   // this is line 80
        
    tablesCombo.setValue'table_name' );  // add this line and the next one
        
    this.selectTabletablesCombo ); 
    You may do it with a template variable, also:

    PHP Code:
        Ext.pmea.EditorGridPanel.superclass.initComponent.applythisarguments );   // this is line 80
        
    tablesCombo.setValue'[%initial_table%]' );  // add this line and the next one
        
    this.selectTabletablesCombo ); 
    In this case, you have to define its value in the PHP code. Go for "getHTML" method in the "PHP_MySQL_ExtJS_Admin" class (PHP_MySQL_ExtJS_Admin.php file, line 59 at "Ganesha 2" release), and add the following line:

    PHP Code:
      // render view
      
    public function getHTML()
      {
        
    $view = new pmeaView$this->config['path_templates'] . $this->ds $this->config['template_html'] );
        
    $view->set'initial_table''table_name' ); // add this line 
    A step beyond is to turn this into a configuration option. In this case you would add the following line instead:

    PHP Code:
        $view->set'initial_table'$this->config['initial_table'] ); 
    To set a default value for a configuration option, go for the beginning of the same file, and add a new element to the config array:

    PHP Code:
      public $config = array(
        
    // BASIC configuration
        
    'extRoot'  => '/ext',
        
    'title'    => 'PHP MySQL ExtJS Admin',
        
    'pageSize' => 30,
        
    'host'  => 'localhost',
        
    'user'  => 'user',
        
    'pass'  => 'pass',
        
    'name'  => 'name',
        
    'debug' => false,
        
    'initial_table' => '',    // add this line to create a new configuration option default value 
    In this case, the default value should be blank.

    Finally, in your own PMEA config.php file, you would now add the new configuration "initial_table" we have just created:

    PHP Code:
    $pmea_config = array(
      
    'extRoot'  => '/ext',
      
    'host'  => 'localhost',
      
    'user'  => 'user',
      
    'pass'  => 'pass',
      
    'name'  => 'name',
      
    'initial_table'  => 'table_name'
    ); 
    Now, you just got your PMEA developer degree!

  3. #13

    Default

    Quote Originally Posted by j.bruni View Post
    This error message reveals that you are using Ext JS 3 RC1 version. You need at least Ext JS 3 RC2 to see it working. You are certainly not using Ext JS 3.0 final version.

    Please, try running it with a compatible version, and please let us know if you could run it successfully.

    Thanks!
    You are right, my apologies! Thanks a lot!

  4. #14
    Sencha User Remy's Avatar
    Join Date
    Apr 2008
    Posts
    306

    Default

    Doesn't appear to work using IE8, can't find any good debugging info I'm afraid, most probably an extra comma somewhere. Not a problem for me as I'm using FF.

  5. #15
    Sencha User j.bruni's Avatar
    Join Date
    Jun 2009
    Location
    Uberlndia, MG, Brazil
    Posts
    106

    Default

    Quote Originally Posted by Remy View Post
    Doesn't appear to work using IE8, can't find any good debugging info I'm afraid, most probably an extra comma somewhere. Not a problem for me as I'm using FF.
    Yep! It was not working in IE, indeed! I tested only first release on it, but not the second. Thanks a lot for pointing this out.

    But no extra comma anywhere!

    It was not working on IE due to this javascript code, at pmea_template.js, line 161:

    Code:
          store: column.editor.enum
    It seems so innocent, huh?! Firefox does not complain about it at all. What's the problem here? The problem is the reserved word enum. IE does not allow it there, even being a property name.

    Well... I just changed it to enums, and everything worked!

    Code:
          store: column.editor.enums
    A change must be done also in pmea_classes.php, line 383:

    PHP Code:
            $column->editor->enums $enum[1]; 
    (Just changed $column->editor->enum to $column->editor->enums)

    I am about to launch a new release, including this and other recent changes.

    Thanks.

  6. #16

    Exclamation Can't download nor preview it

    Somehow i constantly get DNS errors when trying to download form github and your site. Also the preview doesn't seem to work

  7. #17
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676

    Default

    Very cool!

    What i saw on first test, that it doesn't work with innoDB tables.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  8. #18

    Default Sorry for the last post...

    Quote Originally Posted by gvdvenis View Post
    Somehow i constantly get DNS errors when trying to download form github and your site. Also the preview doesn't seem to work
    Guess i did something wron, using ff everything seems to work ok. Maybe some trouble with a recently installed ie8 add-in or something in that order... Anyway... Very nice. This could very well grow into a very usable framework for building database driven webapps... Keep up the good work!

  9. #19
    Sencha User j.bruni's Avatar
    Join Date
    Jun 2009
    Location
    Uberlndia, MG, Brazil
    Posts
    106

    Arrow New release - "Ganesha 3"

    Thanks to all who contributed telling his/her wishes, or problems, or highly-motivating congratulations!

    I had a little time to play with "PHP MySQL ExtJS Admin" (PMEA) today...

    Thus, I am announcing a new release for PMEA, named "Ganesha 3"

    We have these few changes:
    - maxLength is set for field editors (thanks, MD)
    - "initial_table" configuration added (thanks, olof)
    - "allowed_tables" configuration added
    - "forbidden_tables" configuration added
    - fixed javascript compatibility issue with IE (see details on post #15 of this thread; thanks, Remy)

    I hope you like!

    *** Download the new version package from the first post of this thread (attached files) or from the project website (http://www.jbruni.com.br/pmea/) ***

  10. #20
    Sencha User
    Join Date
    Jul 2008
    Posts
    2

    Default

    hi, i was looking for something like this all over the internet, so this is very nice, that you have done this.

    but i have to ask: in the demo i see, that the add and remove functions are not working. are you planing to add this functionality soon?

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •