You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by br...@apache.org on 2008/08/30 11:20:13 UTC

svn commit: r690485 - in /incubator/jspwiki/trunk: ./ etc/i18n/ etc/i18n/templates/ src/com/ecyrd/jspwiki/ src/com/ecyrd/jspwiki/search/ src/com/ecyrd/jspwiki/ui/ src/webdocs/ src/webdocs/scripts/ src/webdocs/templates/default/

Author: brushed
Date: Sat Aug 30 02:20:12 2008
New Revision: 690485

URL: http://svn.apache.org/viewvc?rev=690485&view=rev
Log:
v2.7.0-alpha-31    
  
        * [JSPWIKI-346] Refactored Rename.jsp to display errors through the template pages.
        
        * [JSPWIKI-289] Improved SuggestionMenu (plain editor only) for better attachment link support.
 

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/etc/i18n/CoreResources.properties
    incubator/jspwiki/trunk/etc/i18n/CoreResources_nl.properties
    incubator/jspwiki/trunk/etc/i18n/templates/default.properties
    incubator/jspwiki/trunk/etc/i18n/templates/default_nl.properties
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/search/SearchManager.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/PageCommand.java
    incubator/jspwiki/trunk/src/webdocs/Rename.jsp
    incubator/jspwiki/trunk/src/webdocs/scripts/jspwiki-edit.js
    incubator/jspwiki/trunk/src/webdocs/templates/default/InfoContent.jsp
    incubator/jspwiki/trunk/src/webdocs/templates/default/PageActionsTop.jsp
    incubator/jspwiki/trunk/src/webdocs/templates/default/jspwiki.css

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=690485&r1=690484&r2=690485&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Sat Aug 30 02:20:12 2008
@@ -1,3 +1,22 @@
+2008-08-30 Dirk Frederickx <di...@gmail.com>
+
+        * 2.7.0-alpha-31
+        
+        * [JSPWIKI-346] Rename errors are now displayed inside a page-info in screen,
+        above the rename section.  Some localization updates are needed.
+
+        New resource:
+            prefs.errorprefix.rename=Could not rename the page:&nbsp;
+
+        And the CoreResources rename.* items are updated to remove the text
+        "Click "back" on your browser and change the new name.".
+        (done for default and .nl properties)
+
+        * [JSPWIKI-289] The edit SuggestionMenu (plain editor only) now also allows 
+        to enter a '/' to get a list of attachment links. Moreover, when you open a new link with 
+        a '[', by default jspwiki displays the list of attachments of the current page.
+ 
+
 2008-08-25 Dirk Frederickx <di...@gmail.com>
 
         * 2.7.0-alpha-30 

Modified: incubator/jspwiki/trunk/etc/i18n/CoreResources.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/CoreResources.properties?rev=690485&r1=690484&r2=690485&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/CoreResources.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/CoreResources.properties Sat Aug 30 02:20:12 2008
@@ -52,11 +52,11 @@
 
 # Renaming
 
-rename.empty=New page name empty.  Click "back" on your browser and fill in the new name.
+rename.empty=New page name empty. 
 rename.error.title=Unable to rename page
 rename.error.reason=Reason:
-rename.identical=Page names identical.  Click "back" on your browser and change the new name.
-rename.exists=Page "{0}" already exists. Click "back" on your browser and change the new name or delete the page "{0}" first.
+rename.identical=Page names identical. 
+rename.exists=Page "{0}" already exists. Please change the new name or delete the page "{0}" first.
 rename.unknownerror=An unknown error occurred ({0})
 
 # Login.jsp  

Modified: incubator/jspwiki/trunk/etc/i18n/CoreResources_nl.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/CoreResources_nl.properties?rev=690485&r1=690484&r2=690485&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/CoreResources_nl.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/CoreResources_nl.properties Sat Aug 30 02:20:12 2008
@@ -50,11 +50,11 @@
 
 # Renaming
 
-rename.empty=De nieuwe naam van de pagina is leeg.<br/>\nKlik <b>back</b> in de browser en kies een nieuwe naam
+rename.empty=De nieuwe naam van de pagina is leeg.
 rename.error.title=Fout: de pagina kon niet worden hernoemd
 rename.error.reason=Reden:
