- more work on froxlor-client settings (multiserver mode)

This commit is contained in:
Michael Kaufmann (d00p)
2010-10-19 20:42:55 +00:00
parent 58499a068f
commit d3fd4ee2f4
7 changed files with 104 additions and 19 deletions

View File

@@ -181,7 +181,20 @@ if((int)$settings['multiserver']['enabled'] == 1)
) { ) {
$client = froxlorclient::getInstance($userinfo, $db, $id); $client = froxlorclient::getInstance($userinfo, $db, $id);
$settings_data = $client->getSettingsData(); /**
* @TODO
* - decide by client type (implementation will follow)
* what settings are going to be shown here
* (parameter $client_settings, has to be an array,
* see loadConfigArrayDir-function)
*/
$client_settings = array('froxlorclient');
$settings_data = loadConfigArrayDir(
'./actions/admin/settings/',
'./actions/multiserver/clientsettings/',
$client_settings
);
$settings = $client->getSettingsArray(); $settings = $client->getSettingsArray();
if(isset($_POST['send']) if(isset($_POST['send'])
@@ -190,14 +203,32 @@ if((int)$settings['multiserver']['enabled'] == 1)
} }
else else
{ {
$_part = isset($_GET['part']) ? $_GET['part'] : '';
if($_part == '')
{
$_part = isset($_POST['part']) ? $_POST['part'] : '';
}
/** /**
* @TODO * @TODO this has to get the client-id so the
* - show all client settings * links "configuration" have the ID
* - validate settings
*/ */
echo $header; $fields = buildFormEx($settings_data, $_part);
echo "Here you will see the clients configuration, you will know most of the settings from the 'master'-panel already";
echo $footer; $settings_page = '';
if($_part == '')
{
eval("\$settings_page .= \"" . getTemplate("froxlorclients/froxlorclient_settingsoverview") . "\";");
}
else
{
eval("\$settings_page .= \"" . getTemplate("froxlorclients/froxlorclient_settings") . "\";");
}
eval("echo \"" . getTemplate("settings/settings_form_begin") . "\";");
eval("echo \$settings_page;");
eval("echo \"" . getTemplate("froxlorclients/froxlorclient_settingsend") . "\";");
} }
} }
/** /**

View File

@@ -235,15 +235,6 @@ class froxlorclient
return $this->Get('settings'); return $this->Get('settings');
} }
/**
* return the complete client-settings-data array
* for the settings page
*/
public function getSettingsData()
{
return $this->s_data;
}
/** /**
* get a value from the internal data array * get a value from the internal data array
* *

View File

@@ -28,9 +28,20 @@ function loadConfigArrayDir()
$numargs = func_num_args(); $numargs = func_num_args();
if($numargs <= 0) { return null; } if($numargs <= 0) { return null; }
// variable that holds all dirs that will
// be parsed for inclusion
$configdirs = array(); $configdirs = array();
// if one of the parameters is an array
// we assume that this is a list of
// setting-groups to be selected
$selection = null;
for($x=0;$x<$numargs;$x++) { for($x=0;$x<$numargs;$x++) {
$configdirs[] = func_get_arg($x); $arg = func_get_arg($x);
if(is_array($arg) && isset($arg[0])) {
$selection = $arg;
} else {
$configdirs[] = $arg;
}
} }
$data = array(); $data = array();
@@ -63,5 +74,22 @@ function loadConfigArrayDir()
} }
} }
// if we have specific setting-groups
// to select, we'll handle this here
// (this is for multiserver-client settings)
$_data = array();
if($selection != null
&& is_array($selection)
&& isset($selection[0])
) {
foreach($data['groups'] as $group => $data)
{
if(in_array($group, $selection)) {
$_data[$group] = $data;
}
}
$data = $_data;
}
return $data; return $data;
} }

View File

@@ -1537,5 +1537,6 @@ $lng['froxlorclient']['ssh_user'] = 'SSH user';
$lng['froxlorclient']['ssh_passphrase'] = 'SSH passphrase'; $lng['froxlorclient']['ssh_passphrase'] = 'SSH passphrase';
$lng['froxlorclient']['ssh_pubkey'] = 'SSH public key'; $lng['froxlorclient']['ssh_pubkey'] = 'SSH public key';
$lng['froxlorclient']['ssh_privkey'] = 'SSH private key'; $lng['froxlorclient']['ssh_privkey'] = 'SSH private key';
$lng['admin']['froxlorclient_settings'] = 'Froxlor client settings:';
?> ?>

View File

@@ -0,0 +1,12 @@
<table cellpadding="5" cellspacing="4" border="0" align="center" class="maintable">
<tr>
<td class="maintitle" colspan="2"><b><img src="images/title.gif" alt="" />&nbsp;{$lng['admin']['froxlorclient_settings']}&nbsp;"{$client->Get('name')}</b>
[<a href="$filename?page=settings&amp;part=&amp;s=$s&amp;id={$id}">{$lng['admin']['configfiles']['compactoverview']}</a>]</td>
</tr>
$fields
<tr>
<td class="maintitle_apply_right" nowrap="nowrap" colspan="2">
<input class="bottom" type="reset" value="{$lng['panel']['reset']}" /><input class="bottom" type="submit" value="{$lng['panel']['save']}" />
</td>
</tr>
</table>

View File

@@ -0,0 +1,8 @@
<if $_part != ''>
<input type="hidden" name="part" value="{$_part}" />
</if>
<input type="hidden" name="id" value="{$id}" />
</form>
<br />
<br />
$footer

View File

@@ -0,0 +1,14 @@
<table cellpadding="5" cellspacing="4" border="0" align="center" class="maintable_60">
<tr>
<td class="maintitle" align="center" colspan="3">
<b><img src="images/title.gif" alt="" />&nbsp;{$lng['admin']['configfiles']['serverconfiguration']}</b>
[<a href="$filename?page=settings&amp;part=all&amp;s=$s&amp;id={$id}">{$lng['admin']['configfiles']['overview']}</a>]
</td>
</tr>
$fields
<tr>
<td class="maintitle_apply_right" nowrap="nowrap" colspan="3">
<input class="bottom" type="reset" value="{$lng['panel']['reset']}" />&nbsp;<input class="bottom" type="submit" value="{$lng['panel']['save']}" />
</td>
</tr>
</table>