Deprecate movies system

This commit is contained in:
Pierre HUBERT 2021-02-13 11:20:54 +01:00
parent 37e90f1c18
commit f45666c72d
16 changed files with 1 additions and 512 deletions

View File

@ -1,13 +0,0 @@
/**
* Movies picker
*
* @author Pierre HUBET
*/
.pick-movie-modal .modal-body {
/*max-height: 500px;*/
}
.pick-movie-modal video {
height: 100px;
}

View File

@ -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;

View File

@ -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

View File

@ -998,28 +998,6 @@ var ComunicWeb = {
//TODO : implement
},
/**
* Movies functions
*/
movies: {
/**
* Movies communication interface
*/
interface: {
//TODO : implement
},
/**
* Movies picker
*/
picker:{
//TODO : implement
},
},
/**
* Notifications components
*/

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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: "<p>Loading, please wait...</p>"
});
//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: "<th></th><th>Name</th><th></th>"
});
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");
}
})
}
})
}
},
}

View File

@ -97,9 +97,6 @@ ComunicWeb.components.posts.form = {
//Youtube
var youtubeType = this._add_post_type(postTypesContainer, "youtube", "<i class='fa fa-youtube-play'></i> <span class='hidden-xs'>"+lang("_post_type_youtube")+"</span>");
//Movie
var movieType = this._add_post_type(postTypesContainer, "movie", "<i class='fa fa-file-movie-o'></i> <span class='hidden-xs'>"+lang("_post_type_movie")+"</span>");
//Link
var linkType = this._add_post_type(postTypesContainer, "link", "<i class='fa fa-link'></i> <span class='hidden-xs'>"+lang("_post_type_link")+"</span>");
@ -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){

View File

@ -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"){

View File

@ -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 !",

View File

@ -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&eacute;lectionner une image !",
form_post_err_invalid_youtube_link: "Le lien YouTube sp&eacute;cifi&eacute; semble invalide !",
form_post_err_no_movie_selected: "Veuillez choisir une vid&eacute;o !",
form_post_err_no_pdf_selected: "Veuillez s&eacute;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 !",

View File

@ -32,7 +32,6 @@
<li class="bold"><a href="#comments" class="waves-effect waves-teal">Comments</a></li>
<li class="bold"><a href="#likes" class="waves-effect waves-teal">Likes</a></li>
<li class="bold"><a href="#survey-responses" class="waves-effect waves-teal">Responses to surveys</a></li>
<li class="bold"><a href="#movies" class="waves-effect waves-teal">Movies</a></li>
<li class="bold"><a href="#all-conversations-message" class="waves-effect waves-teal">Conversations Messages (ALL)</a></li>
<li class="bold"><a href="#conversations" class="waves-effect waves-teal">Conversations</a></li>
</ul>
@ -169,33 +168,6 @@
</div>
<!-- Entire movies list -->
<div id="movies" class="category container">
<h1>Your movies</h1>
<table id="full-movie-list-table">
<thead>
<tr>
<th>Number</th>
<th>Name</th>
<th>File type</th>
<th>File size</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<!-- Movies will go here -->
</tbody>
</table>
</div>
<!-- Entire list of conversation messages -->
<div id="all-conversations-message" class="category container">
@ -243,7 +215,6 @@
<script src="assets/js/categories/comments.js"></script>
<script src="assets/js/categories/likes.js"></script>
<script src="assets/js/categories/survey.js"></script>
<script src="assets/js/categories/movies.js"></script>
<script src="assets/js/categories/allConversationMessages.js"></script>
<script src="assets/js/categories/conversations.js"></script>
<script src="assets/js/main.js"></script>

View File

@ -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:
"<td>" + movie.id + "</td>" +
"<td>" + movie.name + "</td>" +
"<td>" + movie.file_type + "</td>" +
"<td>" + movie.size + "</td>" +
"<td> <a href='"+getFilePathFromURL(movie.url)+"'>Open</a></td>"
});
});
}

View File

@ -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"){

View File

@ -79,7 +79,6 @@ xhr.onload = function(){
ApplyCommentsList();
ApplyUserLikes();
ApplySurveyResponses();
ApplyMovies();
ApplyAllConversationMessages();
ApplyConversations();
}

View File

@ -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",