$mod = CMS_modulesCatalog::getByCodename(MOD_STANDARD_CODENAME); $mod->processValidation($validation, VALIDATION_OPTION_ACCEPT); } //reload page to force update status $cms_page = CMS_tree::getPageById($cms_page->getID(), true); //reload current tab $jscontent = ' //goto previz tab Automne.tabPanels.setActiveTab(\'public\', true);'; $view->addJavascript($jscontent); break; case 'cancel_editions': // Copy clientspaces and data from public to edited tables $tpl = $cms_page->getTemplate(); CMS_moduleClientSpace_standard_catalog::moveClientSpaces($tpl->getID(), RESOURCE_DATA_LOCATION_PUBLIC, RESOURCE_DATA_LOCATION_EDITED, true); CMS_blocksCatalog::moveBlocks($cms_page, RESOURCE_DATA_LOCATION_PUBLIC, RESOURCE_DATA_LOCATION_EDITED, true); $cms_page->cancelAllEditions(); $cms_page->writeToPersistence(); $edited = true; $logAction = CMS_log::LOG_ACTION_RESOURCE_CANCEL_EDITIONS; $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE); break; case "delete": if (!$cms_page->isProtected()) { //change the page proposed location and send emails to all the validators if ($cms_page->setProposedLocation(RESOURCE_LOCATION_DELETED, $cms_user)) { $cms_page->writeToPersistence(); $edited = RESOURCE_EDITION_LOCATION; $logAction = CMS_log::LOG_ACTION_RESOURCE_DELETE; $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE); }
/** * Changes The page data (in the DB) from one location to another. * * @param CMS_page $resource The resource concerned by the data location change * @param string $locationFrom The starting location among "edited", "edition", "public", "archived", "deleted" * @param string $locationTo The ending location among "edited", "edition", "public", "archived", "deleted" * @param boolean $copyOnly If true, data is not deleted from the original location * @return void * @access private */ function _changeDataLocation($resource, $locationFrom, $locationTo, $copyOnly = false) { if (!parent::_changeDataLocation($resource, $locationFrom, $locationTo, $copyOnly)) { return false; } // Move the client spaces $tpl = $resource->getTemplate(); if ($tpl instanceof CMS_pageTemplate && $tpl->getID() > 0) { CMS_moduleClientspace_standard_catalog::moveClientSpaces($tpl->getID(), $locationFrom, $locationTo, $copyOnly); } else { CMS_grandFather::raiseError("Bad template found for page " . $resourceID); return false; } // Move the blocks CMS_blocksCatalog::moveBlocks($resource, $locationFrom, $locationTo, $copyOnly); // Move data to the new location (delete data there before) if ($locationTo != RESOURCE_DATA_LOCATION_DEVNULL) { $sql = "\n\t\t\t\tdelete from\n\t\t\t\t\tpagesBaseData_" . $locationTo . "\n\t\t\t\twhere\n\t\t\t\t\tpage_pbd='" . $resource->getID() . "';\n\t\t\t"; $q = new CMS_query($sql); //here we have a bug with insert into... so try with a replace $sql = "\n\t\t\t\treplace into\n\t\t\t\t\tpagesBaseData_" . $locationTo . "\n\t\t\t\t\tselect\n\t\t\t\t\t\t*\n\t\t\t\t\tfrom\n\t\t\t\t\t\tpagesBaseData_" . $locationFrom . "\n\t\t\t\t\twhere\n\t\t\t\t\t\tpage_pbd='" . $resource->getID() . "'\n\t\t\t"; $q = new CMS_query($sql); } if (!$copyOnly) { $sql = "\n\t\t\t\tdelete from\n\t\t\t\t\tpagesBaseData_" . $locationFrom . "\n\t\t\t\twhere\n\t\t\t\t\tpage_pbd='" . $resource->getID() . "'\n\t\t\t"; $q = new CMS_query($sql); } }