]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Merge pull request #406 from ArthurHoaro/qrcode-style
authorVirtualTam <virtualtam@flibidi.net>
Wed, 9 Dec 2015 00:00:52 +0000 (01:00 +0100)
committerVirtualTam <virtualtam@flibidi.net>
Wed, 9 Dec 2015 00:00:52 +0000 (01:00 +0100)
Fixes #403 : Remove QRCode in core CSS and fix plugin layout

application/Router.php
index.php
plugins/demo_plugin/custom_demo.css
plugins/demo_plugin/demo_plugin.php
tpl/page.footer.html
tpl/tools.html [changed mode: 0644->0755]

index 1e6a3983231f9a9eff01abb1e88b8dd63a4717b9..0c813847b282162c40e61ae6a2e16e83a34d3508 100644 (file)
@@ -13,6 +13,8 @@ class Router
 
     public static $PAGE_TAGCLOUD = 'tagcloud';
 
+    public static $PAGE_DAILY = 'daily';
+
     public static $PAGE_TOOLS = 'tools';
 
     public static $PAGE_CHANGEPASSWORD = 'changepasswd';
@@ -69,6 +71,10 @@ class Router
             return self::$PAGE_OPENSEARCH;
         }
 
+        if (startsWith($query, 'do='. self::$PAGE_DAILY)) {
+            return self::$PAGE_DAILY;
+        }
+
         // At this point, only loggedin pages.
         if (!$loggedIn) {
             return self::$PAGE_LINKLIST;
index 81ab7676fec90ee0b05ef1614dc2c41811c0d385..d0876d957721bba0225bc4a7e72cb885698f6662 100644 (file)
--- a/index.php
+++ b/index.php
@@ -995,8 +995,12 @@ function showDailyRSS() {
     exit;
 }
 
-// "Daily" page.
-function showDaily()
+/**
+ * Show the 'Daily' page.
+ *
+ * @param PageBuilder $pageBuilder Template engine wrapper.
+ */
+function showDaily($pageBuilder)
 {
     $LINKSDB = new LinkDB(
         $GLOBALS['config']['DATASTORE'],
@@ -1059,7 +1063,7 @@ function showDaily()
         array_push($columns[$index],$link); // Put entry in this column.
         $fill[$index]+=$length;
     }
-    $PAGE = new pageBuilder;
+
     $data = array(
         'linksToDisplay' => $linksToDisplay,
         'linkcount' => count($LINKSDB),
@@ -1072,10 +1076,10 @@ function showDaily()
     $pluginManager->executeHooks('render_daily', $data, array('loggedin' => isLoggedIn()));
 
     foreach ($data as $key => $value) {
-        $PAGE->assign($key, $value);
+        $pageBuilder->assign($key, $value);
     }
 
-    $PAGE->renderPage('daily');
+    $pageBuilder->renderPage('daily');
     exit;
 }
 
@@ -1209,6 +1213,11 @@ function renderPage()
         exit;
     }
 
+    // Daily page.
+    if ($targetPage == Router::$PAGE_DAILY) {
+        showDaily($PAGE);
+    }
+
     // Display openseach plugin (XML)
     if ($targetPage == Router::$PAGE_OPENSEARCH) {
         header('Content-Type: application/xml; charset=utf-8');
@@ -1948,7 +1957,6 @@ function buildLinkList($PAGE,$LINKSDB)
 
     // Fill all template fields.
     $data = array(
-        'pagetitle' => $GLOBALS['pagetitle'],
         'linkcount' => count($LINKSDB),
         'previous_page_url' => $previous_page_url,
         'next_page_url' => $next_page_url,
@@ -1962,6 +1970,10 @@ function buildLinkList($PAGE,$LINKSDB)
         'links' => $linkDisp,
         'tags' => $LINKSDB->allTags(),
     );
+    // FIXME! temporary fix - see #399.
+    if (!empty($GLOBALS['pagetitle']) && count($linkDisp) == 1) {
+        $data['pagetitle'] = $GLOBALS['pagetitle'];
+    }
 
     $pluginManager = PluginManager::getInstance();
     $pluginManager->executeHooks('render_linklist', $data, array('loggedin' => isLoggedIn()));
@@ -2456,7 +2468,6 @@ if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=g
 if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=rss')) { showRSS(); exit; }
 if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=atom')) { showATOM(); exit; }
 if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=dailyrss')) { showDailyRSS(); exit; }
-if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=daily')) { showDaily(); exit; }
 if (!isset($_SESSION['LINKS_PER_PAGE'])) $_SESSION['LINKS_PER_PAGE']=$GLOBALS['config']['LINKS_PER_PAGE'];
 renderPage();
 ?>
index ab1720b5a6a8f474c1235972c1bbd5ff86eeaecf..af5e8bf95e7f83e520d3b36df3f0d8fe3f0b3d50 100644 (file)
@@ -4,4 +4,10 @@
 
 .upper_plugin_demo {
     float: left;
+}
+
+#demo_marquee {
+       background: darkmagenta;
+       color: white;
+       font-weight: bold;
 }
\ No newline at end of file
index 84763c2b25050e05b5afa692178536fe128c3c81..f5f028e023c68a583ff12c5e7c0837006655492b 100644 (file)
@@ -40,6 +40,8 @@ function hook_demo_plugin_render_header($data)
         // Fields in toolbar
         $data['fields_toolbar'][] = 'DEMO_fields_toolbar';
     }
