r1332 - in xwiki/trunk/src: main/java/com/xpn/xwiki/render/filter main/web/skins/default test/cactus/com/xpn/xwiki/test

Phung Hai Nam namphunghai at users.forge.objectweb.org
Wed Sep 20 11:45:00 CEST 2006


Author: namphunghai
Date: 2006-09-20 11:44:59 +0200 (Wed, 20 Sep 2006)
New Revision: 1332

Modified:
   xwiki/trunk/src/main/java/com/xpn/xwiki/render/filter/XWikiHeadingFilter.java
   xwiki/trunk/src/main/web/skins/default/xwiki.css
   xwiki/trunk/src/test/cactus/com/xpn/xwiki/test/ServletSectionEditTest.java
Log:
Use StringBuffer instead of String and  put the css in the skin instead of in the code in XWikiHeadingFilter.java for section editing

Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/render/filter/XWikiHeadingFilter.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/render/filter/XWikiHeadingFilter.java	2006-09-20 09:06:06 UTC (rev 1331)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/render/filter/XWikiHeadingFilter.java	2006-09-20 09:44:59 UTC (rev 1332)
@@ -131,21 +131,21 @@
             if (level.equals("1") || level.equals("1.1") ) {
                 if(doc.getContent().indexOf(title.trim()) != -1) {
                     sectionNumber++;
-                    String editparams = "";
+                    StringBuffer editparams = new StringBuffer();
                     if (xcontext.getWiki().getEditorPreference(xcontext).equals("wysiwyg"))
-                        editparams += "xpage=wysiwyg&section=" + sectionNumber;
+                        editparams.append("xpage=wysiwyg&section=").append(sectionNumber);
                     else
-                        editparams += "section=" + sectionNumber;
+                        editparams.append("section=").append(sectionNumber);
                     try {
                         if ((xcontext.getWiki().isMultiLingual(xcontext)) && (doc.getRealLanguage(xcontext) != null)) {
-                             String languageParam = "language=" + doc.getRealLanguage(xcontext);
-                            editparams = languageParam + "&" + editparams;
+                            String languageParam = "language=" + doc.getRealLanguage(xcontext);
+                            editparams.append("&").append(languageParam);
                         }
                     } catch (XWikiException e) { }
 
-                    String url = doc.getURL("edit", editparams, xcontext);
+                    String url = doc.getURL("edit", editparams.toString(), xcontext);
 
-                    return heading + "<span style='float:right;margin-left:5px;margin-right:5px;'>&#91;<a style='text-decoration: none;' title='Edit section: "+text+"' href='"+ url+"'>"+"edit"+"</a>&#93;</span>";
+                    return heading + "<span class='edit_section'>&#91;<a style='text-decoration: none;' title='Edit section: "+text+"' href='"+ url+"'>"+"edit"+"</a>&#93;</span>";
                 }
             }
         }

Modified: xwiki/trunk/src/main/web/skins/default/xwiki.css
===================================================================
--- xwiki/trunk/src/main/web/skins/default/xwiki.css	2006-09-20 09:06:06 UTC (rev 1331)
+++ xwiki/trunk/src/main/web/skins/default/xwiki.css	2006-09-20 09:44:59 UTC (rev 1332)
@@ -564,4 +564,11 @@
   padding: auto;
   margin-top: 5px;
   margin-left: 20px;
-}
\ No newline at end of file
+}
+
+.edit_section {
+  float: right;
+  margin-left: 5px;
+  margin-right: 5px;
+}
+

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 09:06:06 UTC (rev 1331)
+++ xwiki/trunk/src/test/cactus/com/xpn/xwiki/test/ServletSectionEditTest.java	2006-09-20 09:44:59 UTC (rev 1332)
@@ -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?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);
+            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&language=en'>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&language=en'>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&language=en'>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&language=en'>edit</a>") != -1);
         } finally {
             clientTearDown();
         }





More information about the Xwiki-notifications mailing list