Download note as XML and JSON
[grauphel.git] / controller / guicontroller.php
index 97a7f10c9289f2622b6e77eabc531ca882744583..fc97b049a7b2bd687849ba92015b6c87604fcc47 100644 (file)
@@ -96,10 +96,25 @@ class GuiController extends Controller
                 'note-content' => $converter->convert(
                     $note->{'note-content'}
                 ),
+                'links' => array(
+                    'json' => $this->urlGen->linkToRoute(
+                        'grauphel.api.note', array(
+                            'guid' => $guid, 'username' => $this->user->getUid()
+                        )
+                    ),
+                    'xml' => $this->urlGen->linkToRoute(
+                        'grauphel.notes.xml', array('guid' => $guid)
+                    ),
+                )
             )
         );
 
-        $this->addNavigation($res);
+        $selectedRawtag = null;
+        if (count($note->tags) > 0) {
+            $selectedRawtag = $note->tags[0];
+        }
+
+        $this->addNavigation($res, $selectedRawtag);
         return $res;
     }
 
@@ -233,6 +248,7 @@ class GuiController extends Controller
                     'href' => $this->urlGen->linkToRoute(
                         'grauphel.gui.tag', array('rawtag' => $rawtag)
                     ),
+                    'selected' => $rawtag == $selectedRawtag,
                 );
             }
         }