implement the ability to pass a disabled option to htmlSelect. Use it to disable the h264 passthrough option for non-ffmpeg monitors. Instead of disappearing it.
parent
11cedb4335
commit
b72d520e02
|
@ -432,20 +432,38 @@ function htmlSelect( $name, $contents, $values, $behaviours=false ) {
|
|||
}
|
||||
}
|
||||
|
||||
return "<select name=\"$name\" id=\"$name\"$behaviourText>".htmlOptions( $contents, $values ).'</select>';
|
||||
return "<select name=\"$name\" id=\"$name\"$behaviourText>".htmlOptions($contents, $values).'</select>';
|
||||
}
|
||||
|
||||
function htmlOptions( $contents, $values ) {
|
||||
$html = '';
|
||||
foreach ( $contents as $value=>$text ) {
|
||||
if ( is_array( $text ) )
|
||||
$text = $text['Name'];
|
||||
else if ( is_object( $text ) )
|
||||
$text = $text->Name();
|
||||
$selected = is_array( $values ) ? in_array( $value, $values ) : !strcmp($value, $values);
|
||||
$html .= "<option value=\"$value\"".($selected?" selected=\"selected\"":'').">$text</option>";
|
||||
function htmlOptions($contents, $values) {
|
||||
$options_html = '';
|
||||
|
||||
foreach ( $contents as $value=>$option ) {
|
||||
$disabled = 0;
|
||||
$text = '';
|
||||
if ( is_array($option) ) {
|
||||
|
||||
if ( isset($option['Name']) )
|
||||
$text = $option['Name'];
|
||||
else if ( isset($option['text']) )
|
||||
$text = $option['text'];
|
||||
|
||||
if ( isset($option['disabled']) ) {
|
||||
$disabled = $option['disabled'];
|
||||
Error("Setting to disabled");
|
||||
}
|
||||
} else if ( is_object($option) ) {
|
||||
$text = $option->Name();
|
||||
} else {
|
||||
$text = $option;
|
||||
}
|
||||
$selected = is_array($values) ? in_array($value, $values) : !strcmp($value, $values);
|
||||
$options_html .= "<option value=\"$value\"".
|
||||
($selected?' selected="selected"':'').
|
||||
($disabled?' disabled="disabled"':'').
|
||||
">$text</option>";
|
||||
}
|
||||
return $html;
|
||||
return $options_html;
|
||||
}
|
||||
|
||||
function truncText( $text, $length, $deslash=1 ) {
|
||||
|
|
|
@ -924,7 +924,9 @@ if ( $monitor->Type() == 'Local' ) {
|
|||
1 => 'X264 Encode',
|
||||
);
|
||||
if ($monitor->Type() == 'Ffmpeg' )
|
||||
$videowriteropts[2]='H264 Camera Passthrough';
|
||||
$videowriteropts[2] = 'H264 Camera Passthrough';
|
||||
else
|
||||
$videowriteropts[2] = array('text'=>'H264 Camera Passthrough - only for FFMPEG','disabled'=>1);
|
||||
echo htmlselect( 'newMonitor[VideoWriter]', $videowriteropts, $monitor->VideoWriter() );
|
||||
?>
|
||||
</td></tr>
|
||||
|
|
Loading…
Reference in New Issue