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