<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
< html >
< head >
< 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.min.js" type = "text/javascript" > < / 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() {}
})
});
function MM_jumpMenu(targ, selObj, restore) { //v3.0
eval("deps.location='pop_departamento.php?id1=" + selObj.options[selObj.selectedIndex].value + "'");
if (restore) {
selObj.selectedIndex = 0;
}
}
< / script >
< link href = "admin/css/forms.css" rel = "stylesheet" type = "text/css" >
< / head >
< body >
<?php
$org_id = GetOrganizacao();
$acao = $_GET["acao"];
$acao2 = $_GET["acao2"];
$param = sprintf('& numRamal=%s& pgn=%s& bloco=%s& pg=%s', $_REQUEST['numRamal'], $_REQUEST['pgn'], $_REQUEST['bloco'], $_REQUEST['pg']);
if ($acao2 == "salva") {
$id = $_POST["id"];
$caixa_postal = trim($_POST["caixa_postal"]);
$caixa_postal_old = trim($_POST["caixa_postal_old"]);
if (md5($_SESSION['SSKeepPassword']) == trim($_POST["senha"])) {
$senha = $_SESSION['SSKeepPassword'];
unset($_SESSION['SSKeepPassword']);
} else {
$senha = trim($_POST["senha"]);
}
$email = RemoveAcentos($_POST["email"], -1);
$nome = RemoveAcentos($_POST["nome"], true);
$pager = trim($_POST["pager"]);
$attach = trim($_POST["attach"]);
$delete = trim($_POST["delete"]);
$saycid = trim($_POST["saycid"]);
$envelope = trim($_POST["envelope"]);
if (strpos('@', trim($_POST["email"]) !== false)) {
echo "< script > alert ( 'Informe um e-mail v<EFBFBD> lido para efetuar o cadastro!' ) < / script > ";
return;
}
if ($acao == "inseri") {
$query = "INSERT INTO pbx_voicemail_usuarios
(caixa_postal,senha,email,nome,pager,attach,delete,saycid,envelope, org_id)
VALUES ('$caixa_postal','$senha','$email','$nome','$pager','$attach','$delete','$saycid','$envelope', $org_id)";
$result = pg_query($dbcon, $query);
if ($result) {
CommandAsterisk2($dbcon, 'VOICE2', $caixa_postal, $caixa_postal);
}
}
if ($acao == "edita") {
$query = "UPDATE pbx_voicemail_usuarios
SET caixa_postal='$caixa_postal', senha='$senha', email='$email',nome='$nome',pager='$pager',attach='$attach',delete='$delete',saycid='$saycid',envelope='$envelope'
WHERE id=$id";
$result = pg_query($dbcon, $query);
if ($result) {
CommandAsterisk2($dbcon, 'DEL_VOICE2', $caixa_postal_old, null);
CommandAsterisk2($dbcon, 'VOICE2', $caixa_postal, $caixa_postal);
}
}
gera_arquivos($dbcon, 'VOICEMAIL');
echo "< script >
opener.location.reload();
fecha_popup(0,'index.php?idProg=10032&pbxRequest=1$param&acao=$acao');
< / script > ";
}
if ($acao == "edita") {
$id = $_GET["id"] ?? "0";
$query = "SELECT * FROM pbx_voicemail_usuarios where id=$id";
$result = pg_query($dbcon, $query);
} else {
$query = "SELECT * FROM pbx_voicemail_usuarios where id is null";
}
$result = pg_query($dbcon, $query);
if ($dados = pg_fetch_array($result)) {
$id = $dados["id"];
$caixa_postal = $dados["caixa_postal"];
$_SESSION['SSKeepPassword'] = $dados["senha"];
$senha = md5($dados["senha"]);
$email = $dados["email"];
$nome = $dados["nome"];
$attach = $dados["attach"];
$delete = $dados["delete"];
$envelope = $dados["envelope"];
$saycid = $dados["saycid"];
$pager = $dados["pager"];
}
?>
< form name = "form1" method = "post" action = "index.php?idProg=11032&pbxRequest=1&acao= <?php echo $acao ; ?> &acao2=salva <?php echo $param ; ?> " id = "form1" >
< table height = "121" border = "1" align = "center" cellpadding = "0" cellspacing = "0" class = "tabela" >
< tr bordercolor = "#EAEAEA" bgcolor = "#EAEAEA" class = "cabecalho" >
< td height = "21" >
< div align = "center" > CADASTRO DE VOICEMAIL
< input name = "id" type = "hidden" id = "id" value = " <? = ( $acao == 'edita' ) ? $id : null ; ?> " >
< input name = "caixa_postal_old" type = "hidden" value = " <? = ( $acao == 'edita' ) ? $caixa_postal : null ; ?> " >
< / div >
< / td >
< / tr >
< tr bordercolor = "#EAEAEA" bgcolor = "#EAEAEA" >
< td height = "19" 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,custom[onlyLetter],length[0,100]] caixas" id = "nome2" value = " <? = ( $acao == 'edita' ) ? $nome : null ; ?> " size = "40" />
< / fieldset >
< / td >
< td >
< fieldset >
< legend class = "labels" > < span class = "style5" > Senha:< / span > < / legend >
< input name = "senha" type = "password" class = "validate[required] caixas" id = "senha2" value = " <? = ( $acao == 'edita' ) ? $senha : null ; ?> " size = "15" maxlength = "10" />
< / fieldset >
< / td >
< / tr >
< / table >
< / td >
< / tr >
< tr bordercolor = "#EAEAEA" bgcolor = "#EAEAEA" >
< td height = "19" class = "labels" >
< table width = "100%" border = "0" cellspacing = "0" cellpadding = "0" >
< tr >
< td >
< fieldset >
< legend class = "labels" > < span class = "style5" > Ramal:< / span > < / legend >
< input name = "caixa_postal" type = "text" class = "validate[required,custom[onlyNumber],length[0,100]] caixas" id = "caixa_postal" value = " <? = ( $acao == 'edita' ) ? $caixa_postal : null ; ?> " size = "15" />
< / fieldset >
< / td >
< td >
< fieldset >
< legend class = "labels" > < span class = "style5" > E-mail:< / span > < / legend >
< input name = "email" type = "email" class = "validate[optional,email,length[0,100]] caixas" id = "email2" value = " <? = ( $acao == 'edita' ) ? $email : null ; ?> " size = "55" />
< / fieldset >
< / td >
< / tr >
< / table >
< / td >
< / tr >
< tr bordercolor = "#EAEAEA" bgcolor = "#EAEAEA" >
< td height = "19" class = "labels" >
< table width = "100%" border = "0" cellspacing = "0" cellpadding = "0" >
< tr >
< td width = "50%" >
< fieldset >
< legend class = "labels" > Reproduzir Identificaç ã o:< / legend >
< span class = "style5" >
< input name = "saycid" type = "radio" value = "yes" <? = ( $acao == 'edita' ) && ( $saycid == 'yes' ) ? "checked" : null ; ?> <? = ( $acao != 'edita' ) ? "checked" : null ; ?> />
Sim
< input name = "saycid" type = "radio" value = "no" <? = ( $acao == 'edita' ) && ( $saycid == 'no' ) ? "checked" : null ; ?> />
Nã o
< / span >
< / fieldset >
< / td >
< td width = "50%" >
< fieldset >
< legend class = "labels" > Enviar Anexo:< / legend >
< span class = "style5" >
< input name = "attach" type = "radio" value = "yes" <? = ( $acao == 'edita' ) && ( $attach == 'yes' ) ? "checked" : null ; ?> <? = ( $acao != 'edita' ) ? "checked" : null ; ?> />
Sim
< input name = "attach" type = "radio" value = "no" <? = ( $acao == 'edita' ) && ( $attach == 'no' ) ? "checked" : null ; ?> />
Nã o< / span >
< / fieldset >
< / td >
< / tr >
< / table >
< / td >
< / tr >
< tr bordercolor = "#EAEAEA" bgcolor = "#EAEAEA" >
< td height = "19" class = "labels" >
< div align = "right" >
< table width = "100%" border = "0" cellspacing = "0" cellpadding = "0" >
< tr >
< td width = "50%" >
< div align = "left" >
< fieldset >
< legend class = "labels" > Deletar apó s o envio:< / legend >
< span class = "style5" >
< input name = "delete" type = "radio" value = "yes" <? = ( $acao == 'edita' ) && ( $delete == 'yes' ) ? "checked" : null ; ?> <? = ( $acao != 'edita' ) ? "checked" : null ; ?> />
Sim
< input name = "delete" type = "radio" value = "no" <? = ( $acao == 'edita' ) && ( $delete == 'no' ) ? "checked" : null ; ?> />
Nã o
< / span >
< / fieldset >
< / div >
< / td >
< td width = "50%" >
< div align = "left" >
< fieldset >
< legend class = "labels" > Reproduzir Data e Hora:< / legend >
< span class = "style5" >
< input name = "envelope" type = "radio" value = "yes" <? = ( $acao == 'edita' ) && ( $envelope == 'yes' ) ? "checked" : null ; ?> <? = ( $acao != 'edita' ) ? "checked" : null ; ?> />
Sim
< input name = "envelope" type = "radio" value = "no" <? = ( $acao == 'edita' ) && ( $envelope == 'no' ) ? "checked" : null ; ?> />
Nã o
< / span >
< / fieldset >
< / div >
< / td >
< / tr >
< / table >
< / div >
< / td >
< / tr >
< tr bordercolor = "#EAEAEA" bgcolor = "#EAEAEA" >
< td height = "22" >
< div align = "center" >
< span class = "style1" > < / span >
< span class = "style1" > < / span >
< span class = "style1" > < / span >
< span class = "style1" >
< input name = "Submit2" type = "button" class = "labels" onclick = "fecha_popup();" value = "Fechar" >
< input name = "Submit" type = "submit" class = "labels" value = "Salvar" >
< / span >
< / div >
< / td >
< / tr >
< / table >
< / form >