We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40762
    • 54 Posts
    Hello everybody, its me again. I have been trying to do this tutorial

    http://rtfm.modx.com/display/ADDON/MIGXdb.Manage+Child-Resources+in+a+grid-TV+with+help+of+MIGXdb


    Currently I am unable to create any new basic resource. The window appears for me to put the content although when I try to click 'done' it is not doing anything.

    I parsed the error with firebug and here is what I get :



    <b>Notice</b>: Undefined variable: packageName in <b>/home/schizoghost/webapps/fonderiedarling/core/components/migx/processors/mgr/childresources/update.php</b> on line <b>50</b>



    <b>Notice</b>: Undefined index: task in <b>/home/schizoghost/webapps/fonderiedarling/core/components/migx/processors/mgr/childresources/update.php</b> on line <b>63</b>

    {"success":false,"message":"","total":1,"data":[{"id":"alias","msg":"This field is required."}],"object":[]}

    if anybody could help me please it be great.
      Marc-Andre Audet
      • 4172
      • 5,888 Posts
      I've modified the childresources/update.php a bit, try this one:

      <?php
      
      /**
       * XdbEdit
       *
       * Copyright 2010 by Bruno Perner <[email protected]>
       *
       * This file is part of XdbEdit, for editing custom-tables in MODx Revolution CMP.
       *
       * XdbEdit is free software; you can redistribute it and/or modify it under the
       * terms of the GNU General Public License as published by the Free Software
       * Foundation; either version 2 of the License, or (at your option) any later
       * version.
       *
       * XdbEdit is distributed in the hope that it will be useful, but WITHOUT ANY
       * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
       * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
       *
       * You should have received a copy of the GNU General Public License along with
       * XdbEdit; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
       * Suite 330, Boston, MA 02111-1307 USA 
       *
       * @package xdbedit
       */
      /**
       * Update and Create-processor for xdbedit
       *
       * @package xdbedit
       * @subpackage processors
       */
      //if (!$modx->hasPermission('quip.thread_view')) return $modx->error->failure($modx->lexicon('access_denied'));
      
      
      if (empty($scriptProperties['object_id'])) {
          $updateerror = true;
          $errormsg = $modx->lexicon('quip.thread_err_ns');
          return;
      }
      
      $config = $modx->migx->customconfigs;
      
      $includeTVList = $modx->getOption('includeTVList', $config, '');
      $includeTVList = !empty($includeTVList) ? explode(',', $includeTVList) : array();
      $includeTVs = $modx->getOption('includeTVs', $config, false);
      $classname = 'modResource';
      
      //$saveTVs = false;
      /*
      if ($modx->lexicon) {
          $modx->lexicon->load($packageName . ':default');
      }
      */
      if (isset($scriptProperties['data'])) {
          //$scriptProperties = array_merge($scriptProperties, $modx->fromJson($scriptProperties['data']));
          $data = $modx->fromJson($scriptProperties['data']);
      }
      
      $data['id'] = $modx->getOption('object_id', $scriptProperties, null);
      
      $parent = $modx->getOption('resource_id', $scriptProperties, false);
      $checkresponse = true;
      
      $task = $modx->getOption('task', $scriptProperties, '');
      
      switch ($task) {
          case 'publish':
              $response = $modx->runProcessor('resource/publish', $data);
              break;
          case 'unpublish':
              $response = $modx->runProcessor('resource/unpublish', $data);
              break;
          case 'delete':
              $response = $modx->runProcessor('resource/delete', $data);
              break;
          case 'recall':
              $object = $modx->getObject($classname, $scriptProperties['object_id']);
              $object->set('deleted', '0');
              $object->save();
              $checkresponse = false;
              break;
      
          default:
      
              //$modx->migx->loadConfigs();
              //$tabs = $modx->migx->getTabs();
      
              $data['context_key'] = $modx->getOption('context_key', $data, $scriptProperties['wctx']);
              if ($includeTVs) {
                  $c = $modx->newQuery('modTemplateVar');
                  $collection = $modx->getCollection('modTemplateVar', $c);
                  foreach ($collection as $tv) {
                      $tvname = $tv->get('name');
                      if (isset($data[$tvname])) {
                          $data['tv' . $tv->get('id')] = $data[$tvname];
                          unset($data[$tvname]);
                      }
                  }
      
                  $data['tvs'] = 1;
              }
      
      
              if ($scriptProperties['object_id'] == 'new') {
                  //$object = $modx->newObject($classname);
                  if (!empty($parent)){
                      $data['parent'] = $parent;
                  }
                  $response = $modx->runProcessor('resource/create', $data);
              } else {
                  //$object = $modx->getObject($classname, $scriptProperties['object_id']);
                  //if (empty($object)) return $modx->error->failure($modx->lexicon('quip.thread_err_nf'));
                  $response = $modx->runProcessor('resource/update', $data);
              }
      }
      
      if ($checkresponse) {
          if ($response->isError()) {
              $updateerror = true;
              $errormsg = $response->getMessage();
          }
          $object = $response->getObject();
      }
      
      
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 40762
        • 54 Posts
        mmmmmmmmmmm.... I stilll get this

        {"success":false,"message":"","total":1,"data":[{"id":"alias","msg":"This field is required."}],"object":[]}
          Marc-Andre Audet
          • 4172
          • 5,888 Posts
          I see.

          You will need an alias-field in your form or set the modx-system-setting autoalias to true
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 40762
            • 54 Posts
            Ok!! Thanks thats helping me alot! Actually how come the alert box isnt working properly on that one?

            thats strange
              Marc-Andre Audet