We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26903
    • 1,336 Posts
    Just a bit more on this, if I instantiate the a JSON decoder from the XPDO tree like this :-
    $jsonDecoder = new Services_JSON(SERVICES_JSON_LOOSE_TYPES);


    I do get a decoded PHP array with the handler keys empty , i.e like this ’stdClass Object ( [0] => cm-context-refresh [text] => Refresh Context [handler] => )’. If I do this with the PHP 5 inbuilt json_decode function i get nothing so it looks like the encoding of the javascript is upsetting both of these JSON decoders, however, I can use the one that works and add my own handlers to the menu, then re-encode it using the $modx->response->toJSON method(still need to try this but I think we should be OK here now).

      Use MODx, or the cat gets it!
      • 26903
      • 1,336 Posts
      OK splittingred, the stringliterals update works like a charm, if I set this in the URL :- ’stringLiterals=1’ the JSON string decodes using Services_JSON or the php json_decode, so I can use this now as $modx->fromJSON and let revo decide which function to use.
        Use MODx, or the cat gets it!
        • 26903
        • 1,336 Posts
        OK, latest update on my site from here again http://bitez.hobby-site.com/index.php?id=63&relPath=projects/revolution/components.

        This should build and install Ok now. The resource tree on the remote resource tab now has an ’import’ menu on each resource, selecting this allows the resource to be created under the ’provisioner’ context in the local installation. It is created as unpublished, and not in the menu hierarchy so it should cause no harm to your installation. From here it can be dragged and dropped onto anywhere else in your local tree and edited as normal etc. Only single resources work at the mo. you can’t import a parent and its children(yet).

        I’ll finish off the resources import by allowing parent/child imports then move on to elements, and the others I have in mind

          Use MODx, or the cat gets it!
          • 7923
          • 4,213 Posts
          Good job shamblett!


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 26903
            • 1,336 Posts
            Ok, nearly there,

            Converted the component to use Ext3 in a similar manner to how the DocManager component was done, OK this works.

            Couple of probs though :-

            1. Got one small problem creating a context on install, I’m doing this :-
            /* CONTEXT */
            $attr = array(
                XPDO_TRANSPORT_PRESERVE_KEYS => true,
                XPDO_TRANSPORT_UPDATE_OBJECT => true,
                XPDO_TRANSPORT_UNIQUE_KEY => array ('key'));
            	
            $vehicle = $builder->createVehicle($context, $attr);
            $vehicles[] = $vehicle;
            


            where $context is :-
            $context = $modx->newObject('modContext');
            $context->fromArray(array(
                			'key' => 'provisioner',
                			'description' => 'The provisioner component context'
            				), '', true);


            This works, it creates in the DB, you cannot create another one called ’provisioner’ from context management but it will not draw in the resource tree, nor will it appear in the contexts grid. If I create it manually it works Ok. My other stuff creates OK, system settings, categories etc.

            2. For some reason this component and doc manager would not live together when their templates were both called ’index.tpl’, smarty seemed to take the latest one from the cache, not the one for the component, so one would render the other wouldn’t depending on which was invoked first, renaming this one to ’pvindex.tpl’ seemed to cure this. Can we clear the directory cache/mgr/smarty on the clearance of the site cache? Mine was full of stuff.

              Use MODx, or the cat gets it!
              • 26903
              • 1,336 Posts
              Ok, found the prob with 1 above, I had a spurious row in the modx_access_context table remove this row and all is well, re-installation of the package didn’t create this row so it must have been something I did earlier.
                Use MODx, or the cat gets it!
                • 26903
                • 1,336 Posts
                OK, beta is ready for the brave, go here http://bitez.hobby-site.com/index.php?id=63&relPath=projects/revolution/components/provisioner to find a transport package, download this into your packages area and do a local install, the zipped up code, some pics and a user guide.

                Please have a quick look at the user guide, it explains what to expect on install, what you are expected to see etc.

                Works on revo 2 beta 2 so you’ll at least need this or later

                  Use MODx, or the cat gets it!
                  • 16183
                  • 1,390 Posts
                  Thx Shamblett! Will test, hopefully soon.

                  Don’t have open office but google docs to the rescue to convert the .odt user guide to .pdf/.doc .... wink

                  cheers/k
                    • 26903
                    • 1,336 Posts
                    OK MODX-982 now fixed and in the revolution branch which means file view now works, also bug fix for import files done. To be found in link above.

                    ##Edit, just realised I can now submit this as an extra modx component for revolution, done that, so you can get it from the extras section of the main MODx site also.
                      Use MODx, or the cat gets it!