From f45666c72d8f1c9cba2fbf54a59c30fa505e9229 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 13 Feb 2021 11:20:54 +0100 Subject: [PATCH] Deprecate movies system --- assets/css/components/movies/picker.css | 13 - assets/css/components/posts/form.css | 5 - assets/css/dark_theme.css | 6 - assets/js/common/functionsSchema.js | 22 -- assets/js/components/account/export/worker.js | 16 +- assets/js/components/movies/interface.js | 36 --- assets/js/components/movies/picker.js | 237 ------------------ assets/js/components/posts/form.js | 61 ----- assets/js/components/posts/ui.js | 30 --- assets/js/langs/en.inc.js | 3 - assets/js/langs/fr.inc.js | 3 - .../Export.html | 29 --- .../assets/js/categories/movies.js | 30 --- .../assets/js/categories/posts.js | 15 -- .../assets/js/main.js | 1 - system/config/dev.config.php | 6 - 16 files changed, 1 insertion(+), 512 deletions(-) delete mode 100644 assets/css/components/movies/picker.css delete mode 100644 assets/js/components/movies/interface.js delete mode 100644 assets/js/components/movies/picker.js delete mode 100644 assets/zip/personnal-data-export-navigator/assets/js/categories/movies.js diff --git a/assets/css/components/movies/picker.css b/assets/css/components/movies/picker.css deleted file mode 100644 index c2914b23..00000000 --- a/assets/css/components/movies/picker.css +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Movies picker - * - * @author Pierre HUBET - */ - -.pick-movie-modal .modal-body { - /*max-height: 500px;*/ -} - -.pick-movie-modal video { - height: 100px; -} \ No newline at end of file diff --git a/assets/css/components/posts/form.css b/assets/css/components/posts/form.css index 14eb11b3..c21d45cd 100644 --- a/assets/css/components/posts/form.css +++ b/assets/css/components/posts/form.css @@ -47,7 +47,6 @@ */ .post-form .post-image, .post-form .post-youtube, -.post-form .post-movie, .post-form .post-weblink, .post-form .post-pdf, .post-form .post-countdown, @@ -55,10 +54,6 @@ display: none; } -.post-form .post-movie button { - margin-right: 5px; -} - .post-form .post-survey .select2-dropdown { /* Hide select2 suggestions*/ display: none; diff --git a/assets/css/dark_theme.css b/assets/css/dark_theme.css index 3024f4c6..c85b510a 100644 --- a/assets/css/dark_theme.css +++ b/assets/css/dark_theme.css @@ -631,12 +631,6 @@ img[src$="groups_logo/default.png"] { color: var(--white); } -/** -* Pick a movie modal -*/ -.pick-movie-modal { - color: var(--white); -} /** * Group settings page diff --git a/assets/js/common/functionsSchema.js b/assets/js/common/functionsSchema.js index 8aca27d9..b6c451bc 100644 --- a/assets/js/common/functionsSchema.js +++ b/assets/js/common/functionsSchema.js @@ -998,28 +998,6 @@ var ComunicWeb = { //TODO : implement }, - /** - * Movies functions - */ - movies: { - - /** - * Movies communication interface - */ - interface: { - //TODO : implement - }, - - /** - * Movies picker - */ - picker:{ - //TODO : implement - }, - - }, - - /** * Notifications components */ diff --git a/assets/js/components/account/export/worker.js b/assets/js/components/account/export/worker.js index 4adc219d..c3f98611 100644 --- a/assets/js/components/account/export/worker.js +++ b/assets/js/components/account/export/worker.js @@ -200,21 +200,10 @@ ComunicWeb.components.account.export.worker = { post.comments.forEach(parseComment); } - /** - * Parse a movie to find potential files to download - * - * @param {Object} info Information about the movie to parse - */ - var parseMovie = function(info){ - if(info.url != null) - if(!files.includes(info.url)) - files.push(info.url); - } - /** * Parse a conversation message to find potential files to download * - * @param {Object} info Information about the movie to parse + * @param {Object} info Information about the conversation to parse */ var parseConversationMessage = function(info){ if(info.image_path != null) @@ -233,9 +222,6 @@ ComunicWeb.components.account.export.worker = { //Comments data.comments.forEach(parseComment); - //Movie - data.movies.forEach(parseMovie); - //Conversation message //* All from users data.all_conversation_messages.forEach(parseConversationMessage); diff --git a/assets/js/components/movies/interface.js b/assets/js/components/movies/interface.js deleted file mode 100644 index 429ccb7c..00000000 --- a/assets/js/components/movies/interface.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Movies communication interface - * - * @author Pierre HUBERT - */ - -ComunicWeb.components.movies.interface = { - - /** - * Get the list of movies of the user from the server - * - * @param {function} callback What to do once we got a response from the server - */ - getList: function(callback){ - - apiURI = "movies/get_list"; - params = {}; - - ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback); - - }, - - - /** - * Delete a movie - * - * @param {number} movieID The ID of the movie to delete - * @return {Promise} - */ - delete: function(movieID) { - return api("movies/delete", { - movieID: movieID - }, true); - } - -} \ No newline at end of file diff --git a/assets/js/components/movies/picker.js b/assets/js/components/movies/picker.js deleted file mode 100644 index 86bad12f..00000000 --- a/assets/js/components/movies/picker.js +++ /dev/null @@ -1,237 +0,0 @@ -/** - * Movies picker - * - * @author Pierre HUBERT - */ - -ComunicWeb.components.movies.picker = { - - /** - * Display the movie picker - * - * Allows the user to choose a movie from his collection - * - * @param {function} callback What to do once a movie has been selected - */ - pick: function(callback){ - - //Create the modal - var modal = createElem2({ - type: "div", - class: "modal pick-movie-modal", - }); - modal.setAttribute("role", "dialog"); - - - var modalDialog = createElem2({ - appendTo: modal, - type: "div", - class: "modal-dialog" - }); - - var modalContent = createElem2({ - appendTo: modalDialog, - type: "div", - class: "modal-content", - }); - - //Modal header - var modalHeader = createElem2({ - appendTo: modalContent, - type: "div", - class: "modal-header" - }); - - var closeModal = createElem2({ - appendTo: modalHeader, - type: "button", - class: "close", - }); - closeModal.onclick = function(){ - $(modal).modal('hide'); - } - - createElem2({ - appendTo: closeModal, - type: "span", - innerHTML: "x" - }); - - var modalTitle = createElem2({ - appendTo: modalHeader, - type: "h4", - class: "modal-title", - innerHTML: "Pick a movie" - }); - - //Modal body - var modalBody = createElem2({ - appendTo: modalContent, - type: "div", - class: "modal-body", - innerHTML: "

Loading, please wait...

" - }); - - //Modal footer - var modalFooter = createElem2({ - appendTo: modalContent, - type: "div", - class: "modal-footer" - }); - - var closeButton = createElem2({ - appendTo: modalFooter, - type: "button", - class: "btn btn-danger", - innerHTML: "Cancel" - }); - closeButton.onclick = function(){ - $(modal).modal('hide'); - } - - //Show the modal - $(modal).modal('show'); - - //Get the list of movies of the user - ComunicWeb.components.movies.interface.getList(function(result){ - - //In case of error - if(result.error){ - ComunicWeb.common.notificationSystem.showNotification("Couldn't get the list of movies of the user !", "danger"); - return; - } - - //Process the list of movies - ComunicWeb.components.movies.picker._display_list(result, modal, modalBody, callback); - - }); - }, - - /** - * Display the list of movies - * - * @param {object} list The list of movies - * @param {HTMLElement} modalRoot The modal root node - * @param {HTMLElement} modalBody The modal body - * @param {function} callback What to do once a movie has been picked - */ - _display_list: function(list, modalRoot, modalBody, callback){ - - //Empty modal body - emptyElem(modalBody); - - //Create a table to display the list of movies - var moviesTable = createElem2({ - appendTo: modalBody, - type: "table", - class: "table table-hover" - }); - - //Create table header - var tableHead = createElem2({ - appendTo: moviesTable, - type: "thead" - }); - - var tableTR = createElem2({ - appendTo: tableHead, - type: "tr", - innerHTML: "Name" - }); - - var tableBody = createElem2({ - appendTo: moviesTable, - type: "tbody", - }); - - - //Process the list of movies - var i; - for(i in list) { - - const movie = list[i]; - - //Create a line - const line = createElem2({ - appendTo: tableBody, - type: "tr", - }); - - //Video cell - var videoCell = createElem2({ - appendTo: line, - type: "td" - }); - - var videoElem = createElem2({ - appendTo: videoCell, - type: "video", - }); - videoElem.setAttribute("controls", ""); - - var videoSrc = createElem2({ - appendTo: videoElem, - type: "source", - src: list[i].url - }); - videoSrc.setAttribute("type", list[i].file_type); - - //Name cell - var nameCell = createElem2({ - appendTo: line, - type: "td", - innerHTML: list[i].name - }); - - //Actions cell - var actionCell = createElem2({ - appendTo: line, - type: "td", - }); - - const chooseButton = createElem2({ - appendTo: actionCell, - type: "button", - class: "btn btn-primary", - innerHTML: "Choose" - }); - chooseButton.setAttribute("data-movie-num", i); - - chooseButton.onclick = function(){ - - //Hide the modal - $(modalRoot).modal('hide'); - - //Call callback - callback(list[this.getAttribute("data-movie-num")]); - } - - - // Add delete button - createElem2({ - appendTo: actionCell, - type: "button", - class: "btn btn-danger", - innerHTML: "Delete", - onclick: () => { - - ComunicWeb.common.messages.confirm("Do you really want to delete this movie ?", async res => { - - if(!res) - return; - - try { - await ComunicWeb.components.movies.interface.delete(movie.id) - line.remove(); - } catch(e) { - console.error(e); - notify("Could not delete movie!", "danger"); - } - - }) - - } - }) - } - }, -} \ No newline at end of file diff --git a/assets/js/components/posts/form.js b/assets/js/components/posts/form.js index 7bd093a3..4702b15a 100644 --- a/assets/js/components/posts/form.js +++ b/assets/js/components/posts/form.js @@ -97,9 +97,6 @@ ComunicWeb.components.posts.form = { //Youtube var youtubeType = this._add_post_type(postTypesContainer, "youtube", " "); - //Movie - var movieType = this._add_post_type(postTypesContainer, "movie", " "); - //Link var linkType = this._add_post_type(postTypesContainer, "link", " "); @@ -144,45 +141,6 @@ ComunicWeb.components.posts.form = { }); //End : Youtube - - //Add movie input form - var movieInputForm = createElem2({ - appendTo: boxBody, - type: "div", - class: "post-movie", - }); - - //Add choose button - var movieChooseButton = createElem2({ - appendTo: movieInputForm, - type: "button", - class: "btn btn-primary", - innerHTML: lang("_choose") - }); - - var movieIDInput = createElem2({ - appendTo: movieInputForm, - type: "input", - elemType: "hidden", - value: 0 - }); - - var movieName = createElem2({ - appendTo: movieInputForm, - type: "span", - innerHTML: lang("_no_movie_selected") - }); - - //Make movie choose button lives - movieChooseButton.onclick = function(){ - ComunicWeb.components.movies.picker.pick(function(movie){ - //Set movie ID and name - movieIDInput.value = movie.id; - movieName.innerHTML = movie.name; - }); - } - //End : movie - //Add webpage input form var linkChooseForm = createElem2({ appendTo: boxBody, @@ -300,10 +258,8 @@ ComunicWeb.components.posts.form = { //Create post type change handler var changesHandler = function(){ - imgUploadForm.style.display = imageType.checked ? "block" : "none"; youtubeInputForm.style.display = youtubeType.checked ? "block" : "none"; - movieInputForm.style.display = movieType.checked ? "block" : "none"; linkChooseForm.style.display = linkType.checked ? "block" : "none"; pdfUploadForm.style.display = pdfType.checked ? "block" : "none"; countdownForm.style.display = countdownType.checked ? "block" : "none"; @@ -314,7 +270,6 @@ ComunicWeb.components.posts.form = { textType.onclick = changesHandler; imageType.onclick = changesHandler; youtubeType.onclick = changesHandler; - movieType.onclick = changesHandler; linkType.onclick = changesHandler; pdfType.onclick = changesHandler; countdownType.onclick = changesHandler; @@ -429,22 +384,6 @@ ComunicWeb.components.posts.form = { datas.append("youtube_id", videoID); } - //Check for movie - else if(movieType.checked){ - - var movieID = movieIDInput.value; - - if(movieID == 0){ - ComunicWeb.common.notificationSystem.showNotification(lang("form_post_err_no_movie_selected"), "danger"); - return; - } - - //Append values - datas.append("kind", "movie"); - datas.append("movieID", movieID); - - } - //Check for PDF else if(pdfType.checked){ diff --git a/assets/js/components/posts/ui.js b/assets/js/components/posts/ui.js index e9ebf5e9..055d644f 100644 --- a/assets/js/components/posts/ui.js +++ b/assets/js/components/posts/ui.js @@ -395,36 +395,6 @@ ComunicWeb.components.posts.ui = { } } - //In case of video - else if(info.kind == "movie"){ - - var videoContainer = createElem2({ - appendTo: postRoot, - type: "div", - class: "post-video" - }); - - //Create video element - var video = createElem2({ - appendTo: videoContainer, - type: "video", - class: "video-js vjs-default-skin" - }); - video.setAttribute("controls", ""); - - //Add source - var video_src = createElem2({ - appendTo: video, - type: "source", - src: info.video_info.url - }); - video_src.type = info.video_info.file_type; - - //Enable videoJS - //videojs(video); - - } - //In case of YouTube video else if(info.kind == "youtube"){ diff --git a/assets/js/langs/en.inc.js b/assets/js/langs/en.inc.js index ef3a5339..cd022c2e 100644 --- a/assets/js/langs/en.inc.js +++ b/assets/js/langs/en.inc.js @@ -88,14 +88,12 @@ ComunicWeb.common.langs.en = { _post_type_text: "Text", _post_type_youtube: "Youtube", _post_type_image: "Image", - _post_type_movie: "Movie", _post_type_link: "Weblink", _post_type_pdf: "PDF", _post_type_countdown: "Timer", _post_type_survey: "Survey", _input_youtube_link_label: "Youtube video link", - _no_movie_selected: "No movie selected.", _input_page_url_label: "Page URL", _input_countdown_enddate: "End date", _input_countdown_endtime: "End time", @@ -108,7 +106,6 @@ ComunicWeb.common.langs.en = { form_post_err_invalid_message: "The specified message is invalid !", form_post_err_no_image_selected: "Please choose an image !", form_post_err_invalid_youtube_link: "The specified Youtube link seems to be invalid !", - form_post_err_no_movie_selected: "Please choose a movie !", form_post_err_no_pdf_selected: "Please pick a PDF !", form_post_err_invalid_url: "Please check the given URL !", form_post_err_no_end_date_selected: "Please specify a date for the countdown timer !", diff --git a/assets/js/langs/fr.inc.js b/assets/js/langs/fr.inc.js index cac227d6..59e93f37 100644 --- a/assets/js/langs/fr.inc.js +++ b/assets/js/langs/fr.inc.js @@ -88,14 +88,12 @@ ComunicWeb.common.langs.fr = { _post_type_text: "Texte", _post_type_youtube: "Youtube", _post_type_image: "Image", - _post_type_movie: "Vidéos", _post_type_link: "Lien web", _post_type_pdf: "PDF", _post_type_countdown: "Compteur à rebours", _post_type_survey: "Sondage", _input_youtube_link_label: "Lien de la vidéo YouTube", - _no_movie_selected: "Aucune vidéo sélectionnée.", _input_page_url_label: "URL de la page", _input_countdown_enddate: "Date de fin", _input_countdown_endtime: "Heure de fin", @@ -108,7 +106,6 @@ ComunicWeb.common.langs.fr = { form_post_err_invalid_message: "Le message saisi est invalide !", form_post_err_no_image_selected: "Veuillez sélectionner une image !", form_post_err_invalid_youtube_link: "Le lien YouTube spécifié semble invalide !", - form_post_err_no_movie_selected: "Veuillez choisir une vidéo !", form_post_err_no_pdf_selected: "Veuillez sélectionner un PDF !", form_post_err_invalid_url: "L'URL saisie semble invalide !", form_post_err_no_end_date_selected: "Veuillez choisir une date pour le compteur à rebours !", diff --git a/assets/zip/personnal-data-export-navigator/Export.html b/assets/zip/personnal-data-export-navigator/Export.html index 798880fc..4c586aa5 100644 --- a/assets/zip/personnal-data-export-navigator/Export.html +++ b/assets/zip/personnal-data-export-navigator/Export.html @@ -32,7 +32,6 @@
  • Comments
  • Likes
  • Responses to surveys
  • -
  • Movies
  • Conversations Messages (ALL)
  • Conversations
  • @@ -168,33 +167,6 @@ - - -
    - -

    Your movies

    - - - - - - - - - - - - - - - - - - - -
    NumberNameFile typeFile sizeActions
    - -
    @@ -243,7 +215,6 @@ - diff --git a/assets/zip/personnal-data-export-navigator/assets/js/categories/movies.js b/assets/zip/personnal-data-export-navigator/assets/js/categories/movies.js deleted file mode 100644 index e5580fa8..00000000 --- a/assets/zip/personnal-data-export-navigator/assets/js/categories/movies.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Movies category - * - * @author Pierre HUBERT - */ - -/** - * Apply the list of movies of the user - */ -function ApplyMovies(){ - - let target = document.querySelector("#full-movie-list-table tbody"); - - //Process the list of movies - data.movies.forEach(movie => { - - createElem2({ - appendTo: target, - type: "tr", - innerHTML: - "" + movie.id + "" + - "" + movie.name + "" + - "" + movie.file_type + "" + - "" + movie.size + "" + - " Open" - }); - - }); - -} \ No newline at end of file diff --git a/assets/zip/personnal-data-export-navigator/assets/js/categories/posts.js b/assets/zip/personnal-data-export-navigator/assets/js/categories/posts.js index c66d254d..2bb64d66 100644 --- a/assets/zip/personnal-data-export-navigator/assets/js/categories/posts.js +++ b/assets/zip/personnal-data-export-navigator/assets/js/categories/posts.js @@ -136,21 +136,6 @@ function ApplyPosts(){ } - - //Post with movie - if(post.kind == "movie"){ - - //Display the movie only (movies have a dedicated tab) - createElem2({ - appendTo: cardContent, - type: "a", - href: getFilePathFromURL(post.video_info.url), - innerHTML: "Open movie" - }); - } - - - //Post with weblink if(post.kind == "weblink"){ diff --git a/assets/zip/personnal-data-export-navigator/assets/js/main.js b/assets/zip/personnal-data-export-navigator/assets/js/main.js index f51a3302..6ccd6114 100644 --- a/assets/zip/personnal-data-export-navigator/assets/js/main.js +++ b/assets/zip/personnal-data-export-navigator/assets/js/main.js @@ -79,7 +79,6 @@ xhr.onload = function(){ ApplyCommentsList(); ApplyUserLikes(); ApplySurveyResponses(); - ApplyMovies(); ApplyAllConversationMessages(); ApplyConversations(); } diff --git a/system/config/dev.config.php b/system/config/dev.config.php index 19952b37..99ae6217 100644 --- a/system/config/dev.config.php +++ b/system/config/dev.config.php @@ -214,8 +214,6 @@ class Dev { "css/components/posts/edit.css", "css/components/posts/targetPicker.css", - //Movies picker - "css/components/movies/picker.css", //Comments component "css/components/comments/ui.css", @@ -434,10 +432,6 @@ class Dev { //Countdown timer "js/components/countdown.js", - //Movies - "js/components/movies/interface.js", - "js/components/movies/picker.js", - //Notifications "js/components/notifications/dropdown.js", "js/components/notifications/service.js",