Changeset 6097
- Timestamp:
- 03/11/15 11:09:37 (9 years ago)
- Location:
- SRUAggregator/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUAggregator/trunk/pom.xml
r6093 r6097 8 8 <groupId>eu.clarin.sru.fcs</groupId> 9 9 <artifactId>Aggregator2</artifactId> 10 <version>2.0.0-beta-2 8</version>10 <version>2.0.0-beta-29</version> 11 11 <name>FCS Aggregator</name> 12 12 -
SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/search/Result.java
r6092 r6097 73 73 74 74 void addRecord(SRURecord record) { 75 // TODO(edima): use response.getNextRecordPosition() 75 76 endpointReturnedRecords.getAndIncrement(); 76 77 if (record.isRecordSchema(ClarinFCSRecordData.RECORD_SCHEMA)) { -
SRUAggregator/trunk/src/main/resources/assets/js/main.jsx
r6093 r6097 3 3 "use strict"; 4 4 5 var VERSION = "VERSION 2.0.0-beta-2 8";5 var VERSION = "VERSION 2.0.0-beta-29"; 6 6 var URLROOT = "/Aggregator-testing"; 7 7 -
SRUAggregator/trunk/src/main/resources/assets/js/search.js
r6093 r6097 297 297 }, 298 298 299 getExportParams: function(corpusId, format ) {299 getExportParams: function(corpusId, format, filterLanguage) { 300 300 var params = corpusId ? {corpusId:corpusId}:{}; 301 301 if (format) params.format = format; 302 if (this.state.languageFilter === 'byGuess' || this.state.languageFilter === 'byMetaAndGuess') { 302 if (filterLanguage) { 303 params.filterLanguage = filterLanguage; 304 } else if (this.state.languageFilter === 'byGuess' || this.state.languageFilter === 'byMetaAndGuess') { 303 305 params.filterLanguage = this.state.language[0]; 304 306 } … … 307 309 308 310 getDownloadLink: function(corpusId, format) { 309 return 'rest/search/'+this.state.searchId+'/download?' + this.getExportParams(corpusId, format); 310 }, 311 312 getToWeblichtLink: function(corpusId) { 313 var params = corpusId ? {corpusId:corpusId}:{}; 314 return 'rest/search/'+this.state.searchId+'/toWeblicht?' + this.getExportParams(corpusId); 311 return 'rest/search/'+this.state.searchId+'/download?' + 312 this.getExportParams(corpusId, format); 313 }, 314 315 getToWeblichtLink: function(corpusId, forceLanguage) { 316 return 'rest/search/'+this.state.searchId+'/toWeblicht?' + 317 this.getExportParams(corpusId, null, forceLanguage); 315 318 }, 316 319 … … 469 472 layers.map(function(l) { 470 473 var cls = l.disabled ? 'disabled':''; 471 var handler = function() { if (!l.disabled) this.setLayer(l.id); } ;474 var handler = function() { if (!l.disabled) this.setLayer(l.id); }.bind(this); 472 475 return React.createElement("li", {key: l.id, className: cls}, " ", React.createElement("a", {tabIndex: "-1", href: "#", 473 476 onClick: handler}, " ", l.name, " ")); … … 753 756 }, 754 757 755 renderToWeblichtLinks: function(corpusId, error) {758 renderToWeblichtLinks: function(corpusId, forceLanguage, error) { 756 759 return ( 757 760 React.createElement("div", {className: "dropdown"}, … … 765 768 error ? 766 769 React.createElement("div", {className: "alert alert-danger", style: {margin:10, width:200}}, error) : 767 React.createElement("a", {href: this.props.getToWeblichtLink(corpusId ), target: "_blank"}, " ",770 React.createElement("a", {href: this.props.getToWeblichtLink(corpusId, forceLanguage), target: "_blank"}, " ", 768 771 "Send to Weblicht") 769 772 … … 834 837 return false; 835 838 } 836 var wlerror = null; 839 840 var forceLanguage = null, wlerror = null; 837 841 if (this.props.weblichtLanguages.indexOf(this.props.searchedLanguage[0]) < 0) { 838 wlerror = "Cannot use WebLicht: unsupported language"; 842 // the search language is either AnyLanguage or unsupported 843 if (this.props.searchedLanguage[0] === multipleLanguageCode) { 844 if (corpusHit.corpus.languages && corpusHit.corpus.languages.length === 1) { 845 forceLanguage = corpusHit.corpus.languages[0]; 846 } else { 847 var langs = corpusHit.kwics.map(function(kwic) {return kwic.language;}); 848 langs = _.uniq(langs.filter(function(l){ return l !== null; })); 849 console.log("languages:", langs); 850 if (langs.length === 1) { 851 forceLanguage = langs[0]; 852 } 853 } 854 } 855 if (!forceLanguage) { 856 wlerror = "Cannot use WebLicht: unsupported language ("+this.props.searchedLanguage[1]+")"; 857 } 839 858 } 840 859 var corpus = corpusHit.corpus; … … 852 871 this.renderDisplayKWIC(), 853 872 React.createElement("div", {className: "inline"}, " ", this.renderDownloadLinks(corpusHit.corpus.id), " "), 854 React.createElement("div", {className: "inline"}, " ", this.renderToWeblichtLinks(corpus.id, wlerror), " ")873 React.createElement("div", {className: "inline"}, " ", this.renderToWeblichtLinks(corpus.id, forceLanguage, wlerror), " ") 855 874 ) 856 875 ), … … 991 1010 return ret; 992 1011 }, 1012 1013 uniq: function(a) { 1014 var r = []; 1015 for (var i = 0; i < a.length; i++) { 1016 if (r.indexOf(a[i]) < 0) { 1017 r.push(a[i]); 1018 } 1019 } 1020 return r; 1021 }, 993 1022 }; 994 1023 -
SRUAggregator/trunk/src/main/resources/assets/js/search.jsx
r6093 r6097 297 297 }, 298 298 299 getExportParams: function(corpusId, format ) {299 getExportParams: function(corpusId, format, filterLanguage) { 300 300 var params = corpusId ? {corpusId:corpusId}:{}; 301 301 if (format) params.format = format; 302 if (this.state.languageFilter === 'byGuess' || this.state.languageFilter === 'byMetaAndGuess') { 302 if (filterLanguage) { 303 params.filterLanguage = filterLanguage; 304 } else if (this.state.languageFilter === 'byGuess' || this.state.languageFilter === 'byMetaAndGuess') { 303 305 params.filterLanguage = this.state.language[0]; 304 306 } … … 307 309 308 310 getDownloadLink: function(corpusId, format) { 309 return 'rest/search/'+this.state.searchId+'/download?' + this.getExportParams(corpusId, format); 310 }, 311 312 getToWeblichtLink: function(corpusId) { 313 var params = corpusId ? {corpusId:corpusId}:{}; 314 return 'rest/search/'+this.state.searchId+'/toWeblicht?' + this.getExportParams(corpusId); 311 return 'rest/search/'+this.state.searchId+'/download?' + 312 this.getExportParams(corpusId, format); 313 }, 314 315 getToWeblichtLink: function(corpusId, forceLanguage) { 316 return 'rest/search/'+this.state.searchId+'/toWeblicht?' + 317 this.getExportParams(corpusId, null, forceLanguage); 315 318 }, 316 319 … … 469 472 { layers.map(function(l) { 470 473 var cls = l.disabled ? 'disabled':''; 471 var handler = function() { if (!l.disabled) this.setLayer(l.id); } ;474 var handler = function() { if (!l.disabled) this.setLayer(l.id); }.bind(this); 472 475 return <li key={l.id} className={cls}> <a tabIndex="-1" href="#" 473 476 onClick={handler}> {l.name} </a></li>; … … 753 756 }, 754 757 755 renderToWeblichtLinks: function(corpusId, error) {758 renderToWeblichtLinks: function(corpusId, forceLanguage, error) { 756 759 return ( 757 760 <div className="dropdown"> … … 765 768 {error ? 766 769 <div className="alert alert-danger" style={{margin:10, width:200}}>{error}</div> : 767 <a href={this.props.getToWeblichtLink(corpusId )} target="_blank">{" "}770 <a href={this.props.getToWeblichtLink(corpusId, forceLanguage)} target="_blank">{" "} 768 771 Send to Weblicht</a> 769 772 } … … 834 837 return false; 835 838 } 836 var wlerror = null; 839 840 var forceLanguage = null, wlerror = null; 837 841 if (this.props.weblichtLanguages.indexOf(this.props.searchedLanguage[0]) < 0) { 838 wlerror = "Cannot use WebLicht: unsupported language"; 842 // the search language is either AnyLanguage or unsupported 843 if (this.props.searchedLanguage[0] === multipleLanguageCode) { 844 if (corpusHit.corpus.languages && corpusHit.corpus.languages.length === 1) { 845 forceLanguage = corpusHit.corpus.languages[0]; 846 } else { 847 var langs = corpusHit.kwics.map(function(kwic) {return kwic.language;}); 848 langs = _.uniq(langs.filter(function(l){ return l !== null; })); 849 console.log("languages:", langs); 850 if (langs.length === 1) { 851 forceLanguage = langs[0]; 852 } 853 } 854 } 855 if (!forceLanguage) { 856 wlerror = "Cannot use WebLicht: unsupported language ("+this.props.searchedLanguage[1]+")"; 857 } 839 858 } 840 859 var corpus = corpusHit.corpus; … … 852 871 { this.renderDisplayKWIC() } 853 872 <div className="inline"> {this.renderDownloadLinks(corpusHit.corpus.id)} </div> 854 <div className="inline"> {this.renderToWeblichtLinks(corpus.id, wlerror)} </div>873 <div className="inline"> {this.renderToWeblichtLinks(corpus.id, forceLanguage, wlerror)} </div> 855 874 </div> 856 875 </div> … … 991 1010 return ret; 992 1011 }, 1012 1013 uniq: function(a) { 1014 var r = []; 1015 for (var i = 0; i < a.length; i++) { 1016 if (r.indexOf(a[i]) < 0) { 1017 r.push(a[i]); 1018 } 1019 } 1020 return r; 1021 }, 993 1022 }; 994 1023
Note: See TracChangeset
for help on using the changeset viewer.