Author: kishore
Date: Wed Apr 26 22:35:19 2017
New Revision: 1792824
URL: http://svn.apache.org/viewvc?rev=1792824&view=rev
Log:
Updated Metadata and Security tabs with Velocity template
Added:
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/webcrawler/editSpecification_Metadata.html.vm
(with props)
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/webcrawler/editSpecification_Security.html.vm
(with props)
Modified:
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
Modified:
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java?rev=1792824&r1=1792823&r2=1792824&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
(original)
+++
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
Wed Apr 26 22:35:19 2017
@@ -2551,6 +2551,49 @@ public class WebcrawlerConnector extends
}
+ private void fillInSecurityTab(Map<String,Object> velocityContext,
IHTTPOutput out, Specification ds)
+ {
+
+ int i = 0;
+
+ // Go through forced ACL
+ Set<String> tokens = new HashSet<>();
+ while (i < ds.getChildCount())
+ {
+ SpecificationNode sn = ds.getChild(i++);
+ if (sn.getType().equals(WebcrawlerConfig.NODE_ACCESS))
+ {
+ String token = sn.getAttributeValue(WebcrawlerConfig.ATTR_TOKEN);
+ tokens.add(token);
+ }
+ }
+
+ velocityContext.put("TOKENS",tokens);
+
+ }
+
+ private void fillInMetadatasTab(Map<String,Object> velocityContext,
IHTTPOutput out, Specification ds)
+ {
+
+ Set<String> excludedHeaders = new HashSet<String>();
+
+ // Now, loop through description
+ int i = 0;
+ while (i < ds.getChildCount())
+ {
+ SpecificationNode sn = ds.getChild(i++);
+ if (sn.getType().equals(WebcrawlerConfig.NODE_EXCLUDEHEADER))
+ {
+ String value = sn.getAttributeValue(WebcrawlerConfig.ATTR_VALUE);
+ excludedHeaders.add(value);
+ }
+ }
+
+
velocityContext.put("POTENTIALLYEXCLUDEDHEADERS",potentiallyExcludedHeaders);
+ velocityContext.put("EXCLUDEDHEADERS",excludedHeaders);
+
+ }
+
/** Output the specification body section.
* This method is called in the body section of a job page which has selected
a repository connection of the
* current type. Its purpose is to present the required form elements for
editing.
@@ -2581,45 +2624,8 @@ public class WebcrawlerConnector extends
fillInMappingsTab(velocityContext,out,ds);
fillInInclusionsTab(velocityContext,out,ds);
fillInExclusionsTab(velocityContext,out,ds);
-
- String seqPrefix = "s"+connectionSequenceNumber+"_";
-
- int i;
- int k;
-
-
-
-
- String exclusions = "";
- String exclusionsIndex = "";
- String exclusionsContentIndex = "";
-
- Set<String> excludedHeaders = new HashSet<String>();
-
- // Now, loop through description
- i = 0;
- while (i < ds.getChildCount())
- {
- SpecificationNode sn = ds.getChild(i++);
- if (sn.getType().equals(WebcrawlerConfig.NODE_EXCLUDES))
- {
- exclusions = sn.getValue();
- if (exclusions == null)
- exclusions = "";
- }
- else if (sn.getType().equals(WebcrawlerConfig.NODE_EXCLUDESCONTENTINDEX))
- {
- exclusionsContentIndex = sn.getValue();
- if (exclusionsContentIndex == null)
- exclusionsContentIndex = "";
- }
- else if (sn.getType().equals(WebcrawlerConfig.NODE_EXCLUDEHEADER))
- {
- String value = sn.getAttributeValue(WebcrawlerConfig.ATTR_VALUE);
- excludedHeaders.add(value);
- }
-
- }
+ fillInSecurityTab(velocityContext,out,ds);
+ fillInMetadatasTab(velocityContext,out,ds);
// Seeds tab
Messages.outputResourceWithVelocity(out,locale,"editSpecification_Seeds.html.vm",velocityContext);
@@ -2631,129 +2637,11 @@ public class WebcrawlerConnector extends
Messages.outputResourceWithVelocity(out,locale,"editSpecification_Inclusions.html.vm",velocityContext);
// Exclusions tab
Messages.outputResourceWithVelocity(out,locale,"editSpecification_Exclusions.html.vm",velocityContext);
-
// Security tab
- // There is no native security, so all we care about are the tokens.
- i = 0;
-
- if
(tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Security")) &&
connectionSequenceNumber == actualSequenceNumber)
- {
- out.print(
-"<table class=\"displaytable\">\n"+
-" <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
- );
- // Go through forced ACL
- i = 0;
- k = 0;
- while (i < ds.getChildCount())
- {
- SpecificationNode sn = ds.getChild(i++);
- if (sn.getType().equals(WebcrawlerConfig.NODE_ACCESS))
- {
- String accessDescription = "_"+Integer.toString(k);
- String accessOpName = seqPrefix+"accessop"+accessDescription;
- String token = sn.getAttributeValue(WebcrawlerConfig.ATTR_TOKEN);
- out.print(
-" <tr>\n"+
-" <td class=\"description\">\n"+
-" <input type=\"hidden\" name=\""+accessOpName+"\" value=\"\"/>\n"+
-" <input type=\"hidden\"
name=\""+seqPrefix+"spectoken"+accessDescription+"\"
value=\""+Encoder.attributeEscape(token)+"\"/>\n"+
-" <a name=\""+seqPrefix+"token_"+Integer.toString(k)+"\">\n"+
-" <input type=\"button\" value=\"" +
Messages.getAttributeString(locale,"WebcrawlerConnector.Delete") + "\"
onClick='Javascript:"+seqPrefix+"SpecOp(\""+accessOpName+"\",\"Delete\",\""+seqPrefix+"token_"+Integer.toString(k)+"\")'
alt=\""+Messages.getAttributeString(locale,"WebcrawlerConnector.DeleteToken")+Integer.toString(k)+"\"/>\n"+
-" </a> \n"+
-" </td>\n"+
-" <td class=\"value\">\n"+
-" "+Encoder.bodyEscape(token)+"\n"+
-" </td>\n"+
-" </tr>\n"
- );
- k++;
- }
- }
- if (k == 0)
- {
- out.print(
-" <tr>\n"+
-" <td class=\"message\" colspan=\"2\">" +
Messages.getBodyString(locale,"WebcrawlerConnector.NoAccessTokensPresent") +
"</td>\n"+
-" </tr>\n"
- );
- }
- out.print(
-" <tr><td class=\"lightseparator\" colspan=\"2\"><hr/></td></tr>\n"+
-" <tr>\n"+
-" <td class=\"description\">\n"+
-" <input type=\"hidden\" name=\""+seqPrefix+"tokencount\"
value=\""+Integer.toString(k)+"\"/>\n"+
-" <input type=\"hidden\" name=\""+seqPrefix+"accessop\" value=\"\"/>\n"+
-" <a name=\""+seqPrefix+"token_"+Integer.toString(k)+"\">\n"+
-" <input type=\"button\" value=\"" +
Messages.getAttributeString(locale,"WebcrawlerConnector.Add") + "\"
onClick='Javascript:"+seqPrefix+"SpecAddToken(\""+seqPrefix+"token_"+Integer.toString(k+1)+"\")'
alt=\"" +
Messages.getAttributeString(locale,"WebcrawlerConnector.AddAccessToken") +
"\"/>\n"+
-" </a> \n"+
-" </td>\n"+
-" <td class=\"value\">\n"+
-" <input type=\"text\" size=\"30\" name=\""+seqPrefix+"spectoken\"
value=\"\"/>\n"+
-" </td>\n"+
-" </tr>\n"+
-"</table>\n"
- );
- }
- else
- {
- // Finally, go through forced ACL
- i = 0;
- k = 0;
- while (i < ds.getChildCount())
- {
- SpecificationNode sn = ds.getChild(i++);
- if (sn.getType().equals(WebcrawlerConfig.NODE_ACCESS))
- {
- String accessDescription = "_"+Integer.toString(k);
- String token = sn.getAttributeValue(WebcrawlerConfig.ATTR_TOKEN);
- out.print(
-"<input type=\"hidden\" name=\""+seqPrefix+"spectoken"+accessDescription+"\"
value=\""+Encoder.attributeEscape(token)+"\"/>\n"
- );
- k++;
- }
- }
- out.print(
-"<input type=\"hidden\" name=\""+seqPrefix+"tokencount\"
value=\""+Integer.toString(k)+"\"/>\n"
- );
- }
-
+
Messages.outputResourceWithVelocity(out,locale,"editSpecification_Security.html.vm",velocityContext);
// "Metadata" tab
- if
(tabName.equals(Messages.getString(locale,"WebcrawlerConnector.Metadata")) &&
connectionSequenceNumber == actualSequenceNumber)
- {
- out.print(
-"<table class=\"displaytable\">\n"+
-" <tr><td class=\"separator\" colspan=\"4\"><hr/></td></tr>\n"+
-" <tr>\n"+
-" <td class=\"description\"><nobr>"+Messages.getBodyString(locale,
"WebcrawlerConnector.ExcludedHeadersColon")+"</nobr></td>\n"+
-" <td class=\"value\" colspan=\"3\">\n"+
-" <input type=\"hidden\" name=\""+seqPrefix+"excludedheaders_present\"
value=\"true\"/>\n"
- );
-
- for (String potentiallyExcludedHeader : potentiallyExcludedHeaders)
- {
- out.print(
-" <input type=\"checkbox\" name=\""+seqPrefix+"excludedheaders\"
value=\""+Encoder.attributeEscape(potentiallyExcludedHeader)+"\""+(excludedHeaders.contains(potentiallyExcludedHeader)?"
checked=\"true\"":"")+">"+Encoder.bodyEscape(potentiallyExcludedHeader)+"</input><br/>\n"
- );
- }
- out.print(
-" </td>\n"+
-" </tr>\n"+
-"</table>\n"
- );
- }
- else
- {
- out.print(
-"<input type=\"hidden\" name=\""+seqPrefix+"excludedheaders_present\"
value=\"true\"/>\n"
- );
- for (String excludedHeader : excludedHeaders)
- {
- out.print(
-"<input type=\"hidden\" name=\""+seqPrefix+"excludedheaders\"
value=\""+Encoder.attributeEscape(excludedHeader)+"\"/>\n"
- );
- }
- }
+
Messages.outputResourceWithVelocity(out,locale,"editSpecification_Metadata.html.vm",velocityContext);
+
}
/** Process a specification post.
Added:
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/webcrawler/editSpecification_Metadata.html.vm
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/webcrawler/editSpecification_Metadata.html.vm?rev=1792824&view=auto
==============================================================================
---
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/webcrawler/editSpecification_Metadata.html.vm
(added)
+++
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/webcrawler/editSpecification_Metadata.html.vm
Wed Apr 26 22:35:19 2017
@@ -0,0 +1,37 @@
+<!--
+ 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.
+-->
+
+#set( $SEQPREFIX = 's' + $SEQNUM + '_' )
+#if($TABNAME == $ResourceBundle.getString('WebcrawlerConnector.Metadata') &&
${SEQNUM} == ${SELECTEDNUM})
+<table class="displaytable">
+ <tr><td class="separator" colspan="4"><hr/></td></tr>
+ <tr>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.ExcludedHeadersColon'))</nobr></td>
+ <td class="value" colspan="3">
+ <input type="hidden" name="${SEQPREFIX}excludedheaders_present"
value="true"/>
+ #foreach($potentiallyExcludedHeader in $POTENTIALLYEXCLUDEDHEADERS)
+ <input type="checkbox" name="${SEQPREFIX}excludedheaders"
value="$Encoder.attributeEscape($potentiallyExcludedHeader)"
#if($EXCLUDEDHEADERS.contains($potentiallyExcludedHeader)) checked="true"
#end>$Encoder.bodyEscape($potentiallyExcludedHeader)</input><br/>
+ #end
+ </td>
+ </tr>
+</table>
+#else
+<input type="hidden" name="${SEQPREFIX}excludedheaders_present" value="true"/>
+ #foreach($potentiallyExcludedHeader in $POTENTIALLYEXCLUDEDHEADERS)
+<input type="hidden" name="${SEQPREFIX}excludedheaders"
value="$Encoder.attributeEscape($potentiallyExcludedHeader)" />
+ #end
+#end
Propchange:
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/webcrawler/editSpecification_Metadata.html.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added:
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/webcrawler/editSpecification_Security.html.vm
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/webcrawler/editSpecification_Security.html.vm?rev=1792824&view=auto
==============================================================================
---
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/webcrawler/editSpecification_Security.html.vm
(added)
+++
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/webcrawler/editSpecification_Security.html.vm
Wed Apr 26 22:35:19 2017
@@ -0,0 +1,66 @@
+<!--
+ 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.
+-->
+
+#set( $SEQPREFIX = 's' + $SEQNUM + '_' )
+#if($TABNAME == $ResourceBundle.getString('WebcrawlerConnector.Security') &&
${SEQNUM} == ${SELECTEDNUM})
+<table class="displaytable">
+ <tr><td class="separator" colspan="2"><hr/></td></tr>
+ #foreach($TOKEN in $TOKENS)
+ #set( $ACCESSDESC = "_" + $foreach.index )
+ #set( $ACCESSOPNAME = $SEQPREFIX + "accessop" + $ACCESSDESC )
+ <tr>
+ <td class="description">
+ <input type="hidden" name="$ACCESSOPNAME" value=""/>
+ <input type="hidden" name="${SEQPREFIX}spectoken${ACCESSDESC}"
value="$Encoder.attributeEscape($TOKEN)" />
+ <a name="${SEQPREFIX}token_${foreach.index}">
+ <input type="button"
value="$Encoder.attributeEscape($ResourceBundle.getString('WebcrawlerConnector.Delete'))"
onClick='Javascript:${SEQPREFIX}SpecOp("$ACCESSOPNAME","Delete","${SEQPREFIX}token_${foreach.index}")'
alt="??"/>
+ </a>
+ </td>
+ <td class="value">
+ $Encoder.bodyEscape($TOKEN)
+ </td>
+ </tr>
+ #end
+ #set( $COUNTER = $TOKENS.size() )
+ #if($COUNTER == 0)
+ <tr>
+ <td class="message"
colspan="2">$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.NoAccessTokensPresent'))</td>
+ </tr>
+ #end
+ <tr><td class="lightseparator" colspan="2"><hr/></td></tr>
+ <tr>
+ <td class="description">
+ <input type="hidden" name="${SEQPREFIX}tokencount" value="?"/>
+ <input type="hidden" name="${SEQPREFIX}accessop" value=""/>
+ <a name="${SEQPREFIX}token_${COUNTER}">
+ <input type="button"
value="$Encoder.attributeEscape($ResourceBundle.getString('WebcrawlerConnector.Add'))"
onClick='Javascript:${SEQPREFIX}SpecAddToken("${SEQPREFIX}token_${COUNTER}")'
alt="$Encoder.attributeEscape($ResourceBundle.getString('WebcrawlerConnector.AddAccessToken'))"/>
+ </a>
+ </td>
+ <td class="value">
+ <input type="text" size="30" name="${SEQPREFIX}spectoken" value="" />
+ </td>
+ </tr>
+</table>
+#else
+ #foreach($TOKEN in $TOKENS)
+ #set( $ACCESSDESC = "_" + $foreach.index )
+ #set( $ACCESSOPNAME = $SEQPREFIX + "accessop" + $ACCESSDESC )
+<input type="hidden" name="${SEQPREFIX}spectoken${ACCESSDESC}"
value="$Encoder.attributeEscape($TOKEN)" />
+ #end
+ #set( $COUNTER = $TOKENS.size() )
+<input type="hidden" name="${SEQPREFIX}tokencount" value="$COUNTER" />
+#end
Propchange:
manifoldcf/branches/CONNECTORS-1403/connectors/webcrawler/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/webcrawler/editSpecification_Security.html.vm
------------------------------------------------------------------------------
svn:eol-style = native