Secciones de la página

pag. tol


Declaraciones


Funciones


Time oriented language


Árbol de ficheros

Funciones

Text PagPage()

Text PagDir()

Text PagSee()

Text PagSeePi1()

Text PagSeePi4()

Text PagSeeLst()

Text PagSeeInf()

Real PagIsBilingual()

Text PagLanguage()

Text PagLongTitle()

Text PagShortTitle()

Text PagNumInt()

Text PagNameInt()

Text PagName()

Real PagPicInLst()

Real PagPicInPag()

Set PagPicFriends()

Text PagLongTitFriends()

Text PagShortTitFriends()

Real PagFirstFriend()

Real PagFirstList()

Text PagTechnique()

Set PagYearTab()

Set PagYearMnu()

Real PagCicle()

Real PagList()

Real PagSel()

Tol

Artículos del sitio

Presentación de Tol

Todos los programas

Simuladores visuales

Sitios que me gustan

Por categorías

Algoritmia

Búsqueda y ordenación

Computación fisiológica

Editorial y edición

Gráficos de datos

Herramientas y utilidades

Hipertexto

Informática forense

Lectura óptica de datos

Metaprogramación

No determinista

Ofimática

Recursión e iteración

Reglas y restricciones

Series y estadística









pag.tol de Ink.Watercolor

Page functions.

Declaraciones

Funciones

  • Text PagPage(Real eng)
    Returns the pages directory.
  • Text PagDir(Real eng)
    Returns the pages full path.
  • Text PagSee(Real eng)
    Returns the seeds directory.
  • Text PagSeePi1(Real eng)
    Returns the page for zoom.
  • Text PagSeePi4(Real eng)
    Returns the page for tinys.
  • Text PagSeeLst(Real eng)
    Returns the page for list.
  • Text PagSeeInf(Real eng)
    Returns the page for info.
  • Real PagIsBilingual(Text txt)
    Returns true if the text is in english and spanish
  • Text PagLanguage(Real eng, Text txt)
    If eng==true returns the english text, if eng=false the spanish text and if the text is not bilingual then return the text.
  • Text PagLongTitle(Real eng, Text tit)
    Returns the long title, the full title without the () that are the tags of the sort title.
  • Text PagShortTitle(Real eng, Text tit)
    Returns the long title, the title inside the () or [].
  • Text PagNumInt(Real picNum, Real zero)
    Returns the number of a page in text format, if zero=true 0009 and if zero=false then 9.
  • Text PagNameInt(Text prefix, Real picNum)
    Returns the name of a page giving a prefix and a picture number.
  • Text PagName(Text prefix, Set picReg)
    Returns the name of a page giving a prefix and a picture register.
  • Real PagPicInLst(Real picNum)
    Returns the number of list page (format of several pics per list page) in witch the picture picNum must be inserted.
  • Real PagPicInPag(Real picNum)
    Returns the number of page (format of several pics per page) in witch the picture picNum must be inserted.
  • Set PagPicFriends(Real ordReg, Set inpPdb)
    Returns the set of pics that are in the same page.
  • Text PagLongTitFriends(Real eng, Real ordReg, Set inpPdb)
    Returns a text title formed by union of the long titles of pics that are in the same page.
  • Text PagShortTitFriends(Real eng, Real ordReg, Set inpPdb)
    Returns a text title formed by union of the short titles of pics that are in the same page.
  • Real PagFirstFriend(Real numPag, Set inpPdb)
    Returns the number of the register that is the first (friend) a page of pictures.
  • Real PagFirstList(Real numPag, Set inpPdb)
    Returns the number of the register that is the first of a list of pictures.
  • Text PagTechnique(Real eng, Set picReg, Real long)
    Returns the pictore technique in a short or long way.
  • Set PagYearTab(Real eng, Set inpPdb, Text keySel)
    Returns a replacement table for the years index.
  • Set PagYearMnu(Set picReg)
    Returns a replacement tuble for a year of the years index.
  • Real PagCicle(Real eng, Set inpPdb, Text keySel, Set yeaRep, Text outDir, Text pthSee)
    Creates and writes the html file for the cicle page of 4 pictures.
  • Real PagList(Real eng, Set inpPdb, Text keySel, Set yeaRep, Text outDir, Text pthSee)
    Creates and writes the html file for the list page of 16 pictures.
  • Real PagSel(Real eng, Set inpPdb, Text keySel, Set yeaRep, Text pagSee)
    Creates and writes html files for zoom, cicle and list pages.

Funciones

Text PagPage()

//////////////////////////////////////////////////////////////////////////////
Text PagPage(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "pag"+If(eng, "e", "s") };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the pages directory.", PagPage);
//////////////////////////////////////////////////////////////////////////////

Text PagDir()

//////////////////////////////////////////////////////////////////////////////
Text PagDir(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "web/"+PagGal+"/"+PagPage(eng) };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the pages full path.", PagDir);
//////////////////////////////////////////////////////////////////////////////

Text PagSee()

//////////////////////////////////////////////////////////////////////////////
Text PagSee(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "web/"+PagGal+"/sed"+If(eng, "e", "s") };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the seeds directory.", PagSee);
//////////////////////////////////////////////////////////////////////////////

Text PagSeePi1()

//////////////////////////////////////////////////////////////////////////////
Text PagSeePi1(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "seedpi1"+If(eng, "eng", "spa")+".htm" };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the page for zoom.", PagSeePi1);
//////////////////////////////////////////////////////////////////////////////

Text PagSeePi4()

//////////////////////////////////////////////////////////////////////////////
Text PagSeePi4(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "seedpi4"+If(eng, "eng", "spa")+".htm" };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the page for tinys.", PagSeePi4);
//////////////////////////////////////////////////////////////////////////////

Text PagSeeLst()

//////////////////////////////////////////////////////////////////////////////
Text PagSeeLst(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "seedlst"+If(eng, "eng", "spa")+".htm" };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the page for list.", PagSeePi4);
//////////////////////////////////////////////////////////////////////////////

Text PagSeeInf()

//////////////////////////////////////////////////////////////////////////////
Text PagSeeInf(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "seedinf"+If(eng, "eng", "spa")+".htm" };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the page for info.", PagSeeInf);
//////////////////////////////////////////////////////////////////////////////

Real PagIsBilingual()

//////////////////////////////////////////////////////////////////////////////
Real PagIsBilingual(Text txt) // Text
//////////////////////////////////////////////////////////////////////////////
{ And(TextFind(txt,"{"), TextFind(txt,"|"), TextFind(txt,"}")) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns true if the text is in english and spanish",
PagIsBilingual);
//////////////////////////////////////////////////////////////////////////////

Text PagLanguage()

//////////////////////////////////////////////////////////////////////////////
Text PagLanguage(Real eng, // True if english
                 Text txt) // Text
//////////////////////////////////////////////////////////////////////////////
{ 
  If(! PagIsBilingual(txt), txt,                // There aren't traduction
  If(eng, TxtBetween2Tag(txt, "{", "|", TRUE),  // English
          TxtBetween2Tag(txt, "|", "}", TRUE))) // Spanish
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"If eng==true returns the english text, if eng=false the spanish text and
if the text is not bilingual then return the text.",
PagLanguage);
//////////////////////////////////////////////////////////////////////////////

Text PagLongTitle()

//////////////////////////////////////////////////////////////////////////////
Text PagLongTitle(Real eng, // True if english
                  Text tit) // Tittle
//////////////////////////////////////////////////////////////////////////////
{ ReplaceTable(PagLanguage(eng, tit), [[ [["(", ""]], [[")", ""]] ]]) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the long title, the full title without the () that are the tags of
the sort title.",
PagLongTitle);
//////////////////////////////////////////////////////////////////////////////

Text PagShortTitle()

//////////////////////////////////////////////////////////////////////////////
Text PagShortTitle(Real eng, // True if english
                   Text tit) // Tittle
//////////////////////////////////////////////////////////////////////////////
{
  Text txt = PagLanguage(eng, tit);
  If(TextFind(txt, "("), TxtBetween2Tag(txt, "(", ")", TRUE), // ()
  If(TextFind(txt, "["), TxtBetween2Tag(txt, "[", "]", TRUE), // []
     txt))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the long title, the title inside the ()  or [].",
PagShortTitle);
//////////////////////////////////////////////////////////////////////////////

Text PagNumInt()

//////////////////////////////////////////////////////////////////////////////
Text PagNumInt(Real picNum, Real zero)
//////////////////////////////////////////////////////////////////////////////
{ If(zero, FormatReal(picNum, "%04.0lf"), FormatReal(picNum, "%.0lf")) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the number of a page in text format, if zero=true 0009 and if
zero=false then 9.",
PagNumInt);
//////////////////////////////////////////////////////////////////////////////

Text PagNameInt()

//////////////////////////////////////////////////////////////////////////////
Text PagNameInt(Text prefix, Real picNum)
//////////////////////////////////////////////////////////////////////////////
{ prefix+PagNumInt(picNum, TRUE)+".htm" };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the name of a page giving a prefix and a picture number.",
PagNameInt);
//////////////////////////////////////////////////////////////////////////////

Text PagName()

//////////////////////////////////////////////////////////////////////////////
Text PagName(Text prefix, Set picReg)
//////////////////////////////////////////////////////////////////////////////
{ PagNameInt(prefix, picReg->picNum) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the name of a page giving a prefix and a picture register.",
PagName);
//////////////////////////////////////////////////////////////////////////////

Real PagPicInLst()

//////////////////////////////////////////////////////////////////////////////
Real PagPicInLst(Real picNum)
//////////////////////////////////////////////////////////////////////////////
{ If(EQ(picNum%PagLst, 0), picNum/PagLst, 1+Floor(picNum/PagLst)) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the number of list page (format of several pics per list page) in
witch the picture picNum must be inserted.",
PagPicInLst);
//////////////////////////////////////////////////////////////////////////////

Real PagPicInPag()

//////////////////////////////////////////////////////////////////////////////
Real PagPicInPag(Real picNum)
//////////////////////////////////////////////////////////////////////////////
{ If(EQ(picNum%PagPic, 0), picNum/PagPic, 1+Floor(picNum/PagPic)) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the number of page (format of several pics per page) in witch the
picture picNum must be inserted.",
PagPicInPag);
//////////////////////////////////////////////////////////////////////////////

Set PagPicFriends()

//////////////////////////////////////////////////////////////////////////////
Set PagPicFriends(Real ordReg, // A pic order number
                  Set  inpPdb) // Pictures database
//////////////////////////////////////////////////////////////////////////////
{
  Real numPag = PagPicInPag(ordReg); // Find the page
  Real maxReg = Card(inpPdb);        // Maximum of pics
  Set  picRep = For(1, PagPic, Set(Real picPos)
  {
    Real numReg = ((numPag-1)*PagPic)+picPos;
    If(GT(numReg,maxReg), Empty, inpPdb[numReg])
  });
  Select(picRep, Real(Set reg) { Card(reg) }) // Not empty regs
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the set of pics that are in the same page.",
PagPicFriends);
//////////////////////////////////////////////////////////////////////////////

