jQuery(document).ready(function(){ jQuery(".ui-icon-plus").live("click",function(){ jQuery(this).removeClass("ui-icon-plus").addClass("ui-icon-minus").closest("div").find("table:eq(1)").show(); }); jQuery(".ui-icon-minus").live("click",function(){ jQuery(this).removeClass("ui-icon-minus").addClass("ui-icon-plus").closest("div").find("table:eq(1)").hide(); }); }); var errorIcon = ''; var warningIcon=''; var noteIcon=''; function printCommonMistakesValidationResult(json){ var issuesNo =0; var html = []; html.push(''); if(!json){ append2ColumnRow(html,"Server error no validation results") showTab("#tabs-common-mistakes-validation-tab"); }else{ if(json.status=="ok"){ var results = json.results; if(json.rules && json.rules.length>0){ var rules=""; printMessageWindow("#tabs-COMMON-MISTAKES-VALIDATION div.msg","The following fixes have been applied to the document:
"+rules,"warning"); printMessageWindow("#tabs-TRIPLES div.msg","The following fixes have been applied to the document:
"+rules+ "
Some of the triples have been extracted because your document has been fixed." ,"warning"); } if(results.length==0){ append1ColumnRow(html,"Valid document","validationResult valid"); makeTabValid("#tabs-common-mistakes-validation-tab"); }else{ issuesNo = results.length; append1ColumnRow(html,"Invalid document","validationResult invalid") append2ColumnRow(html,'issues:',issuesNo,"propertyName plus","propertyValue"); makeTabInvalid("#tabs-common-mistakes-validation-tab",issuesNo); } }else{ showTab("#tabs-common-mistakes-validation-tab"); for(var i=0;i
'); // collapse table if it has more then 10 issues printStartTagOffIssuesTable(issuesNo,html); if(json && json.status=="ok"){ var results = json.results; for(var i=0;i'); jQuery("#tabs-COMMON-MISTAKES-VALIDATION") .find("div.desc").show() .end() .find("div.result").append(html.join('')).show(); } function printW3cMarkupValidationResult(json){ var issuesNo=0; var issuesNo =0; var html = []; html.push(''); if(json){ if(json.status=="ok"){ append2ColumnRow(html,"uri:",json.uri,"propertyName","propertyValue") append2ColumnRow(html,"doctype:",json.doctype,"propertyName","propertyValue") append2ColumnRow(html,"charset:",json.charset,"propertyName","propertyValue") if(json.validity=="true"){ append1ColumnRow(html,"Valid document","validationResult valid") makeTabValid("#tabs-syntax-validation-tab"); }else{ issuesNo = json.errors.errorlist.length+json.warnings.warninglist.length; append1ColumnRow(html,"Invalid document","validationResult invalid") append2ColumnRow(html,'issues:','errors: '+json.errors.errorlist.length+', warnings: '+json.warnings.warninglist.length+'',"plus"); makeTabInvalid("#tabs-syntax-validation-tab", issuesNo); } }else{ showTab("#tabs-syntax-validation-tab"); printError(html,json.error); } }else{ showTab("#tabs-syntax-validation-tab"); printError(html,"Error no json results"); } html.push('
'); printStartTagOffIssuesTable(issuesNo,html); if(json && json.status=="ok"){ if(json.errors){ var errorList = json.errors.errorlist; for(var i=0;i'); html.push(''); html.push('Line: '+ line + ', Column: '+col+': '+message+''); html.push(explanation); html.push(''+ source +''); html.push(''); } } if(json.warnings){ var warningList = json.warnings.warninglist; for(var i=0;i'); html.push(''); html.push('Line: '+ line + ', Column: '+col+': '+message+''); html.push(explanation); html.push(''+ source +''); html.push(''); } } } html.push(''); jQuery("#tabs-SYNTAX-VALIDATION") .find("div.desc").show() .end() .find("div.result").append(html.join('')).show(); } function printW3cRdfValidationResult(json){ var issuesNo =0; var html = []; html.push(''); if(!json){ showTab("#tabs-rdf-syntax-validation-tab"); append2ColumnRow(html,"Error no json results") }else{ if(json.status=="ok"){ if(json.results.length==0){ append1ColumnRow(html,"Valid document","validationResult valid") makeTabValid("#tabs-rdf-syntax-validation-tab"); }else{ issuesNo = json.results.length; append1ColumnRow(html,"Invalid document","validationResult invalid"); append2ColumnRow(html,'issues:',issuesNo,"propertyName plus","propertyValue"); makeTabInvalid("#tabs-rdf-syntax-validation-tab",issuesNo); } }else{ showTab("#tabs-rdf-syntax-validation-tab"); printError(html,json.error); } } html.push('
'); printStartTagOffIssuesTable(issuesNo,html); if(json && json.status=="ok"){ var results = json.results; for(var i=0;i'); jQuery("#tabs-RDF-SYNTAX-VALIDATION") .find("div.desc").show() .end() .find("div.result").append(html.join('')).show(); } function printRdfValidationResult(json){ var issuesNo=0; var html = []; html.push(''); if(json){ if(json.status=="okay"){ var errors =[]; var errorsNo=0; var warnings =[]; var warningsNo=0; var notes =[]; var notesNo =0; var results = json.results; for(var i=0;iissues:', 'errors:'+errorsNo+''+errorIcon+ ', warnings '+warningsNo+''+warningIcon+ ', notes: '+notesNo+''+noteIcon, "propertyName plus", "propertyValue"); makeTabInvalid("#tabs-pedantic-validation-tab",issuesNo); } }else{ showTab("#tabs-pedantic-validation-tab"); printError(html,json.error); } }else{ showTab("#tabs-pedantic-validation-tab"); printError(html,"Error no json results"); } html.push('
'); printStartTagOffIssuesTable(issuesNo,html) if(json && json.status=="okay"){ html.push(errors.join('')); html.push(warnings.join('')); html.push(notes.join('')); } html.push(''); jQuery("#tabs-PEDANTIC-VALIDATION") .find("div.desc").show() .end() .find("div.result").append(html.join('')).show(); } function append1ColumnRow(html,msg,classes1){ if(!classes1){ classes1=''; }else{ classes1='class="'+classes1+'"'; } html.push(''); html.push(''); html.push(msg); html.push(''); html.push(''); } function append2ColumnRow(html,msg1,msg2,classes1,classes2){ if(!classes1){ classes1=""; } if(!classes2){ classes2=""; } html.push(''); html.push(''); html.push(msg1); html.push(''); html.push(msg2); html.push(''); html.push(''); } function printError(html,errorMsg){ html.push(''); html.push(errorMsg); html.push(''); } function printIssue(html,issue){ var type = issue.type; var codeNo = issue.code; if(!codeNo){codeNo="0";} var msg = issue['msg'].replace(//g,">"); html.push(''); html.push(''); if(type=='FatalError'){ html.push(errorIcon); }else if(type=="error"){ html.push(errorIcon); }else if(type=="warning"){ html.push(warningIcon); }else if(type=='note'){ html.push(noteIcon); } html.push(''); html.push(''); html.push(msg); html.push(''); html.push(''); } function showTab(selector){ jQuery(selector).parent().show(); } function makeTabValid(selector){ jQuery(selector).find("span").empty().end().css("color","green").parent().addClass("ui-state-default").show(); } var allTabsValid = true; function selectValidationTab(selector){ if(allTabsValid==true){ VALIDATION_TABS.tabs('select', selector); } } function makeTabInvalid(selector,no){ var tot = jQuery("#tabs-validation-tab span").text(); if(tot==""){ tot=0; }else{ tot = parseInt(tot.substring(1,tot.length-1)); } tot += parseInt(no); jQuery("#tabs-validation-tab").find("span").text("("+tot+")").end().css("color","red").parent().removeClass("ui-state-active").addClass("ui-state-default").show(); jQuery(selector).find("span").text("("+no+")").end().css("color","red").parent().removeClass("ui-state-active").addClass("ui-state-default").show(); if(selector=="#tabs-syntax-validation-tab"){ VALIDATION_TABS.tabs("select","#tabs-SYNTAX-VALIDATION"); }else if(selector=="#tabs-rdf-syntax-validation-tab"){ VALIDATION_TABS.tabs("select","#tabs-RDF-SYNTAX-VALIDATION"); }else if(selector=="#tabs-common-mistakes-validation-tab"){ VALIDATION_TABS.tabs("select","#tabs-COMMON-MISTAKES-VALIDATION"); }else if(selector=="#tabs-pedantic-validation-tab"){ VALIDATION_TABS.tabs("select","#tabs-PEDANTIC-VALIDATION"); }else if(selector=="#tabs-okkam-validation-tab"){ VALIDATION_TABS.tabs("select","#tabs-OKKAM-VALIDATION"); } //showing the validation tabs because there were some errors TABS.tabs("select","#tabs-VALIDATION"); allTabsValid=false; } var collapseWhenMoreThen=10; function printStartTagOffIssuesTable(resultsNo,html){ html.push('collapseWhenMoreThen){ html.push(' style="display:none;" '); } html.push(' class="validator_issues">'); } function plusOrMinusIcon(resultsNo){ if(resultsNo>collapseWhenMoreThen){ return 'ui-icon-plus'; }else{ return 'ui-icon-minus'; } }