summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2008-05-06 22:50:11 +0200
committerAndreas Gohr <andi@splitbrain.org>2008-05-06 22:50:11 +0200
commitf951a474978baea95a0f880b5651605aad09997e (patch)
tree26db8eb51cb60878088a453a8f72872a8e6d6db4
parent640f0ac18e2bb5e5b2c8d04c7502aa5642134b4e (diff)
downloadrpg-f951a474978baea95a0f880b5651605aad09997e.tar.gz
rpg-f951a474978baea95a0f880b5651605aad09997e.tar.bz2
jump to edited section after editing FS#643
This patch adds a mecanism that tries to scroll down to the section that was just edited when using section editing. The approach used is not failsafe, but should work in most cases. It will not work correctly when: * multiple sections on the page have the same headline * the edited section no longer starts with a headline darcs-hash:20080506205011-7ad00-9d213d4436c4f01840d3f62277c3fee9e316d447.gz
-rw-r--r--inc/actions.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/inc/actions.php b/inc/actions.php
index 24516e5d5..45c067657 100644
--- a/inc/actions.php
+++ b/inc/actions.php
@@ -301,9 +301,22 @@ function act_save($act){
//delete draft
act_draftdel($act);
+
+ $go = wl($ID,'',true);
+
+ //get section name when coming from section edit
+ if($PRE && preg_match('/^\s*==+([^=\n]+)/',$TEXT,$match)){
+ #FIXME duplicates code from xhtml renderer
+ $title = $match[0];
+ $title = str_replace(':','',cleanID($title));
+ $title = ltrim($title,'0123456789._-');
+ if(empty($title)) $title='section';
+ $go .= '#'.$title;
+ }
+
//show it
session_write_close();
- header("Location: ".wl($ID,'',true));
+ header("Location: $go");
exit();
}