-rename.identical=De pagina namen zijn identiek.<br/>\nKlik <b>back</b> in de browser en kies een andere naam.
-rename.exists=Page "{0}" bestaat reeds.<br/>\nKlik <b>back</b> in de browser en kies een andere naam of verwijder de pagina "{0}".
+rename.identical=De pagina namen zijn identiek.
+rename.exists=De pagina "{0}" bestaat reeds. Kies een andere naam of verwijder de pagina "{0}".
 rename.unknownerror=Er is een onbekende fout opgetreden ({0})
 
 # Login.jsp  
@@ -62,7 +62,7 @@
 login.error.noaccess=U heeft geen toegang tot deze informatie.Sorry.
 
 # Lostpassword.jsp
-
+  
 # 0 = login name, 1 = password, 2 = URL, 3 = Application name (as signature)
 # This is text, not HTML.
 lostpwd.newpassword.email=Zoals aangevraagd, uw nieuwe wachtwoord voor de login "{0}" is "{1}" \

Modified: incubator/jspwiki/trunk/etc/i18n/templates/default.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/templates/default.properties?rev=690485&r1=690484&r2=690485&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/templates/default.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/templates/default.properties Sat Aug 30 02:20:12 2008
@@ -405,6 +405,7 @@
 
 prefs.errorprefix.prefs=Could not save preferences:&nbsp;
 prefs.errorprefix.profile=Could not save profile:&nbsp;
+prefs.errorprefix.rename=Could not rename the page:&nbsp;
 
 prefs.loginname=Login name *
 prefs.loginname.description=This is your login id.

Modified: incubator/jspwiki/trunk/etc/i18n/templates/default_nl.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/templates/default_nl.properties?rev=690485&r1=690484&r2=690485&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/templates/default_nl.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/templates/default_nl.properties Sat Aug 30 02:20:12 2008
@@ -400,6 +400,7 @@
 
 prefs.errorprefix.prefs=De gebruikers instellingen konden niet worden bewaard&nbsp;
 prefs.errorprefix.profile=Het gebruikers profiel kon niet worden bewaard:&nbsp;
