var style_box:string;
backgroundcolor,
border,bordercolor,borderstyle,borderwidth,
color,
float,
margin,
padding,
width,
csstitre,
titre,
texte,
doctexte,
docListe,
cssbox,
backgroundcolortitre : string;
ListItems,css_file:TStringList;
idname,css_filename,css_data,path:string;
i:integer;
begin
//script ici
backgroundcolor := GetParam('background-color','$3399CC');
bordercolor := GetShadowColor(backgroundcolor);//GetParam('bordercolor','');
if bordercolor<>'' then bordercolor := ColorToHtml(bordercolor);
backgroundcolortitre := bordercolor;
//backgroundcolortitre := GetParam('background-color-titre','');
//if backgroundcolortitre<>'' then backgroundcolortitre := ColorToHtml(backgroundcolortitre);
borderstyle := GetParam('borderstyle','none');
borderwidth := GetParam('borderwidth','');
color := ColorToHtml(GetHightLightColor(BackGroundColor)); //GetParam('color','');
float := GetParam('float','right');
margin := GetParam('margin','');
padding := GetParam('padding','');
titre := GetParam('titre','');
csstitre := GetParam('csstitre','');
width := GetParam('width','');
doctexte := GetParam('docTexte','');
docListe := GetParam('docListe','');
if doctexte='' then texte := GetParam('Texte','') else texte := GetContenuPartage(doctexte);
// si docListe n'est pas vide il prend la priorité sur docTexte
// le texte va donc etre construit avec les éléments contenus dans docTexte
// chaque ligne sera considérée comme étant un élément d'une liste non ordonnée
if docListe<>'' then
begin
// nom de votre boîte, il doit être différent si vos boîtes-liste ont des styles #
idname := GetParam('idname','boxlistcontainer');
// création des styles css
css_filename := GetParam('FilenameCss',GetProjet+'_hw.css');
SetCss(css_filename,'#'+idname+' ul','margin','0');
SetCss(css_filename,'#'+idname+' ul','padding','0');
SetCss(css_filename,'#'+idname+' ul','list-style-type','0');
SetCss(css_filename,'#'+idname+' a','display','block');
SetCss(css_filename,'#'+idname+' a','color',ColorToHtml(Color));
SetCss(css_filename,'#'+idname+' a','background-color',ColorToHtml(BackGroundColor));
SetCss(css_filename,'#'+idname+' a','width','100%');
SetCss(css_filename,'#'+idname+' a','padding','3px 12px 3px 8px');
SetCss(css_filename,'#'+idname+' a','text-decoration','none');
SetCss(css_filename,'#'+idname+' a','border-bottom','1px solid');
SetCss(css_filename,'#'+idname+' a','font-weight','bold');
SetCss(css_filename,'#'+idname+' a:hover','background-color',ColorToHtml(GetShadowColor(BackGroundColor)));
SetCss(css_filename,'#'+idname+' a:hover','color',ColorToHtml(BackGroundColor));
SetCss(css_filename,'#'+idname+' ul ul a','display','block');
SetCss(css_filename,'#'+idname+' ul ul a','color',ColorToHtml(Color));
SetCss(css_filename,'#'+idname+' ul ul a','background-color',ColorToHtml(BackGroundColor));
SetCss(css_filename,'#'+idname+' ul ul a','width','100%');
SetCss(css_filename,'#'+idname+' ul ul a','padding','3px 3px 3px 17px');
SetCss(css_filename,'#'+idname+' ul ul a','text-decoration','none');
SetCss(css_filename,'#'+idname+' ul ul a','border-bottom','1px solid '+ColorToHtml(Color));
SetCss(css_filename,'#'+idname+' ul ul a','font-weight','normal');
// si on ne l'a pas déjà fait on fait en sorte que notre css se charge
// pour cela on l'importe dans le head
if GetVarInt(css_filename+GetTitre,0)=0 then
begin
SetVarInt(css_filename+GetTitre,1); // pour ne le faire qu'une seule fois par page
// il existe 2 façons de lier une feuille de style mais en htmlhelp seule la première semble fonctionner...
if Condition('_HTMLHELP_') then
writeln('<<WEB(head:<link rel="stylesheet" type="text/css" href="')>>+css_filename+<<FNT(STRING.-,-,-,-:'" />)>>')
else
writeln('<<WEB(head:<style type="text/css" media="screen">@import url( ')>>+css_filename+<<FNT(STRING.-,-,-,-:' );</style>)>>');
end;
ListItems := TStringList.create;
ListItems.Text := GetContenuPartage(docListe);
// on cré un DIV puis y place la liste
texte := '<<WEB(<div id="')>>+idname+<<FNT(STRING.-,-,-,-:'">)>><<WEB(ul)>>';
// on va prendre chaque ligne du contenu partagé docListe
// et la transformer en un élément de notre liste
for i:=0 to ListItems.count-1 do
texte := texte+'<<WEB(li)>>'+ListItems.strings[i]+ '<<WEB(</li>)>>';
// on ferme la liste et le DIV
texte := texte + '<<WEB(/ul)>><<WEB(</div>)>>';
ListItems.free;
end;
// on transforme notre couleur en couleur html
backgroundcolor := ColorToHtml(backgroundcolor);
cssbox := GetParam('cssbox','');
style_box :='';
if backgroundcolor<>'' then style_box := 'background-color:'+backgroundcolor+ ';';
if borderstyle<>'' then style_box := style_box + ' border-style:'+borderstyle+';';
if borderwidth<>'' then style_box := style_box + ' border-width:'+borderwidth+';';
if bordercolor<>'' then style_box := style_box + ' border-color:'+bordercolor+';';
//style_box := style_box+' border:'+borderstyle+' '+borderwidth+' '+bordercolor+';';
if cssBox='' then style_box := style_box+' color:'+color+';';
style_box := style_box+' float:'+float+';';
style_box := style_box+' margin:'+margin+';';
style_box := style_box+' padding:'+padding+';';
style_box := style_box+' width:'+width+';';
write('<<WEB(<div>)>>');
write('<<WEB(<div style="')>>+style_box+<<FNT(STRING.-,-,-,-:'" class="')>>+cssbox+<<FNT(STRING.-,-,-,-:'">)>>');
write('<<WEB(<div style="background-color:')>>+backgroundcolortitre+<<FNT(STRING.-,-,-,-:'" class="')>>+csstitre+<<FNT(STRING.-,-,-,-:'">)>>'+titre+ '<<WEB(</div>)>>');
writeln(texte);
writeln('<<WEB(</div>)>><<WEB(</div>)>>');
end;
end.
backgroundcolor,
border,bordercolor,borderstyle,borderwidth,
color,
float,
margin,
padding,
width,
csstitre,
titre,
texte,
doctexte,
docListe,
cssbox,
backgroundcolortitre : string;
ListItems,css_file:TStringList;
idname,css_filename,css_data,path:string;
i:integer;
begin
//script ici
backgroundcolor := GetParam('background-color','$3399CC');
bordercolor := GetShadowColor(backgroundcolor);//GetParam('bordercolor','');
if bordercolor<>'' then bordercolor := ColorToHtml(bordercolor);
backgroundcolortitre := bordercolor;
//backgroundcolortitre := GetParam('background-color-titre','');
//if backgroundcolortitre<>'' then backgroundcolortitre := ColorToHtml(backgroundcolortitre);
borderstyle := GetParam('borderstyle','none');
borderwidth := GetParam('borderwidth','');
color := ColorToHtml(GetHightLightColor(BackGroundColor)); //GetParam('color','');
float := GetParam('float','right');
margin := GetParam('margin','');
padding := GetParam('padding','');
titre := GetParam('titre','');
csstitre := GetParam('csstitre','');
width := GetParam('width','');
doctexte := GetParam('docTexte','');
docListe := GetParam('docListe','');
if doctexte='' then texte := GetParam('Texte','') else texte := GetContenuPartage(doctexte);
// si docListe n'est pas vide il prend la priorité sur docTexte
// le texte va donc etre construit avec les éléments contenus dans docTexte
// chaque ligne sera considérée comme étant un élément d'une liste non ordonnée
if docListe<>'' then
begin
// nom de votre boîte, il doit être différent si vos boîtes-liste ont des styles #
idname := GetParam('idname','boxlistcontainer');
// création des styles css
css_filename := GetParam('FilenameCss',GetProjet+'_hw.css');
SetCss(css_filename,'#'+idname+' ul','margin','0');
SetCss(css_filename,'#'+idname+' ul','padding','0');
SetCss(css_filename,'#'+idname+' ul','list-style-type','0');
SetCss(css_filename,'#'+idname+' a','display','block');
SetCss(css_filename,'#'+idname+' a','color',ColorToHtml(Color));
SetCss(css_filename,'#'+idname+' a','background-color',ColorToHtml(BackGroundColor));
SetCss(css_filename,'#'+idname+' a','width','100%');
SetCss(css_filename,'#'+idname+' a','padding','3px 12px 3px 8px');
SetCss(css_filename,'#'+idname+' a','text-decoration','none');
SetCss(css_filename,'#'+idname+' a','border-bottom','1px solid');
SetCss(css_filename,'#'+idname+' a','font-weight','bold');
SetCss(css_filename,'#'+idname+' a:hover','background-color',ColorToHtml(GetShadowColor(BackGroundColor)));
SetCss(css_filename,'#'+idname+' a:hover','color',ColorToHtml(BackGroundColor));
SetCss(css_filename,'#'+idname+' ul ul a','display','block');
SetCss(css_filename,'#'+idname+' ul ul a','color',ColorToHtml(Color));
SetCss(css_filename,'#'+idname+' ul ul a','background-color',ColorToHtml(BackGroundColor));
SetCss(css_filename,'#'+idname+' ul ul a','width','100%');
SetCss(css_filename,'#'+idname+' ul ul a','padding','3px 3px 3px 17px');
SetCss(css_filename,'#'+idname+' ul ul a','text-decoration','none');
SetCss(css_filename,'#'+idname+' ul ul a','border-bottom','1px solid '+ColorToHtml(Color));
SetCss(css_filename,'#'+idname+' ul ul a','font-weight','normal');
// si on ne l'a pas déjà fait on fait en sorte que notre css se charge
// pour cela on l'importe dans le head
if GetVarInt(css_filename+GetTitre,0)=0 then
begin
SetVarInt(css_filename+GetTitre,1); // pour ne le faire qu'une seule fois par page
// il existe 2 façons de lier une feuille de style mais en htmlhelp seule la première semble fonctionner...
if Condition('_HTMLHELP_') then
writeln('<<WEB(head:<link rel="stylesheet" type="text/css" href="')>>+css_filename+<<FNT(STRING.-,-,-,-:'" />)>>')
else
writeln('<<WEB(head:<style type="text/css" media="screen">@import url( ')>>+css_filename+<<FNT(STRING.-,-,-,-:' );</style>)>>');
end;
ListItems := TStringList.create;
ListItems.Text := GetContenuPartage(docListe);
// on cré un DIV puis y place la liste
texte := '<<WEB(<div id="')>>+idname+<<FNT(STRING.-,-,-,-:'">)>><<WEB(ul)>>';
// on va prendre chaque ligne du contenu partagé docListe
// et la transformer en un élément de notre liste
for i:=0 to ListItems.count-1 do
texte := texte+'<<WEB(li)>>'+ListItems.strings[i]+ '<<WEB(</li>)>>';
// on ferme la liste et le DIV
texte := texte + '<<WEB(/ul)>><<WEB(</div>)>>';
ListItems.free;
end;
// on transforme notre couleur en couleur html
backgroundcolor := ColorToHtml(backgroundcolor);
cssbox := GetParam('cssbox','');
style_box :='';
if backgroundcolor<>'' then style_box := 'background-color:'+backgroundcolor+ ';';
if borderstyle<>'' then style_box := style_box + ' border-style:'+borderstyle+';';
if borderwidth<>'' then style_box := style_box + ' border-width:'+borderwidth+';';
if bordercolor<>'' then style_box := style_box + ' border-color:'+bordercolor+';';
//style_box := style_box+' border:'+borderstyle+' '+borderwidth+' '+bordercolor+';';
if cssBox='' then style_box := style_box+' color:'+color+';';
style_box := style_box+' float:'+float+';';
style_box := style_box+' margin:'+margin+';';
style_box := style_box+' padding:'+padding+';';
style_box := style_box+' width:'+width+';';
write('<<WEB(<div>)>>');
write('<<WEB(<div style="')>>+style_box+<<FNT(STRING.-,-,-,-:'" class="')>>+cssbox+<<FNT(STRING.-,-,-,-:'">)>>');
write('<<WEB(<div style="background-color:')>>+backgroundcolortitre+<<FNT(STRING.-,-,-,-:'" class="')>>+csstitre+<<FNT(STRING.-,-,-,-:'">)>>'+titre+ '<<WEB(</div>)>>');
writeln(texte);
writeln('<<WEB(</div>)>><<WEB(</div>)>>');
end;
end.