case 'update-block-link':
     //update block content
     if (class_exists($blockClass)) {
         $cms_block = new $blockClass();
         $cms_block->initializeFromBasicAttributes($blockId);
         //get old datas
         $old_data = $cms_block->getRawData($cms_page->getID(), $cs, $rowTag, RESOURCE_LOCATION_EDITION, false);
         //Link
         $link = $old_data['value'] ? new CMS_href($old_data['value']) : new CMS_href();
         $linkDialog = new CMS_dialog_href($link);
         $linkDialog->create($linktext, MOD_STANDARD_CODENAME, $cms_page->getID());
         $link = $linkDialog->getHref();
         $data['value'] = $link->getTextDefinition();
         $cms_block->writeToPersistence($cms_page->getID(), $cs, $rowTag, RESOURCE_LOCATION_EDITION, false, $data);
         //instanciate the clientspace
         $clientSpace = CMS_moduleClientSpace_standard_catalog::getByTemplateAndTagID($tpl, $cs, $visualMode == PAGE_VISUALMODE_FORM);
         //get block's row from CS
         $row = $clientSpace->getRow($rowId, $rowTag);
         if ($row) {
             //get row datas
             $datas = $row->getData($cms_language, $cms_page, $clientSpace, PAGE_VISUALMODE_FORM);
             //instanciate modules treatments for page content tags
             $modulesTreatment = new CMS_modulesTags(MODULE_TREATMENT_PAGECONTENT_TAGS, PAGE_VISUALMODE_FORM, $cms_page);
             $modulesTreatment->setTreatmentParameters(array("language" => $cms_language, 'replaceVars' => true));
             $modulesTreatment->setDefinition($datas);
             $datas = $modulesTreatment->treatContent(true);
             //set datas as returned content
             $view->setContent($datas);
             $edited = true;
         } else {
             CMS_grandFather::raiseError('Can\'t get row type ' . $rowId . ' from clientspace ' . $cs . ' of page ' . $cms_page->getID() . ' with row id ' . $rowTag);
Пример #2
0
            $validation = new CMS_resourceValidation(MOD_STANDARD_CODENAME, RESOURCE_EDITION_BASEDATA, $cms_page);
            $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);