]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Realtime/RealtimePlugin.php
Merge branch '0.9.x-mobile' of git@gitorious.org:~csarven/statusnet/csarven-clone...
[quix0rs-gnu-social.git] / plugins / Realtime / RealtimePlugin.php
index 4fb8bf84e5e55adac63eaf352c45e40606014a18..181927968648a132f2ef9754725502f3b8d4b5af 100644 (file)
@@ -77,14 +77,12 @@ class RealtimePlugin extends Plugin
         }
 
         $base = $action->selfUrl();
-        if (mb_strstr($url, '?')) {
+        if (mb_strstr($base, '?')) {
             $url = $base . '&realtime=1';
         } else {
             $url = $base . '?realtime=1';
         }
 
-        $title = $action->title();
-
         $scripts = $this->_getScripts();
 
         foreach ($scripts as $script) {
@@ -99,21 +97,19 @@ class RealtimePlugin extends Plugin
             $user_id = 0;
         }
 
-        // FIXME: Need to check if the current URL is a poped realtime window
-        if (1==2) {
+        if ($action->boolean('realtime')) {
             $realtimeUI = ' RealtimeUpdate.initPopupWindow();';
         }
         else {
-            // FIXME: This icon URL is no good if fancy URLs are off.
-            $iconurl = $base.'plugins/Realtime/icon_external.gif';
-            $realtimeUI = ' RealtimeUpdate.addPopup("'.$url.'", "'.$title.'", "'. $iconurl .'");';
+            $iconurl = common_path('plugins/Realtime/icon_external.gif');
+            $realtimeUI = ' RealtimeUpdate.addPopup("'.$url.'", "'.$timeline.'", "'. $iconurl .'");';
         }
 
         $action->elementStart('script', array('type' => 'text/javascript'));
 
         $script = ' $(document).ready(function() { '.
-          $this->_updateInitialize($timeline, $user_id).
           $realtimeUI.
+          $this->_updateInitialize($timeline, $user_id).
           '}); ';
         $action->raw($script);
 
@@ -220,9 +216,9 @@ class RealtimePlugin extends Plugin
                                                               'class' => 'user_in')
                               : array('id' => $action->trimmed('action')));
 
-        $action->elementStart('div', array('id' => 'header'));
         // XXX hack to deal with JS that tries to get the
         // root url from page output
+
         $action->elementStart('address');
         $action->element('a', array('class' => 'url',
                                   'href' => common_local_url('public')),
@@ -232,9 +228,9 @@ class RealtimePlugin extends Plugin
         if (common_logged_in()) {
             $action->showNoticeForm();
         }
-        $action->elementEnd('div');
 
         $action->showContentBlock();
+        $action->showScripts();
         $action->elementEnd('body');
         return false; // No default processing
     }