$nvc = $c->getVersionToModify(); if ($_POST['reset_css']) { $nvc->resetAreaCustomStyle($area); } else { if ($_POST['cspID'] > 0 && $_POST['cspPresetAction'] == 'update_existing_preset') { $csp = CustomStylePreset::getByID($_POST['cspID']); $csr = $csp->getCustomStylePresetRuleObject(); // we update the csr in case anything has been changed $csr->update($_POST['css_id'], $_POST['css_class_name'], $_POST['css_custom'], $_POST); $nvc->setAreaCustomStyle($area, $csr); } else { $csr = CustomStyleRule::add($_POST['css_id'], $_POST['css_class_name'], $_POST['css_custom'], $_POST); $nvc->setAreaCustomStyle($area, $csr); } if ($_POST['cspPresetAction'] == 'create_new_preset') { CustomStylePreset::add($_POST['cspName'], $csr); } } header('Location: ' . BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $_GET['cID'] . '&mode=edit' . $step); exit; } break; case 'layout': $area = Area::get($c, $_GET['arHandle']); $ap = new Permissions($area); if ($ap->canWrite()) { Loader::model('custom_style'); $nvc = $c->getVersionToModify(); //Loader::model('layout'); $originalLayoutID = intval($_REQUEST['originalLayoutID']); $layoutID = intval($_REQUEST['layoutID']);
//echo '[<a class="ccm-dialog-close">'.t('Close Window').'</a>]'; echo '</div>'; } if ($b->isAliasOfMasterCollection() && $_REQUEST['btask'] != 'view_edit_mode') { echo '<div class="ccm-notification">'; echo t('This block is an alias of Page Defaults. Editing it here will "disconnect" it so changes to Page Defaults will no longer affect this block.'); echo '</div>'; } if (is_object($b)) { switch ($_REQUEST['btask']) { case 'block_css': if ($bp->canWrite()) { $style = $b->getBlockCustomStyleRule(); $action = $b->getBlockUpdateCssAction(); if ($_REQUEST['subtask'] == 'delete_custom_style_preset') { $styleToDelete = CustomStylePreset::getByID($_REQUEST['deleteCspID']); $styleToDelete->delete(); } $refreshAction = REL_DIR_FILES_TOOLS_REQUIRED . '/edit_block_popup?btask=block_css&cID=' . $c->getCollectionID() . '&arHandle=' . $a->getAreaHandle() . '&bID=' . $b->getBlockID() . '&isGlobal=' . $_REQUEST['isGlobal'] . '&refresh=1'; $bv->renderElement('custom_style', array('b' => $b, 'rcID' => $rcID, 'c' => $c, 'a' => $a, 'style' => $style, 'action' => $action, 'refreshAction' => $refreshAction)); } break; case 'template': if ($bp->canWrite()) { $bv->renderElement('block_custom_template', array('b' => $b, 'rcID' => $rcID)); } break; case 'view': if ($bp->canRead()) { $bv->render($b, 'view', array('c' => $c, 'a' => $a)); }
</td> </tr> </table> </div> <div> <h2><?php echo t('Additional CSS')?></h2> <textarea name="css_custom" cols="50" rows="4" style="width:99%"><?=htmlentities($style->getCustomStyleRuleCSSCustom(), ENT_COMPAT, APP_CHARSET) ?></textarea> </div> </div> </div> <br/> <? if ($cspID > 0) { $cspx = CustomStylePreset::getByID($cspID); ?> <div id="cspFooterPreset" style="display: none"> <div class="ccm-note-important"> <h2><?=t('You are changing a preset')?></h2> <div><?=$form->radio('cspPresetAction', 'update_existing_preset', true)?> <?=t('Update "%s" preset everywhere it is used', $cspx->getCustomStylePresetName())?></div> <div><?=$form->radio('cspPresetAction', 'save_as_custom_style')?> <?=t('Use this style here, and leave "%s" unchanged', $cspx->getCustomStylePresetName())?></div> <div><?=$form->radio('cspPresetAction', 'create_new_preset')?> <?=t('Save this style as a new preset')?><br/><span style="margin-left: 20px"><?=$form->text('cspName', array('style' => 'width: 127px', 'disabled' => true))?></span></div> </div> </div> <? } ?> <div id="cspFooterNoPreset" ><?=$form->checkbox('cspPresetAction', 'create_new_preset')?> <label for="cspPresetAction" style="display: inline; color: #555"><?=t('Save this style as a new preset.')?></label><span style="margin-left: 10px"><?=$form->text('cspName', array('style' => 'width: 127px', 'disabled' => true))?></span></div> <br/>
public static function getByID($cspID) { $csp = new CustomStylePreset(); $csp->load($cspID); if (is_object($csp) && $csp->getCustomStylePresetID() == $cspID) { return $csp; } }
$ah = Loader::helper("concrete/asset_library"); if (isset($_REQUEST['cspID']) && $_REQUEST['cspID'] > 0) { $csp = CustomStylePreset::getByID($_REQUEST['cspID']); if (is_object($csp)) { $style = $csp->getCustomStylePresetRuleObject(); } } else { if (is_object($style)) { $selectedCsrID = $style->getCustomStyleRuleID(); } } if (!$style) { $style = new CustomStyleRule(); } $cssData = $style->getCustomStyleRuleCustomStylesArray(); $presets = CustomStylePreset::getList(); $presetsArray = array(); foreach ($presets as $csp) { $presetsArray[$csp->getCustomStylePresetID()] = $csp->getCustomStylePresetName(); } $presetsArray[0] = t('** Custom (No Preset)'); if (!isset($_REQUEST['csrID'])) { $cspID = $style->getCustomStylePresetID(); } if ($_REQUEST['subtask'] == 'delete_custom_style_preset') { $cspID = 0; } ?> <?php if (!$_REQUEST['refresh']) {