public function show(Curry_Backend $backend, $params = null) { if ($params === null) { $params = $_GET; } try { /*if (isAjax()) $pr = Curry_URL::setPreventRedirect(true);*/ $action = isset($params['action']) ? explode(".", $params['action']) : array(); $this->dispatch($action, $backend, $params); /*if (isAjax()) Curry_URL::setPreventRedirect($pr);*/ } catch (Curry_Exception_RedirectPrevented $e) { Curry_Application::returnPartial('<script type="text/javascript">window.location.href = "' . addcslashes($e->getUrl(), '"') . '";</script>'); } }
/** * View to execute task in seperate request. */ protected function showExecTask() { // TODO: make this a POST request $task = $_GET['task']; $defaultReturnValue = unserialize($_GET['default']); $variables = unserialize($_GET['variables']); $package = Curry_PackageManager::getPackage($_GET['package'], $_GET['version']); $returnValue = $package ? Curry_PackageManager::execTask($package, $task, $defaultReturnValue, $variables) : $defaultReturnValue; Curry_Application::returnPartial(serialize($returnValue)); }
public function showTestEmail() { $form = $this->getTestEmailForm(); if (isPost() && $form->isValid($_POST)) { $values = $form->getValues(true); $ret = $this->sendTestEmail($values); Curry_Application::returnPartial('<pre>' . $ret . '</pre>'); } $this->addMainContent($form); }
/** * This is partial-html used for the popup when creating or editing a user. */ public function showUser() { if (!$this->hasPermission(self::PERMISSION_USERS)) { throw new Exception('You dont have permission to access this view.'); } $user = isset($_GET['item']) ? UserQuery::create()->findPk($_GET['item']) : null; $validRoles = $this->getValidRoles(); if ($user && !array_key_exists($user->getUserRoleId(), $validRoles)) { $this->addMessage('You dont have access to users with that role.', self::MSG_ERROR); return; } // create new if user not set if (!$user) { $user = new User(); } // Validate $form = $this->getUserForm($user); $form->fillForm($user); if (isPost() && $form->isValid($_POST)) { $this->createModelUpdateEvent(get_class($user), $user->getPrimaryKey(), $user->isNew() ? 'insert' : 'update'); $this->saveUser($user, $form); if (isAjax()) { Curry_Application::returnPartial(''); } } // Render $this->addMainContent($form); }
/** * Return partial html-content to browser and exit. Will set content-type header and return the content. * * @deprecated Use Curry_Application::returnPartial() instead. * @param mixed $content */ public function returnPartial($content) { Curry_Application::returnPartial($content); }
/** * Generate TinyMCE link list. */ public function showTinyMceList() { $pages = array(); foreach (PageQuery::create()->orderByBranch()->find() as $page) { if (self::isTemplatePage($page)) { continue; } $pages[] = array(str_repeat(Curry_Core::SELECT_TREE_PREFIX, $page->getLevel()) . $page->getName(), $page->getUrl()); } Curry_Application::returnPartial('var tinyMCELinkList = ' . json_encode($pages) . ';', "text/plain"); }
/** * Return partial html-content to browser and exit. Will set content-type header and return the content. * * @deprecated Please use Curry_Application::returnPartial() instead. * * @param string $content * @param string $contentType * @param string|null $charset */ public function returnPartial($content, $contentType = 'text/html', $charset = null) { trace_warning('DEPRECATED: ' . __CLASS__ . '::' . __METHOD__ . '(), please use Curry_Application::' . __METHOD__ . '() instead.'); Curry_Application::returnPartial($content, $contentType, $charset); }