Fossil SCM
Restore the ability to delete a wiki page.
Commit
e947378e843cfdcdc1e406e5836c86de9e47bb8dc06ac41a52c467670828a864
Parent
3b17294dfe5b483…
1 file changed
+13
-6
+13
-6
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -691,17 +691,20 @@ | ||
| 691 | 691 | } |
| 692 | 692 | if( !goodCaptcha ){ |
| 693 | 693 | @ <p class="generalError">Error: Incorrect security code.</p> |
| 694 | 694 | } |
| 695 | 695 | blob_zero(&wiki); |
| 696 | + while( fossil_isspace(zBody[0]) ) zBody++; | |
| 696 | 697 | blob_append(&wiki, zBody, -1); |
| 697 | - if( P("preview")!=0 && zBody[0] ){ | |
| 698 | + if( P("preview")!=0 ){ | |
| 698 | 699 | havePreview = 1; |
| 699 | - @ Preview:<hr /> | |
| 700 | - wiki_render_by_mimetype(&wiki, zMimetype); | |
| 701 | - @ <hr /> | |
| 702 | - blob_reset(&wiki); | |
| 700 | + if( zBody[0] ){ | |
| 701 | + @ Preview:<hr /> | |
| 702 | + wiki_render_by_mimetype(&wiki, zMimetype); | |
| 703 | + @ <hr /> | |
| 704 | + blob_reset(&wiki); | |
| 705 | + } | |
| 703 | 706 | } |
| 704 | 707 | for(n=2, z=zBody; z[0]; z++){ |
| 705 | 708 | if( z[0]=='\n' ) n++; |
| 706 | 709 | } |
| 707 | 710 | if( n<20 ) n = 20; |
| @@ -758,11 +761,15 @@ | ||
| 758 | 761 | @ <input type="submit" name="edit-markup" value="Markup Editor" |
| 759 | 762 | @ onclick='return confirm("Switching to markup-mode\nwill erase your WYSIWYG\nedits. Continue?")' /> |
| 760 | 763 | } |
| 761 | 764 | login_insert_csrf_secret(); |
| 762 | 765 | if( havePreview ){ |
| 763 | - @ <input type="submit" name="submit" value="Apply These Changes" /> | |
| 766 | + if( zBody[0] ){ | |
| 767 | + @ <input type="submit" name="submit" value="Apply These Changes" /> | |
| 768 | + }else{ | |
| 769 | + @ <input type="submit" name="submit" value="Delete This Wiki Page" /> | |
| 770 | + } | |
| 764 | 771 | } |
| 765 | 772 | @ <input type="hidden" name="name" value="%h(zPageName)" /> |
| 766 | 773 | @ <input type="submit" name="cancel" value="Cancel" |
| 767 | 774 | @ onclick='confirm("Abandon your changes?")' /> |
| 768 | 775 | @ </div> |
| 769 | 776 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -691,17 +691,20 @@ | |
| 691 | } |
| 692 | if( !goodCaptcha ){ |
| 693 | @ <p class="generalError">Error: Incorrect security code.</p> |
| 694 | } |
| 695 | blob_zero(&wiki); |
| 696 | blob_append(&wiki, zBody, -1); |
| 697 | if( P("preview")!=0 && zBody[0] ){ |
| 698 | havePreview = 1; |
| 699 | @ Preview:<hr /> |
| 700 | wiki_render_by_mimetype(&wiki, zMimetype); |
| 701 | @ <hr /> |
| 702 | blob_reset(&wiki); |
| 703 | } |
| 704 | for(n=2, z=zBody; z[0]; z++){ |
| 705 | if( z[0]=='\n' ) n++; |
| 706 | } |
| 707 | if( n<20 ) n = 20; |
| @@ -758,11 +761,15 @@ | |
| 758 | @ <input type="submit" name="edit-markup" value="Markup Editor" |
| 759 | @ onclick='return confirm("Switching to markup-mode\nwill erase your WYSIWYG\nedits. Continue?")' /> |
| 760 | } |
| 761 | login_insert_csrf_secret(); |
| 762 | if( havePreview ){ |
| 763 | @ <input type="submit" name="submit" value="Apply These Changes" /> |
| 764 | } |
| 765 | @ <input type="hidden" name="name" value="%h(zPageName)" /> |
| 766 | @ <input type="submit" name="cancel" value="Cancel" |
| 767 | @ onclick='confirm("Abandon your changes?")' /> |
| 768 | @ </div> |
| 769 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -691,17 +691,20 @@ | |
| 691 | } |
| 692 | if( !goodCaptcha ){ |
| 693 | @ <p class="generalError">Error: Incorrect security code.</p> |
| 694 | } |
| 695 | blob_zero(&wiki); |
| 696 | while( fossil_isspace(zBody[0]) ) zBody++; |
| 697 | blob_append(&wiki, zBody, -1); |
| 698 | if( P("preview")!=0 ){ |
| 699 | havePreview = 1; |
| 700 | if( zBody[0] ){ |
| 701 | @ Preview:<hr /> |
| 702 | wiki_render_by_mimetype(&wiki, zMimetype); |
| 703 | @ <hr /> |
| 704 | blob_reset(&wiki); |
| 705 | } |
| 706 | } |
| 707 | for(n=2, z=zBody; z[0]; z++){ |
| 708 | if( z[0]=='\n' ) n++; |
| 709 | } |
| 710 | if( n<20 ) n = 20; |
| @@ -758,11 +761,15 @@ | |
| 761 | @ <input type="submit" name="edit-markup" value="Markup Editor" |
| 762 | @ onclick='return confirm("Switching to markup-mode\nwill erase your WYSIWYG\nedits. Continue?")' /> |
| 763 | } |
| 764 | login_insert_csrf_secret(); |
| 765 | if( havePreview ){ |
| 766 | if( zBody[0] ){ |
| 767 | @ <input type="submit" name="submit" value="Apply These Changes" /> |
| 768 | }else{ |
| 769 | @ <input type="submit" name="submit" value="Delete This Wiki Page" /> |
| 770 | } |
| 771 | } |
| 772 | @ <input type="hidden" name="name" value="%h(zPageName)" /> |
| 773 | @ <input type="submit" name="cancel" value="Cancel" |
| 774 | @ onclick='confirm("Abandon your changes?")' /> |
| 775 | @ </div> |
| 776 |