After looked for a solution, I have found a lot of article but not a way to do what I want so I'm there.
My problem:
I use uib-tooltip to set some explanation on the use/utility of some fields. I also use $translate with i18n files to do some translation.
These i18n files contains some html codes for special chars (because of servers issue I can't simply use UTF-8...).
And so, when I use simply for exemple:
<span translate="create.period"></span>
It's working fine, the HTML is interpreted fine and I have the good result.
Exemple of value on my i18n file:
create.period:'Ce champ contient la valeur de la période'
Result from the previus code:
Ce champ contient la valeur de la période
But if I use the uib-tooltip I have some issue.
Exemple of my code:
<span class='glyphicon glyphicon-question-sign pointer signColor' uib-tooltip="{{'create.period' | translate}}"></span>
And here the reult on the tooltip popup is :
Ce champ contient la valeur de la période
I have seen lot of thing like old way to do (uib-tooltip-html) or way to do with
$sce and ng-bind-html, but I can't do that here because I on the uib-tooltip.
So do I have miss some simple thing?
Or have you a solution for me? (and explanatinons :p)
Thank you very much ! :)
I add a try for a filter:
filter("htmlToPlaintext", ['$sce', '$compile', function ($sce, $compile) {
return function (val) {
return $sce.valueOf($sce.trustAsHtml(val));;
};
}])
Saddly not worky.
$scope.create.period = $sce.trustAsHtml('Ce champ contient la valeur de la période');
scope variable
<span class='glyphicon glyphicon-question-sign pointer signColor' uib-tooltip-html="create.period"></span>
pass '$sce' dependency in your controller
Related
Following this guide I've created a page with the following source code
{{#subobject:mysubobject
|url = https://www.instagram.com/p/CXeE2j-NT6s/
|title = Bullismo: proposta una legge in Francia per punirlo penalmente. Si rischia anche il carcere
|#category = bullismo|violenza|leggi|punizioni|+sep=;
}}
But I get the following error message:
processing error text "#category " cannot be used as a property name in this wiki.
Any hint on what's going on? I couldn't find any answer on google.
Try removing the space after #category. Also, note that a semicolon is used to separate several categories in your case:
{{#subobject:mysubobject
|url = https://www.instagram.com/p/CXeE2j-NT6s/
|title = Bullismo: proposta una legge in Francia per punirlo penalmente. Si rischia anche il carcere
|#category=bullismo;violenza;leggi;punizioni|+sep=;
}}
Within a subobject you are creating proporties, you cannot give them a separate category. And here you are saying give me a property #category within my subobject.
Some classes/properties are protected. The name category is one of them
[queuePlayer seekToTime:CMTimeMake(time,1)];
While I take seekToTime, the audio does replay, not seek to the time.
How to create CMTime para or you can tell me how to do all.
Please try below code:
UISlider *s = (UISlider*)sender;
[appDelegate.queuePlayer seekToTime:CMTimeMakeWithSeconds(s.value, queuePlayer.currentTime.timescale)];
first para is progress (0-1.0)
second para like this 'queuePlayer.currentTime.timescale'
I'm a novice in programming and my mission is to program a webserver based on a WIZnet w5200.
I develop all the function that control and generate my socket but now I need to print a web page with just few data on it.
In fact their will be a PC connected to the WIZnet via Ethernet wire and what I want to do is opening a web page with internet explorer on this PC.
For instance I get some weird framework on Wireshark and "HHHHHHHHHHHHHHHHH...etc" on my internet explorer screen (edit-->no more weird framework or mutliple"H"). I developped functions that create dynamically html code.
Here is some part of my code, tell me if something is choking (except the fact that it is weird) :
switch(Get_S0_SR())
{
case SOCK_ESTABLISHED:
printf("\n\n establish \n\n");
/*if(Get_S0_RX_RSR()!=0) //on regarde si on a reçu des data
{
printf("\n\nsize recv = %x\n\n",Get_S0_RX_RSR());
recv_data=recv_Socket(); //si oui on procède à la reception de ces données
}*/
//if(analog_data!=0) //on regarde si on as une donnée analogique
//{
printf("\n\ndeuxieme\n\n");
val=0;
while(val!=1)
{
val=send_Socket();//on envoi cette donnée via ethernet
printf("\n\nFINI\n\n");
}
//}
//else
//{
//goto SOCK_CLOSE_WAIT;
disconnect_Socket();
printf("\n\ndisconnect\n\n");
//}
break;
case SOCK_CLOSE_WAIT:
printf("\n\nSOCK_CLOSE_WAIT\n\n");
if(Get_S0_RX_RSR()!=0) //on regarde si on a reçu des data
{
recv_data=recv_Socket(); //si oui on procède à la reception de ces données
disconnect_Socket(); //une fois le processus finis on se deconnecte
//goto SOCK_CLOSED;
}
if(Get_S0_IR()==S0_IR_TIMEOUT)
{
//goto SOCK_CLOSED;
disconnect_Socket();
}
else
{
//goto SOCK_ESTABLISHED;
disconnect_Socket();
}
break;
case SOCK_CLOSED:
printf("\n\nSOCK_CLOSE\n\n");
close_Socket();
break;
case SOCK_INIT:
val=listen_Socket();
while(Get_S0_SR()!=SOCK_ESTABLISHED)
{
printf("\n\non attend la connection\n\n");
//delay(1000);
}
printf("\n\nstatu=%x\n\n",Get_S0_SR());
delay(1000);
break;
default:
break;
}
//printf("\n\nstatu=%x\n\n",Get_S0_SR());
return ;
}
One more update :
I use strcpy() to fill my buffer with html (as displayed on the code at the bottom) and I get the web page that I want (except for the data contained in "tracabilite[]"). The only problem is that I display the same paragraph several times ! Just like my "HHHHHHHHHH...etc" problem before. I think it comes from the transmission buffer of the WIZnet. Does its size is supposed to be initialize at the exact length of the HTTP frame ?
I try to figure it out but for instance I don't.
Here is the new code to generate html:
unsigned short debut_trame(void)
{
//unsigned char idx;
unsigned short taille;
//on vas stocker notre chaine de caractère html grace à strcpy
strcpy(Write_Com_WIZnet,"HTTP/1.1 200 OK\rContent-Type:Text/html;
<charset=utf-8>\r\n<!DOCTYPE html>\n<html>\n<body>\n<h1>Donnees de soudure</h1><p>");
taille=strlen("HTTP/1.1 200 OK\rContent-Type:Text/html; <charset=utf-
8>\r\n<!DOCTYPE html>\n<html>\n<body>\n<h1>Donnees de soudure</h1><p>");
printf("\ntaille trame=%d",taille);
//on vas écrire cette chaine de caractère dans le buffer TX
write_WIZnet(0x8000,taille);
return taille;
}
unsigned short liste_analog_data(unsigned short taille)
{
unsigned short len;
strcpy(Write_Com_WIZnet,"Puissance_Alim=");
len=strlen("Puissance_Alim=");
Write_Com_WIZnet[len]=tracabilite[0];
Write_Com_WIZnet[len+1]=tracabilite[1];
strcpy((Write_Com_WIZnet+(len+2)),"<br />");
len+=strlen("<br />")+2;
strcpy((Write_Com_WIZnet+(len)),"Courant_Alim=");
len+=strlen("Courant_Alim=");
Write_Com_WIZnet[len]=tracabilite[2];
Write_Com_WIZnet[len+1]=tracabilite[3];
strcpy((Write_Com_WIZnet+(len+2)),"<br />");
len+=strlen("<br />")+2;
strcpy((Write_Com_WIZnet+(len)),"Tension_Alim=");
len+=strlen("Tension_Alim=");
Write_Com_WIZnet[len]=tracabilite[4];
Write_Com_WIZnet[len+1]=tracabilite[5];
strcpy((Write_Com_WIZnet+(len+2)),"<br />");
len+=strlen("<br />")+2;
strcpy((Write_Com_WIZnet+(len)),"Courant_Generateur=");
len+=strlen("Courant_Generateur=");
Write_Com_WIZnet[len]=tracabilite[6];
Write_Com_WIZnet[len+1]=tracabilite[7];
strcpy((Write_Com_WIZnet+(len+2)),"<br />");
len+=strlen("<br />")+2;
strcpy((Write_Com_WIZnet+(len)),"Frequence=");
len+=strlen("Frequence=");
Write_Com_WIZnet[len]=tracabilite[8];
Write_Com_WIZnet[len+1]=tracabilite[9];
strcpy((Write_Com_WIZnet+(len+2)),"<br />");
len+=strlen("<br />")+2;
strcpy((Write_Com_WIZnet+(len)),"Temps_Soudure=");
len+=strlen("Temps_Soudure=");
Write_Com_WIZnet[len]=tracabilite[10];
Write_Com_WIZnet[len+1]=tracabilite[11];
strcpy((Write_Com_WIZnet+(len+2)),"<br />");
len+=strlen("<br />")+2;
strcpy((Write_Com_WIZnet+(len)),"Statut=");
len+=strlen("Statut=");
Write_Com_WIZnet[len]=tracabilite[12];
Write_Com_WIZnet[len+1]=tracabilite[13];
strcpy((Write_Com_WIZnet+(len+2)),"<br />");
len+=strlen("<br />")+2;
strcpy((Write_Com_WIZnet+(len)),"SWR=");
len+=strlen("SWR=");
Write_Com_WIZnet[len]=tracabilite[14];
Write_Com_WIZnet[len+1]=tracabilite[15];
strcpy((Write_Com_WIZnet+(len+2)),"<br />");
len+=strlen("<br />")+2;
strcpy((Write_Com_WIZnet+(len)),"</p>\n</body>\n</html>\0");
len+=strlen("</p>\n</body>\n</html>\0");
write_WIZnet(0x8000+taille,len);
taille+=len;
return taille;
}
void genere_HTML(void)
{
unsigned short size, size2;
printf("\non genere la page\n");
size=debut_trame();
size2=liste_analog_data(size);
//size2+=size;
printf("\nenvoi de la page au WIZnet, taille=%x\n",size2);
//write_WIZnet(0x8000,size2);
}
I know it is ugly but it's working (at least for the look)... The problem is that I display it several times.
Any help about HTTP, HTML or anything else will be usefull !
This is not really an answer but too much for comments.
I've also cleaned up a few of my comments related to providing the sample file.
With your changed function to create HTML content, the text is copied correctly.
But looking at frame #8 of your Wireshark file you can see that the HTTP data does not start with the content you prepared does not start at byte #0. Instead it starts much later.
HTTP data part of the frame starts at offset 0x36. Yout text is visible from offset 0x220.
I don't know where you can configure which buffer ist used as content of your TCP connection, but you are off by 490 bytes here.
Another issue is visible. If you look at the TCP stream, you can see that the data transmitted is ~40KiB which is far too much.
In the content you can spot multiple copies of your prepared content but only 1 GET request.
From your function I can see some new problem:
unsigned char* genere_HTML(void)
{
unsigned char* return_strcpy;
strcpy(Write_Com_WIZnet,"HTTP/1.1 200 OK\nContent-Type:Text/html;
charset=utf-8\n\n<html>\n<body>\n<h1>\n1 2 3 4\n</h1>\n</body>\n</html>");
write_WIZnet(0x8000,200);
return return_strcpy;
}
Here you return the uninitialized content of return_strcpy. Whatever is done with the return value of that function, it cannot be any good.
Also you use hard coded parameters for write_WIZnet. No hint about the length of the content or the storage location.
Assuming that Write_Com_WIZnet is used implicitely, you still have no length information.
I also don't have any information what these values are supposed to mean.
Wherever your buffer is transmitted, the problem is not in the part visible in this question.
I have this code that creates a decorated popup panel :
...
var x = 600;
var y = 150+row*23;
var popPanel = app.createDecoratedPopupPanel().setStyleAttributes({background:'#FFFFDD',padding:'15px'});
var message = app.createHTML("Opération non reversible !!<BR>Il faudra 'rafraichir' votre navigateur<BR>"+
"après vous être effacé du planning (case ✖)<BR>pour voir les données à jour").setPixelSize(300,60).setStyleAttributes({background:'#FFFFDD',padding:'15px'});
popPanel.add(message);
popPanel.setAnimationEnabled(true);
popPanel.setPopupPosition(x, y);
popPanel.setAutoHideEnabled(true);
popPanel.show();// I didn't chain the commands to make it easier to test by commenting one or another...
return app;
}
and it gives this result :
My question is : knowing that background attribute determines the surrounding zone (popup panel padding 15px) and that the inside widget has also its background color (and its own padding as well), how can I change the color of this blue frame ?
It seems that decorated** can not be redecorated in GAS. I too have wondered this (when working with decorated tab panels). I concluded that it was not possible. I used the Chrome inspector and found out that the blue part is actually a set of images. So it wouldn't be a simple CSS fix.
This thread seems to have the final verdict.
Thanks to the link from the other answer (leading to James Ferreira's site) I was able to build this new code that is a lot more easy to customize...
Here it is with the result below :
...
var x = 600;
var y = 150+row*23;
var popPanel = app.createPopupPanel().setStyleAttributes({background:'#ccccaa',padding:'5px', borderRadius:'15px 15px 15px 15px',borderColor:'#ffffdd',borderWidth:'5px'});
var message = app.createHTML("Opération non reversible !!<BR>Il faudra 'rafraichir' votre navigateur<BR>"+
"après vous être effacé du planning (case ✖)<BR>pour voir les données à jour").setPixelSize(300,60).setStyleAttributes({padding:'5px'});
popPanel.add(message); popPanel.setAnimationEnabled(true).setPopupPosition(x, y).setAutoHideEnabled(true).show();
return app;
}
The borderRadius:'px px px px' can be used on any widget, allowing for nice buttons as wel ;-)
I am trying to build up a HTML report based on values from a spreadsheet like this:
Ereigniszeilen += EreignisVorlage
.replace("<ZeileNr>", BerichtZaehler)
.replace("<KindName>", AlleEintraege[j][ColumnNameKind-1])
.replace("<LeistungsArt>", LeistungsArt)
.replace("<Datum>", DatumLeistung)
.replace("<CheckIn>", CheckIn)
.replace("<CheckOut>", CheckOut)
.replace("<TotalStunden>", TotalStunden)
.replace("<Bemerkung>", AlleEintraege[j][ColumnBemerkung-1]);
var AttachmentInhalt = AttachmentVorlage.replace("<EVENTS>", Ereigniszeilen);
var AttachmentInhalt = AttachmentVorlage
.replace("<BerichtsDatum>", BerichtsDatumFormatiert)
.replace("<EVENTS>", Ereigniszeilen);
var Bericht = [{fileName:"Bericht-Rapport.html", content: AttachmentInhalt}]
And then send by email:
MailApp.sendEmail("heinz.ruffieux#tfv-lac.org", TitelMitKind, "", //Versand des Emails
{htmlBody: "Guten Tag liebe Eltern,<br> Bonjour chers Parents, <br><br> \
Beiliegend senden wir Ihnen den wöchentlichen Bericht für die Betreuungsleistungen für <b>"
+KindName +" von " +StartDatumFormatiert +" bis " +EndDatumFormatiert +"</b>.<br><br> \
Nous vous envoyons ci-desous le rapport heptomadaire sur les services d'accueil du <b>"
+KindName + " du " +StartDatumFormatiert +" au " +EndDatumFormatiert +".</b><br><br>\
Mit freundlichen Grüssen <br> \
Meilleurs salutations <br><br> \
Tagesfamilienverein des Seebezirks <br> \
Association d'accueil familial de jour du district du Lac <br><br>" +ZusatztextDeutsch +"<br>"
+ZusatztextFranz, attachments: Bericht});
The result is a simple mail with some text and the report as a HTML attachment. This email is addressed to Swiss users only.
In principle everything works great since several months, but I do have some problems with char coding. The spreadsheed (source) contains German and French special characters which do not display correctly.
Especially on iPhones and apparently some Windows IE9 systems. On my own Linux system with Chrome and Firefox everything just looks great.
The HTML Body text of the email above however display correctly on every system so far.
Can anybody help me how to apply the correct character set in Google Apps Script?
Many thanks
Heinz
I'm not an expert in HTML but I guess that you should build a header in your html body to tell the browser (or the email client app.) to use the right character set. You could do that easily by sending to yourself the same message manually on gmail (of with your favorite mail client app) and analyse the html content of the message to see how it's done ?
just a suggestion ;-)
EDIT : (another suggestion ;-) If the problem occurs in the attachment, why not converting it in pdf ?
there is a built in converter in the DocsList service.
var docN = 'docname';
var ID = 'ID you have get prior to this'
var pdf = DocsList.getFileById(ID).getAs('application/pdf').getBytes();
var attach = {fileName: docN+".pdf",content:pdf, mimeType:'application/pdf'};
MailApp.sendEmail('email#xxx.com', 'Your document as PDF ('+docN+')', 'see attachment', {attachments:[attach]});