+    // Another button always displayed
+    $data['buttons_toolbar'][] = '<li><a href="#">DEMO</a></li>';
 
     return $data;
 }
@@ -74,6 +76,7 @@ function hook_demo_plugin_render_includes($data)
  *
  * Template placeholders:
  *   - text
+ *   - endofpage
  *   - js_files
  *
  * Data:
@@ -89,6 +92,11 @@ function hook_demo_plugin_render_footer($data)
     // footer text
     $data['text'][] = 'Shaarli is now enhanced by the awesome demo_plugin.';
 
+    // Free elements at the end of the page.
+    $data['endofpage'][] = '<marquee id="demo_marquee">' .
+            'DEMO: it\'s 1999 all over again!' .
+        '</marquee>';
+
     // List of plugin's JS files.
     // Note that you just need to specify CSS path.
     $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/demo_plugin/demo_plugin.js';
index b20aae540adab9b9c6d7ca277ac342dc06ef3524..195dada049cdbd9fb3642dba25a4cee16a888fdf 100644 (file)
@@ -4,6 +4,11 @@
         {$value}
     {/loop}
 </div>
+
+{loop="$plugins_footer.endofpage"}
+    {$value}
+{/loop}
+
 {if="$newVersion"}
 <div id="newversion">
   <span id="version_id">&#x25CF;</span> Shaarli {$newVersion} is
old mode 100644 (file)
new mode 100755 (executable)
index c9ada4a..c13f4f1
                <a href="?do=changetag"><b>Rename/delete tags</b> <span>:  Rename or delete a tag in all links</span></a><br><br>
                <a href="?do=import"><b>Import</b> <span>:  Import Netscape html bookmarks (as exported from Firefox, Chrome, Opera, delicious...)</span></a> <br><br>
                <a href="?do=export"><b>Export</b> <span>:  Export Netscape html bookmarks (which can be imported in Firefox, Chrome, Opera, delicious...)</span></a><br><br>
