We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4172
    • 5,888 Posts
    You ever wanted to edit your own tables and want to use TV-inputs for your table-fields?

    Use richtext-TVs, dropdowns, image-TVs and so on or also custom-tv-input-types in your custom-table-Editor-Forms with xdbedit:

    If you want to play with it, you can download it here:
    http://github.com/Bruno17/xdbedit
    some instructions:
    http://github.com/Bruno17/xdbedit/wiki
      -------------------------------

      you can buy me a beer, if you like MIGX

      http://webcmsolutions.de/migx.html

      Thanks!
      • 33976 ☆ A M B ☆
      • 571 Posts
      Really interesting, will definitely have to check this.
      Anyway, for now i didn’t find the example folder (as stated in the wiki)
        • 4172
        • 5,888 Posts
        example-folders are
        /core/components/xdbedit/processors/mgr/angebote
        /core/components/xdbedit/processors/mgr/ausschreibung

        but there are no schema/classes included for that examples.

        you have to create your own tables/schema/classes before you can use that.
        Perhaps I should add a ready working example-schema, but you can create one realy fast and easy from existing table(s) with the included createschema - action
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 33976 ☆ A M B ☆
          • 571 Posts
          Thanks Bruno, will check those later on.
            • 22019
            • 390 Posts
            Bruno, loving the idea, and thanks a lot for sharing what you’ve made.

            However, I’m finding it really hard to follow the instructions in the wiki. It would really help if you could start off with a complete example - ie the table that you’re using for Angebrote, as it is difficult to follow the fields/tabs equivalency otherwise (particularly for non-German speakers wink ).


            I have raised a couple of starter issues in Git, and I suspect that there will be more. Not sure if this is the best way to do it, but I’m going to ask some questions relating to the wiki documentation here (installation was all fine - my problems are with the ’Creating your own table-editor with xbdedit’ section):

            3. Create config file
            ◦ Copy one of example-config-file to yours:
            ◦ myconfig.config.inc.php
            ◦ modify it to your needs. With the tabs-array you setup your tabs and fields for your Editor-Form
            ◦ Example:
            ◦ task: mytask

            I took this to mean ’make a copy of ’angebote.config.inc.php’ and save it in /core/components/xbdedit/configs/ . (Initially I had tried saving this in my new package directory created in step 2).

            ’With the tabs-array...’ is fine, but the example is really confusing, as there appear to be three inner arrays in ’angebote.config.inc.php.’ Also, at the bottom of the inc.php file is an instruction to optionally uncomment the package loading, but I can’t see a direct equivalent in the processor.

            4. copy one of example-grid in /assets/components/xdbedit/js/widgets/grids to your own grid
            ◦ name it mytask.grid.js
            ◦ and make your modifications

            Again, should I make a copy in ’/assets/components/xdbedit/js/widgets/grids’ or create a new directory for my new package? I took it to mean duplicate an existing grid, but rename it. There’s a lot of script in that grid - how much needs to be edited? Also, should the ’headers’ match the ’captions’ in the config.inc.php or is that arbitrary? Also - the two grid examples don’t match - presumably because they use different field types, but I don’t know which one to use.

            5. create a folder ’mytask’ under /core/components/xdbedit/processors/mgr
            ◦ add your processors. See example-folders.

            The two example folders have differing numbers of processors and have different bits that require editing, although it appears that the core list is ’getlist, fields, and update’. It would be helpful to know _exactly_ what needs editing in this files - getlist is completely different between the two (including confusing reference to a ModResource), and fields has a database join in one, but not in the other.

            I can’t get 6 to work following the instructions in the wiki - I get this
            {"success":false,"message":"quip.thread_err_nf","total":0,"data":[],"object":[]}
            . I suspect it’s because I’m so far off-piste in the above instructions.... grin


              Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
              • 4172
              • 5,888 Posts
              Quote from: odeclas at Nov 07, 2010, 02:50 PM

              Bruno, loving the idea, and thanks a lot for sharing what you’ve made.

              However, I’m finding it really hard to follow the instructions in the wiki. It would really help if you could start off with a complete example - ie the table that you’re using for Angebrote, as it is difficult to follow the fields/tabs equivalency otherwise (particularly for non-German speakers wink ).

              ok, I will add a simple example. What kind of example would you like to see?


              I have raised a couple of starter issues in Git, and I suspect that there will be more. Not sure if this is the best way to do it, but I’m going to ask some questions relating to the wiki documentation here (installation was all fine - my problems are with the ’Creating your own table-editor with xbdedit’ section):

              3. Create config file
              ◦ Copy one of example-config-file to yours:
              ◦ myconfig.config.inc.php
              ◦ modify it to your needs. With the tabs-array you setup your tabs and fields for your Editor-Form
              ◦ Example:
              ◦ task: mytask

              I took this to mean ’make a copy of ’angebote.config.inc.php’ and save it in /core/components/xbdedit/configs/ . (Initially I had tried saving this in my new package directory created in step 2).

              right - make a copy of ’angebote.config.inc.php’ (or the new example.config.inc.php I will add) and save it in /core/components/xbdedit/configs/


              ’With the tabs-array...’ is fine, but the example is really confusing, as there appear to be three inner arrays in ’angebote.config.inc.php.’ Also, at the bottom of the inc.php file is an instruction to optionally uncomment the package loading, but I can’t see a direct equivalent in the processor.


              outer array are the tabs you want to have on your editor-form. (see also screenshot)
              inner arrays are the fields
              field - is the fieldname of your object (feched in your fields.php)
              caption - is the later caption in your form
              inputTV - is the TV you want to use as input-type with all its options and so on. If you have no inputTV it uses textbox.

              for example in /core/components/xdbedit/processors/mgr/angebote/getlist.php
              Here I load the package and generate the classname for later usage.
              it uses the configs you did in your config-file.

              see:
              $config=$modx->xdbedit->customconfigs;
              $prefix = $config['prefix'];
              $packageName = $config['packageName'];
              $tablename = $config['tablename'];
              
              $packagepath = $modx->getOption('core_path') . 'components/'.$packageName.'/';
              $modelpath = $packagepath.'model/';
              
              $modx->addPackage($packageName,$modelpath,$prefix);
              $classname = $modx->xdbedit->getClassName($tablename);




              4. copy one of example-grid in /assets/components/xdbedit/js/widgets/grids to your own grid
              ◦ name it mytask.grid.js
              ◦ and make your modifications

              Again, should I make a copy in ’/assets/components/xdbedit/js/widgets/grids’ or create a new directory for my new package? I took it to mean duplicate an existing grid, but rename it. There’s a lot of script in that grid - how much needs to be edited? Also, should the ’headers’ match the ’captions’ in the config.inc.php or is that arbitrary? Also - the two grid examples don’t match - presumably because they use different field types, but I don’t know which one to use.
              make a copy in ’/assets/components/xdbedit/js/widgets/grids’ in the same folder and rename it.
              Of course you have to know a bit extjs to understand what goes on. It was also hard for me to understand what goes on the first time. I made a copy from quip, tried to understand what goes up and modified it to what it is now. (there are still some parts from quip I have to clean out)


              5. create a folder ’mytask’ under /core/components/xdbedit/processors/mgr
              ◦ add your processors. See example-folders.

              The two example folders have differing numbers of processors and have different bits that require editing, although it appears that the core list is ’getlist, fields, and update’. It would be helpful to know _exactly_ what needs editing in this files - getlist is completely different between the two (including confusing reference to a ModResource), and fields has a database join in one, but not in the other.

              if you know xpdo, I think its easy to see what goes. This is, why I posted it under ’in developement’ meant for coders who are looking for ways to manipulate custom-tables in revo-backend. In my one example I had a relation in my schema to modResource. If you don’t - remove the join. Again - you need to know a bit xpdo.


              I can’t get 6 to work following the instructions in the wiki - I get this
              {"success":false,"message":"quip.thread_err_nf","total":0,"data":[],"object":[]}
              . I suspect it’s because I’m so far off-piste in the above instructions.... grin

              this is error-message (not translatet in lexicon) from
              /core/components/xdbedit/processors/mgr/xdbedit/fields.php

              it could not get an object from your processor /yourfolder/fields.php
              fields.php creates the form with datas from your object. It uses the fields and tabs you have configured in your config-file.

                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 22019
                • 390 Posts
                Thanks for the detailed response. You’re right, I don’t know enough about either extJS or the modx API to understand what’s going on completely, but I think I sort of follow now I can see the screenshots. I am happy to try and follow your working example if you are happy to share (I know no German so I’m relying on translation software - it looks like you have a vacancies / job offers table (or possibly two - one for offerred, one for wanted)?

                Running through those screenshots - please correct things I’ve misunderstood:

                Table-CMP.jpg

                There is a list of offers, which you can edit, update, or delete (from the list). If you click to view/edit an offer in the list, does it open in the table above the list?
                I assume that the content field is not displayed in the list.

                I can see now that the arrays I was confused about are because you have spread the fields of the object across multiple tabs.

                Table-CMP02 and 03.jpg

                This is a ’new vacancy’ editor, which populates the list below. The list below can be sorted by year, month, and has some bulk actions - eg publish.
                I assume that the content field is not displayed in the list. I am not clear what the Test tab does.

                If you don’t want to share that particular piece of work, then something that I guess would be understandable by most people would be something simple like a telephone directory:
                Id, Name, Job Title

                if possible with backend editing and front-end publishing (ie you see the result on a published resource).

                If you want to add back some of the complexity in your original example, you could add a Region or Department dropdown, and a Published Yes/No checkbox.

                (And no, I’m not building a telephone directory grin)

                Edit: Or perhaps even more useful would be to use the Custom Table used in the RTFM entry on custom tables and 3PCs: http://rtfm.modx.com/display/revolution20/Using+Custom+Database+Tables+in+your+3rd+Party+Components




                  Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
                  • 4172
                  • 5,888 Posts
                  your telephonedir-example is on github and also bit modified wiki
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 31640
                    • 100 Posts
                    This sounds very promising...

                    Any idea when the first beta version will be released so i can test this one...
                      • 4172
                      • 5,888 Posts
                      just download it from github and install it as instructed in wiki. See first post on this thread.
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!