]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/action.php
Initial checkin of Poll plugin: micro-app to post mini polls/surveys from the notice...
[quix0rs-gnu-social.git] / lib / action.php
index 9a6a160e3f283c53c31c1a3b146ff55455d5dea3..28b0fdbacfb6bfcd5c2b0c2e1e87cb09bf1538d1 100644 (file)
@@ -295,7 +295,13 @@ class Action extends HTMLOutputter // lawsuit
             }
             if (Event::handle('StartShowStatusNetScripts', array($this)) &&
                 Event::handle('StartShowLaconicaScripts', array($this))) {
-                $this->script('util.min.js');
+                if (common_config('site', 'minify')) {
+                    $this->script('util.min.js');
+                } else {
+                    $this->script('util.js');
+                    $this->script('xbImportNode.js');
+                    $this->script('geometa.js');
+                }
                 $this->showScriptMessages();
                 // Frame-busting code to avoid clickjacking attacks.
                 $this->inlineScript('if (window.top !== window.self) { window.top.location.href = window.self.location.href; }');
@@ -324,6 +330,12 @@ class Action extends HTMLOutputter // lawsuit
             // TRANS: Localized tooltip for '...' expansion button on overlong remote messages.
             $messages['showmore_tooltip'] = _m('TOOLTIP', 'Show more');
 
+            // TRANS: Inline reply form submit button: submits a reply comment.
+            $messages['reply_submit'] = _m('BUTTON', 'Reply');
+
+            // TRANS: Placeholder text for inline reply form. Clicking in this box will turn it into a mini notice form.
+            $messages['reply_placeholder'] = _m('Write a reply...');
+
             $messages = array_merge($messages, $this->getScriptMessages());
 
            Event::handle('EndScriptMessages', array($this, &$messages));
@@ -464,14 +476,7 @@ class Action extends HTMLOutputter // lawsuit
 
             Event::handle('EndShowSiteNotice', array($this));
         }
-        if (common_logged_in()) {
-            if (Event::handle('StartShowNoticeForm', array($this))) {
-                $this->showNoticeForm();
-                Event::handle('EndShowNoticeForm', array($this));
-            }
-        } else {
-            $this->showAnonymousMessage();
-        }
+
         $this->elementEnd('div');
     }
 
@@ -543,8 +548,10 @@ class Action extends HTMLOutputter // lawsuit
      */
     function showPrimaryNav()
     {
+        $this->elementStart('div', array('id' => 'site_nav_global_primary'));
         $pn = new PrimaryNav($this);
         $pn->show();
+        $this->elementEnd('div');
     }
 
     /**
@@ -573,8 +580,63 @@ class Action extends HTMLOutputter // lawsuit
      */
     function showNoticeForm()
     {
-        $notice_form = new NoticeForm($this);
-        $notice_form->show();
+        $tabs = array('status' => _('Status'));
+
+        $this->elementStart('div', 'input_forms');
+
+        if (Event::handle('StartShowEntryForms', array(&$tabs))) {
+
+            $this->elementStart('ul', array('class' => 'nav',
+                                            'id' => 'input_form_nav'));
+
+            foreach ($tabs as $tag => $title) {
+
+                $attrs = array('id' => 'input_form_nav_'.$tag,
+                               'class' => 'input_form_nav_tab');
+
+                if ($tag == 'status') {
+                    $attrs['class'] = 'current';
+                }
+
+                $this->elementStart('li', $attrs);
+
+                $this->element('a',
+                               array('href' => 'javascript:SN.U.switchInputFormTab("'.$tag.'")'),
+                               $title);
+                $this->elementEnd('li');
+            }
+
+            $this->elementEnd('ul');
+
+            foreach ($tabs as $tag => $title) {
+
+                $attrs = array('class' => 'input_form',
+                               'id' => 'input_form_'.$tag);
+
+                if ($tag == 'status') {
+                    $attrs['class'] .= ' current';
+                }
+
+                $this->elementStart('div', $attrs);
+
+                $form = null;
+
+                if (Event::handle('StartMakeEntryForm', array($tag, $this, &$form))) {
+                    if ($tag == 'status') {
+                        $form = new NoticeForm($this);
+                    }
+                    Event::handle('EndMakeEntryForm', array($tag, $this, $form));
+                }
+
+                if (!empty($form)) {
+                    $form->show();
+                }
+
+                $this->elementEnd('div');
+            }
+        }
+
+        $this->elementEnd('div');
     }
 
     /**
@@ -607,6 +669,10 @@ class Action extends HTMLOutputter // lawsuit
             $this->showContentBlock();
             Event::handle('EndShowContentBlock', array($this));
         }
+        if (Event::handle('StartShowObjectNavBlock', array($this))) {
+            $this->showObjectNavBlock();
+            Event::handle('EndShowObjectNavBlock', array($this));
+        }
         if (Event::handle('StartShowAside', array($this))) {
             $this->showAside();
             Event::handle('EndShowAside', array($this));
@@ -641,6 +707,32 @@ class Action extends HTMLOutputter // lawsuit
         $nav->show();
     }
 
+    /**
+     * Show menu for an object (group, profile)
+     *
+     * @return nothing
+     */
+    function showObjectNavBlock()
+    {
+        // Need to have this ID for CSS; I'm too lazy to add it to
+        // all menus
+        $this->elementStart('div', array('id' => 'site_nav_object'));
+        $this->showObjectNav();
+        $this->elementEnd('div');
+    }
+
+    /**
+     * Show object navigation.
+     *
+     * If there are things to do with this object, show it here.
+     *
+     * @return nothing
+     */
+    function showObjectNav()
+    {
+        /* Nothing here. */
+    }
+
     /**
      * Show content block.
      *
@@ -649,6 +741,12 @@ class Action extends HTMLOutputter // lawsuit
     function showContentBlock()
     {
         $this->elementStart('div', array('id' => 'content'));
+        if (common_logged_in()) {
+            if (Event::handle('StartShowNoticeForm', array($this))) {
+                $this->showNoticeForm();
+                Event::handle('EndShowNoticeForm', array($this));
+            }
+        }
         if (Event::handle('StartShowPageTitle', array($this))) {
             $this->showPageTitle();
             Event::handle('EndShowPageTitle', array($this));