We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    Have you seen my articles on writing a database management module? I’ve also written an article on developing an extjs based front-end snippet to go with it; it would certainly be easy enough to modify the extjs grid to make it editable.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 10449
      • 956 Posts
      An old little "how to" forum thread of mine: http://modxcms.com/forums/index.php/topic,23176.msg142906.html#msg142906
      This explains how to include phpMyEdit in a modx module. It still works, but it’s not exactly "plug and play". However, you can e.g. customize which table fields should be editable, and use custom display field-names etc.
      YMMV...
        • 30223
        • 1,010 Posts
        Quote from: Everett at May 14, 2009, 02:33 AM

        Mmm... I see what you’re saying. How about accessing non-MODx tables in another database? That should be pretty clear. I understand the security implication of preventing access to MODx tables, but I’d rather just have access to my tables, regardless of whether or not they’re native to the MODx install. I’ll take the heat for breaking things. Maybe a better check would be to look for an array of pre-defined "known to be included in a default MODx install" table names. A black list approach...

        I spend so much time on the MySQL command line writing joins that I HATE using table prefixes, especially when it’s really clear what your objects are. It’s the department of redundancy department all over again...

        Anyhow... i’m curious to evaluate this module as I work on a CRUD module of my own. I’ve tried the phpMyEdit, and that seems viable for the backend, but probably not a good idea for web users... it doesn’t look skin-able enough. And filtering data...mmm... I should read more of their docs, it’s just a bit heavy for this time of night.

        I built the module to be used by clients who most likely don’t know about modx internals. Don’t want them to get confused and don’t want them to blow up the site by fiddling with the wrong tables. However what you do is up to you. You can lift the restriction by commenting out these lines in dbedit/index.php (starting around line 210).

        <?php
        if($mysql_version[0]>4){
            if($l) $sql .= " WHERE Tables_in_{$dbase} NOT LIKE '".$prefix."%'";
        }
        


          • 10449
          • 956 Posts
          I tried that - doesn’t work. Everything looks the same as before :|
          Even re-installed it. "refresh" doesn’t show anything.
            • 9207 ☆ A M B ☆
            • 2,475 Posts
            TobyL -- I’ll give that edit a try at some point.
            sottwell -- thanks! I hadn’t seen your articles on that.
            ganeshXL -- I just recently discovered that post of yours. Very helpful! Thanks!

            The topic of database access is huge... and even though I’ve put together a robust and extendable class for data objects and regular expressions, I keep finding other scripts that perform similar actions. I’m leaning towards more of a 2-script approach like phpMyEdit: 1 class file, and one setup file that generates a page (i.e. extends the class). phpMyEdit looks pretty good... but part of me freaks out when I don’t understand EVERYTHING in the code. I’m also not sure how to tie it into the MODx front end or use it for form processing.... whereas my code is fully intended to be used as a Snippet (or as a module). My brain is full I think...
              • 30223
              • 1,010 Posts
              Quote from: ganeshXL at May 14, 2009, 10:52 AM

              I tried that - doesn’t work. Everything looks the same as before :|
              Even re-installed it. "refresh" doesn’t show anything.

              Seems you need to change one additional line (line 216);
              if(substr($row[0],0,$l)!=$prefix) $table_names[] = $row[0];

              should become:
              $table_names[] = $row[0];
                • 7508
                • 22 Posts
                Brilliant!

                Was just about to start building one of these myself... with no experience!

                You saved me a great deal of pain!

                Thanks
                  • 7508
                  • 22 Posts
                  Quick question...

                  Which script picks up the link attributes (eg. &ra=insert)? I want to add an extra link and direct it to a custom php page I have made.

                  Any advice or help would be appreciated, thanks in advance!
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    That’s not a link attribute; a link attribute is something that goes in the <a> tag, like target="_blank". What you want is a query string name-value pair. How you do it depends on whether you have friendly URLs or not.
                    <a href="[~xx~]?ra=insert...
                    if you have friendly URLs on (your URL has mypage.html),
                    <a href="[~xx~]&ra-insert...
                    if you don’t (your URL has index.php?id=xx).
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 30223
                      • 1,010 Posts
                      @susan As we’re talking about a manager module which runs inside the manager the whole friendly urls story doesn’t apply here. For teh rest you are quite right.

                      Have a look inside the dbedit/index.php file. You should see a couple of switch statements that control which page or script is loaded The second (nested) switch block uses the $ra value. (Somewhere near line117)