public function submit($arLayoutID) { if ($this->validateAction()) { $arLayout = AreaLayout::getByID($arLayoutID); if (!is_object($arLayout)) { throw new Exception(t('Invalid layout object.')); } if ($_POST['arLayoutPresetID'] == '-1') { UserPreset::add($arLayout, $_POST['arLayoutPresetName']); } else { $existingPreset = UserPreset::getByID($_POST['arLayoutPresetID']); if (is_object($existingPreset)) { $existingPreset->updateName($_POST['arLayoutPresetName']); $existingPreset->updateAreaLayoutObject($arLayout); } } $pr = new EditResponse(); if ($existingPreset) { $pr->setMessage(t('Area layout preset updated successfully.')); } else { $pr->setMessage(t('Area layout preset saved successfully.')); } $pr->outputJSON(); } }
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 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 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 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() && $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() { $e = Core::make('error'); $pagetype = Type::getByID($this->request->request->get('ptID')); if (is_object($pagetype)) { $configuredTarget = $pagetype->getPageTypePublishTargetObject(); $cParentID = $configuredTarget->getPageTypePublishTargetConfiguredTargetParentPageID(); if (!$cParentID) { $cParentID = $this->request->request->get('cParentID'); } } $parent = Page::getByID($cParentID); if ($this->request->request->get('ptComposerPageTemplateID')) { $template = Template::getByID($this->request->request->get('ptComposerPageTemplateID')); } if (!is_object($template)) { $template = $pagetype->getPageTypeDefaultPageTemplateObject(); } if (is_object($pagetype)) { $validator = $pagetype->getPageTypeValidatorObject(); $e->add($validator->validateCreateDraftRequest($template)); $e->add($validator->validatePublishLocationRequest($parent)); if ($this->request->request('addPageComposeAction') == 'publish') { $e->add($validator->validatePublishDraftRequest()); } } $pr = new EditResponse(); $pr->setError($e); if (!$e->has()) { $d = $pagetype->createDraft($template); $d->setPageDraftTargetParentPageID($cParentID); $pagetype->savePageTypeComposerForm($d); if ($this->request->request('addPageComposeAction') == 'publish') { $pagetype->publish($d); $pr->setAdditionalDataAttribute('cParentID', $cParentID); $pr->setMessage(t('Page Added Successfully.')); } else { $pr->setRedirectURL($d->getCollectionLink(true)); } } $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 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 create_new() { $pr = new PageEditResponse(); $ms = Section::getByID($this->request->request->get('section')); // we get the related parent id if ($this->page->isPageDraft()) { $cParentID = $this->page->getPageDraftTargetParentPageID(); } else { $cParentID = $this->page->getCollectionParentID(); } $cParent = \Page::getByID($cParentID); $cParentRelatedID = $ms->getTranslatedPageID($cParent); if ($cParentRelatedID > 0) { // we copy the page underneath it and store it $ct = \PageType::getByID($this->page->getPageTypeID()); if ($this->page->isPageDraft()) { $ptp = new \Permissions($ct); if (!$ptp->canAddPageType()) { throw new \Exception(t('You do not have permission to add a page of this type.')); } } $newParent = \Page::getByID($cParentRelatedID); $cp = new \Permissions($newParent); if ($cp->canAddSubCollection($ct)) { if ($this->page->isPageDraft()) { $targetParent = \Page::getByPath(\Config::get('concrete.paths.drafts')); } else { $targetParent = $newParent; } $newPage = $this->page->duplicate($targetParent); if (is_object($newPage)) { if ($this->page->isPageDraft()) { $newPage->setPageDraftTargetParentPageID($newParent->getCollectionID()); Section::relatePage($this->page, $newPage, $ms->getLocale()); $pr->setMessage(t('New draft created.')); } else { // grab the approved version and unapprove it $v = Version::get($newPage, 'ACTIVE'); if (is_object($v)) { $v->deny(); } $pr->setMessage(t('Unapproved page created. You must publish this page before it is live.')); } $ih = Core::make('multilingual/interface/flag'); $icon = (string) $ih->getSectionFlagIcon($ms); $pr->setAdditionalDataAttribute('name', $newPage->getCollectionName()); $pr->setAdditionalDataAttribute('link', $newPage->getCollectionLink()); $pr->setAdditionalDataAttribute('icon', $icon); } } else { throw new \Exception(t('You do not have permission to add this page to this section of the tree.')); } } $pr->outputJSON(); }
public function create_new() { $pr = new PageEditResponse(); $ms = Section::getByID($this->request->request->get('section')); // we get the related parent id $cParentID = $this->page->getCollectionParentID(); $cParent = \Page::getByID($cParentID); $cParentRelatedID = $ms->getTranslatedPageID($cParent); if ($cParentRelatedID > 0) { // we copy the page underneath it and store it $newParent = \Page::getByID($cParentRelatedID); $ct = \PageType::getByID($this->page->getPageTypeID()); $cp = new \Permissions($newParent); if ($cp->canAddSubCollection($ct) && $this->page->canMoveCopyTo($newParent)) { $newPage = $this->page->duplicate($newParent); if (is_object($newPage)) { // grab the approved version and unapprove it $v = Version::get($newPage, 'ACTIVE'); if (is_object($v)) { $v->deny(); $pkr = new ApprovePageRequest(); $pkr->setRequestedPage($newPage); $u = new \User(); $pkr->setRequestedVersionID($v->getVersionID()); $pkr->setRequesterUserID($u->getUserID()); $response = $pkr->trigger(); if (!$response instanceof Response) { // we are deferred $pr->setMessage(t('<strong>Request Saved.</strong> You must complete the workflow before this change is active.')); } else { $ih = Core::make('multilingual/interface/flag'); $icon = $ih->getSectionFlagIcon($ms); $pr->setAdditionalDataAttribute('name', $newPage->getCollectionName()); $pr->setAdditionalDataAttribute('link', $newPage->getCollectionLink()); $pr->setAdditionalDataAttribute('icon', $icon); $pr->setMessage(t('Page created.')); } } } } else { throw new \Exception(t('You do not have permission to add this page to this section of the tree.')); } } $pr->outputJSON(); }
public function setMessage($message) { return parent::setMessage($message); }