Files
webgui/plugins/dynamix/DiskList.page
Eric Schultz 30ca111094 initial commit
2015-10-24 10:17:28 -07:00

101 lines
4.0 KiB
Plaintext

Menu="Shares:2"
Title="Disk Shares"
Cond="$var['fsState']=='Started' && $var['shareDisk']!='no'"
---
<?PHP
/* Copyright 2015, Lime Technology
* Copyright 2015, 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.
*/
?>
<?
// Display export settings
function disk_share_settings($protocol,$share) {
if (empty($share)) return;
if ($protocol!='yes' || $share['export']=='-') return "-";
if ($share['export']=='e') return ucfirst($share['security']);
return '<em>'.ucfirst($share['security']).'</em>';
}
// Share size per disk
$preserve = $path==$prev;
$ssz2 = array();
foreach (glob("state/*.ssz2", GLOB_NOSORT) as $entry) {
if ($preserve) {
$ssz2[basename($entry, ".ssz2")] = parse_ini_file($entry);
} else {
unlink($entry);
}
}
?>
<table class="share_status share <?=$display['view']?>">
<thead><tr><td style="width:15%">Name</td><td style="width:33%">Comment</td><td>SMB</td><td>NFS</td><td>AFP</td><td>Size</td><td>Free</td><td>View</td></tr></thead>
<tbody>
<?
foreach ($disks as $disk):
if ($disk['type']=='Flash') continue;
if ($disk['fsColor']=='grey-off') continue;
if ($disk['exportable']=='no') continue;
$num_exportable++;
$name = $disk['name'];
$ball = "/webGui/images/{$disk['fsColor']}.png";
switch ($disk['fsColor']) {
case 'green-on': $help = 'All files protected'; break;
case 'yellow-on': $help = 'All files unprotected'; break;
}
?><tr>
<td><a class='info nohand' onclick='return false'><img src='<?=$ball?>' class='icon'><span style="left:18px"><?=$help?></span></a><a href="<?=$path?>/Disk?name=<?=$name?>" onclick="$.cookie('one','tab1',{path:'/'})"><?=$name?></a></td>
<td><?=$disk['comment']?></td>
<td><?=disk_share_settings($var['shareSMBEnabled'], $sec[$name])?></td>
<td><?=disk_share_settings($var['shareNFSEnabled'], $sec_nfs[$name])?></td>
<td><?=disk_share_settings($var['shareAFPEnabled'], $sec_afp[$name])?></td>
<?if (array_key_exists($name, $ssz2)):?>
<td><?=my_scale(($disk['fsSize'])*1024, $unit).' '.$unit?></td>
<td><?=my_scale($disk['fsFree']*1024, $unit).' '.$unit?></td>
<td><a href="<?=$path?>/Browse?dir=/mnt/<?=$name?>"><img src="/webGui/images/explore.png" title="Browse /mnt/<?=$name?>"></a></td>
</tr>
<?foreach ($ssz2[$name] as $share_name => $share_size):
if ($share_name!="total"):
?> <tr class="share_status_size">
<td><?=$share_name?>:</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><?=my_scale($share_size*1024, $unit).' '.$unit?></td>
<td><?=my_scale($disk['fsFree']*1024, $unit).' '.$unit?></td>
<td></td>
</tr>
<? endif;
endforeach;
else:
$cmd="/webGui/scripts/disk_size&arg1=$name&arg2=/var/local/emhttp/$name.ssz2";
?><td><a href="/update.htm?cmd=<?=$cmd?>" target="progressFrame" onclick="$(this).text('Please wait...')">Compute...</a></td>
<td><?=my_scale($disk['fsFree']*1024, $unit).' '.$unit?></td>
<td><a href="<?=$path?>/Browse?dir=/mnt/<?=$name?>"><img src="/webGui/images/explore.png" title="Browse /mnt/<?=$name?>"></a></td>
</tr>
<?endif;
endforeach;
?>
</tbody>
</table>
<?if (!isset($num_exportable)):?>
<div style="font-style:italic;font-size:14px;opacity:0.5;padding:5px;">There are no exportable disk shares</div>
<?endif;?>
> **Colored Status Indicator** the significance of the color indicator at the beginning of each line in *Disk Shares* is as follows:
>
> <img src='/webGui/images/green-on.png' class='icon'>Mounted, underlying device has redundancy/protection.
>
> <img src='/webGui/images/yellow-on.png' class='icon'>Mounted, underlying device does not have redundancy/protection.
>
> SMB security mode displayed in *italics* indicates exported hidden shares.
>
> AFP security mode displayed in *italics* indicates exported time-machine shares.