Text PagLongTitFriends()

//////////////////////////////////////////////////////////////////////////////
Text PagLongTitFriends(Real eng,    // English/Spanish
                       Real ordReg, // A pic order number
                       Set  inpPdb) // Pictures database
//////////////////////////////////////////////////////////////////////////////
{
  Set frdSet = PagPicFriends(ordReg, inpPdb);
  Set titSet = EvalSet(frdSet, Text(Set frdReg)
               { PagLongTitle(eng, frdReg->picTit) });
  Set2TxtCommaAmp(titSet)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns a text title formed by union of the long titles of pics that are in
the same page.",
PagLongTitFriends);
//////////////////////////////////////////////////////////////////////////////

Text PagShortTitFriends()

//////////////////////////////////////////////////////////////////////////////
Text PagShortTitFriends(Real eng,    // English/Spanish
                        Real ordReg, // A pic order number
                        Set  inpPdb) // Pictures database
//////////////////////////////////////////////////////////////////////////////
{
  Set frdSet = PagPicFriends(ordReg, inpPdb);
  Set titSet = EvalSet(frdSet, Text(Set frdReg)
               { PagShortTitle(eng, frdReg->picTit) });
  Set2TxtCommaAmp(titSet)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns a text title formed by union of the short titles of pics that are in
the same page.",
PagShortTitFriends);
//////////////////////////////////////////////////////////////////////////////

Real PagFirstFriend()

//////////////////////////////////////////////////////////////////////////////
Real PagFirstFriend(Real numPag, // Page number
                    Set  inpPdb) // Pictures database
//////////////////////////////////////////////////////////////////////////////
{ ((numPag-1)*PagPic)+1 };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the number of the register that is the first (friend) a page of
pictures.",
PagFirstFriend);
//////////////////////////////////////////////////////////////////////////////

Real PagFirstList()

//////////////////////////////////////////////////////////////////////////////
Real PagFirstList(Real numPag, // Page number
                  Set  inpPdb) // Pictures database
//////////////////////////////////////////////////////////////////////////////
{ ((numPag-1)*PagLst)+1 };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the number of the register that is the first of a list of pictures.",
PagFirstList);
//////////////////////////////////////////////////////////////////////////////

Text PagTechnique()

//////////////////////////////////////////////////////////////////////////////
Text PagTechnique(Real eng,    // English/Spanish
                  Set  picReg, // A pic register
                  Real long)   // If True then long technique
//////////////////////////////////////////////////////////////////////////////
{
  Text traFun(Text txt, Real eng, Real fem)
  {
    If(eng, txt,
    {
      Set  tab = [[
      [["diffusion of alcohol fire", "difusión de fuego de alcohol"]],
      [["rubbed with alcohol",       "frotado con alcohol"]],
      [["Fabriano paper",            "papel Fabriano"]],
      [["marker's ink",              "tinta de rotulador"]],
      [["couché paper",              "papel couché"]],
      [["mixed media",               "técnicas mixtas"]],
      [["golden brown",              "marrón "+If(fem, "dorada", "dorado")]],
      [["aerograph",                 "aerógrafo"]],
      [["watercolor",                "acuarela"]],
      [["cotton",                    "algodón"]],
      [["orange",                    "naranja"]],
      [["marker",                    "rotulador"]],
      [["violet",                    "violeta"]],
      [["white",                     If(fem, "blanca", "blanco")]],
      [["yellow",                    If(fem, "amarilla", "amarillo")]],
      [["green",                     "verde"]],
      [["brown",                     "marrón"]],
      [["black",                     If(fem, "negra", "negro")]],
      [["grey",                      "gris"]],
      [["light blue",                "azul claro"]],
      [["blue",                      "azul"]],
      [["cyan",                      "cian"]],
      [["pink",                      "rosa"]],
      [["red",                       If(fem, "roja", "rojo")]],
      [["ink",                       "tinta"]], // pink ?
      [["and",                       "y"]],
      [["&",                     "y"]] ]];
      SetReplaceTable(txt, tab, 1)   // Recursive secuential replacement
    })
  };  

  Text tecCol(Set tecSet, Set colSet, Real fem)
  {
    If(tecSet[1]=="", "",
    {
      Text colTxt = Set2TxtCommaAmp(colSet);
      Text tecTxt = Set2TxtCommaAmp(tecSet);
      Text tecCol =
        If(!long, tecTxt,
        If(eng, colTxt+" "+tecTxt, tecTxt+" "+colTxt));
      traFun(Compact(tecCol), eng, fem)
    })
  };       
         
  Text forTxt = tecCol(picReg->forTec, picReg->forCol, TRUE); // Femenine
  Text bckTxt = tecCol(picReg->bckTec, picReg->bckCol, TRUE); // Femenine
  Text papTxt = If(! long, "",
                   tecCol(picReg->papTec, picReg->papCol, FALSE)+" "+ // Masculine
                   "("+FormatReal(picReg->picWid,"%.0lf")+"<i> </i>x<i> </i>"+
                   FormatReal(picReg->picHei,"%.0lf")+"<i> </i>mms)");

  Text sepF2b = If(eng, " over ", " sobre ");
  Text sepB2p = If(eng, " on ",   " en ");

  Text tecTxt = Case(
    And(forTxt!="", bckTxt!="", papTxt!=""), forTxt+sepF2b+bckTxt+sepB2p+papTxt,
    And(forTxt=="", bckTxt!="", papTxt!=""),               bckTxt+sepB2p+papTxt,
    And(forTxt!="", bckTxt=="", papTxt!=""), forTxt              +sepB2p+papTxt,
    And(forTxt!="", bckTxt!="", papTxt==""), forTxt+sepF2b+bckTxt              ,
    TRUE /* only 1 of the 3 */             , forTxt       +bckTxt       +papTxt);

  tecTxt
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the pictore technique in a short or long way.",
PagTechnique);
//////////////////////////////////////////////////////////////////////////////

Set PagYearTab()

//////////////////////////////////////////////////////////////////////////////
Set PagYearTab(Real eng,
               Set  inpPdb,
               Text keySel)
//////////////////////////////////////////////////////////////////////////////
{
  Text pthOld = "../../chppho/"+PagPage(eng)+"/";
  Text pthGal = "../../"+PagGal+"/"+PagPage(eng)+"/";

  Set  claPdb = Classify(inpPdb, Real(Set a, Set b)
                { Compare(Year(a->endDte),Year(b->endDte)) });
  Set  fstPdb = EvalSet(claPdb, Set(Set cla)
  { Sort(cla,Real(Set a, Set b){ Compare(a->endDte,b->endDte) })[1] });

  Set  yeaRep = For(1980,2010, Set(Real yeaNum)
  {
    Set  yeaSet = Select(fstPdb, Real(Set a) { EQ(Year(a->endDte),yeaNum) });
    Real crdSet = Card(yeaSet);
    Text yeaTxt = FormatReal(yeaNum,"%.0lf");
    Text yeaOld = "<a href='"+pthOld+"AN."+yeaTxt+"'>"+yeaTxt+"</a>";
    Set  repTwo =
       If(NE(crdSet,1), 
         SetOfText(yeaOld, // Si no hay cuadros para el año no pone nada
           ""),
         SetOfText(yeaOld, // Si hay cuadros para el año cambia el link
           "<a href='"+pthGal+PagName(keySel+"zoo", yeaSet[1])+"'>"+yeaTxt+"</a>"));

    // Cambiar comillas simples por dobles como todo el mundo en internet
    SetOfText(repTwo[1], Replace(repTwo[2], "'", Char(34)))
  })
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns a replacement table for the years index.",
PagYearTab);
//////////////////////////////////////////////////////////////////////////////

Set PagYearMnu()

//////////////////////////////////////////////////////////////////////////////
Set PagYearMnu(Set picReg)
//////////////////////////////////////////////////////////////////////////////
{
  Text dte = FormatDate(picReg->endDte,"%c%Y/%m/%d");
  Text yea = Sub(dte,1,4);
  SetOfText("<td class='navAMn'><!-- "+yea+" -->",   // Marcar el año
            "<td class='navOMn'><!-- "+yea+" -->")   // en curso
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns a replacement tuble for a year of the years index.",
PagYearMnu);
//////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
Set PagTranslation(Real eng,    // Language english/spanish
                   Text htmPth) // Html file
//////////////////////////////////////////////////////////////////////////////
{
  Text Q      = Char(34);
  Text notTra =
    "<img src="+Q+"../../common/gif/block.gif"+Q+" width='100%' />";
  Text hlpTxt = " ("+If(eng,"translate to Spanish",
                            "traducir al inglés")+")";

  Text yesTra(Text url, Text tit)
  {
    "<a href="+Q+url+Q+">"+
    "<img src="+Q+"../../common/gif/translsta.gif"+Q+
    " width='100%'"+
    " name="+Q+"traBut"+Q+
    " border='0' "+
    " alt="+Q+tit+hlpTxt+Q+" "+
    " onmouseover="+Q+"document.traBut.src='../../common/gif/translact.gif';"+Q+ 
    " onmouseout ="+Q+"document.traBut.src='../../common/gif/translsta.gif';"+Q+
    " /></a>"
  };

  Text traPth = Replace(htmPth, PagPage( eng), PagPage(!eng));

  If(! FileExist(traPth), [[ "TRA.COD", notTra ]],
  {
    Text traHtm = ReadFile(traPth);
    Text traUrl = Replace(htmPth, PagDir(eng), "../"+PagPage(!eng));
    Text traTit = TxtBetween2Tag(traHtm, "<title>", "</title>", TRUE);
    [[ "TRA.COD", yesTra(traUrl, traTit) ]]
  })
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the Html code that link each page wit it translation.",
PagTranslation);
//////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
Set PagGalleryLabel(Real eng,     // Language english/spanish
                    Text keySel)  // Selector
//////////////////////////////////////////////////////////////////////////////
{
  [[
    SetOfText("GAL.NAM",
             If(PagGal=="inarmy", If(eng, "ink in the army",
                                          "tinta en la mili"),
             If(PagGal=="fleurs", If(eng, "the flowers of evil",
                                          "las flores del mal"),
                                  If(eng, "ink and watercolor",
                                          "tinta y acuarela")))), 
    SetOfText("GAL.KEY", 
             If(keySel=="sad", If(eng, "[all]",         "[completo]"),
             If(keySel=="upd", If(eng, "[new]",         "[nuevo]"),
             If(keySel=="inx", If(eng, "[index]",       "[índice]"),
             If(keySel=="inf", If(eng, "[information]", "[información]"),
                               If(eng, "[error]",       "[error]"))))))
  ]]
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns a pair of labels for an art gallery.",
PagGalleryLabel);
//////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
Real PagZoom(Real eng,     // Language english/spanish
             Set  inpPdb,  // Pictures database
             Text keySel,  // Selector
             Set  yeaRep,  // Year map
             Text outDir,  // Output directory
             Text pthSee)  // Seed file
