function device_info(&$disk) { global $path, $var; $name = $disk['name']; $type = $disk['type']=='Flash' || $disk['type']=='New' ? $disk['type'] : 'Device'; $action = strpos($disk['color'],'blink')===false ? 'down' : 'up'; if ($var['fsState']=='Started' && $type!='Flash') { $cmd = $type=='New' ? "cmd=/webGui/scripts/hd_parm&arg1=$action&arg2=$name" : "cmdSpin$action=$name"; $ctrl = "<a href='update.htm?$cmd' title='Click to spin $action device' class='none' target='progressFrame' onclick=\"$.removeCookie('one',{path:'/'});\"><i class='fa fa-sort-$action spacing'></i></a>"; } else $ctrl = ''; switch ($disk['color']) { case 'green-on': $help = 'Normal operation, device is active'; break; case 'green-blink': $help = 'Device is in standby mode (spun-down)'; break; case 'blue-on': $help = 'New device'; break; case 'blue-blink': $help = 'New device, in standby mode (spun-down)'; break; case 'yellow-on': $help = $name=='parity' ? 'Parity is invalid' : 'Device contents emulated'; break; case 'yellow-blink': $help = $name=='parity' ? 'Parity is invalid, in standby mode (spun-down)' : 'Device contents emulated, in standby mode (spun-down)'; break; case 'red-on': case 'red-blink': $help = $name=='parity' ? 'Parity device is disabled' : 'Device is disabled, contents emulated'; break; case 'red-off': $help = $name=='parity' ? 'Parity device is missing' : 'Device is missing (disabled), contents emulated'; break; case 'grey-off': $help = 'Device not present'; break; } $status = "$ctrl<a class='info nohand' onclick='return false'><img src='/webGui/images/{$disk['color']}.png' class='icon'><span>$help</span></a>"; $link = strpos($disk['status'], 'DISK_NP')===false ? "<a href='$path/$type?name=$name' title='".my_disk($name)." Settings'>".my_disk($name)."</a>" : my_disk($name); return $status.$link; }
function device_info($disk) { global $path, $width, $var, $display, $screen; $href = $disk['name']; if ($href != 'preclear') { $name = my_disk($href); $type = $disk['type']; } else { $name = $disk['device']; $type = 'Preclear'; $href = "{$disk['device']}&file=$screen"; } $action = strpos($disk['color'],'blink')===false ? "down" : "up"; if ($var['fsState']=='Started' && $type!='Flash' && $type!='Preclear') $ctrl = "<a href='update.htm?cmdSpin{$action}={$href}' title='Click to spin $action device' class='none' target='progressFrame' onclick=\"$.removeCookie('one',{path:'/'});\"><i class='fa fa-sort-$action spacing'></i></a>"; else $ctrl = ""; $ball = "/webGui/images/{$disk['color']}.png"; switch ($disk['color']) { case 'green-on': $help = 'Normal operation, device is active'; break; case 'green-blink': $help = 'Device is in standby mode (spun-down)'; break; case 'blue-on': $help = ($disk['name']=='preclear' ? 'Unassigned device' : 'New device'); break; case 'blue-blink': $help = ($disk['name']=='preclear' ? 'Unassigned device, in standby mode' : 'New device, in stadby mode (spun-down)'); break; case 'yellow-on': $help = ($href=='parity' ? 'Parity is invalid' : 'Device contents emulated'); break; case 'yellow-blink': $help = 'Device contents emulated, in standby mode (spun-down)'; break; case 'red-on': case 'red-blink': $help = ($href=='parity' ? 'Parity device is disabled' : 'Device is disabled, contents emulated'); break; case 'red-off': $help = ($href=='parity' ? 'Parity device missing' : 'Device is missing (disabled), contents emulated'); break; case 'grey-off': $help = 'Device not present'; break; } switch ($type) { case 'Flash': $device = "Flash"; break; default: $device = "Device"; break; } $status = "${ctrl}<a class='info nohand' onclick='return false'><img src='$ball' class='icon'><span>${help}</span></a>"; $link = strpos($disk['status'], 'DISK_NP')===false ? "<a href='$path/$device?name=$href'>$name</a>" : $name; return $status.$link; }
echo "<td>{$share['comment']}</td>"; echo "<td>".user_share_settings($var['shareSMBEnabled'], $sec[$name])."</td>"; echo "<td>".user_share_settings($var['shareNFSEnabled'], $sec_nfs[$name])."</td>"; echo "<td>".user_share_settings($var['shareAFPEnabled'], $sec_afp[$name])."</td>"; $cmd="/webGui/scripts/share_size"."&arg1=".urlencode($name)."&arg2=ssz1"; if (array_key_exists($name, $ssz1)) { echo "<td>".my_scale($ssz1[$name]['disk.total']*1024, $unit)." $unit</td>"; echo "<td>".my_scale($share['free']*1024, $unit)." $unit</td>"; echo "<td><a href='$path/Browse?dir=/mnt/user/".urlencode($name)."'><img src='/webGui/images/explore.png' title='Browse /mnt/user/".urlencode($name)."'></a></td>"; echo "</tr>"; foreach ($ssz1[$name] as $diskname => $disksize) { if ($diskname=='disk.total') continue; $include = $share['include']; $inside = in_array($diskname, array_filter(array_diff($myDisks, explode(',',$share['exclude'])), 'shareInclude')); echo "<tr class='share_status_size".($inside ? "'>" : " warning'>"); echo "<td>".my_disk($diskname).":</td>"; echo "<td>".($inside ? "" : "<em>Share is outside the list of designated disks</em>")."</td>"; echo "<td></td>"; echo "<td></td>"; echo "<td></td>"; echo "<td class='share-$row-1'>".my_scale($disksize*1024, $unit)." $unit</td>"; echo "<td class='share-$row-2'>".my_scale($disks[$diskname]['fsFree']*1024, $unit)." $unit</td>"; echo "<td><a href='/update.htm?cmd=$cmd' target='progressFrame' title='Recompute...' onclick='$(\".share-$row-1\").html(\"Please wait...\");$(\".share-$row-2\").html(\"\");'><i class='fa fa-refresh icon'></i></a></td>"; echo "</tr>"; } } else { echo "<td><a href='/update.htm?cmd=$cmd' target='progressFrame' onclick=\"$(this).text('Please wait...')\">Compute...</a></td>"; echo "<td>".my_scale($share['free']*1024, $unit)." $unit</td>"; echo "<td><a href='$path/Browse?dir=/mnt/user/".urlencode($name)."'><img src='/webGui/images/explore.png' title='Browse /mnt/user/".urlencode($name)."'></a></td>"; echo "</tr>"; }
function mk_option_check($name, $value, $text = "") { if ($text) { $checked = strpos("$name,", "$value,")===false ? "" : " selected"; return "<option value='$value'$checked>$text</option>"; } if (strpos($name, 'disk')!==false) { $checked = strpos("$value,", "$name,")===false ? "" : " selected"; return "<option value='$name'$checked>".my_disk($name)."</option>"; } }
function tab_title($text,$path,$png) { global $docroot; $file = "$path/icons/".($png ? $png : strtolower(str_replace(' ','',$text)).".png"); if (!file_exists("$docroot/$file")) $file = "webGui/icons/default.png"; return "<img src='/$file' class='icon'>".my_disk($text); }