]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
make new event work, sort of
authorEvan Prodromou <evan@status.net>
Wed, 9 Mar 2011 07:48:14 +0000 (02:48 -0500)
committerEvan Prodromou <evan@status.net>
Wed, 9 Mar 2011 07:48:14 +0000 (02:48 -0500)
plugins/Event/EventPlugin.php
plugins/Event/eventform.php
plugins/Event/newevent.php

index d6d7e00fc12a8de3d25740462e21ed91dbf1f242..f33de09d78c2bdb9b3f4140453d82979a5d805a5 100644 (file)
@@ -58,7 +58,7 @@ class EventPlugin extends MicroappPlugin
     {
         $schema = Schema::get();
 
-        $schema->ensureTable('event', Happening::schemaDef());
+        $schema->ensureTable('happening', Happening::schemaDef());
         $schema->ensureTable('rsvp', RSVP::schemaDef());
 
         return true;
index 8347639b5bec71668c268b8c2f006ca8b4c7641a..8d108020a611fa560b56d79a3015d484ee8d165c 100644 (file)
@@ -66,7 +66,7 @@ class EventForm extends Form
 
     function formClass()
     {
-        return 'form_settings ajax';
+        return 'form_settings ajax-notice';
     }
 
     /**
index fe23e8825df00dd18f4d8ba1d24043262925e370..365e9c14343dcab2ca65bc6f3faa047acde6f31a 100644 (file)
@@ -146,12 +146,12 @@ class NeweventAction extends Action
                 throw new ClientException(_('Event must have an end time.'));
             }
 
-            $saved = Event::saveNew($this->user->getProfile(),
-                                    $this->start_time,
-                                    $this->end_time,
-                                    $this->title,
-                                    $this->location,
-                                    $this->description);
+            $saved = Happening::saveNew($this->user->getProfile(),
+                                        $this->start_time,
+                                        $this->end_time,
+                                        $this->title,
+                                        $this->location,
+                                        $this->description);
 
         } catch (ClientException $ce) {
             $this->error = $ce->getMessage();
@@ -159,7 +159,21 @@ class NeweventAction extends Action
             return;
         }
 
-
+        if ($this->boolean('ajax')) {
+            header('Content-Type: text/xml;charset=utf-8');
+            $this->xw->startDocument('1.0', 'UTF-8');
+            $this->elementStart('html');
+            $this->elementStart('head');
+            // TRANS: Page title after sending a notice.
+            $this->element('title', null, _('Event saved'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
+            $this->showNotice($saved);
+            $this->elementEnd('body');
+            $this->elementEnd('html');
+        } else {
+            common_redirect($saved->bestUrl(), 303);
+        }
     }
 
     /**
@@ -200,4 +214,20 @@ class NeweventAction extends Action
             return false;
         }
     }
+
+
+    /**
+     * Output a notice
+     *
+     * Used to generate the notice code for Ajax results.
+     *
+     * @param Notice $notice Notice that was saved
+     *
+     * @return void
+     */
+    function showNotice($notice)
+    {
+        $nli = new NoticeListItem($notice, $this);
+        $nli->show();
+    }
 }