//////////////////////////////////////////////////////////////////////////////
{
  Text WriteLn("Zoom  for: "+keySel);

  Text zooSee = pthSee+"/"+PagSeePi1(eng);
  Text zooHtm = ReadFile(zooSee);
  Text notNow = "../../common/gif/notnowzoo.gif";
  Real maxReg = Card(inpPdb);

  Text iniFil = PagName(keySel+"zoo", inpPdb[1]);
  Text iniTit = PagLongTitle(eng, inpPdb[1]->picTit);

  Text endFil = PagName(keySel+"zoo", inpPdb[maxReg]);
  Text endTit = PagLongTitle(eng, inpPdb[maxReg]->picTit);

  Set  cicSet = For(1, maxReg, Real(Real numReg)
  {
    Set  picReg = inpPdb[numReg];
    Text lngTit = PagLongTitle(eng, picReg->picTit);
    Text numTxt = PagNumInt(picReg->picNum, TRUE);  // 0099
    Text numTxB = PagNumInt(picReg->picNum, FALSE); // 99
    Text dteTxt = FormatDate(picReg->endDte,"%c%Y/%m/%d");
    Text yeaTxt = Sub(dteTxt,1, 4);
    Text dteTxB = Replace(dteTxt,"/", "<i> </i>/<i> </i>"); /* very little */
    Text traRem = PagLanguage(eng, picReg->picRem);

    Text zooFil = PagName   (keySel+"zoo", picReg);
    Text zooPth = outDir+"/"+zooFil;

    Text zooJpg = "web/"+PagGal+"/image/zoom/"+picReg->jpgFil;

    // Realmente sobra ya que si no hay imagen no crea ni la pagina
    Real zooExi = FileExist(zooJpg); 

    Text picKey = Set2TxtKeyword([[lngTit, traRem]] + // Keywords
                                   picReg->bckTec   +
                                   picReg->forTec,
                                   PagMinChr, TRUE);

    Text nxtFil = PagName(keySel+"zoo", inpPdb[Min(maxReg,numReg+1)]);
    Text nxtTit = PagLongTitle(eng, inpPdb[Min(maxReg,numReg+1) ]->picTit);

//  http://www.baudelaire.cz/works.html?aID=100&artID=2 Frances
//  http://www.baudelaire.cz/works.html?aID=200&artID=2 Ingles
//  until 102 That kind heart you were jealous of... ok
//  but for me Mists and Rains is the 103 and baudelaire.cz jump to 137

    Text cz.bau = If(PagGal!="fleurs", "",
    {
      Text cz.txt = "<br /><br />" +
                    If(eng, "Full poem at ", "Poema completo en ");
      Text cz.lan = If(eng, "200", "100");
      Text lnk.cz = cz.txt+
                    "<a href='http://www.baudelaire.cz/works.html?aID="+
                    cz.lan+"&amp;artID="+numTxB+"'>baudelaire.cz</a>";
      lnk.cz
    });

    Set repTab =  
    [[
      SetOfText("WIN.TIT", lngTit),
      SetOfText("MET.DES", lngTit+" ("+dteTxt+")"),
      SetOfText("MET.KEY", picKey),
      SetOfText("PAG.TIT", lngTit),

      SetOfText("JPG.FIL", If(zooExi, "../image/zoom/"+picReg->jpgFil,
                                      notNow)),

      SetOfText("URL.INI", iniFil),
      SetOfText("URL.B10", PagName   (keySel+"zoo", inpPdb[Max(1,     numReg-10)])),
      SetOfText("URL.PRE", PagName   (keySel+"zoo", inpPdb[Max(1,     numReg-1) ])),
      SetOfText("URL.CIC", PagNameInt(keySel+"cic", PagPicInPag(numReg))),
      SetOfText("URL.NXT", nxtFil),
      SetOfText("URL.F10", PagName   (keySel+"zoo", inpPdb[Min(maxReg,numReg+10)])),
      SetOfText("URL.END", endFil),

      SetOfText("TIT.INI", iniTit),
      SetOfText("TIT.B10", PagLongTitle(eng, inpPdb[Max(1,     numReg-10)]->picTit)),
      SetOfText("TIT.PRE", PagLongTitle(eng, inpPdb[Max(1,     numReg-1) ]->picTit)),
      SetOfText("TIT.CIC", PagShortTitFriends(eng, numReg, inpPdb)),
      SetOfText("TIT.NXT", nxtTit),
      SetOfText("TIT.F10", PagLongTitle(eng, inpPdb[Min(maxReg,numReg+10)]->picTit)),
      SetOfText("TIT.END", endTit),


// Forms page free images and budgets
      SetOfText("URL.FRE", "../../chppho/"+If(eng, "page", "pags")+
                           "/inffeeimg.htm?pn="+numTxt), // Free image
      SetOfText("URL.BDG", "../../chppho/"+If(eng, "page", "pags")+
                           "/inffeebdg.htm?pn="+numTxt), // Budgets 
      SetOfText("TIT.FRE", If(eng, "free image of ",      
                                   "imagen gratis de ")+lngTit), 
      SetOfText("TIT.BDG", If(eng, "price for the original painting ",
                                   "precio para la obra original ")+lngTit), 

      SetOfText("LOW.001",
      {
        lngTit                                   +", "+
        If(eng, "painted in", "pintado en")      +" "+
        dteTxB                                   +" "+
        If(keySel!="sad", "",
           If(eng, "with number", "con número")  +" "+
           numTxt)
      }),

      SetOfText("LOW.002", Text PagTechnique(eng, picReg, TRUE)),

      SetOfText("LOW.003",
      {
        If(eng, "painting viewed", "pintura vista")+" "+
        FormatReal(picReg->picPrn,"%.0lf")         +" "+
        If(eng, "times", "veces")
      }),

      SetOfText("LOW.004",
      {
        If(eng, "next", "siguiente")+": "+
        "<a href="+Char(34)+nxtFil+Char(34)+">"+
                            nxtTit+"</a>"
      }),

      SetOfText("LOW.LST", traRem+cz.bau),

      PagTranslation(eng, zooPth),

      PagYearMnu(picReg)

    ]]<<
      PagGalleryLabel(eng, keySel);

    Text filWri = WriteFile(zooPth, ReplaceTable(zooHtm, repTab<<yeaRep));
    TRUE
  });
  Card(cicSet)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Creates and writes the html file for the zoom page of a picture.",
PagZoom);
//////////////////////////////////////////////////////////////////////////////

Real PagCicle()

//////////////////////////////////////////////////////////////////////////////
Real PagCicle(Real eng,    // Language
              Set  inpPdb, // Picture database
              Text keySel, // Selector
              Set  yeaRep, // Year map
              Text outDir, // Output directory
              Text pthSee) // Seed path
//////////////////////////////////////////////////////////////////////////////
{
  Text WriteLn("Cicle for: "+keySel);

  Text defNot = "../../common/gif/notnowtin.gif";

  Real maxReg = Card(inpPdb);
  Real maxPag = PagPicInPag(maxReg);

  Text cicSee = pthSee+"/"+PagSeePi4(eng);
  Text cicHtm = ReadFile(cicSee);

  Text iniFil = PagNameInt(keySel+"cic", 1);
  Text endFil = PagNameInt(keySel+"cic", maxPag);
  Text iniAlt = PagShortTitFriends(eng, 1,      inpPdb);
  Text endAlt = PagShortTitFriends(eng, maxReg, inpPdb);

  Set  cicSet = For(1, maxPag, Real(Real numPag)
  {
    // Movimientos de pagina adelante y atras
    Real b10Pag = Max(1,      numPag-10);
    Real prePag = Max(1,      numPag-1);
    Real nxtPag = Min(maxPag, numPag+1);
    Real f10Pag = Min(maxPag, numPag+10);

    Text b10Fil = PagNameInt(keySel+"cic", b10Pag);
    Text preFil = PagNameInt(keySel+"cic", prePag);
    Text nxtFil = PagNameInt(keySel+"cic", nxtPag);
    Text f10Fil = PagNameInt(keySel+"cic", f10Pag);

    // Años en curso a los que pertenecen las imagenes
    Real numFst = PagFirstFriend(numPag, inpPdb); // El primero marca año
    Set  picFst = inpPdb[numFst];                 // El registro
    Set  picLst = inpPdb[Min(maxReg,((numPag-1)*PagPic)+PagPic)]; // Ultimo
    Set  yeaMrk = If(EQ(Year(picFst->endDte),Year(picLst->endDte)),
    [[PagYearMnu(picFst)]],  // Marcar el año en curso
    [[PagYearMnu(picFst),    // Marcar el año ini en curso
      PagYearMnu(picLst)]]); // Marcar el año end en curso

    Set  picRep = For(1, PagPic, Set(Real picPos)
    {
      Real numReg = ((numPag-1)*PagPic)+picPos;
      Text pos3Tx = FormatReal(picPos,"%1.0lf");
      If(LE(numReg,maxReg),
      {

        Text jpgPth =
        If(FileExist("web/"+PagGal+"/image/tiny/"+inpPdb[numReg]->jpgFil),
           "../image/tiny/"+inpPdb[numReg]->jpgFil,
           defNot);

        [[
          SetOfText("ZOO."+pos3Tx, PagName(keySel+"zoo", inpPdb[numReg])),
          SetOfText("PIC."+pos3Tx, jpgPth),
          SetOfText("TIT."+pos3Tx, PagLongTitle(eng, inpPdb[numReg]->picTit)),
          SetOfText("TEC."+pos3Tx, "<b>"+PagTechnique(eng, inpPdb[numReg], FALSE)+"</b>")
        ]]
      },
      {
        [[
          SetOfText(Replace("<li><a href="+Char(34)+"ZOO._N_"+Char(34)+">TIT._N_</a>: TEC._N_","_N_",pos3Tx), ""),
          SetOfText("ZOO."+pos3Tx, "#"), // The same page
          SetOfText("PIC."+pos3Tx, defNot),
          SetOfText("TIT."+pos3Tx, ""),
          SetOfText("TEC."+pos3Tx, "")
        
        ]]
      })
    });

//        SetOfText(Replace(defZoo,"_N_",pos3Tx), defNot),

    Text cicFil = PagNameInt(keySel+"cic", numPag);
    Text cicPth = outDir+"/"+cicFil;

    Text frdLng = PagLongTitFriends (eng, numFst, inpPdb);
    Text frdShr = PagShortTitFriends(eng, numFst, inpPdb);
    Text frdS80 = If(LE(TextLength(frdShr),PagTitMax), frdShr,
                  If(eng, "a free art gallery showcasing ink and watercolor paintings",
                          "una galería de arte libre con pinturas de tinta y acuarela")),

    Set  keySet = EvalSet(PagPicFriends(numFst, inpPdb), Set(Set reg)
                  { reg->bckTec + reg->forTec });
    Text keyRep = Set2TxtKeyword(BinGroup("<<",keySet)+[[frdLng]], PagMinChr, TRUE);

    Set repTab =  
    [[
      SetOfText("WIN.TIT", frdShr),
      SetOfText("MET.DES", frdLng),
      SetOfText("MET.KEY", keyRep),
      SetOfText("PAG.TIT", frdS80),

      SetOfText("URL.INI", iniFil),
      SetOfText("URL.B10", b10Fil),
      SetOfText("URL.PRE", preFil),
      SetOfText("URL.LST", PagNameInt(keySel+"lst", PagPicInLst(numFst))),
      SetOfText("URL.NXT", nxtFil),
      SetOfText("URL.F10", f10Fil),
      SetOfText("URL.END", endFil),

      SetOfText("TIT.INI", iniAlt),
      SetOfText("TIT.B10", PagShortTitFriends(eng, PagFirstFriend(b10Pag, inpPdb), inpPdb)),
      SetOfText("TIT.PRE", PagShortTitFriends(eng, PagFirstFriend(prePag, inpPdb), inpPdb)),
      SetOfText("TIT.LST", If(eng, "gallery listing of paintings",
                                   "listado de cuadros de la galería")),
      SetOfText("TIT.NXT", PagShortTitFriends(eng, PagFirstFriend(nxtPag, inpPdb), inpPdb)),
      SetOfText("TIT.F10", PagShortTitFriends(eng, PagFirstFriend(f10Pag, inpPdb), inpPdb)),
      SetOfText("TIT.END", endAlt),

// Forms page free images and budgets (without any number)
      SetOfText("URL.FRE", "../../chppho/"+If(eng, "page", "pags")+
                           "/inffeeimg.htm"), // Free image
      SetOfText("URL.BDG", "../../chppho/"+If(eng, "page", "pags")+
                           "/inffeebdg.htm"), // Budgets 
      SetOfText("TIT.FRE", If(eng, "ask for free images",      // Free image (alt)
                                   "pedir imágenes gratis")), 
      SetOfText("TIT.BDG", If(eng, "ask for the prices of the originals",
                                   "pedir precios para la obra original")), 

      PagTranslation(eng, cicPth)
    ]] << BinGroup("<<",picRep)
       << yeaRep
       << yeaMrk
       << PagGalleryLabel(eng, keySel);

    Text filWri = WriteFile(cicPth, ReplaceTable(cicHtm, repTab));
    TRUE
  });
  Card(cicSet)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Creates and writes the html file for the cicle page of 4 pictures.",
PagCicle);
//////////////////////////////////////////////////////////////////////////////

