{include file="head.html"}
<div id="maincontent">
  <div class="wrap">
    <div class="crumbs"> <a href="__APP__/index/home">{lang='系统设置'}</a> <a href="#">{lang='模型管理'}</a> </div>
    <hr /><br />
    <table class="list_table table_style">
      <thead>
        <tr>
            <th width="25%" align="center"><div style=" padding-left:30px;">{lang='模型名'}</div></th>
            <th width="25%" align="left">{lang='模型文件'}</th>
            <th width="15%" align="left">{lang='模型作者'}</th>
            <th width="15%" align="left">{lang='模型版本'}</th>
            <th width="20%"><div align="center">{lang='操作'}</div></th>
       </tr>
      </thead>
      <?php if (!empty($list)) foreach ($list as $vo) { ?>
        <?php
        $condition['mark'] = $vo['FILE_NAME'];
        $module_list = module('common')->model->table('model')->where($condition)->select();
        if (!empty($module_list)) foreach ($module_list as $mod_vo) {
        ?>
        
        <tr id="del_{$vo['id']}">
          <td align="left"><div style=" padding-left:20px;">{$mod_vo['name']}</div></td>
          <td align="left">{$mod_vo['mark']}</td>
          <td align="left">{$mod_vo['AUTHOR']}</td>
          <td align="left">{$mod_vo['VER']}</td>
          <td align="center">       
          <a href="javascript:void(0)" onclick="open_window('__APP__/{$vo['FILE_NAME']}/default_manage-{$vo['FILE_NAME']}','模型预设');">{lang='预设'}</a> |   
          <?php if($mod_vo['OPEN']) { ?>
          <a href="__URL__/switchoff-{$mod_vo['mark']}">{lang='停用'}</a> |
          <?php }else{ ?>
          <a href="__URL__/switchon-{$mod_vo['mark']}" style="color:#F00">{lang='启动'}</a> |
          <?php } ?>
          <?php if($vo['VER']>$mod_vo['VER']) { ?>
          <a href="#" style="color:#F00" onclick="update('{$mod_vo['mark']}')">{lang='升级'}</a>
          <?php }else{ ?>
          <a href="#" onclick="uninstall('{$mod_vo['mark']}')">{lang='卸载'}</a>
          <?php } ?>
          
          </td>
        </tr>
        <?php }else{ ?>
        
        <tr>
          <td align="left"><div style=" padding-left:20px;">{$vo['NAME']}</div></td>
          <td align="left">{$vo['FILE_NAME']}</td>
          <td align="left">{$vo['AUTHOR']}</td>
          <td align="left">{$vo['VER']}</td>
          <td align="center">
          <span style="color:#666">{lang='预设'}</span> |
          <span style="color:#666">{lang='启用'}</span> |
          <a href="#" onclick="install('{$vo['FILE_NAME']}')" style="color:#F00">{lang='安装'}</a>
          </td>
        </tr>
        
        <?php }} ?>
    </table>
  </div>
</div>
<script>
//卸载
function uninstall(file) {	

parent.asyncbox.confirm('{lang='确认要卸载该模型吗？'}','{lang='操作提示'}',function(action){
if(action == 'ok'){
	window.location.href="__URL__/uninstall-"+file;
}
　});
	 
}


//安装
function install(file) {	

parent.asyncbox.confirm('{lang='确认要安装该模型吗？'}','{lang='操作提示'}',function(action){
if(action == 'ok'){

	window.location.href="__URL__/install-"+file;

}
　});
	 
}

//升级
function update(file) {	

parent.asyncbox.confirm('{lang='确认要进行升级吗？'}','{lang='操作提示'}',function(action){
if(action == 'ok'){

	window.location.href="__URL__/update-"+file;

}
　});
	 
}

</script>
</body></html>