Moving all of agents config to "config" page
parent
6d07744ab7
commit
1acb7126ec
|
@ -33,14 +33,14 @@ class Agent {
|
|||
public function addAgent($platform_id, $newAgent) {
|
||||
try {
|
||||
$sql = 'INSERT INTO jilo_agents
|
||||
(platform_id, type_id, url, secret_key)
|
||||
(platform_id, agent_type_id, url, secret_key)
|
||||
VALUES
|
||||
(:platform_id, :type_id, :url, :secret_key)';
|
||||
(:platform_id, :agent_type_id, :url, :secret_key)';
|
||||
|
||||
$query = $this->db->prepare($sql);
|
||||
$query->execute([
|
||||
':platform_id' => $platform_id,
|
||||
':type_id' => $newAgent['type_id'],
|
||||
':agent_type_id' => $newAgent['type_id'],
|
||||
':url' => $newAgent['url'],
|
||||
':secret_key' => $newAgent['secret_key'],
|
||||
]);
|
||||
|
@ -56,7 +56,7 @@ class Agent {
|
|||
public function editAgent($platform_id, $updatedAgent) {
|
||||
try {
|
||||
$sql = 'UPDATE jilo_agents SET
|
||||
type_id = :type_id,
|
||||
agent_type_id = :agent_type_id,
|
||||
url = :url,
|
||||
secret_key = :secret_key
|
||||
WHERE
|
||||
|
@ -66,7 +66,7 @@ class Agent {
|
|||
|
||||
$query = $this->db->prepare($sql);
|
||||
$query->execute([
|
||||
':type_id' => $updatedAgent['type_id'],
|
||||
':agent_type_id' => $updatedAgent['agent_type_id'],
|
||||
':url' => $updatedAgent['url'],
|
||||
':secret_key' => $updatedAgent['secret_key'],
|
||||
':agent_id' => $updatedAgent['id'],
|
||||
|
|
|
@ -49,28 +49,28 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
//
|
||||
// }
|
||||
|
||||
header("Location: $app_root?platform=$platform_id&page=agents");
|
||||
header("Location: $app_root?platform=$platform_id&page=config");
|
||||
exit();
|
||||
|
||||
// no form submitted, show the templates
|
||||
} else {
|
||||
|
||||
switch ($action) {
|
||||
case 'add':
|
||||
include '../app/templates/agent-add.php';
|
||||
break;
|
||||
case 'edit':
|
||||
$agentDetails = $agentObject->getAgentDetails($platform_id, $agent);
|
||||
include '../app/templates/agent-edit.php';
|
||||
break;
|
||||
case 'delete':
|
||||
$agentDetails = $agentObject->getAgentDetails($platform_id, $agent);
|
||||
include '../app/templates/agent-delete.php';
|
||||
break;
|
||||
default:
|
||||
$agentDetails = $agentObject->getAgentDetails($platform_id);
|
||||
include '../app/templates/agent-list.php';
|
||||
}
|
||||
// switch ($action) {
|
||||
// case 'add':
|
||||
// include '../app/templates/agent-add.php';
|
||||
// break;
|
||||
// case 'edit':
|
||||
// $agentDetails = $agentObject->getAgentDetails($platform_id, $agent);
|
||||
// include '../app/templates/agent-edit.php';
|
||||
// break;
|
||||
// case 'delete':
|
||||
// $agentDetails = $agentObject->getAgentDetails($platform_id, $agent);
|
||||
// include '../app/templates/agent-delete.php';
|
||||
// break;
|
||||
// default:
|
||||
// $agentDetails = $agentObject->getAgentDetails($platform_id);
|
||||
// include '../app/templates/agent-list.php';
|
||||
// }
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -41,7 +41,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
$platformObject->addPlatform($newPlatform);
|
||||
|
||||
// deleting an agent
|
||||
} elseif (isset($_POST['delete']) && isset($_POST['item']) && $_POST['delete'] === 'true' && $_POST['item'] === 'agent') {
|
||||
} elseif (isset($_POST['delete']) && isset($_POST['agent']) && $_POST['delete'] === 'true') {
|
||||
$result = $agentObject->deleteAgent($agent);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "Agent id \"{$_REQUEST['agent']}\" deleted.";
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<p class="h4 card-header">Add new Jilo Agent to Jitsi platform "<strong><?= htmlspecialchars($platformDetails[0]['name']) ?></strong>"</p>
|
||||
<div class="card-body">
|
||||
<!--p class="card-text">add new platform:</p-->
|
||||
<form method="POST" action="<?= $app_root ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=agents">
|
||||
<form method="POST" action="<?= $app_root ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=config">
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
|
@ -40,6 +40,7 @@
|
|||
</div>
|
||||
|
||||
<input type="hidden" name="new" value="true" />
|
||||
<input type="hidden" name="item" value="agent" />
|
||||
|
||||
<br />
|
||||
<a class="btn btn-secondary" href="<?= $app_root ?>?page=config" />Cancel</a>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<p class="h4 card-header">Jilo Agent configuration for Jitsi platform <strong>"<?= htmlspecialchars($platformDetails[0]['name']) ?>"</strong></p>
|
||||
<div class="card-body">
|
||||
<p class="card-text">delete an agent:</p>
|
||||
<form method="POST" action="<?= $app_root ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=agents">
|
||||
<form method="POST" action="<?= $app_root ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=config">
|
||||
<?php
|
||||
foreach ($agentDetails[0] as $key => $value) {
|
||||
// if ($key === 'id') continue;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<p class="h4 card-header">Jilo Agent configuration for Jitsi platform <strong>"<?= htmlspecialchars($platformDetails[0]['name']) ?>"</strong></p>
|
||||
<div class="card-body">
|
||||
<p class="card-text">edit the agent details:</p>
|
||||
<form method="POST" action="<?= $app_root ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=agents">
|
||||
<form method="POST" action="<?= $app_root ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=config">
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 text-end">
|
||||
|
|
Loading…
Reference in New Issue