Real PagList()

//////////////////////////////////////////////////////////////////////////////
Real PagList(Real eng,    // Language
             Set  inpPdb, // Picture database
             Text keySel, // Selector
             Set  yeaRep, // Year map
             Text outDir, // Output directory
             Text pthSee) // Seed path
//////////////////////////////////////////////////////////////////////////////
{
  Text WriteLn("List  for: "+keySel);

  Real maxReg = Card(inpPdb);
  Real maxPag = PagPicInLst(maxReg);

  Text lstSee = pthSee+"/"+PagSeeLst(eng);
  Text lstHtm = ReadFile(lstSee);

  Text iniFil = PagNameInt(keySel+"lst", 1);
  Text endFil = PagNameInt(keySel+"lst", maxPag);

  Set  lstSet = For(1, maxPag, Real(Real numPag)
  {
    // Movimientos de pagina adelante y atras
    Real b10Pag = Max(1,      numPag-2);
    Real prePag = Max(1,      numPag-1);
    Real nxtPag = Min(maxPag, numPag+1);
    Real f10Pag = Min(maxPag, numPag+2);

    Text b10Fil = PagNameInt(keySel+"lst", b10Pag);
    Text preFil = PagNameInt(keySel+"lst", prePag);
    Text nxtFil = PagNameInt(keySel+"lst", nxtPag);
    Text f10Fil = PagNameInt(keySel+"lst", f10Pag);

    // Años en curso a los que pertenecen las imagenes
    Real numFst = PagFirstList(numPag, inpPdb);   // El primero marca año
    Set  picFst = inpPdb[numFst];                 // El registro
    Real numLst = Min(maxReg,((numPag-1)*PagLst)+PagLst); // Ultimo
    Set  picLst = inpPdb[numLst]; // Ultimo
    Set  yeaMrk = If(EQ(Year(picFst->endDte),Year(picLst->endDte)),
    [[PagYearMnu(picFst)]],  // Marcar el año en curso
    [[PagYearMnu(picFst),    // Marcar el año ini en curso
      PagYearMnu(picLst)]]); // Marcar el año end en curso

    Set  picRep = For(1, PagLst, Text(Real picPos)
    {
      Real numReg = ((numPag-1)*PagLst)+picPos;
      If(GT(numReg,maxReg), "",
      {
        Text url = PagName(keySel+"zoo", inpPdb[numReg]);
        Text tit = PagLongTitle(eng, inpPdb[numReg]->picTit);
        Text srt = PagShortTitle(eng, inpPdb[numReg]->picTit);
        Text lnk = "<a href="+Char(34)+url+Char(34)+">"+srt+"</a>";
        Text lin = "<li>"+Replace(tit, srt, lnk)+"</li>\n"
      })
    });


    Text lstFil = PagNameInt(keySel+"lst", numPag);
    Text lstPth = outDir+"/"+lstFil;

    Set  keyCic = For(1, PagLst, Text(Real picPos)
    {
      Real numReg = ((numPag-1)*PagLst)+picPos;
      If(GT(numReg,maxReg), "", PagLongTitle(eng, inpPdb[numReg]->picTit))
    });
    Text keyRep = Set2TxtKeyword(keyCic, 6, TRUE);  // Minimum 6 ordered
    Text keyTit = Set2TxtKeyword(keyCic, 7, FALSE); // Minimum 7 not ordered
    // Buscar la primera coma con blanco antes de la longitud maxima del titulo
    Text pagTit = Sub(keyTit, 1, TextFind(keyTit, ", ", PagTitMax, 1, -1))+"...";

    Set repTab =  
    [[
      SetOfText("WIN.TIT", pagTit),
      SetOfText("MET.DES", pagTit),
      SetOfText("MET.KEY", keyRep),
      SetOfText("PAG.TIT", pagTit),


      SetOfText("URL.INI", iniFil),
      SetOfText("URL.B10", b10Fil),
      SetOfText("URL.PRE", preFil),
      SetOfText("ZOO.1",   PagName(keySel+"zoo", picFst)),
      SetOfText("URL.NXT", nxtFil),
      SetOfText("URL.F10", f10Fil),
      SetOfText("URL.END", endFil),

      SetOfText("TIT.INI", If(eng, "begin of gallery listing",
                                   "inicio del listado de la galería")),
      SetOfText("TIT.B10", "-2"),
      SetOfText("TIT.PRE", "previous"),
      SetOfText("TIT.ZOM", PagLongTitle(eng, picFst->picTit)),
      SetOfText("TIT.NXT", "next"),
      SetOfText("TIT.F10", "+2"),
      SetOfText("TIT.END", If(eng, "end of gallery listing",
                                   "final del listado de la galería")),

// Forms page free images and budgets (without any number)
      SetOfText("URL.FRE", "../../chppho/"+If(eng, "page", "pags")+
                           "/inffeeimg.htm"), // Free image
      SetOfText("URL.BDG", "../../chppho/"+If(eng, "page", "pags")+
                           "/inffeebdg.htm"), // Budgets 
      SetOfText("TIT.FRE", If(eng, "ask for free images",      // Free image (alt)
                                   "pedir imágenes gratis")), 
      SetOfText("TIT.BDG", If(eng, "ask for the prices of the originals",
                                   "pedir precios para la obra original")), 

//    SetOfText("PIC.MIN", FormatReal(numFst,"%.0lf")),
//    SetOfText("PIC.MAX", FormatReal(numLst,"%.0lf")),
      
      SetOfText("PIC.LST", BinGroup("+",picRep)),

      PagTranslation(eng, lstPth)
    ]] << yeaRep
       << yeaMrk
       << PagGalleryLabel(eng, keySel);

    Text filWri = WriteFile(lstPth, ReplaceTable(lstHtm, repTab));
    TRUE
  });
  Card(lstSet)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Creates and writes the html file for the list page of 16 pictures.",
PagCicle);
//////////////////////////////////////////////////////////////////////////////

Real PagSel()

//////////////////////////////////////////////////////////////////////////////
Real PagSel(Real eng, 
            Set  inpPdb, 
            Text keySel,
            Set  yeaRep,
            Text pagSee)
//////////////////////////////////////////////////////////////////////////////
{
  Text WriteLn(PdbSep+"\nbuilding "+If(eng,"english","spanish")+" pages...");

  Real zoo = PagZoom (eng, inpPdb, keySel, yeaRep, PagDir(eng), pagSee);
  Real cic = PagCicle(eng, inpPdb, keySel, yeaRep, PagDir(eng), pagSee);
  Real lst = PagList (eng, inpPdb, keySel, yeaRep, PagDir(eng), pagSee);

  zoo+cic+lst
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Creates and writes html files for zoom, cicle and list pages.",
PagSel);
//////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
Real PagJavascriptDB(Real eng,     // Language english/spanish
                     Set  inpPdb,  // Pictures database
                     Text outDir,  // Output directory
                     Text pthSee)  // Seed file
