public function submit() { if ($this->validateAction()) { $c = $this->page; $cp = $this->permissions; $u = new User(); if ($cp->canDeletePage() && $c->getCollectionID() != HOME_CID && !$c->isMasterCollection()) { $children = $c->getNumChildren(); if ($children == 0 || $u->isSuperUser()) { if ($c->isExternalLink()) { $c->delete(); } else { $pkr = new DeletePagePageWorkflowRequest(); $pkr->setRequestedPage($c); $pkr->setRequesterUserID($u->getUserID()); $u->unloadCollectionEdit($c); $response = $pkr->trigger(); $pr = new PageEditResponse(); $pr->setPage($c); $parent = Page::getByID($c->getCollectionParentID(), 'ACTIVE'); if ($response instanceof WorkflowProgressResponse) { // we only get this response if we have skipped workflows and jumped straight in to an approve() step. $pr->setMessage(t('Page deleted successfully.')); if (!$this->request->request->get('sitemap')) { $pr->setRedirectURL($parent->getCollectionLink(true)); } } else { $pr->setMessage(t('Page deletion request saved. This action will have to be approved before the page is deleted.')); } $pr->outputJSON(); } } } } }
public function unmap() { Section::unregisterPage($this->page); $r = new PageEditResponse(); $r->setPage($this->page); $r->setMessage(t('Page unmapped.')); $r->outputJSON(); }
public function submit() { if ($this->validateAction()) { $request = \Request::getInstance(); $this->page->addCollectionAliasExternal($request->request->get('name'), $request->request->get('link'), $request->request->get('openInNewWindow')); $r = new EditResponse(); $r->setPage($this->page); $r->setRedirectURL(URL::to('/dashboard/sitemap')); $r->outputJSON(); } }
public function submit() { if ($this->validateAction() && $this->canAccess()) { $a = $this->area; $oldStyle = $this->page->getAreaCustomStyle($a); if (is_object($oldStyle)) { $oldStyleSet = $oldStyle->getStyleSet(); } $nvc = $this->page->getVersionToModify(); $r = $this->request->request->all(); $set = new StyleSet(); $set->setBackgroundColor($r['backgroundColor']); $set->setBackgroundImageFileID(intval($r['backgroundImageFileID'])); $set->setBackgroundRepeat($r['backgroundRepeat']); $set->setLinkColor($r['linkColor']); $set->setTextColor($r['textColor']); $set->setBaseFontSize($r['baseFontSize']); $set->setMarginTop($r['marginTop']); $set->setMarginRight($r['marginRight']); $set->setMarginBottom($r['marginBottom']); $set->setMarginLeft($r['marginLeft']); $set->setPaddingTop($r['paddingTop']); $set->setPaddingRight($r['paddingRight']); $set->setPaddingBottom($r['paddingBottom']); $set->setPaddingLeft($r['paddingLeft']); $set->setBorderWidth($r['borderWidth']); $set->setBorderStyle($r['borderStyle']); $set->setBorderColor($r['borderColor']); $set->setBorderRadius($r['borderRadius']); $set->setAlignment($r['alignment']); $set->setRotate($r['rotate']); $set->setBoxShadowBlur($r['boxShadowBlur']); $set->setBoxShadowColor($r['boxShadowColor']); $set->setBoxShadowHorizontal($r['boxShadowHorizontal']); $set->setBoxShadowVertical($r['boxShadowVertical']); $set->setBoxShadowSpread($r['boxShadowSpread']); $set->setCustomClass($r['customClass']); $set->save(); $nvc->setCustomStyleSet($a, $set); $pr = new EditResponse(); $pr->setPage($this->page); $pr->setAdditionalDataAttribute('aID', $this->area->getAreaID()); $pr->setAdditionalDataAttribute('arHandle', $this->area->getAreaHandle()); $pr->setAdditionalDataAttribute('issID', $set->getID()); if (is_object($oldStyleSet)) { $pr->setAdditionalDataAttribute('oldIssID', $oldStyleSet->getID()); } $style = new CustomStyle($set, $this->area->getAreaHandle()); $pr->setAdditionalDataAttribute('css', $style->getCSS()); $pr->setAdditionalDataAttribute('containerClass', $style->getContainerClass()); $pr->setMessage(t('Design updated.')); $pr->outputJSON(); } }
public function submit() { if ($this->validateAction()) { $c = $this->page; $request = \Request::getInstance(); $this->page->updateCollectionAliasExternal($request->request->get('name'), $request->request->get('link'), $request->request->get('openInNewWindow')); $pr = new EditResponse(); $pr->setMessage(t('External Link updated.')); $pr->setPage($c); $pr->outputJSON(); } }
public function getJSON() { $h = \Core::make('helper/concrete/dashboard/sitemap'); if ($h->canRead()) { $c = ConcretePage::getByID(intval($_POST['cID'])); $cp = new Permissions($c); if ($cp->canViewPage()) { $r = new PageEditResponse(); $r->setPage($c); $r->outputJSON(); } } }
public function submit() { if ($this->validateAction() && $this->canAccess()) { $b = $this->getBlockToEdit(); $oldStyle = $b->getCustomStyle(); if (is_object($oldStyle)) { $oldStyleSet = $oldStyle->getStyleSet(); } $r = $this->request->request->all(); $set = StyleSet::populateFromRequest($this->request); if (is_object($set)) { $set->save(); $b->setCustomStyleSet($set); } else { if ($oldStyleSet) { $b->resetCustomStyle(); } } if (isset($r['enableBlockContainer'])) { if ($r['enableBlockContainer'] === '-1') { $b->resetBlockContainerSettings(); } if ($r['enableBlockContainer'] === '0' || $r['enableBlockContainer'] === '1') { $b->setCustomContainerSettings($r['enableBlockContainer']); } } if ($this->permissions->canEditBlockCustomTemplate()) { $data = array(); $data['bFilename'] = $r['bFilename']; $b->updateBlockInformation($data); } $pr = new EditResponse(); $pr->setPage($this->page); $pr->setAdditionalDataAttribute('aID', $this->area->getAreaID()); $pr->setAdditionalDataAttribute('arHandle', $this->area->getAreaHandle()); $pr->setAdditionalDataAttribute('originalBlockID', $this->block->getBlockID()); if (is_object($oldStyleSet)) { $pr->setAdditionalDataAttribute('oldIssID', $oldStyleSet->getID()); } if (is_object($set)) { $pr->setAdditionalDataAttribute('issID', $set->getID()); $style = new CustomStyle($set, $b, $this->page->getCollectionThemeObject()); $css = $style->getCSS(); if ($css !== '') { $pr->setAdditionalDataAttribute('css', $style->getStyleWrapper($css)); } } $pr->setAdditionalDataAttribute('bID', $b->getBlockID()); $pr->setMessage(t('Design updated.')); $pr->outputJSON(); } }
public function submit() { if ($this->validateAction()) { $c = $this->page; $pr = new EditResponse(); if ($c->isExternalLink()) { $pr->setMessage(t('External Link deleted.')); } else { $pr->setMessage(t("Alias deleted.")); } $c->removeThisAlias(); $pr->setPage($c); $pr->outputJSON(); } }
public function getJSON() { $h = \Core::make('helper/concrete/dashboard/sitemap'); if ($h->canRead()) { $c = ConcretePage::getByID(intval($_POST['cID'])); $cp = new Permissions($c); if ($cp->canViewPage()) { $r = new PageEditResponse(); $r->setPage($c); $r->outputJSON(); } else { Core::make('helper/ajax')->sendError(t('You are not allowed to access this page.')); } } else { Core::make('helper/ajax')->sendError(t('You do not have access to the sitemap.')); } }
public function submit() { if ($this->validateAction() && $this->canAccess()) { $a = \Area::get($this->page, $_GET['arHandle']); $c = $this->page; if (is_object($a)) { $b = \Block::getByID($_GET['bID'], $c, $a); $p = new \Permissions($b); if ($p->canAdminBlock() && $c->isMasterCollection()) { if (is_array($_POST['cIDs'])) { foreach ($_POST['cIDs'] as $cID) { $nc = \Page::getByID($cID); if (!$b->isAlias($nc)) { $bt = $b->getBlockTypeObject(); if ($bt->isCopiedWhenPropagated()) { $b->duplicate($nc, true); } else { $b->alias($nc); } } } } // now remove any items that WERE checked and now aren't if (is_array($_POST['checkedCIDs'])) { foreach ($_POST['checkedCIDs'] as $cID) { if (!is_array($_POST['cIDs']) || !in_array($cID, $_POST['cIDs'])) { $nc = \Page::getByID($cID, 'RECENT'); $nb = \Block::getByID($_GET['bID'], $nc, $a); if (is_object($nb) && !$nb->isError()) { $nb->deleteBlock(); } $nc->rescanDisplayOrder($_REQUEST['arHandle']); } } } $er = new EditResponse(); $er->setPage($this->page); $er->setAdditionalDataAttribute('bID', $b->getBlockID()); $er->setAdditionalDataAttribute('aID', $a->getAreaID()); $er->setAdditionalDataAttribute('arHandle', $a->getAreaHandle()); $er->setMessage(t('Defaults updated.')); $er->outputJSON(); } } } }
public function submit() { if ($this->validateAction() && $this->canAccess()) { $a = $this->area; $oldStyle = $this->page->getAreaCustomStyle($a); if (is_object($oldStyle)) { $oldStyleSet = $oldStyle->getStyleSet(); } $nvc = $this->page->getVersionToModify(); $set = StyleSet::populateFromRequest($this->request); if (is_object($set)) { $set->save(); $nvc->setCustomStyleSet($a, $set); } else if ($oldStyleSet) { $nvc->resetAreaCustomStyle($this->area); } $pr = new EditResponse(); $pr->setPage($this->page); $pr->setAdditionalDataAttribute('aID', $this->area->getAreaID()); $pr->setAdditionalDataAttribute('arHandle', $this->area->getAreaHandle()); if (is_object($oldStyleSet)) { $pr->setAdditionalDataAttribute('oldIssID', $oldStyleSet->getID()); } if (is_object($set)) { $pr->setAdditionalDataAttribute('issID', $set->getID()); $style = new CustomStyle($set, $this->area->getAreaHandle()); $css = $style->getCSS(); if ($css !== '') { $pr->setAdditionalDataAttribute('css', $style->getCSS()); } $pr->setAdditionalDataAttribute('containerClass', $style->getContainerClass()); } $pr->setMessage(t('Design updated.')); $pr->outputJSON(); } }
public function submit() { if ($this->validateAction()) { $b = $this->getBlockToEdit(); if ($this->permissions->canEditBlockName()) { $b->setName($this->request->request->get('bName')); } if ($this->permissions->canEditBlockCacheSettings()) { $b->resetCustomCacheSettings(); if ($this->request->request->get('cbOverrideBlockTypeCacheSettings')) { $b->setCustomCacheSettings($this->request->request->get('btCacheBlockOutput'), $this->request->request->get('btCacheBlockOutputOnPost'), $this->request->request->get('btCacheBlockOutputForRegisteredUsers'), $this->request->request->get('btCacheBlockOutputLifetime')); } } $pr = new EditResponse(); $pr->setPage($this->page); $pr->setAdditionalDataAttribute('aID', $this->area->getAreaID()); $pr->setAdditionalDataAttribute('arHandle', $this->area->getAreaHandle()); $pr->setAdditionalDataAttribute('bID', $b->getBlockID()); $pr->setMessage(t('Advanced block settings saved successfully.')); $pr->outputJSON(); } }
public function arrange() { $pc = new PageEditResponse(); $pc->setPage($this->page); $e = Loader::helper('validation/error'); $nvc = $this->page->getVersionToModify(); $sourceAreaID = intval($_POST['sourceArea']); $destinationAreaID = intval($_POST['area']); $affectedAreaIDs = array(); $affectedAreaIDs[] = $sourceAreaID; if ($sourceAreaID != $destinationAreaID) { $affectedAreaIDs[] = $destinationAreaID; } if (Config::get('concrete.permissions.model') == 'advanced') { // first, we check to see if we have permissions to edit the area contents for the source area. $arHandle = Area::getAreaHandleFromID($sourceAreaID); $ar = Area::getOrCreate($nvc, $arHandle); $ap = new Permissions($ar); if (!$ap->canEditAreaContents()) { $e->add(t('You may not arrange the contents of area %s.', $arHandle)); } else { // now we get further in. We check to see if we're dealing with both a source AND a destination area. // if so, we check the area permissions for the destination area. if ($sourceAreaID != $destinationAreaID) { $destAreaHandle = Area::getAreaHandleFromID($destinationAreaID); $destArea = Area::getOrCreate($nvc, $destAreaHandle); $destAP = new Permissions($destArea); if (!$destAP->canEditAreaContents()) { $e->add(t('You may not arrange the contents of area %s.', $destAreaHandle)); } else { // we're not done yet. Now we have to check to see whether this user has permission to add // a block of this type to the destination area. if ($ar->isGlobalArea()) { $stack = Stack::getByName($arHandle); $b = Block::getByID($_REQUEST['block'], $stack, STACKS_AREA_NAME); } else { $b = Block::getByID($_REQUEST['block'], $nvc, $arHandle); } $bt = $b->getBlockTypeObject(); if (!$destAP->canAddBlock($bt)) { $e->add(t('You may not add %s to area %s.', t($bt->getBlockTypeName()), $destAreaHandle)); } } } } // now, if we get down here we perform the arrangement // it will be set to true if we're in simple permissions mode, or if we've passed all the checks } $source_area = Area::get($nvc, Area::getAreaHandleFromID($sourceAreaID)); $destination_area = Area::get($this->page, Area::getAreaHandleFromID($destinationAreaID)); if ($sourceAreaID !== $destinationAreaID && ($source_area->isGlobalArea() || $destination_area->isGlobalArea())) { // If the source_area is the only global area if ($source_area->isGlobalArea() && !$destination_area->isGlobalArea()) { $cp = new Permissions($nvc); $stack = Stack::getByName($source_area->getAreaHandle()); $stackToModify = $stack->getVersionToModify(); $nvc->relateVersionEdits($stackToModify); $block = Block::getByID($_POST['block'], $stackToModify, Area::get($stackToModify, STACKS_AREA_NAME)); $block->move($nvc, Area::get($nvc, STACKS_AREA_NAME)); } if ($destination_area->isGlobalArea()) { $cp = new Permissions($nvc); $stack = Stack::getByName($destination_area->getAreaHandle()); $stackToModify = $stack->getVersionToModify(); $nvc->relateVersionEdits($stackToModify); // If the source area is global, we need to get the block from there rather than from the view controller if ($source_area->isGlobalArea()) { $sourceStackToModify = Stack::getByName($source_area->getAreaHandle())->getVersionToModify(); $nvc->relateVersionEdits($sourceStackToModify); $block = Block::getByID($_POST['block'], $sourceStackToModify, Area::get($sourceStackToModify, STACKS_AREA_NAME)); } else { $block = Block::getByID($_POST['block'], $nvc, $source_area); } $block->move($stackToModify, Area::get($stackToModify, STACKS_AREA_NAME)); } } if (!$e->has()) { $request = \Request::getInstance(); $area_id = $request->post('area', 0); $block_id = $request->post('block', 0); $block_ids = $request->post('blocks', array()); if ($destination_area->isGlobalArea()) { $stack = Stack::getByName($destination_area->getAreaHandle()); $stackToModify = $stack->getVersionToModify(); $area = Area::get($stackToModify, STACKS_AREA_NAME); $area_id = $area->getAreaID(); $nvc->relateVersionEdits($stackToModify); $stackToModify->processArrangement($area_id, $block_id, $block_ids); } else { $nvc->processArrangement($area_id, $block_id, $block_ids); } } $pc->setError($e); $pc->outputJSON(); exit; }
public function reset_site_customizations($pThemeID) { if ($this->validateAction()) { Page::resetAllCustomStyles(); $pt = PageTheme::getByID($pThemeID); $pt->resetThemeCustomStyles(); $r = new PageEditResponse(); $r->setPage($this->page); $r->setRedirectURL(URL::to($this->page)); $r->outputJSON(); } }
public function submit() { if ($this->validateAction() && $this->canAccess()) { $b = $this->getBlockToEdit(); $oldStyle = $b->getCustomStyle(); if (is_object($oldStyle)) { $oldStyleSet = $oldStyle->getStyleSet(); } $r = $this->request->request->all(); $set = new StyleSet(); $set->setBackgroundColor($r['backgroundColor']); $set->setBackgroundImageFileID(intval($r['backgroundImageFileID'])); $set->setBackgroundRepeat($r['backgroundRepeat']); $set->setLinkColor($r['linkColor']); $set->setTextColor($r['textColor']); $set->setBaseFontSize($r['baseFontSize']); $set->setMarginTop($r['marginTop']); $set->setMarginRight($r['marginRight']); $set->setMarginBottom($r['marginBottom']); $set->setMarginLeft($r['marginLeft']); $set->setPaddingTop($r['paddingTop']); $set->setPaddingRight($r['paddingRight']); $set->setPaddingBottom($r['paddingBottom']); $set->setPaddingLeft($r['paddingLeft']); $set->setBorderWidth($r['borderWidth']); $set->setBorderStyle($r['borderStyle']); $set->setBorderColor($r['borderColor']); $set->setBorderRadius($r['borderRadius']); $set->setAlignment($r['alignment']); $set->setRotate($r['rotate']); $set->setBoxShadowBlur($r['boxShadowBlur']); $set->setBoxShadowColor($r['boxShadowColor']); $set->setBoxShadowHorizontal($r['boxShadowHorizontal']); $set->setBoxShadowVertical($r['boxShadowVertical']); $set->setBoxShadowSpread($r['boxShadowSpread']); $set->setCustomClass($r['customClass']); $set->save(); $b->setCustomStyleSet($set); if ($this->permissions->canEditBlockCustomTemplate()) { $data = array(); $data['bFilename'] = $r['bFilename']; $data['bName'] = $r['bName']; $b->updateBlockInformation($data); } $pr = new EditResponse(); $pr->setPage($this->page); $pr->setAdditionalDataAttribute('aID', $this->area->getAreaID()); $pr->setAdditionalDataAttribute('arHandle', $this->area->getAreaHandle()); $pr->setAdditionalDataAttribute('originalBlockID', $this->block->getBlockID()); $pr->setAdditionalDataAttribute('issID', $set->getID()); if (is_object($oldStyleSet)) { $pr->setAdditionalDataAttribute('oldIssID', $oldStyleSet->getID()); } $style = new CustomStyle($set, $b->getBlockID(), $this->area->getAreaHandle()); $pr->setAdditionalDataAttribute('css', $style->getCSS()); $pr->setAdditionalDataAttribute('bID', $b->getBlockID()); $pr->setMessage(t('Design updated.')); $pr->outputJSON(); } }
public function setPage(Concrete\Core\Page\Page $page) { return parent::setPage($page); }