[ 
https://issues.apache.org/jira/browse/CONNECTORS-1403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15992681#comment-15992681
 ] 

Kishore Kumar commented on CONNECTORS-1403:
-------------------------------------------

Hi [~daddywri],

Please find the answer in the same order as asked

(1) We are already using a standard framework for UI, which is 
[Bootstrap|http://getbootstrap.com/], with little bit knowledge on how to 
define [Forms|http://getbootstrap.com/css/#forms] in Bootstrarp], I think this 
can be achieved. The Access Credentials tab was a bit complex, so I have added 
those collapsible panels. The above javascript in (1) only applicable for 
Access credentials tab and cannot be used as common for the framework unless we 
identify such complexity in any other tab, once identified we can make this 
code generic and move it to *mcf.js*

(2) I will try to re-indent the velocity code in the vm files. Will try to 
indent velocity tags irrespective of html. Do you prefer the indentation to be 
like below

{code:title=editSpecification_Security.html.vm}
#set( $SEQPREFIX = 's' + $SEQNUM + '_' )
#if($TABNAME == $ResourceBundle.getString('WebcrawlerConnector.Security') && 
${SEQNUM} == ${SELECTEDNUM})
<div class="row">
  <div class="col-md-8">
    <ul class="list-group">
  #foreach($TOKEN in $TOKENS)
    #set( $ACCESSDESC = "_" + $foreach.index )
    #set( $ACCESSOPNAME = $SEQPREFIX + "accessop" + $ACCESSDESC )
      <li class="list-group-item">
        <input type="hidden" name="$ACCESSOPNAME" value=""/>
        <input type="hidden" name="${SEQPREFIX}spectoken${ACCESSDESC}" 
value="$Encoder.attributeEscape($TOKEN)" />
        $Encoder.bodyEscape($TOKEN)
        <span class="pull-right">
          <button class="btn btn-xs btn-danger" type="button" 
onClick='Javascript:${SEQPREFIX}SpecOp("$ACCESSOPNAME","Delete","${SEQPREFIX}token_${foreach.index}")'
 
alt="$Encoder.attributeEscape($ResourceBundle.getString('WebcrawlerConnector.DeleteToken'))$foreach.index"><i
 class="fa fa-minus-circle fa-fw" 
aria-hidden="true"></i>$Encoder.attributeEscape($ResourceBundle.getString('WebcrawlerConnector.Delete'))</button>
        </span>
      </li>
  #end
    </ul>
  </div>
</div>
  
  #set( $COUNTER = $TOKENS.size() )
  #if($COUNTER == 0)
<div class="row">
  <div class="col-xs-12">
    <div class="alert 
alert-warning">$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.NoAccessTokensPresent'))</div>
  </div>
</div>
  #end
  
<hr/>
<div class="row">
  <div class="col-md-8 form-inline">
    <div class="form-group">
      <input type="hidden" name="${SEQPREFIX}tokencount" value="$COUNTER"/>
      <input type="hidden" name="${SEQPREFIX}accessop" value=""/>
      <label for="${SEQPREFIX}spectoken" class="sr-only">Token:</label>
      <input class="form-control" type="text" name="${SEQPREFIX}spectoken" 
id="${SEQPREFIX}spectoken" value="" placeholder="Token" />
    </div>
    <button class="btn btn-primary" type="button" 
onClick='Javascript:${SEQPREFIX}SpecAddToken("${SEQPREFIX}token_${COUNTER}")' 
title="$Encoder.attributeEscape($ResourceBundle.getString('WebcrawlerConnector.AddAccessToken'))"><i
 class="fa fa-plus-circle fa-fw" 
aria-hidden="true"></i>$Encoder.attributeEscape($ResourceBundle.getString('WebcrawlerConnector.Add'))</button>
  </div>
</div>
#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
{code}

(3)  I believe .vm is the standard extension used for Velocity templates. By 
using an extension specific to velocity helps me differentiating velocity code 
and errors

(4) Trying to add condition HTML only for page type = form, it was there in the 
previous code
https://github.com/apache/manifoldcf/blob/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java#L2438

(5) The connector UI writer should have a little bit of knowledge of Bootstrap 
framework, all those div class are standard for each component, The extra div 
(rows and cols-*-*) are required to make the application as much responsive as 
possible on smaller devices.

Thanks,
KK


> Update WebCrawler Connector HTML String to Velocity Template
> ------------------------------------------------------------
>
>                 Key: CONNECTORS-1403
>                 URL: https://issues.apache.org/jira/browse/CONNECTORS-1403
>             Project: ManifoldCF
>          Issue Type: Improvement
>          Components: Web connector
>    Affects Versions: ManifoldCF 2.7
>            Reporter: Kishore Kumar
>            Assignee: Kishore Kumar
>            Priority: Minor
>             Fix For: ManifoldCF 2.8
>
>
> Hi,
> I am currently in the process of converting the stringified HTML to Velocity 
> template for WebCrawler connector. This is the first attempt in updating all 
> the connectors to use velocity template.
> I don't know when we are planning for the code freeze but will try to 
> complete by next week.
> Thanks,
> Kishore Kumar



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to