@@ -299,7 +299,7 @@ export default {
299
299
// but there will be a change in responses that needs to trigger
300
300
// this.setVisibility().
301
301
if ((oldP !== newP) && newP === 100 ) {
302
- // console.log('time to check for branching activities!');
302
+ //
303
303
this .setVisbility ();
304
304
}
305
305
},
@@ -518,11 +518,13 @@ export default {
518
518
_ .map (eachActivityList, (itemObj ) => {
519
519
const newObj = { ... itemObj };
520
520
if (itemObj[' @type' ] === ' reproschema:Response' ) {
521
- if (itemObj .value instanceof Blob ) {
521
+ if (itemObj .value instanceof Blob && ( itemObj . mimeType === " audio/wav " || itemObj . mimeType === " video/mp4 " ) ) {
522
522
const keyStrings = (itemObj .isAbout .split (' /' ));
523
523
const rId = itemObj[' @id' ].split (' uuid:' )[1 ];
524
- jszip .folder (fileName).file (` ${ keyStrings[keyStrings .length - 1 ]} -${ rId} .wav` , itemObj .value );
525
- newObj .value = ` ${ keyStrings[keyStrings .length - 1 ]} -${ rId} .wav` ;
524
+ const extension = itemObj .mimeType === " audio/wav" ? " wav" : " mp4" ;
525
+ const filename = ` ${ keyStrings[keyStrings .length - 1 ]} -${ rId} .${ extension} ` ;
526
+ jszip .folder (fileName).file (filename, itemObj .value );
527
+ newObj .value = filename;
526
528
}
527
529
}
528
530
activityData .push (newObj);
@@ -552,81 +554,6 @@ export default {
552
554
});
553
555
},
554
556
},
555
- watch: {
556
- $route () {
557
- if (this .$route .params .id !== undefined ) {
558
- this .$store .dispatch (' setActivityIndex' , this .$route .params .id );
559
- }
560
- },
561
- visibilityConditions: {
562
- handler (newC ) {
563
- if (! _ .isEmpty (newC)) {
564
- this .setVisbility ();
565
- }
566
- },
567
- deep: true ,
568
- },
569
- },
570
- created () {
571
- const url = this .$route .query .url ;
572
- if (url) {
573
- this .protocolUrl = url;
574
- }
575
- this .$store .dispatch (' getBaseSchema' , url).then (() => this .getPrefLabel ());
576
- // this.$store.dispatch('getBaseSchema', url);
577
- },
578
- mounted () {
579
- new EmailDecoder (' [data-email]' );
580
- this .clientSpecs = JSON .stringify (Bowser .parse (window .navigator .userAgent ));
581
- this .browserType = Bowser .parse (window .navigator .userAgent ).browser .name ;
582
- if (config .checkMediaPermission ) {
583
- this .checkPermission ();
584
- }
585
- if (this .$route .query .lang ) {
586
- this .selected_language = this .$route .query .lang ;
587
- i18n .locale = this .selected_language ;
588
- } else this .selected_language = ' en' ;
589
-
590
- if (this .$route .query .uid ) {
591
- // console.log(407, this.$route.query.uid);
592
- this .$store .dispatch (' saveParticipantId' , this .$route .query .uid );
593
- } else if (config .generateRandomUid ) {
594
- this .$store .dispatch (' saveParticipantId' , uuidv4 ());
595
- }
596
- if (this .$route .params .id ) {
597
- this .$store .dispatch (' setActivityIndex' , this .$route .params .id );
598
- }
599
- axios .get (' https://raw.githubusercontent.com/ReproNim/reproschema-library/master/resources/languages.json' ).then ((resp ) => {
600
- this .langMap = resp .data ;
601
- });
602
- this .$store .dispatch (' setParticipantUUID' , uuidv4 ()); // set participant UUID for the current user
603
- if (this .$route .query .expiry_time ) {
604
- this .$store .dispatch (' setExpiryMinutes' , this .$route .query .expiry_time );
605
- }
606
- if (this .$route .query .auth_token ) {
607
- this .$store .dispatch (' setAuthToken' , this .$route .query .auth_token );
608
- }
609
- if (! _ .isEmpty (this .$route .query )) {
610
- this .$store .dispatch (' setQueryParameters' , this .$route .query );
611
- }
612
-
613
- // const formData = new FormData();
614
- // const TOKEN = this.$store.getters.getAuthToken;
615
- // if (TOKEN) {
616
- // formData.append('file', null);
617
- // formData.append('auth_token', `${TOKEN}`);
618
- // axios.post(`${config.backendServer}/submit`, formData, {
619
- // 'Content-Type': 'multipart/form-data',
620
- // }).then((res) => {
621
- // // console.log('SUCCESS!!', res.status);
622
- // })
623
- // .catch((e) => {
624
- // if (e.response.status === 403) {
625
- // this.invalidToken = true;
626
- // }
627
- // });
628
- // }
629
- },
630
557
computed: {
631
558
accessDeniedPath () {
632
559
let path = require (' ./assets/403-Access-Forbidden-HTML-Template.gif' );
@@ -655,7 +582,7 @@ export default {
655
582
' $1-$2-$3T$4:$5:$6Z'
656
583
);
657
584
const time = Date .parse (formattedTime);
658
- console .log (537 , timestamp, formattedTime, time);
585
+ // console.log(537, timestamp, formattedTime, time);
659
586
return time;
660
587
},
661
588
showTimer () {
@@ -704,6 +631,7 @@ export default {
704
631
if (! _ .isEmpty (this .$store .state .schema )) {
705
632
const order = _ .map (this .$store .state .schema [' http://schema.repronim.org/order' ][0 ][' @list' ],
706
633
u => u[' @id' ]);
634
+ // console.log(order)
707
635
return order;
708
636
}
709
637
return [];
@@ -817,6 +745,81 @@ export default {
817
745
return this .$store .getters .getParticipantId ;
818
746
},
819
747
},
748
+ mounted () {
749
+ new EmailDecoder (' [data-email]' );
750
+ this .clientSpecs = JSON .stringify (Bowser .parse (window .navigator .userAgent ));
751
+ this .browserType = Bowser .parse (window .navigator .userAgent ).browser .name ;
752
+ if (config .checkMediaPermission ) {
753
+ this .checkPermission ();
754
+ }
755
+ if (this .$route .query .lang ) {
756
+ this .selected_language = this .$route .query .lang ;
757
+ i18n .locale = this .selected_language ;
758
+ } else this .selected_language = ' en' ;
759
+
760
+ if (this .$route .query .uid ) {
761
+ // console.log(407, this.$route.query.uid);
762
+ this .$store .dispatch (' saveParticipantId' , this .$route .query .uid );
763
+ } else if (config .generateRandomUid ) {
764
+ this .$store .dispatch (' saveParticipantId' , uuidv4 ());
765
+ }
766
+ if (this .$route .params .id ) {
767
+ this .$store .dispatch (' setActivityIndex' , this .$route .params .id );
768
+ }
769
+ axios .get (' https://raw.githubusercontent.com/ReproNim/reproschema-library/master/resources/languages.json' ).then ((resp ) => {
770
+ this .langMap = resp .data ;
771
+ });
772
+ this .$store .dispatch (' setParticipantUUID' , uuidv4 ()); // set participant UUID for the current user
773
+ if (this .$route .query .expiry_time ) {
774
+ this .$store .dispatch (' setExpiryMinutes' , this .$route .query .expiry_time );
775
+ }
776
+ if (this .$route .query .auth_token ) {
777
+ this .$store .dispatch (' setAuthToken' , this .$route .query .auth_token );
778
+ }
779
+ if (! _ .isEmpty (this .$route .query )) {
780
+ this .$store .dispatch (' setQueryParameters' , this .$route .query );
781
+ }
782
+
783
+ // const formData = new FormData();
784
+ // const TOKEN = this.$store.getters.getAuthToken;
785
+ // if (TOKEN) {
786
+ // formData.append('file', null);
787
+ // formData.append('auth_token', `${TOKEN}`);
788
+ // axios.post(`${config.backendServer}/submit`, formData, {
789
+ // 'Content-Type': 'multipart/form-data',
790
+ // }).then((res) => {
791
+ // // console.log('SUCCESS!!', res.status);
792
+ // })
793
+ // .catch((e) => {
794
+ // if (e.response.status === 403) {
795
+ // this.invalidToken = true;
796
+ // }
797
+ // });
798
+ // }
799
+ },
800
+ watch: {
801
+ $route () {
802
+ if (this .$route .params .id !== undefined ) {
803
+ this .$store .dispatch (' setActivityIndex' , this .$route .params .id );
804
+ }
805
+ },
806
+ visibilityConditions: {
807
+ handler (newC ) {
808
+ if (! _ .isEmpty (newC)) {
809
+ this .setVisbility ();
810
+ }
811
+ },
812
+ deep: true ,
813
+ },
814
+ },
815
+ created () {
816
+ const url = this .$route .query .url ;
817
+ if (url) {
818
+ this .protocolUrl = url;
819
+ }
820
+ this .$store .dispatch (' getBaseSchema' , url).then (() => this .getPrefLabel ());
821
+ // this.$store.dispatch('getBaseSchema', url);
822
+ }
820
823
};
821
824
</script >
822
825
@@ -943,5 +946,3 @@ export default {
943
946
944
947
945
948
</style >
946
-
947
-
0 commit comments