Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Danbor Bordan

Redimensionar janela automaticamente

Recommended Posts

Pode ser em qualquer lugar msm

coloquei após <div id="loginbody"> no final do código conforme abaixo, mas a janela fica em branco, será que não tenho que mudar em nada o botão de abertura da janela?

 

 

<?php

//$callButtonImg = false;

$callButtonImg = 'click-to-call-small-b.png ';

//$clientImg = false;

$clientImg = 'http://www.uolinc.co...mages/click.png';

 

include("lib/customer.defines.php");

include("lib/customer.module.access.php");

include("lib/Class.RateEngine.php");

include("lib/customer.smarty.php");

include(dirname(__file__) . "/lib/phpagi/phpagi-asmanager.php");

getpost_ifset(array(

'callback',

'called',

'calling1',

'calling2',

));

 

$key = $_GET['key'];

if ($callback) {

$FG_DEBUG = 0;

$color_msg = 'red';

$DBHandle = DbConnect();

$id_table = new Table('cc_card', 'username, uipass, tariff');

$id_clause = "MD5(username) = '$key'";

$id_result = $id_table->Get_list($DBHandle, $id_clause, 0);

$_SESSION["pr_login"] = $id_result[0][0];

$_SESSION["pr_password"] = $id_result[0][1];

$_SESSION["tariff"] = $id_result[0][2];

$QUERY = "SELECT username, credit, lastname, firstname, address, city, state, country, zipcode, phone, email, fax, lastuse, activated, status FROM cc_card WHERE username = '" . $_SESSION["pr_login"] . "' AND uipass = '" . $_SESSION["pr_password"] . "'";

$DBHandle_max = DbConnect();

$numrow = 0;

$resmax = $DBHandle_max->Execute($QUERY);

if ($resmax)

$numrow = $resmax->RecordCount();

if ($numrow == 0)

exit();

$customer_info = $resmax->fetchRow();

if ($customer_info[14] != "1" && $customer_info[14] != "8") {

Header("HTTP/1.0 401 Unauthorized");

Header("Location: PP_error.php?c=accessdenied");

die();

}

$called = $_SESSION["pr_login"];

$calling = str_replace(array('(', ')', '-', '.', ' '), '', $_GET['calling1'] . $_GET['calling2']);

 

if (strlen($called) > 1 && strlen($calling) > 1 && is_numeric($called) && is_numeric($calling)) {

 

$calling = '' . $calling;

$A2B->DBHandle = DbConnect();

$instance_table = new Table();

$A2B->set_instance_table($instance_table);

$A2B->cardnumber = $_SESSION["pr_login"];

if ($A2B->callingcard_ivr_authenticate_light($error_msg)) {

$RateEngine = new RateEngine();

$RateEngine->webui = 0;

$A2B->agiconfig['accountcode'] = $_SESSION["pr_login"];

$A2B->agiconfig['use_dnid'] = 1;

$A2B->agiconfig['say_timetocall'] = 0;

$A2B->extension = $A2B->dnid = $A2B->destination = $called;

$resfindrate = $RateEngine->rate_engine_findrates($A2B, $called, $_SESSION["tariff"]);

if ($resfindrate != 0) {

$res_all_calcultimeout = $RateEngine->rate_engine_all_calcultimeout($A2B, $A2B->credit);

if ($res_all_calcultimeout) {

if ($RateEngine->ratecard_obj[0][34] != '-1') {

$usetrunk = 34;

$usetrunk_failover = 1;

$RateEngine->usedtrunk = $RateEngine->ratecard_obj[0][34];

} else {

$usetrunk = 29;

$RateEngine->usedtrunk = $RateEngine->ratecard_obj[0][29];

$usetrunk_failover = 0;

}

$prefix = $RateEngine->ratecard_obj[0][$usetrunk + 1];

$tech = $RateEngine->ratecard_obj[0][$usetrunk + 2];

$ipaddress = $RateEngine->ratecard_obj[0][$usetrunk + 3];

$removeprefix = $RateEngine->ratecard_obj[0][$usetrunk + 4];

$timeout = $RateEngine->ratecard_obj[0]['timeout'];

$failover_trunk = $RateEngine->ratecard_obj[0][40 + $usetrunk_failover];

$addparameter = $RateEngine->ratecard_obj[0][42 + $usetrunk_failover];

$destination = $called;

if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0)

$destination = substr($destination, strlen($removeprefix));

$pos_dialingnumber = strpos($ipaddress, '%dialingnumber%');

$ipaddress = str_replace("%cardnumber%", $A2B->cardnumber, $ipaddress);

$ipaddress = str_replace("%dialingnumber%", $prefix . $destination, $ipaddress);

$dialparams = '';

if ($pos_dialingnumber !== false) {

$dialstr = "$tech/$ipaddress" . $dialparams;

} else {

if ($A2B->agiconfig['switchdialcommand'] == 1) {

$dialstr = "$tech/$destination" . $dialparams;

} else {

$dialstr = "$tech/$destination" . $dialparams;

}

}

if (strlen($addparameter) > 0) {

$addparameter = str_replace("%cardnumber%", $A2B->cardnumber, $addparameter);

$addparameter = str_replace("%dialingnumber%", $prefix . $destination, $addparameter);

$dialstr .= $addparameter;

}

 

$num_attempt = 0;

if ($A2B->config['global']['ast_version'] == "1_11") {

$variable = "CALLED=$called,CALLING=$calling,CBID=$uniqueid,LEG=" . $A2B->cardnumber;

} else {

$variable = "CALLED=$called|CALLING=$calling|CBID=$uniqueid|LEG=" . $A2B->cardnumber;

}

$QUERY = " INSERT INTO cc_callback_spool (uniqueid, status, server_ip, num_attempt, channel, exten, context, priority," . " variable, id_server_group, callback_time, account, callerid, timeout ) " . " VALUES ('$uniqueid', '$status', '$server_ip', '$num_attempt', '$channel', '$exten', '$context', '$priority'," . " '$variable', '$id_server_group', now(), '$account', '$callerid', '100000')";

$res = $A2B->DBHandle->Execute($QUERY);

if (!$res) {

$error_msg = gettext("Cannot insert the request in the spool!") . "<br/> ({$_GET['calling1']}){$_GET['calling2']}";

$color_msg = 'orange';

} else {

$error_msg = gettext("Aguarde!<br/> Número discado: ({$_GET['calling1']}){$_GET['calling2']}");

$color_msg = 'green';

}

} else {

$error_msg = gettext("Erro : Você não ;ão!");

$color_msg = 'red';

}

} else {

$error_msg = gettext("Erro : Esta fala existe!") . "<br/> ({$_GET['calling1']}){$_GET['calling2']}";

$color_msg = 'red';

}

} else {

}

} else {

$error_msg = gettext("entre com os dados!");

}

