Add new attachment

Only authorized users are allowed to upload new attachments.

This page (revision-10) was last changed on 21-Jun-2007 05:22 by 203.162.3.157  

This page was created on 14-Mar-2003 12:08 by MarkAnderson

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 1 changed 96 lines
Here is a patch to add a save button to the preview page. It just makes it more convenient if you are happy with the changes you have made and want to commit them without having to go back first.\\
The patch simply copies some code for supporting the save button from the Edit JSP files into the Preview files.
;:''Thanks. The patch is now included in 2.1.1 (though I simplified it a bit - you don't need to check latestversion for previewing. --JanneJalkanen''
;:''Oops. It seems that if the page is long enough, you can't put the text into a hidden input element; the browser (Mozilla, in this case) cuts off the rest of the page. --[JanneJalkanen]''
;:''There's another problem. If the contents of the page include a double-quote character, the contents get truncated at it. --KellyDenehy''
''There's now an updated version in 2.1.84, which not only includes "Save" from preview, but also "Keep editing" and "Cancel" -buttons. --JanneJalkanen''
\\
__Patch for src/webdocs/Preview.jsp__
{{{--- src/webdocs/Preview.jsp.orig Fri Jan 10 22:27:04 2003
+++ src/webdocs/Preview.jsp Mon Mar 10 16:14:26 2003
@@ -1,3 +1,4 @@
+<%@ page import="java.util.Date" %>
<%@ page import="org.apache.log4j.*" %>
<%@ page import="com.ecyrd.jspwiki.*" %>
<%@ page import="com.ecyrd.jspwiki.tags.WikiTagBase" %>
@@ -24,10 +25,11 @@
NDC.push( wiki.getApplicationName()+":"+pagereq );
WikiPage wikipage = wiki.getPage( pagereq );
-
+ WikiPage latestversion = wikipage;
if( wikipage == null )
{
wikipage = new WikiPage( pagereq );
+ latestversion = wikipage;
}
WikiContext wikiContext = new WikiContext( wiki, wikipage );
@@ -43,6 +45,19 @@
pageContext.setAttribute( "usertext",
wiki.safeGetParameter( request, "text" ),
PageContext.REQUEST_SCOPE );
+ //
+ // Determine and store the date the latest version was changed. Since
+ // the newest version is the one that is changed, we need to track
+ // that instead of the edited version.
+ //
+ long lastchange = 0;
+
+ Date d = latestversion.getLastModified();
+ if( d != null ) lastchange = d.getTime();
+
+ pageContext.setAttribute( "lastchange",
+ Long.toString( lastchange ),
+ PageContext.REQUEST_SCOPE );
String contentPage = "templates/"+skin+"/ViewTemplate.jsp";
%>}}}
----
__Patch for src/webdocs/templates/default/PreviewContent.jsp__
{{{
--- src/webdocs/templates/default/PreviewContent.jsp.orig Fri Nov 8 01:26:48 2002
+++ src/webdocs/templates/default/PreviewContent.jsp Mon Mar 10 17:04:41 2003
@@ -4,6 +4,7 @@
<DIV class="previewnote">
<B>This is a PREVIEW! Hit "back" on your browser to go back to the editor.</B>
+ <B>Or just hit the save button if you are happy with what you see.</B>
</DIV>
<P><HR></P>
@@ -18,4 +19,21 @@
<DIV class="previewnote">
<B>This is a PREVIEW! Hit "back" on your browser to go back to the editor.</B>
+ <B>Or just hit the save button if you are happy with what you see.</B>
</DIV>
+
+ <FORM action="<wiki:EditLink format="url" />" method="POST" ACCEPT-CHARSET="ISO-8859-1,UTF-8">
+ <%-- These are required parts of this form. If you do not include these,
+ horrible things will happen. Do not modify them either. --%>
+
+ <%-- FIXME: This is not required, is it? --%>
+ <INPUT type="hidden" name="page" value="<wiki:PageName/>">
+ <INPUT type="hidden" name="action" value="save">
+ <INPUT type="hidden" name="edittime" value="<%=pageContext.getAttribute("lastchange", PageContext.REQUEST_SCOPE )%>">
+ <INPUT type="hidden" name="text" value="<%=pageContext.getAttribute("usertext",PageContext.REQUEST_SCOPE)%>">
+ <%-- End of required area --%>
+
+ <br clear="all" />
+ <input type="submit" name="ok" value="Save" />
+ &nbsp;&nbsp;
+</FORM>
}}}
-[MarkAnderson]
----
More [Category Patches].
Topic now obsolete and wiped; please refer to earlier versions for history of topic.
daas
Version Date Modified Size Author Changes ... Change note
10 21-Jun-2007 05:22 0.092 kB 203.162.3.157 to previous
9 21-Nov-2005 13:22 0.086 kB GregorHagedorn to previous | to last
8 19-Oct-2003 23:45 4.075 kB JanneJalkanen to previous | to last
7 14-Jul-2003 16:54 3.917 kB 167.1.146.100 to previous | to last
6 14-Jul-2003 16:25 3.915 kB 167.1.146.100 to previous | to last
5 28-Mar-2003 09:52 3.772 kB JanneJalkanen to previous | to last
4 28-Mar-2003 09:47 3.739 kB JanneJalkanen to previous | to last
3 28-Mar-2003 09:39 3.577 kB JanneJalkanen to previous | to last
2 17-Mar-2003 14:35 3.422 kB JanneJalkanen to previous | to last
1 14-Mar-2003 12:08 3.386 kB MarkAnderson to last
« This page (revision-10) was last changed on 21-Jun-2007 05:22 by 203.162.3.157