if (isset($_POST['nodeID']) && is_int((int) $_POST['nodeID']) && isset($_POST['languageID']) && is_int((int) $_POST['languageID']) && isset($_POST['notes'])) { // TO DO encode the entity value pairs into an array to pass into the saveContent node $entityValuesArray = array(); foreach ($_POST as $name => $value) { if (substr($name, 0, 7) === "entity-") { $entityID = substr($name, 7); if (is_numeric($entityID)) { $entityValuesArray[$entityID] = $value; } // TO DO ELSE? Content could go walkies otherwise! } } // DEBUG ONLY error_log(print_r($entityValuesArray,1)); // Testing // $saveSuccess = true; $saveSuccess = $content->saveContent((int) $_POST['nodeID'], (int) $_POST['languageID'], $_POST['notes'], $entityValuesArray); if ($saveSuccess !== true) { echo json_encode(array('result' => false, 'msg' => 'Error storing content to the database')); exit; } else { echo json_encode(array('result' => $saveSuccess, 'msg' => 'Content stored')); exit; } } else { echo json_encode(array('result' => false, 'msg' => 'AJAX Validation failed')); exit; } } //////////////////////////////////////////////////// // setTemplate Set template - used for new nodes ////////////////////////////////////////////////////
if (is_numeric($sectionInstanceID)) { $sectionInstancesArray[$key]['sectionInstanceID'] = $sectionInstanceID; $sectionInstancesArray[$key]['sectionID'] = $sectionID; $sectionInstancesArray[$key]['sortOrder'] = $value['sortOrder']; // error_log("Added instance: ". $sectionInstanceID . " sectionID: " . $sectionID . " sortorder:" . $value['sortOrder']); } } } } catch (Exception $e) { error_log('Throwing exception in the save Content AJAX call ' . $e->getMessage()); echo json_encode(array('result' => $saveSuccess, 'msg' => 'Content stored')); exit; } // Testing // $saveSuccess = $content->saveContent((int)$_REQUEST['nodeID'], (int)$_REQUEST['languageID'], $_REQUEST['notes'], $entityValuesArray); $saveSuccess = $content->saveContent((int) $_POST['nodeID'], (int) $_POST['languageID'], $_POST['notes'], (int) $_POST['noCache'], $entityValuesArrayNEW, $sectionInstancesArray); // $saveSuccess = true; if ($saveSuccess !== true) { echo json_encode(array('result' => false, 'msg' => 'Error storing content to the database')); exit; } else { echo json_encode(array('result' => $saveSuccess, 'msg' => 'Content stored')); exit; } } else { echo json_encode(array('result' => false, 'msg' => 'AJAX Validation failed')); exit; } } //////////////////////////////////////////////////// // setTemplate Set template - used for new nodes
$version = isset($_GET['version']) ? $_GET['version'] : null; $content_id = isset($_GET['content_id']) ? $_GET['content_id'] : null; $parent_content_id = isset($_GET['parent_content_id']) ? $_GET['parent_content_id'] : null; $action = isset($_GET['action']) ? $_GET['action'] : ''; $method = isset($_GET['method']) ? $_GET['method'] : null; $filter = isset($_GET['filter']) ? $_GET['filter'] : null; $deleted = isset($_GET['deleted']) ? $_GET['deleted'] : ''; $message = ''; $submenu_depth = 0; $datum_obj = new datum(); $filterstr = explode(' ', TRIM(str_replace(array('!', '.', '?', ','), '', $filter))); //Inhalt Speichern if (isset($_POST['XSDFormPrinter_XML'])) { $content = new content(); $content->getContent($content_id, $sprache, $version); if ($content->saveContent($content->contentsprache_id, $_POST['XSDFormPrinter_XML'])) { $message .= '<span class="ok">Inhalt wurde erfolgreich gespeichert</span>'; } else { $message .= '<span class="error">' . $content->errormsg . '</span>'; } } if (!is_null($method)) { switch ($method) { case 'content_sperre': //Sperren und Freigeben von Content if (!isset($_GET['contentsprache_id'])) { die('Falsche Parameteruebergabe'); } if (!$rechte->isBerechtigt('basis/cms', null, 'su')) { $message .= '<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>'; break;