mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 04:04:20 +00:00 
			
		
		
		
	Added translation to post form
This commit is contained in:
		@@ -358,7 +358,7 @@ ComunicWeb.components.posts.form = {
 | 
				
			|||||||
				
 | 
									
 | 
				
			||||||
				//Check message content
 | 
									//Check message content
 | 
				
			||||||
				if(!ComunicWeb.components.posts.form._check_message(message_content)){
 | 
									if(!ComunicWeb.components.posts.form._check_message(message_content)){
 | 
				
			||||||
					ComunicWeb.common.notificationSystem.showNotification("The specified message is invalid !", "danger");
 | 
										ComunicWeb.common.notificationSystem.showNotification(lang("form_post_err_invalid_message"), "danger");
 | 
				
			||||||
					return;
 | 
										return;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -371,7 +371,7 @@ ComunicWeb.components.posts.form = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				//Check for image
 | 
									//Check for image
 | 
				
			||||||
				if(imgFileInput.files.length == 0){
 | 
									if(imgFileInput.files.length == 0){
 | 
				
			||||||
					ComunicWeb.common.notificationSystem.showNotification("Please choose an image !", "danger");
 | 
										ComunicWeb.common.notificationSystem.showNotification(lang("form_post_err_no_image_selected"), "danger");
 | 
				
			||||||
					return;
 | 
										return;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -388,7 +388,7 @@ ComunicWeb.components.posts.form = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				//Check its validity
 | 
									//Check its validity
 | 
				
			||||||
				if(!videoID){
 | 
									if(!videoID){
 | 
				
			||||||
					ComunicWeb.common.notificationSystem.showNotification("The specified Youtube link seems to be invalid !", "danger");
 | 
										ComunicWeb.common.notificationSystem.showNotification(lang("form_post_err_invalid_youtube_link"), "danger");
 | 
				
			||||||
					return;
 | 
										return;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -403,7 +403,7 @@ ComunicWeb.components.posts.form = {
 | 
				
			|||||||
				var movieID = movieIDInput.value;
 | 
									var movieID = movieIDInput.value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if(movieID == 0){
 | 
									if(movieID == 0){
 | 
				
			||||||
					ComunicWeb.common.notificationSystem.showNotification("Please choose a movie !", "danger");
 | 
										ComunicWeb.common.notificationSystem.showNotification(lang("form_post_err_no_movie_selected"), "danger");
 | 
				
			||||||
					return;
 | 
										return;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -418,7 +418,7 @@ ComunicWeb.components.posts.form = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				//Check for image
 | 
									//Check for image
 | 
				
			||||||
				if(pdfFileInput.files.length == 0){
 | 
									if(pdfFileInput.files.length == 0){
 | 
				
			||||||
					ComunicWeb.common.notificationSystem.showNotification("Please pick a PDF !", "danger");
 | 
										ComunicWeb.common.notificationSystem.showNotification(lang("form_post_err_no_pdf_selected"), "danger");
 | 
				
			||||||
					return;
 | 
										return;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -433,7 +433,7 @@ ComunicWeb.components.posts.form = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				//Check the given url
 | 
									//Check the given url
 | 
				
			||||||
				if(!check_url(linkInput.value)){
 | 
									if(!check_url(linkInput.value)){
 | 
				
			||||||
					ComunicWeb.common.notificationSystem.showNotification("Please check the given URL !", "danger");
 | 
										ComunicWeb.common.notificationSystem.showNotification(lang("form_post_err_invalid_url"), "danger");
 | 
				
			||||||
					return;
 | 
										return;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -447,14 +447,14 @@ ComunicWeb.components.posts.form = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				//Check the given time
 | 
									//Check the given time
 | 
				
			||||||
				if(dateEndInput.value.length < 10){
 | 
									if(dateEndInput.value.length < 10){
 | 
				
			||||||
					ComunicWeb.common.notificationSystem.showNotification("Please specify a date for the countdown timer !", "danger");
 | 
										ComunicWeb.common.notificationSystem.showNotification(lang("form_post_err_no_end_date_selected"), "danger");
 | 
				
			||||||
					return;
 | 
										return;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				//Convert the date to an array
 | 
									//Convert the date to an array
 | 
				
			||||||
				var end_date_array = dateEndInput.value.split("/");
 | 
									var end_date_array = dateEndInput.value.split("/");
 | 
				
			||||||
				if(end_date_array.length < 3) {
 | 
									if(end_date_array.length < 3) {
 | 
				
			||||||
					ComunicWeb.common.notificationSystem.showNotification("Specified date for the countdown timer is invalid !", "danger");
 | 
										ComunicWeb.common.notificationSystem.showNotification(lang("form_post_err_selected_end_date_invalid"), "danger");
 | 
				
			||||||
					return;
 | 
										return;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -491,13 +491,13 @@ ComunicWeb.components.posts.form = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				//Check the given question
 | 
									//Check the given question
 | 
				
			||||||
				if(surveyQuestionInput.value.length < 5){
 | 
									if(surveyQuestionInput.value.length < 5){
 | 
				
			||||||
					ComunicWeb.common.notificationSystem.showNotification("Please specify a question for the survey !", "danger");
 | 
										ComunicWeb.common.notificationSystem.showNotification(lang("form_post_err_no_question_for_survey"), "danger");
 | 
				
			||||||
					return;
 | 
										return;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				//Get the answers
 | 
									//Get the answers
 | 
				
			||||||
				if(surveyAnswerInput.children.length < 2){
 | 
									if(surveyAnswerInput.children.length < 2){
 | 
				
			||||||
					ComunicWeb.common.notificationSystem.showNotification("Please specify at least two options for the survey !", "danger");
 | 
										ComunicWeb.common.notificationSystem.showNotification(lang("form_post_err_not_enough_survey_options"), "danger");
 | 
				
			||||||
					return;
 | 
										return;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -517,7 +517,7 @@ ComunicWeb.components.posts.form = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			//The post type is not supported
 | 
								//The post type is not supported
 | 
				
			||||||
			else {
 | 
								else {
 | 
				
			||||||
				ComunicWeb.common.notificationSystem.showNotification("Please check you have chosen a post type !", "danger");
 | 
									ComunicWeb.common.notificationSystem.showNotification(lang("form_post_err_no_post_type_selected"), "danger");
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -533,14 +533,14 @@ ComunicWeb.components.posts.form = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				//Check for errors
 | 
									//Check for errors
 | 
				
			||||||
				if(result.error){
 | 
									if(result.error){
 | 
				
			||||||
					ComunicWeb.common.notificationSystem.showNotification("An error occured while trying to send a new post !", "danger");
 | 
										ComunicWeb.common.notificationSystem.showNotification(lang("form_post_err_send_new_post"), "danger");
 | 
				
			||||||
					sendButton.disabled = false;
 | 
										sendButton.disabled = false;
 | 
				
			||||||
					return;
 | 
										return;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				//Else
 | 
									//Else
 | 
				
			||||||
				//Display a success notification
 | 
									//Display a success notification
 | 
				
			||||||
				ComunicWeb.common.notificationSystem.showNotification("The post has been successfully created !", "success");
 | 
									ComunicWeb.common.notificationSystem.showNotification(lang("form_post_success_create_post"), "success");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				//Refresh current page
 | 
									//Refresh current page
 | 
				
			||||||
				ComunicWeb.common.page.refresh_current_page();
 | 
									ComunicWeb.common.page.refresh_current_page();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,6 +53,19 @@ ComunicWeb.common.langs.en = {
 | 
				
			|||||||
    _input_survey_answers_hint: "Type your answer and then press return (enter) key to confirm it.",
 | 
					    _input_survey_answers_hint: "Type your answer and then press return (enter) key to confirm it.",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _err_drag_image_post: "Please do not drag images directly in the message !",
 | 
					    _err_drag_image_post: "Please do not drag images directly in the message !",
 | 
				
			||||||
 | 
					    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 !",
 | 
				
			||||||
 | 
					    form_post_err_selected_end_date_invalid: "Specified date for the countdown timer is invalid !",
 | 
				
			||||||
 | 
					    form_post_err_no_question_for_survey: "Please specify a question for the survey !",
 | 
				
			||||||
 | 
					    form_post_err_not_enough_survey_options: "Please specify at least two options for the survey !",
 | 
				
			||||||
 | 
					    form_post_err_no_post_type_selected: "Please check you have chosen a post type !",
 | 
				
			||||||
 | 
					    form_post_err_send_new_post: "An error occured while trying to send a new post !",
 | 
				
			||||||
 | 
					    form_post_success_create_post: "The post has been successfully created !",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user