]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Added XHR for form_entity_flag
authorSarven Capadisli <csarven@status.net>
Wed, 11 Nov 2009 13:43:21 +0000 (13:43 +0000)
committerSarven Capadisli <csarven@status.net>
Wed, 11 Nov 2009 13:43:21 +0000 (13:43 +0000)
plugins/UserFlag/UserFlagPlugin.php
plugins/UserFlag/flagprofile.php
plugins/UserFlag/flagprofileform.php

index fe4a74869efb4f67af521b75b32657a15fef585f..6410ee1ce68fd5e00842ccf47e8ade476a1ec315 100644 (file)
@@ -140,4 +140,12 @@ class UserFlagPlugin extends Plugin
 
         return true;
     }
+
+    function onEndShowScripts($action)
+    {
+        $action->elementStart('script', array('type' => 'text/javascript'));
+        $action->raw('/*<![CDATA[*/ SN.U.FormXHR($(".form_entity_flag")); /*]]>*/');
+        $action->elementEnd('script');
+        return true;
+    }
 }
index c72b74c6a1e516e10fad38baa8654e6ac95887f9..77c86b233bd50e800a5e44baa69ab12e9d2795fb 100644 (file)
@@ -108,7 +108,21 @@ class FlagprofileAction extends Action
         parent::handle($args);
 
         $this->flagProfile();
-        $this->returnTo();
+        
+        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');
+            $this->element('title', null, _('Flagged for review'));
+            $this->elementEnd('head');
+            $this->elementStart('body');
+            $this->element('p', 'flagged', _('Flagged'));
+            $this->elementEnd('body');
+            $this->elementEnd('html');
+        } else {
+            $this->returnTo();
+        }
     }
 
     function title() {
index 0811dbb9d0a884098878a004b43ab151fa4bb12b..a8396e2d573dc6414fd3a581e2288b16e6dd4e39 100644 (file)
@@ -94,7 +94,7 @@ class FlagProfileForm extends Form
 
     function formClass()
     {
-        return 'form_profile_flag';
+        return 'form_entity_flag';
     }
 
     /**