From aa0fbf89c2546b2f14ad3a78e291eebfe5f30fe9 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 11 May 2014 21:06:59 +0200 Subject: [PATCH] Initial version of ManagedAction This will simplify actions for future development and maintenance since we can automate much more (such as auto-running show[Ajax|Page]) and handle errors of various kinds. Essentially the same kind of improvements as Managed_DataObject gives us. --- lib/managedaction.php | 61 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 lib/managedaction.php diff --git a/lib/managedaction.php b/lib/managedaction.php new file mode 100644 index 0000000000..580d8c09e3 --- /dev/null +++ b/lib/managedaction.php @@ -0,0 +1,61 @@ +. + * + * @category Action + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli + * @copyright 2008 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('GNUSOCIAL')) { exit(1); } + +class ManagedAction extends Action +{ + /** + * Handler method + */ + protected function handle() + { + parent::handle(); + + if (StatusNet::isAjax()) { + $this->showAjax(); + } else { + $this->showPage(); + } + } + + public function showAjax() + { + $this->startHTML('text/xml;charset=utf-8'); + $this->elementStart('head'); + // TRANS: Title for conversation page. + $this->element('title', null, _m('TITLE','Notice')); + $this->elementEnd('head'); + $this->elementStart('body'); + $this->showContent(); + $this->elementEnd('body'); + $this->endHTML(); + } +}