web commit by http://jeremie.koenig.myopenid.com/: update
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Thu, 16 Aug 2007 15:59:28 +0000 (15:59 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Thu, 16 Aug 2007 15:59:28 +0000 (15:59 +0000)
doc/todo/preview_changes.mdwn

index 9533b993ce1e1768377d76c1343c7e8d2fbc18a3..d04c32314e3632772b47b7856b860302ebc6d0ec 100644 (file)
@@ -21,12 +21,12 @@ But:
   * How could the case of concurrent editing be handled ?
     Especially as (I think) only the RCS backend can know that
     this has happened.
-  * Doing the formbuilder trick for adding a button needs the following
-    patch. (note that this is not the only template which has its submit
-    buttons hardcoded; is this supposed to work around something?)
-  * Coercing `editpage()` into showing the edit form again rather that
-    saving the page would be tricky and hackish to do from a module;
-    maybe this would better be implemented directly in `showpage`?
+  * May I hijack the `page_preview` template variable to show
+    my diff output? (the patch below assumes this).
+  * Using the formbuilder hook to add a button, and coerce `editpage()`
+    into showing the edit form again rather that saving the page needs
+    the following patch. (note that this is not the only template which has
+    its submit buttons hardcoded; is this supposed to work around something?)
 
 <pre>
 Index: templates/editpage.tmpl
@@ -58,14 +58,29 @@ Index: IkiWiki/CGI.pm
                 method => 'POST',
 @@ -321,7 +322,8 @@
         );
+        
         run_hooks(formbuilder_setup => sub {
 -               shift->(form => $form, cgi => $q, session => $session);
 +               shift->(form => $form, cgi => $q, session => $session,
 +                       buttons => \@buttons);
         });
+        
         decode_form_utf8($form);
+@@ -402,12 +404,12 @@
+                        preprocess($page, $page,
+                        filter($page, $page, $form->field('editcontent')), 0, 1))));
+        }
+-       else {
++       elsif ($form->submitted eq "Save Page") {
+                $form->tmpl_param("page_preview", "");
+        }
+        $form->tmpl_param("page_conflict", "");
+        
+-       if (! $form->submitted || $form->submitted eq "Preview" || 
++       if ($form->submitted ne "Save Page" || 
+            ! $form->validate) {
+                if ($form->field("do") eq "create") {
+                        my @page_locs;
 </pre>
 
 --[[JeremieKoenig]]
\ No newline at end of file