From ee4c4a1b5a5840c1b9d2d8c74b3f4298dd52928b Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 11 Mar 2006 21:01:48 +0100 Subject: Automatic draft saving DokuWiki now automatically creates a draft file of the currently edited page. In case of an editing interuption (eg. Browsercrash) the draftfile can be continued later. darcs-hash:20060311200148-7ad00-919337a51e001136178d175a1755cd26122e9726.gz --- inc/html.php | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index c0ce8527f..0cc52fbd1 100644 --- a/inc/html.php +++ b/inc/html.php @@ -98,7 +98,7 @@ function html_login(){ } /** - * shows the edit/source/show button dependent on current mode + * shows the edit/source/show/draft button dependent on current mode * * @author Andreas Gohr */ @@ -110,10 +110,14 @@ function html_editbutton(){ if($ACT == 'show' || $ACT == 'search'){ if($INFO['writable']){ - if($INFO['exists']){ - $r = html_btn('edit',$ID,'e',array('do' => 'edit','rev' => $REV),'post'); + if($INFO['draft']){ + $r = html_btn('draft',$ID,'e',array('do' => 'draft'),'post'); }else{ - $r = html_btn('create',$ID,'e',array('do' => 'edit','rev' => $REV),'post'); + if($INFO['exists']){ + $r = html_btn('edit',$ID,'e',array('do' => 'edit','rev' => $REV),'post'); + }else{ + $r = html_btn('create',$ID,'e',array('do' => 'edit','rev' => $REV),'post'); + } } }else{ $r = html_btn('source',$ID,'v',array('do' => 'edit','rev' => $REV),'post'); @@ -286,6 +290,36 @@ function html_show($txt=''){ } } +/** + * ask the user about how to handle an exisiting draft + * + * @author Andreas Gohr + */ +function html_draft(){ + global $INFO; + global $ID; + global $lang; + global $conf; + $draft = unserialize(io_readFile($INFO['draft'],false)); + $text = cleanText(con($draft['prefix'],$draft['text'],$draft['suffix'],true)); + + echo p_locale_xhtml('draft'); + ?> +
+ +
+ + +
+ + + + +
+
+
@@ -1012,8 +1047,8 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed? textChanged = ; -
+
@@ -1025,7 +1060,7 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed?
- +
-- cgit v1.2.3