Changeset 1514
- Timestamp:
- Feb 10, 2011, 4:30:16 PM (12 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy
r1511 r1514 152 152 } 153 153 on("refresh") { 154 if (params.savepropertymapping) println "saved properties" 154 // a name was given to the current property mapping, try to store it 155 if (params.mappingname) { 156 flash['mappingname'] = params.mappingname 157 propertiesSaveImportMappingPage(flow, flash, params) 158 } 155 159 flow.importer_fuzzymatching="true" 156 160 success() … … 365 369 return false 366 370 } 371 372 /** 373 * Save the properties as an import mapping. 374 * 375 * @param Map LocalAttributeMap (the flow scope) 376 * @param Map GrailsParameterMap (the flow parameters = form data) 377 * @returns boolean true if correctly validated, otherwise false 378 */ 379 boolean propertiesSaveImportMappingPage(flow, flash, params) { 380 flash.wizardErrors = [:] 381 382 // Find actual Template object from the chosen template name 383 def template = Template.get(flow.importer_template_id) 384 //def im = new ImportMapping(name:params.mappingname).save() 385 386 params.columnproperty.index.each { columnindex, property -> 387 // Create an actual class instance of the selected entity with the selected template 388 // This should be inside the closure because in some cases in the advanced importer, the fields can have different target entities 389 def entityClass = Class.forName(flow.importer_header[columnindex.toInteger()].entity.getName(), true, this.getClass().getClassLoader()) 390 def entityObj = entityClass.newInstance(template: template) 391 def dontimport = (property == "dontimport") ? true : false 392 393 def mc = new MappingColumn (property:property, templatefieldtype:entityObj.giveFieldType(property), dontimport: dontimport ) 394 395 // Store the selected property for this column into the column map for the ImporterService 396 /*flow.importer_header[columnindex.toInteger()].property = property 397 398 // Look up the template field type of the target TemplateField and store it also in the map 399 flow.importer_header[columnindex.toInteger()].templatefieldtype = entityObj.giveFieldType(property) 400 401 // Is a "Don't import" property assigned to the column? 402 flow.importer_header[columnindex.toInteger()].dontimport = (property == "dontimport") ? true : false 403 404 //if it's an identifier set the mapping column true or false 405 entityObj.giveFields().each { 406 (it.preferredIdentifier && (it.name == property)) ? flow.importer_header[columnindex.toInteger()].identifier = true : false 407 }*/ 408 } 409 } 367 410 368 411 /** -
trunk/grails-app/views/importer/common/_on_page.gsp
r1511 r1514 49 49 }); 50 50 51 $('#savepropertiesbutton').click(function() { 52 var width = 800 53 var height = 400 51 $('#savepropertiesbutton').click(function() { 52 var width = 500 53 var height = 200 54 var vars = "" 55 56 $("#savemapping").toggle("scale") 57 58 if ($("#mappingname").val()) refreshFlow(); 54 59 55 60 // get all properties 56 61 //$('select[name^=columnproperty.index.]').each ( function() { 57 //} 62 //} 58 63 59 $('<iframe frameborder="0" src="' + baseUrl + "/importer/propertiesManager" + '" sanbox="allow-same-origin" seamless />').dialog({60 title : "Properties manager", 61 autoOpen : true, 64 /*$('#propertiesManager').dialog({ 65 title : "Properties manager", 66 autoOpen : true, 62 67 width : width, 68 vars : vars, 63 69 height : height, 64 70 modal : true, 65 71 position : 'center', 66 72 buttons : { 67 Close : function() { $(this).dialog('close'); } 73 Save : function() { 74 //alert($(this).parent().$('input[name="mappingname"]').val()) 75 alert($(this)) 76 var p = $(this).parent().parent().parent() 77 console.log(p.('input[name="mappingname"]').val()) 78 //alert(vars) 79 $(this).dialog('close'); } 68 80 }, 69 81 close : function() { … … 72 84 } 73 85 }).width(width - 10).height(height) 86 */ 74 87 75 88 }); … … 165 178 166 179 </script> 167 -
trunk/grails-app/views/importer/common/_properties_horizontal.gsp
r1511 r1514 15 15 %> 16 16 17 17 18 <!-- saveproperties action was defined in the form --> 19 ${flash.mappingname} 18 20 <table> 19 21 <g:each var="stdentity" in ="${GdtService.cachedEntities}"> … … 22 24 <tr><td colspan="3"><h4>${stdentity.name}</h4></td></tr> 23 25 <tr> 24 <td class="header" width=" 25px">26 <td class="header" width="55px"> 25 27 <input class="buttonsmall" id="clearselect" type="button" value="Clear" name="clearselect"> 26 28 <input class="buttonsmall" id="fuzzymatchselect" type="button" value="Match" name="fuzzymatchselect"> 27 <!-- <input class="buttonsmall" id="savepropertiesbutton" type="button" value="Save" name="savepropertiesbutton"> --> 29 <input class="buttonsmall" id="savepropertiesbutton" type="button" value="Save" name="savepropertiesbutton"> 30 <div id="savemapping" style="display:none"> 31 Give current mapping a name and press Save: 32 <input type="text" name="mappingname" size="20" id="mappingname"> 33 </div> 28 34 </td> 29 35 <g:each var="selentity" in="${importer_selectedentities}">
Note: See TracChangeset
for help on using the changeset viewer.