diff --git a/app/pages/config.php b/app/pages/config.php index aa3ffc7..a028b9e 100644 --- a/app/pages/config.php +++ b/app/pages/config.php @@ -109,20 +109,32 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { // no form submitted, show the templates } else { - // $item - config.js and interface_config.js are special case; remote loaded files switch ($item) { - case 'configjs': + case 'platforms': $mode = $_REQUEST['mode'] ?? ''; $raw = ($mode === 'raw'); $platformConfigjs = $configObject->getPlatformConfigjs($platformDetails[0]['jitsi_url'], $raw); include '../app/templates/config-list-configjs.php'; break; - case 'interfaceconfigjs': + case 'hosts': $mode = $_REQUEST['mode'] ?? ''; $raw = ($mode === 'raw'); $platformInterfaceConfigjs = $configObject->getPlatformInterfaceConfigjs($platformDetails[0]['jitsi_url'], $raw); include '../app/templates/config-list-interfaceconfigjs.php'; break; + case 'endpoints': + $mode = $_REQUEST['mode'] ?? ''; + $raw = ($mode === 'raw'); + $platformInterfaceConfigjs = $configObject->getPlatformInterfaceConfigjs($platformDetails[0]['jitsi_url'], $raw); + include '../app/templates/config-list-interfaceconfigjs.php'; + break; + case 'config_file': + if ($userObject->hasRight($user_id, 'view config file')) { + include '../app/templates/config-configfile.php'; + } else { + include '../app/templates/error-unauthorized.php'; + } + break; // if there is no $item, we work on the local config DB default: @@ -153,12 +165,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { include '../app/templates/config-delete-platform.php'; } break; - default: - if ($userObject->hasRight($user_id, 'view config file')) { - include '../app/templates/config-list.php'; - } else { - include '../app/templates/error-unauthorized.php'; - } } } } diff --git a/app/pages/data.php b/app/pages/data.php index 16a3c29..cb898be 100644 --- a/app/pages/data.php +++ b/app/pages/data.php @@ -9,97 +9,94 @@ require '../app/classes/agent.php'; $configObject = new Config(); $agentObject = new Agent($dbWeb); -// no form submitted, show the templates +switch ($item) { - // $item - config.js and interface_config.js are special case; remote loaded files - switch ($item) { + case 'graphs': + // FIXME example data + $one = date('Y-m-d',strtotime("-5 days")); + $two = date('Y-m-d',strtotime("-4 days")); + $three = date('Y-m-d',strtotime("-2 days")); + $four = date('Y-m-d',strtotime("-1 days")); - case 'graphs': - // FIXME example data - $one = date('Y-m-d',strtotime("-5 days")); - $two = date('Y-m-d',strtotime("-4 days")); - $three = date('Y-m-d',strtotime("-2 days")); - $four = date('Y-m-d',strtotime("-1 days")); + $graph[0]['data0'] = [ + ['date' => $one, 'value' => 10], + ['date' => $two, 'value' => 20], + ['date' => $three, 'value' => 15], + ['date' => $four, 'value' => 25], + ]; - $graph[0]['data0'] = [ - ['date' => $one, 'value' => 10], - ['date' => $two, 'value' => 20], - ['date' => $three, 'value' => 15], - ['date' => $four, 'value' => 25], - ]; + $graph[0]['data1'] = [ + ['date' => $one, 'value' => 12], + ['date' => $two, 'value' => 23], + ['date' => $three, 'value' => 11], + ['date' => $four, 'value' => 27], + ]; - $graph[0]['data1'] = [ - ['date' => $one, 'value' => 12], - ['date' => $two, 'value' => 23], - ['date' => $three, 'value' => 11], - ['date' => $four, 'value' => 27], - ]; + $graph[0]['graph_name'] = 'conferences'; + $graph[0]['graph_title'] = 'Conferences in "' . htmlspecialchars($platformDetails[0]['name']) . '" over time'; + $graph[0]['graph_data0_label'] = 'Conferences from Jitsi logs (Jilo)'; + $graph[0]['graph_data1_label'] = 'Conferences from Jitsi API (Jilo Agents)'; - $graph[0]['graph_name'] = 'conferences'; - $graph[0]['graph_title'] = 'Conferences in "' . htmlspecialchars($platformDetails[0]['name']) . '" over time'; - $graph[0]['graph_data0_label'] = 'Conferences from Jitsi logs (Jilo)'; - $graph[0]['graph_data1_label'] = 'Conferences from Jitsi API (Jilo Agents)'; + $graph[1]['data0'] = [ + ['date' => $one, 'value' => 20], + ['date' => $two, 'value' => 30], + ['date' => $three, 'value' => 15], + ['date' => $four, 'value' => 55], + ]; - $graph[1]['data0'] = [ - ['date' => $one, 'value' => 20], - ['date' => $two, 'value' => 30], - ['date' => $three, 'value' => 15], - ['date' => $four, 'value' => 55], - ]; + $graph[1]['data1'] = [ + ['date' => $one, 'value' => 22], + ['date' => $two, 'value' => 33], + ['date' => $three, 'value' => 11], + ['date' => $four, 'value' => 57], + ]; - $graph[1]['data1'] = [ - ['date' => $one, 'value' => 22], - ['date' => $two, 'value' => 33], - ['date' => $three, 'value' => 11], - ['date' => $four, 'value' => 57], - ]; + $graph[1]['graph_name'] = 'participants'; + $graph[1]['graph_title'] = 'Participants in "' . htmlspecialchars($platformDetails[0]['name']) . '" over time'; + $graph[1]['graph_data0_label'] = 'Participants from Jitsi logs (Jilo)'; + $graph[1]['graph_data1_label'] = 'Participants from Jitsi API (Jilo Agents)'; - $graph[1]['graph_name'] = 'participants'; - $graph[1]['graph_title'] = 'Participants in "' . htmlspecialchars($platformDetails[0]['name']) . '" over time'; - $graph[1]['graph_data0_label'] = 'Participants from Jitsi logs (Jilo)'; - $graph[1]['graph_data1_label'] = 'Participants from Jitsi API (Jilo Agents)'; + include '../app/templates/graphs-combined.php'; + break; - include '../app/templates/graphs-combined.php'; - break; + case 'latest': + $latestJvbConferences = $agentObject->getLatestData($platform_id, 'jvb', 'conferences'); + $latestJvbParticipants = $agentObject->getLatestData($platform_id, 'jvb', 'participants'); + $latestJicofoConferences = $agentObject->getLatestData($platform_id, 'jicofo', 'conferences'); + $latestJicofoParticipants = $agentObject->getLatestData($platform_id, 'jicofo', 'participants'); - case 'latest': - $latestJvbConferences = $agentObject->getLatestData($platform_id, 'jvb', 'conferences'); - $latestJvbParticipants = $agentObject->getLatestData($platform_id, 'jvb', 'participants'); - $latestJicofoConferences = $agentObject->getLatestData($platform_id, 'jicofo', 'conferences'); - $latestJicofoParticipants = $agentObject->getLatestData($platform_id, 'jicofo', 'participants'); + $widget['records'] = array(); - $widget['records'] = array(); + // prepare the widget + $widget['full'] = false; + $widget['name'] = 'LatestData'; + $widget['title'] = 'Latest data from Jilo Agents'; + $widget['collapsible'] = false; + $widget['collapsed'] = false; + $widget['filter'] = false; + if (!empty($latestJvbConferences) && !empty($latestJvbParticipants) && !empty($latestJicofoConferences) && !empty($latestJicofoParticipants)) { + $widget['full'] = true; + } + $widget['pagination'] = true; - // prepare the widget - $widget['full'] = false; - $widget['name'] = 'LatestData'; - $widget['title'] = 'Latest data from Jilo Agents'; - $widget['collapsible'] = false; - $widget['collapsed'] = false; - $widget['filter'] = false; - if (!empty($latestJvbConferences) && !empty($latestJvbParticipants) && !empty($latestJicofoConferences) && !empty($latestJicofoParticipants)) { - $widget['full'] = true; - } - $widget['pagination'] = true; + include '../app/templates/latest-data.php'; + break; - include '../app/templates/latest-data.php'; - break; + case 'configjs': + $mode = $_REQUEST['mode'] ?? ''; + $raw = ($mode === 'raw'); + $platformConfigjs = $configObject->getPlatformConfigjs($platformDetails[0]['jitsi_url'], $raw); + include '../app/templates/config-list-configjs.php'; + break; - case 'configjs': - $mode = $_REQUEST['mode'] ?? ''; - $raw = ($mode === 'raw'); - $platformConfigjs = $configObject->getPlatformConfigjs($platformDetails[0]['jitsi_url'], $raw); - include '../app/templates/config-list-configjs.php'; - break; + case 'interfaceconfigjs': + $mode = $_REQUEST['mode'] ?? ''; + $raw = ($mode === 'raw'); + $platformInterfaceConfigjs = $configObject->getPlatformInterfaceConfigjs($platformDetails[0]['jitsi_url'], $raw); + include '../app/templates/config-list-interfaceconfigjs.php'; + break; - case 'interfaceconfigjs': - $mode = $_REQUEST['mode'] ?? ''; - $raw = ($mode === 'raw'); - $platformInterfaceConfigjs = $configObject->getPlatformInterfaceConfigjs($platformDetails[0]['jitsi_url'], $raw); - include '../app/templates/config-list-interfaceconfigjs.php'; - break; - - default: - } + default: +} ?> diff --git a/app/templates/config-configfile.php b/app/templates/config-configfile.php new file mode 100644 index 0000000..aa023be --- /dev/null +++ b/app/templates/config-configfile.php @@ -0,0 +1,22 @@ + + +
+

Jilo configuration

+

+ platforms + hosts + endpoints +    + config file +

+
+

main variables

+ + +
+
+