Commit 108e4bb0 authored by Falko Timme's avatar Falko Timme

- Dashlets can now be managed from interface config (left column, right...

- Dashlets can now be managed from interface config (left column, right column, position, etc.). Defaults dashlets are used if appropriate fields in interface config are left empty. TODO: formatting of dashlets; they need to adjust themselves to left or right column.
parent d6fa81a0
......@@ -409,6 +409,42 @@ $form["tabs"]['misc'] = array (
'default' => 'n',
'value' => array(0 => 'n',1 => 'y')
),
'admin_dashlets_left' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => ''
),
'admin_dashlets_right' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => ''
),
'reseller_dashlets_left' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => ''
),
'reseller_dashlets_right' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => ''
),
'client_dashlets_left' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => ''
),
'client_dashlets_right' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => ''
),
##################################
# ENDE Datatable fields
##################################
......
......@@ -52,4 +52,11 @@ $wb['mailbox_show_custom_rules_tab_txt'] = 'Zeige Benutzerregel Reiter in E-Mail
$wb['webmail_url_error_regex'] = 'Falsche Webmail URL';
$wb['phpmyadmin_url_note_txt'] = 'Platzhalter:';
$wb['webmail_url_note_txt'] = 'Platzhalter:';
$wb['available_dashlets_note_txt'] = 'Verfügbare Dashlets:';
$wb['admin_dashlets_left_txt'] = 'Admin-Dashlets links';
$wb['admin_dashlets_right_txt'] = 'Admin-Dashlets rechts';
$wb['reseller_dashlets_left_txt'] = 'Reseller-Dashlets links';
$wb['reseller_dashlets_right_txt'] = 'Reseller-Dashlets rechts';
$wb['client_dashlets_left_txt'] = 'Kunden-Dashlets links';
$wb['client_dashlets_right_txt'] = 'Kunden-Dashlets rechts';
?>
......@@ -52,4 +52,11 @@ $wb['mailbox_show_custom_rules_tab_txt'] = 'Show custom mailfilter tab in mail a
$wb['webmail_url_error_regex'] = 'Invalid webmail URL';
$wb['phpmyadmin_url_note_txt'] = 'Placeholder:';
$wb['webmail_url_note_txt'] = 'Placeholder:';
$wb['available_dashlets_note_txt'] = 'Available Dashlets:';
$wb['admin_dashlets_left_txt'] = 'Left Admin Dashlets';
$wb['admin_dashlets_right_txt'] = 'Right Admin Dashlets';
$wb['reseller_dashlets_left_txt'] = 'Left Reseller Dashlets';
$wb['reseller_dashlets_right_txt'] = 'Right Reseller Dashlets';
$wb['client_dashlets_left_txt'] = 'Left Client Dashlets';
$wb['client_dashlets_right_txt'] = 'Right Client Dashlets';
?>
......@@ -78,6 +78,24 @@ class page_action extends tform_actions {
$app->tpl->setVar($record);
}
function onShowEnd() {
global $app, $conf;
// available dashlets
$available_dashlets_txt = '';
$handle = @opendir(ISPC_WEB_PATH.'/dashboard/dashlets');
while ($file = @readdir ($handle)) {
if ($file != '.' && $file != '..' && !is_dir($file)) {
$available_dashlets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.substr($file,0,-4).']<pre class="addPlaceholderContent" style="display:none;">['.substr($file,0,-4).'],</pre></a> ';
}
}
if($available_dashlets_txt == '') $available_dashlets_txt = '------';
$app->tpl->setVar("available_dashlets_txt",$available_dashlets_txt);
parent::onShowEnd();
}
function onSubmit() {
global $app;
......
......@@ -20,6 +20,30 @@
<div class="ctrlHolder">
<label for="monitor_key">{tmpl_var name='monitor_key_txt'}</label>
<input name="monitor_key" id="monitor_key" value="{tmpl_var name='monitor_key'}" size="" maxlength="" type="text" class="textInput" />
</div>
<div class="ctrlHolder">
<label for="admin_dashlets_left">{tmpl_var name='admin_dashlets_left_txt'}</label>
<input name="admin_dashlets_left" id="admin_dashlets_left" value="{tmpl_var name='admin_dashlets_left'}" size="" maxlength="" type="text" class="textInput" />&nbsp;{tmpl_var name='available_dashlets_note_txt'} {tmpl_var name="available_dashlets_txt"}
</div>
<div class="ctrlHolder">
<label for="admin_dashlets_right">{tmpl_var name='admin_dashlets_right_txt'}</label>
<input name="admin_dashlets_right" id="admin_dashlets_right" value="{tmpl_var name='admin_dashlets_right'}" size="" maxlength="" type="text" class="textInput" />&nbsp;{tmpl_var name='available_dashlets_note_txt'} {tmpl_var name="available_dashlets_txt"}
</div>
<div class="ctrlHolder">
<label for="reseller_dashlets_left">{tmpl_var name='reseller_dashlets_left_txt'}</label>
<input name="reseller_dashlets_left" id="reseller_dashlets_left" value="{tmpl_var name='reseller_dashlets_left'}" size="" maxlength="" type="text" class="textInput" />&nbsp;{tmpl_var name='available_dashlets_note_txt'} {tmpl_var name="available_dashlets_txt"}
</div>
<div class="ctrlHolder">
<label for="reseller_dashlets_right">{tmpl_var name='reseller_dashlets_right_txt'}</label>
<input name="reseller_dashlets_right" id="reseller_dashlets_right" value="{tmpl_var name='reseller_dashlets_right'}" size="" maxlength="" type="text" class="textInput" />&nbsp;{tmpl_var name='available_dashlets_note_txt'} {tmpl_var name="available_dashlets_txt"}
</div>
<div class="ctrlHolder">
<label for="client_dashlets_left">{tmpl_var name='client_dashlets_left_txt'}</label>
<input name="client_dashlets_left" id="client_dashlets_left" value="{tmpl_var name='client_dashlets_left'}" size="" maxlength="" type="text" class="textInput" />&nbsp;{tmpl_var name='available_dashlets_note_txt'} {tmpl_var name="available_dashlets_txt"}
</div>
<div class="ctrlHolder">
<label for="client_dashlets_right">{tmpl_var name='client_dashlets_right_txt'}</label>
<input name="client_dashlets_right" id="client_dashlets_right" value="{tmpl_var name='client_dashlets_right'}" size="" maxlength="" type="text" class="textInput" />&nbsp;{tmpl_var name='available_dashlets_note_txt'} {tmpl_var name="available_dashlets_txt"}
</div>
<div class="ctrlHolder">
<p class="label">{tmpl_var name='tab_change_discard_txt'}</p>
......
......@@ -157,8 +157,36 @@ while ($file = @readdir ($handle)) {
/* Which dashlets in which column */
/******************************************************************************/
$leftcol_dashlets = array('modules','invoices','quota','mailquota');
$rightcol_dashlets = array('limits');
$default_leftcol_dashlets = array('modules','invoices','quota','mailquota');
$default_rightcol_dashlets = array('limits');
$app->uses('getconf');
$dashlets_config = $app->getconf->get_global_config('misc');
//* Client: If the logged in user is not admin and has no sub clients (no reseller)
if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
$role = 'client';
//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
$role = 'reseller';
//* Admin: If the logged in user is admin
} else {
$role = 'admin';
}
$dashlets_config[$role.'_dashlets_left'] = trim($dashlets_config[$role.'_dashlets_left']);
$dashlets_config[$role.'_dashlets_right'] = trim($dashlets_config[$role.'_dashlets_right']);
if($dashlets_config[$role.'_dashlets_left'] != ''){
preg_match_all('@\[(.*?)\]@', $dashlets_config[$role.'_dashlets_left'], $matches);
$leftcol_dashlets = $matches[1];
} else {
$leftcol_dashlets = $default_leftcol_dashlets;
}
if($dashlets_config[$role.'_dashlets_right'] != ''){
preg_match_all('@\[(.*?)\]@', $dashlets_config[$role.'_dashlets_right'], $matches);
$rightcol_dashlets = $matches[1];
} else {
$rightcol_dashlets = $default_rightcol_dashlets;
}
/******************************************************************************/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment