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
    Your connector.php looks Ok but the Provisioner 3PC has an extra two lines before the call to $modx->handleRequest, these being :-
    $corePath = $modx->config['core_path'].'components/provisioner/';
    $modx->addPackage('provisioner', $corePath.'model/');


    You could try adding these for your component.
      Use MODx, or the cat gets it!
      • 24865
      • 289 Posts
      Where exactly should these be added? I’ve never seen that package before and so I haven’t installed it yet...

      /edit
      I’ve added them to my connector.php
      <?php
      
      	$basePath = dirname(dirname(dirname(dirname(__FILE__))));
      	
      	require_once $basePath . '/config.core.php';
      	require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
      	require_once MODX_CONNECTORS_PATH . 'index.php';
      	
      	$corePath = $modx->config['core_path'].'components/provisioner/';
      	$modx->addPackage('provisioner', $corePath.'model/');
      	
      	$modx->handleRequest(array(
      		'processors_path' => $modx->getOption('core_path').'components/mycmp/processors/',
      		'location' => ''
      	));


      And still nothing... Also added them to fetch.php and nothing. Am I using the call right from the Ext standpoint? I feel like it doesn’t even try to find the fetch.php file.
        @MarkGHErnst

        Developer at Adwise Internetmarketing, the Netherlands.
        • 26903
        • 1,336 Posts
        You need to use your component name, not provisioner, ie you need to use components/mycmp to add your 3PC to the model, sorry for not being clear here.
        I’ll have a look at Provisioners Ext calls.
          Use MODx, or the cat gets it!
          • 24865
          • 289 Posts
          Alright, I’ve done that and it dumps as true, so I assume all went perfectly. Now what do I do? I still get a access denied JSON response...

          /edit
          I’ve now tried about almost anything and I am getting kinda fed up here... People say it’s ’sooo easy’ but why can’t I seem to get it to work?
            @MarkGHErnst

            Developer at Adwise Internetmarketing, the Netherlands.
            • 26903
            • 1,336 Posts
            OK, Provisoner uses the modext toolset provided with revo, not Ext directly, so it uses the following :-
            MODx.Ajax.request

            rather than
            Ext.Ajax.request

            the former of course sends the siteAPI key automatically with the AJAX header info, from modx.js
            ......,headers: {
                            'Powered-By': 'MODx'
                            ,'modAuth': config.auth


            you probably need to add this to your Ext.Ajax request, setting the config.auth to the site API key.
              Use MODx, or the cat gets it!
              • 24865
              • 289 Posts
              Alright, I’m gonna try that right now. Now I need to find there MODx has stashed away its version of Ext...

              Now as you can see I’ve entered the values you told me to and the new return message is... *drums*

              {"success":false,"message":"action_err_ns","total":0,"data":[],"object":[]}


              With the following:

              Ext.Ajax.request({
              	url: '/modx/assets/components/mycmp/connector.php',
               	method: 'post',
              	success: function(response, opts) {
              		alert(response.responseText);
              	},
              	failure: function(response, opts) {
              		alert('Fail');
              	},
              	params: {
              		'action': 'fetch',
              		'ctx': 'web'
              	},
              	headers: {
              		'Powered-By': 'MODx',
              		'modAuth': 'modx4c4ea53155f7d6.89425603'
              	}
              });
                @MarkGHErnst

                Developer at Adwise Internetmarketing, the Netherlands.
                • 24865
                • 289 Posts
                It almost seems like it can´t find the action?
                  @MarkGHErnst

                  Developer at Adwise Internetmarketing, the Netherlands.
                  • 26903
                  • 1,336 Posts
                  Yes, its getting there, again from Provisioner it uses this to specify the action
                  baseParams: {
                              action: 'administration/login'
                          }


                  notice the ’baseParams’ rather than ’params’ but this may just be because how the modext tools do this.

                  OK, change your url to add this to the end ’?action=fetch’, so you have
                  'url: '/modx/assets/components/mycmp/connector.php?action=fetch' 

                  and get rid of the ’params’ section for now.

                  You get the error from this line in the connectorresponse class
                  else if (empty($options['action'])) {
                              $this->body = $this->modx->error->failure($modx->lexicon('action_err_ns'));
                  
                  when you can’t find the action.
                    Use MODx, or the cat gets it!
                    • 26903
                    • 1,336 Posts
                    Also, your context cant be ’web’ here. it has to be ’mgr’ to use the back end connectors I believe.
                      Use MODx, or the cat gets it!
                      • 24865
                      • 289 Posts
                      Alright, I’ve fixed the javascript portion, the message stays the same. To be on the safe side, I’ve created 2 extra fetch.php files in mycmp/, mycmp/processors/ and mycmp/processors/web/.
                      For some reason I can’t find the line you are refering to in your last code portion. I found it before, but now I can’t find it. I need to "know" how MODx tries to find the fetch.php file.

                      I do not understand why this needs to be so immensely complicated...
                        @MarkGHErnst

                        Developer at Adwise Internetmarketing, the Netherlands.