How can I change the size of the bindPopup since when opening the web from a mobile phone it is very large, in the image that shows a lot of space is left below, is there any way to reduce that size?
search the internet but there are no results almost everything is from the bookmarks
This is part of the code I use to display this information:
const updateMap = () => {
const Buslocation =
"https:xxxxxxxxxxxxx" + gtebi;
fetch(Buslocation)
.then((res) => res.json())
.then((data) => {
//si existe el marcador removerlo para no tener marcadores duplicados
if (bus_marker) {
map.removeLayer(bus_marker);
}
//asignar valores que se usaran ingresar el marcador
const latitud = data.latitud;
const longitud = data.longitud;
//asignar valores que se usaran mas adelate para definir el popup
const destino = data.destino;
const origen = data.origen;
const patente = data.patente;
//animacion para dirigirse al punto donde se encuentra el bus
map.flyTo([latitud, longitud], 12);
//crear marcador
bus_marker = L.marker([latitud, longitud], {
icon: busicon,
})
.addTo(map)
.bindPopup(
"<strong><h3>El bus esta aquí</h3></strong>" +
"<h5>Origen: " +
"<strong>" +
origen +
"</strong>" +
"</h5>" +
"<h5>Destino: " +
"<strong>" +
destino +
"</strong>" +
"</h5>" +
"<h5>Patente: " +
"<strong>" +
patente +
"</strong>" +
"</h5>"
)
.update();
});
//definir el tiempo de actualizacion del marcador(bus)
setTimeout(updateMap, 180000);
};
I searched the internet but I only get options for the map markers.
or if I can remove the bindPopup somehow, because if I don't use it, the white bar is left next to it.
I am doing an API call and data fetching with Fetch function on a platform listing different products with their data identified by attributes, here I am trying to fetch multiple attributes of a specific category of product, each product is identified by a unique serial number, which serves as my entry key to retrieve product data.
Or the attributes that I retrieve do not exist for certain products, either the field exists but the data is null, or the field is not filled in on the platform for this product.
I neutralize nulls with the formula you can see on my script but it doesn't always work, I would like to know if I can make my API even more dynamic, i.e. retrieve attributes only when they exist and when the presence of a null does not block the API call.
function GetAllProduct() {
var token=ConnectAlkemics();
//Logger.log(token);
var headers ={
"accept": "*/*",
"accept-language": "fr",
'Authorization' : 'Bearer ' + token,
'cache-control': 'no-cache',
'content-type': 'application/json;charset=UTF-8',
'expires': '-1',
'pragma': 'no-cache',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'x-alk-priority': '9'
};
var options ={
'method' : "GET",
"headers" : headers
};
var source =SpreadsheetApp.getActive().getSheetByName("GTIN");
var ss =SpreadsheetApp.getActive().getSheetByName("RESULTATS");
ss.clear();
// var dico=CreerDicoHeader();
//retrieving list of attribute
var lastRow = source.getLastRow();
var listeAttribut = "";
var listeChamp = "";
var tabChamp = [];
var index = 0;
for(var i = 2; i <= lastRow; i++ ){
//Logger.log(i);
if(source.getRange(i, 3).getValue() != ""){
tabChamp[index] = source.getRange(i, 2).getValue();
index +=1;
if(listeAttribut == ""){
listeAttribut = source.getRange(i, 3).getValue();
listeChamp = source.getRange(i, 2).getValue();
}
else{
listeAttribut = listeAttribut + "," + source.getRange(i, 3).getValue();
listeChamp = listeChamp + "," + source.getRange(i, 2).getValue();}
}
}
var total=0;
var debut=2;
var moregtin=true
var lignegtin=1;
var colonnes=[
"GTIN",
"Libelle long",
"Fournisseur",
"Catégorie du produit",
"Code Tiers",
"Cycle de vie",
"Maturité commande Galec",
"Maturité direct magasin" ,
"Maturité Commande SCABEL",
"Maturité complémentaire Galec",
"Maturité complémentaire Direct Magasin",
"Maturité complémentaire Scabel",
"Maturité Animation Digitale",
"Maturité Digitale",
"Maturité Entité Leclerc",
"Type d'unité",
"Marque Commerciale",
"Appellation viticole ou région d'origine",
"Complément d'appellation(N)",
"Packaging vin",
"Contenu net",
"Description des saveurs du vin",
"Type de champagne(N)",
"Viticulture(N)",
"Couleur du Vin",
"Millésime",
"Terroirs et sol(N)",
"Région Viticole",
"Durée du potentiel de maturation",
"Echelle de fruit",
"Echelle de personnalité",
"Dégustation robe",
"Dégustation nez",
"Type de vendange(N)",
"Dégustation bouche",
"Type d'appellation du vin",
"Allergènes avérés",
"Type d'allergène",
"Degré d'alcool",
"Teneur en sucre",
"Description du cépage",
"Accords mets et vins",
"Occasions particulières",
"Températures de dégustation (en °c)",
"Potentiel de garde",
"Code de nomenclature douanière",
"Code produit accise france",
"Libellé fiscal",
"Pays d'origine",
"Type de paiement des droits d'alcools",
"Image Face du produit",
"Image Arrière du produit",
];
var colonnematurite=6; //Colonnes
for(i=0;i<colonnes.length;i++) {
ss.getRange(1,i+1).setValue(colonnes[i]);
}
//for(i=0; i<tabChamp.length; i++){
// ss.getRange(1,i+1).setValue(tabChamp[i]);
//Logger.log(tabChamp[i]);
//}
while (moregtin==true)
{
var fini=false;
var nbgtin=0;
var lesgtin="";
var produits =[];
while ((source.getRange(lignegtin,1).getValue()!="") && (nbgtin<50)) //paquets de 50 GTINs
{
if (lesgtin!="")
lesgtin=lesgtin+",";
lesgtin=lesgtin+source.getRange(lignegtin,1).getValue().toString().replace(/\s+/g," ").trim();
lignegtin=lignegtin+1;
nbgtin=nbgtin+1;
}
if (lesgtin=="")
{
moregtin=false;
fini=true;
}
else
{
var limit=200;
var next_page='';
var lastparam='';
var params =lastparam + 'status_shared_from=4' + lesgtin + '&filter_source_include=uuid,gtin,namePublicLong,namePublicShort,isSharedFrom.sourceOrganization.nameLegal,endAvailabilityDateTime,supplierId,business_processes,brand.description,lastOrderDateTime,isUserLabeledByName,lifeCycle,typePackaging,isConsumerUnit,isBaseUnit,isDisplayUnit,assets,pictures,exportables'
var params =lastparam + '&filter_product_languages=fr&filter_gtins_in=' + lesgtin + '&filter_source_include=' + listeAttribut
var lesparams =params + '&limit=' + limit + '&next_page=' + next_page + '&ts=' + Math.floor((Math.random() * 10000000) + 1);
}
while (fini==false) {
var lesparams =params + '&limit=' + limit + '&next_page=' + next_page + '&ts=' + Math.floor((Math.random() * 10000000) + 1);
var url='https://apis.alkemics.com/public/v1/products?'+lesparams;
//Logger.log(url);
var content =UrlFetchApp.fetch(url, options);
//Logger.log(content);
//Logger.log(content.getResponseCode())
if (content.getResponseCode() ==200) {
var retour =JSON.parse(content.getContentText());
next_page=retour.next_page;
var data=retour.data;
for(i=0; i<data.length;i++) {
var produit=data[i]; // Un produit au format JSON
var libellelong="";
try
{
libellelong=produit.namePublicLong[0].data;
}
catch(e) {
libellelong="";
//libelle="NA"
}
var libellecourt="";
try
{
libellecourt=produit.namePublicShort[0].data;
}
catch(e) {
libellecourt="";
//libelle="NA"
}
var maturite={}
for(k=0;k<produit.business_processes.length;k++)
{
maturite[produit.business_processes[k].label]=(produit.business_processes[k].requested==false?"":(produit.business_processes[k].status==true?"OK":"KO"));
}
var listematurite={}
for(k=0;k<produit.business_processes.length;k++)
{
listematurite[k]=produit.business_processes[k].label;
}
var marque=""
if ("brand" in produit) {
if ("description" in produit.brand)
marque=produit.brand.description;
}
var occasionwhine=""
if (" occasions" in produit) {
if("occasion" in produit.occasions[0])
occasionwhine = produit.occasions[0].occasion.label
}
var pairing=""
if (" pairingsTypes" in produit) {
if("pairingsType" in produit.pairingsTypes[0])
pairing = produit.pairingsTypes[0].pairingsType.label
}
var mediaface= ""
if (" assets" in produit) {
if("pictures" in produit.assets)
if("exportables" in produit.assets.pictures[0])
mediaface= produit.assets.pictures[0].exportables[0].uniformResourceIdentifier
}
var mediaback
if (" assets" in produit) {
if("pictures" in produit.assets)
if("exportables" in produit.assets.pictures[2])
mediaback= produit.assets.pictures[2].exportables[0].uniformResourceIdentifier
}
//var ConsumerUnit = (produit.isConsumerUnit == false ?"":(produit.isBaseUnit==true?"UC":"LOT"))
//var Presentoir = (produit.isDisplayUnit == true ? produit.typePackaging.label : "")
var ligne=[
produit.gtin,
libellelong,
produit.isSharedFrom[0].sourceOrganization.nameLegal,
produit.kind != null? produit.kind.label: ' ',
produit.supplierId,
produit.lifeCycle,
//(produit.endAvailabilityDateTime==null?"":TIMESTAMP_TO_DATE(produit.endAvailabilityDateTime)),
//produit.isUserLabeledByName,
maturite[tabChamp[colonnematurite]],
maturite[tabChamp[colonnematurite+1]],
maturite[tabChamp[colonnematurite+2]],
maturite[tabChamp[colonnematurite+3]],
maturite[tabChamp[colonnematurite+4]],
maturite[tabChamp[colonnematurite+5]],
maturite[tabChamp[colonnematurite+6]],
maturite[tabChamp[colonnematurite+7]],
maturite[tabChamp[colonnematurite+8]],
produit.typePackaging.label,
marque,
produit['alcoholicBeverageSubregionText'],
produit['alcoholicBeverageAdditionalAppellationDetailsText'],
produit.leclercWinePackagingTypeCode != null? produit.leclercWinePackagingTypeCode.label : ' ',
produit.netWeight[0] != null? produit.netWeight[0].data: ' ',
produit.wineTastingDescriptionList[0] != null?
produit.wineTastingDescriptionList[0].wineTastingCode.label : ' ',
produit.wineCategoryCode != null? produit.wineCategoryCode.label: ' ',
produit.vintnerTextList,
produit.colorGroup != null? produit.colorGroup.label: ' ',
produit.vintage,
produit.vineyardRegion != null? produit.vineyardRegion.label: ' ',
produit.leclercFrenchVineyardRegionCode != null? produit.leclercFrenchVineyardRegionCode.label: ' ',
produit.wineAgeingPotentialDurationCode != null? produit.wineAgeingPotentialDurationCode.label: ' ',
produit.wineFruitExpressionNoteNumber,
produit.wineAromasExpressionNoteNumber,
produit.wineTastingRobeDescriptionText[0] != null? produit.wineTastingRobeDescriptionText[0].data: ' ',
produit.wineTastingNoseDescriptionText[0] != null? produit.wineTastingNoseDescriptionText[0].data: ' ',
produit['grapeHarvestingDescriptionText'].data,
produit.wineTastingMouthDescriptionText[0] != null? produit.wineTastingMouthDescriptionText[0].data:' ',
produit.wineCategoryCode != null? produit.wineCategoryCode.label: ' ',
produit.allergens[0] != null? produit.allergens[0].data : ' ',
produit.allergenTypeList,
produit.ratioAlcohol,
produit.sugarContent != null? produit.sugarContent.label: ' ',
produit.varietalDesignationDescriptionText[0] != null? produit.varietalDesignationDescriptionText[0].data:' ',
pairing,
//produit.pairingsTypes[0] != null? produit.pairingsTypes[0].pairingsType.label: ' ',
occasionwhine,
//produit.occasions[0].occasion != null? produit.occasions[0].occasion.label: ' ' , //+ "," + produit.occasions[1],
produit.tempConsumption[0] != null? produit.tempConsumption[0].data: ' ',
produit.wineAgeingPotentialDurationCode != null? produit.wineAgeingPotentialDurationCode.label : ' ',
produit.importEuropeanClassification,
produit.cpaFranceCode.label,
produit.taxLabelList[0] != null? produit.taxLabelList[0].taxLabelCode.label: ' ',
produit.countryOfOriginList[0] != null? produit.countryOfOriginList[0].countryOfOriginCode.label: ' ',
produit.alcoholicBeveragePaymentTypeCode != null? produit.alcoholicBeveragePaymentTypeCode.label: ' ',
mediaface,
mediaback,
//produit.assets.pictures[0].exportables[0] != null? produit.assets.pictures[0].exportables[0].uniformResourceIdentifier: ' ',
// produit.assets.pictures[2].exportables[0] != null? produit.assets.pictures[2].exportables[0].uniformResourceIdentifier: ' ',
//ConsumerUnit,
//Presentoir
];
produits.push(ligne);
total=total+1;
}
}
else {
Logger.log('Error in GET /contents/{contentid}')
}
I have a loop running for each selected checkbox in Javascript / Jquery.
Inside this loop I call an async function that will return a Tile Layer(Image).
I have to pass to this function a parameter called checkboxPermanent.
After this function is called the variable checkboxPermanent changes its value, not sure why.
In the sequence it calls a similiar function but now passing the same variable but with the wrong parameter value.
$('#exec-perm').on('click', function () {
var checkboxPermanent;
$('#checks-perm input').each(async function () {
checkboxPermanent = $(this).attr('value');
isChecked = $(this).prop('checked');
permanent = permanent_layers[checkboxPermanent] // começa com valor undefined, no próximo loop passa a conter um objeto para que possa cair na codição 1
pixel_permanent = pixel_permanent_layers[checkboxPermanent]
if (permanent) {
if (!isChecked) {
map.removeLayer(permanent)
map.removeLayer(pixel_permanent)
ctrlLayers.removeLayer(permanent)
ctrlLayers.removeLayer(pixel_permanent)
} else if (isChecked && state_faz == faz_value && state_ano_safra == ano_safra_value && state_profundidade == profundidade_value) {
//map.addLayer(permanent)
//map.addLayer(pixel_permanent)
map.removeLayer(permanent)
map.removeLayer(pixel_permanent)
ctrlLayers.removeLayer(permanent)
ctrlLayers.removeLayer(pixel_permanent)
ctrlLayers.addOverlay(permanent, 'Mapa de ' + checkboxPermanent);
ctrlLayers.addOverlay(pixel_permanent, 'Mapa de ' + checkboxPermanent + ' - Pixels');
} else if (isChecked && (state_faz != faz_value || state_ano_safra != ano_safra_value || state_profundidade != profundidade_value)) {
map.removeLayer(permanent)
map.removeLayer(pixel_permanent)
ctrlLayers.removeLayer(permanent)
ctrlLayers.removeLayer(pixel_permanent)
permanent = wmsPermRasterCall(checkboxPermanent, faz_value, profundidade_value);
pixel_permanent = wmsPixelPermCall(checkboxPermanent, faz_value, profundidade_value);
permanent_layers[checkboxPermanent] = permanent; // armazena o valor no array para que possa cair na condicional que irá excluir os layers do control
pixel_permanent_layers[checkboxPermanent] = pixel_permanent;
//map.addLayer(permanent);
//map.addLayer(pixel_permanent);
ctrlLayers.addOverlay(permanent, 'Mapa de ' + checkboxPermanent);
ctrlLayers.addOverlay(pixel_permanent, 'Mapa de ' + checkboxPermanent + ' - Pixels');
}
} else if (isChecked) {
console.log(checkboxPermanent)
permanent = wmsPermRasterCall(checkboxPermanent, faz_value, profundidade_value);
console.log(permanent)
pixel_permanent = wmsPixelPermCall(checkboxPermanent, faz_value, profundidade_value);
//console.log(checkboxPermanent)
permanent_layers[checkboxPermanent] = permanent; // armazena o valor no array para que possa cair na condicional que irá excluir os layers do control
pixel_permanent_layers[checkboxPermanent] = pixel_permanent;
//map.addLayer(permanent);
//map.addLayer(pixel_permanent);
ctrlLayers.addOverlay(permanent, 'Mapa de ' + checkboxPermanent);
ctrlLayers.addOverlay(pixel_permanent, 'Mapa de ' + checkboxPermanent + ' - Pixels');
}
if (checkboxPermanent == 'altimetria') {
leg_permanent[checkboxPermanent] = 'Emp:' + checkboxPermanent + '_' + faz_value
leg_pixel_permanent[checkboxPermanent] = 'Emp:mv_' + checkboxPermanent + '_sql'
} else {
leg_permanent[checkboxPermanent] = 'Emp:' + checkboxPermanent + '_' + faz_value + '_p' + profundidade_value
leg_pixel_permanent[checkboxPermanent] = 'Emp:mv_' + checkboxPermanent + '_sql'
}
});
})
If I console.log(checkboxPermanent) before wmswmsPermRasterCall(). It will return the right value. If I console.log(checkboxPermanent) right after wmswmsPermRasterCall() is called it gets a different value..
async function wmsPermRasterCall(checkboxPermanent, faz_value, profundidade_value) {
//var colorRampSLD = getStyles(faz_value, checkboxPermanent)
if (checkboxPermanent == 'altimetria') {
var raster_name = checkboxPermanent + '_' + faz_value
getColors = await getStyles(faz_value, checkboxPermanent)
var colorEnv = '';
for (var j = 0; j < getColors.length; j++) {
if (j + 1 >= getColors.length) {
colorEnv += 'c' + j + ':' + getColors[j]
} else {
colorEnv += 'c' + j + ':' + getColors[j] + ';'
}
}
return L.tileLayer.wms('http://localhost:8080/geoserver/Emp/wms', {
layers: 'Emp:' + raster_name,
transparent: true,
format: 'image/png',
}).setParams({
env: colorEnv
})
} else {
return L.tileLayer.wms('http://localhost:8080/geoserver/Emp/wms', {
layers: 'Emp:' + checkboxPermanent + '_' + faz_value + '_p' + profundidade_value,
transparent: true,
format: 'image/png',
})
}
}
What Am I missing here?
Check here:
console.log(checkboxPermanent)
permanent = wmsPermRasterCall(checkboxPermanent, faz_value, profundidade_value);
console.log(permanent)
This function is async, it will run outside of your function, your code will continue before wmsPermRasterCall is finished.
You need to wait for the result of wmsPermRasterCall using await:
console.log(checkboxPermanent)
permanent = await wmsPermRasterCall(checkboxPermanent, faz_value, profundidade_value);
console.log(permanent)
Your code will halt until wmsPermRasterCall is finished.
I am working with MVC and I am creating a dynamic table as data from # Html.TextBoxFor is added that I have in my view, and all good so far
My question is: Any way to save my table that I create with a JS function?
Searching the web I found some examples but so far nothing works for me
My Table
<table id="mytable" class="table table-bordered table-hover ">
<tr bgcolor="#90A8D0">
<th>Proyecto</th>
<th>Cuenta</th>
<th>Sub Cuenta</th>
<th>Beneficiario</th>
<th>Tipo de Pago</th>
<th>Pago en el proyecto</th>
<th>Pago Por México</th>
<th>Tarjeta Usuario</th>
<th>Total de Remesa</th>
<th>Obersvaciones</th>
<th>Eliminar</th>
</tr>
</table>
So I create my dynamic table:
$(document).ready(function() {
$('#adicionar').click(function () {
debugger;
var Proyecto = $("#ProyectoID option:selected").text();
var Recurso = $("#RecursoID option:selected").text();
var SubRecurso = $("#SubRecursoID option:selected").text();
var Beneficiario = document.getElementById("Beneficiario").value;
var TipoPago = $("#TipoPagoID option:selected").text();
var PagoProyecto = document.getElementById("PagoProyecto").value;
var PagoMexico = document.getElementById("PagoMexico").value;
var TarjetaUsuario = document.getElementById("TarjetaUsuario").value;
var TotalRemesa = parseInt(PagoProyecto) + parseInt(PagoMexico) + parseInt(TarjetaUsuario);
var ObervacionesCuenta = document.getElementById("ObervacionesCuenta").value;
var i = 1; //contador para asignar id al boton que borrara la fila
var fila = '<tr id="row' + i + '"><td>' + Proyecto + '</td><td>' + Recurso + '</td><td>' + SubRecurso + '</td><td>' + Beneficiario + '</td><td>' + TipoPago + '</td><td>' + PagoProyecto + '</td><td>' + PagoMexico + '</td><td>' + TarjetaUsuario + '</td><td>' + TotalRemesa + '</td><td>' + ObervacionesCuenta + '</td><td><button type="button" name="remove" id="' + i + '" class="btn btn-danger btn_remove">Quitar</button></td></tr>'; //esto seria lo que contendria la fila
i++;
$('#mytable tr:first').after(fila);
$("#adicionados").text(""); //esta instruccion limpia el div adicioandos para que no se vayan acumulando
var nFilas = $("#mytable tr").length;
$("#adicionados").append(nFilas - 1);
//le resto 1 para no contar la fila del header
document.getElementById("Recurso").value ="";
document.getElementById("SubRecurso").value = "";
document.getElementById("Proyecto").value = "";
document.getElementById("Proyecto").focus();
});
$(document).on('click', '.btn_remove', function () {
var button_id = $(this).attr("id");
//cuando da click obtenemos el id del boton
$('#row' + button_id + '').remove(); //borra la fila
//limpia el para que vuelva a contar las filas de la tabla
$("#adicionados").text("");
var nFilas = $("#mytable tr").length;
$("#adicionados").append(nFilas - 1);
});
});
This is an example I found on the web:
$(function () {
debugger;
$('#mytable').each(function () {
var cuotaNo= $(this).find('td').eq(0).html();
var interes = $(this).find('td').eq(1).html();
var abonoCapital = $(this).find('td').eq(2).html();
var valorCuota = $(this).find('td').eq(3).html();
var saldoCapital = $(this).find('td').eq(4).html();
$.ajax({
async: false,
type: "POST",
url: "../Guardardatos",
data:"cuotaNo="+cuotaNo+"&interes="+interes+"&abonoCapital="+abonoCapital+"&valorCuota="+valorCuota+"&saldoCapital="+saldoCapital,
data: {valores:valores},
success: function(data) { if(data!="");}
});
});
});
As this last example is what I am trying to save the data that is created in my table
In this example, create TableView, TableRowView, and TableCellView classes. Each class returns an object with an element property and render* method. TableView.element uses the table provided in your example. TableRowView.element and TableCellView.element both create new elements.
After the data from the form (not shown in your example) is POSTED and the success callback is executed: first, create a new instance of TableView; second, create a new instance of TableRowView; third, create new instances of TableCellView for each data property, then render the property value inside of it.
To ensure that the correct order of data elements is rendered, use columnOrder to define the table cell names, the iterate over them in the onSuccess callback. Each iteration, use the column name to access the corresponding data property.
const columnOrder = [
'proyecto',
'cuenta',
'subCuenta',
'beneficiario',
'tipoPago',
'pagoProyecto',
'pagoMexico',
'tarjetaUsuario',
'totalRemesa',
'obersvaciones',
'elminar',
]
const TableView = () => {
let table = document.getElementByID('myTable')
return {
element: table,
renderTableRow: (element) => {
this.element.appendChild(element)
return this
}
}
}
const TableRowView = () => {
let tr = document.createElement('tr')
return {
element: tr,
renderTableCell: (element) => {
this.element.appendChild(element)
return this
},
}
}
const TableCellView = () => {
let td = document.createElement('tr')
return {
element: td,
render: (value) => {
this.element.innerHTML = value
return this
},
}
}
const onSuccess = (event) => {
let data = event.data
/*
data
-----
{
'proyecto': ??,
'cuenta': ??,
'subCuenta': ??,
'beneficiario': ??,
'tipoPago': ??,
'pagoProyecto': ??,
'pagoMexico': ??,
'tarjetaUsuario': ??,
'totalRemesa': ??,
'obersvaciones': ??,
'elminar': ??,
}
*/
let table = new TableView()
let row = new TableRow()
columnOrder.forEach((columnName) => {
let cell = new TableCellView()
let cellData = data[columnName]
cell.render(cellData)
row.renderTableCell(cell.element)
table.renderTableRow(row.element)
})
}
$.ajax({
...,
success: onSuccess,
})
Good morning everyone,
I have a system which needs send a e-mail with some variables that I have in my JS. The code, at begin, looks fine to me, but the Request.QueryString returns me nothing. I am trying to receive data from the URL with Request.Url.ToString() and that show me all the url sended by the JS, which means the JS is sending, but the Request.QueryString can´t read the values.
Can someone please help me with this?
Below I show the code.
<script type="text/javascript">
var nomeCarinha;
$(document).on("click", "[id*=lnkView]", function () {
$("#nome").html($(this).closest("tr").find("td.sDisplayName").text());
$("#Product").html($(this).closest("tr").find(".Produto").text());
$("#IP").html($(this).closest("tr").find("td.sNetworkAddress").text());
$("#DC").html($(this).closest("tr").find("td.dc").text());
$("#comentario").html($(this).closest("tr").find("td.sComment").text());
$("#inicio").html($(this).closest("tr").find("td.inicio").text());
$("#mensagem").html($(this).closest("tr").find(".mensagem").text());
$("#monitor").html($(this).closest("tr").find("td.sMonitorTypeName").text());
$("#dialog").dialog({
width: 1000,
title: "Detalhes para TP",
buttons: {
Email: function (nome) {
var width = 150;
var height = 250;
var left = 99;
var top = 99;
var nome = $(this).find("#nome").text();
var produto = $(this).find("#product").text();
var ip = $(this).find("#IP").text();
var dc = $(this).find("#DC").text();
var comentario = $(this).find("#comentario").text();
var inicio = $(this).find("#inicio").text();
var mensagem = $(this).find("#mensagem").text();
var monitor = $(this).find("#monitor").text();
var janeleira = window.open("outlookPrimeiro.aspx?nomeDevice="+nome+"&nomeIp"+ip+"&nomeDc="+dc+"&nomeComentario="+comentario+"&nomeInicio="+inicio+"&nomeMonitor="+monitor, 'janela', 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left + ', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no, setTimeout=1000');
// Rescrever no outlookprimeiro.aspx para tirar os + no lugar de espaço da URL
},
Ok: function () {
$(this).dialog('close');
}
},
modal: true
});
return false;
});
function blinker() {
$('.blink').fadeOut(500);
$('.blink').fadeIn(500);
}
setInterval(blinker, 1000); //Runs every second
And the receive:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
//NECESSÁRIO PARA USAR MARSHALL
using System.Runtime.InteropServices;
//NECESSARIO PARA USAR O OUTLOOK
using aqueleLance = Microsoft.Office.Interop.Outlook;
using OutlookApp = Microsoft.Office.Interop.Outlook.Application;
using testeUsingPrimeiro = Microsoft.Office.Interop.Outlook._AutoFormatRule;
using testeUsingSegundo = Microsoft.Office.Interop.Outlook._AutoFormatRules;
using testeUsingTerceiro = Microsoft.Office.Interop.Outlook.AutoFormatRule;
using testeUsingQuarto = Microsoft.Office.Interop.Outlook.AutoFormatRules;
public partial class outlookPrimeiro : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String nomeDevice = Request.Url.ToString();
//String nomeProduto = "TESTE";
String nomeIp = Request.QueryString["ip"];
String nomeDc = Request.QueryString["dc"];
String nomeComentario = Request.QueryString["comentario"];
String nomeInicio = Request.QueryString["inicio"];
String nomeMonitor = Request.QueryString["monitor"];
//DEFINICICOES DE DADOS DO E-MAIL A SER ENVIADO
String paraEmail = "noc#email.com.br";
String copiaEmail = "mateus#email.com.br";
//String copiaOculta = "";
String assuntoEmail = "Usando Outlook 2013
String corpo = "<html><body><div style='width:95%;text-align: center;background-color: black'><table style='width: 100%;text-align: center'><tr style='background-color:#5B2E90'><td style='color: white'>Prioridade</td><td style='color: white'>Acionamento</td><td style='color: white'>KBN</td><td style='color: white'>Device</td><td style='color: white'>IP</td><td style='color: white'>DC</td><td style='color: white'>WUG</td><td style='color: white'>Diretorio</td><td style='color: white'>Monitor</td><td style='color: white'>Comentario</td><td style='color: white'>Tempo Down</td><td style='color: white'>Inicio</td><td style='color: white'>TP</td></tr><tr><td style='color: orange'>Prioridade</td><td style='color: orange'>Acionamento</td><td style='color: orange'>KBN</td><td style='color: orange'>" + nomeDevice + "</td><td style='color: orange'>" + nomeIp + "</td><td style='color: orange'>" + nomeDc + "</td><td style='color: orange'>WUG</td><td style='color: orange'>Diretorio</td><td style='color: orange'>" + nomeMonitor + "</td><td style='color: orange'>COMENTARIO</td><td style='color: orange'>Tempo Down</td><td style='color: orange'>" + nomeInicio + "</td><td style='color: orange'>TP</td></tr></table></div></body></html>";
//CRIA NOVO APP USANDO Microsoft.Office.Interop.Outlook.Application
OutlookApp appDoOutlook = new OutlookApp();
//CRIA E-MAIL
aqueleLance.MailItem itemDoMail = appDoOutlook.CreateItem(aqueleLance.OlItemType.olMailItem) as aqueleLance.MailItem;
//QUAL CONTA VAI ENVIAR? NECESSÁRIO TER A CONTA NA MÁQUINA
string nomeDaConta = "noc#linx.com.br";
//CRIA SESSÃO
aqueleLance.NameSpace sessao = itemDoMail.Session;
//PEGA CONTAS PRESENTES NA MÁQUINA
aqueleLance.Accounts contaAccounts = sessao.Accounts;
//FOR 1 ATÉ FINAL DO NÚMERO DE CONTAS
for (int i = 1; i <= contaAccounts.Count; i++)
{
//aqueleLance.Account contaAccount RECEBE O VALOR DO FOR
aqueleLance.Account contaAccount = contaAccounts[i];
//SE A CONTA EXISTE, ELE VAI ENVIAR
//(COMPARAÇÃO FEITA EM LOWER CASE
if (contaAccount.DisplayName.ToLower() == nomeDaConta.ToLower())
{
//COMANDO PARA ENVIAR USANDO A CONTA XXXXX
itemDoMail.SendUsingAccount = contaAccount;
//LIBERA VARIAVEL
Marshal.ReleaseComObject(contaAccount);
//PARA O COMANDO
break;
}
}
//PARA QUEM ENVIA O E-MAIL
itemDoMail.To = paraEmail;
//ENVIAR COM COPIA PARA
itemDoMail.CC = copiaEmail;
//COPIA OCULTA
//itemDoMail.BCC = copiaOculta;
//ASSUNTO DO EMAIL
itemDoMail.Subject = assuntoEmail;
//CORPO DO EMAIL EM HTML
itemDoMail.HTMLBody = corpo;
//"<html><body>Enviado pelo <strong>Outlook</strong> 2013<br/> Teste do envio com CC e BCC.<br/><br/></body></html>"
//IMPORTANCIA DO EMAIL
itemDoMail.Importance = aqueleLance.OlImportance.olImportanceHigh;
//ENVIA O EMAIL
//NÃO É POSSÍVEL VER ANTES DE ENVIAR SEM HABILITAR O DISPLAY ABAIXO
//itemDoMail.Send();
//HABILITE ISSO PARA VER A MENSAGEM ANTES DE ENVIAR
//PRECISA TIRAR O SEND ACIMA
itemDoMail.Display(false);
//LIBERA CONTAS
Marshal.ReleaseComObject(contaAccounts);
//LIBERA SESSÃO
Marshal.ReleaseComObject(sessao);
}
}
You're not using the same keys for your values:
"nomeDevice="+nome+"&nomeIp="+ip+"&nomeDc="+dc+"&nomeComentario="+comentario+"&nomeInicio="+inicio+"&nomeMonitor="+monitor
So you should also read these in the C# code:
String nomeIp = Request.QueryString["nomeIp"];
String nomeDc = Request.QueryString["nomeDc"];
String nomeComentario = Request.QueryString["nomeComentario"];
String nomeInicio = Request.QueryString["nomeInicio"];
String nomeMonitor = Request.QueryString["nomeMonitor"];
Also note that you should absolutely escape the content on the JavaScript side using encodeURIComponent(), otherwise your users can make the request fail by having for instance a & in the comentario... e.g.:
"outlookPrimeiro.aspx"+
"?nomeDevice="+encodeURIComponent(nome)+
"&nomeIp="+encodeURIComponent(ip)+
"&nomeDc="+encodeURIComponent(dc)+
"&nomeComentario="+encodeURIComponent(comentario)+
"&nomeInicio="+encodeURIComponent(inicio)+
"&nomeMonitor="+encodeURIComponent(monitor)
Try To change:
String nomeIp = Request.QueryString["ip"];
To
String nomeIp = Request.QueryString["nomeIp"]
and so on...
also, there's small typo. +"&nomeIp"+ip+ should be +"&nomeIp="+ip+