Example #1
0
     $area = Area::get($c, $_GET['arHandle']);
     $ap = new Permissions($area);
     if ($ap->canWrite()) {
         Loader::model('custom_style');
         $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');
Example #2
0
 public function getCustomStylePresetRuleObject()
 {
     return CustomStyleRule::getByID($this->csrID);
 }
Example #3
0
 public function getBlockCustomStyleRule()
 {
     $db = Loader::db();
     $csrID = $this->csrID;
     if ($csrID > 0) {
         Loader::model('custom_style');
         $txt = Loader::helper('text');
         $csr = CustomStyleRule::getByID($csrID);
         $arHandle = $txt->filterNonAlphaNum($this->getAreaHandle());
         if (is_object($csr)) {
             $csr->setCustomStyleNameSpace('blockStyle' . $this->getBlockID() . $arHandle);
             return $csr;
         }
     }
 }
Example #4
0
	public function getAreaCustomStyleRule($area) {
		$db = Loader::db();
		
		$csrID = $this->vObj->customAreaStyles[$area->getAreaHandle()];
		
		if ($csrID > 0) {
			$txt = Loader::helper('text');
			Loader::model('custom_style');
			$arHandle = $txt->filterNonAlphaNum($area->getAreaHandle());			
			$csr = CustomStyleRule::getByID($csrID);
			if (is_object($csr)) {
				$csr->setCustomStyleNameSpace('areaStyle' . $arHandle);
				return $csr;
			}
		}
	}
Example #5
0
$txt = Loader::helper('text');
$form = Loader::helper('form');
$fh = Loader::helper('form/color'); 
$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();
}
$txt = Loader::helper('text');
$form = Loader::helper('form');
$fh = Loader::helper('form/color');
$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;
}
?>
Example #7
0
 public function getAreaCustomStyleRule($area)
 {
     $db = Loader::db();
     $areac = $area->getAreaCollectionObject();
     if ($areac instanceof Stack) {
         // this fixes the problem of users applying design to the main area on the page, and then that trickling into any
         // stacks that have been added to other areas of the page.
         return false;
     }
     $styles = $this->vObj->getCustomAreaStyles();
     $csrID = $styles[$area->getAreaHandle()];
     if ($csrID > 0) {
         $txt = Loader::helper('text');
         Loader::model('custom_style');
         $arHandle = $txt->filterNonAlphaNum($area->getAreaHandle());
         $csr = CustomStyleRule::getByID($csrID);
         if (is_object($csr)) {
             $csr->setCustomStyleNameSpace('areaStyle' . $arHandle);
             return $csr;
         }
     }
 }
Example #8
0
$txt = Loader::helper('text');
$form = Loader::helper('form');
$fh = Loader::helper('form/color');
$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;
}
?>