/**
* @AUTHOR: Alexandre Correia / Rodrigo Souza
* @DATE: 2006/10/24 17:03:00
* @LAST CHANGE: Seg 11 Dez 2006 10:21:34 BRST::
* Instant Messenger
* im_templates.js
**/
function Templates(){
this.element = document.getElementById("im_expresso");
this.form = "";
this.time_set = "";
this.transfer = 0;
this.arquivo = "";
}
/*
* Conf forms
*/
Templates.prototype.conf_form = function(pName,pWidth,pHeight,pHTML,pTitle)
{
var params = new Array();
params['body'] = pHTML;
params['height'] = pHeight;
params['id'] = pName;
params['maximize'] = false;
params['minimize'] = false;
params['title'] = pTitle;
params['width'] = pWidth;
im_win.create_window(params);
}
/*
* Add Usuario
*/
Templates.prototype.add_user = function()
{
var _this = this;
var _td = "";
var form_add_user = "Selecione uma Organização .: " +
"Carregando ....."+
""+
"
"
_this.conf_form("divAddUser",520,270,form_add_user,":: " + IM.get_lang('Add New Contact') + " - Expresso ::");
}
/*
* Del Usuario
*/
Templates.prototype.remove_user = function()
{
var _this = this;
var form_del_user = ""+
"
"+IM.get_lang('Contact')+" .: "+
"
"+
"
"+
"
";
_this.conf_form("divDelUser",400,110,form_del_user,":: " + IM.get_lang('Remove Contact') + " - Expresso ::");
}
/*
* Update Usuario
*/
Templates.prototype.update_user = function()
{
var _this = this;
var form_update_user = "";
_this.conf_form("divUpdateUser",300,110,form_update_user,":: Adicionar Contato - Expresso ::");
}
Templates.prototype.Users_Not_Auth = function ()
{
var count = 0;
var _this = this;
var auth_user = "";
if(!IM.array_prefe['ch_contacts'])
{
auth_user = '' +
' Contato | Detalhes | Aceitar S/N |
';
for(var i=0 ; i < IM.array_users.length; i++){
if(IM.array_users[i].group == 'sem_grupo'){
auth_user += ''+
'' + decodeURI(IM.array_users[i].name).substr(0,decodeURI(IM.array_users[i].name).indexOf('@')) + ' | '+
' ? | '+
' Sim / Não | '+
'
';
count++;
}
}
auth_user += '
';
if( count > 0 ){
var form_auth_user = '' +
''+
'
O(s) contato(s) abaixo aguarda(m) sua autorização.' +
'Para adicionar este(s) novo(s) contato(s), basta dar um ' +
'clique em cima do contato.' +
'Contato(s) :' +
'' +
'
';
form_auth_user += auth_user + '
';
_this.conf_form("divFormAuthUser",360,250,form_auth_user, ":: Contatos sem Cadastro - Expresso ::");
}
}
}
/*
* Vcard Usuario
*/
Templates.prototype.information_user = function()
{
var _this = this;
var form_info_user = ""+
"";
_this.conf_form("divInfoUser",400,220,form_info_user, ":: " + IM.get_lang('Information User') + " - Expresso ::");
}
Templates.prototype.information_Contact = function()
{
var _this = this;
var form_info_contact = ''+
''+IM.get_lang('Full Name')+' .: | |
'+
''+IM.get_lang('NickName')+' .: | |
'+
''+IM.get_lang('Orgunit')+' .: | |
'+
''+IM.get_lang('Role')+' .: | |
'+
''+IM.get_lang('Birthday')+' .: | |
'+
'';
_this.conf_form("divInfoContact",430,130,form_info_contact,":: Informações do Contato - Expresso ::");
}
Templates.prototype.emotions = function()
{
grid = '';
grid += '';
grid += ' ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += '
';
grid += ' ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += '
';
grid += ' ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += ' | ';
grid += '
';
grid += ' ';
grid += ' | ';
grid += '
';
grid += ' ';
grid += '
';
grid += ' Close This Menu | ';
grid += ' ';
grid += '
';
return grid;
}
Templates.prototype.font_name = function()
{
grid = '';
grid += '';
grid += '';
grid += '';
grid += '';
grid += '';
return grid;
}
Templates.prototype.font_size = function()
{
grid = '';
grid += '';
grid += '';
grid += '';
grid += '';
grid += '';
grid += '';
grid += '';
grid += '';
grid += '';
return grid;
}
Templates.prototype.font_color = function()
{
grid = '';
grid += '';
grid += '';
grid += '';
grid += '';
grid += '';
grid += '';
grid += '';
grid += '';
grid += '';
grid += '';
return grid;
}
Templates.prototype.font_style = function()
{
grid = '';
grid += '';
grid += '';
grid += '';
grid += '';
grid += '';
return grid;
}
/*
* Send File
*/
Templates.prototype.Send_file = function(pJid)
{
var _this = this;
var form_send_file = ''+
''+
'.: Enviar Arquivo :.
'+
'
'+
'' +
'
.: Status da Transferência :.'+
'
'+
'
';
_this.conf_form("divSendFile",360,110,form_send_file,":: Envio de Arquivo - Expresso ::");
}
Templates.prototype.Wait_file = function(pJid)
{
if(document.getElementById("send_file_im").value != ""){
document.getElementById("div_send_file_im").style.display = "none";
document.getElementById("status_upload").style.display = "block";
this.UpdateStatusSendFile(pJid);
}else{
alert("É necessário informar um arquivo para envio!");
}
}
Templates.prototype.UpdateStatusSendFile = function(pJid)
{
var _this = this;
this.time_set = setTimeout("Templates.Wait_file('" + pJid + "')",80);
if(this.transfer == 100){
clearTimeout(this.time_set);
document.getElementById("div_send_file_im").style.display = "block";
document.getElementById("status_upload").style.display = "none";
document.getElementById("send_file_im").value = "";
this.transfer = 0;
this.time_set = "";
// Envia a Mensagem para a baixa do arquivo;
var h_name_file = function(data){
//var pJID = "alexandrecorreia@im.pr.gov.br";
var pJID = pJid;
var message_conf = ''+
'VOCÊ ACABA DE RECEBER UM ARQUIVO !!!! '+
'Clique aqui';
var Conf_send_file = function(data){
if(!data)
alert(data);
}
cIM.cExecute("$this.Ujabber.SendMessage",Conf_send_file,"to="+pJID+"&body="+url_encode(encodeURI(message_conf)));
}
cIM.cExecute("$this.upload.name_file",h_name_file);
}else{
var h_size_file = function(data){
_this.transfer++;
document.getElementById("progressbar_f").style.width = _this.transfer + "%";
document.getElementById("porcent_im").innerHTML = _this.transfer + "%";
}
cIM.cExecute("$this.upload.size_file",h_size_file);
}
}
/*
* Preferências do usuário
*/
Templates.prototype.yourPreferences = function()
{
var form_your_prefe = '' +
'' +
'
'+
''+
''+
'* É necessário salvar as opções *'+
''+
''+
'
';
this.conf_form("divYourPrefe",345,230,form_your_prefe,":: " + IM.get_lang('Preferences') + " - Expresso ::");
}
//Templates
var Templates = new Templates();