//////////////////////////////////////////////////////////////////////////////
{
  Text WriteLn("PagJavascriptDB: "+PagGal+" -> ");

  Text budJsc = ReadFile(pthSee);     // Javascript seed
  Text budPth = outDir+"/"+PagGal+If(eng,"dbenglish",        // Big DB eng
                                         "dbspanish")+".js"; // Big DB spa
  Text tudPth = outDir+"/"+PagGal+If(eng,"dtenglish",        // Tiny DB eng
                                         "dtspanish")+".js"; // Tiny DB spa
  Text WriteLn(" ->"+budPth);
  Text WriteLn(" ->"+tudPth);
  
  Text fstLin = "// Inkwatercolor pictures javascript database "+
                "PdbLan = "+If(eng, "'english'", "'spanish'")+";";
  Text budWri = WriteFile(budPth, fstLin+" (big)\n");
  Text tudWri = WriteFile(tudPth, fstLin+" (tiny)\n");
  
  Real maxReg = Card(inpPdb);

  Set  cicSet = For(1, maxReg, Real(Real numReg)
  {
    Set  picReg = inpPdb[numReg];
    
    Text numTxt = PagNumInt(picReg->picNum, TRUE);
    Text lngTit = PagLongTitle(eng, picReg->picTit);
    Text shrTit = PagShortTitle(eng, picReg->picTit);
    Text dteTxt = FormatDate(picReg->endDte,"%c%Y/%m/%d");
    Text dteFmt = If(eng, "painted in", "pintado en") +" "+dteTxt+" "+
                  If(eng, "with number", "con número")+" "+numTxt;
    Text picJpg = PagGal+"/image/tiny/"+picReg->jpgFil;
    Text lngTec = ReplaceTable(
                    PagTechnique(eng, picReg, TRUE); // Long technique
                    [[ [["&amp;", "&"]], [["<i> </i>", " "]] ]]); // No html
    Text shrTec = ReplaceTable(
                    PagTechnique(eng, picReg, FALSE); // Short technique
                    [[ [["&amp;", "&"]], [["<i> </i>", " "]] ]]); // No html
    Real priBas = 100 *
                  If(IsUnknown(picReg->wrkTim), 0, picReg->wrkTim) *
                  If(IsUnknown(picReg->wrkQly), 0, picReg->wrkQly);
    Text priTxt = FormatReal(priBas, "%.0lf");

    Set repTab =  
    [[
      SetOfText("PIC.NUM", numTxt),
      SetOfText("PIC.DTE", dteFmt),
      SetOfText("PIC.JPG", picJpg),
      SetOfText("PRI.BAS", priTxt)
    ]];

    Set repBig =  
    [[
      SetOfText("PIC.TIT", lngTit),
      SetOfText("PIC.TEC", lngTec)
    ]] << repTab;

    Set repTin =  
    [[
      SetOfText("PIC.TIT", shrTit),
      SetOfText("PIC.TEC", shrTec)
    ]] << repTab;

    Text budApp = AppendFile(budPth, ReplaceTable(budJsc, repBig));
    Text tudApp = AppendFile(tudPth, ReplaceTable(budJsc, repTin));
    TRUE
  });
  Card(cicSet)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Creates and writes a Javascript database of the pictures.",
PagSel);
//////////////////////////////////////////////////////////////////////////////

Time oriented language

//////////////////////////////////////////////////////////////////////////////
// FILE    : pag.tol
// AUTHOR  : http://www.asolver.com
// PURPOSE : Page functions.
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
// CONSTANTS
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
Real PagPic    =  4;
//////////////////////////////////////////////////////////////////////////////
PutDescription("Pictures per page.", PagPic);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Real PagLst    = 32;
//////////////////////////////////////////////////////////////////////////////
PutDescription("Lines per list page.", PagLst);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Real PagMinChr =  2; 
//////////////////////////////////////////////////////////////////////////////
PutDescription("With less than 2 chars is not a keyword.", PagMinChr);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Real PagTitMax = 99;
//////////////////////////////////////////////////////////////////////////////
PutDescription("Maximum length for a title.", PagTitMax);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
Text PagPage(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "pag"+If(eng, "e", "s") };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the pages directory.", PagPage);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagDir(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "web/"+PagGal+"/"+PagPage(eng) };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the pages full path.", PagDir);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagSee(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "web/"+PagGal+"/sed"+If(eng, "e", "s") };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the seeds directory.", PagSee);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagSeePi1(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "seedpi1"+If(eng, "eng", "spa")+".htm" };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the page for zoom.", PagSeePi1);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagSeePi4(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "seedpi4"+If(eng, "eng", "spa")+".htm" };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the page for tinys.", PagSeePi4);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagSeeLst(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "seedlst"+If(eng, "eng", "spa")+".htm" };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the page for list.", PagSeePi4);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagSeeInf(Real eng)
//////////////////////////////////////////////////////////////////////////////
{ "seedinf"+If(eng, "eng", "spa")+".htm" };
//////////////////////////////////////////////////////////////////////////////
PutDescription("Returns the page for info.", PagSeeInf);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Real PagIsBilingual(Text txt) // Text
//////////////////////////////////////////////////////////////////////////////
{ And(TextFind(txt,"{"), TextFind(txt,"|"), TextFind(txt,"}")) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns true if the text is in english and spanish",
PagIsBilingual);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagLanguage(Real eng, // True if english
                 Text txt) // Text
//////////////////////////////////////////////////////////////////////////////
{ 
  If(! PagIsBilingual(txt), txt,                // There aren't traduction
  If(eng, TxtBetween2Tag(txt, "{", "|", TRUE),  // English
          TxtBetween2Tag(txt, "|", "}", TRUE))) // Spanish
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"If eng==true returns the english text, if eng=false the spanish text and
if the text is not bilingual then return the text.",
PagLanguage);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagLongTitle(Real eng, // True if english
                  Text tit) // Tittle
//////////////////////////////////////////////////////////////////////////////
{ ReplaceTable(PagLanguage(eng, tit), [[ [["(", ""]], [[")", ""]] ]]) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the long title, the full title without the () that are the tags of
the sort title.",
PagLongTitle);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagShortTitle(Real eng, // True if english
                   Text tit) // Tittle
//////////////////////////////////////////////////////////////////////////////
{
  Text txt = PagLanguage(eng, tit);
  If(TextFind(txt, "("), TxtBetween2Tag(txt, "(", ")", TRUE), // ()
  If(TextFind(txt, "["), TxtBetween2Tag(txt, "[", "]", TRUE), // []
     txt))
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the long title, the title inside the ()  or [].",
PagShortTitle);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagNumInt(Real picNum, Real zero)
//////////////////////////////////////////////////////////////////////////////
{ If(zero, FormatReal(picNum, "%04.0lf"), FormatReal(picNum, "%.0lf")) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the number of a page in text format, if zero=true 0009 and if
zero=false then 9.",
PagNumInt);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagNameInt(Text prefix, Real picNum)
//////////////////////////////////////////////////////////////////////////////
{ prefix+PagNumInt(picNum, TRUE)+".htm" };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the name of a page giving a prefix and a picture number.",
PagNameInt);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagName(Text prefix, Set picReg)
//////////////////////////////////////////////////////////////////////////////
{ PagNameInt(prefix, picReg->picNum) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the name of a page giving a prefix and a picture register.",
PagName);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Real PagPicInLst(Real picNum)
//////////////////////////////////////////////////////////////////////////////
{ If(EQ(picNum%PagLst, 0), picNum/PagLst, 1+Floor(picNum/PagLst)) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the number of list page (format of several pics per list page) in
witch the picture picNum must be inserted.",
PagPicInLst);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Real PagPicInPag(Real picNum)
//////////////////////////////////////////////////////////////////////////////
{ If(EQ(picNum%PagPic, 0), picNum/PagPic, 1+Floor(picNum/PagPic)) };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the number of page (format of several pics per page) in witch the
picture picNum must be inserted.",
PagPicInPag);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Set PagPicFriends(Real ordReg, // A pic order number
                  Set  inpPdb) // Pictures database
//////////////////////////////////////////////////////////////////////////////
{
  Real numPag = PagPicInPag(ordReg); // Find the page
  Real maxReg = Card(inpPdb);        // Maximum of pics
  Set  picRep = For(1, PagPic, Set(Real picPos)
  {
    Real numReg = ((numPag-1)*PagPic)+picPos;
    If(GT(numReg,maxReg), Empty, inpPdb[numReg])
  });
  Select(picRep, Real(Set reg) { Card(reg) }) // Not empty regs
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the set of pics that are in the same page.",
PagPicFriends);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagLongTitFriends(Real eng,    // English/Spanish
                       Real ordReg, // A pic order number
                       Set  inpPdb) // Pictures database
//////////////////////////////////////////////////////////////////////////////
{
  Set frdSet = PagPicFriends(ordReg, inpPdb);
  Set titSet = EvalSet(frdSet, Text(Set frdReg)
               { PagLongTitle(eng, frdReg->picTit) });
  Set2TxtCommaAmp(titSet)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns a text title formed by union of the long titles of pics that are in
the same page.",
PagLongTitFriends);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagShortTitFriends(Real eng,    // English/Spanish
                        Real ordReg, // A pic order number
                        Set  inpPdb) // Pictures database
//////////////////////////////////////////////////////////////////////////////
{
  Set frdSet = PagPicFriends(ordReg, inpPdb);
  Set titSet = EvalSet(frdSet, Text(Set frdReg)
               { PagShortTitle(eng, frdReg->picTit) });
  Set2TxtCommaAmp(titSet)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns a text title formed by union of the short titles of pics that are in
the same page.",
PagShortTitFriends);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Real PagFirstFriend(Real numPag, // Page number
                    Set  inpPdb) // Pictures database
//////////////////////////////////////////////////////////////////////////////
{ ((numPag-1)*PagPic)+1 };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the number of the register that is the first (friend) a page of
pictures.",
PagFirstFriend);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Real PagFirstList(Real numPag, // Page number
                  Set  inpPdb) // Pictures database
//////////////////////////////////////////////////////////////////////////////
{ ((numPag-1)*PagLst)+1 };
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the number of the register that is the first of a list of pictures.",
PagFirstList);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text PagTechnique(Real eng,    // English/Spanish
                  Set  picReg, // A pic register
                  Real long)   // If True then long technique
