From: Mikael Nordfeldth Date: Sun, 11 May 2014 19:06:59 +0000 (+0200) Subject: Initial version of ManagedAction X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=aa0fbf89c2546b2f14ad3a78e291eebfe5f30fe9;p=quix0rs-gnu-social.git 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. --- 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(); + } +}