changeset 5155:b18473705235

twikidraw java code reverted to 5081:3e1d3367aeaa because of anywikidraw does miss the TextCha feature and it needs more work, actions twikidraw and anywikidraw adapted.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 19 Sep 2009 21:33:48 +0200
parents 1eb3596fbd3a
children 94fbaf908135
files MoinMoin/action/anywikidraw.py MoinMoin/action/twikidraw.py MoinMoin/web/static/htdocs/applets/TWikiDrawPlugin/twikidraw.jar contrib/TWikiDrawPlugin/build.xml contrib/TWikiDrawPlugin/src/CH/ifa/draw/twiki/TWikiDraw.java contrib/TWikiDrawPlugin/src/CH/ifa/draw/twiki/TWikiFrame.java
diffstat 6 files changed, 15 insertions(+), 70 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/anywikidraw.py	Sat Sep 19 18:39:38 2009 +0200
+++ b/MoinMoin/action/anywikidraw.py	Sat Sep 19 21:33:48 2009 +0200
@@ -144,10 +144,6 @@
         pageurl = request.href(pagename)
         saveurl = request.href(pagename, action=action_name, do='save', target=target)
         helpurl = request.href("HelpOnActions/AttachFile")
-        #if TextCha(request).is_enabled():
-        #    textchaquestion = TextCha(request).question
-        #else:
-        #    textchaquestion = ''
 
         html = """
 <p>
--- a/MoinMoin/action/twikidraw.py	Sat Sep 19 18:39:38 2009 +0200
+++ b/MoinMoin/action/twikidraw.py	Sat Sep 19 21:33:48 2009 +0200
@@ -110,8 +110,6 @@
         _ = request.getText
         pagename = self.pagename
         target = self.target
-        if not TextCha(request).check_answer_from_form():
-            return _('TextCha: Wrong answer! Go back and try again...')
         if not request.user.may.write(pagename):
             return _('You are not allowed to save a drawing on this page.')
         if not target:
@@ -169,10 +167,6 @@
         pageurl = request.href(pagename)
         saveurl = request.href(pagename, action=action_name, do='save', target=target)
         helpurl = request.href("HelpOnActions/AttachFile")
-        if TextCha(request).is_enabled():
-            textchaquestion = TextCha(request).question
-        else:
-            textchaquestion = ''
 
         html = """
 <p>
@@ -184,7 +178,6 @@
     <param name="basename" value="%(basename)s">
     <param name="viewpath" value="%(pageurl)s">
     <param name="helppath" value="%(helpurl)s">
-    <param name="textchaquestion" value="%(textchaquestion)s">
     <strong>NOTE:</strong> You need a Java enabled browser to edit the drawing.
 </applet>
 </p>
@@ -196,7 +189,6 @@
     pageurl=wikiutil.escape(pageurl, 1),
     saveurl=wikiutil.escape(saveurl, 1),
     helpurl=wikiutil.escape(helpurl, 1),
-    textchaquestion=wikiutil.escape(textchaquestion, 1),
 )
 
         title = "%s %s:%s" % (_("Edit drawing"), pagename, target)
Binary file MoinMoin/web/static/htdocs/applets/TWikiDrawPlugin/twikidraw.jar has changed
--- a/contrib/TWikiDrawPlugin/build.xml	Sat Sep 19 18:39:38 2009 +0200
+++ b/contrib/TWikiDrawPlugin/build.xml	Sat Sep 19 21:33:48 2009 +0200
@@ -12,7 +12,7 @@
     </target>
 
     <target name="build" depends="-init" description="Build TWikiDrawPlugin JAR">
-        <javac destdir="${build.home}/classes" source="1.3" target="1.1" executable="/usr/bin/javac -Xlint:deprecation">
+        <javac destdir="${build.home}/classes" source="1.3" target="1.1">
             <src path="${src.home}/packages"/>
             <src path="${src.home}/src"/>
         </javac>
