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
    Sorry, that’s just an automatic response to the issue rolleyes
      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
      • 7508
      • 22 Posts
      Just looking at the index.php now, it looks a lot clearer now... this might be easier than I thought

      I am a complete noob at module creation but i’m learning smiley

      Thanks for your time guys

        • 18913
        • 654 Posts
        Hi,
        I’ve been trying to turn dbEdit into something I can use to handle a database external to that used by MODx for managing a site (e.g. a product catalog). But I’m having difficulty tracking down all the modx-site-database calls.

        Has anyone successfully twisted this around to be used in such a situation and if so could I get some pointers?

        I thought I could do something somewhat elegant by creating a new DBAPI call with info specific to the database I want to access. Then, replace the $modx->db->connect calls with something like $db2->connect.

        But I don’t seem to be getting very far.

        And, yes, I have also looked at sottwell’s code. I’m having problems there too. So if anyone has advice or examples they can point me to on either one, I’d be grateful.
          • 31640
          • 100 Posts
          @TobyL
          thanks for the great module. I was planning of doing something similar, you saved me a lot off work.

          But i have some questions

          1. When i click to see the details off a table, i only see the id field and the delete buttons to delete a single record. I did’t manage to get more fields visible. I tried to use the ’use’ and ’list’ properties of the table but that didn’t changed a thing. So what do i have to do to get this running beceause this is quite important to me to use this great module.

          2. Is there any documentation available?

          3. Will there be a new release in the future?? Beceause i thing the module is great allready, but inline editing off a record and so would’t make this module even greater?
            • 30223
            • 1,010 Posts
            Quote from: visvoer at Jun 28, 2009, 05:47 AM

            @TobyL
            thanks for the great module. I was planning of doing something similar, you saved me a lot off work.

            But i have some questions

            1. When i click to see the details off a table, i only see the id field and the delete buttons to delete a single record. I did’t manage to get more fields visible. I tried to use the ’use’ and ’list’ properties of the table but that didn’t changed a thing. So what do i have to do to get this running beceause this is quite important to me to use this great module.
            The ’use’ property indicates that the field should be shown in the detail record edit window. The ’list’ property indicates that the field should be show in the browse records window. Not sure what may be going wrong if you’ve ticked the list property and you still don’t see the field in the list. Bets I can offer you is to post (or pm me) an SQL export of the table you’re trying to manage and of the {prefix}dbedit_config table so I can try to duplicate the problem.

            2. Is there any documentation available?
            No not much. I haven’t made it into an official release and have not put any effort into documentation I’m afraid. Reading through the source code is your best bet.

            3. Will there be a new release in the future?? Beceause i thing the module is great allready, but inline editing off a record and so would’t make this module even greater?
            Not very likely at the moment. I’ve shared the code as is for anyone to use and adapt it to their own needs but as I said it’s not an official resource. (i.e. you wont find it in the add-ons repository). If in the future I work on this again I will certainly share my efforts but for the moment at least there’s not much happening on that front.
              • 23192
              • 13 Posts
              This looks like a very useful module, but I’m having some problems getting it to work. I can select my table, but then it gets stuck on "Loading Configuration". I see no errors in Firefox, in IE I get the JavaScript error that was mentioned earlier in the thread.

              EDIT: The problem was the use of &$props in the foreach in json.get.config.php line 32. This doesn’t work in PHP4.
                • 10449
                • 956 Posts
                A little suggestion:
                For text-fields, it would be cool to show it in a textarea, rather than a regular text-input field, when editing. If you have tables with several lines of text, incl. linebreaks, a small text-input field is tedious for editing.
                  • 24531
                  • 213 Posts
                  i have a trouble:
                  after editing some record and pressing save it tries to set its id to 0 instead of keeping it’s real id. how could i fix this?


                  nevermind i sorted out the issue
                    • 29076
                    • 615 Posts
                    A quick, dirty hack; How to get the columns in the datagrid Sortable with http://www.frequency-decoder.com/2006/09/16/unobtrusive-table-sort-script-revisited:

                    The sorting scripts I have found use the structure
                    <table id="sortedTableID">
                        <thead>
                            <tr>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td></td>
                            </tr>
                        </tbody>
                    </table>

                    So in order to get that structure when using this dbEdit-snippet, I had to hack the file manager/includes/controls/datagrid.class.php:
                    (Sorry for not using the Code tag here, but colored text is not allowed within that tag, and I wanted to show my changes in red to make them stand out)

                    ----------------------------------------------------
                    // start grid
                    $tblStart = "<table id=’tablesorted’ $cssClass $cssStyle cellpadding=’".(isset($this->cellPadding) ? (int)$this->cellPadding :1)."’ cellspacing=’".(isset($this->cellSpacing) ? (int)$this->cellSpacing:1)."’>";
                    $tblEnd = "</tbody>\n</table>";

                    // build column header
                    $this->_colnames = explode((strstr($this->columns,"||")!==false ? "||":","),$this->columns);
                    $this->_colwidths = explode((strstr($this->colWidths,"||")!==false ? "||":","),$this->colWidths);
                    $this->_colaligns = explode((strstr($this->colAligns,"||")!==false ? "||":","),$this->colAligns);
                    $this->_colwraps = explode((strstr($this->colWraps,"||")!==false ? "||":","),$this->colWraps);
                    $this->_colcolors = explode((strstr($this->colColors,"||")!==false ? "||":","),$this->colColors);
                    $this->_coltypes = explode((strstr($this->colTypes,"||")!==false ? "||":","),$this->colTypes);
                    $this->_colcount = count($this->_colnames);
                    if(!$this->_isDataset) {
                    $this->ds = explode((strstr($this->ds,"||")!==false ? "||":","),$this->ds);
                    $this->ds = array_chunk($this->ds, $this->_colcount);
                    }
                    $tblColHdr ="<thead>\n<tr>";
                    for($c=0;$c<$this->_colcount;$c++){
                    $name=$this->_colnames[$c];
                    $width=$this->_colwidths[$c];
                    $tblColHdr.="<th class=’sortable’ $columnHeaderStyle $columnHeaderClass".($width? " width=’$width’":"").">$name</th>";
                    }
                    $tblColHdr.="</tr>\n</thead>\n<tbody>\n\n";
                    ----------------------------------------------------

                    The code it self is not changed, I have only added/changed some output tags.

                    Next, in assets/modules/dbedit/records.list.records.inc.php I added:

                    -----------------------------------------------------
                    <td ><a href="#" class="searchbutton" title="Search" onclick="filterGrid();return false;">Go</a></td>
                    <?php if(isset($dbConfig[’deletedField’]) ){ ?>
                    <td><a class="searchtoolbarbtn" href="<?php echo $dbeHomeUrl; ?>&ra=opentrash"><img src="media/style/<?php echo $manager_theme; ?>images/tree/trash.gif" width="16" height="16" align="absmiddle" /> Trash Bin</a></td>
                    <?php } ?>
                    </tr>
                    </table>

                    </td>
                    </tr>
                    </table>
                    </div>

                    <script type="text/javascript" src="media/script/mootools/sortableTable.js"></script> (This is the unobtrusive-table-sort-script from above)
                    <link href="../css/tablesort.css" rel="stylesheet" type="text/css" /> (This is just for giving my Table some style)
                    <?php echo $grid_html; ?>
                    </div>

                    -------------------------------------------------------
                      I think, thererfor I am! But what I am, and why...?
                      • 29076
                      • 615 Posts
                      When using the dbEdit as a datagrid, the data is paginated above a given number of rows in the database. Doe’s some of you know where to "turn off" that pagination?

                      The reason I ask is because the sorting script from my last post doesn’t work when the data in the datagrid, set up via the dbedit module, is paginated.
                        I think, thererfor I am! But what I am, and why...?