コード例 #1
0
						<tr align="center">
							<td colspan="2"><input type="submit" value=" Add storage volume "></td>
						</tr>
						<input type="hidden" name="sent" value="1" />
					</table>
				</form>';
            }
        }
    }
    echo "<h2>Storage pools</h2>";
    echo "Here's the list of the storage pools available on the connection.<br /><br />";
    echo "<table>";
    echo "<tr>\n\t\t\t<th>Name<th>\n\t\t\t<th>Activity</th>\n\t\t\t<th>Volume count</th>\n\t\t\t<th>State</th>\n\t\t\t<th>Capacity</th>\n\t\t\t<th>Allocation</th>\n\t\t\t<th>Available</th>\n\t\t\t<th>Path</th>\n\t\t\t<th>Permissions</th>\n\t\t\t<th>Ownership</th>\n\t\t\t<th>Actions</th>\n\t\t      </tr>";
    $pools = $lv->get_storagepools();
    for ($i = 0; $i < sizeof($pools); $i++) {
        $info = $lv->get_storagepool_info($pools[$i]);
        $act = $info['active'] ? 'Active' : 'Inactive';
        echo "<tr align=\"center\">\n\t\t\t\t<td>{$spaces}{$pools[$i]}{$spaces}<td>\n\t\t\t\t<td>{$spaces}{$act}{$spaces}</td>\n\t\t\t\t<td>{$spaces}{$info['volume_count']}{$spaces}</td>\n                \t        <td>{$spaces}{$lv->translate_storagepool_state($info['state'])}{$spaces}</td>\n                        \t<td>{$spaces}{$lv->format_size($info['capacity'], 2)}{$spaces}</td>\n\t                        <td>{$spaces}{$lv->format_size($info['allocation'], 2)}{$spaces}</td>\n        \t                <td>{$spaces}{$lv->format_size($info['available'], 2)}{$spaces}</td>\n\t\t\t\t<td>{$spaces}{$info['path']}{$spaces}</td>\n\t\t\t\t<td>{$spaces}{$lv->translate_perms($info['permissions'])}{$spaces}</td>\n\t\t\t\t<td>{$spaces}{$info['id_user']} / {$info['id_group']}{$spaces}</td>\n\t\t\t\t<td>{$spaces}<a href=\"?action=storage-pools&amp;pool={$pools[$i]}&amp;subaction=volume-create\">Create volume</a>{$spaces}</td>\n                \t      </tr>";
        if ($info['volume_count'] > 0) {
            echo "<tr>\n\t\t\t\t\t<td colspan=\"10\" style='padding-left: 40px'><table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t  <th>Name</th>\n\t\t\t\t\t  <th>Type</th>\n\t\t\t\t\t  <th>Capacity</th>\n\t\t\t\t\t  <th>Allocation</th>\n\t\t\t\t\t  <th>Path</th>\n\t\t\t\t\t  <th>Actions</th>\n\t\t\t\t\t</tr>";
            $tmp = $lv->storagepool_get_volume_information($pools[$i]);
            $tmp_keys = array_keys($tmp);
            for ($ii = 0; $ii < sizeof($tmp); $ii++) {
                $path = base64_encode($tmp[$tmp_keys[$ii]]['path']);
                echo "<tr>\n\t\t\t\t\t\t<td>{$spaces}{$tmp_keys[$ii]}{$spaces}</td>\n\t\t\t\t\t\t<td>{$spaces}{$lv->translate_volume_type($tmp[$tmp_keys[$ii]]['type'])}{$spaces}</td>\n\t\t\t\t\t\t<td>{$spaces}{$lv->format_size($tmp[$tmp_keys[$ii]]['capacity'], 2)}{$spaces}</td>\n\t\t\t\t\t\t<td>{$spaces}{$lv->format_size($tmp[$tmp_keys[$ii]]['allocation'], 2)}{$spaces}</td>\n\t\t\t\t\t\t<td>{$spaces}{$tmp[$tmp_keys[$ii]]['path']}{$spaces}</td>\n\t\t\t\t\t\t<td>{$spaces}<a href=\"?action=storage-pools&amp;path={$path}&amp;subaction=volume-delete\">Delete volume</a>{$spaces}</td>\n\t\t\t\t\t      </tr>";
            }
            echo "</table></td>\n\t\t\t\t\t</tr>";
        }
    }
    echo "</table>";
    echo strpos($msg, '<form') ? $msg : '<pre>' . $msg . '</pre>';