--- a/contrib/TWikiDrawPlugin/src/CH/ifa/draw/twiki/TWikiDraw.java	Sat Sep 19 18:39:38 2009 +0200
+++ b/contrib/TWikiDrawPlugin/src/CH/ifa/draw/twiki/TWikiDraw.java	Sat Sep 19 21:33:48 2009 +0200
@@ -5,8 +5,6 @@
  * modified, and distributed without fee provided that this 
  * copyright notice appears in all copies.
  * Portions Copyright (C) 2001 Motorola - All Rights Reserved
- *
- * 2009 MoinMoin:ReimarBauer TextCha feature added
  */
 
 package CH.ifa.draw.twiki;
@@ -76,8 +74,6 @@
 	String type,
 	String path,
 	String content,
-    String textchaquestion,
-    String textchaanswer,
 	String comment)
 	throws MalformedURLException, IOException {
 
@@ -86,7 +82,7 @@
 	    sep += "x";
 
 	String message = makeMimeForm(fileName, type,
-				      path, content, textchaquestion, textchaanswer, comment, sep);
+				      path, content, comment, sep);
 
         // for test
         //URL server = new URL("http", "localhost", 80, savePath);
@@ -183,8 +179,6 @@
 	String type,
 	String path,
 	String content,
-    String textchaquestion,
-    String textchaanswer,
 	String comment,
 	String sep) {
 
@@ -209,12 +203,6 @@
 	    + binary + NL
 	    + content
 	    + mime_sep
-        + "Content-Disposition: form-data; name=\"textcha-question\"" + NLNL
-	    + textchaquestion
-        + mime_sep
-        + "Content-Disposition: form-data; name=\"textcha-answer\"" + NLNL
-	    + textchaanswer
-        + mime_sep
 	    + "Content-Disposition: form-data; name=\"filecomment\"" + NLNL
 	    + comment
 	    + NL + "--" + sep + "--" + NL;
--- a/contrib/TWikiDrawPlugin/src/CH/ifa/draw/twiki/TWikiFrame.java	Sat Sep 19 18:39:38 2009 +0200
+++ b/contrib/TWikiDrawPlugin/src/CH/ifa/draw/twiki/TWikiFrame.java	Sat Sep 19 21:33:48 2009 +0200
@@ -5,8 +5,6 @@
  * modified, and distributed without fee provided that this 
  * copyright notice appears in all copies.
  * Portions Copyright (C) 2001 Motorola - All Rights Reserved
- *
- * 2009 MoinMoin:ReimarBauer TextCha feature added
  */
 
 package CH.ifa.draw.twiki;
@@ -36,8 +34,6 @@
      * Parameter names
      */
     static private String UNTITLED_PARAMETER   = "untitled";
-    static private String TEXTCHA_QUESTION_PARAMETER   = "textchaquestion";
-    static private String TEXTCHA_SEND_PARAMETER   = "textchaanswer";
     static private String DRAWPATH_PARAMETER   = "drawpath";
     static private String GIFPATH_PARAMETER    = "gifpath";
     static private String PNGPATH_PARAMETER    = "pngpath";
@@ -47,8 +43,7 @@
     static private String HELPPATH_PARAMETER   = "helppath";
     static private String BORDERSIZE_PARAMETER = "bordersize";
 
-    private Label fStatusLabel, fTextChaLabel;
-    private TextField fTextChaTextField;
+    private Label fStatusLabel;
 
     public TWikiFrame(Application applet) {
         super("TWikiDraw", applet);
@@ -245,16 +240,7 @@
 
         button = new CommandButton(new SendToBackCommand("Send To Back", view()));
         buttons.add(button);
-        
-        String question = getApplication().getParameter(TEXTCHA_QUESTION_PARAMETER);
-        if (question.length() > 0) {
-            fTextChaLabel = new Label(question);
-            panel.add(fTextChaLabel);
-            fTextChaTextField = new TextField(40);
-            panel.add(fTextChaTextField);
-        };
-                
-        
+
         button = new Button("Help");
 	button.addActionListener(
 	    new ActionListener() {
@@ -275,7 +261,7 @@
 	else
 	    getApplication().showStatus(s);
     }
-    
+
     /**
      * Workaround to get it work without update button
      */
@@ -351,8 +337,8 @@
 	
     public boolean doSaveDrawing() {
 		TWikiDraw app = (TWikiDraw)getApplication();
-		boolean savedDraw, savedSvg, savedGif, savedPng, savedMap, savedTextCha, sendTextCha;
-		savedDraw = savedSvg = savedGif = savedPng = savedMap = savedTextCha = sendTextCha = false;
+		boolean savedDraw, savedSvg, savedGif, savedPng, savedMap;
+		savedDraw = savedSvg = savedGif = savedPng = savedMap = false;
 		
 		// set wait cursor
 		setCursor(new Cursor(Cursor.WAIT_CURSOR));
@@ -376,21 +362,7 @@
 			String savePath = app.getParameter(SAVEPATH_PARAMETER);
 			if (savePath == null)
 				savePath = "";
-
-            // textcha question
-            String textchaquestion = getApplication().getParameter(TEXTCHA_QUESTION_PARAMETER);
-            if (textchaquestion == null)
-				textchaquestion = "";
-
-			// sends textcha Answer
-            String textchaanswer = "";
-            if (textchaquestion.length() > 0) {
-                textchaanswer =  fTextChaTextField.getText();
-			    if (textchaanswer == null)
-				    textchaanswer = "";
-            } 
-
-
+			
 			// gets base filename
 			String baseName = app.getParameter(BASENAME_PARAMETER);
 			if (baseName == null)
@@ -398,10 +370,10 @@
 			
 			// submit POST command to the server three times:
 			// *.draw, *.map and *.gif
+			// first upload *.draw file
 			showStatus("Saving " + baseName + ".draw");
-			savedDraw = app.post(savePath, baseName + ".draw", "text/plain", 
-                        drawingPath, out.toString(), textchaquestion,
-                        textchaanswer, "TWikiDraw draw file");
+			savedDraw = app.post(savePath, baseName + ".draw", "text/plain", drawingPath,
+								 out.toString(), "TWikiDraw draw file");
 			
 			// calculate the minimum size of the gif image
 			Dimension d = new Dimension(0, 0); // not this.view().getSize();
@@ -449,14 +421,12 @@
 					(d.width + iBorder) + "," + (d.height + iBorder) +
 					"\" href=\"%TWIKIDRAW%\" />\n" +
 					"</map>";
-				savedMap = app.post(savePath, baseName + ".map", "text/plain",
-                                    mapPath + ".map", map, textchaquestion,
-                                    textchaanswer, "TWikiDraw map file");
+				savedMap = app.post(savePath, baseName + ".map", "text/plain", mapPath + ".map",
+									map, "TWikiDraw map file");
 			} else {
 				// erase any previous map file
 				String mapPath = drawingPath.substring(0, drawingPath.length() - 5);
-				savedMap = app.post( savePath, baseName + ".map", "text/plain",
-                        mapPath + ".map", "", textchaquestion,  textchaanswer, "");
+				savedMap = app.post( savePath, baseName + ".map", "text/plain", mapPath + ".map", "", "");
             }
 			
             // get pathname of the SVG file
@@ -505,7 +475,6 @@
 					// upload *.png file
 					savedPng = app.post(savePath, baseName + ".png", "image/png",
 										pngPath, String.valueOf( aChar, 0, size),
-                                        textchaquestion,  textchaanswer,
 										"TWikiDraw PNG file");
 				}
 				
@@ -526,7 +495,7 @@
 					// upload *.gif file
 					savedGif = app.post(savePath, baseName + ".gif", "image/gif",
 										gifPath, String.valueOf( aChar, 0, size),
-										textchaquestion,  textchaanswer, "TWikiDraw GIF file");
+										"TWikiDraw GIF file");
 				}
 			}
 		} catch (MalformedURLException e) {