incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1225559 - in /incubator/lcf/branches/release-0.4-incubating-branch: ./ connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/ connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/cra...
Date Thu, 29 Dec 2011 15:33:40 GMT
Author: kwright
Date: Thu Dec 29 15:33:39 2011
New Revision: 1225559

URL: http://svn.apache.org/viewvc?rev=1225559&view=rev
Log:
Fixes for CONNECTORS-343, pulled up and modified from trunk.

Added:
    incubator/lcf/branches/release-0.4-incubating-branch/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/i18n/
    incubator/lcf/branches/release-0.4-incubating-branch/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/i18n/Messages.java   (with props)
Modified:
    incubator/lcf/branches/release-0.4-incubating-branch/CHANGES.txt
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editSpecification.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenConfiguration.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenSpecification.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewConfiguration.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewSpecification.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/editConfiguration.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/hiddenConfiguration.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/hiddenSpecification.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/viewConfiguration.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnector.java
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerParam.java
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/configuration.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/specifications.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/view.html
    incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/viewSpec.html
    incubator/lcf/branches/release-0.4-incubating-branch/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/util/Encoder.java

Modified: incubator/lcf/branches/release-0.4-incubating-branch/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/CHANGES.txt?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/CHANGES.txt (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/CHANGES.txt Thu Dec 29 15:33:39 2011
@@ -3,6 +3,11 @@ $Id$
 
 ======================= 0.4-dev =====================
 
+CONNECTORS-343: Fix lack of proper escaping for values in the
+Alfresco, CMIS, and OpenSearchServer connectors.  Fix broken tabs
+in the Alfresco and CMIS connectors.
+(Karl Wright)
+
 CONNECTORS-342: Fix bad HTML in the File System connector.
 (Karl Wright)
 

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java Thu Dec 29 15:33:39 2011
@@ -27,6 +27,8 @@ import java.io.InterruptedIOException;
 import java.io.UnsupportedEncodingException;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
 
 import org.alfresco.webservice.authentication.AuthenticationFault;
 import org.alfresco.webservice.content.Content;
@@ -411,50 +413,14 @@ public class AlfrescoRepositoryConnector
    */
   private void outputResource(String resName, IHTTPOutput out,
       ConfigParams params) throws ManifoldCFException {
-    InputStream is = getClass().getResourceAsStream(resName);
-    BufferedReader br = null;
-    try {
-      br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
-      String line;
-      while ((line = br.readLine()) != null) {
-        if (params != null) {
-          @SuppressWarnings("unchecked")
-          Iterator<String> i = params.listParameters();
-          boolean parsedLine = false;
-          while (i.hasNext()) {
-            String key = (String) i.next();
-            String value = Encoder.attributeEscape(params.getParameter(key));
-            String replacer = "${" + key.toUpperCase() + "}";
-            if (StringUtils.contains(line, replacer)) {
-              if (StringUtils.isEmpty(value)) {
-                out.println(StringUtils.replace(line, replacer,
-                    StringUtils.EMPTY));
-                parsedLine = true;
-              } else {
-                out.println(StringUtils.replace(line, replacer, value));
-                parsedLine = true;
-              }
-            } else if (StringUtils.contains(line, "${")) {
-              parsedLine = true;
-            } else if (!parsedLine) {
-              out.println(line);
-              parsedLine = true;
-            }
-          }
-        } else {
-          break;
-        }
-      }
-    } catch (UnsupportedEncodingException e) {
-      throw new ManifoldCFException(e);
-    } catch (IOException e) {
-      throw new ManifoldCFException(e);
-    } finally {
-      if (br != null)
-        IOUtils.closeQuietly(br);
-      if (is != null)
-        IOUtils.closeQuietly(is);
+    Map<String,String> paramMap = new HashMap<String,String>();
+    Iterator<String> i = params.listParameters();
+    while(i.hasNext()){
+      String key = i.next();
+      String value = params.getParameter(key);
+      paramMap.put(key,value);
     }
+    org.apache.manifoldcf.ui.i18n.Messages.outputResource(out,getClass(),resName,paramMap,true);
   }
 
   /**

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration.html Thu Dec 29 15:33:39 2011
@@ -28,7 +28,7 @@
 			</nobr>
 		</td>
 		<td class="value">
-			<input id="username" type="text" name="username" value="${USERNAME}" />
+			<input id="username" type="text" name="username" value="${USERNAME:A}" />
 		</td>
 	</tr>
 	<tr>
@@ -38,7 +38,7 @@
 			</nobr>
 		</td>
 		<td class="value">
-			<input id="password" type="password" name="password" value="${PASSWORD}" />
+			<input id="password" type="password" name="password" value="${PASSWORD:A}" />
 		</td>
 	</tr>
 	<tr>
@@ -61,7 +61,7 @@
       </nobr>
     </td>
     <td class="value">
-        <input id="server" name="server" type="text" size="32" value="${SERVER}"/>
+        <input id="server" name="server" type="text" size="32" value="${SERVER:A}"/>
     </td>
   </tr>
   <tr>
@@ -71,7 +71,7 @@
       </nobr>
     </td>
     <td class="value">
-        <input id="port" name="port" type="text" size="5" value="${PORT}" />
+        <input id="port" name="port" type="text" size="5" value="${PORT:A}" />
     </td>
   </tr>
   <tr>
@@ -81,14 +81,14 @@
       </nobr>
     </td>
     <td class="value">
-        <input id="path" name="path" type="text" size="32" value="${PATH}" />
+        <input id="path" name="path" type="text" size="32" value="${PATH:A}" />
     </td>
   </tr>
 </table>
 
 <script type="text/javascript">
 <!--
-var protocol = "${PROTOCOL}";
+var protocol = "${PROTOCOL:BJ}";
 var protocolSelect = document.getElementById("protocol");
 if(protocol=="https"){
   protocolSelect.options[1].selected = true;

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editSpecification.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editSpecification.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editSpecification.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editSpecification.html Thu Dec 29 15:33:39 2011
@@ -29,7 +29,7 @@
 		</td>
 		<td class="value">
 			<nobr>
-				<input type="text" size="120" name="luceneQuery" value="${LUCENEQUERY}" />
+				<input type="text" size="120" name="luceneQuery" value="${LUCENEQUERY:A}" />
 			</nobr>
 		</td>
 	</tr>

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenConfiguration.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenConfiguration.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenConfiguration.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenConfiguration.html Thu Dec 29 15:33:39 2011
@@ -14,9 +14,9 @@
  See the License for the specific language governing permissions and
  limitations under the License.
 -->
-<input type="hidden" name="username" value="${USERNAME}" />
-<input type="hidden" name="password" value="${PASSWORD}" />
-<input type="hidden" name="protocol" value="${PROTOCOL}" />
-<input type="hidden" name="server" value="${SERVER}" />
-<input type="hidden" name="port" value="${PORT}" />
-<input type="hidden" name="path" value="${PATH}" />
\ No newline at end of file
+<input type="hidden" name="username" value="${USERNAME:A}" />
+<input type="hidden" name="password" value="${PASSWORD:A}" />
+<input type="hidden" name="protocol" value="${PROTOCOL:A}" />
+<input type="hidden" name="server" value="${SERVER:A}" />
+<input type="hidden" name="port" value="${PORT:A}" />
+<input type="hidden" name="path" value="${PATH:A}" />
\ No newline at end of file

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenSpecification.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenSpecification.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenSpecification.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/hiddenSpecification.html Thu Dec 29 15:33:39 2011
@@ -14,4 +14,4 @@
  See the License for the specific language governing permissions and
  limitations under the License.
 -->
-<input type="hidden" name="luceneQuery" value="${LUCENEQUERY}" />
\ No newline at end of file
+<input type="hidden" name="luceneQuery" value="${LUCENEQUERY:A}" />
\ No newline at end of file

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewConfiguration.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewConfiguration.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewConfiguration.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewConfiguration.html Thu Dec 29 15:33:39 2011
@@ -24,7 +24,7 @@
 		</td>
 		<td class="value" colspan="3">
 			<nobr>
-				username=${USERNAME}
+				username=${USERNAME:B}
 			</nobr>
 			<br />
       <nobr>
@@ -32,24 +32,22 @@
       </nobr>
 			<br />
 			<nobr>
-				protocol=${PROTOCOL}
+				protocol=${PROTOCOL:B}
 			</nobr>
       <br />
       <nobr>
-        server=${SERVER}
+        server=${SERVER:B}
       </nobr>
       <br />
       <nobr>
-        port=${PORT}
+        port=${PORT:B}
       </nobr>
       <br />
       <nobr>
-        path=${PATH}
+        path=${PATH:B}
       </nobr>
       <br />
 		</td>
 	</tr>
 </table>
 
-<script type="text/javascript">
-</script>
\ No newline at end of file

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewSpecification.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewSpecification.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewSpecification.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/viewSpecification.html Thu Dec 29 15:33:39 2011
@@ -21,15 +21,7 @@
 			Lucene Query:
 		</td>
 		<td class="value">
-			<div id="luceneQueryDiv">${LUCENEQUERY}</div>
+			${LUCENEQUERY:B}
 		</td>
 	</tr>
 </table>
-
-<script type="text/javascript">
-var luceneQuery = "${CMISQUERY}";
-if(luceneQuery.trim()==""){
-  var luceneQueryDiv = document.getElementById("luceneQueryDiv");
-  luceneQueryDiv.innerHTML = "";
-}
-</script>

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java Thu Dec 29 15:33:39 2011
@@ -689,48 +689,14 @@ public class CmisRepositoryConnector ext
    */
   private void outputResource(String resName, IHTTPOutput out,
       ConfigParams params) throws ManifoldCFException {
-    InputStream is = getClass().getResourceAsStream(resName);
-    BufferedReader br = null;
-    try {
-      br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
-      String line;
-      while ((line = br.readLine()) != null) {
-        if (params != null){
-          Iterator i = params.listParameters();
-          boolean parsedLine = false;
-          while(i.hasNext()){
-            String key = (String) i.next();
-            String value = params.getParameter(key);
-            String replacer = "${"+key.toUpperCase()+"}";
-            if(StringUtils.contains(line, replacer)){  
-              if(StringUtils.isEmpty(value)){
-                out.println(StringUtils.replace(line, replacer, StringUtils.EMPTY));
-                parsedLine=true;
-              } else {
-                out.println(StringUtils.replace(line, replacer, value));
-                parsedLine=true;
-              }
-            } else if(StringUtils.contains(line, "${")){
-                parsedLine=true;
-            } else if(!parsedLine){
-                out.println(line);
-                parsedLine=true;
-            }
-          }
-        } else {
-            break;
-        }
-      }
-    } catch (UnsupportedEncodingException e) {
-      throw new ManifoldCFException(e);
-    } catch (IOException e) {
-      throw new ManifoldCFException(e);
-    } finally {
-      if (br != null)
-        IOUtils.closeQuietly(br);
-      if (is != null)
-        IOUtils.closeQuietly(is);
+    Map<String,String> paramMap = new HashMap<String,String>();
+    Iterator<String> i = params.listParameters();
+    while(i.hasNext()){
+      String key = i.next();
+      String value = params.getParameter(key);
+      paramMap.put(key,value);
     }
+    org.apache.manifoldcf.ui.i18n.Messages.outputResource(out,getClass(),resName,paramMap,true);
   }
   
   /**

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/editConfiguration.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/editConfiguration.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/editConfiguration.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/editConfiguration.html Thu Dec 29 15:33:39 2011
@@ -45,7 +45,7 @@
 			</nobr>
 		</td>
 		<td class="value">
-			<input type="text" id="username" name="username" value="${USERNAME}" />
+			<input type="text" id="username" name="username" value="${USERNAME:A}" />
 		</td>
 	</tr>
 	<tr>
@@ -55,7 +55,7 @@
 			</nobr>
 		</td>
 		<td class="value">
-			<input type="password" id="password" name="password" value="${PASSWORD}" />
+			<input type="password" id="password" name="password" value="${PASSWORD:A}" />
 		</td>
 	</tr>
 	<tr>
@@ -78,7 +78,7 @@
       </nobr>
     </td>
     <td class="value">
-        <input id="server" name="server" type="text" size="32" value="${SERVER}"/>
+        <input id="server" name="server" type="text" size="32" value="${SERVER:A}"/>
     </td>
   </tr>
   <tr>
@@ -88,7 +88,7 @@
       </nobr>
     </td>
     <td class="value">
-        <input id="port" name="port" type="text" size="5" value="${PORT}" />
+        <input id="port" name="port" type="text" size="5" value="${PORT:A}" />
     </td>
   </tr>
   <tr>
@@ -98,7 +98,7 @@
       </nobr>
     </td>
     <td class="value">
-        <input id="path" name="path" type="text" size="32" value="${PATH}" />
+        <input id="path" name="path" type="text" size="32" value="${PATH:A}" />
     </td>
   </tr>
 	<tr>
@@ -108,7 +108,7 @@
 			</nobr>
 		</td>
 		<td class="value">
-			<input type="text" id="repositoryId" name="repositoryId" value="${REPOSITORYID}" />
+			<input type="text" id="repositoryId" name="repositoryId" value="${REPOSITORYID:A}" />
 			<nobr>
 				(optional)
 			</nobr>
@@ -118,13 +118,13 @@
 
 <script type="text/javascript">
 <!--
-var binding = "${BINDING}";
+var binding = "${BINDING:BJ}";
 if(binding=="ws"){
   var bindingSelect = document.getElementById("binding");
   bindingSelect.options[1].selected = true;
 }
 
-var protocol = "${PROTOCOL}";
+var protocol = "${PROTOCOL:BJ}";
 var protocolSelect = document.getElementById("protocol");
 if(protocol=="https"){
   protocolSelect.options[1].selected = true;

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification.html Thu Dec 29 15:33:39 2011
@@ -29,7 +29,7 @@
 		</td>
 		<td class="value">
 			<nobr>
-				<input type="text" size="120" name="cmisQuery" value="${CMISQUERY}" />
+				<input type="text" size="120" name="cmisQuery" value="${CMISQUERY:A}" />
 			</nobr>
 		</td>
 	</tr>

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/hiddenConfiguration.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/hiddenConfiguration.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/hiddenConfiguration.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/hiddenConfiguration.html Thu Dec 29 15:33:39 2011
@@ -14,11 +14,11 @@
  See the License for the specific language governing permissions and
  limitations under the License.
 -->
-<input type="hidden" name="username" value="${USERNAME}" />
-<input type="hidden" name="password" value="${PASSWORD}" />
-<input type="hidden" name="protocol" value="${PROTOCOL}" />
-<input type="hidden" name="server" value="${SERVER}" />
-<input type="hidden" name="port" value="${PORT}" />
-<input type="hidden" name="path" value="${PATH}" />
-<input type="hidden" name="binding" value="${BINDING}" />
-<input type="hidden" name="repositoryId" value="${REPOSITORYID}" />
\ No newline at end of file
+<input type="hidden" name="username" value="${USERNAME:A}" />
+<input type="hidden" name="password" value="${PASSWORD:A}" />
+<input type="hidden" name="protocol" value="${PROTOCOL:A}" />
+<input type="hidden" name="server" value="${SERVER:A}" />
+<input type="hidden" name="port" value="${PORT:A}" />
+<input type="hidden" name="path" value="${PATH:A}" />
+<input type="hidden" name="binding" value="${BINDING:A}" />
+<input type="hidden" name="repositoryId" value="${REPOSITORYID:A}" />
\ No newline at end of file

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/hiddenSpecification.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/hiddenSpecification.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/hiddenSpecification.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/hiddenSpecification.html Thu Dec 29 15:33:39 2011
@@ -14,4 +14,4 @@
  See the License for the specific language governing permissions and
  limitations under the License.
 -->
-<input type="hidden" name="cmisQuery" value="${CMISQUERY}" />
\ No newline at end of file
+<input type="hidden" name="cmisQuery" value="${CMISQUERY:A}" />
\ No newline at end of file

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/viewConfiguration.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/viewConfiguration.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/viewConfiguration.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/viewConfiguration.html Thu Dec 29 15:33:39 2011
@@ -24,7 +24,7 @@
 		</td>
 		<td class="value" colspan="3">
 			<nobr>
-				username=${USERNAME}
+				username=${USERNAME:B}
 			</nobr>
 			<br />
       <nobr>
@@ -32,39 +32,29 @@
       </nobr>
 			<br />
 			<nobr>
-				binding=${BINDING}
+				binding=${BINDING:B}
 			</nobr>
 			<br />
 			<nobr>
-        protocol=${PROTOCOL}
+        protocol=${PROTOCOL:B}
       </nobr>
       <br />
       <nobr>
-        server=${SERVER}
+        server=${SERVER:B}
       </nobr>
       <br />
       <nobr>
-        port=${PORT}
+        port=${PORT:B}
       </nobr>
       <br />
       <nobr>
-        path=${PATH}
+        path=${PATH:B}
       </nobr>
       <br />
-			<nobr>
-        <div id="repositoryIdDiv"></div>
+      <nobr>
+        repositoryId=${REPOSITORYID:B}
       </nobr>
       <br />
 		</td>
 	</tr>
 </table>
-
-<script type="text/javascript">
-var repositoryId = "${REPOSITORYID}";
-var repositoryIdField = document.getElementById("repositoryIdDiv");
-if(repositoryId!=null && repositoryId!="" && repositoryId!=undefined){
-  repositoryIdField.innerHTML = "repositoryId=" + repositoryId;
-} else {
-  repositoryIdField.innerHTML = "";
-}
-</script>
\ No newline at end of file

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/cmis/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html Thu Dec 29 15:33:39 2011
@@ -21,15 +21,7 @@
 			CMIS Query:
 		</td>
 		<td class="value">
-			<div id="cmisQueryDiv">${CMISQUERY}</div>
+			${CMISQUERY:B}
 		</td>
 	</tr>
 </table>
-
-<script type="text/javascript">
-var cmisQuery = "${CMISQUERY}";
-if(cmisQuery.trim()==""){
-  var cmisQueryDiv = document.getElementById("cmisQueryDiv");
-  cmisQueryDiv.innerHTML = "";
-}
-</script>

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnector.java?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnector.java (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnector.java Thu Dec 29 15:33:39 2011
@@ -84,26 +84,7 @@ public class OpenSearchServerConnector e
    */
   private void outputResource(String resName, IHTTPOutput out,
       OpenSearchServerParam params) throws ManifoldCFException {
-    InputStream is = getClass().getResourceAsStream(resName);
-    BufferedReader br = null;
-    try {
-      br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
-      String line;
-      while ((line = br.readLine()) != null)
-        if (params != null)
-          out.println(params.replace(line));
-        else
-          out.println(line);
-    } catch (UnsupportedEncodingException e) {
-      throw new ManifoldCFException(e);
-    } catch (IOException e) {
-      throw new ManifoldCFException(e);
-    } finally {
-      if (br != null)
-        IOUtils.closeQuietly(br);
-      if (is != null)
-        IOUtils.closeQuietly(is);
-    }
+    org.apache.manifoldcf.ui.i18n.Messages.outputResource(out,getClass(),resName,(params==null)?null:params.buildMap(),false);
   }
 
   @Override

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerParam.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerParam.java?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerParam.java (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerParam.java Thu Dec 29 15:33:39 2011
@@ -73,16 +73,11 @@ public class OpenSearchServerParam exten
     super(params.length);
   }
 
-  /**
-   * Replace the variables ${PARAMNAME} with the value contained in the set.
-   * 
-   * @param text
-   * @return
-   */
-  final public String replace(String text) {
+  final public Map<String,String> buildMap() {
+    Map<String,String> rval = new HashMap<String,String>();
     for (Map.Entry<ParameterEnum, String> entry : this.entrySet())
-      text = text.replace("${" + entry.getKey().name() + "}", entry.getValue());
-    return text;
+      rval.put(entry.getKey().name(), entry.getValue());
+    return rval;
   }
 
 }

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/configuration.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/configuration.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/configuration.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/configuration.html Thu Dec 29 15:33:39 2011
@@ -19,22 +19,22 @@
 	<tr>
 		<td class="description"><nobr>Server Location</nobr> (URL):</td>
 		<td class="value"><input name="serverlocation"
-			value="${SERVERLOCATION}" size="48" />
+			value="${SERVERLOCATION:A}" size="48" />
 		</td>
 	</tr>
 	<tr>
 		<td class="description"><nobr>Index name:</nobr></td>
-		<td class="value"><input name="indexname" value="${INDEXNAME}"
+		<td class="value"><input name="indexname" value="${INDEXNAME:A}"
 			size="24" /></td>
 	</tr>
 	<tr>
 		<td class="description"><nobr>User name:</nobr></td>
-		<td class="value"><input name="username" value="${USERNAME}"
+		<td class="value"><input name="username" value="${USERNAME:A}"
 			size="24" /></td>
 	</tr>
 	<tr>
 		<td class="description"><nobr>API Key:</nobr></td>
-		<td class="value"><input name="apikey" value="${APIKEY}"
+		<td class="value"><input name="apikey" value="${APIKEY:A}"
 			size="40" /></td>
 	</tr>
 </table>
\ No newline at end of file

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/specifications.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/specifications.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/specifications.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/specifications.html Thu Dec 29 15:33:39 2011
@@ -19,17 +19,17 @@
 	<tr>
 		<td class="description"><nobr>Max file size</nobr> (bytes):</td>
 		<td class="value"><input name="maxfilesize"
-			value="${MAXFILESIZE}" size="24" /></td>
+			value="${MAXFILESIZE:A}" size="24" /></td>
 	</tr>
 	<tr>
 		<td class="description"><nobr>Allowed MIME Types :</nobr>
 		</td>
-		<td class="value"><textarea rows="10" cols="64" name="mimetypes">${MIMETYPES}</textarea>
+		<td class="value"><textarea rows="10" cols="64" name="mimetypes">${MIMETYPES:B}</textarea>
 		</td>
 	</tr>
 	<tr>
 		<td class="description"><nobr>Allowed file</nobr> extensions:</td>
-		<td class="value"><textarea rows="10" cols="12" name="extensions">${EXTENSIONS}</textarea>
+		<td class="value"><textarea rows="10" cols="12" name="extensions">${EXTENSIONS:B}</textarea>
 		</td>
 	</tr>
 </table>
\ No newline at end of file

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/view.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/view.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/view.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/view.html Thu Dec 29 15:33:39 2011
@@ -18,18 +18,18 @@
 <table class="displaytable">
 	<tr>
 		<td class="description"><nobr>Server Location</nobr> (URL):</td>
-		<td class="value">${SERVERLOCATION}</td>
+		<td class="value">${SERVERLOCATION:B}</td>
 	</tr>
 	<tr>
 		<td class="description"><nobr>Index name:</nobr></td>
-		<td class="value">${INDEXNAME}</td>
+		<td class="value">${INDEXNAME:B}</td>
 	</tr>
 	<tr>
 		<td class="description"><nobr>User name:</nobr></td>
-		<td class="value">${USERNAME}</td>
+		<td class="value">${USERNAME:B}</td>
 	</tr>
 	<tr>
 		<td class="description"><nobr>API Key:</nobr></td>
-		<td class="value">${APIKEY}</td>
+		<td class="value">${APIKEY:B}</td>
 	</tr>
 </table>
\ No newline at end of file

Modified: incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/viewSpec.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/viewSpec.html?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/viewSpec.html (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/connectors/opensearchserver/connector/src/main/resource/org/apache/manifoldcf/agents/output/opensearchserver/viewSpec.html Thu Dec 29 15:33:39 2011
@@ -18,14 +18,14 @@
 <table class="displaytable">
 	<tr>
 		<td class="description"><nobr>Max file size</nobr> (bytes):</td>
-		<td class="value">${MAXFILESIZE}</td>
+		<td class="value">${MAXFILESIZE:B}</td>
 	</tr>
 	<tr>
 		<td class="description"><nobr>Allowed MIME types:</nobr></td>
-		<td class="value">${MIMETYPES}</td>
+		<td class="value">${MIMETYPES:B}</td>
 	</tr>
 	<tr>
 		<td class="description"><nobr>Allowed file</nobr> extensions:</td>
-		<td class="value">${EXTENSIONS}</td>
+		<td class="value">${EXTENSIONS:B}</td>
 	</tr>
 </table>
\ No newline at end of file

Added: incubator/lcf/branches/release-0.4-incubating-branch/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/i18n/Messages.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/i18n/Messages.java?rev=1225559&view=auto
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/i18n/Messages.java (added)
+++ incubator/lcf/branches/release-0.4-incubating-branch/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/i18n/Messages.java Thu Dec 29 15:33:39 2011
@@ -0,0 +1,116 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.ui.i18n;
+
+import java.util.Map;
+import java.util.Iterator;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.BufferedReader;
+import java.io.IOException;
+
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
+
+import org.apache.manifoldcf.ui.util.Encoder;
+
+public class Messages
+{
+  /** Write a resource to HTTP output, specifying what to substitute, and more importantly, how.
+  * ${PARAM_NAME} will be substituted directly with the value.
+  * ${PARAM_NAME:A} will be substituted with HTML attribute-escaped value.
+  * ${PARAM_NAME:B} will be substituted with HTML body-escaped value.
+  * ${PARAM_NAME:AJ} will be substituted with HTML attribute + Javascript escaped value.
+  * ${PARAM_NAME:BJ} will be substituted with HTML body + Javascript escaped value.
+  */
+  public static void outputResource(IHTTPOutput output, Class classInstance,
+    String resourceKey, Map<String,String> substitutionParameters, boolean mapToUpperCase)
+    throws ManifoldCFException
+  {
+    try
+    {
+      InputStream is = classInstance.getResourceAsStream(resourceKey);
+      if (is == null)
+        throw new ManifoldCFException("Missing resource '"+resourceKey+"'");
+      try
+      {
+        BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+        String line;
+        while ((line = br.readLine()) != null)
+        {
+          if (substitutionParameters != null)
+          {
+            Iterator<String> i = substitutionParameters.keySet().iterator();
+            boolean parsedLine = false;
+            while(i.hasNext())
+            {
+              String key = i.next();
+              String value = substitutionParameters.get(key);
+              if (mapToUpperCase)
+                key = key.toUpperCase();
+              if (value == null)
+                value = "";
+              //System.out.println("Processed key = '"+key+"', processed value = '"+value+"'");
+              // We replace 4x, with 4 different replacement strings
+              line = doReplace(line,"${"+key+"}",value);
+              line = doReplace(line,"${"+key+":A}",Encoder.attributeEscape(value));
+              line = doReplace(line,"${"+key+":B}",Encoder.bodyEscape(value));
+              line = doReplace(line,"${"+key+":AJ}",Encoder.attributeJavascriptEscape(value));
+              line = doReplace(line,"${"+key+":BJ}",Encoder.bodyJavascriptEscape(value));
+            }
+          }
+          output.println(line);
+        }
+      }
+      finally
+      {
+        is.close();
+      }
+    }
+    catch (IOException e)
+    {
+      throw new ManifoldCFException(e.getMessage(),e);
+    }
+  }
+
+  private static String doReplace(String line, String key, String value)
+  {
+    if (line.indexOf(key) == -1)
+    {
+      return line;
+    }
+    StringBuilder sb = new StringBuilder();
+    int index = 0;
+    while (true)
+    {
+      int newIndex = line.indexOf(key,index);
+      if (newIndex == -1)
+      {
+        sb.append(line.substring(index));
+        break;
+      }
+      sb.append(line.substring(index,newIndex)).append(value);
+      index = newIndex + key.length();
+    }
+    return sb.toString();
+  }
+  
+
+}

Propchange: incubator/lcf/branches/release-0.4-incubating-branch/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/i18n/Messages.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/branches/release-0.4-incubating-branch/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/i18n/Messages.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/lcf/branches/release-0.4-incubating-branch/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/util/Encoder.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/release-0.4-incubating-branch/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/util/Encoder.java?rev=1225559&r1=1225558&r2=1225559&view=diff
==============================================================================
--- incubator/lcf/branches/release-0.4-incubating-branch/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/util/Encoder.java (original)
+++ incubator/lcf/branches/release-0.4-incubating-branch/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/util/Encoder.java Thu Dec 29 15:33:39 2011
@@ -46,6 +46,31 @@ public class Encoder
     return attributeEscape(rval.toString());
   }
 
+  /** Escape a string that's in an html body (script) area and thence inside javascript.
+  *@param value is the input.
+  *@return the escaped string.
+  */
+  public static String bodyJavascriptEscape(String value)
+  {
+    StringBuilder rval = new StringBuilder();
+    int i = 0;
+    while (i < value.length())
+    {
+      char x = value.charAt(i++);
+      // First level of encoding: javascript string
+      if (x == '\\' || x == '"' || x == '\'')
+      {
+        rval.append("\\").append(x);
+      }
+      else
+        rval.append(x);
+    }
+    // Body escaping does not seem to be necessary inside <script></script>
+    // blocks, at least when <!-- and //--> surround it.
+    //return bodyEscape(rval.toString());
+    return rval.toString();
+  }
+
   /** Escape a string that's inside an html attribute.
   *@param value is the input.
   *@return the escaped string.



Mime
View raw message