diff --git a/administrator/components/com_associations/views/association/tmpl/edit.php b/administrator/components/com_associations/views/association/tmpl/edit.php index ced7000ad5d54..f0b10ccd2ef93 100644 --- a/administrator/components/com_associations/views/association/tmpl/edit.php +++ b/administrator/components/com_associations/views/association/tmpl/edit.php @@ -21,8 +21,10 @@ 'itemtype' => $this->itemtype, 'id' => $this->referenceId, ); + +JText::script('COM_ASSOCIATIONS_CONFIRM_CANCEL'); ?> - diff --git a/administrator/language/en-GB/en-GB.com_associations.ini b/administrator/language/en-GB/en-GB.com_associations.ini index 10b45c96dcd2b..21be63568ce8b 100644 --- a/administrator/language/en-GB/en-GB.com_associations.ini +++ b/administrator/language/en-GB/en-GB.com_associations.ini @@ -11,6 +11,7 @@ COM_ASSOCIATIONS_COMPONENT_NOT_SUPPORTED="The extension %s does not support mult COM_ASSOCIATIONS_COMPONENT_SELECTOR_DESC="Select a component from this list" COM_ASSOCIATIONS_COMPONENT_SELECTOR_LABEL="Select component" COM_ASSOCIATIONS_CONFIGURATION="Multilingual Associations: Options" +COM_ASSOCIATIONS_CONFIRM_CANCEL="Make sure you have saved your changes before closing. \nWarning! It is extremely important to 'Save Target' when the target has been created using 'Copy Reference to Target'." COM_ASSOCIATIONS_COPY_REFERENCE="Copy Reference to Target" COM_ASSOCIATIONS_DELETE_ORPHANS="Delete Orphans" COM_ASSOCIATIONS_DELETE_ORPHANS_FAILED="Failed to delete orphans." diff --git a/media/com_associations/js/sidebyside-uncompressed.js b/media/com_associations/js/sidebyside-uncompressed.js index 58b8a0786ab65..8094d06c7d0b0 100644 --- a/media/com_associations/js/sidebyside-uncompressed.js +++ b/media/com_associations/js/sidebyside-uncompressed.js @@ -13,9 +13,12 @@ jQuery(document).ready(function($) { // Using close button, normal joomla submit. if (task == 'association.cancel') { - Joomla.submitform(task); + if (confirm(Joomla.JText._('COM_ASSOCIATIONS_CONFIRM_CANCEL'))) + { + Joomla.submitform(task); + } } - else if(task == 'copy') + else if (task == 'copy') { window.frames['reference-association'].Joomla.submitbutton(document.getElementById('adminForm').getAttribute('data-associatedview') + '.save2copy'); } diff --git a/media/com_associations/js/sidebyside.js b/media/com_associations/js/sidebyside.js index 49a7ff7baaa4c..6f0e316096eee 100644 --- a/media/com_associations/js/sidebyside.js +++ b/media/com_associations/js/sidebyside.js @@ -1 +1 @@ -jQuery(document).ready(function(a){a("#toolbar-target").hide(),a("#toolbar-copy").hide(),Joomla.submitbutton=function(b){if("association.cancel"==b)Joomla.submitform(b);else if("copy"==b)window.frames["reference-association"].Joomla.submitbutton(document.getElementById("adminForm").getAttribute("data-associatedview")+".save2copy");else if("undo-association"==b){var c=document.getElementById("reference-association"),d=document.getElementById("target-association"),f=(c.getAttribute("data-id"),c.getAttribute("data-language").replace(/-/,"_")),h=(d.getAttribute("data-id"),d.getAttribute("data-language").replace(/-/,"_"));c=a(c).contents(),d=a(d).contents(),c.find("#jform_associations_"+h+"_id").val(""),c.find("#jform_associations_"+h+"_name").val(""),c.find("#jform_associations_"+h+"_chzn").remove(),c.find("#jform_associations_"+h).val("").change().chosen();var i="";a("#jform_itemlanguage option").each(function(){i=a(this).val().split("|")[0],"undefined"!=typeof i&&(i=i.replace(/-/,"_"),d.find("#jform_associations_"+i+"_id").val(""),d.find("#jform_associations_"+i+"_chzn").remove(),d.find("#jform_associations_"+i).val("").change().chosen())}),d.find("#jform_associations_"+f+"_id").val(""),d.find("#jform_associations_"+f+"_name").val(""),d.find("#jform_associations_"+f+"_chzn").remove(),d.find("#jform_associations_"+f).val("").change().chosen();var j=a("#jform_itemlanguage").val(),k=h.replace(/_/,"-");a('#jform_itemlanguage option[value="'+j+'"]').val(k+":0:add"),a("#jform_itemlanguage").val("").change(),a("#jform_itemlanguage").trigger("liszt:updated"),Joomla.submitbutton("reference")}else a("#"+b+"-association").contents().find("#jform_language").attr("disabled",!1),window.frames[b+"-association"].Joomla.submitbutton(document.getElementById("adminForm").getAttribute("data-associatedview")+".apply");return!1},Joomla.loadingLayer("load"),a("body").on("click","#toogle-left-panel",function(){var b=this.getAttribute("data-hide-reference"),c=this.getAttribute("data-show-reference");a(this).text()===b?a(this).text(c):a(this).text(b),a("#left-panel").toggle(),a("#right-panel").toggleClass("full-width")}),a("body").on("change","#jform_itemlanguage",function(){var b=document.getElementById("target-association"),c=a(this).val();""!=c&&"undefined"!=typeof c?(b.setAttribute("data-action",c.split(":")[2]),b.setAttribute("data-id",c.split(":")[1]),b.setAttribute("data-language",c.split(":")[0]),Joomla.loadingLayer("show"),b.src=b.getAttribute("data-editurl")+"&task="+b.getAttribute("data-item")+"."+b.getAttribute("data-action")+"&id="+b.getAttribute("data-id")):(a("#toolbar-target").hide(),a("#toolbar-copy").hide(),a("#select-change").addClass("hidden"),a("#remove-assoc").addClass("hidden"),b.setAttribute("data-action",""),b.setAttribute("data-id","0"),b.setAttribute("data-language",""),b.src="")}),a("#reference-association").on("load",function(){if(a(this).contents().find("#jform_id").val()!==this.getAttribute("data-id")){var b=document.getElementById("target-association");b.src=b.getAttribute("data-editurl")+"&task="+b.getAttribute("data-item")+".edit&id="+a(this).contents().find("#jform_id").val(),this.src=this.getAttribute("data-editurl")+"&task="+this.getAttribute("data-item")+".edit&id="+this.getAttribute("data-id")}var c=a(this).contents();c.find("#jform_language_chzn").remove(),c.find("#jform_language").attr("disabled",!0).chosen(),c.find("#associations").find(".btn").remove();var d="";a("#jform_itemlanguage option").each(function(){d=a(this).val().split(":"),"undefined"!=typeof d[0]&&(langAssociation=d[0].replace(/-/,"_"),""==c.find("#jform_associations_"+langAssociation+"_id").val()&&c.find("#jform_associations_"+langAssociation+"_name").val(document.getElementById("reference-association").getAttribute("data-no-assoc")))}),Joomla.loadingLayer("hide")}),a("#target-association").on("load",function(){if(""!=this.getAttribute("src")){a("#toolbar-target").show(),a("#toolbar-copy").show(),a("#select-change").removeClass("hidden");var b=this.getAttribute("data-language"),c=this.getAttribute("data-id"),d=a(this).contents().find("#jform_id").val()||"0";if(a(this).contents().find('a[href="#associations"]').parent().find('.btn').remove(),a(this).contents().find('#associations').find('.btn').remove(),a(this).contents().find("#associations").hasClass("active")&&(a(this).contents().find('a[href="#associations"]').parent().removeClass("active"),a(this).contents().find("#associations").removeClass("active"),a(this).contents().find(".nav-tabs").find("li").first().addClass("active"),a(this).contents().find(".tab-content").find(".tab-pane").first().addClass("active")),a(this).contents().find("#jform_language_chzn").remove(),a(this).contents().find("#jform_language").val(b).change().attr("disabled",!0).chosen(),"0"==d)document.getElementById("select-change-text").innerHTML=document.getElementById("select-change").getAttribute("data-select");else{document.getElementById("select-change-text").innerHTML=document.getElementById("select-change").getAttribute("data-change"),a("#remove-assoc").removeClass("hidden"),a("#toolbar-copy").hide();var e=document.getElementById("target-id").value,f=""==e?d:e+","+d;document.getElementById("target-id").value=f,d!=c&&(a('#jform_itemlanguage option[value^="'+b+":"+c+':add"]').val(b+":"+d+":edit"),this.setAttribute("data-id",d),this.setAttribute("data-action","edit"));var g=document.getElementById("reference-association"),h=b.replace(/-/,"_"),i=a(this).contents().find("#jform_title").val();a(g).contents().find("#jform_associations_"+h+"_id").val(d),a(g).contents().find("#jform_associations_"+h+"_name").val(i),a(g).contents().find("#jform_associations_"+h+"_chzn").remove(),a(g).contents().find("#jform_associations_"+h).append('"),a(g).contents().find("#jform_associations_"+h).val(d).change().chosen()}var g=document.getElementById("reference-association"),j=g.getAttribute("data-id"),h=g.getAttribute("data-language").replace(/-/,"_"),i=a(g).contents().find("#jform_title").val(),k=a(this).contents();k.find("#jform_associations_"+h+"_id").val(j),k.find("#jform_associations_"+h+"_name").val(i),k.find("#jform_associations_"+h+"_chzn").remove();var l=k.find("#jform_associations_"+h);l.append('"),l.val(j).change().chosen();var m,n;a("#jform_itemlanguage option").each(function(){m=a(this).val().split(":"),"undefined"!=typeof m[1]&&"0"!==m[1]&&(n=m[0].replace(/-/,"_"),k.find("#jform_associations_"+n+"_id").val(m[1]),k.find("#jform_associations_"+n+"_chzn").remove(),l=k.find("#jform_associations_"+n),l.append(''),l.val(m[1]).change().chosen())}),Joomla.loadingLayer("hide")}})}); \ No newline at end of file +jQuery(document).ready(function(a){a("#toolbar-target").hide(),a("#toolbar-copy").hide(),Joomla.submitbutton=function(b){if("association.cancel"==b)confirm(Joomla.JText._("COM_ASSOCIATIONS_CONFIRM_CANCEL"))&&Joomla.submitform(b);else if("copy"==b)window.frames["reference-association"].Joomla.submitbutton(document.getElementById("adminForm").getAttribute("data-associatedview")+".save2copy");else if("undo-association"==b){var c=document.getElementById("reference-association"),d=document.getElementById("target-association"),f=(c.getAttribute("data-id"),c.getAttribute("data-language").replace(/-/,"_")),h=(d.getAttribute("data-id"),d.getAttribute("data-language").replace(/-/,"_"));c=a(c).contents(),d=a(d).contents(),c.find("#jform_associations_"+h+"_id").val(""),c.find("#jform_associations_"+h+"_name").val(""),c.find("#jform_associations_"+h+"_chzn").remove(),c.find("#jform_associations_"+h).val("").change().chosen();var i="";a("#jform_itemlanguage option").each(function(){i=a(this).val().split("|")[0],"undefined"!=typeof i&&(i=i.replace(/-/,"_"),d.find("#jform_associations_"+i+"_id").val(""),d.find("#jform_associations_"+i+"_chzn").remove(),d.find("#jform_associations_"+i).val("").change().chosen())}),d.find("#jform_associations_"+f+"_id").val(""),d.find("#jform_associations_"+f+"_name").val(""),d.find("#jform_associations_"+f+"_chzn").remove(),d.find("#jform_associations_"+f).val("").change().chosen();var j=a("#jform_itemlanguage").val(),k=h.replace(/_/,"-");a('#jform_itemlanguage option[value="'+j+'"]').val(k+":0:add"),a("#jform_itemlanguage").val("").change(),a("#jform_itemlanguage").trigger("liszt:updated"),Joomla.submitbutton("reference")}else a("#"+b+"-association").contents().find("#jform_language").attr("disabled",!1),window.frames[b+"-association"].Joomla.submitbutton(document.getElementById("adminForm").getAttribute("data-associatedview")+".apply");return!1},Joomla.loadingLayer("load"),a("body").on("click","#toogle-left-panel",function(){var b=this.getAttribute("data-hide-reference"),c=this.getAttribute("data-show-reference");a(this).text()===b?a(this).text(c):a(this).text(b),a("#left-panel").toggle(),a("#right-panel").toggleClass("full-width")}),a("body").on("change","#jform_itemlanguage",function(){var b=document.getElementById("target-association"),c=a(this).val();""!=c&&"undefined"!=typeof c?(b.setAttribute("data-action",c.split(":")[2]),b.setAttribute("data-id",c.split(":")[1]),b.setAttribute("data-language",c.split(":")[0]),Joomla.loadingLayer("show"),b.src=b.getAttribute("data-editurl")+"&task="+b.getAttribute("data-item")+"."+b.getAttribute("data-action")+"&id="+b.getAttribute("data-id")):(a("#toolbar-target").hide(),a("#toolbar-copy").hide(),a("#select-change").addClass("hidden"),a("#remove-assoc").addClass("hidden"),b.setAttribute("data-action",""),b.setAttribute("data-id","0"),b.setAttribute("data-language",""),b.src="")}),a("#reference-association").on("load",function(){if(a(this).contents().find("#jform_id").val()!==this.getAttribute("data-id")){var b=document.getElementById("target-association");b.src=b.getAttribute("data-editurl")+"&task="+b.getAttribute("data-item")+".edit&id="+a(this).contents().find("#jform_id").val(),this.src=this.getAttribute("data-editurl")+"&task="+this.getAttribute("data-item")+".edit&id="+this.getAttribute("data-id")}var c=a(this).contents();c.find("#jform_language_chzn").remove(),c.find("#jform_language").attr("disabled",!0).chosen(),c.find("#associations").find(".btn").remove();var d="";a("#jform_itemlanguage option").each(function(){d=a(this).val().split(":"),"undefined"!=typeof d[0]&&(langAssociation=d[0].replace(/-/,"_"),""==c.find("#jform_associations_"+langAssociation+"_id").val()&&c.find("#jform_associations_"+langAssociation+"_name").val(document.getElementById("reference-association").getAttribute("data-no-assoc")))}),Joomla.loadingLayer("hide")}),a("#target-association").on("load",function(){if(""!=this.getAttribute("src")){a("#toolbar-target").show(),a("#toolbar-copy").show(),a("#select-change").removeClass("hidden");var b=this.getAttribute("data-language"),c=this.getAttribute("data-id"),d=a(this).contents().find("#jform_id").val()||"0";if(a(this).contents().find('a[href="#associations"]').parent().find(".btn").remove(),a(this).contents().find("#associations").find(".btn").remove(),a(this).contents().find("#associations").hasClass("active")&&(a(this).contents().find('a[href="#associations"]').parent().removeClass("active"),a(this).contents().find("#associations").removeClass("active"),a(this).contents().find(".nav-tabs").find("li").first().addClass("active"),a(this).contents().find(".tab-content").find(".tab-pane").first().addClass("active")),a(this).contents().find("#jform_language_chzn").remove(),a(this).contents().find("#jform_language").val(b).change().attr("disabled",!0).chosen(),"0"==d)document.getElementById("select-change-text").innerHTML=document.getElementById("select-change").getAttribute("data-select");else{document.getElementById("select-change-text").innerHTML=document.getElementById("select-change").getAttribute("data-change"),a("#remove-assoc").removeClass("hidden"),a("#toolbar-copy").hide();var e=document.getElementById("target-id").value,f=""==e?d:e+","+d;document.getElementById("target-id").value=f,d!=c&&(a('#jform_itemlanguage option[value^="'+b+":"+c+':add"]').val(b+":"+d+":edit"),this.setAttribute("data-id",d),this.setAttribute("data-action","edit"));var g=document.getElementById("reference-association"),h=b.replace(/-/,"_"),i=a(this).contents().find("#jform_title").val();a(g).contents().find("#jform_associations_"+h+"_id").val(d),a(g).contents().find("#jform_associations_"+h+"_name").val(i),a(g).contents().find("#jform_associations_"+h+"_chzn").remove(),a(g).contents().find("#jform_associations_"+h).append('"),a(g).contents().find("#jform_associations_"+h).val(d).change().chosen()}var g=document.getElementById("reference-association"),j=g.getAttribute("data-id"),h=g.getAttribute("data-language").replace(/-/,"_"),i=a(g).contents().find("#jform_title").val(),k=a(this).contents();k.find("#jform_associations_"+h+"_id").val(j),k.find("#jform_associations_"+h+"_name").val(i),k.find("#jform_associations_"+h+"_chzn").remove();var l=k.find("#jform_associations_"+h);l.append('"),l.val(j).change().chosen();var m,n;a("#jform_itemlanguage option").each(function(){m=a(this).val().split(":"),"undefined"!=typeof m[1]&&"0"!==m[1]&&(n=m[0].replace(/-/,"_"),k.find("#jform_associations_"+n+"_id").val(m[1]),k.find("#jform_associations_"+n+"_chzn").remove(),l=k.find("#jform_associations_"+n),l.append(''),l.val(m[1]).change().chosen())}),Joomla.loadingLayer("hide")}})}); \ No newline at end of file