Skip to content

Commit

Permalink
"RDFViewer button for SPARQL construct queries" #149 : URL Encode SPA…
Browse files Browse the repository at this point in the history
…RQL service URI
  • Loading branch information
jmvanel committed Mar 22, 2017
1 parent 8295924 commit 16099a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ trait DefaultConfiguration extends Configuration {

/** URI Prefix prepended to newly created resource instances */
override val defaultInstanceURIHostPrefix =
"http://ldp.virtual-assembly.org"
// "http://ldp.virtual-assembly.org"
"http://semantic-forms.cc"

override val relativeURIforCreatedResourcesByForm = "ldp/"
override val relativeURIforCreatedResourcesByLDP = relativeURIforCreatedResourcesByForm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ trait ToolsPage extends EnterButtons
toolname: String = "RDF Viewer",
imgWidth: Int = 15): NodeSeq = {

val sparqlServicePrefix = "/sparlq?query="
val sparqlServicePrefix = URLEncoder.encode("/sparlq?query=", "UTF-8")
val buttonId = textareaId+"-button"
println(s"servicesURIPrefix $servicesURIPrefix")
val servicesURL = s"$toolURLprefix$servicesURIPrefix$sparqlServicePrefix"
val servicesURIPrefixEncoded = URLEncoder.encode(servicesURIPrefix, "UTF-8")
val servicesURL = s"$toolURLprefix$servicesURIPrefixEncoded$sparqlServicePrefix"
println(s"servicesURL $servicesURL")

<button id={buttonId}
Expand All @@ -115,7 +116,7 @@ trait ToolsPage extends EnterButtons
var url = '$servicesURL' + window.encodeURIComponent(query) ;
console.log( 'URL ' + url );
// console.log( 'startsWith ' + ( '$sparqlServicePrefix' . startsWith ('/') ) );
if( ! '$sparqlServicePrefix' . startsWith ('/') )
if( ! ${servicesURIPrefix.contains(":")} )
window.open( url , '_blank' );
else
console.log( 'RDFViewer works only on a hosted Internet serverURL !!!' );
Expand Down

0 comments on commit 16099a4

Please sign in to comment.