-               <a class="smallbutton" onclick="alert('Drag this link to your bookmarks toolbar, or right-click it and choose Bookmark This Link...');return false;" href="javascript:javascript:(function(){var%20url%20=%20location.href;var%20title%20=%20document.title%20||%20url;window.open('{$pageabsaddr}?post='%20+%20encodeURIComponent(url)+'&amp;title='%20+%20encodeURIComponent(title)+'&amp;description='%20+%20encodeURIComponent(document.getSelection())+'&amp;source=bookmarklet','_blank','menubar=no,height=390,width=600,toolbar=no,scrollbars=no,status=no,dialog=1');})();"><b>✚Shaare link</b></a> <a href="#" style="clear:none;"><span>&#x21D0; Drag this link to your bookmarks toolbar (or right-click it and choose Bookmark This Link....).<br>&nbsp;&nbsp;&nbsp;&nbsp;Then click "✚Shaare link" button in any page you want to share.</span></a><br><br>
-               <a class="smallbutton" onclick="alert('Drag this link to your bookmarks toolbar, or right-click it and choose Bookmark This Link...');return false;" href="?private=1&post="><b>✚Add Note</b></a> <a href="#" style="clear:none;"><span>&#x21D0; Drag this link to your bookmarks toolbar (or right-click it and choose Bookmark This Link....).<br>&nbsp;&nbsp;&nbsp;&nbsp;Then click "✚Add Note" button anytime to start composing a (default private)  Note (text post) to your Shaarli.</span></a><br><br>
-               <a class="smallbutton" onclick="activateFirefoxSocial(this)"><b>✚Add to Firefox social</b></a> <a href="#" style="clear:none;"><span>&#x21D0; Click on this button to add Shaarli to the "Share this page" button in Firefox.</span></a><br><br>
-        {loop="$tools_plugin"}
+               <a class="smallbutton"
+                  onclick="return alertBookmarklet();"
+                  href="javascript:(
+                       function(){
+                               var%20url%20=%20location.href;
+                               var%20title%20=%20document.title%20||%20url;
+                               window.open(
+                                       '{$pageabsaddr}?post='%20+%20encodeURIComponent(url)+
+                                       '&amp;title='%20+%20encodeURIComponent(title)+
+                                       '&amp;description='%20+%20encodeURIComponent(document.getSelection())+
+                                       '&amp;source=bookmarklet','_blank','menubar=no,height=390,width=600,toolbar=no,scrollbars=no,status=no,dialog=1'
+                               );
+                       }
+               )();">
+                       <b>✚Shaare link</b>
+               </a>
+               <a href="#" onclick="return alertBookmarklet();">
+                       <span>
+                               &#x21D0; Drag this link to your bookmarks toolbar (or right-click it and choose Bookmark This Link....).<br>
+                               &nbsp;&nbsp;&nbsp;&nbsp;Then click "✚Shaare link" button in any page you want to share.
+                       </span>
+               </a><br><br>
+               <a class="smallbutton"
+                       onclick="return alertBookmarklet();"
+                       href="?private=1&amp;post=">
+                       <b>✚Add Note</b>
+               </a>
+               <a href="#" onclick="return alertBookmarklet();">
+                       <span>
+                               &#x21D0; Drag this link to your bookmarks toolbar (or right-click it and choose Bookmark This Link....).<br>
+                               &nbsp;&nbsp;&nbsp;&nbsp;Then click "✚Add Note" button anytime to start composing a private Note (text post) to your Shaarli.
+                       </span>
+               </a><br><br>
+               <a class="smallbutton" onclick="activateFirefoxSocial(this)">
+                       <b>✚Add to Firefox social</b>
+               </a>
+               <a href="#">
+                       <span>&#x21D0; Click on this button to add Shaarli to the "Share this page" button in Firefox.</span>
+               </a><br><br>
+
+               {loop="$tools_plugin"}
             {$value}
         {/loop}
+
                <div class="clear"></div>
 
                <script>
                                var activate = new CustomEvent("ActivateSocialFeature");
                                node.dispatchEvent(activate);
                        }
+
+                       function alertBookmarklet() {
+                               alert('Drag this link to your bookmarks toolbar, or right-click it and choose Bookmark This Link...');
+                               return false;
+                       }
                </script>
        </div>
 </div>