]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/action.php
Merge branch 'mobile-style' of git://gitorious.org/laconica/meitar into review
[quix0rs-gnu-social.git] / lib / action.php
index 3e236d7146ba82675de08ba7dc007b4d8fe3e251..8ff9e646b8cb769e3c60bc4bdde2e99af07c9daa 100644 (file)
@@ -151,31 +151,45 @@ class Action extends HTMLOutputter // lawsuit
      */
     function showStylesheets()
     {
-        $this->element('link', array('rel' => 'stylesheet',
-                                     'type' => 'text/css',
-                                     'href' => theme_path('css/display.css', 'base') . '?version=' . LACONICA_VERSION,
-                                     'media' => 'screen, projection, tv'));
-        $this->element('link', array('rel' => 'stylesheet',
-                                     'type' => 'text/css',
-                                     'href' => theme_path('css/display.css', null) . '?version=' . LACONICA_VERSION,
-                                     'media' => 'screen, projection, tv'));
-        $this->comment('[if IE]><link rel="stylesheet" type="text/css" '.
-                       'href="'.theme_path('css/ie.css', 'base').'?version='.LACONICA_VERSION.'" /><![endif]');
-        foreach (array(6,7) as $ver) {
-            if (file_exists(theme_file('css/ie'.$ver.'.css', 'base'))) {
-                // Yes, IE people should be put in jail.
-                $this->comment('[if lte IE '.$ver.']><link rel="stylesheet" type="text/css" '.
-                               'href="'.theme_path('css/ie'.$ver.'.css', 'base').'?version='.LACONICA_VERSION.'" /><![endif]');
+        if (Event::handle('StartShowStyles', array($this))) {
+            if (Event::handle('StartShowLaconicaStyles', array($this))) {
+
+                $this->element('link', array('rel' => 'stylesheet',
+                                             'type' => 'text/css',
+                                             'href' => theme_path('css/display.css', 'base') . '?version=' . LACONICA_VERSION,
+                                             'media' => 'screen, projection, tv'));
+                $this->element('link', array('rel' => 'stylesheet',
+                                             'type' => 'text/css',
+                                             'href' => theme_path('css/modal.css', 'base') . '?version=' . LACONICA_VERSION,
+                                             'media' => 'screen, projection, tv'));
+                $this->element('link', array('rel' => 'stylesheet',
+                                             'type' => 'text/css',
+                                             'href' => theme_path('css/display.css', null) . '?version=' . LACONICA_VERSION,
+                                             'media' => 'screen, projection, tv'));
+                if (common_config('site', 'mobile')) {
+                    $this->element('link', array('rel' => 'stylesheet',
+                                                 'type' => 'text/css',
+                                                 'href' => theme_path('css/mobile.css', 'base') . '?version=' . LACONICA_VERSION,
+                                                 // TODO: "handheld" CSS for other mobile devices
+                                                 'media' => 'only screen and (max-device-width: 480px)')); // Mobile WebKit
+                }
+                Event::handle('EndShowLaconicaStyles', array($this));
             }
-        }
-        $this->comment('[if IE]><link rel="stylesheet" type="text/css" '.
-                       'href="'.theme_path('css/ie.css', null).'?version='.LACONICA_VERSION.'" /><![endif]');
-        if (common_config('site', 'mobile')) {
-            $this->element('link', array('rel' => 'stylesheet',
-                                         'type' => 'text/css',
-                                         'href' => theme_path('css/mobile.css', 'base') . '?version=' . LACONICA_VERSION,
-                                         // TODO: "handheld" CSS for other mobile devices
-                                         'media' => 'only screen and (max-device-width: 480px)')); // Mobile WebKit
+            if (Event::handle('StartShowUAStyles', array($this))) {
+                $this->comment('[if IE]><link rel="stylesheet" type="text/css" '.
+                               'href="'.theme_path('css/ie.css', 'base').'?version='.LACONICA_VERSION.'" /><![endif]');
+                foreach (array(6,7) as $ver) {
+                    if (file_exists(theme_file('css/ie'.$ver.'.css', 'base'))) {
+                        // Yes, IE people should be put in jail.
+                        $this->comment('[if lte IE '.$ver.']><link rel="stylesheet" type="text/css" '.
+                                       'href="'.theme_path('css/ie'.$ver.'.css', 'base').'?version='.LACONICA_VERSION.'" /><![endif]');
+                    }
+                }
+                $this->comment('[if IE]><link rel="stylesheet" type="text/css" '.
+                               'href="'.theme_path('css/ie.css', null).'?version='.LACONICA_VERSION.'" /><![endif]');
+                Event::handle('EndShowUAStyles', array($this));
+            }
+            Event::handle('EndShowStyles', array($this));
         }
     }
 
@@ -194,6 +208,13 @@ class Action extends HTMLOutputter // lawsuit
                 $this->element('script', array('type' => 'text/javascript',
                                                'src' => common_path('js/jquery.form.js')),
                                ' ');
+
+
+                $this->element('script', array('type' => 'text/javascript',
+                                               'src' => common_path('js/jquery.simplemodal-1.2.2.pack.js')),
+                               ' ');
+
+
                 Event::handle('EndShowJQueryScripts', array($this));
             }
             if (Event::handle('StartShowLaconicaScripts', array($this))) {
@@ -203,6 +224,18 @@ class Action extends HTMLOutputter // lawsuit
                 $this->element('script', array('type' => 'text/javascript',
                                                'src' => common_path('js/util.js?version='.LACONICA_VERSION)),
                                ' ');
+
+
+                $this->element('script', array('type' => 'text/javascript',
+                                               'src' => common_path('js/flowplayer-3.0.5.min.js')),
+                               ' ');
+
+                $this->element('script', array('type' => 'text/javascript',
+                                               'src' => common_path('js/video.js')),
+                               ' ');
+
+
+
                 Event::handle('EndShowLaconicaScripts', array($this));
             }
             Event::handle('EndShowScripts', array($this));
@@ -232,9 +265,19 @@ class Action extends HTMLOutputter // lawsuit
      *
      * @return nothing
      */
+
     function showFeeds()
     {
-        // does nothing by default
+        $feeds = $this->getFeeds();
+
+        if ($feeds) {
+            foreach ($feeds as $feed) {
+                $this->element('link', array('rel' => $feed->rel(),
+                                             'href' => $feed->url,
+                                             'type' => $feed->mimeType(),
+                                             'title' => $feed->title));
+            }
+        }
     }
 
     /**
@@ -272,9 +315,15 @@ class Action extends HTMLOutputter // lawsuit
     {
         $this->elementStart('body', array('id' => $this->trimmed('action')));
         $this->elementStart('div', array('id' => 'wrap'));
-        $this->showHeader();
+        if (Event::handle('StartShowHeader', array($this))) {
+            $this->showHeader();
+            Event::handle('EndShowHeader', array($this));
+        }
         $this->showCore();
-        $this->showFooter();
+        if (Event::handle('StartShowFooter', array($this))) {
+            $this->showFooter();
+            Event::handle('EndShowFooter', array($this));
+        }
         $this->elementEnd('div');
         $this->elementEnd('body');
     }
@@ -429,7 +478,10 @@ class Action extends HTMLOutputter // lawsuit
     {
         $this->elementStart('div', array('id' => 'core'));
         $this->showLocalNavBlock();
-        $this->showContentBlock();
+        if (Event::handle('StartShowContentBlock', array($this))) {
+            $this->showContentBlock();
+            Event::handle('EndShowContentBlock', array($this));
+        }
         $this->showAside();
         $this->elementEnd('div');
     }
@@ -547,15 +599,16 @@ class Action extends HTMLOutputter // lawsuit
     /**
      * Show export data feeds.
      *
-     * MAY overload if there are feeds
-     *
-     * @return nothing
+     * @return void
      */
+
     function showExportData()
     {
-        // is there structure to this?
-        // list of (visible!) feed links
-        // can we reuse list of feeds from showFeeds() ?
+        $feeds = $this->getFeeds();
+        if ($feeds) {
+            $fl = new FeedList($this);
+            $fl->show($feeds);
+        }
     }
 
     /**
@@ -931,4 +984,17 @@ class Action extends HTMLOutputter // lawsuit
             $this->elementEnd('div');
         }
     }
+
+    /**
+     * An array of feeds for this action.
+     *
+     * Returns an array of potential feeds for this action.
+     *
+     * @return array Feed object to show in head and links
+     */
+
+    function getFeeds()
+    {
+        return null;
+    }
 }