add sidebar
authorChristian Weiske <cweiske@cweiske.de>
Fri, 22 Aug 2014 14:57:14 +0000 (16:57 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Fri, 22 Aug 2014 14:57:14 +0000 (16:57 +0200)
controller/guicontroller.php
templates/appnavigation.php [new file with mode: 0644]
templates/index.php

index 313bf69..06ea681 100644 (file)
@@ -59,25 +59,37 @@ class GuiController extends Controller
         $this->checkDeps();
 
         $res = new TemplateResponse('grauphel', 'index');
-        $res->setParams(
-            array(
-                //we need to remove the trailing / for tomdroid
-                'apiurl' => rtrim(
-                    $this->urlGen->getAbsoluteURL(
-                        $this->urlGen->linkToRoute('grauphel.gui.index')
-                    ),
-                    '/'
-                )
-            )
-        );
+        $res->setParams(array('apiurl' => $this->getApiUrl()));
+        $this->addNavigation($res);
         return $res;
     }
 
+    protected function addNavigation(TemplateResponse $res)
+    {
+        $nav = new \OCP\Template('grauphel', 'appnavigation', '');
+        $nav->assign('apiurl', $this->getApiUrl());
+
+        $params = $res->getParams();
+        $params['appNavigation'] = $nav;
+        $res->setParams($params);
+    }
+
     protected function checkDeps()
     {
         if (!class_exists('OAuthProvider')) {
             throw new \Exception('PHP extension "oauth" is required');
         }
     }
+
+    protected function getApiUrl()
+    {
+        //we need to remove the trailing / for tomdroid and conboy
+        return rtrim(
+            $this->urlGen->getAbsoluteURL(
+                $this->urlGen->linkToRoute('grauphel.gui.index')
+            ),
+            '/'
+        );
+    }
 }
 ?>
diff --git a/templates/appnavigation.php b/templates/appnavigation.php
new file mode 100644 (file)
index 0000000..19854f1
--- /dev/null
@@ -0,0 +1,18 @@
+<div id="app-navigation">
+  <ul>
+    <?php foreach ($_['navigationItems'] as $item) { ?>
+      <li data-id="<?php p($item['id']) ?>" class="nav-<?php p($item['id']) ?>"><a href="<?php p(isset($item['href']) ? $item['href'] : '#') ?>"><?php p($item['name']);?></a></li>
+    <?php } ?>
+  </ul>
+
+  <div id="app-settings">
+    <div id="app-settings-header">
+      <button class="settings-button" data-apps-slide-toggle="#app-settings-content"></button>
+    </div>
+    <div id="app-settings-content" style="display: none;">
+      <h2><?php p($l->t('Tomboy note server'));?></h2>
+      <em><?php print_unescaped($l->t('Use the following sync server URL with tomboy/conboy/tomdroid:')); ?></em>
+      <div><input id="resturl" type="text" readonly="readonly" value="<?php p($_['apiurl']); ?>" /></div>
+    </div>
+  </div>
+</div>
index a0ddbb3..7b7c6a6 100644 (file)
@@ -1,6 +1,5 @@
-<div id="app">
-  <div id="app-navigation">
-</div>
+<?php /** @var $l OC_L10N */ ?>
+<?php $_['appNavigation']->printPage(); ?>
 
 <div id="app-content">
   <div style="margin: 1ex">
@@ -10,4 +9,5 @@
     </p>
     <pre style="margin: 1em; background-color: #DDD; padding: 1ex; font-family: monospace"><?php p($_['apiurl']); ?></pre>
   </div>
+
 </div>