//////////////////////////////////////////////////////////////////////////////
{
  Text traFun(Text txt, Real eng, Real fem)
  {
    If(eng, txt,
    {
      Set  tab = [[
      [["diffusion of alcohol fire", "difusión de fuego de alcohol"]],
      [["rubbed with alcohol",       "frotado con alcohol"]],
      [["Fabriano paper",            "papel Fabriano"]],
      [["marker's ink",              "tinta de rotulador"]],
      [["couché paper",              "papel couché"]],
      [["mixed media",               "técnicas mixtas"]],
      [["golden brown",              "marrón "+If(fem, "dorada", "dorado")]],
      [["aerograph",                 "aerógrafo"]],
      [["watercolor",                "acuarela"]],
      [["cotton",                    "algodón"]],
      [["orange",                    "naranja"]],
      [["marker",                    "rotulador"]],
      [["violet",                    "violeta"]],
      [["white",                     If(fem, "blanca", "blanco")]],
      [["yellow",                    If(fem, "amarilla", "amarillo")]],
      [["green",                     "verde"]],
      [["brown",                     "marrón"]],
      [["black",                     If(fem, "negra", "negro")]],
      [["grey",                      "gris"]],
      [["light blue",                "azul claro"]],
      [["blue",                      "azul"]],
      [["cyan",                      "cian"]],
      [["pink",                      "rosa"]],
      [["red",                       If(fem, "roja", "rojo")]],
      [["ink",                       "tinta"]], // pink ?
      [["and",                       "y"]],
      [["&amp;",                     "y"]] ]];
      SetReplaceTable(txt, tab, 1)   // Recursive secuential replacement
    })
  };  

  Text tecCol(Set tecSet, Set colSet, Real fem)
  {
    If(tecSet[1]=="", "",
    {
      Text colTxt = Set2TxtCommaAmp(colSet);
      Text tecTxt = Set2TxtCommaAmp(tecSet);
      Text tecCol =
        If(!long, tecTxt,
        If(eng, colTxt+" "+tecTxt, tecTxt+" "+colTxt));
      traFun(Compact(tecCol), eng, fem)
    })
  };       
         
  Text forTxt = tecCol(picReg->forTec, picReg->forCol, TRUE); // Femenine
  Text bckTxt = tecCol(picReg->bckTec, picReg->bckCol, TRUE); // Femenine
  Text papTxt = If(! long, "",
                   tecCol(picReg->papTec, picReg->papCol, FALSE)+" "+ // Masculine
                   "("+FormatReal(picReg->picWid,"%.0lf")+"<i> </i>x<i> </i>"+
                   FormatReal(picReg->picHei,"%.0lf")+"<i> </i>mms)");

  Text sepF2b = If(eng, " over ", " sobre ");
  Text sepB2p = If(eng, " on ",   " en ");

  Text tecTxt = Case(
    And(forTxt!="", bckTxt!="", papTxt!=""), forTxt+sepF2b+bckTxt+sepB2p+papTxt,
    And(forTxt=="", bckTxt!="", papTxt!=""),               bckTxt+sepB2p+papTxt,
    And(forTxt!="", bckTxt=="", papTxt!=""), forTxt              +sepB2p+papTxt,
    And(forTxt!="", bckTxt!="", papTxt==""), forTxt+sepF2b+bckTxt              ,
    TRUE /* only 1 of the 3 */             , forTxt       +bckTxt       +papTxt);

  tecTxt
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the pictore technique in a short or long way.",
PagTechnique);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Set PagYearTab(Real eng,
               Set  inpPdb,
               Text keySel)
//////////////////////////////////////////////////////////////////////////////
{
  Text pthOld = "../../chppho/"+PagPage(eng)+"/";
  Text pthGal = "../../"+PagGal+"/"+PagPage(eng)+"/";

  Set  claPdb = Classify(inpPdb, Real(Set a, Set b)
                { Compare(Year(a->endDte),Year(b->endDte)) });
  Set  fstPdb = EvalSet(claPdb, Set(Set cla)
  { Sort(cla,Real(Set a, Set b){ Compare(a->endDte,b->endDte) })[1] });

  Set  yeaRep = For(1980,2010, Set(Real yeaNum)
  {
    Set  yeaSet = Select(fstPdb, Real(Set a) { EQ(Year(a->endDte),yeaNum) });
    Real crdSet = Card(yeaSet);
    Text yeaTxt = FormatReal(yeaNum,"%.0lf");
    Text yeaOld = "<a href='"+pthOld+"AN."+yeaTxt+"'>"+yeaTxt+"</a>";
    Set  repTwo =
       If(NE(crdSet,1), 
         SetOfText(yeaOld, // Si no hay cuadros para el año no pone nada
           ""),
         SetOfText(yeaOld, // Si hay cuadros para el año cambia el link
           "<a href='"+pthGal+PagName(keySel+"zoo", yeaSet[1])+"'>"+yeaTxt+"</a>"));

    // Cambiar comillas simples por dobles como todo el mundo en internet
    SetOfText(repTwo[1], Replace(repTwo[2], "'", Char(34)))
  })
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns a replacement table for the years index.",
PagYearTab);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Set PagYearMnu(Set picReg)
//////////////////////////////////////////////////////////////////////////////
{
  Text dte = FormatDate(picReg->endDte,"%c%Y/%m/%d");
  Text yea = Sub(dte,1,4);
  SetOfText("<td class='navAMn'><!-- "+yea+" -->",   // Marcar el año
            "<td class='navOMn'><!-- "+yea+" -->")   // en curso
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns a replacement tuble for a year of the years index.",
PagYearMnu);
//////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
Set PagTranslation(Real eng,    // Language english/spanish
                   Text htmPth) // Html file
//////////////////////////////////////////////////////////////////////////////
{
  Text Q      = Char(34);
  Text notTra =
    "<img src="+Q+"../../common/gif/block.gif"+Q+" width='100%' />";
  Text hlpTxt = " ("+If(eng,"translate to Spanish",
                            "traducir al inglés")+")";

  Text yesTra(Text url, Text tit)
  {
    "<a href="+Q+url+Q+">"+
    "<img src="+Q+"../../common/gif/translsta.gif"+Q+
    " width='100%'"+
    " name="+Q+"traBut"+Q+
    " border='0' "+
    " alt="+Q+tit+hlpTxt+Q+" "+
    " onmouseover="+Q+"document.traBut.src='../../common/gif/translact.gif';"+Q+ 
    " onmouseout ="+Q+"document.traBut.src='../../common/gif/translsta.gif';"+Q+
    " /></a>"
  };

  Text traPth = Replace(htmPth, PagPage( eng), PagPage(!eng));

  If(! FileExist(traPth), [[ "TRA.COD", notTra ]],
  {
    Text traHtm = ReadFile(traPth);
    Text traUrl = Replace(htmPth, PagDir(eng), "../"+PagPage(!eng));
    Text traTit = TxtBetween2Tag(traHtm, "<title>", "</title>", TRUE);
    [[ "TRA.COD", yesTra(traUrl, traTit) ]]
  })
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the Html code that link each page wit it translation.",
PagTranslation);
//////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
Set PagGalleryLabel(Real eng,     // Language english/spanish
                    Text keySel)  // Selector
//////////////////////////////////////////////////////////////////////////////
{
  [[
    SetOfText("GAL.NAM",
             If(PagGal=="inarmy", If(eng, "ink in the army",
                                          "tinta en la mili"),
             If(PagGal=="fleurs", If(eng, "the flowers of evil",
                                          "las flores del mal"),
                                  If(eng, "ink and watercolor",
                                          "tinta y acuarela")))), 
    SetOfText("GAL.KEY", 
             If(keySel=="sad", If(eng, "[all]",         "[completo]"),
             If(keySel=="upd", If(eng, "[new]",         "[nuevo]"),
             If(keySel=="inx", If(eng, "[index]",       "[índice]"),
             If(keySel=="inf", If(eng, "[information]", "[información]"),
                               If(eng, "[error]",       "[error]"))))))
  ]]
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns a pair of labels for an art gallery.",
PagGalleryLabel);
//////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
Real PagZoom(Real eng,     // Language english/spanish
             Set  inpPdb,  // Pictures database
             Text keySel,  // Selector
             Set  yeaRep,  // Year map
             Text outDir,  // Output directory
             Text pthSee)  // Seed file
//////////////////////////////////////////////////////////////////////////////
{
  Text WriteLn("Zoom  for: "+keySel);

  Text zooSee = pthSee+"/"+PagSeePi1(eng);
  Text zooHtm = ReadFile(zooSee);
  Text notNow = "../../common/gif/notnowzoo.gif";
  Real maxReg = Card(inpPdb);

  Text iniFil = PagName(keySel+"zoo", inpPdb[1]);
  Text iniTit = PagLongTitle(eng, inpPdb[1]->picTit);

  Text endFil = PagName(keySel+"zoo", inpPdb[maxReg]);
  Text endTit = PagLongTitle(eng, inpPdb[maxReg]->picTit);

  Set  cicSet = For(1, maxReg, Real(Real numReg)
  {
    Set  picReg = inpPdb[numReg];
    Text lngTit = PagLongTitle(eng, picReg->picTit);
    Text numTxt = PagNumInt(picReg->picNum, TRUE);  // 0099
    Text numTxB = PagNumInt(picReg->picNum, FALSE); // 99
    Text dteTxt = FormatDate(picReg->endDte,"%c%Y/%m/%d");
    Text yeaTxt = Sub(dteTxt,1, 4);
    Text dteTxB = Replace(dteTxt,"/", "<i> </i>/<i> </i>"); /* very little */
    Text traRem = PagLanguage(eng, picReg->picRem);

    Text zooFil = PagName   (keySel+"zoo", picReg);
    Text zooPth = outDir+"/"+zooFil;

    Text zooJpg = "web/"+PagGal+"/image/zoom/"+picReg->jpgFil;

    // Realmente sobra ya que si no hay imagen no crea ni la pagina
    Real zooExi = FileExist(zooJpg); 

    Text picKey = Set2TxtKeyword([[lngTit, traRem]] + // Keywords
                                   picReg->bckTec   +
                                   picReg->forTec,
                                   PagMinChr, TRUE);

    Text nxtFil = PagName(keySel+"zoo", inpPdb[Min(maxReg,numReg+1)]);
    Text nxtTit = PagLongTitle(eng, inpPdb[Min(maxReg,numReg+1) ]->picTit);

//  http://www.baudelaire.cz/works.html?aID=100&artID=2 Frances
//  http://www.baudelaire.cz/works.html?aID=200&artID=2 Ingles
//  until 102 That kind heart you were jealous of... ok
//  but for me Mists and Rains is the 103 and baudelaire.cz jump to 137

    Text cz.bau = If(PagGal!="fleurs", "",
    {
      Text cz.txt = "<br /><br />" +
                    If(eng, "Full poem at ", "Poema completo en ");
      Text cz.lan = If(eng, "200", "100");
      Text lnk.cz = cz.txt+
                    "<a href='http://www.baudelaire.cz/works.html?aID="+
                    cz.lan+"&amp;artID="+numTxB+"'>baudelaire.cz</a>";
      lnk.cz
    });

    Set repTab =  
    [[
      SetOfText("WIN.TIT", lngTit),
      SetOfText("MET.DES", lngTit+" ("+dteTxt+")"),
      SetOfText("MET.KEY", picKey),
      SetOfText("PAG.TIT", lngTit),

      SetOfText("JPG.FIL", If(zooExi, "../image/zoom/"+picReg->jpgFil,
                                      notNow)),

      SetOfText("URL.INI", iniFil),
      SetOfText("URL.B10", PagName   (keySel+"zoo", inpPdb[Max(1,     numReg-10)])),
      SetOfText("URL.PRE", PagName   (keySel+"zoo", inpPdb[Max(1,     numReg-1) ])),
      SetOfText("URL.CIC", PagNameInt(keySel+"cic", PagPicInPag(numReg))),
      SetOfText("URL.NXT", nxtFil),
      SetOfText("URL.F10", PagName   (keySel+"zoo", inpPdb[Min(maxReg,numReg+10)])),
      SetOfText("URL.END", endFil),

      SetOfText("TIT.INI", iniTit),
      SetOfText("TIT.B10", PagLongTitle(eng, inpPdb[Max(1,     numReg-10)]->picTit)),
      SetOfText("TIT.PRE", PagLongTitle(eng, inpPdb[Max(1,     numReg-1) ]->picTit)),
      SetOfText("TIT.CIC", PagShortTitFriends(eng, numReg, inpPdb)),
      SetOfText("TIT.NXT", nxtTit),
      SetOfText("TIT.F10", PagLongTitle(eng, inpPdb[Min(maxReg,numReg+10)]->picTit)),
      SetOfText("TIT.END", endTit),


// Forms page free images and budgets
      SetOfText("URL.FRE", "../../chppho/"+If(eng, "page", "pags")+
                           "/inffeeimg.htm?pn="+numTxt), // Free image
      SetOfText("URL.BDG", "../../chppho/"+If(eng, "page", "pags")+
                           "/inffeebdg.htm?pn="+numTxt), // Budgets 
      SetOfText("TIT.FRE", If(eng, "free image of ",      
                                   "imagen gratis de ")+lngTit), 
      SetOfText("TIT.BDG", If(eng, "price for the original painting ",
                                   "precio para la obra original ")+lngTit), 

      SetOfText("LOW.001",
      {
        lngTit                                   +", "+
        If(eng, "painted in", "pintado en")      +" "+
        dteTxB                                   +" "+
        If(keySel!="sad", "",
           If(eng, "with number", "con número")  +" "+
           numTxt)
      }),

      SetOfText("LOW.002", Text PagTechnique(eng, picReg, TRUE)),

      SetOfText("LOW.003",
      {
        If(eng, "painting viewed", "pintura vista")+" "+
        FormatReal(picReg->picPrn,"%.0lf")         +" "+
        If(eng, "times", "veces")
      }),

      SetOfText("LOW.004",
      {
        If(eng, "next", "siguiente")+": "+
        "<a href="+Char(34)+nxtFil+Char(34)+">"+
                            nxtTit+"</a>"
      }),

      SetOfText("LOW.LST", traRem+cz.bau),

      PagTranslation(eng, zooPth),

      PagYearMnu(picReg)

    ]]<<
      PagGalleryLabel(eng, keySel);

    Text filWri = WriteFile(zooPth, ReplaceTable(zooHtm, repTab<<yeaRep));
    TRUE
  });
  Card(cicSet)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Creates and writes the html file for the zoom page of a picture.",
PagZoom);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Real PagCicle(Real eng,    // Language
              Set  inpPdb, // Picture database
              Text keySel, // Selector
              Set  yeaRep, // Year map
              Text outDir, // Output directory
              Text pthSee) // Seed path
