Return-Path: X-Original-To: apmail-jena-commits-archive@www.apache.org Delivered-To: apmail-jena-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 922111007C for ; Tue, 12 Nov 2013 00:37:40 +0000 (UTC) Received: (qmail 68761 invoked by uid 500); 12 Nov 2013 00:37:40 -0000 Delivered-To: apmail-jena-commits-archive@jena.apache.org Received: (qmail 68362 invoked by uid 500); 12 Nov 2013 00:37:40 -0000 Mailing-List: contact commits-help@jena.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jena.apache.org Delivered-To: mailing list commits@jena.apache.org Received: (qmail 68216 invoked by uid 99); 12 Nov 2013 00:37:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Nov 2013 00:37:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Nov 2013 00:37:38 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5AE78238889B; Tue, 12 Nov 2013 00:37:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1540899 - in /jena/branches/jena-fuseki-new-ui/pages/js/app: controllers/validation-controller.js models/validation-options.js services/validation-service.js Date: Tue, 12 Nov 2013 00:37:18 -0000 To: commits@jena.apache.org From: ijd@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131112003718.5AE78238889B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ijd Date: Tue Nov 12 00:37:17 2013 New Revision: 1540899 URL: http://svn.apache.org/r1540899 Log: Progress on validation, but needs to strip out HTML content Modified: jena/branches/jena-fuseki-new-ui/pages/js/app/controllers/validation-controller.js jena/branches/jena-fuseki-new-ui/pages/js/app/models/validation-options.js jena/branches/jena-fuseki-new-ui/pages/js/app/services/validation-service.js Modified: jena/branches/jena-fuseki-new-ui/pages/js/app/controllers/validation-controller.js URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/pages/js/app/controllers/validation-controller.js?rev=1540899&r1=1540898&r2=1540899&view=diff ============================================================================== --- jena/branches/jena-fuseki-new-ui/pages/js/app/controllers/validation-controller.js (original) +++ jena/branches/jena-fuseki-new-ui/pages/js/app/controllers/validation-controller.js Tue Nov 12 00:37:17 2013 @@ -9,14 +9,17 @@ define( ValidationService = require( "services/validation-service" ); var ValidationController = function() { - this.initEvents(); this.initServices(); + this.initEvents(); }; // add the behaviours defined on the controller _.extend( ValidationController.prototype, { initEvents: function() { fui.vent.on( "models.validation-options.ready", this.onValidationOptionsModelReady ); + $(".validation").on( "click", "a.perform-validation", function( event ) { + fui.services.validation.performValidation( fui.views.validationOptions.model ); + } ); }, onValidationOptionsModelReady: function( e ) { Modified: jena/branches/jena-fuseki-new-ui/pages/js/app/models/validation-options.js URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/pages/js/app/models/validation-options.js?rev=1540899&r1=1540898&r2=1540899&view=diff ============================================================================== --- jena/branches/jena-fuseki-new-ui/pages/js/app/models/validation-options.js (original) +++ jena/branches/jena-fuseki-new-ui/pages/js/app/models/validation-options.js Tue Nov 12 00:37:17 2013 @@ -43,6 +43,21 @@ define( this.set( "outputFormat", of ); }, + validationURL: function() { + switch (this.get( "validateAs" )) { + case "sparql": return "/validate/query"; + case "arq": return "/validate/query"; + case "Turtle": return "/validate/data"; + case "TriG": return "/validate/data"; + case "N-Triples": return "/validate/data"; + case "N-Quads": return "/validate/data"; + } + }, + + payloadParam: function() { + return this.validateAsQuery() ? "query" : "data"; + }, + toJSON: function() { var json = { languageSyntax: this.validateAs(), Modified: jena/branches/jena-fuseki-new-ui/pages/js/app/services/validation-service.js URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/pages/js/app/services/validation-service.js?rev=1540899&r1=1540898&r2=1540899&view=diff ============================================================================== --- jena/branches/jena-fuseki-new-ui/pages/js/app/services/validation-service.js (original) +++ jena/branches/jena-fuseki-new-ui/pages/js/app/services/validation-service.js Tue Nov 12 00:37:17 2013 @@ -33,6 +33,28 @@ define( ['underscore', 'jquery', 'fui', } ); } return this._output; + }, + + /** Return the current code editor contents */ + editorContent: function() { + return this.editorElement().getValue(); + }, + + /** Perform the given action to validate the current content */ + performValidation: function( optionsModel ) { + var self = this; + var content = {}; + content[optionsModel.payloadParam()] = this.editorContent(); + + var options = { + data: _.extend( optionsModel.toJSON(), content ), + type: "POST" + }; + + $.ajax( optionsModel.validationURL(), options ) + .done( function( data ) { + self.outputElement().setValue( data ); + } ); } } );