Projet

Général

Profil

« Précédent | Suivant » 

Révision 6e73977b

Ajouté par Renato Botelho il y a presque 10 ans

Show disabled interface when it was already part of interface group, it avoids to show a random interface instead and let user to add it by mistake. It should fix #3680

Voir les différences:

usr/local/www/interfaces_groups_edit.php
58 58
	$pconfig['ifname'] = $a_ifgroups[$id]['ifname'];
59 59
	$pconfig['members'] = $a_ifgroups[$id]['members'];
60 60
	$pconfig['descr'] = html_entity_decode($a_ifgroups[$id]['descr']);
61

  
62 61
}
63 62

  
63
$iflist = get_configured_interface_with_descr();
64
$iflist_disabled = get_configured_interface_with_descr(false, true);
65

  
64 66
if ($_POST) {
65 67

  
66 68
	unset($input_errors);
......
74 76
	if (preg_match("/([^a-zA-Z])+/", $_POST['ifname'], $match))
75 77
		$input_errors[] = gettext("Only letters A-Z are allowed as the group name.");
76 78

  
77
	$ifaces = get_configured_interface_with_descr();
78
	foreach ($ifaces as $gif => $gdescr) {
79
	foreach ($iflist as $gif => $gdescr) {
79 80
		if ($gdescr == $_POST['ifname'] || $gif == $_POST['ifname'])
80 81
			$input_errors[] = "The specified group name is already used by an interface. Please choose another name.";
81 82
	}
......
200 201
		<?php
201 202
                        $innerHTML="\"<input type='hidden' value='\" + totalrows +\"' name='\" + rowname[i] + \"_row-\" + totalrows + \"' /><select size='1' name='\" + rowname[i] + totalrows + \"'>\" +\"";
202 203

  
203
			$iflist = get_configured_interface_with_descr();
204 204
                        foreach ($iflist as $ifnam => $ifdescr)
205 205
                                $innerHTML .= "<option value='{$ifnam}'>{$ifdescr}<\/option>";
206 206
			$innerHTML .= "<\/select>\";";
......
288 288
	<td class="vtable">
289 289
	        <select name="members<?php echo $tracker; ?>" class="formselect" id="members<?php echo $tracker; ?>">
290 290
			<?php
291
				$found = false;
291 292
				foreach ($iflist as $ifnam => $ifdescr) {
292 293
					echo "<option value=\"{$ifnam}\"";
293
					if ($ifnam == $members)
294
					if ($ifnam == $members) {
295
						$found = true;
294 296
						echo " selected=\"selected\"";
297
					}
295 298
					echo ">{$ifdescr}</option>";
296 299
				}
300

  
301
				if ($found === false)
302
					foreach ($iflist_disabled as $ifnam => $ifdescr)
303
						if ($ifnam == $members)
304
							echo "<option value=\"{$ifnam}\" selected=\"selected\">{$ifdescr}</option>";
297 305
			?>
298 306
                        </select>
299 307
	</td>

Formats disponibles : Unified diff