You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

166 lines
7.8 KiB

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<head>
<title>----- | Simples IP | -----</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="admin/css/validationEngine.jquery.css" type="text/css" media="screen" title="no title" charset="ISO-8859-1" />
<script type="text/javascript" src="admin/js/jquery-1.4.js"></script>
<script type="text/javascript" src="admin/js/jquery.blockUI.js?v2.29"></script>
<script src="admin/js/jquery.validationEngine.js" type="text/javascript"></script>
<script src="admin/js/jquery.validationEngine-en.js" type="text/javascript"></script>
<script src="admin/js/pbxAjax.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
$("#form1").validationEngine({
sucess: function () {
document.form1.submit();
},
failure: function () {}
})
});
</script>
<link href="admin/css/forms.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-color: #EAEAEA;
}
-->
</style></head>
<body>
<?php
$acao = $_GET["acao"];
$acao2 = $_GET["acao2"];
$acao = $_GET['acao'];
$id = $_GET['id'];
$id_ura = $_GET['id_ura'];
$nome_ura = $_GET['nome_ura'];
if ($acao2 == "salva") {
$id = $_POST["id"];
$nome = strtolower(trim($_POST["nome"]));
$som_ura = trim($_POST["som_ura"]);
$ura_desc = trim($_POST["ura_desc"]);
$teste = trim($_POST["teste"]);
$tempo_espera = ((int) trim($_POST["tempo_espera"]));
$permite_ligacao = trim($_POST["permite_ligacao"]);
$acao_ = trim($_POST["acao_"]);
$opcao_ = "ura_ativa"; //trim($_POST["opcao_"]);
$timeout_digito = trim($_POST["timeout_digito"]);
if ($acao == "inseri") {
$query = "INSERT INTO pbx_ura(nome,tempo_espera,permite_ligacao,som_ura,teste,opcao,acao, timeout_digito, ura_desc)
VALUES ('$nome','$tempo_espera','$permite_ligacao','$som_ura','$teste','$opcao_','$acao_', '$timeout_digito', '$ura_desc')";
pg_query($dbcon, $query);
$query = "select max(id) from pbx_ura";
$result = pg_query($dbcon, $query);
$dados = pg_fetch_array($result); {
$id_new = $dados['id'];
}
}
if ($acao == "edita") {
$query = "UPDATE pbx_ura
SET nome='$nome', ura_desc='$ura_desc', teste=$teste
WHERE id=$id";
pg_query($dbcon, $query);
}
//gera arquivos e executa o reload dos dados no asterisk
gera_arquivos($dbcon, 'URA'); //gera arquivos e executa o reload dos dados no asterisk
gera_arquivos($dbcon, 'TESTES');
echo '<script>fecha_popup();</script>';
}
if ($acao == "edita") {
$id = $_GET["id"] ?? "0";
$query = "SELECT * FROM pbx_ura where id=$id";
$result = pg_query($dbcon, $query);
} else {
$query = "SELECT * FROM pbx_ura where id is null";
}
$result = pg_query($dbcon, $query);
while ($dados = pg_fetch_array($result)) {
$id = $dados["id"];
$id_ura = $dados["id"];
$nome = $dados["nome"];
$tempo_espera = $dados["tempo_espera"];
$permite_ligacao = $dados["permite_ligacao"];
$som_ura = $dados["som_ura"];
$ura_desc = $dados["ura_desc"];
$teste = $dados["teste"];
$opcao_ = $dados["opcao"];
$acao_ = $dados["acao"];
$timeout_digito = $dados["timeout_digito"];
}
?>
<form name="form1" method="post" action="index.php?idProg=12031&pbxRequest=1&acao=<?php echo $acao; ?>&acao2=salva&id=<?php echo $id; ?>" id="form1">
<table border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#990000" class="tabela">
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td>
<div align="center" class="cabecalho">CADASTRO DE URA ATIVA
<input name="id" type="hidden" value="<?php
if ($acao == 'edita') {
echo $id;
}
?>" />
<input name="tempo_espera" type="hidden" value="0"/>
<input name="timeout_digito" type="hidden" value="0"/>
<input name="som_ura" type="hidden" value=""/>
<input name="permite_ligacao" type="hidden" value="N"/>
<input name="opcao_" type="hidden" value="uraativa"/>
<input name="acao_" type="hidden" value=""/>
</div></td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td class="labels">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><fieldset>
<legend class="labels">Nome:</legend>
<input name="nome" type="text" class="validate[required,length[0,100]] caixas" id="nome2" value="<?php
if ($acao == 'edita') {
echo $nome;
}
?>" size="40" maxlength="100" />
</fieldset></td>
<td><fieldset>
<legend class="labels">Discar:</legend>
<input name="teste" type="text" class="caixas" id="teste2" size="7" maxlength="5" value="<?php echo $teste; ?>"/>
</fieldset></td>
</tr>
</table>
</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<fieldset>
<legend class="labels">Descri<EFBFBD><EFBFBD>o:</legend>
<textarea name="ura_desc" cols="60" rows="6" id="ura_desc"><?php
if ($acao == 'edita') {
echo $ura_desc;
}
?></textarea>
</fieldset>
</td>
</tr>
</table></td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td><div align="center">
<input name="Submit2" type="button" class="labels" onclick="fecha_popup();" value="Fechar" />
<input name="Submit" type="submit" class="labels" value="Salvar" />
</div></td>
</tr>
</table>
</form>
</body>
</html>