//////////////////////////////////////////////////////////////////////////////
{
  Text WriteLn("Cicle for: "+keySel);

  Text defNot = "../../common/gif/notnowtin.gif";

  Real maxReg = Card(inpPdb);
  Real maxPag = PagPicInPag(maxReg);

  Text cicSee = pthSee+"/"+PagSeePi4(eng);
  Text cicHtm = ReadFile(cicSee);

  Text iniFil = PagNameInt(keySel+"cic", 1);
  Text endFil = PagNameInt(keySel+"cic", maxPag);
  Text iniAlt = PagShortTitFriends(eng, 1,      inpPdb);
  Text endAlt = PagShortTitFriends(eng, maxReg, inpPdb);

  Set  cicSet = For(1, maxPag, Real(Real numPag)
  {
    // Movimientos de pagina adelante y atras
    Real b10Pag = Max(1,      numPag-10);
    Real prePag = Max(1,      numPag-1);
    Real nxtPag = Min(maxPag, numPag+1);
    Real f10Pag = Min(maxPag, numPag+10);

    Text b10Fil = PagNameInt(keySel+"cic", b10Pag);
    Text preFil = PagNameInt(keySel+"cic", prePag);
    Text nxtFil = PagNameInt(keySel+"cic", nxtPag);
    Text f10Fil = PagNameInt(keySel+"cic", f10Pag);

    // Años en curso a los que pertenecen las imagenes
    Real numFst = PagFirstFriend(numPag, inpPdb); // El primero marca año
    Set  picFst = inpPdb[numFst];                 // El registro
    Set  picLst = inpPdb[Min(maxReg,((numPag-1)*PagPic)+PagPic)]; // Ultimo
    Set  yeaMrk = If(EQ(Year(picFst->endDte),Year(picLst->endDte)),
    [[PagYearMnu(picFst)]],  // Marcar el año en curso
    [[PagYearMnu(picFst),    // Marcar el año ini en curso
      PagYearMnu(picLst)]]); // Marcar el año end en curso

    Set  picRep = For(1, PagPic, Set(Real picPos)
    {
      Real numReg = ((numPag-1)*PagPic)+picPos;
      Text pos3Tx = FormatReal(picPos,"%1.0lf");
      If(LE(numReg,maxReg),
      {

        Text jpgPth =
        If(FileExist("web/"+PagGal+"/image/tiny/"+inpPdb[numReg]->jpgFil),
           "../image/tiny/"+inpPdb[numReg]->jpgFil,
           defNot);

        [[
          SetOfText("ZOO."+pos3Tx, PagName(keySel+"zoo", inpPdb[numReg])),
          SetOfText("PIC."+pos3Tx, jpgPth),
          SetOfText("TIT."+pos3Tx, PagLongTitle(eng, inpPdb[numReg]->picTit)),
          SetOfText("TEC."+pos3Tx, "<b>"+PagTechnique(eng, inpPdb[numReg], FALSE)+"</b>")
        ]]
      },
      {
        [[
          SetOfText(Replace("<li><a href="+Char(34)+"ZOO._N_"+Char(34)+">TIT._N_</a>: TEC._N_","_N_",pos3Tx), ""),
          SetOfText("ZOO."+pos3Tx, "#"), // The same page
          SetOfText("PIC."+pos3Tx, defNot),
          SetOfText("TIT."+pos3Tx, ""),
          SetOfText("TEC."+pos3Tx, "")
        
        ]]
      })
    });

//        SetOfText(Replace(defZoo,"_N_",pos3Tx), defNot),

    Text cicFil = PagNameInt(keySel+"cic", numPag);
    Text cicPth = outDir+"/"+cicFil;

    Text frdLng = PagLongTitFriends (eng, numFst, inpPdb);
    Text frdShr = PagShortTitFriends(eng, numFst, inpPdb);
    Text frdS80 = If(LE(TextLength(frdShr),PagTitMax), frdShr,
                  If(eng, "a free art gallery showcasing ink and watercolor paintings",
                          "una galería de arte libre con pinturas de tinta y acuarela")),

    Set  keySet = EvalSet(PagPicFriends(numFst, inpPdb), Set(Set reg)
                  { reg->bckTec + reg->forTec });
    Text keyRep = Set2TxtKeyword(BinGroup("<<",keySet)+[[frdLng]], PagMinChr, TRUE);

    Set repTab =  
    [[
      SetOfText("WIN.TIT", frdShr),
      SetOfText("MET.DES", frdLng),
      SetOfText("MET.KEY", keyRep),
      SetOfText("PAG.TIT", frdS80),

      SetOfText("URL.INI", iniFil),
      SetOfText("URL.B10", b10Fil),
      SetOfText("URL.PRE", preFil),
      SetOfText("URL.LST", PagNameInt(keySel+"lst", PagPicInLst(numFst))),
      SetOfText("URL.NXT", nxtFil),
      SetOfText("URL.F10", f10Fil),
      SetOfText("URL.END", endFil),

      SetOfText("TIT.INI", iniAlt),
      SetOfText("TIT.B10", PagShortTitFriends(eng, PagFirstFriend(b10Pag, inpPdb), inpPdb)),
      SetOfText("TIT.PRE", PagShortTitFriends(eng, PagFirstFriend(prePag, inpPdb), inpPdb)),
      SetOfText("TIT.LST", If(eng, "gallery listing of paintings",
                                   "listado de cuadros de la galería")),
      SetOfText("TIT.NXT", PagShortTitFriends(eng, PagFirstFriend(nxtPag, inpPdb), inpPdb)),
      SetOfText("TIT.F10", PagShortTitFriends(eng, PagFirstFriend(f10Pag, inpPdb), inpPdb)),
      SetOfText("TIT.END", endAlt),

// Forms page free images and budgets (without any number)
      SetOfText("URL.FRE", "../../chppho/"+If(eng, "page", "pags")+
                           "/inffeeimg.htm"), // Free image
      SetOfText("URL.BDG", "../../chppho/"+If(eng, "page", "pags")+
                           "/inffeebdg.htm"), // Budgets 
      SetOfText("TIT.FRE", If(eng, "ask for free images",      // Free image (alt)
                                   "pedir imágenes gratis")), 
      SetOfText("TIT.BDG", If(eng, "ask for the prices of the originals",
                                   "pedir precios para la obra original")), 

      PagTranslation(eng, cicPth)
    ]] << BinGroup("<<",picRep)
       << yeaRep
       << yeaMrk
       << PagGalleryLabel(eng, keySel);

    Text filWri = WriteFile(cicPth, ReplaceTable(cicHtm, repTab));
    TRUE
  });
  Card(cicSet)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Creates and writes the html file for the cicle page of 4 pictures.",
PagCicle);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Real PagList(Real eng,    // Language
             Set  inpPdb, // Picture database
             Text keySel, // Selector
             Set  yeaRep, // Year map
             Text outDir, // Output directory
             Text pthSee) // Seed path
