Menu="Tasks:50"
Type="xmenu"
Title="Installed Plugins"
Tag="puzzle-piece"
Tabs="true"
---
<?PHP
/* Copyright 2005-2017, Lime Technology
 * Copyright 2012-2017, Bergware International.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2,
 * as published by the Free Software Foundation.
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 */
?>

<?
$empty = "<tr><td colspan='6' style='text-align:center;padding-top:12px'><i class='fa fa-spinner fa-spin icon'></i><em>Please wait, retrieving and updating plugin information ...</em></td><tr>";
// Remove stale /tmp/plugin/*.plg entries
foreach (glob("/tmp/plugins/*.{plg,txt}", GLOB_NOSORT+GLOB_BRACE) as $entry) if (!file_exists("/var/log/plugins/".basename($entry))) @unlink($entry);
$audit = $notify['version'] ? 1 : 0;
?>
<link type="text/css" rel="stylesheet" href="/webGui/styles/jquery.filetree.css">
<style>
#plugin_tree{width:33%;height:200px;overflow-y:scroll;}
</style>
<script src="/webGui/javascript/jquery.filetree.js"></script>
<script>
<?if ($display['resize']):?>
function resize(bind) {
  var width = [];
  var h = $('#plugin_list').height();
  var s = Math.max(window.innerHeight-300,370);
  if (h>s || bind) {
    $('#plugin_list').height(s);
    $('#plugin_table tbody tr:first-child td').each(function(){width.push($(this).width());});
    $('#plugin_table thead tr th').each(function(i){$(this).width(width[i]);});
    if (!bind) $('#plugin_table thead,#plugin_table tbody').addClass('fixed');
  }
}
<?endif;?>
function noAudit() {
  hideUpgrade();
  $.cookie('noAudit','true',{path:'/'});
}
$(function() {
  var audit = <?=$audit?>;
  if ($.cookie('noAudit') != null) {
    $.removeCookie('noAudit',{path:'/'});
    audit = 0;
  }
  $.get('/plugins/dynamix.plugin.manager/include/ShowPlugins.php',{audit:audit},function(data) {
    if (data) $('#plugin_list').html(data);
<?if ($display['resize']):?>
    resize();
    $(window).bind('resize',function(){resize(true);});
<?endif;?>
    $('#plugin_table').tablesorter({sortList:[[4,0],[1,0]],sortAppend:[[1,0]],headers:{0:{sorter:false},5:{sorter:false}}});
    $('.desc_readmore').readmore({maxHeight:58});
  });
  $('#plugin_tree').fileTree({root:'/boot/',filter:'plg'}, function(file) {$('#plugin_file').val(file);});
<?if (!$audit):?>
  $('.tabs').append("<span class='status vhshift'><input type='button' value='Check for Updates' onclick='openBox(\"/plugins/dynamix.plugin.manager/scripts/plugin&arg1=checkall\",\"Plugin Update Check\",490,430,true)'></span>");
<?endif;?>
});
</script>
<table class='tablesorter plugins shift' id='plugin_table'>
<thead><tr><th></th><th>Plugin</th><th>Author</th><th>Version</th><th>Status</th><th>Uninstall</th></tr></thead>
<tbody id="plugin_list"><?=$empty?></tbody>
</table>
