| Current Path : /home/bijouxly/www/media/com_akeeba/js/ |
| Current File : /home/bijouxly/www/media/com_akeeba/js/MultipleDatabases.min.js |
/*
Copyright (c)2006-2020 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={modalDialog:null});akeeba.Multidb.render=function(e){var b=document.getElementById("ak_list_contents");b.innerHTML="";for(rootname in e)e.hasOwnProperty(rootname)&&akeeba.Multidb.addRow(rootname,e[rootname],b);akeeba.Multidb.addNewRecordButton(b)};
akeeba.Multidb.addRow=function(e,b,m){var g=document.createElement("tr");g.className="ak_filter_row";akeeba.System.data.set(g,"root",e);akeeba.System.data.set(g,"def",JSON.stringify(b));var k=document.createElement("td");k.style.width="2em";var h=document.createElement("span");h.className="ak_filter_tab_icon_container akeeba-btn--red--mini";akeeba.System.addEventListener(h,"click",function(){var e={root:akeeba.System.data.get(this.parentNode.parentNode,"root"),verb:"remove"};akeeba.Fsfilters.toggle(e,
this,function(c,e){1==c.success&&(c=e.parentNode.parentNode,c.parentNode.removeChild(c))})});var f=document.createElement("span");f.className="ak-toggle-button deletebutton";f.insertAdjacentHTML("beforeend",'<span class="akion-trash-a"></span>');h.appendChild(f);k.appendChild(h);h=document.createElement("td");h.style.width="2em";f=document.createElement("span");f.className="ak_filter_tab_icon_container akeeba-btn--teal--mini";akeeba.System.addEventListener(f,"click",function(){var b=this.parentNode.parentNode,
c=JSON.parse(akeeba.System.data.get(b,"def","{}"));akeeba.System.data.get(b,"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(a){}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(n){}a=document.createElement("div");a.className="akeeba-block--info";a.id="ak_editor_notifier";var c=document.createElement("p");c.id="ak_editor_notifier_content";a.appendChild(c);
var b=document.createElement("img");b.setAttribute("border",0);b.setAttribute("src",akeeba.System.getOptions("akeeba.Multidb.loadingGif",""));c.appendChild(b);b=document.createElement("span");b.textContent=akeeba.System.Text._("COM_AKEEBA_MULTIDB_GUI_LBL_LOADING");c.appendChild(b);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:e,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");1==a.status?(document.getElementById("ak_editor_notifier").className="akeeba-block--success",b.textContent=
akeeba.System.Text._("COM_AKEEBA_MULTIDB_GUI_LBL_CONNECTOK")):(document.getElementById("ak_editor_notifier").className="akeeba-block--failure",b.innerHTML=akeeba.System.Text._("COM_AKEEBA_MULTIDB_GUI_LBL_CONNECTFAIL")+"<br/><code>"+a.message+"</code>")},function(a){var b=document.getElementById("ak_editor_notifier_content");document.getElementById("ak_editor_notifier").className="akeeba-block--failure";b.textContent=akeeba.System.Text._("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(p){}a=document.createElement("div");a.className="akeeba-block--info";a.id="ak_editor_notifier";var c=document.createElement("p");c.id="ak_editor_notifier_content";
a.appendChild(c);var d=document.createElement("img");d.setAttribute("border",0);d.setAttribute("src",akeeba.System.getOptions("akeeba.Multidb.loadingGif",""));c.appendChild(d);d=document.createElement("span");d.textContent=akeeba.System.Text._("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;var f={verb:"set",root:e,
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(e).substr(0,9)+document.getElementById("ake_database").value+".sql"}};a={action:JSON.stringify(f)};akeeba.System.doAjax(a,function(a){1!=a?document.getElementById("ak_editor_notifier_content").textContent=
akeeba.System.Text._("COM_AKEEBA_MULTIDB_GUI_LBL_SAVEFAIL"):(akeeba.System.data.set(b,"def",JSON.stringify(f.data)),b.querySelectorAll("td"),b.querySelector("span.ak_dbhost").textContent=f.data.host,b.querySelector("span.ak_dbname").textContent=f.data.database,-1==b.querySelector("span.editbutton").firstChild.className.indexOf("akion-edit")&&(b.querySelector("span.deletebutton").parentNode.style.display="inline-block",b.querySelector("span.editbutton").firstChild.className="akion-edit",akeeba.Multidb.addNewRecordButton(b.parentNode)),
"object"==typeof akeeba.Multidb.modalDialog&&akeeba.Multidb.modalDialog.close&&akeeba.Multidb.modalDialog.close())},function(a){document.getElementById("ak_editor_notifier_content").textContent=akeeba.System.Text._("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 d=document.createElement("span");d.className="editbutton ak-toggle-button";d.insertAdjacentHTML("beforeend",'<span class="akion-edit"></span>');f.appendChild(d);h.appendChild(f);f=document.createElement("td");
f.className="ak_filter_item";d=document.createElement("span");d.className="ak_filter_name ak_dbhost";d.textContent=b.host;f.appendChild(d);d=document.createElement("td");d.className="ak_filter_item";var l=document.createElement("span");l.className="ak_filter_name ak_dbname";l.textContent=b.database;d.appendChild(l);g.appendChild(k);g.appendChild(h);g.appendChild(f);g.appendChild(d);m.appendChild(g)};
akeeba.Multidb.addNewRecordButton=function(e){var b=Math.uuid();akeeba.Multidb.addRow(b,{host:"",port:"",username:"",password:"",database:"",prefix:""},e);e=document.getElementById("ak_list_contents").children;e=e[e.length-1].querySelectorAll("td");e[0].querySelector("span").style.display="none";e=e[1].querySelectorAll("span");b=e[e.length-1];console.log(e,b);b.className="akion-plus"};akeeba.System.documentReady(function(){akeeba.Multidb.render(akeeba.System.getOptions("akeeba.Multidb.guiData",{}))}); //# sourceMappingURL=MultipleDatabases.min.map