@@ -299,7 +299,7 @@ export default {
299299 // but there will be a change in responses that needs to trigger
300300 // this.setVisibility().
301301 if ((oldP !== newP) && newP === 100 ) {
302- // console.log('time to check for branching activities!');
302+ //
303303 this .setVisbility ();
304304 }
305305 },
@@ -518,11 +518,13 @@ export default {
518518 _ .map (eachActivityList, (itemObj ) => {
519519 const newObj = { ... itemObj };
520520 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 " ) ) {
522522 const keyStrings = (itemObj .isAbout .split (' /' ));
523523 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;
526528 }
527529 }
528530 activityData .push (newObj);
@@ -552,81 +554,6 @@ export default {
552554 });
553555 },
554556 },
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- },
630557 computed: {
631558 accessDeniedPath () {
632559 let path = require (' ./assets/403-Access-Forbidden-HTML-Template.gif' );
@@ -655,7 +582,7 @@ export default {
655582 ' $1-$2-$3T$4:$5:$6Z'
656583 );
657584 const time = Date .parse (formattedTime);
658- console .log (537 , timestamp, formattedTime, time);
585+ // console.log(537, timestamp, formattedTime, time);
659586 return time;
660587 },
661588 showTimer () {
@@ -704,6 +631,7 @@ export default {
704631 if (! _ .isEmpty (this .$store .state .schema )) {
705632 const order = _ .map (this .$store .state .schema [' http://schema.repronim.org/order' ][0 ][' @list' ],
706633 u => u[' @id' ]);
634+ // console.log(order)
707635 return order;
708636 }
709637 return [];
@@ -817,6 +745,81 @@ export default {
817745 return this .$store .getters .getParticipantId ;
818746 },
819747 },
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+ }
820823};
821824 </script >
822825
@@ -943,5 +946,3 @@ export default {
943946
944947
945948 </style >
946-
947-
0 commit comments