PHP Classes

File: public/js/tools/langCms.tool.js

Recommend this page to a friend!
  Classes of Fabrice Fesch   Melis CMS   public/js/tools/langCms.tool.js   Download  
File: public/js/tools/langCms.tool.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Melis CMS
Content management system that provides its tools
Author: By
Last change:
Date: 1 year ago
Size: 5,058 bytes
 

Contents

Class file image Download
$(function() { //var formAdd = "#formplatformadd form#idformsite"; var formEdit = "#formplatformedit form#idformlang"; addEvent("#btn_cms_new_lang",function(){ melisCoreTool.showOnlyTab('#modal-language-cms', '#id_meliscms_tool_language_modal_content_new'); melisCoreTool.clearForm("idformlang"); }); addEvent("#btnLangCmsAdd", function() { var dataString = $(this).parent().find("#idformlang").serialize(); melisCoreTool.pending("#btnLangCmsAdd"); melisCoreTool.processing(); $.ajax({ type : 'POST', url : '/melis/MelisCms/Language/addLanguage', data : dataString, dataType : 'json', encode : true }).done(function(data) { if ( data.success ) { $('#modal-language-cms').modal('hide'); melisHelper.zoneReload("id_meliscms_tool_language", "meliscms_tool_language"); melisHelper.melisOkNotification(data.textTitle, data.textMessage); } else { melisCoreTool.alertDanger("#languagealert", '', data.textMessage); melisHelper.melisKoNotification(data.textTitle, data.textMessage, data.errors); melisCoreTool.highlightErrors(data.success, data.errors, "idformlang"); } melisCoreTool.done("#btnLangCmsAdd"); melisCore.flashMessenger(); melisCoreTool.processDone(); }).fail(function(xhr, textStatus, errorThrown) { alert( translations.tr_meliscore_error_message ); }); }); addEvent("#btnLangCmsEdit", function() { melisCoreTool.showOnlyTab('#modal-language-cms', '#id_meliscms_tool_language_modal_content_edit'); var getId = $(this).parents("tr").attr("id"); $.ajax({ type : 'POST', url : '/melis/MelisCms/Language/getLanguageById', data : {id : getId}, dataType : 'json', encode : true }).done(function(data) { melisCoreTool.pending(".btn"); $(formEdit + " input[type='text']").each(function(index) { var name = $(this).attr('name'); $("input#" + $(this).attr('id')).val(data.language[name]); $("span#platformupdateid").html(data.language['lang_cms_id']); }); melisCoreTool.done(".btn"); }).fail(function(xhr, textStatus, errorThrown) { alert( translations.tr_meliscore_error_message ); }); }); addEvent("#btnLangEdit", function() { var dataString = $(formEdit).serializeArray(); dataString.push({ name: "id", value: $("#platformupdateid").html() }); dataString = $.param(dataString); melisCoreTool.pending("#btnLangEdit"); melisCoreTool.processing(); $.ajax({ type : 'POST', url : '/melis/MelisCms/Language/editLanguage', data : dataString, dataType : 'json', encode : true }).done(function(data) { if(data.success) { //alert("success!"); $('#modal-language-cms').modal('hide'); melisHelper.zoneReload("id_meliscms_tool_language", "meliscms_tool_language"); // Show Pop-up Notification melisHelper.melisOkNotification(data.textTitle, data.textMessage); } else { melisCoreTool.alertDanger("#langeditalert", '', data.textMessage); melisHelper.melisKoNotification(data.textTitle, data.textMessage, data.errors); melisCoreTool.highlightErrors(data.success, data.errors, "formplatformedit form#idformlang"); } melisCoreTool.done("#btnLangEdit"); melisCore.flashMessenger(); melisCoreTool.processDone(); }).fail(function(){ alert( translations.tr_meliscore_error_message ); }); }); addEvent("#btnLangCmsDelete", function() { var getId = $(this).parents("tr").attr("id"); melisCoreTool.confirm( translations.tr_meliscms_common_yes, translations.tr_meliscore_common_no, translations.tr_meliscms_tool_language, translations.tr_meliscms_tool_language_delete_confirm, function() { $.ajax({ type : 'POST', url : '/melis/MelisCms/Language/deleteLanguage', data : {id : getId}, dataType : 'json', encode : true }).done(function(data) { melisCoreTool.pending(".btn-danger"); if ( data.success ) { melisHelper.zoneReload("id_meliscms_tool_language_content", "meliscms_tool_language_content"); melisHelper.zoneReload("id_meliscms_header_language", "meliscms_header_language"); melisHelper.melisOkNotification(data.textTitle, data.textMessage); } else { melisHelper.melisKoNotification(data.textTitle, data.textMessage, data.errors); } melisCore.flashMessenger(); melisCoreTool.done(".btn-danger"); }).fail(function(xhr, textStatus, errorThrown) { alert( translations.tr_meliscore_error_message ); }); }); }); function addEvent(target, func) { $("body").on("click", target, func); } }); window.initLangJs = function() { $('#tableLanguages td:nth-child(3):contains("'+ melisLangId +'")').siblings(':last').html('-'); }