Compare commits
	
		
			3 Commits
		
	
	
		
			14c5423328
			...
			a168d41aee
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a168d41aee | |||
| 3f4f6ed49a | |||
| fed567e9ab | 
| @ -52,6 +52,7 @@ public class ApplicationsController { | ||||
|  | ||||
|         //if unAuthed | ||||
|         authorizedApps.add(Applications.Login); | ||||
|         authorizedApps.add(Applications.ListResearches); | ||||
|  | ||||
| 		User user = authServ.getUserFromToken(token); | ||||
| 		if(user == null) | ||||
|  | ||||
| @ -21,5 +21,7 @@ public enum Applications { | ||||
|     // profile of a researcher | ||||
|     ResearcherProfile, | ||||
|     ManageResearcherProfile, | ||||
|     StudentsList | ||||
|  | ||||
|     //the list of all researches (filterable) | ||||
|     ListResearches, StudentsList | ||||
| } | ||||
|  | ||||
| @ -29,6 +29,7 @@ app.manage.profile=Manage profile | ||||
| app.studentList=Students List | ||||
| app.users=Users | ||||
| app.manage.researcherProfile=Manage researcher profile | ||||
| app.list.researches=List researches | ||||
| request.moreInfos=More Infos | ||||
| request.accept=Accept | ||||
| request.refuse=Refuse | ||||
|  | ||||
| @ -29,6 +29,7 @@ app.manage.profile=Gérer le profil | ||||
| app.studentList=Liste des étudiants | ||||
| app.users=Utilisateurs | ||||
| app.manage.researcherProfile= gérer son profil de chercheur | ||||
| app.list.researches=Lister les recherches | ||||
| request.moreInfos=Plus d'Infos | ||||
| request.accept=Accepter | ||||
| request.refuse=Refuser | ||||
|  | ||||
| @ -165,7 +165,7 @@ window.addEventListener('hashchange', () => { | ||||
| 		border-color:black; | ||||
| 		height: 100%; | ||||
| 		position: fixed; | ||||
| 		overflow:; | ||||
| 		overflow: scroll; | ||||
| 		transition-duration: .3s; | ||||
| 	} | ||||
|  | ||||
|  | ||||
| @ -1,8 +1,90 @@ | ||||
| <script setup> | ||||
|  | ||||
| import { ref} from "vue"; | ||||
| import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue"; | ||||
| import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue"; | ||||
| import {getFile, fetchAllResearches, addView} from "@/rest/ScientificPublications/ManageResearch.js"; | ||||
| import {fetchResearch} from "@/rest/ScientificPublications/ResearcherProfile.js"; | ||||
| const input = ref("") | ||||
| const isFilterOpened = ref(false); | ||||
| const isResearchOpened = ref(false); | ||||
| const articleToDisplay = ref(Object) | ||||
|  | ||||
| const researchList = ref(await fetchAllResearches()); | ||||
| const isResearcher = ref(false) | ||||
|  | ||||
| const props = defineProps({ | ||||
|   filters: ref([""]), | ||||
| }); | ||||
|  | ||||
| const openFilter = () => { | ||||
|   isFilterOpened.value = true; | ||||
| }; | ||||
| const closeFilter = () => { | ||||
|   isFilterOpened.value = false; | ||||
| }; | ||||
| const submitFilters = ()=>{ | ||||
| } | ||||
| const openResearch = (article) => { | ||||
|   isResearchOpened.value = true; | ||||
|   articleToDisplay.value = article; | ||||
| } | ||||
|  | ||||
| const closeResearch = () => { | ||||
|   isResearchOpened.value =false; | ||||
|   articleToDisplay.value = null; | ||||
| } | ||||
|  | ||||
| const downloadBibTex = (research) => { | ||||
|   getFile(research.bibTexLocation) | ||||
| } | ||||
|  | ||||
| async function downloadArticle (research){ | ||||
|   await addView(research.pdfLocation) | ||||
|   await getFile(research.pdfLocation) | ||||
|   articleToDisplay.value = await fetchResearch(articleToDisplay.value.id) | ||||
| } | ||||
|  | ||||
| function downloadCoAuthors(){ | ||||
|   //todo | ||||
|   const data = JSON.stringify(researcher.value); | ||||
|   const blob = new Blob([data], {type:"application/json"}); | ||||
|   return URL.createObjectURL(blob); | ||||
| } | ||||
|  | ||||
|  | ||||
| function searchInList(list, searchInput) { | ||||
|   let retList = [] | ||||
|   for (let i = 0; i < list.length; i++) { | ||||
|     let researcher = list[i].researcher.user.firstName + " " +list[i].researcher.user.lastName | ||||
|     if (isResearcher.value && (lDistance(researcher, searchInput) < 5 || researcher.toUpperCase().indexOf(searchInput.toUpperCase()) > -1)){ | ||||
|       retList.push(list[i]) | ||||
|     } | ||||
|     if (!isResearcher.value && (lDistance(list[i].title, searchInput) < 10 || list[i].title.toUpperCase().indexOf(searchInput.toUpperCase()) > -1)){ | ||||
|       retList.push(list[i]) | ||||
|     } | ||||
|   } | ||||
|   return retList | ||||
| } | ||||
|  | ||||
| function lDistance(s,t){ | ||||
|   if (!s.length) return t.length; | ||||
|   if (!t.length) return s.length; | ||||
|   const arr = []; | ||||
|   for (let i = 0; i <= t.length; i++) { | ||||
|     arr[i] = [i]; | ||||
|     for (let j = 1; j <= s.length; j++) { | ||||
|       arr[i][j] = | ||||
|           i === 0 | ||||
|               ? j | ||||
|               : Math.min( | ||||
|                   arr[i - 1][j] + 1, | ||||
|                   arr[i][j - 1] + 1, | ||||
|                   arr[i - 1][j - 1] + (s[j - 1] === t[i - 1] ? 0 : 1) | ||||
|               ); | ||||
|     } | ||||
|   } | ||||
|   return arr[t.length][s.length]; | ||||
| } | ||||
|  | ||||
| </script> | ||||
|  | ||||
| @ -12,13 +94,17 @@ import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vu | ||||
|   <ArticleComponent :article="articleToDisplay" :isOpen="isResearchOpened" :manage="false" @modal-close="closeResearch" @downloadPdf="downloadArticle(articleToDisplay)" @downloadBibTex="downloadBibTex(articleToDisplay)"></ArticleComponent> | ||||
|   <div id="researches"> | ||||
|     <div id="search"> | ||||
|       <input type="text" id="search-input" placeholder="search for researches" v-model="input"/> | ||||
|       <input v-if="!isResearcher" type="text" id="search-input" placeholder="search for researches" v-model="input"/> | ||||
|       <input v-else type="text" id="search-input" placeholder="search for researcher" v-model="input"/> | ||||
|       <button id="filterButton" @click="openFilter">  Filters </button> | ||||
|       <button v-if="!isResearcher" id="unToggledResearchButton" @click="isResearcher = !isResearcher">  Toggle Researcher Search</button> | ||||
|       <button v-if="isResearcher" id="toggledResearchButton" @click="isResearcher = !isResearcher">  UnToggle Researcher Search</button> | ||||
|     </div> | ||||
|     <ul id="researchUL"> | ||||
|       <li id="researchLi" v-for="n in searchInList(researchList,input)"> | ||||
|         <div class="vl"> {{n.title}}</div> | ||||
|         <div class="vl"> {{ n.researcher.user.firstName +" "+ n.researcher.user.lastName }}</div> | ||||
|         <div class="vl"> <a :href="'#/researcher-profile?id=' + n.researcher.id"> {{ n.researcher.user.firstName +" "+ n.researcher.user.lastName }}</a> | ||||
|         </div> | ||||
|         <a @click="openResearch(n)"> MoreInfo  </a></li> | ||||
|     </ul> | ||||
|   </div> | ||||
| @ -27,4 +113,95 @@ import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vu | ||||
|  | ||||
| <style scoped> | ||||
|  | ||||
| #main { | ||||
|   height: 100%; | ||||
|   width: 100%; | ||||
| } | ||||
|  | ||||
| #search{ | ||||
|   width: 100%; | ||||
|   height: 10%; | ||||
|   display: inline-flex; | ||||
| } | ||||
| #search-input { | ||||
|   margin-left: 25px; | ||||
|   width: 75%; | ||||
|   font-size: 16px; | ||||
|   padding: 12px 20px 12px 40px; | ||||
|   border: 1px solid #ddd; | ||||
|   height: 20px; | ||||
|   align-self: center; | ||||
| } | ||||
|  | ||||
| #filterButton { | ||||
|   align-self: center; | ||||
|   margin-left: 2px; | ||||
|   font-size: xx-large; | ||||
|   color: white; | ||||
|   background: rgba(191, 64, 191,0.5); | ||||
|   border:2px solid black; | ||||
| } | ||||
| #filterButton:hover{ | ||||
|   background: rgba(191, 64, 191); | ||||
| } | ||||
|  | ||||
|  | ||||
| #researchUL { | ||||
|   list-style-type: none; | ||||
|   color: white; | ||||
|   padding: 12px; | ||||
|   margin: 5px; | ||||
|   height: 100%; | ||||
|   overflow: scroll; | ||||
| } | ||||
| #researchLi{ | ||||
|   display: grid; | ||||
|   grid-template-columns: auto auto auto; | ||||
|   border: 2px solid black; | ||||
|   color: white; | ||||
|   font-size: x-large; | ||||
|   text-align: center; | ||||
|   text-indent: 7px; | ||||
|   background-color: rgba(255, 255, 255, 0.09); | ||||
|   border-radius: 18px; | ||||
|   margin-bottom: 15px; | ||||
| } | ||||
| a{ | ||||
|   color:#007aff; | ||||
|   text-decoration: underline; | ||||
|   cursor: pointer; | ||||
| } | ||||
|  | ||||
| .vl { | ||||
|   border-right: 2px solid black; | ||||
| } | ||||
|  | ||||
| #unToggledResearchButton{ | ||||
|   align-self: center; | ||||
|   margin-left: 2px; | ||||
|   font-size: large; | ||||
|   color: white; | ||||
|   background: #2a1981; | ||||
|   border:2px solid black; | ||||
| } | ||||
|  | ||||
| #unToggledResearchButton:hover{ | ||||
|   background: #5ac8fa; | ||||
|  | ||||
| } | ||||
|  | ||||
| #toggledResearchButton { | ||||
|   align-self: center; | ||||
|   margin-left: 2px; | ||||
|   font-size: large; | ||||
|   color: white; | ||||
|   background: crimson; | ||||
|   border:2px solid black; | ||||
| } | ||||
| #toggledResearchButton:hover{ | ||||
|   background: #ff2d55; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| </style> | ||||
| @ -1,5 +1,5 @@ | ||||
| <script setup> | ||||
| import { ref, reactive } from "vue"; | ||||
| import { ref} from "vue"; | ||||
| import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue"; | ||||
| import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue"; | ||||
| import {fetchResearches, } from "@/rest/ScientificPublications/ResearcherProfile.js"; | ||||
| @ -10,7 +10,6 @@ const isFilterOpened = ref(false); | ||||
| const isResearchOpened = ref(false); | ||||
| const isPostResearchOpened = ref(false); | ||||
| const articleToDisplay = ref() | ||||
| const filters = ref([]); | ||||
| const changing = ref(false); | ||||
|  | ||||
| let toModify= Object.assign({}, {}); | ||||
|  | ||||
| @ -9,8 +9,8 @@ | ||||
| import { ref, reactive } from "vue"; | ||||
| import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue"; | ||||
| import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue"; | ||||
| import {fetchResearcher, fetchResearches, fetchStats, addView} from "@/rest/ScientificPublications/ResearcherProfile.js"; | ||||
| import {getFile} from "@/rest/ScientificPublications/ManageResearch.js"; | ||||
| import {fetchResearcher, fetchResearches, fetchStats, fetchResearch} from "@/rest/ScientificPublications/ResearcherProfile.js"; | ||||
| import {getFile, addView} from "@/rest/ScientificPublications/ManageResearch.js"; | ||||
| const input = ref(""); | ||||
| const statsOf = ref(""); | ||||
| const statsBy = ref(""); | ||||
| @ -20,16 +20,18 @@ const articleToDisplay = ref(Object) | ||||
| const filters = ref([]); | ||||
| let chart; | ||||
|  | ||||
| const researchList = ref(await fetchResearches(1)); | ||||
| //todo changer dynamiquement le 1 ici en fct de sur quel profil on est | ||||
| const researcher = ref(await fetchResearcher(1)); | ||||
| const stats = ref(await fetchStats(1)) | ||||
| const researcherId = window.location.href.split("=")[1] | ||||
|  | ||||
| const props = defineProps({ | ||||
|   researcherId: ref(), //int | ||||
|   filters: ref([""]), | ||||
|   filters: ref([]), | ||||
| }); | ||||
|  | ||||
|  | ||||
|  | ||||
| const researchList = ref(await fetchResearches(researcherId)); | ||||
| const researcher = ref(await fetchResearcher(researcherId)); | ||||
| const stats = ref(await fetchStats(researcherId)) | ||||
|  | ||||
| const openFilter = () => { | ||||
|   isFilterOpened.value = true; | ||||
| }; | ||||
| @ -52,9 +54,12 @@ const downloadBibTex = (research) => { | ||||
|   getFile(research.bibTexLocation) | ||||
| } | ||||
|  | ||||
| const downloadArticle = (research) => { | ||||
|   addView(research.pdfLocation) | ||||
|   getFile(research.pdfLocation) | ||||
| async function downloadArticle (research) { | ||||
|   await addView(research.pdfLocation) | ||||
|   await getFile(research.pdfLocation) | ||||
|   articleToDisplay.value = await fetchResearch(articleToDisplay.value.id) | ||||
|   stats.value = await fetchStats(researcher.value.id) | ||||
|   update() | ||||
| } | ||||
|  | ||||
| function downloadCoAuthors(){ | ||||
|  | ||||
| @ -23,11 +23,14 @@ export async function postResearch(data){ | ||||
|     return restPost("/research", data) | ||||
| } | ||||
|  | ||||
| export async function fetchResearches(){ | ||||
| export async function fetchAllResearches(){ | ||||
|     return restGet("/researches") | ||||
| } | ||||
|  | ||||
| export async function getFile(url){ | ||||
|     const restURL = import.meta.env.VITE_CLYDE_MODE === 'container' ? "http://localhost:8000": import.meta.env.DEV ? "http://localhost:5173" : "https://clyde.herisson.ovh/api" | ||||
|     await fetch(restURL + "/"+url, {method: "GET"}) | ||||
|     await fetch(restURL + "/" + url, {method: "GET"}) | ||||
| } | ||||
| export async function addView(url){ | ||||
|     return restPost("/addview/" + url) | ||||
| } | ||||
|  | ||||
| @ -11,6 +11,7 @@ export async function fetchResearches(id){ | ||||
| export async function fetchStats(id){ | ||||
|     return restGet("/stats/" +id) | ||||
| } | ||||
| export async function addView(url){ | ||||
|     return restPost("/addview/" +url) | ||||
|  | ||||
| export async function fetchResearch(id){ | ||||
|     return restGet("/research/" +id) | ||||
| } | ||||
| @ -13,6 +13,8 @@ import AboutStudent from "@/Apps/Inscription/AboutStudent.vue"; | ||||
| import Msg from "@/Apps/Msg.vue" | ||||
| import ManageRequests from "@/Apps/Inscription/ManageRequests.vue"; | ||||
| import ManageResearcherProfile from "@/Apps/ScientificPublications/ManageResearcherProfile.vue"; | ||||
| import ListResearches from "@/Apps/ScientificPublications/ListResearches.vue"; | ||||
| import ResearcherProfile from "@/Apps/ScientificPublications/ResearcherProfile.vue"; | ||||
|  | ||||
| const apps = { | ||||
| 		'/login': LoginPage, | ||||
| @ -23,9 +25,12 @@ const apps = { | ||||
| 		'/students-list' : Students, | ||||
| 		'/manage-researcher-profile' : ManageResearcherProfile, | ||||
| 		'/msg' : Msg, | ||||
| 		'/researches' : ListResearches, | ||||
| 		'/researcher-profile': ResearcherProfile | ||||
| } | ||||
|  | ||||
| const appsList = { | ||||
| 		'ListResearches': {path:'#/researches', icon:'fa-book-bookmark',text:i18n("app.list.researches")}, | ||||
| 		'Msg': { path: '#/msg', icon: 'fa-comment', text: i18n("app.messages") }, | ||||
| 		'Notification': { path: '#/notifs', icon: 'fa-bell', text: i18n("app.notifications") }, | ||||
| 		'Forum': { path: '#/forum', icon: 'fa-envelope', text: i18n("app.forum") }, | ||||
| @ -35,12 +40,13 @@ const appsList = { | ||||
| 		'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")}, | ||||
| 		'UsersList':{ path: '#/users-list',icon: 'fa-users',text: i18n("app.users")}, | ||||
| 		'ManageResearcherProfile':{path:'#/manage-researcher-profile',icon:'fa-book-bookmark',text:i18n("app.manage.researcherProfile")}, | ||||
|  | ||||
| } | ||||
|  | ||||
| const currentPath = ref(window.location.hash) | ||||
|  | ||||
| export const currentView = computed(() => { | ||||
| 		return apps[currentPath.value.slice(1) || '/'] | ||||
| 		return apps[currentPath.value.split("?")[0].slice(1) || '/'] | ||||
| }) | ||||
|  | ||||
| /** | ||||
|  | ||||
		Reference in New Issue
	
	Block a user