/** * DOCUMENT ME * @param sfWebRequest $request */ public function executeRevert(sfWebRequest $request) { $version = false; $subaction = $request->getParameter('subaction'); $this->preview = false; if ($subaction == 'preview') { $version = $request->getParameter('version'); $this->preview = true; } elseif ($subaction == 'revert') { $version = $request->getParameter('version'); } $id = $request->getParameter('id'); $page = aPageTable::retrieveByIdWithSlotsForVersion($id, $version); $this->flunkUnless($page); $this->name = $this->getRequestParameter('name'); $name = $this->name; $options = $this->getUser()->getAttribute("area-options-{$id}-{$name}", null, 'apostrophe'); $this->flunkUnless(isset($options['edit']) && $options['edit']); if ($subaction == 'revert') { $page->newAreaVersion($this->name, 'revert'); $page = aPageTable::retrieveByIdWithSlots($id); } aTools::setCurrentPage($page); $this->cancel = $subaction == 'cancel'; $this->revert = $subaction == 'revert'; }
public static function setPageEnvironment(sfAction $action, aPage $page) { // Title is pre-escaped as valid HTML $prefix = aTools::getOptionI18n('title_prefix'); $action->getResponse()->setTitle($prefix . $page->getTitle(), false); // Necessary to allow the use of // aTools::getCurrentPage() in the layout. // In Symfony 1.1+, you can't see $action->page from // the layout. aTools::setCurrentPage($page); // Borrowed from sfSimpleCMS if (sfConfig::get('app_a_use_bundled_layout', true)) { $action->setLayout(sfContext::getInstance()->getConfiguration()->getTemplateDir('a', 'layout.php') . '/layout'); } // Loading the a helper at this point guarantees not only // helper functions but also necessary JavaScript and CSS sfContext::getInstance()->getConfiguration()->loadHelpers('a'); }
protected function editAjax($editorOpen) { // Refetch the page to reflect these changes before we // rerender the slot aTools::setCurrentPage(aPageTable::retrieveByIdWithSlots($this->page->id)); // Symfony 1.2 can return partials rather than templates... // which gets us out of the "we need a template from some other // module" bind $variant = $this->slot->getEffectiveVariant($this->options); return $this->renderPartial("a/ajaxUpdateSlot", array("name" => $this->name, "type" => $this->type, "permid" => $this->permid, "options" => $this->options, "editorOpen" => $editorOpen, "pageid" => $this->page->id, "variant" => $variant, "validationData" => $this->validationData)); }
/** * DOCUMENT ME * @return mixed */ protected function editSave() { $this->slot->save(); $this->page->newAreaVersion($this->name, $this->newSlot ? 'add' : 'update', array('permid' => $this->permid, 'slot' => $this->slot, 'top' => sfConfig::get('app_a_new_slots_top', true))); // Refetch the page to reflect these changes before we // rerender the slot aTools::setCurrentPage(aPageTable::retrieveByIdWithSlots($this->page->id)); if ($this->getRequestParameter('noajax')) { return $this->redirectToPage(); } else { return $this->editAjax(false); } }