Posts Html functions.
Funciones
Text PhtExpText(Text txtPst)Text PhtXlsInclude(Text xlsPth)Text PhtName(Set pstObj)Text PhtAName(Set pstObj)Text PhtLinkTag(Text tagLbl, Real tinLbl)Text PhtLink(Set pstObj, Real tinLbl)Text PhtLinkCatSet(Set setCat, Real tinLbl)Text PhtLinkPstSet(Set setPst, Real tinLbl)Text PhtFileName(Text tagLbl)Text PhtTitle(Text tagLbl, Real tinLbl)//////////////////////////////////////////////////////////////////////////////
Text PhtExpText(Text txtPst) // Expand basic literals
//////////////////////////////////////////////////////////////////////////////
{ ReplaceTable(txtPst, PhtRepTab, 1) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Expande pequeños textos muy habituales dentro de los posts.",
PhtExpText);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtXlsInclude(Text xlsPth) // Excel.html path
//////////////////////////////////////////////////////////////////////////////
{
Text xlsHtm = ReadFile(xlsPth);
Text iniCss = "<style ";
Text endCss = "</style>";
Text xlsCss = iniCss +
TxtBetween2Tag(xlsHtm, iniCss, endCss, FALSE) +
endCss;
Text iniBdy = "<body>";
Text endBdy = "</body>";
Text xlsBdy = TxtBetween2Tag(xlsHtm, iniBdy, endBdy, FALSE);
"\n"+xlsCss+"\n"+xlsBdy+"\n"
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna, para su inclusión, el resultado de leer el Css y el Html de una
tabla Excel volcada como Html en el fichero de ruta xlsPth.",
PhtXlsInclude);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtName(Set pstObj) // If exists returns else build one
//////////////////////////////////////////////////////////////////////////////
{
If(pstObj->pstCod!="", pstObj->pstCod,
FormatDate(pstObj->pstDte,"%c%Y%m%d%h%m"))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el nombre del post como su codigo si lo tiene y si no lo tiene
utiliza la fecha para crear un nombre.",
PhtName);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtAName(Set pstObj)
//////////////////////////////////////////////////////////////////////////////
{ "<a name='"+PhtName(pstObj)+"'></a>" };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un enlace con el nombre de un post.",
PhtAName);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkTag(Text tagLbl, // Tag label
Real tinLbl) // Tiny or long label
//////////////////////////////////////////////////////////////////////////////
{
"<a href=" + Q("../"+PhtFileName(tagLbl)) + ">" +
PhtTitle (tagLbl, tinLbl) + "</a>"
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un enlace para una etiqueta que puede ser corta o larga.",
PhtLinkTag);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLink(Set pstObj, // Post object
Real tinLbl) // Tiny or long label
//////////////////////////////////////////////////////////////////////////////
{
Text pstTit = TxtOutside2Tag(pstObj->pstTit, "<", ">");
PhtLinkTag(pstTit, tinLbl)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un enlace para un post recibiendolo como objeto y utilizando una
etiqueta que puede ser corta o larga.",
PhtLink);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkCatSet(Set setCat, // Set of category names
Real tinLbl) // Tiny or long label
//////////////////////////////////////////////////////////////////////////////
{
SetSum(EvalSet(setCat, Text(Text cat)
{ "<li>" + PhtLinkTag(cat, tinLbl) + "</li>" }))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una lista de tipo li con los enlaces para todas las categorias de un
conjunto.",
PhtLinkCatSet);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkPstSet(Set setPst, // Set of posts
Real tinLbl) // Tiny or long label
//////////////////////////////////////////////////////////////////////////////
{
SetSum(EvalSet(setPst, Text(Set pst)
{ "<li>" + PhtLink(pst, tinLbl) + "</li>" }))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una lista de tipo li con los enlaces para todos los post de un
conjunto.",
PhtLinkPstSet);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtFileName(Text tagLbl) // File tag
//////////////////////////////////////////////////////////////////////////////
{
Text tagLow = ToLower(tagLbl);
Text tagRep = ReplaceTable(tagLow,
[[
[["á", "a"]], [["é", "e"]], [["í", "i"]], [["ó", "o"]], [["ú", "u"]],
[["ñ", "n"]]
]]);
Set letCic = For(1, TextLength(tagRep), Text(Real pos)
{
Text let = Sub(tagRep, pos, pos);
If(Or(And(let>="0", let<="9"), And(let>="a", let<="z")), let, "")
});
Text tagCls = Set2Txt(letCic, "", "", "", "", "", "", "", "");
Text dirNam = Case(
tagLbl == "Completo", "categorias", // Categoria especial
tagLbl <: CatAll, "categorias", // Categoria normal
TRUE, "articulos"); // El resto son articulos
dirNam + "/" + tagCls + ".html"
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna limpia la ruta de un fichero eliminado los acentos y todos los
caracteres que no son basicos.",
PhtFileName);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtTitle(Text tagLbl, // For menus
Real tinLbl) // Tiny or long label
//////////////////////////////////////////////////////////////////////////////
{
Case
(
tagLbl == "Presentación",
If(tinLbl, "Inicio",
"Presentación del contenido"),
tagLbl == "Derecho e informática",
If(tinLbl, "Derecho e<br />informática",
"Área de conceptos del Derecho para informáticos forenses y peritos"),
tagLbl == "Informática forense",
If(tinLbl, "Informática<br />forense",
"Área de conceptos fundamentales de informática forense y pericial"),
tagLbl == "Investigación básica",
If(tinLbl, "Investigación<br />básica",
"Área de investigación en sistemas informáticos"),
tagLbl == "Investigación avanzada",
If(tinLbl, "Investigación<br />avanzada",
"Área de investigación avanzada en informática forense"),
tagLbl == "Base documental",
If(tinLbl, "Base<br />documental",
"Área del caso práctico personal y de la base documental"),
tagLbl == "Área",
If(tinLbl, "Áreas",
"Áreas de conocimiento"),
tagLbl == "Módulo",
If(tinLbl, "Módulos",
"Módulos de informática forense y pericial"),
tagLbl == "Bibliografía",
If(tinLbl, "Bibliografía",
"Bibliografía seleccionada"),
TRUE, tagLbl
)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna para ciertas etiquetas otras mas largas o cortas para utilizarse
en los diferentes tipos de menus.",
PhtTitle);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// FILE : pht.tol
// AUTHOR : http://www.asolver.com
// PURPOSE : Posts Html functions.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// CONSTANT
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
PhtRepTab =
[[
[["_f.i_",
"<a href='http://www.forense.info'>Forense.info</a>"]],
[["_c.e_",
"<a href='http://www.ciip.es'>Campus Internacional de Inteligencia y Pericia</a>"]],
[["_C.e_",
"<a href='http://www.ciip.es'>CIIP</a>"]],
[["_c:e_",
"<a href='http://www.ciip.es'>ciip.es</a>"]],
[["_mas_",
"<a href='http://www.ciip.es/index.php?option=com_content&view=article&id=202&Itemid=120'>Máster</a>"]],
[["_esp_",
"<a href='http://www.ciip.es/index.php?option=com_content&view=article&id=208&Itemid=126'>Especialista</a>"]],
[["_exp_",
"<a href='http://www.ciip.es/index.php?option=com_content&view=article&id=214&Itemid=132'>Experto</a>"]]
]] << CriMaiTab; // emails
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Tabla de pequeños textos muy habituales dentro de los posts a expandir.",
PhtRepTab);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtExpText(Text txtPst) // Expand basic literals
//////////////////////////////////////////////////////////////////////////////
{ ReplaceTable(txtPst, PhtRepTab, 1) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Expande pequeños textos muy habituales dentro de los posts.",
PhtExpText);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtXlsInclude(Text xlsPth) // Excel.html path
//////////////////////////////////////////////////////////////////////////////
{
Text xlsHtm = ReadFile(xlsPth);
Text iniCss = "<style ";
Text endCss = "</style>";
Text xlsCss = iniCss +
TxtBetween2Tag(xlsHtm, iniCss, endCss, FALSE) +
endCss;
Text iniBdy = "<body>";
Text endBdy = "</body>";
Text xlsBdy = TxtBetween2Tag(xlsHtm, iniBdy, endBdy, FALSE);
"\n"+xlsCss+"\n"+xlsBdy+"\n"
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna, para su inclusión, el resultado de leer el Css y el Html de una
tabla Excel volcada como Html en el fichero de ruta xlsPth.",
PhtXlsInclude);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtName(Set pstObj) // If exists returns else build one
//////////////////////////////////////////////////////////////////////////////
{
If(pstObj->pstCod!="", pstObj->pstCod,
FormatDate(pstObj->pstDte,"%c%Y%m%d%h%m"))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna el nombre del post como su codigo si lo tiene y si no lo tiene
utiliza la fecha para crear un nombre.",
PhtName);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtAName(Set pstObj)
//////////////////////////////////////////////////////////////////////////////
{ "<a name='"+PhtName(pstObj)+"'></a>" };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un enlace con el nombre de un post.",
PhtAName);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkTag(Text tagLbl, // Tag label
Real tinLbl) // Tiny or long label
//////////////////////////////////////////////////////////////////////////////
{
"<a href=" + Q("../"+PhtFileName(tagLbl)) + ">" +
PhtTitle (tagLbl, tinLbl) + "</a>"
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un enlace para una etiqueta que puede ser corta o larga.",
PhtLinkTag);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLink(Set pstObj, // Post object
Real tinLbl) // Tiny or long label
//////////////////////////////////////////////////////////////////////////////
{
Text pstTit = TxtOutside2Tag(pstObj->pstTit, "<", ">");
PhtLinkTag(pstTit, tinLbl)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna un enlace para un post recibiendolo como objeto y utilizando una
etiqueta que puede ser corta o larga.",
PhtLink);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkCatSet(Set setCat, // Set of category names
Real tinLbl) // Tiny or long label
//////////////////////////////////////////////////////////////////////////////
{
SetSum(EvalSet(setCat, Text(Text cat)
{ "<li>" + PhtLinkTag(cat, tinLbl) + "</li>" }))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una lista de tipo li con los enlaces para todas las categorias de un
conjunto.",
PhtLinkCatSet);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtLinkPstSet(Set setPst, // Set of posts
Real tinLbl) // Tiny or long label
//////////////////////////////////////////////////////////////////////////////
{
SetSum(EvalSet(setPst, Text(Set pst)
{ "<li>" + PhtLink(pst, tinLbl) + "</li>" }))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna una lista de tipo li con los enlaces para todos los post de un
conjunto.",
PhtLinkPstSet);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtFileName(Text tagLbl) // File tag
//////////////////////////////////////////////////////////////////////////////
{
Text tagLow = ToLower(tagLbl);
Text tagRep = ReplaceTable(tagLow,
[[
[["á", "a"]], [["é", "e"]], [["í", "i"]], [["ó", "o"]], [["ú", "u"]],
[["ñ", "n"]]
]]);
Set letCic = For(1, TextLength(tagRep), Text(Real pos)
{
Text let = Sub(tagRep, pos, pos);
If(Or(And(let>="0", let<="9"), And(let>="a", let<="z")), let, "")
});
Text tagCls = Set2Txt(letCic, "", "", "", "", "", "", "", "");
Text dirNam = Case(
tagLbl == "Completo", "categorias", // Categoria especial
tagLbl <: CatAll, "categorias", // Categoria normal
TRUE, "articulos"); // El resto son articulos
dirNam + "/" + tagCls + ".html"
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna limpia la ruta de un fichero eliminado los acentos y todos los
caracteres que no son basicos.",
PhtFileName);
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
Text PhtTitle(Text tagLbl, // For menus
Real tinLbl) // Tiny or long label
//////////////////////////////////////////////////////////////////////////////
{
Case
(
tagLbl == "Presentación",
If(tinLbl, "Inicio",
"Presentación del contenido"),
tagLbl == "Derecho e informática",
If(tinLbl, "Derecho e<br />informática",
"Área de conceptos del Derecho para informáticos forenses y peritos"),
tagLbl == "Informática forense",
If(tinLbl, "Informática<br />forense",
"Área de conceptos fundamentales de informática forense y pericial"),
tagLbl == "Investigación básica",
If(tinLbl, "Investigación<br />básica",
"Área de investigación en sistemas informáticos"),
tagLbl == "Investigación avanzada",
If(tinLbl, "Investigación<br />avanzada",
"Área de investigación avanzada en informática forense"),
tagLbl == "Base documental",
If(tinLbl, "Base<br />documental",
"Área del caso práctico personal y de la base documental"),
tagLbl == "Área",
If(tinLbl, "Áreas",
"Áreas de conocimiento"),
tagLbl == "Módulo",
If(tinLbl, "Módulos",
"Módulos de informática forense y pericial"),
tagLbl == "Bibliografía",
If(tinLbl, "Bibliografía",
"Bibliografía seleccionada"),
TRUE, tagLbl
)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Retorna para ciertas etiquetas otras mas largas o cortas para utilizarse
en los diferentes tipos de menus.",
PhtTitle);
//////////////////////////////////////////////////////////////////////////////
iForense construye las paginas del sitio sobre informática forense Forense.Info
2015 asolver.com | Aviso legal | XHTML | Δ Θ Ξ | Creative Commons | Mapa y funciones del sitio