Skip to content
Snippets Groups Projects
Commit 4eb16fb3 authored by Isa H's avatar Isa H
Browse files

licences, file ext

parent ef8884ab
Branches
No related tags found
1 merge request!2Dev2
<template> <template>
<v-container fluid> <v-container fluid>
<v-layout column class="uploadBox">
<v-card-title class="title grey lighten-2 white--text"> <v-card-title class="title grey lighten-2 white--text">
<span>Select the files for your current submission</span> <span>Select the files for your current submission</span>
</v-card-title> </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>
<!-- @change="$emit('input-file',$event);setFilename($event.target.files);"--> <!-- @change="$emit('input-file',$event);setFilename($event.target.files);"-->
<v-flex class="uploadBoxMain" v-if="itemsAdded"> <v-flex class="uploadBoxMain" v-if="itemsAdded">
<v-layout row wrap xs v-for="i in itemsNames.length" :key="i" xs12> <v-layout row wrap xs v-for="i in itemsNames.length" :key="i" xs12>
...@@ -40,6 +22,7 @@ ...@@ -40,6 +22,7 @@
return-object return-object
></v-select> ></v-select>
</v-flex> </v-flex>
<v-flex xs2 v-if="!FileExtFreefield[i-1]"> <v-flex xs2 v-if="!FileExtFreefield[i-1]">
<v-text-field :value="items[i-1]['type']" label="File extension" disabled></v-text-field> <v-text-field :value="items[i-1]['type']" label="File extension" disabled></v-text-field>
</v-flex> </v-flex>
...@@ -52,7 +35,7 @@ ...@@ -52,7 +35,7 @@
</v-tooltip> </v-tooltip>
</v-flex> </v-flex>
<v-flex xs2 v-if="FileExtFreefield[i-1]"> <v-flex xs2 v-if="FileExtFreefield[i-1]===true">
<v-select <v-select
item-text="@id" item-text="@id"
:label="'File extension'" :label="'File extension'"
...@@ -66,7 +49,7 @@ ...@@ -66,7 +49,7 @@
</v-flex> </v-flex>
<v-flex v-if="FileExtFreefield[i-1]"> <v-flex v-if="FileExtFreefield[i-1]">
<v-tooltip bottom> <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-icon>remove</v-icon>
</v-btn> </v-btn>
<span>Remove input</span> <span>Remove input</span>
...@@ -113,6 +96,25 @@ ...@@ -113,6 +96,25 @@
</v-flex> </v-flex>
</v-layout> </v-layout>
</v-flex> </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-layout row wrap>
<v-btn v-if="!loaderVisible" @click="removeItems">Remove all</v-btn> <v-btn v-if="!loaderVisible" @click="removeItems">Remove all</v-btn>
<v-btn v-if="!loaderVisible" @click="loaderVisible=true">Add more</v-btn> <v-btn v-if="!loaderVisible" @click="loaderVisible=true">Add more</v-btn>
...@@ -185,6 +187,9 @@ export default { ...@@ -185,6 +187,9 @@ export default {
}, },
methods: { methods: {
alert: function(e) {
console.log("alert", e);
},
selectId: function(event) { selectId: function(event) {
if (event) { if (event) {
return event["@id"]; return event["@id"];
...@@ -193,8 +198,9 @@ export default { ...@@ -193,8 +198,9 @@ export default {
setArray: function(array, index, val) { setArray: function(array, index, val) {
array.splice(index, 1, val); array.splice(index, 1, val);
}, },
setFreefield: function(index, val) { setExt: function(index, val) {
this.FileExtFreefield.splice(index, 1, val); this.FileExtFreefield[index] = val;
console.log("in set elem", this.FileExtFreefield);
}, },
// http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/ // http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/
...@@ -240,7 +246,14 @@ export default { ...@@ -240,7 +246,14 @@ export default {
var fileSizes = 0; var fileSizes = 0;
for (var i = 0; i < this.items.length; i++) { for (var i = 0; i < this.items.length; i++) {
this.itemsNames[i] = this.items[i].name; 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.itemsType[i] = ;
//this.itemsDesc[i] = ""; //this.itemsDesc[i] = "";
//this.itemsLicense[i] = ""; //this.itemsLicense[i] = "";
...@@ -274,6 +287,7 @@ export default { ...@@ -274,6 +287,7 @@ export default {
this.itemsSizes = []; this.itemsSizes = [];
this.itemsLicense = []; this.itemsLicense = [];
this.itemsWarning = []; this.itemsWarning = [];
this.FileExtFreefield = [];
this.itemsTotalSize = ""; this.itemsTotalSize = "";
this.loaderVisible = true; this.loaderVisible = true;
if (this.items.length > 0) { if (this.items.length > 0) {
...@@ -309,6 +323,7 @@ export default { ...@@ -309,6 +323,7 @@ export default {
this.itemsSizes.splice(i, 1); this.itemsSizes.splice(i, 1);
this.itemsLicense.splice(i, 1); this.itemsLicense.splice(i, 1);
this.itemsWarning.splice(i, 1); this.itemsWarning.splice(i, 1);
this.FileExtFreefield.splice(i, 1);
for (var i = 0; i < this.items.length; i++) { for (var i = 0; i < this.items.length; i++) {
fileSizes += this.items[i].size; fileSizes += this.items[i].size;
} }
......
...@@ -107,8 +107,8 @@ ...@@ -107,8 +107,8 @@
<v-flex v-else-if="n== 'file'"> <v-flex v-else-if="n== 'file'">
<v-card-text> <v-card-text>
<v-layout v-for="(f) in s[index].fields" :key="f.id" row wrap> <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'"> <v-flex v-if="f.component == 'files'">
hallo{{f}}
<ph-files <ph-files
v-bind.sync="f" v-bind.sync="f"
v-on:input-numberFiles="f.nfile=$event" v-on:input-numberFiles="f.nfile=$event"
......
...@@ -1713,7 +1713,7 @@ export default { ...@@ -1713,7 +1713,7 @@ export default {
jsonldid = "member_" + k; jsonldid = "member_" + k;
jsonlds[jsonldid] = {}; jsonlds[jsonldid] = {};
//console.log("nfile i", jsonldid, k, s); console.log("nfile i", jsonldid, k, s);
this.fields2jsonFile(jsonlds[jsonldid], k, s); this.fields2jsonFile(jsonlds[jsonldid], k, s);
} }
} else { } else {
...@@ -2086,6 +2086,10 @@ export default { ...@@ -2086,6 +2086,10 @@ export default {
if (f.fileFormat[i - 1]) { if (f.fileFormat[i - 1]) {
this.push_literal(jsonld, "dcterms:type", 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; break;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment