single file edit: jump to file after saving
[phorkie.git] / www / edit.php
index e95ca3f5ed2dbf5441f79300dc5bfacdd8853308..33b22c2afe09031f3fc264c466ac49ef2eeee8ff 100644 (file)
@@ -9,16 +9,20 @@ require_once 'www-header.php';
 $repo = new Repository();
 $repo->loadFromRequest();
 
-$repopo = new Repository_Post($repo);
-if ($repopo->process($_POST, $_SESSION)) {
-    redirect($repo->getLink('display', null, true));
-}
-
 $file = null;
 if (isset($_GET['file'])) {
     $file = $repo->getFileByName($_GET['file']);
 }
 
+$repopo = new Repository_Post($repo);
+if ($repopo->process($_POST, $_SESSION)) {
+    $anchor = '';
+    if ($file !== null) {
+        $anchor = '#' . $file->getAnchorName();
+    }
+    redirect($repo->getLink('display', null, true) . $anchor);
+}
+
 render(
     'edit',
     array(