//////////////////////////////////////////////////////////////////////////////
{
  Text WriteLn("List  for: "+keySel);

  Real maxReg = Card(inpPdb);
  Real maxPag = PagPicInLst(maxReg);

  Text lstSee = pthSee+"/"+PagSeeLst(eng);
  Text lstHtm = ReadFile(lstSee);

  Text iniFil = PagNameInt(keySel+"lst", 1);
  Text endFil = PagNameInt(keySel+"lst", maxPag);

  Set  lstSet = For(1, maxPag, Real(Real numPag)
  {
    // Movimientos de pagina adelante y atras
    Real b10Pag = Max(1,      numPag-2);
    Real prePag = Max(1,      numPag-1);
    Real nxtPag = Min(maxPag, numPag+1);
    Real f10Pag = Min(maxPag, numPag+2);

    Text b10Fil = PagNameInt(keySel+"lst", b10Pag);
    Text preFil = PagNameInt(keySel+"lst", prePag);
    Text nxtFil = PagNameInt(keySel+"lst", nxtPag);
    Text f10Fil = PagNameInt(keySel+"lst", f10Pag);

    // Años en curso a los que pertenecen las imagenes
    Real numFst = PagFirstList(numPag, inpPdb);   // El primero marca año
    Set  picFst = inpPdb[numFst];                 // El registro
    Real numLst = Min(maxReg,((numPag-1)*PagLst)+PagLst); // Ultimo
    Set  picLst = inpPdb[numLst]; // Ultimo
    Set  yeaMrk = If(EQ(Year(picFst->endDte),Year(picLst->endDte)),
    [[PagYearMnu(picFst)]],  // Marcar el año en curso
    [[PagYearMnu(picFst),    // Marcar el año ini en curso
      PagYearMnu(picLst)]]); // Marcar el año end en curso

    Set  picRep = For(1, PagLst, Text(Real picPos)
    {
      Real numReg = ((numPag-1)*PagLst)+picPos;
      If(GT(numReg,maxReg), "",
      {
        Text url = PagName(keySel+"zoo", inpPdb[numReg]);
        Text tit = PagLongTitle(eng, inpPdb[numReg]->picTit);
        Text srt = PagShortTitle(eng, inpPdb[numReg]->picTit);
        Text lnk = "<a href="+Char(34)+url+Char(34)+">"+srt+"</a>";
        Text lin = "<li>"+Replace(tit, srt, lnk)+"</li>\n"
      })
    });


    Text lstFil = PagNameInt(keySel+"lst", numPag);
    Text lstPth = outDir+"/"+lstFil;

    Set  keyCic = For(1, PagLst, Text(Real picPos)
    {
      Real numReg = ((numPag-1)*PagLst)+picPos;
      If(GT(numReg,maxReg), "", PagLongTitle(eng, inpPdb[numReg]->picTit))
    });
    Text keyRep = Set2TxtKeyword(keyCic, 6, TRUE);  // Minimum 6 ordered
    Text keyTit = Set2TxtKeyword(keyCic, 7, FALSE); // Minimum 7 not ordered
    // Buscar la primera coma con blanco antes de la longitud maxima del titulo
    Text pagTit = Sub(keyTit, 1, TextFind(keyTit, ", ", PagTitMax, 1, -1))+"...";

    Set repTab =  
    [[
      SetOfText("WIN.TIT", pagTit),
      SetOfText("MET.DES", pagTit),
      SetOfText("MET.KEY", keyRep),
      SetOfText("PAG.TIT", pagTit),


      SetOfText("URL.INI", iniFil),
      SetOfText("URL.B10", b10Fil),
      SetOfText("URL.PRE", preFil),
      SetOfText("ZOO.1",   PagName(keySel+"zoo", picFst)),
      SetOfText("URL.NXT", nxtFil),
      SetOfText("URL.F10", f10Fil),
      SetOfText("URL.END", endFil),

      SetOfText("TIT.INI", If(eng, "begin of gallery listing",
                                   "inicio del listado de la galería")),
      SetOfText("TIT.B10", "-2"),
      SetOfText("TIT.PRE", "previous"),
      SetOfText("TIT.ZOM", PagLongTitle(eng, picFst->picTit)),
      SetOfText("TIT.NXT", "next"),
      SetOfText("TIT.F10", "+2"),
      SetOfText("TIT.END", If(eng, "end of gallery listing",
                                   "final del listado de la galería")),

// Forms page free images and budgets (without any number)
      SetOfText("URL.FRE", "../../chppho/"+If(eng, "page", "pags")+
                           "/inffeeimg.htm"), // Free image
      SetOfText("URL.BDG", "../../chppho/"+If(eng, "page", "pags")+
                           "/inffeebdg.htm"), // Budgets 
      SetOfText("TIT.FRE", If(eng, "ask for free images",      // Free image (alt)
                                   "pedir imágenes gratis")), 
      SetOfText("TIT.BDG", If(eng, "ask for the prices of the originals",
                                   "pedir precios para la obra original")), 

//    SetOfText("PIC.MIN", FormatReal(numFst,"%.0lf")),
//    SetOfText("PIC.MAX", FormatReal(numLst,"%.0lf")),
      
      SetOfText("PIC.LST", BinGroup("+",picRep)),

      PagTranslation(eng, lstPth)
    ]] << yeaRep
       << yeaMrk
       << PagGalleryLabel(eng, keySel);

    Text filWri = WriteFile(lstPth, ReplaceTable(lstHtm, repTab));
    TRUE
  });
  Card(lstSet)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Creates and writes the html file for the list page of 16 pictures.",
PagCicle);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Real PagSel(Real eng, 
            Set  inpPdb, 
            Text keySel,
            Set  yeaRep,
            Text pagSee)
//////////////////////////////////////////////////////////////////////////////
{
  Text WriteLn(PdbSep+"\nbuilding "+If(eng,"english","spanish")+" pages...");

  Real zoo = PagZoom (eng, inpPdb, keySel, yeaRep, PagDir(eng), pagSee);
  Real cic = PagCicle(eng, inpPdb, keySel, yeaRep, PagDir(eng), pagSee);
  Real lst = PagList (eng, inpPdb, keySel, yeaRep, PagDir(eng), pagSee);

  zoo+cic+lst
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Creates and writes html files for zoom, cicle and list pages.",
PagSel);
//////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
Real PagJavascriptDB(Real eng,     // Language english/spanish
                     Set  inpPdb,  // Pictures database
                     Text outDir,  // Output directory
                     Text pthSee)  // Seed file
//////////////////////////////////////////////////////////////////////////////
{
  Text WriteLn("PagJavascriptDB: "+PagGal+" -> ");

  Text budJsc = ReadFile(pthSee);     // Javascript seed
  Text budPth = outDir+"/"+PagGal+If(eng,"dbenglish",        // Big DB eng
                                         "dbspanish")+".js"; // Big DB spa
  Text tudPth = outDir+"/"+PagGal+If(eng,"dtenglish",        // Tiny DB eng
                                         "dtspanish")+".js"; // Tiny DB spa
  Text WriteLn(" ->"+budPth);
  Text WriteLn(" ->"+tudPth);
  
  Text fstLin = "// Inkwatercolor pictures javascript database "+
                "PdbLan = "+If(eng, "'english'", "'spanish'")+";";
  Text budWri = WriteFile(budPth, fstLin+" (big)\n");
  Text tudWri = WriteFile(tudPth, fstLin+" (tiny)\n");
  
  Real maxReg = Card(inpPdb);

  Set  cicSet = For(1, maxReg, Real(Real numReg)
  {
    Set  picReg = inpPdb[numReg];
    
    Text numTxt = PagNumInt(picReg->picNum, TRUE);
    Text lngTit = PagLongTitle(eng, picReg->picTit);
    Text shrTit = PagShortTitle(eng, picReg->picTit);
    Text dteTxt = FormatDate(picReg->endDte,"%c%Y/%m/%d");
    Text dteFmt = If(eng, "painted in", "pintado en") +" "+dteTxt+" "+
                  If(eng, "with number", "con número")+" "+numTxt;
    Text picJpg = PagGal+"/image/tiny/"+picReg->jpgFil;
    Text lngTec = ReplaceTable(
                    PagTechnique(eng, picReg, TRUE); // Long technique
                    [[ [["&amp;", "&"]], [["<i> </i>", " "]] ]]); // No html
    Text shrTec = ReplaceTable(
                    PagTechnique(eng, picReg, FALSE); // Short technique
                    [[ [["&amp;", "&"]], [["<i> </i>", " "]] ]]); // No html
    Real priBas = 100 *
                  If(IsUnknown(picReg->wrkTim), 0, picReg->wrkTim) *
                  If(IsUnknown(picReg->wrkQly), 0, picReg->wrkQly);
    Text priTxt = FormatReal(priBas, "%.0lf");

    Set repTab =  
    [[
      SetOfText("PIC.NUM", numTxt),
      SetOfText("PIC.DTE", dteFmt),
      SetOfText("PIC.JPG", picJpg),
      SetOfText("PRI.BAS", priTxt)
    ]];

    Set repBig =  
    [[
      SetOfText("PIC.TIT", lngTit),
      SetOfText("PIC.TEC", lngTec)
    ]] << repTab;

    Set repTin =  
    [[
      SetOfText("PIC.TIT", shrTit),
      SetOfText("PIC.TEC", shrTec)
    ]] << repTab;

    Text budApp = AppendFile(budPth, ReplaceTable(budJsc, repBig));
    Text tudApp = AppendFile(tudPth, ReplaceTable(budJsc, repTin));
    TRUE
  });
  Card(cicSet)
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Creates and writes a Javascript database of the pictures.",
PagSel);
//////////////////////////////////////////////////////////////////////////////

Árbol de ficheros

Ink.Watercolor construye las páginas del sitio web inkwatercolor.com

  • make.tol proceso principal de generación de contenidos del sitio web
  • tol directorios de código fuente en lenguaje de programación Tol
    • cmm funciones comunes de textos, fechas, conjuntos, ficheros, etc.
      • txt.tol funciones de manejo de textos
      • set.tol funciones de manejo de conjuntos
      • tab.tol funciones de tablas como set of sets
      • ser.tol funciones de series temporales
      • fil.tol funciones de gestión de ficheros
      • zip.tol compresor de ficheros en línea de mandatos
      • apa.tol proceso de ficheros de log de Apache
      • dir.tol funciones de gestión de directorios
    • app funciones especificas de Ink.Watercolor
      • pdb.tol funciones de la base de datos de pinturas
      • pag.tol funciones para generar páginas web Html
      • sed.tol semillas, templates, de páginas web Html
      • ftp.tol funciones para generar mandatos para hacer Ftp
      • xml.tol funciones históricas para sitemaps en Xml
      • alc.tol alchemy para la transformación de imágenes
      • ink.tol funciones auxiliares de InkWatercolor
    • inc.tol inclusión de los ficheros Tol básicos y de aplicación
  • agenda directorio destinado a albergar los ficheros de agendas de posts
    • chpphodb01.txt ejemplo con las 4 primeras obras artísticas que se incluyeron
  • web directorio destinado a las paginas web generadas automáticamente
    • common directorio de recursos comunes a todas las galerías
      • css directorio para ficheros de estilo
        • common.css fichero de estilo para las paginas Html del sitio web
      • seed trozos de código Html para construir templates
        • strseed.htm estructura básica de página Html de inkwatercolor.com
        • pi1lowseed.htm estructura para albergar información sobre una obra
        • pi4cntseed.htm estructura para albergar 4 pinturas en una página
      • src directorio para ficheros javascript
    • chppho directorio para la galería principal de Inkwatercolor
      • index.html ejemplo de página Html generada automáticamente
    • download directorio para material extra para descargas
      • chppho0129.jpg ejemplo de imagen de obra artística para descargar
      • chppho0143.jpg ejemplo de imagen de obra artística para descargar
    • sitemap.xml mapa del sitio web generado en Xml de forma automática
  • history archivo de registro histórico del programa Ink.Watercolor
  • ink_watercolor.pdf documento resumen de funciones del programa de generación Html

2015 asolver.com | Aviso legal | XHTML | Δ Θ Ξ | Creative Commons | Mapa y funciones del sitio

Tol