]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - doc/todo/preview_changes.mdwn
Merge commit 'upstream/master' into prv/po
[git.ikiwiki.info.git] / doc / todo / preview_changes.mdwn
index d04c32314e3632772b47b7856b860302ebc6d0ec..28797b452708aa3e3d80c3f7fd582e949db8fc80 100644 (file)
@@ -7,80 +7,8 @@ Some discussion from the main [[/index/discussion]] page:
 >
 >> It's doable, it could even be done by a [[todo/plugin]], I think.
 >> --[[Joey]]
+>>
 
----
+See the [[plugins/editdiff]] plugin --[[JeremieKoenig]]
 
-I need help with this. Supposedly, such a plugin would provide a `formbuilder_setup`
-hook which would add the button, and a cgi hook which would interecept
-"Show Diff" clicks. This would show a diff between
-`titlepage(possibly_foolish_untaint($form->field("page")))`
-and the provided `$form->field("editcontent")`.
-
-But:
-
-  * How could the case of concurrent editing be handled ?
-    Especially as (I think) only the RCS backend can know that
-    this has happened.
-  * 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
-===================================================================
---- templates/editpage.tmpl     (rĂ©vision 4130)
-+++ templates/editpage.tmpl     (copie de travail)
-@@ -57,9 +57,7 @@
- Optional comment about this change:<br />
- <TMPL_VAR FIELD-COMMENTS><br />
- </TMPL_IF>
--<input id="_submit" name="_submit" type="submit" value="Save Page" />
--<input id="_submit_2" name="_submit" type="submit" value="Preview" />
--<input id="_submit_3" name="_submit" type="submit" value="Cancel" />
-+<TMPL_VAR FORM-SUBMIT>
- <TMPL_VAR HELPONFORMATTINGLINK>
- <TMPL_VAR FORM-END>
-Index: IkiWiki/CGI.pm
-===================================================================
---- IkiWiki/CGI.pm      (rĂ©vision 4130)
-+++ IkiWiki/CGI.pm      (copie de travail)
-@@ -304,6 +304,7 @@
-        eval q{use CGI::FormBuilder};
-        error($@) if $@;
-        my $form = CGI::FormBuilder->new(
-+               title => "editpage",
-                fields => \@fields,
-                charset => "utf-8",
-                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
+[[done]]