r1330 - in xwiki/trunk/src: main/java/com/xpn/xwiki test/cactus/com/xpn/xwiki/test

Phung Hai Nam namphunghai at users.forge.objectweb.org
Wed Sep 20 07:02:24 CEST 2006


Author: namphunghai
Date: 2006-09-20 07:02:23 +0200 (Wed, 20 Sep 2006)
New Revision: 1330

Modified:
   xwiki/trunk/src/main/java/com/xpn/xwiki/XWiki.java
   xwiki/trunk/src/test/cactus/com/xpn/xwiki/test/ServletSectionEditTest.java
Log:
XWIKI-356. Fixed  a bug with multilingual  in section editing

Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/XWiki.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/XWiki.java	2006-09-20 02:44:42 UTC (rev 1329)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/XWiki.java	2006-09-20 05:02:23 UTC (rev 1330)
@@ -18,7 +18,7 @@
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  *
  * @author ludovic
- * @author namphunghai
+ * @author phunghainam
  * @author wr0ngway
  * @author markj
  * @author erwan
@@ -3989,17 +3989,11 @@
     }
 
     public boolean hasSectionEdit(XWikiContext context) {
-        if (context.getWiki().ParamAsLong("xwiki.section.edit", 0) == 1)
-            return true;
-         else
-            return false;
+        return (context.getWiki().ParamAsLong("xwiki.section.edit", 0) == 1);
     }
 
     public boolean hasCaptcha(XWikiContext context) {
-        if (context.getWiki().ParamAsLong("xwiki.plugin.captcha", 0) == 1)
-            return true;
-        else
-            return false;
+        return (context.getWiki().ParamAsLong("xwiki.plugin.captcha", 0) == 1);
     }
 
     public String clearName(String name, XWikiContext context) {
@@ -4047,7 +4041,7 @@
     }
 
     public List search(XWikiQuery query, XWikiContext context) throws XWikiException {
-        QueryPlugin qp = (QueryPlugin) getPlugin("query", context);                                              
+        QueryPlugin qp = (QueryPlugin) getPlugin("query", context);
         if (qp == null)
          return null;
         return qp.search(query);

Modified: xwiki/trunk/src/test/cactus/com/xpn/xwiki/test/ServletSectionEditTest.java
===================================================================
--- xwiki/trunk/src/test/cactus/com/xpn/xwiki/test/ServletSectionEditTest.java	2006-09-20 02:44:42 UTC (rev 1329)
+++ xwiki/trunk/src/test/cactus/com/xpn/xwiki/test/ServletSectionEditTest.java	2006-09-20 05:02:23 UTC (rev 1330)
@@ -62,10 +62,10 @@
     public void endPresentEdit(WebResponse webResponse) throws HibernateException {
         try {
             String result = webResponse.getText();
-            assertTrue("Content should have edit button for title 1 : " + result, result.indexOf("<a style='text-decoration: none;' title='Edit section: This is title 1' href='/xwiki/testbin/edit/Main/PresentSectionEditTest?section=1'>edit</a>") != -1);
-            assertTrue("Content should have edit button for subtitle 1 : " + result, result.indexOf("<a style='text-decoration: none;' title='Edit section: This is the subtitle 1' href='/xwiki/testbin/edit/Main/PresentSectionEditTest?section=2'>edit</a>") != -1);
-            assertTrue("Content should have edit button for subtitle 2 : " + result, result.indexOf("<a style='text-decoration: none;' title='Edit section: This is the subtitle 2' href='/xwiki/testbin/edit/Main/PresentSectionEditTest?section=3'>edit</a>") != -1);
-            assertTrue("Content should have edit button for title2 : " + result, result.indexOf("<a style='text-decoration: none;' title='Edit section: This is the title 2' href='/xwiki/testbin/edit/Main/PresentSectionEditTest?section=4'>edit</a>") != -1);
+            assertTrue("Content should have edit button for title 1 : " + result, result.indexOf("<a style='text-decoration: none;' title='Edit section: This is title 1' href='/xwiki/testbin/edit/Main/PresentSectionEditTest?language=en&section=1'>edit</a>") != -1);
+            assertTrue("Content should have edit button for subtitle 1 : " + result, result.indexOf("<a style='text-decoration: none;' title='Edit section: This is the subtitle 1' href='/xwiki/testbin/edit/Main/PresentSectionEditTest?language=en&section=2'>edit</a>") != -1);
+            assertTrue("Content should have edit button for subtitle 2 : " + result, result.indexOf("<a style='text-decoration: none;' title='Edit section: This is the subtitle 2' href='/xwiki/testbin/edit/Main/PresentSectionEditTest?language=en&section=3'>edit</a>") != -1);
+            assertTrue("Content should have edit button for title2 : " + result, result.indexOf("<a style='text-decoration: none;' title='Edit section: This is the title 2' href='/xwiki/testbin/edit/Main/PresentSectionEditTest?language=en&section=4'>edit</a>") != -1);
         } finally {
             clientTearDown();
         }





More information about the Xwiki-notifications mailing list