]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/newgroup.php
EmailSettingsAction adapted to FormAction
[quix0rs-gnu-social.git] / actions / newgroup.php
index b20267a4968fd3c14a6f5f6df86a3beabcc5d42d..ef8346c03ef053b37868da8933d0e10db7216a14 100644 (file)
@@ -29,9 +29,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * Add a new group
@@ -46,45 +44,37 @@ if (!defined('STATUSNET')) {
  */
 class NewgroupAction extends FormAction
 {
+    protected $group;
+
+    protected $form = 'GroupEdit';
+
+    function getGroup() {
+        return $this->group;
+    }
+
     function title()
     {
         // TRANS: Title for form to create a group.
         return _('New group');
     }
 
-    /**
-     * Prepare to run
-     */
-    protected function prepare(array $args=array())
+    protected function doPreparation()
     {
-        parent::prepare($args);
-
         // $this->scoped is the current user profile
         if (!$this->scoped->hasRight(Right::CREATEGROUP)) {
             // TRANS: Client exception thrown when a user tries to create a group while banned.
             $this->clientError(_('You are not allowed to create groups on this site.'), 403);
         }
-
-        return true;
     }
 
-    public function showContent()
+    protected function getInstructions()
     {
-        $form = new GroupEditForm($this);
-        $form->show();
+        // TRANS: Form instructions for group create form.
+        return _('Use this form to create a new group.');
     }
 
-    public function showInstructions()
+    protected function doPost()
     {
-        $this->element('p', 'instructions',
-                       // TRANS: Form instructions for group create form.
-                       _('Use this form to create a new group.'));
-    }
-
-    protected function handlePost()
-    {
-        parent::handlePost();
-
         if (Event::handle('StartGroupSaveForm', array($this))) {
             $nickname = Nickname::normalize($this->trimmed('newnickname'), true);
 
@@ -127,7 +117,6 @@ class NewgroupAction extends FormAction
                                            'Too many aliases! Maximum %d allowed.',
                                            common_config('group', 'maxaliases')),
                                         common_config('group', 'maxaliases')));
-                return;
             }
 
             if ($private) {