$_SESSION["pr_login"] = '';

$_SESSION["pr_password"] = '';

$_SESSION["tariff"] = '';

}

;

 

echo '

 

<div id="loginbody">

 

 

 

function altera_window(div){

var content_largura = document.getElementById(div).offsetWidth;

var content_altura = document.getElementById(div).offsetHeight;

var janela_largura = window.innerWidth;

var janela_altura = window.innerHeight;

 

if (content_largura > janela_largura && content_altura > janela_altura) {

window.resizeTo(content_largura,content_altura);

};

}

 

<body onload="altera_window('loginbody')">

 

 

 

<form name="theForm" action=' . $PHP_SELF . ' method="GET" >

<table width="100" align="center" class="cal_maintable" style="border: 1px solid #ccc">

<tr>

<td colspan="2" style="text-align: center">

<img src="' . ($clientImg ? $clientImg : 'clicl2.png') . '" />

</td>

</tr>

';

if (isset($error_msg) && $error_msg !='') {

echo '

<tr class="bgcolor_001">

<td colspan="2" valign="bottom" style="font-family:Arial;font-size:1.3em; font-weight:bold; line-height: 1.5em;text-align:center; background-color: #efefef; padding: 10px 10px; color: ' . $color_msg . ';">

' . $error_msg . '

</td>

</tr>

';

}

