mirror of
https://github.com/unraid/webgui.git
synced 2026-01-15 06:00:14 -06:00
91 lines
3.9 KiB
Plaintext
91 lines
3.9 KiB
Plaintext
Menu="Tasks:50"
|
|
Type="xmenu"
|
|
Title="Installed Plugins"
|
|
Tag="icon-plugins"
|
|
Tabs="true"
|
|
Code="e944"
|
|
---
|
|
<?PHP
|
|
/* Copyright 2005-2018, Lime Technology
|
|
* Copyright 2012-2018, 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.
|
|
*/
|
|
?>
|
|
|
|
<?
|
|
// 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);
|
|
$check = $notify['version'] ? 0 : 1;
|
|
?>
|
|
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.filetree.css')?>">
|
|
<style>
|
|
#plugin_tree{width:33%;height:200px;overflow-y:scroll}
|
|
table tbody td{line-height:normal}
|
|
</style>
|
|
<script src="<?autov('/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-340,330);
|
|
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 loadlist(id) {
|
|
$.get('/plugins/dynamix.plugin.manager/include/ShowPlugins.php',{audit:id,check:<?=$check?>},function(d) {
|
|
var data = d.split(/\0/);
|
|
var list = $('#plugin_list');
|
|
if (id) {
|
|
var cmd = id.split(':');
|
|
var tr = 'tr#'+cmd[0].replace(/[\. _]/g,'');
|
|
switch (cmd[1]) {
|
|
case 'return' : $('div.spinner').hide('slow').remove();list.html(data[0]); $('#plugin_table').trigger('destroy'); break;
|
|
case 'remove' : list.find(tr).remove(); break;
|
|
case 'update' : list.find(tr).remove();
|
|
case 'install': if (!list.find(tr).length) list.append(data[0]).trigger('update'); break;
|
|
}
|
|
} else {
|
|
list.html(data[0]);
|
|
}
|
|
<?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}},textAttribute:'data'});
|
|
$('.desc_readmore').readmore({maxHeight:80,moreLink:"<a href='#'><i class='fa fa-chevron-down'></i></a>",lessLink:"<a href='#'><i class='fa fa-chevron-up'></i></a>"});
|
|
if (data[1]>1) $('#updateall').show(); else $('#updateall').hide();
|
|
<?if ($check):?>
|
|
$('#checkall').find('input').prop('disabled',false).show();
|
|
<?endif;?>
|
|
});
|
|
}
|
|
function spinner() {
|
|
$('#plugin_list').append("<div class='spinner fixed'></div>");
|
|
$('div.spinner').html(unraid_logo).show('slow');
|
|
}
|
|
$(function() {
|
|
loadlist();
|
|
$('#plugin_tree').fileTree({root:'/boot/',filter:'plg'}, function(file) {$('#plugin_file').val(file);});
|
|
$('.tabs').append("<span id='updateall' class='status vhshift' style='display:none;margin-left:12px'><input type='button' value='Update All Plugins' onclick='spinner();openBox(\"/plugins/dynamix.plugin.manager/scripts/plugin&arg1=updateall\",\"Update All Plugins\",600,600,true,\"loadlist\",\":return\")'></span>");
|
|
<?if ($check):?>
|
|
$('.tabs').append("<span id='checkall' class='status vhshift'><input type='button' value='Check For Updates' onclick='spinner();openBox(\"/plugins/dynamix.plugin.manager/scripts/plugin&arg1=checkall\",\"Plugin Update Check\",600,600,true,\"loadlist\",\":return\")' disabled></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"><tr><td colspan="6"><div class="spinner"></div></td><tr></tbody>
|
|
</table>
|