diff --git a/src/components/input/pharma-input-fields/PhFiles.vue b/src/components/input/pharma-input-fields/PhFiles.vue index c018d0f508f216af7c3a26cc3fd06a383ae17406..c6b1a5a6ca0f91771fdedd15d7d143629708d805 100644 --- a/src/components/input/pharma-input-fields/PhFiles.vue +++ b/src/components/input/pharma-input-fields/PhFiles.vue @@ -1,28 +1,10 @@ <template> <v-container fluid> - <v-card-title class="title grey lighten-2 white--text"> - <span>Select the files for your current submission</span> - </v-card-title> <v-layout column class="uploadBox"> - <v-flex class="uploadBoxMain" v-if="loaderVisible"> - <v-flex - class="dropArea" - @dragenter="dragging=true" - @dragleave="dragging=false" - @ondragover="setFilename($event)" - > - <!-- @ondragover="$emit('input-file',$event); setFilename($event.target.files)"--> - <!-- <v-flex - class="dropArea" - @dragenter="dragging=true" - @dragleave="dragging=false" - @ondragover="setFilename($event.target.files);" - >--> - <h4>Drop multiple files here</h4> - <input type="file" required multiple @change="setFilename($event);" /> - <p>or click to upload</p> - </v-flex> - </v-flex> + <v-card-title class="title grey lighten-2 white--text"> + <span>Select the files for your current submission</span> + </v-card-title> + <!-- @change="$emit('input-file',$event);setFilename($event.target.files);"--> <v-flex class="uploadBoxMain" v-if="itemsAdded"> <v-layout row wrap xs v-for="i in itemsNames.length" :key="i" xs12> @@ -40,6 +22,7 @@ return-object ></v-select> </v-flex> + <v-flex xs2 v-if="!FileExtFreefield[i-1]"> <v-text-field :value="items[i-1]['type']" label="File extension" disabled></v-text-field> </v-flex> @@ -52,7 +35,7 @@ </v-tooltip> </v-flex> - <v-flex xs2 v-if="FileExtFreefield[i-1]"> + <v-flex xs2 v-if="FileExtFreefield[i-1]===true"> <v-select item-text="@id" :label="'File extension'" @@ -66,7 +49,7 @@ </v-flex> <v-flex v-if="FileExtFreefield[i-1]"> <v-tooltip bottom> - <v-btn slot="activator" small icon v-on:click="setArray(FileExtFreefield,i-1,false)"> + <v-btn slot="activator" small icon v-on:click="setArray(FileExtFreefield,i-1,true)"> <v-icon>remove</v-icon> </v-btn> <span>Remove input</span> @@ -113,6 +96,25 @@ </v-flex> </v-layout> </v-flex> + <v-flex class="uploadBoxMain" v-if="loaderVisible"> + <v-flex + class="dropArea" + @dragenter="dragging=true" + @dragleave="dragging=false" + @ondragover="setFilename($event)" + > + <!-- @ondragover="$emit('input-file',$event); setFilename($event.target.files)"--> + <!-- <v-flex + class="dropArea" + @dragenter="dragging=true" + @dragleave="dragging=false" + @ondragover="setFilename($event.target.files);" + >--> + <h4>Drop multiple files here</h4> + <input type="file" required multiple @change="setFilename($event);" /> + <p>or click to upload</p> + </v-flex> + </v-flex> <v-layout row wrap> <v-btn v-if="!loaderVisible" @click="removeItems">Remove all</v-btn> <v-btn v-if="!loaderVisible" @click="loaderVisible=true">Add more</v-btn> @@ -185,6 +187,9 @@ export default { }, methods: { + alert: function(e) { + console.log("alert", e); + }, selectId: function(event) { if (event) { return event["@id"]; @@ -193,8 +198,9 @@ export default { setArray: function(array, index, val) { array.splice(index, 1, val); }, - setFreefield: function(index, val) { - this.FileExtFreefield.splice(index, 1, val); + setExt: function(index, val) { + this.FileExtFreefield[index] = val; + console.log("in set elem", this.FileExtFreefield); }, // http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/ @@ -240,7 +246,14 @@ export default { var fileSizes = 0; for (var i = 0; i < this.items.length; i++) { this.itemsNames[i] = this.items[i].name; - //this.itemsExt[i] = this.items[i].type; + //only push the extension type if no value was selected before + if (this.itemsExt[i] == null) { + this.itemsExt[i] = this.items[i].type; + } + if (this.FileExtFreefield[i] == null) { + this.FileExtFreefield[i] = false; + } + //this.itemsType[i] = ; //this.itemsDesc[i] = ""; //this.itemsLicense[i] = ""; @@ -274,6 +287,7 @@ export default { this.itemsSizes = []; this.itemsLicense = []; this.itemsWarning = []; + this.FileExtFreefield = []; this.itemsTotalSize = ""; this.loaderVisible = true; if (this.items.length > 0) { @@ -309,6 +323,7 @@ export default { this.itemsSizes.splice(i, 1); this.itemsLicense.splice(i, 1); this.itemsWarning.splice(i, 1); + this.FileExtFreefield.splice(i, 1); for (var i = 0; i < this.items.length; i++) { fileSizes += this.items[i].size; } diff --git a/src/components/input/pharma-input-fields/PhInputForm.vue b/src/components/input/pharma-input-fields/PhInputForm.vue index a1791a52b0863a90d6d820352dd03bc61952eaec..02bf453f1e1f839e6a591c033c80fb97dc14e415 100644 --- a/src/components/input/pharma-input-fields/PhInputForm.vue +++ b/src/components/input/pharma-input-fields/PhInputForm.vue @@ -107,8 +107,8 @@ <v-flex v-else-if="n== 'file'"> <v-card-text> <v-layout v-for="(f) in s[index].fields" :key="f.id" row wrap> + <v-flex xs12>f.fileLicense {{f.fileLicense}} f.licenseWarning {{f.licenseWarning}}</v-flex> <v-flex v-if="f.component == 'files'"> - hallo{{f}} <ph-files v-bind.sync="f" v-on:input-numberFiles="f.nfile=$event" diff --git a/src/utils/json-ld.js b/src/utils/json-ld.js index 8c155c56fb0fee2940f67d84053594ffe6f55232..676b8de7495e8b8c20d52f5b95a4322446c1e0c2 100644 --- a/src/utils/json-ld.js +++ b/src/utils/json-ld.js @@ -1713,7 +1713,7 @@ export default { jsonldid = "member_" + k; jsonlds[jsonldid] = {}; - //console.log("nfile i", jsonldid, k, s); + console.log("nfile i", jsonldid, k, s); this.fields2jsonFile(jsonlds[jsonldid], k, s); } } else { @@ -2086,6 +2086,10 @@ export default { if (f.fileFormat[i - 1]) { this.push_literal(jsonld, "dcterms:type", f.fileFormat[i - 1]); } + + if (f.fileLicense[i - 1]) { + this.push_literal(jsonld, "edm:rights", f.fileLicense[i - 1]); + } break; } }