+prefs.errorprefix.rename=De pagina kon niet worden hernoemd:&nbsp;
 
 prefs.loginname=Login naam *
 prefs.loginname.description=Dit is uw login id.

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java?rev=690485&r1=690484&r2=690485&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java Sat Aug 30 02:20:12 2008
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "30";
+    public static final String     BUILD         = "31";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/search/SearchManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/search/SearchManager.java?rev=690485&r1=690484&r2=690485&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/search/SearchManager.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/search/SearchManager.java Sat Aug 30 02:20:12 2008
@@ -110,10 +110,19 @@
 
             if( wikiName.length() > 0 )
             {
-                wikiName = MarkupParser.cleanLink(wikiName);
-                wikiName = wikiName.toLowerCase();
+                
+                // split pagename and attachment filename
+                String filename = "";
+                int pos = wikiName.indexOf("/");
+                if( pos >= 0 ) 
+                {
+                    filename = wikiName.substring( pos ).toLowerCase();
+                    wikiName = wikiName.substring( 0, pos );
+                }
+                
+                String cleanWikiName = MarkupParser.cleanLink(wikiName).toLowerCase() + filename;
 
-                String oldStyleName = MarkupParser.wikifyLink(wikiName).toLowerCase();
+                String oldStyleName = MarkupParser.wikifyLink(wikiName).toLowerCase() + filename;
 
                 Set allPages = m_engine.getReferenceManager().findCreated();
 
@@ -122,7 +131,7 @@
                 {
                     String p = (String) i.next();
                     String pp = p.toLowerCase();
-                    if( pp.startsWith( wikiName ) || pp.startsWith( oldStyleName ) )
+                    if( pp.startsWith( cleanWikiName) || pp.startsWith( oldStyleName ) )
                     {
                         list.add( p );
                         counter++;

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/PageCommand.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/PageCommand.java?rev=690485&r1=690484&r2=690485&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/PageCommand.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/PageCommand.java Sat Aug 30 02:20:12 2008
@@ -63,7 +63,7 @@
         = new PageCommand( "preview", "%uPreview.jsp?page=%n", "PreviewContent.jsp", null, PagePermission.VIEW_ACTION );
 
     public static final Command RENAME
-        = new PageCommand( "rename", "%uRename.jsp?page=%n", null, null, PagePermission.RENAME_ACTION );
+        = new PageCommand( "rename", "%uRename.jsp?page=%n", "InfoContent.jsp", null, PagePermission.RENAME_ACTION );
 
     public static final Command RSS
         = new PageCommand( "rss", "%urss.jsp", null, null, PagePermission.VIEW_ACTION );

Modified: incubator/jspwiki/trunk/src/webdocs/Rename.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/Rename.jsp?rev=690485&r1=690484&r2=690485&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/Rename.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/Rename.jsp Sat Aug 30 02:20:12 2008
@@ -17,7 +17,7 @@
     if(!wikiContext.hasAccess( response )) return;
 
     String renameFrom = wikiContext.getName();
-    String renameTo = request.getParameter( "renameto");
+    String renameTo = request.getParameter("renameto");
 
     boolean changeReferences = false;
 
@@ -28,9 +28,6 @@
         changeReferences = true;
     }
 
-    // Set the content type and include the response content
-    response.setContentType("text/html; charset="+wiki.getContentEncoding() );
-
     log.info("Page rename request for page '"+renameFrom+ "' to new name '"+renameTo+"' from "+request.getRemoteAddr()+" by "+request.getRemoteUser() );
 
     WikiSession wikiSession = wikiContext.getWikiSession();
@@ -47,54 +44,39 @@
         }
         else
         {
-            wikiSession.addMessage(rb.getString("rename.empty"));
+            wikiSession.addMessage("rename", rb.getString("rename.empty"));
 
             log.info("Page rename request failed because new page name was left blank");
-
-%>
-            <h3><fmt:message key="rename.error.title"/></h3>
-
-            <dl>
-               <dt><b><fmt:message key="rename.error.reason"/></b></dt>
-               <dd>
-                  <wiki:Messages div="error" />
-               </dd>
-            </dl>
-<%
         }
-
     }
     catch (WikiException e)
     {
-        if (e.getMessage().equals("Page exists"))
+        if (e.getMessage().equals("You cannot rename the page to itself"))
         {
-            if (renameTo.equals( renameFrom ))
-            {
-                log.info("Page rename request failed because page names are identical");
-                wikiSession.addMessage( rb.getString("rename.identical") );
-            }
-            else
-            {
-                log.info("Page rename request failed because new page name is already in use");
-                Object[] args = { renameTo };
-                wikiSession.addMessage(MessageFormat.format(rb.getString("rename.exists"),args));
-            }
+            log.info("Page rename request failed because page names are identical");
+            wikiSession.addMessage("rename", rb.getString("rename.identical") );
+        }
+        else if (e.getMessage().startsWith("Page already exists "))
+        {
+            log.info("Page rename request failed because new page name is already in use");
+            Object[] args = { renameTo };
+            wikiSession.addMessage("rename", MessageFormat.format(rb.getString("rename.exists"),args));
         }
         else
         {
             Object[] args = { e.toString() };
-            wikiSession.addMessage( MessageFormat.format(rb.getString("rename.unknownerror"),args));
+            wikiSession.addMessage("rename",  MessageFormat.format(rb.getString("rename.unknownerror"),args));
         }
 
-%>
-       <h3><fmt:message key="rename.error.title"/></h3>
-
-       <dl>
-          <dt><b><fmt:message key="rename.error.reason"/></b></dt>
-          <dd>
-             <wiki:Messages div="error" />
-          </dd>
-       </dl>
-<%
     }
-%>
+
+    pageContext.setAttribute( "renameto",
+                              TextUtil.replaceEntities( renameTo ),
+                              PageContext.REQUEST_SCOPE );
+
+    response.setContentType("text/html; charset="+wiki.getContentEncoding() );
+    String contentPage = wiki.getTemplateManager().findJSP( pageContext,
+                                                            wikiContext.getTemplate(),
+                                                            "ViewTemplate.jsp" );
+    
+%><wiki:Include page="<%=contentPage%>" />
\ No newline at end of file

Modified: incubator/jspwiki/trunk/src/webdocs/scripts/jspwiki-edit.js
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/scripts/jspwiki-edit.js?rev=690485&r1=690484&r2=690485&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/scripts/jspwiki-edit.js (original)
+++ incubator/jspwiki/trunk/src/webdocs/scripts/jspwiki-edit.js Sat Aug 30 02:20:12 2008
@@ -391,7 +391,8 @@
 		var textarea = this.textarea,
 			sel = TextArea.getSelectionCoordinates(textarea),
 			val = textarea.value,
