<?php

/*

		系统数据统计

*/

//载入全局配置和函数包
require_once(dirname(__FILE__)."/../include/global.php");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $Project["charset"];?>" />
<title>结束插件 - Powered By VeryIDE</title>

<?php

echo loader_style(array(VI_BASE."style/dialog.css"),$Project["charset"],$Project["version"]);

echo loader_script(array(VI_BASE."js/mo.js"),$Project["charset"],$Project["version"]);

?>

<script>

var XAPP = function( appid , button ){

	parent.Serv.Apps.close( appid );

	button.innerHTML = '已终止';
	button.className = 'added';

}

var XWIG = function( appid , widget , button ){

	parent.Serv.Widget.remove( appid , widget , true );

	button.innerHTML = '已终止';
	button.className = 'added';

}

Mo.reader(function(){

	parent.Mo("#task li").each( function(){

		var appid   = this.getAttribute("appid");
		var appname = this.getAttribute("appname");

		var li = document.createElement("li");

			li.innerHTML = '<img src="<?php echo VI_BASE;?>/module/'+appid+'/icon.png" /> <br /> '+appname+' <br /> <button appid="'+appid+'" onclick="XAPP(\''+appid+'\',this);">终止</button>';

		Mo("#task_apps").append( li );		

	});

	if( Mo("#task_apps").html() == '' ){
		Mo("#task_apps").html('没有在运行的应用');
	}

	//////////////////////////////////	

	parent.Mo("#widget div.widget").each( function(){

		var appid   = this.getAttribute("appid");
		var widget  = this.getAttribute("widget");
		var name	= this.getAttribute("widgetname");

		var li = document.createElement("li");

			li.innerHTML = '<img src="<?php echo VI_BASE;?>/module/'+appid+'/widget/'+widget+'/preview.png" /> <br /> '+name+' <br /> <button appid="'+appid+'" onclick="XWIG(\''+appid+'\',\''+widget+'\',this);">终止</button>';

		Mo("#task_widget").append( li );		

	});

	if( Mo("#task_widget").html() == '' ){
		Mo("#task_widget").html('没有在运行的插件');
	}
	
	//////////////////////////////////

});

</script>

</head>

<body>

    <div id="wrapper">

        <?php
    
        //未登录
        if( !$_SESSION["Manager"]["id"] ){    
            exit('<div id="error">未登录，请先登录</div>');    
        }
    
        ?>
    
		<dl id="tasks">

			<dt>应用窗口</dt>
			<dd>
				<ul id="task_apps">				
				</ul>
			</dd>  

			<dt>插件工具</dt>
			<dd>
				<ul id="task_widget">
				</ul>
			</dd>
			 
        </dl>
    
    </div>
    
</body>
</html>