manifoldcf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karl Wright (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CONNECTORS-1403) Update WebCrawler Connector HTML String to Velocity Template
Date Tue, 02 May 2017 08:55:04 GMT

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

Karl Wright commented on CONNECTORS-1403:
-----------------------------------------

[~kishorekumar], I've looked a bit at the code.  Some comments.

(1) Since this is the first connector to use the new UI style, I think we have to be very
careful to make these changes in a manner that other people can easily replicate for other
connectors.  I don't see that this code quite achieves that yet.  Let's work for a while longer
to get it to the point where it meets that goal.  I expect we will be needing to add connector
support in the framework javascript to accomplish it.  As a simple example, this method seems
like it would be something that all connectors would need to do:

{code}
<script type="text/javascript">
  $(function(){
      $('#accordion-session-access .btn-danger').hover(function(){
        $(this).closest('.panel').removeClass('panel-default').addClass('panel-danger');
      },function(){
        $(this).closest('.panel').removeClass('panel-danger').addClass('panel-default');
      });

      $('.collapse').on('shown.bs.collapse', function () {
        var collapseId = $(this).attr("id");
        if(window.sessionStorage){
          sessionStorage.setItem("webcrawler_session_collapse",collapseId)
        }
      })

      //if post-back, open the same collapse
      if(window.sessionStorage){
        if(sessionStorage.getItem("webcrawler_session_collapse")){
          var collapseId = sessionStorage.getItem("webcrawler_session_collapse");
          if(collapseId) {
              //Remove the previous selected Pane.
            $("#accordion-session-access .in").removeClass("in");

            $('#' + collapseId).collapse("show");
          }
        }
      }
  });
</script>
{code}

(2) The indentation of the Velocity template commands doesn't line up for me and I'm therefore
having trouble following the code.  I try to have the indent level of the Velocity commands
operate independently of the HTML they are embedded in.  It would help greatly to check the
formatting and adjust this so I can read the code easier.

(3) Switching the extension of the velocity templates from (*.js, *.html)  to (*.js.vm, *.html.vm)
makes my editor (at least) not recognize the code as fundamentally Javascript or HTML.  While
I can reprogram accordingly, I am wondering why you chose to do that?

(4) Looking at editConfiguration_Access.vm.html, there's code that I don't understand here
that also seems like it should somehow be a framework responsibility.  Can you fill me in
on what the purpose is of the following conditional:

{code}
        #if($authPageMap["pageType"] == "form")
...
{code}

(5) Most of the <div> classes, and why they are the appropriate ones to use, seem opaque
to me, as does the level of nesting.  Is there any way to abstract from these so that the
connector UI writer has less flexibility but also a lot less to worry about?  For example,
have a look at editConfiguration_Access.html:

{code}
...
      <div class="panel panel-default">
        <div class="panel-body">
          <div class="row">
            <div class="col-md-12">
              <div class="form-group">
                <div class="row">
                  <div class="col-md-4">
                    <label class="control-label" for="${PREFIX}_loginpageregexp">$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.LoginURLRegularExpression'))</label>
                    <input class="form-control" type="text" size="30" name="${PREFIX}_loginpageregexp"
id="${PREFIX}_loginpageregexp" value=""/>
                  </div>
                  <div class="col-md-8">
                    <label class="control-label">$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.PageType'))</label>
                    <div class="checkbox">
                      <label class="checkbox-inline"><input type="radio" name="${PREFIX}_loginpagetype"
value="form" checked=""/>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.FormName'))</label>
                      <label class="checkbox-inline"><input type="radio" name="${PREFIX}_loginpagetype"
value="link"/>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.LinkTarget'))</label>
                      <label class="checkbox-inline"><input type="radio" name="${PREFIX}_loginpagetype"
value="redirection"/>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.RedirectionTo'))</label>
                      <label class="checkbox-inline"><input type="radio" name="${PREFIX}_loginpagetype"
value="content"/>$Encoder.bodyEscape($ResourceBundle.getString('WebcrawlerConnector.PageContent'))</label>
                    </div>
...
{code}

Honestly, this is way more UI detail than you could ever hope to get from a connector author.

Thanks!

> 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)

Mime
View raw message