%PDF- %PDF-
Direktori : /home1/lightco1/www/media/com_akeeba/js/ |
Current File : //home1/lightco1/www/media/com_akeeba/js/MultipleDatabases.min.js |
/* Copyright (c)2006-2017 Nicholas K. Dionysopoulos / Akeeba Ltd @license GNU General Public License version 3, or later */ if("undefined"==typeof akeeba)var akeeba={};"undefined"==typeof akeeba.Multidb&&(akeeba.Multidb={loadingGif:"",modalDialog:null});akeeba.Multidb.render=function(b){var g=document.getElementById("ak_list_contents");g.innerHTML="";for(rootname in b)b.hasOwnProperty(rootname)&&akeeba.Multidb.addRow(rootname,b[rootname],g);akeeba.Multidb.addNewRecordButton(g)}; akeeba.Multidb.addRow=function(b,g,n){var h=document.createElement("tr");h.className="ak_filter_row";akeeba.System.data.set(h,"root",b);akeeba.System.data.set(h,"def",JSON.stringify(g));var l=document.createElement("td");l.style.width="2em";var k=document.createElement("span");k.className="ak_filter_tab_icon_container btn btn-default";akeeba.System.addEventListener(k,"click",function(){var b={root:akeeba.System.data.get(this.parentNode.parentNode,"root"),verb:"remove"};akeeba.Fsfilters.toggle(b,this, function(b,e){if(!0==b.success){var d=e.parentNode.parentNode;d.parentNode.removeChild(d)}})});var e=document.createElement("span");e.className="ak-toggle-button icon icon-trash deletebutton";k.appendChild(e);l.appendChild(k);k=document.createElement("td");k.style.width="2em";e=document.createElement("span");e.className="ak_filter_tab_icon_container btn btn-default";akeeba.System.addEventListener(e,"click",function(){var e=this.parentNode.parentNode,c=JSON.parse(akeeba.System.data.get(e,"def","{}")); akeeba.System.data.get(e,"root");var f=document.getElementById("akEditorDialog");""==c.driver&&(c.driver="mysqli");document.getElementById("ake_driver").value=c.driver;document.getElementById("ake_host").value=c.host;document.getElementById("ake_username").value=c.username;document.getElementById("ake_password").value=c.password;document.getElementById("ake_database").value=c.database;document.getElementById("ake_prefix").value=c.prefix;try{var d=document.getElementById("ak_editor_notifier");d.parentNode.removeChild(d)}catch(g){}c= document.getElementById("akEditorBtnDefault");d=c.cloneNode(!0);c.parentNode.replaceChild(d,c);akeeba.System.addEventListener(d,"click",function(){try{var a=document.getElementById("ak_editor_notifier");a.parentNode.removeChild(a)}catch(e){}a=document.createElement("div");a.className="alert alert-info alert-dismissable";a.id="ak_editor_notifier";a.insertAdjacentHTML("afterbegin",'<span type="button" class="close" data-dismiss="alert" aria-hidden="true">×</span>');var c=document.createElement("span"); c.id="ak_editor_notifier_content";a.appendChild(c);var d=document.createElement("img");d.setAttribute("border",0);d.setAttribute("src",akeeba.Multidb.loadingGif);c.appendChild(d);d=document.createElement("span");d.textContent=Joomla.JText._("COM_AKEEBA_MULTIDB_GUI_LBL_LOADING");c.appendChild(d);document.getElementById("ak_editor_table").insertAdjacentHTML("beforebegin",a.outerHTML);a=document.getElementById("ake_driver");a=a.options[a.selectedIndex];a=null==a?"":a.value;a={verb:"test",root:b,data:{host:document.getElementById("ake_host").value, driver:a,port:document.getElementById("ake_port").value,user:document.getElementById("ake_username").value,password:document.getElementById("ake_password").value,database:document.getElementById("ake_database").value,prefix:document.getElementById("ake_prefix").value}};a={action:JSON.stringify(a)};akeeba.System.doAjax(a,function(a){var b=document.getElementById("ak_editor_notifier_content");!0==a.status?b.textContent=Joomla.JText._("COM_AKEEBA_MULTIDB_GUI_LBL_CONNECTOK"):b.innerHTML=Joomla.JText._("COM_AKEEBA_MULTIDB_GUI_LBL_CONNECTFAIL")+ "<br/><code>"+a.message+"</code>"},function(a){document.getElementById("ak_editor_notifier_content").textContent=Joomla.JText._("COM_AKEEBA_MULTIDB_GUI_LBL_CONNECTFAIL");"object"==typeof akeeba.Multidb.modalDialog&&akeeba.Multidb.modalDialog.close&&akeeba.Multidb.modalDialog.close();akeeba.System.params.errorCallback(a)},!1,15E3)});c=document.getElementById("akEditorBtnSave");d=c.cloneNode(!0);c.parentNode.replaceChild(d,c);akeeba.System.addEventListener(d,"click",function(){try{var a=document.getElementById("ak_editor_notifier"); a.parentNode.removeChild(a)}catch(c){}a=document.createElement("div");a.className="alert alert-info alert-dismissable";a.id="ak_editor_notifier";a.insertAdjacentHTML("afterbegin",'<span type="button" class="close" data-dismiss="alert" aria-hidden="true">×</span>');var d=document.createElement("span");d.id="ak_editor_notifier_content";a.appendChild(d);var f=document.createElement("img");f.setAttribute("border",0);f.setAttribute("src",akeeba.Multidb.loadingGif);d.appendChild(f);f=document.createElement("span"); f.textContent=Joomla.JText._("COM_AKEEBA_MULTIDB_GUI_LBL_LOADING");d.appendChild(f);document.getElementById("ak_editor_table").insertAdjacentHTML("beforebegin",a.outerHTML);var a=document.getElementById("ake_driver"),a=a.options[a.selectedIndex],a=null==a?"":a.value,g={verb:"set",root:b,data:{host:document.getElementById("ake_host").value,driver:a,port:document.getElementById("ake_port").value,username:document.getElementById("ake_username").value,password:document.getElementById("ake_password").value, database:document.getElementById("ake_database").value,prefix:document.getElementById("ake_prefix").value,dumpFile:String(b).substr(0,9)+document.getElementById("ake_database").value+".sql"}},a={action:JSON.stringify(g)};akeeba.System.doAjax(a,function(a){!0!=a?document.getElementById("ak_editor_notifier_content").textContent=Joomla.JText._("COM_AKEEBA_MULTIDB_GUI_LBL_SAVEFAIL"):(akeeba.System.data.set(e,"def",JSON.stringify(g.data)),e.querySelectorAll("td"),e.querySelector("span.ak_dbhost").textContent= g.data.host,e.querySelector("span.ak_dbname").textContent=g.data.database,-1==e.querySelector("span.editbutton").className.indexOf("icon-pencil")&&(e.querySelector("span.deletebutton").parentNode.style.display="inline-block",a=e.querySelector("span.editbutton"),akeeba.System.removeClass(a,"icon-plus-circle"),akeeba.System.addClass(a,"icon-pencil ak-toggle-button"),akeeba.Multidb.addNewRecordButton(e.parentNode)),"object"==typeof akeeba.Multidb.modalDialog&&akeeba.Multidb.modalDialog.close&&akeeba.Multidb.modalDialog.close())}, function(a){document.getElementById("ak_editor_notifier_content").textContent=Joomla.JText._("COM_AKEEBA_MULTIDB_GUI_LBL_SAVEFAIL");"object"==typeof akeeba.Multidb.modalDialog&&akeeba.Multidb.modalDialog.close&&akeeba.Multidb.modalDialog.close();akeeba.System.params.errorCallback(a)},!1,15E3)});c=document.getElementById("akEditorBtnCancel");d=c.cloneNode(!0);c.parentNode.replaceChild(d,c);akeeba.System.addEventListener(d,"click",function(){"object"==typeof akeeba.Multidb.modalDialog&&akeeba.Multidb.modalDialog.close&& akeeba.Multidb.modalDialog.close()});akeeba.Multidb.modalDialog=akeeba.Modal.open({inherit:f,width:"80%"});akeeba.System.triggerEvent(f.querySelector("span"),"focus")});var f=document.createElement("span");f.className="fa icon-pencil editbutton ak-toggle-button";e.appendChild(f);k.appendChild(e);e=document.createElement("td");e.className="ak_filter_item";f=document.createElement("span");f.className="ak_filter_name ak_dbhost";f.textContent=g.host;e.appendChild(f);f=document.createElement("td");f.className= "ak_filter_item";var m=document.createElement("span");m.className="ak_filter_name ak_dbname";m.textContent=g.database;f.appendChild(m);h.appendChild(l);h.appendChild(k);h.appendChild(e);h.appendChild(f);n.appendChild(h)}; akeeba.Multidb.addNewRecordButton=function(b){var g=Math.uuid();akeeba.Multidb.addRow(g,{host:"",port:"",username:"",password:"",database:"",prefix:""},b);b=document.getElementById("ak_list_contents").children;b=b[b.length-1].querySelectorAll("td");b[0].querySelector("span").style.display="none";b=b[1].querySelectorAll("span");b=b[b.length-1];akeeba.System.removeClass(b,"icon-pencil");akeeba.System.addClass(b,"icon-plus-circle ak-toggle-button")}; //# sourceMappingURL=MultipleDatabases.min.map