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 ) {
|
function htmlOptions($contents, $values) {
|
||||||
$html = '';
|
$options_html = '';
|
||||||
foreach ( $contents as $value=>$text ) {
|
|
||||||
if ( is_array( $text ) )
|
foreach ( $contents as $value=>$option ) {
|
||||||
$text = $text['Name'];
|
$disabled = 0;
|
||||||
else if ( is_object( $text ) )
|
$text = '';
|
||||||
$text = $text->Name();
|
if ( is_array($option) ) {
|
||||||
$selected = is_array( $values ) ? in_array( $value, $values ) : !strcmp($value, $values);
|
|
||||||
$html .= "<option value=\"$value\"".($selected?" selected=\"selected\"":'').">$text</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 ) {
|
function truncText( $text, $length, $deslash=1 ) {
|
||||||
|
|
|
@ -924,7 +924,9 @@ if ( $monitor->Type() == 'Local' ) {
|
||||||
1 => 'X264 Encode',
|
1 => 'X264 Encode',
|
||||||
);
|
);
|
||||||
if ($monitor->Type() == 'Ffmpeg' )
|
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() );
|
echo htmlselect( 'newMonitor[VideoWriter]', $videowriteropts, $monitor->VideoWriter() );
|
||||||
?>
|
?>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
Loading…
Reference in New Issue