put empty <option/> only when <select> is empty, for xhtml, i am pretty sure i checked this in already...

This commit is contained in:
toyomoyo 2007-03-16 02:31:44 +00:00
parent 0f5a44ca98
commit 1ccb8ec916

View file

@ -17,17 +17,22 @@
getElementById('assignform').addselect.selectedIndex=-1;"> getElementById('assignform').addselect.selectedIndex=-1;">
<?php <?php
foreach ($contextusers as $contextuser) { $i = 0;
$fullname = fullname($contextuser, true); foreach ($contextusers as $contextuser) {
if ($contextuser->hidden) { $fullname = fullname($contextuser, true);
$hidden=' ('.get_string('hiddenassign').') '; if ($contextuser->hidden) {
} else { $hidden=' ('.get_string('hiddenassign').') ';
$hidden=""; } else {
} $hidden="";
echo "<option value=\"$contextuser->id\">".$fullname.", ".$contextuser->email.$hidden."</option>\n"; }
} echo "<option value=\"$contextuser->id\">".$fullname.", ".$contextuser->email.$hidden."</option>\n";
$i++;
}
if ($i==0) {
echo '<option/>'; // empty select breaks xhtml strict
}
?> ?>
<option/>
</select></td> </select></td>
<td valign="top"> <td valign="top">
<br /> <br />
@ -50,32 +55,36 @@
getElementById('assignform').remove.disabled=true; getElementById('assignform').remove.disabled=true;
getElementById('assignform').removeselect.selectedIndex=-1;"> getElementById('assignform').removeselect.selectedIndex=-1;">
<?php <?php
$i=0;
if (!empty($searchtext)) {
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n";
while ($user = rs_fetch_next_record($availableusers)) {
if (!isset($contextusers[$user->id])) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
$i++;
}
}
echo "</optgroup>\n";
if (!empty($searchtext)) { } else {
echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n"; if ($usercount > MAX_USERS_PER_PAGE) {
while ($user = rs_fetch_next_record($availableusers)) { echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
if (!isset($contextusers[$user->id])) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
}
}
echo "</optgroup>\n";
} else {
if ($usercount > MAX_USERS_PER_PAGE) {
echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
.'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n"; .'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
} else { } else {
while ($user = rs_fetch_next_record($availableusers)) { while ($user = rs_fetch_next_record($availableusers)) {
if (!isset($contextusers[$user->id])) { if (!isset($contextusers[$user->id])) {
$fullname = fullname($user, true); $fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n"; echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
} $i++;
} }
} }
} }
}
if ($i==0) {
echo '<option/>'; // empty select breaks xhtml strict
}
?> ?>
<option/>
</select> </select>
<br /> <br />
<label for="searchtext" class="accesshide"><?php p($strsearch) ?></label> <label for="searchtext" class="accesshide"><?php p($strsearch) ?></label>