Changeset 1505
- Timestamp:
- Feb 8, 2011, 3:53:49 PM (13 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy
r1502 r1505 106 106 flow.page = 1 107 107 flow.studies = Study.findAllWhere(owner: authenticationService.getLoggedInUser()) 108 flow.importer_fuzzymatching="false" 108 109 109 110 success() … … 150 151 success() 151 152 } 153 on("refresh") { 154 flow.importer_fuzzymatching="true" 155 success() 156 }.to "pageTwo" 157 152 158 on("next") { 153 159 if (propertiesPage(flow, flash, params)) { -
trunk/grails-app/domain/dbnp/importer/ImportMapping.groovy
r1430 r1505 1 1 package dbnp.importer 2 import org.dbnp.gdt.* 2 3 3 4 class ImportMapping implements Serializable { 4 5 5 static hasMany = [columns: MappingColumn] 6 static String t 6 static hasMany = [columns: MappingColumn] 7 Template template 8 Class entity 9 String name 10 7 11 8 12 static constraints = { -
trunk/grails-app/taglib/dbnp/importer/ImporterTagLib.groovy
r1481 r1505 94 94 * @param matchvalue value which will be looked up via fuzzy matching against the list of options and will be selected 95 95 * @param MappingColumn object containing all required information 96 * @param fuzzymatching boolean true if fuzzy matching should be used, otherwise false 96 97 * @param allfieldtypes boolean true if all templatefields should be listed, otherwise only show filtered templatefields 97 98 * @return chooser object … … 103 104 def t = Template.get(attrs['template_id']) 104 105 def mc = attrs['mappingcolumn'] 105 def allfieldtypes = attrs['allfieldtypes'] 106 def matchvalue = attrs['matchvalue'] 107 def domainfields = mc.entity.giveDomainFields().findAll { it.type == mc.templatefieldtype } 106 def allfieldtypes = attrs['allfieldtypes'] 107 def matchvalue = (attrs['fuzzymatching']=="true") ? attrs['matchvalue'] : "" 108 109 def domainfields = mc.entity.giveDomainFields().findAll { it.type == mc.templatefieldtype } 108 110 domainfields = domainfields.findAll { it.preferredIdentifier != mc.identifier} 109 111 … … 133 135 def createPropertySelect(String name, options, matchvalue, Integer columnIndex) { 134 136 // Determine which field in the options list matches the best with the matchvalue 135 def mostsimilar = ImporterService.mostSimilar(matchvalue, options)137 def mostsimilar = (matchvalue) ? ImporterService.mostSimilar(matchvalue, options) : "" 136 138 137 139 def res = "<select style=\"font-size:10px\" id=\"${name}.index.${columnIndex}\" name=\"${name}.index.${columnIndex}\">" -
trunk/grails-app/views/importer/common/_on_page.gsp
r1489 r1505 43 43 return false; 44 44 }); 45 46 $('#fuzzymatchselect').click(function() { 47 refreshFlow() 48 }); 49 50 // attach function to clear button to reset all selects to "don't import" 51 $('#clearselect').click(function() { 52 // for each select field on the page 53 $("select").each( function(){ 54 // set its value to its first option 55 $(this).val($('option:first', this).val()); 56 }); 57 }); 45 58 } 46 59 -
trunk/grails-app/views/importer/common/_properties_horizontal.gsp
r1480 r1505 41 41 }); 42 42 43 $('#clearselect').click(function() {44 45 // for each select field on the page46 $("select").each( function(){47 // set its value to its first option48 $(this).val($('option:first', this).val());49 });50 51 });52 43 53 44 54 45 }); 55 46 </script> 56 <!-- saveproperties action was defined in the form --> 47 <!-- saveproperties action was defined in the form --> 57 48 <table> 58 49 <g:each var="stdentity" in ="${GdtService.cachedEntities}"> … … 61 52 <tr><td colspan="3"><h4>${stdentity.name}</h4></td></tr> 62 53 <tr> 63 <td class="header" width="25px"><input id="clearselect" type="button" value="clear" name="clearselect"></td> 54 <td class="header" width="25px"><input id="clearselect" type="button" value="Clear" name="clearselect"> 55 <input id="fuzzymatchselect" type="button" value="Match" name="fuzzymatchselect"> 56 </td> 64 57 <g:each var="selentity" in="${importer_selectedentities}"> 65 58 <g:if test="${selentity.name.toLowerCase()==stdentity.entity.toLowerCase()}"> 66 59 <td class="header" width="200px"> 67 60 <b>${importer_header[selentity.columnindex.toInteger()].name}</b> 68 <importer:propertyChooser name="columnproperty" mappingcolumn="${importer_header[selentity.columnindex.toInteger()]}" matchvalue="${importer_header[selentity.columnindex.toInteger()].name}" template_id="${importer_template_id}" allfieldtypes="true"/>61 <importer:propertyChooser name="columnproperty" mappingcolumn="${importer_header[selentity.columnindex.toInteger()]}" matchvalue="${importer_header[selentity.columnindex.toInteger()].name}" fuzzymatching="${importer_fuzzymatching}" template_id="${importer_template_id}" allfieldtypes="true"/> 69 62 </td> 70 63 </g:if>
Note: See TracChangeset
for help on using the changeset viewer.