-			searchword = '';
+			searchword = '',
+			searchlen = 0;
 			
 		var	suggestID = 'findSuggestionMenu',
 			suggest = $(suggestID) || new Element('div',{
@@ -400,21 +401,23 @@
 
 		/* find a partial jspwiki-link 'searchword' */
 		/* look backwards for the start of a wiki-link bracket */
-		for( i = sel.start-1; i >= 0; i-- ){
+		for( var i = sel.start-1; i >= 0; i-- ){
 			if( val.charAt(i) == ']' ) break;
 			if( val.charAt(i) == '[' && i < val.length-1 ) { 
 				searchword = val.substring(i+1,sel.start); 
 				if(searchword.indexOf('|') != -1) searchword = searchword.split('|')[1];
+				searchlen = searchword.length;
+
+				if(searchlen == 0) searchword=Wiki.PageName+'/'; /* by default - get list of attachments, if any */
 				break; 
 			}
 		}
 		if(searchword =='') return suggest.hide();
 
-		var searchlen = searchword.length;		
-
-		if(sel.start == sel.end) { //when no selection, extend till next ]
-			var i = val.indexOf(']',sel.start);
-			if( i>0 ) sel.end = i
+		if(sel.start == sel.end) { //when no selection, extend till next ]  or end of the line
+			var ss = val.substring(sel.start),
+				end = ss.search(/[\n\r\]]/);
+			if(end!=-1) sel.end = sel.start+end;
 		}
 
 		Wiki.jsonrpc('search.getSuggestions', [searchword,30], function(result,exception){

Modified: incubator/jspwiki/trunk/src/webdocs/templates/default/InfoContent.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/templates/default/InfoContent.jsp?rev=690485&r1=690484&r2=690485&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/templates/default/InfoContent.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/templates/default/InfoContent.jsp Sat Aug 30 02:20:12 2008
@@ -16,6 +16,9 @@
   String attTitle = LocaleSupport.getLocalizedMessage(pageContext, "attach.tab");
   if( attCount != 0 ) attTitle += " (" + attCount + ")";
 
+  String parm_renameto = (String)request.getParameter( "renameto" );
+  if( parm_renameto == null ) parm_renameto = wikiPage.getName();
+
   String creationAuthor ="";
 
   //FIXME -- seems not to work correctly for attachments !!
@@ -93,6 +96,11 @@
   </wiki:CheckVersion>
 
   <wiki:Permission permission="rename">
+
+    <div class="formhelp">
+      <wiki:Messages div="error" topic="rename" prefix='<%=LocaleSupport.getLocalizedMessage(pageContext,"prefs.errorprefix.rename")%>'/>
+    </div>
+
     <form action="<wiki:Link format='url' jsp='Rename.jsp'/>"
            class="wikiform"
               id="renameform"
@@ -101,7 +109,7 @@
       <p>
       <input type="hidden" name="page" value="<wiki:Variable var='pagename' />" />
       <input type="submit" name="rename" value="<fmt:message key='info.rename.submit' />" />
-      <input type="text" name="renameto" value="<wiki:Variable var='pagename' />" size="40" />
+      <input type="text" name="renameto" value="<%= parm_renameto %>" size="40" />
       &nbsp;&nbsp;
       <input type="checkbox" name="references" checked="checked" />
       <fmt:message key="info.updatereferrers"/>

Modified: incubator/jspwiki/trunk/src/webdocs/templates/default/PageActionsTop.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/templates/default/PageActionsTop.jsp?rev=690485&r1=690484&r2=690485&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/templates/default/PageActionsTop.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/templates/default/PageActionsTop.jsp Sat Aug 30 02:20:12 2008
@@ -7,7 +7,7 @@
 <div id="actionsTop" class="pageactions"> 
   <ul>
 
-    <wiki:CheckRequestContext context='view|info|diff|upload'>
+    <wiki:CheckRequestContext context='view|info|diff|upload|rename'>
     <wiki:Permission permission="edit">
 	<li>
         <wiki:PageType type="page">

Modified: incubator/jspwiki/trunk/src/webdocs/templates/default/jspwiki.css
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/templates/default/jspwiki.css?rev=690485&r1=690484&r2=690485&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/templates/default/jspwiki.css (original)
+++ incubator/jspwiki/trunk/src/webdocs/templates/default/jspwiki.css Sat Aug 30 02:20:12 2008
@@ -54,6 +54,7 @@
 	float:left;
 	margin-top:1.75em;
 	width:18%;
+	padding:0.5em;
 }
 #favorites .userbox {
 	border:1px solid #ddd;