Current File : //root/panel/modules/phpmodule/module.zpm |
<style>
.phpm_mod{font-size:13px;font-weight:bold;}
.php_desc{width:100%;min-height:40px;}
.mod_dis {width:200px;min-height:20px;word-wrap: break-word;}
input::-moz-focus-inner{border:0}
.bld{font-weight:bold;color:#629338;}
.btn{width:80px;min-height:20px;border:none;background-color:#3b7eb0;}
.btn1{width:80px;min-height:20px;border:none;background-color:#Ad0403;}
#error_dis { width:100%;text-align:center;}
#error_id{font-size:12px;color:#629338;font-weight:bold;}
.clearboth1{width:100%;height:1px;clear:both;}
.clearboth2{width:100%;height:2px;clear:both;}
.clearboth5{width:100%;height:5px;clear:both;}
.clearboth10{width:100%;height:10px;clear:both;}
.clearboth20{width:100%;height:20px;clear:both;}
</style>
<div class="zmodule_content panel" id="zmodule_header_<@ ModuleName @>">
<div class="panel-heading">
<img src="<@ ModuleIcon @>" width="35" height="35" border="0" alt="<@ ModuleName @>">
<div class="zmodule_title">
<@ ModuleName @>
</div>
<div class="zmodule_desc" id="zmodule_desc_<@ ModuleName @>"><@ ModuleDesc @></div>
<style>
.helpicon {
display: block;
float: right;
border: 1px solid #ccc;
background-color: #f3f3f3;
padding: 5px 10px;
font-size: 12px;
margin-top:-121px;
margin-right:5px;
-webkit-box-shadow: -8px 7px 5px 0px rgba(204,204,204,1);
-moz-box-shadow: -8px 7px 5px 0px rgba(204,204,204,1);
box-shadow: -8px 7px 5px 0px rgba(204,204,204,1);
-webkit-box-shadow: 8px 7px 5px 0px rgba(204,204,204,1);
-moz-box-shadow: 8px 7px 5px 0px rgba(204,204,204,1);
box-shadow: 8px 7px 5px 0px rgba(204,204,204,1);
}
</style>
<div class="helpicon">
<a href="<@ helpicon @>" target="_blank"><img src="etc/styles/CstyleX-master/images/help.png" style="float:left;" ><span style="float:left;margin-top:8px;font-weight:bold;font-size:12px;" >Video Tutorial</span></a>
</div>
<div class="clearboth5" > </div>
</div>
<div id="error_dis" ><span id="error_id" > </span></div>
<div class="clearboth20" > </div>
<!-- <div class = "phpm_mod" >FFMPEG Installation </div>
<div class ="php_desc" id = "desc_ffmpeg" > </div>-->
<div class = "phpm_mod" >Imagick Installation </div>
<div class ="php_desc" id = "desc_gick" > </div>
<div class = "phpm_mod" >Php Extension Installation </div>
<div class ="php_desc" id = "desc_ext" ></div>
</div>
<script>
var isd="";
var timer ="";
var m_url = document.location.origin;
var err = {"ins":"Please wait initialization process start","s_error":"Something wrong please contact sys admin","pkg_ins":" installation process is going on please wait" ,"pkg_uns":" uninstallation process is going on please wait","d_msg":"Processing please wait","proc_comp":"Process has completed"};
var ins_array = [0,1,2,3];
function mhrpanel()
{
var _self = this;
_self.checkmodule = function()
{
var ajaxdata1={
"ajaxurl":"./?module=phpmodule&action=packdetail",
"ajaxmethod":"POST",
"ajaxsync":true,
"calldetail":2,
"statusdetail":3,
"datadetail":"",
"callback":function(response)
{
if( typeof response['status'] !="undefined" && parseInt(response['status']) == 1 && typeof response['sarray'] != "undefined" && typeof response['darray'] != "undefined" )
{
var err_id = document.getElementById("error_id");
var res_t = response['status'];
if(res_t == 0)
{
err_id.innerHTML = response['msg'];
}
else if (res_t == 1)
{
if (typeof response['c_p'] != "undefined" && typeof response['c_s'] !="undefined" )
{
var c_p = response['c_p'];
var c_t = response['c_s'];
if(c_t == 0 )
{
err_id.innerHTML =" ";
}
else if(c_t == 1)
{
err_id.innerHTML = c_p+err.pkg_uns;
_self.call_timer();
}
else if(c_t == 2)
{
err_id.innerHTML = c_p+err.pkg_ins;
_self.call_timer();
}
else if(c_t == 3)
{
err_id.innerHTML = err.proc_comp;
setTimeout(function(){ _self.checkmodule(); },5000 );
}
else
{
err_id.innerHTML =" ";
}
}
else
{
// console.log("tttttttttttttttttttttt");
err_id.innerHTML = err.s_error;
}
}
else
{
document.location.href = m_url;
}
var d_array = response['darray'];
var s_array = response['sarray'];
var f1 = "",f2 = "",f3 = "";
var pecl = s_array['pecl'],imagick = s_array['imagick'],ffmpeg =s_array['ffmpeg'] ;
var d1 ="<table border='1' >";
for (f1 in pecl)
{
//alert(d_array[pecl[f1]]+" "+f1+" "+pecl[f1]);
d1 +="<tr>";
d1 +="<td><div class = 'mod_dis' ><span class='bld' >"+pecl[f1]+"</span> installation detail</div></td>";
if( typeof d_array[pecl[f1]] != "undefined" && d_array[pecl[f1]] == 1) { d1 +="<td><input type='button' value='Uninstall' class='btn btn1' onclick = \"isd.rivpkg(1,'"+pecl[f1]+"')\" ></td>"; }
else { d1 +="<td><input type='button' value='Install' class='btn' onclick = \"isd.rivpkg(2,'"+pecl[f1]+"')\" ></td>"; }
d1 +="</tr>";
}
d1 += "</table";
var d2 = "<table border='1' >";
for( f2 in imagick)
{
d2 +="<tr>";
d2 +="<td><div class = 'mod_dis' ><span class='bld' >"+imagick[f2]+"</span> installation detail </div></td>";
if( typeof d_array[imagick[f2]] != "undefined" && d_array[imagick[f2]] == 1) { d2 +="<td><input type='button' value ='Uninstall' class ='btn btn1' onclick = \"isd.rivpkg(1,'"+imagick[f2]+"')\" ></td>";
}
else
{
d2 +="<td><input type='button' value ='Install' class ='btn' onclick = \"isd.rivpkg(2,'"+imagick[f2]+"')\" ></td>";
}
d2 +="</tr>";
}
d2 +="</table>";
var d3 = "<table border='1' >";
for( f3 in ffmpeg)
{
d3 +="<tr>";
d3 +="<td><div class = 'mod_dis' ><span class='bld' >"+ffmpeg[f3]+"</span> installation detail </div></td>";
if( typeof d_array[ffmpeg[f3]] != "undefined" && d_array[ffmpeg[f3]] == 1) { d3 +="<td><input type='button' value ='Uninstall' class ='btn btn1' onclick = \"isd.rivpkg(1,'"+ffmpeg[f3]+"')\" ></td>";
}
else
{
d3 +="<td><input type='button' value ='Install' class ='btn' onclick = \"isd.rivpkg(2,'"+ffmpeg[f3]+"')\" ></td>";
}
d3 +="</tr>";
}
d3 +="</table>";
document.getElementById("desc_ext").innerHTML = d1;
document.getElementById("desc_gick").innerHTML = d2;
//document.getElementById("desc_ffmpeg").innerHTML = d3;
}
}
}
_self.ajaxcall(ajaxdata1);
}
_self.trim = function()
{
}
_self.rivpkg = function(st,namd)
{
var err_id = document.getElementById("error_id");
err_id.innerHTML = err.ins ;
namd = namd.replace(/\s+/g,'').trim();
var stg = parseInt(st);
if( namd.match("^[a-zA-Z\(\)]+$") && (stg == 1 || stg == 2))
{
var ajaxdata1={
"ajaxurl":"./?module=phpmodule&action=packinstall",
"ajaxmethod":"POST",
"ajaxsync":true,
"calldetail":2,
"statusdetail":3,
"datadetail":"stv="+encodeURIComponent(stg)+"&packs="+encodeURIComponent(namd),
"callback":function(response)
{
if (typeof response['status'] !="undefined" )
{
var res_t = response['status'];
if(res_t == 0)
{
err_id.innerHTML = response['msg'];
}
else if (res_t == 1)
{
if(stg == 2)
{
err_id.innerHTML = err.pkg_ins;
}
else{
err_id.innerHTML = err.pkg_uns;
}
_self.call_timer();
}
else
{
document.location.href = m_url;
}
}
else
{
err_id.innerHTML = err.s_error;
}
}
};
_self.ajaxcall(ajaxdata1);
}
}
_self.call_timer=function()
{
timer = setTimeout(function(){
_self.checkmodule();
}
,30000 );
}
_self.ajaxcall = function(ajaxdata) {
var xmlhttp = ""; // The variable that makes Ajax possible!
try {
// Opera 8.0+, Firefox, Safari
xmlhttp = new XMLHttpRequest();
} catch (e) {
// Internet Explorer Browsers
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
// Something went wrong
// console.log("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
// console.log(xmlhttp.responseText);
try{
var jsondata = JSON.parse(xmlhttp.responseText);
ajaxdata.callback(jsondata)
}
catch(ex)
{
console.log(ex);
}
} else if (xmlhttp.status == 404 || xmlhttp.status == 500) {
console.log("404 or 505 error");
} else {}
}
if (ajaxdata.ajaxsync == true) {
xmlhttp.open(ajaxdata.ajaxmethod, ajaxdata.ajaxurl, ajaxdata.ajaxsync);
} else {
xmlhttp.open(ajaxdata.ajaxmethod, ajaxdata.ajaxurl);
}
if (ajaxdata.statusdetail == 4) {
xmlhttp.send(ajaxdata.formdata);
} else {
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send(ajaxdata.datadetail);
}
}
}
document.addEventListener("DOMContentLoaded",function()
{
isd = new mhrpanel();
isd.checkmodule();
});
</script>