echo '

<tr class="bgcolor_001">

<td align="right" valign="center">

<input type="hidden" name="callback" value="1">

<input class="form_input_text" name="calling1" style="text-align: center; width: 40px;" value="" maxlength="2" placeholder="DDD" >

<input class="form_input_text" name="calling2" value="" style="text-align: center; width: 100px;" maxlength="9">

<input id="pinHash" type="hidden" name="key" value="';

echo $key;

;

echo '"/>

<input type="hidden" name="callback2" value="1">

</td>

<td align="center" valign="middle">

';

 

if ($callButtonImg) :?>

<button type="submit" id="call2" name="call" style="background:none; border:none;"><img src="<?php echo $callButtonImg ?>" alt="Conectar" /></button>

<?php else : ?>

<input id="call2" type="submit" name="call" value="chamar"/></a>

<?php endif;

 

echo '

</td>

</tr>

<tr>

<td colspan="2" style="text-align: center">

<a href="http://www.uolinc.com" title="COM" target="_blank"><img src="http://www.uolinc.com/oz.png" alt="M" title="M" border="0"></a>

</td>

</tr>

</table>

</form>

 

';

$smarty->display('footer.tpl');

?>

Compartilhar este post


Link para o post
Compartilhar em outros sites

mas não tem essa tag <head> no código

Bota em qualquer lugar da pagina msm

 

Tá tudo sendo impresso com echo no php, provavelmente tá dando erro ali pq das aspas simples, coloque o codigo antes do <?php

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bota em qualquer lugar da pagina msm

 

Tá tudo sendo impresso com echo no php, provavelmente tá dando erro ali pq das aspas simples, coloque o codigo antes do <?php

coloquei tudo antes do <?php mas aí aparece na janela todo o código abaixo:

 

function altera_window(div){

var content_largura = document.getElementById(div).offsetWidth;

var content_altura = document.getElementById(div).offsetHeight;

var janela_largura = window.innerWidth;

var janela_altura = window.innerHeight;

 

if (content_largura > janela_largura && content_altura > janela_altura) {

window.resizeTo(content_largura,content_altura);

};

}

Compartilhar este post


Link para o post
Compartilhar em outros sites

É pq precisa tá dentro da tag Script

<script type="text/javascript">
function altera_window(div){
        var content_largura = document.getElementById(div).offsetWidth;
        var content_altura = document.getElementById(div).offsetHeight;
        var janela_largura = window.innerWidth;
        var janela_altura = window.innerHeight;

        if (content_largura > janela_largura && content_altura > janela_altura) {
         window.resizeTo(content_largura,content_altura);
        };
    }
</script>

Compartilhar este post


Link para o post
Compartilhar em outros sites

 

É pq precisa tá dentro da tag Script

<script type="text/javascript">
function altera_window(div){
        var content_largura = document.getElementById(div).offsetWidth;
        var content_altura = document.getElementById(div).offsetHeight;
        var janela_largura = window.innerWidth;
        var janela_altura = window.innerHeight;

        if (content_largura > janela_largura && content_altura > janela_altura) {
         window.resizeTo(content_largura,content_altura);
        };
    }
</script>

Fiz igual você desse acima mas a janela não redimensiona automaticamente, ou seja, ela não cresce para baixo o quanto precisa para mostrar a nova informação.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Fiz igual você desse acima mas a janela não redimensiona automaticamente, ou seja, ela não cresce para baixo o quanto precisa para mostrar a nova informação.

Bom, aqui funcionou, para te ajudar só tendo acesso mesmo aous teus arquivos e etc,enfim...

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.