do not hide unavailable options, just disable them so people can see what is actually possible but just not available due to webserver-usage or other settings
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function getFormFieldOutputBool($fieldname, $fielddata)
|
||||
function getFormFieldOutputBool($fieldname, $fielddata, $do_show = true)
|
||||
{
|
||||
$label = $fielddata['label'];
|
||||
$boolswitch = makeYesNo($fieldname, '1', '0', $fielddata['value']);
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function getFormFieldOutputDate($fieldname, $fielddata)
|
||||
function getFormFieldOutputDate($fieldname, $fielddata, $do_show = true)
|
||||
{
|
||||
if(isset($fielddata['date_timestamp']) && $fielddata['date_timestamp'] === true)
|
||||
{
|
||||
$fielddata['value'] = date('Y-m-d', $fielddata['value']);
|
||||
}
|
||||
|
||||
return getFormFieldOutputString($fieldname, $fielddata);
|
||||
return getFormFieldOutputString($fieldname, $fielddata, $do_show);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function getFormFieldOutputFile($fieldname, $fielddata)
|
||||
function getFormFieldOutputFile($fieldname, $fielddata, $do_show = true)
|
||||
{
|
||||
$label = $fielddata['label'];
|
||||
$value = htmlentities($fielddata['value']);
|
||||
|
||||
@@ -49,7 +49,7 @@ function buildFormEx($form, $part = '') {
|
||||
$do_show = $groupdetails['visible'];
|
||||
}
|
||||
|
||||
if ($do_show) {
|
||||
//if ($do_show) {
|
||||
if (isset($groupdetails['title']) && $groupdetails['title'] != '') {
|
||||
$fields .= getFormGroupOutput($groupname, $groupdetails);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ function buildFormEx($form, $part = '') {
|
||||
$fields .= getFormFieldOutput($fieldname, $fielddetails);
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
function getFormFieldOutput($fieldname, $fielddata) {
|
||||
|
||||
global $lng;
|
||||
|
||||
$returnvalue = '';
|
||||
if (is_array($fielddata)
|
||||
&& isset($fielddata['type'])
|
||||
@@ -51,6 +53,7 @@ function getFormFieldOutput($fieldname, $fielddata) {
|
||||
$websrv = Settings::Get('system.webserver');
|
||||
if (!in_array($websrv, $fielddata['websrv_avail'])) {
|
||||
$do_show = false;
|
||||
$fielddata['label'].= sprintf($lng['serversettings']['option_unavailable_websrv'], implode(", ", $fielddata['websrv_avail']));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,11 +62,14 @@ function getFormFieldOutput($fieldname, $fielddata) {
|
||||
// be false due to websrv_avail
|
||||
if (isset($fielddata['visible']) && $do_show) {
|
||||
$do_show = $fielddata['visible'];
|
||||
if (!$do_show) {
|
||||
$fielddata['label'].= $lng['serversettings']['option_unavailable'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($do_show) {
|
||||
$returnvalue = call_user_func('getFormFieldOutput' . ucfirst($fielddata['type']), $fieldname, $fielddata);
|
||||
}
|
||||
//if ($do_show) {
|
||||
$returnvalue = call_user_func('getFormFieldOutput' . ucfirst($fielddata['type']), $fieldname, $fielddata, $do_show);
|
||||
//}
|
||||
}
|
||||
return $returnvalue;
|
||||
}
|
||||
|
||||
@@ -81,11 +81,13 @@ function getFormOverviewGroupOutput($groupname, $groupdetails) {
|
||||
$websrv = Settings::Get('system.webserver');
|
||||
if (!in_array($websrv, $groupdetails['websrv_avail'])) {
|
||||
$do_show = false;
|
||||
$title .= sprintf($lng['serversettings']['option_unavailable_websrv'], implode(", ", $groupdetails['websrv_avail']));
|
||||
// hack disabled flag into select-box
|
||||
$option = str_replace('<select class', '<select disabled="disabled" class', $option);
|
||||
}
|
||||
}
|
||||
|
||||
if ($do_show) {
|
||||
eval("\$group = \"" . getTemplate("settings/settings_overviewgroup") . "\";");
|
||||
}
|
||||
eval("\$group = \"" . getTemplate("settings/settings_overviewgroup") . "\";");
|
||||
|
||||
return $group;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function getFormFieldOutputHiddenString($fieldname, $fielddata)
|
||||
function getFormFieldOutputHiddenString($fieldname, $fielddata, $do_show = true)
|
||||
{
|
||||
$label = $fielddata['label'];
|
||||
$value = htmlentities($fielddata['value']);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function getFormFieldOutputInt($fieldname, $fielddata)
|
||||
function getFormFieldOutputInt($fieldname, $fielddata, $do_show = true)
|
||||
{
|
||||
return getFormFieldOutputString($fieldname, $fielddata);
|
||||
return getFormFieldOutputString($fieldname, $fielddata, $do_show);
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function getFormFieldOutputOption($fieldname, $fielddata)
|
||||
function getFormFieldOutputOption($fieldname, $fielddata, $do_show = true)
|
||||
{
|
||||
$returnvalue = '';
|
||||
|
||||
|
||||
if(isset($fielddata['option_options']) && is_array($fielddata['option_options']) && !empty($fielddata['option_options']))
|
||||
{
|
||||
if(isset($fielddata['option_mode']) && $fielddata['option_mode'] == 'multiple')
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function getFormFieldOutputString($fieldname, $fielddata)
|
||||
function getFormFieldOutputString($fieldname, $fielddata, $do_show = true)
|
||||
{
|
||||
$label = $fielddata['label'];
|
||||
$value = htmlentities($fielddata['value']);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function getFormFieldOutputText($fieldname, $fielddata)
|
||||
function getFormFieldOutputText($fieldname, $fielddata, $do_show = true)
|
||||
{
|
||||
$label = $fielddata['label'];
|
||||
$value = htmlentities($fielddata['value']);
|
||||
|
||||
@@ -2037,3 +2037,5 @@ $lng['serversettings']['le_froxlor_enabled']['description'] = "If activated, the
|
||||
$lng['serversettings']['le_froxlor_redirect']['title'] = "Enable SSL-redirect for the froxlor vhost";
|
||||
$lng['serversettings']['le_froxlor_redirect']['description'] = "If activated, all http requests to your froxlor will be redirected to the corresponding SSL site.";
|
||||
$lng['admin']['froxlorvhost'] = 'Froxlor VirtualHost settings';
|
||||
$lng['serversettings']['option_unavailable_websrv'] = '<br><em class="red">Availble only for: %s</em>';
|
||||
$lng['serversettings']['option_unavailable'] = '<br><em class="red">Option not availble due to other settings.</em>';
|
||||
|
||||
@@ -1689,3 +1689,5 @@ $lng['serversettings']['le_froxlor_enabled']['description'] = "Wenn dies aktivie
|
||||
$lng['serversettings']['le_froxlor_redirect']['title'] = "SSL-Weiterleitung für den froxlor Vhost aktivieren";
|
||||
$lng['serversettings']['le_froxlor_redirect']['description'] = "Wenn dies aktiviert ist, werden alle HTTP Anfragen an die entsprechende SSL Seite weitergeleitet.";
|
||||
$lng['admin']['froxlorvhost'] = 'Froxlor VirtualHost Einstellungen';
|
||||
$lng['serversettings']['option_unavailable_websrv'] = '<br><em class="red">Nur verfügbar für: %s</em>';
|
||||
$lng['serversettings']['option_unavailable'] = '<br><em class="red">Option aufgrund anderer Einstellungen nicht verfügbar.</em>';
|
||||
|
||||
2
templates/Sparkle/formfields/bool.tpl
vendored
2
templates/Sparkle/formfields/bool.tpl
vendored
@@ -1,4 +1,4 @@
|
||||
<tr>
|
||||
<td>{$label}</td>
|
||||
<td><input type="checkbox" name="{$fieldname}" value="1" <if( $fielddata['value'] == '1' )>checked="checked"</if> /></td>
|
||||
<td><input <if $do_show == 0>disabled="disabled"</if> type="checkbox" name="{$fieldname}" value="1" <if( $fielddata['value'] == '1' )>checked="checked"</if> /></td>
|
||||
</tr>
|
||||
|
||||
2
templates/Sparkle/formfields/file.tpl
vendored
2
templates/Sparkle/formfields/file.tpl
vendored
@@ -1,4 +1,4 @@
|
||||
<tr>
|
||||
<td>{$label}</td>
|
||||
<td><input type="file" class="file" name="{$fieldname}" /></td>
|
||||
<td><input <if $do_show == 0>disabled="disabled"</if> type="file" class="file" name="{$fieldname}" /></td>
|
||||
</tr>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<tr>
|
||||
<td>{$label}</td>
|
||||
<td><input type="password" class="text" name="{$fieldname}" value="{$value}" /></td>
|
||||
<td><input <if $do_show == 0>disabled="disabled"</if> type="password" class="text" name="{$fieldname}" value="{$value}" /></td>
|
||||
</tr>
|
||||
2
templates/Sparkle/formfields/option.tpl
vendored
2
templates/Sparkle/formfields/option.tpl
vendored
@@ -1,4 +1,4 @@
|
||||
<tr>
|
||||
<td>{$label}</td>
|
||||
<td><select name="{$fieldname}<if $multiple == true>[]</if>"<if $multiple == true> multiple="multiple"</if>>{$options}</select></td>
|
||||
<td><select <if $do_show == 0>disabled="disabled"</if> name="{$fieldname}<if $multiple == true>[]</if>"<if $multiple == true> multiple="multiple"</if>>{$options}</select></td>
|
||||
</tr>
|
||||
|
||||
2
templates/Sparkle/formfields/string.tpl
vendored
2
templates/Sparkle/formfields/string.tpl
vendored
@@ -1,4 +1,4 @@
|
||||
<tr>
|
||||
<td>{$label}</td>
|
||||
<td><input type="text" class="text" name="{$fieldname}" value="{$value}" /></td>
|
||||
<td><input <if $do_show == 0>disabled="disabled"</if> type="text" class="text" name="{$fieldname}" value="{$value}" /></td>
|
||||
</tr>
|
||||
|
||||
2
templates/Sparkle/formfields/text.tpl
vendored
2
templates/Sparkle/formfields/text.tpl
vendored
@@ -1,4 +1,4 @@
|
||||
<tr>
|
||||
<td>{$label}</td>
|
||||
<td><textarea rows="12" cols="40" name="{$fieldname}">{$value}</textarea></td>
|
||||
<td><textarea <if $do_show == 0>disabled="disabled"</if> rows="12" cols="40" name="{$fieldname}">{$value}</textarea></td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user