From 31a41498462777712769983490e91b7b36d97789 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 9 Jul 2012 07:19:59 +0000 Subject: [PATCH] .uppweb git-svn-id: svn://ultimatepp.org/upp/trunk@5161 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppbox/uppweb/init | 1 + uppbox/uppweb/uppweb.upp | 3 +- uppbox/uppweb/www.cpp | 2074 +++++++++-------- uppbox/uppweb/www.tpp/documentation$en-us.tpp | 3 +- .../uppweb/www.tpp/documentation$en-us.tppi | 10 + 5 files changed, 1053 insertions(+), 1038 deletions(-) create mode 100644 uppbox/uppweb/www.tpp/documentation$en-us.tppi diff --git a/uppbox/uppweb/init b/uppbox/uppweb/init index 685f835a7..69b3f5cfd 100644 --- a/uppbox/uppweb/init +++ b/uppbox/uppweb/init @@ -10,4 +10,5 @@ #include "Sql/init" #include "Skeleton/init" #include "Painter/init" +#include "Skylark/init" #endif diff --git a/uppbox/uppweb/uppweb.upp b/uppbox/uppweb/uppweb.upp index 22ff34e0f..47ffb78f7 100644 --- a/uppbox/uppweb/uppweb.upp +++ b/uppbox/uppweb/uppweb.upp @@ -11,7 +11,8 @@ uses plugin\ftp, Sql, Skeleton, - Painter; + Painter, + Skylark; options(GCC) -DNOWSTRING; diff --git a/uppbox/uppweb/www.cpp b/uppbox/uppweb/www.cpp index 8088ec133..bef3535a0 100644 --- a/uppbox/uppweb/www.cpp +++ b/uppbox/uppweb/www.cpp @@ -1,1036 +1,1038 @@ -#include "www.h" -#define IMAGECLASS WWW -#define IMAGEFILE -#include -#include - -#define TFILE -#include - -#define LLOG(x) // LOG(x) - -#ifdef PLATFORM_WIN32 -String rootdir = "u:\\upp.src"; -String uppbox = rootdir + "uppbox"; -String uppsrc = rootdir + "uppsrc"; -String reference = rootdir + "reference"; -String examples = rootdir + "examples"; -String targetdir = "u:\\uppwww"; -String pdfdir = "u:\\pdf"; -#else -String rootdir = "/root/upp.src"; -String uppbox = rootdir + "uppbox"; -String uppsrc = rootdir + "uppsrc"; -String reference = rootdir + "reference"; -String examples = rootdir + "examples"; -String targetdir = "/var/www"; -String diffdir = "/root/wwwupp"; -String pdfdir = "/var/www"; -#endif -String bazaar; -bool outPdf; -bool doSvn; - -String GetRcFile(const char *s) -{ - String f = GetDataFile(s); - if(FileExists(f)) - return f; - return GetHomeDirFile("upp.src/uppbox/uppweb/" + AsString(s)); -} - -bool ContainsAt(const String &source, const String &pattern, int pos) -{ - return pos >= 0 - && pos + pattern.GetLength() <= source.GetLength() - && 0 == memcmp(source.Begin() + pos, pattern.Begin(), pattern.GetLength()); -} - -bool StartsWith(const String &source, const String &pattern) -{ - return ContainsAt(source, pattern, 0); -} - -bool EndsWith(const String &source, const String &pattern) -{ - return ContainsAt(source, pattern, source.GetLength() - pattern.GetLength()); -} - -String ImgName(int q) -{ - return Sprintf("%di.png", q); -} - -typedef Image (*ImageFn)(); - -namespace Upp { -template<> -unsigned GetHashValue(const ::ImageFn& fn) { return (unsigned)(uintptr_t) fn; } -}; - -String GetImageSrc(ImageFn img) -{ - static Index il; - int q = il.Find(img); - if(il.Find(img) < 0) { - q = il.GetCount(); - il.Add(img); - PNGEncoder png; - png.SaveFile(AppendFileName(targetdir, ImgName(q)),(*img)()); - } - return ImgName(q); -} - -Htmls Wimg(ImageFn img) -{ - return HtmlImg(GetImageSrc(img)).Border(0); -} - -Htmls RoundFrame(Htmls data, String border, Color bg) -{ - return HtmlPackedTable().BgColor(bg).Width(-100) - .Attr("style", "border-style: solid; border-width: 1px; border-color: #" + border + ";") - / HtmlLine() / data; -} - -HtmlTag BoxWidth(int width) -{ - return HtmlPackedTable().Width(width) / HtmlLine(); -} - -Htmls BarSection(const char *txt) -{ - Htmls bar; - bar.Br(); - bar << HtmlPackedTable().BgColor(WhiteGray).Width(-100) / - (HtmlRow() / ( - HtmlCell().Width(10) / " " + - HtmlCell() / HtmlArial(8) / HtmlBold() / txt + - HtmlCell().Width(10) / " " - )); - return bar; -} - -Htmls BarCaption(const char *text) -{ - return HtmlLine() - .Width(-100) - .VCenter() - .Style("background-image: url('" + GetImageSrc(WWW::Caption) + "'); " - "border: 0px solid black;" - "padding-left:12px; padding-right:0px; " - "padding-top:1px; padding-bottom:1px;" - "color:#FFFFFF;") - / HtmlBold() / HtmlArial(8) / text; -} - -Htmls BarCaptionLang(const char *text) -{ - return HtmlLine() - .Width(20) - .VCenter() - .Style("background-image: url('" + GetImageSrc(WWW::News2) + "'); " - "border: 0px solid black;" - "padding-left:12px; padding-right:0px; " - "padding-top:1px; padding-bottom:1px;" - "color:#FFFFFF;") - / HtmlBold() / HtmlArial(8) / text; -} - -Htmls BarItem(Htmls content, const char *style) -{ - String bgStyle = "background-image: url('" + GetImageSrc(WWW::Button) + "'); "; - return HtmlLine().Width(-100).VCenter().Style(bgStyle + style) - / content; -} - -Htmls BarLink(const char *link, const char *text, bool nxt = true) -{ - String style = "border: 0px solid black; " - "padding-left:12px; padding-right:0px; " - "padding-top:6px; padding-bottom:6px;"; - if(nxt) - style += " border-top: 1px solid #6E89AE;"; - - return BarItem( HtmlLink(link).Class("l1") / text, style ); -} - -Htmls SearchBar(const char *domain) -{ - Htmls form = - HtmlForm("http://www.google.com/search", false, "GET") - .Style("margin:0px;padding:0px;") / - ( HtmlHidden("ie", "UTF-8") + - HtmlHidden("oe", "UTF-8") + - HtmlEdit("q", 15) + - HtmlHidden("domains", domain) + - HtmlHidden("sitesearch", domain) - ); - - Htmls content; - content << HtmlPackedTable().Width(-100) - / HtmlRow() / ( - HtmlCell() / Wimg(WWW::google) + - HtmlCell() / form - ); - - String style = "border: 0px solid black; " - "padding-left:6px; padding-right:0px; " - "padding-top:4px; padding-bottom:4px;" - "border-top: 1px solid #6E89AE;"; - return BarItem(content, style); -} - -HtmlTag HtmlPadding(int p) -{ - return HtmlPackedTable().Width(-100) / - HtmlLine(); -} - -VectorMap escape; - -String QtfAsHtml(const char *qtf, Index& css, - const VectorMap& links, - const VectorMap& labels, - const String& outdir, const String& fn = Null) -{ - return EncodeHtml(ParseQTF(qtf), css, links, labels, outdir, fn, Zoom(8, 40), escape, 40); -} - -String GetText(const char *s) -{ - return GetTopic(s).text; -} - -String ChangeTopicLanguage(const String &topic, int lang) { - int pos = topic.ReverseFind('$'); - if (pos < 0) - return ""; - String langtxt = ToLower(LNGAsText(lang)); - return topic.Left(pos+1) + langtxt + topic.Mid(pos+1+langtxt.GetCount()); -} - -String GetTopicLanguage(const String &topic) { - int pos = topic.ReverseFind('$'); - if (pos < 0) - return ""; - return topic.Mid(pos+1, 5); -} - -String FormatDateRFC822(const Time& t) { - int tz = int((GetSysTime()-GetUtcTime())/60); - return Format("%s, %d %Mon %d %02d:%02d:%02d %s%04d", - DayName(DayOfWeek(t)).Left(3), - t.day,t.month,t.year, - t.hour,t.minute,t.second, - tz>0?"+":"",tz/60*100+(tz+1440)%60); -} - -void CreateRssFeed() { - String header="\n" - "\n" - "Ultimate++ svn changes\n" - "http://ultimatepp.org/\n" - "This feed offers list of commits to Ultimate++ framework svn repository\n" - ""+ FormatDateRFC822(GetSysTime()) + "\n" - "en-us\n" - "\n\n"; - - String items; - for(int i = 0; i < min(30,svnlog.GetCount()); i++){ - items+="\n" - "Revision " + svnlog[i].revision + "\n" - "http://code.google.com/p/upp-mirror/source/detail?r=" + svnlog[i].revision + "\n" - "http://code.google.com/p/upp-mirror/source/detail?r=" + svnlog[i].revision + "\n" - "" + FormatDateRFC822(svnlog[i].time) + "\n" - "\n" - " Revision:" + svnlog[i].revision + "\n" - " Description:" + svnlog[i].msg + "\n" - " Submitted:" + FormatDateRFC822(svnlog[i].time) + " by " + svnlog[i].author + "\n" - " Affected files: \n" - " \n" - "
\n"; - for(int j = 0; j < svnlog[i].changes.GetCount(); j++) - items+="" + svnlog[i].changes[j].action + " " - "" + svnlog[i].changes[j].path + "
\n"; - items+= - "
\n" - " \n" - " \n" - "]]>
\n" - "
\n\n"; - } - SaveFile(AppendFileName(targetdir, "svnchanges.xml"), header + items + "
\n
\n"); -} - -VectorMap tt; - -String Www(const char *topic, int lang, String topicLocation = "topic://uppweb/www/") -{ - String strLang = ToLower(LNGAsText(lang)); - String www = GatherTopics(tt, String().Cat() << topicLocation << topic << "$" << strLang); - if (www != "index.html") - return www; - return GatherTopics(tt, String().Cat() << topicLocation << topic << "$" << "en-us"); -} - -String FolderLinks(String package, String group, int lang) -{ - String qtf; - FindFile ff(AppendFileName(AppendFileName(AppendFileName(uppsrc, package), group + ".tpp"), "*.tpp")); - while(ff) { - if(ff.IsFile()) { - if (ff.GetName().Find("en-us") >= 0) { - String title; - String tl = "topic://" + package + '/' + group + '/' + GetFileTitle(ff.GetName()); - tl = ChangeTopicLanguage(tl, lang); - GatherTopics(tt, tl, title); - qtf << "________[^" << tl << "^ " << DeQtf(Nvl(title, tl)) << "]&"; - } - } - ff.Next(); - } - return qtf; -} - -void AddFiles(String& qtf, const String& dir, const char* ext, bool& b) -{ - FindFile ff(AppendFileName(dir, "*." + String(ext))); - while(ff) { - qtf << "[A4* " << DeQtf(ff.GetName()) << "]&&" - << CppAsQtf(LoadFile(AppendFileName(dir, ff.GetName()))) - << "&&&"; - ff.Next(); - b = true; - } -} - -struct Isort { - bool operator()(const String& a, const String& b) const - { - return ToUpper(a) < ToUpper(b); - } -}; - -String MakeExamples(const char *dir, const char *www, int language) -{ - String ttxt; - FindFile ff(AppendFileName(dir, "*.*")); - ttxt << "{{1:3 "; - bool next = false; - Vector ls; - while(ff) { - if(ff.IsFolder()) - ls.Add(ff.GetName()); - ff.Next(); - } - Sort(ls, Isort()); - for(int i = 0; i < ls.GetCount(); i++) { - String name = ls[i]; - String link = String().Cat() << www << '$' << name << "$" << ToLower(LNGAsText(language)) << ".html"; - Topic& topic = tt.Add(link); - topic.title = name; - String fn = AppendFileName( - AppendFileName( - AppendFileName(uppbox, "uppweb"), - String(www) + ".tpp" - ), - topic.title + "$" + ToLower(LNGAsText(language)) + ".tpp" - ); - String h = ReadTopic(LoadFile(fn)).text; - Package p; - p.Load(AppendFileName(AppendFileName(dir, name), name + ".upp")); - topic.text << "[R6* " << name << "]&&" << DeQtf(p.description) << "&"; - if(h.GetCount()) - topic.text << h; - topic.text << "[A2 &x, String& qtf, const char *folder, int lang) -{ - if(x.Find(folder) >= 0) - return; - x.Add(folder); - String srcdoc = FolderLinks(folder, "srcdoc", lang); - String src = FolderLinks(folder, "src", lang); - Package p; - p.Load(AppendFileName(uppsrc, AppendFileName(folder, GetFileName(folder) + ".upp"))); - if(srcdoc.GetLength() || src.GetLength()) { - qtf << "&&&[*4@b " << folder << "]&"; - if(!IsNull(p.description)) - qtf << "[2 " << p.description << "]&"; - if(srcdoc.GetCount()) { - qtf << "&[3/* " + Format(t_("Using %s"), folder) << "]&"; - qtf << srcdoc; - } - if(src.GetCount()) { - qtf << "&[3/* " << Format(t_("%s reference"), folder) << "]&"; - qtf << src; - } - } -} - -int CharFilterLbl(int c) -{ - return IsAlNum(c) ? c : '.'; -} - - -void QtfAsPdf(PdfDraw &pdf, const char *qtf) -{ - RichText txt = ParseQTF(qtf); - Size page = Size(3968, 6074); - UPP::Print(pdf, txt, page); -} - -VectorMap links; -VectorMap labels; -Htmls header, lastUpdate; - -Array bar; -Array languages; - -int GetLinkLanguage(const String &link) { - int pos = link.ReverseFind('$'); - if (pos < 0) - return 0; - int lang = LNGFromText(ToUpper(link.Mid(pos+1))); - for (int i = 0; i < languages.GetCount(); ++i) { - if (languages[i] == lang) - return i; - } - return 0; -} - -void ExportPage(int i) -{ - Index css; - String path = links.GetKey(i); - RLOG("Exporting " << path); - - int ilang = GetLinkLanguage(path); - SetLanguage(languages[ilang]); - String text = GetText(path); - int h; - h = ParseQTF(tt[i].text).GetHeight(1000); - - int isvn = svndata.Find(tt.GetKey(i)); - String qtflangs; - String googleFile; - if (isvn > -1) { - String txt = String("[2 ") + t_("Last edit by %s on %s") + ".]"; - qtflangs += Format(txt, svndata[isvn].author, Format(Date(svndata[isvn].time))); - googleFile = svndata[isvn].fullPath; - if (googleFile.GetCount() > rootdir.GetCount()) - googleFile = UnixPath(googleFile.Mid(rootdir.GetCount())); - else - googleFile = ""; - } - String strlang; - String jslang; - Array arrLangs; - for (int il = 0; il < languages.GetCount(); ++il) { - String topic = ChangeTopicLanguage(path, languages[il]); - int itopic; - if ((itopic = tt.Find(topic)) >= 0) { - if (tt[itopic].title.Find(" (translated)") < 0) { - if (il != ilang) { - if (!strlang.IsEmpty()) - strlang << ", "; - arrLangs.Add("[^" + links[itopic] + "^ [2 " + ToLower(GetNativeLangName(languages[il])) + "]]"); - } - jslang+="'"+ links[itopic] +"':'" + GetNativeLangName(languages[il]) + "',"; - } - } - } - if(!jslang.IsEmpty()) - jslang.Trim(jslang.GetCount()-1); - if (arrLangs.GetCount() > 0) { - for (int i = 0; i < arrLangs.GetCount(); ++i) { - if (i == arrLangs.GetCount()-1 && i != 0) - strlang << String(" ") + t_("and") + " "; - else if (i > 0) - strlang << ", "; - strlang << arrLangs[i]; - } - } - if (!strlang.IsEmpty()) - qtflangs += Format(String("[2 ") + t_("This page is also in %s") + ".]", strlang); - if (tt[i].title.Find("How to contribute. Web page") < 0) { - String help = "topic://uppweb/www/contribweb$" + ToLower(LNGAsText(languages[ilang])); - qtflangs += " " + String("[^") + help + "^ [ htmlrep; - int posB = 0; - while (true) { - posB = page.Find("[IHTMLTEXT", posB); - if (posB < 0) - break; - int posBB = posB + (int)strlen("[IHTMLTEXT"); - int pos0 = page.ReverseFind("[", posB-1); - int posE = page.Find(";2", posBB); - String html0 = page.Mid(posBB, posE - posBB); - html0.Replace("`", ""); - htmlrep.Add(html0); - int posEE = page.Find("]&]", posE) + (int)strlen("]&]"); - - page = page.Left(pos0) + "QTFHTMLTEXT" + FormatInt(htmlrep.GetCount()-1) + page.Mid(posEE+1); - } - - page = QtfAsHtml(page, css, links, labels, targetdir, links[i]); - for (int iHtml = 0; iHtml < htmlrep.GetCount(); ++iHtml) - page.Replace(String("QTFHTMLTEXT") + FormatInt(iHtml), htmlrep[iHtml]); - - Color paper = SWhite; - if(path == "topic://uppweb/www/download$en-us") - page << LoadFile(GetRcFile("adsense3.txt")); -/* if(path == "topic://uppweb/www/index$en-us") { - for(int q = 0; q < news.GetCount(); q++) { - String n = GetText("uppweb/www_news/" + news[q]); - String h = news[q]; - int i = h.Find('$'); - if(i >= 0) - h = h.Mid(0, i); - if(h.GetLength() == 8) - h = h.Mid(0, 4) + '-' + h.Mid(4, 2) + '-' + h.Mid(6, 2); - page << "
"; - page << "
  " - << h << "

"; - page << QtfAsHtml(n, css, links, targetdir, FormatIntAlpha(q) + "_n"); - page << "
"; - } - }*/ - Color bg = Color(210, 217, 210); - Htmls footer; - footer << HtmlTable().Border(0).Width(-100) / HtmlLine() + - RoundFrame(HtmlPadding(8) / langs , "6E89AE;padding: 10px;", White); - Htmls html; - html << - HtmlPackedTable().Width(-100) / - HtmlLine().ColSpan(3) / header + - HtmlPackedTable().Width(-100) / ( - HtmlLine().ColSpan(3).BgColor(bg).Height(6) / "" + - HtmlRow() / ( - HtmlTCell().Center() / BoxWidth(160).Center() / ( - bar[GetLinkLanguage(path)] + - "
" + - LoadFile(GetRcFile("facebook.txt")) + - "

" + -// "

" + - LoadFile(GetRcFile("adsense2.txt")) + - "

" + - LoadFile(GetRcFile("adlinks.txt")) + - (h > 25000 ? "

" + LoadFile(GetRcFile("adsense2.txt")) - : "") + - "


" + -// LoadFile(GetRcFile("referral.txt")) + -// LoadFile(GetRcFile("referral2.txt")) + -// LoadFile(GetRcFile("donations.txt")) + -// "

" + -// amazon[i % amazon.GetCount()] + - "


" + - HtmlLink("http://sourceforge.net/projects/upp/") / - HtmlImg("http://sourceforge.net/sflogo.php?group_id=93970&type=2", - "SourceForge.net Logo").Border(0).Width(125).Height(37) + - "

" + - HtmlLink("http://www.sdjournal.org/en/") / - HtmlImg(GetImageSrc(WWW::Sdj)).Border(0) + - "

" + - (links[i] == "index.html" ? lastUpdate : Htmls()) + - HtmlImg("http://www.vol.cz/cgi-bin/wc/upp").Width(1).Height(1) - ) + - HtmlTCell().BgColor(bg) / BoxWidth(6) / "" + - HtmlTCell().Width(-100).BgColor(bg) / ( - RoundFrame(HtmlPadding(8) / page , "6E89AE;padding: 10px;", White) + - footer - ) - ) - ) + Htmls(""); - - String topicTitle = tt.GetKey(i); - String pageTitle = tt[i].title; - if(IsNull(pageTitle)) - pageTitle = "Ultimate++"; - if(StartsWith(topicTitle, "examples$")) - pageTitle = "Demos / " + pageTitle; - else if(StartsWith(topicTitle, "reference$")) - pageTitle = "Examples / " + pageTitle; - - if(pageTitle != "Ultimate++") - pageTitle << " :: Ultimate++"; - - Htmls content = - "\n" + - HtmlHeader(pageTitle, AsCss(css) + - "a.l1 { text-decoration:none; font-size: 8pt; font-family: sans-serif; " - "font-weight: normal; }\n" - "a.l1:link { color:#000000; }\n" - "a.l1:visited { color:#000080; }\n" - "a.l1:hover { color:#9933CC; }\n" - "a.l1:active { color:#000000; }\n" - "a.l2 { text-decoration:none; font-size: 12pt; font-family: sans-serif; " - "font-variant: small-caps; }\n" - "a.l2:link { color:#0066FF; }\n" - "a.l2:visited { color:#FF6600; }\n" - "a.l2:hover { color:#BC0624; }\n" - "a.l2:active { color:#BC0024; }\n", - "" - "\n" - "" -// "" - ) - - - .BgColor(bg) - .Alink(Red).Link(Black).Vlink(Blue) - / html; - SaveFile(AppendFileName(targetdir, links[i]), content); - RLOG("Exported page " << links[i]); -} - -String Downloads() -{ - String r; - FindFile ff(AppendFileName(targetdir, "downloads/*.*")); - Vector

") + - BarItem(HtmlPackedTable().Width(-100) - / HtmlRow() / ( - HtmlCell() / Wimg(WWW::Language) + - HtmlCell() / Htmls("
"+GetNativeLangName(languages[i])+"
") - ),"border: 0px solid black;" - "padding-left:6px; padding-right:0px;" - "padding-top:4px; padding-bottom:4px;" - ) + Htmls("
"); - - - HtmlTag bf = HtmlPackedTable() - .Width(-100) - .BgColor(White) - .Attr("style", "border-style: solid; border-width: 1px; border-color: #6E89AE;" - "padding: 0px"); - String div = HtmlTable().Border(0).Width(-100) / HtmlLine(); - bar[i] = bf / bi + div + - // bf / bex + div + - // bf / bdoc + div + - // bf / bcom + div + - // bf / bcon + div + - bf / bsearch + div + - bf / blang + div; - } - SetLanguage(lang); - - for(int i = 0; i < tt.GetCount(); i++) { - String topic = tt.GetKey(i); - links.Add(topic, topic == "topic://uppweb/www/index$en-us" ? "index.html" : - memcmp(topic, "topic://", 8) ? topic : TopicFileNameHtml(topic)); - } - - String svntableStr = DeQtf("[svntable]"); - for(int i = 0; i < tt.GetCount(); i++) { - if (tt[i].title == "Svn releases") - tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 300, "")); - else if (tt[i].title == "Svn Web releases") - tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 100, "uppweb")); - else if (tt[i].title == "Svn Bazaar releases") - tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 100, "bazaar")); - else if (tt[i].title == "Svn Upp releases") - tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 100, "uppsrc")); - else if (tt[i].title == "Svn major releases") - tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 300, "", true)); - else if (tt[i].title == "Svn Web major releases") - tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 100, "uppweb", true)); - else if (tt[i].title == "Svn Bazaar major releases") - tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 100, "bazaar", true)); - else if (tt[i].title == "Svn Upp major releases") - tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 100, "uppsrc", true)); - else - if(tt[i].title == "Nightly builds") - tt[i].text.Replace(String("<#downloads#>"), downloads); - else if (links[i].Find("index") >= 0) { - String win32 = "upp-win32-RELEASE.exe"; - String win32release = win32; - win32release.Replace(String("RELEASE"), release); - String x11 = "upp-x11-src-RELEASE.tar.gz"; - String x11release = x11; - x11release.Replace(String("RELEASE"), release); - tt[i].text.Replace(DeQtf(x11), DeQtf(x11release)); - tt[i].text.Replace(DeQtf(win32), DeQtf(win32release)); - } - } - - for(int i = 0; i < reflink.GetCount(); i++) { - String l = reflink.GetKey(i); - String lbl = Filter(l, CharFilterLbl); - String f = links.Get(reflink[i], Null) + '#' + lbl; - links.Add(l, f); - static const char *x[] = { "::struct", "::class", "::union" }; - for(int ii = 0; ii < 3; ii++) { - String e = x[ii]; - if(EndsWith(l, e)) { - links.Add(l.Mid(0, l.GetLength() - e.GetLength()), f); - } - } - labels.Add(l, lbl); - } - - Date d = GetSysDate(); - lastUpdate = HtmlItalic() / HtmlArial(8) / HtmlFontColor(Gray()) / - (String().Cat() << "Last update " << GetSysDate()); - -// Vector amazon = Split(LoadFile(GetRcFile("amazon.txt")), '\n');//440 - - Vector bazaarItems = SvnBazaarList(bazaar, svnlog); - - // To fill Bazaar page with real release dates and size - for(int i = 0; i < tt.GetCount(); i++) { - if (tt[i].title == "Bazaar") { - String page = tt[i]; - for (int j = 0; j < bazaarItems.GetCount(); ++j) { - int pos = page.Find("2 " + DeQtf(bazaarItems[j].name) + "]]"); - if (pos < 0) - pos = page.Find("2 " + DeQtf(bazaarItems[j].name) + "\r\n]]"); - if (pos >= 0) { - pos = page.Find("::", pos); - pos = page.Find("::", pos); - pos = page.Find(":: [s0;=2", pos); - if (pos >= 0) - pos += (int)strlen(":: [s0;=2"); - String strDate; - if (pos >= 0) { - Time t = bazaarItems[j].lastChange; - if (IsNull(t)) - strDate = "Not in Svn log"; - else - strDate = Format("%Mon", t.month) + " " + FormatInt(t.year); - page.Insert(pos, " " + strDate); - } - pos = page.Find(":: [s0;=2", pos); - if (pos >= 0) - pos += (int)strlen(":: [s0;=2"); - String strSz; - if (pos >= 0) { - if (bazaarItems[j].size == 0) - strSz = "Not in Svn log"; - else - strSz = BytesToString(bazaarItems[j].size); - - page.Insert(pos, " " + strSz); - } - } - } - tt[i].text = page; - } - } - - LLOG("G: " << MemoryUsedKb()); - -/* - if (outPdf) { - PdfDraw pdf; - for(int i = 0; i < tt.GetCount(); i++) - QtfAsPdf(pdf, tt[i]); - SaveFile(AppendFileName(pdfdir, "Upp.pdf"), pdf.Finish()); - } -*/ - - LLOG("H: " << MemoryUsedKb()); - - for(int i = 0; i < tt.GetCount(); i++) - ExportPage(i); - SetLanguage(lang); - - LLOG("I: " << MemoryUsedKb()); - -// SaveFile(AppendFileName(targetdir, "favicon.ico"), LoadFile(AppendFileName(uppsrc, "ide/ide.ico"))); - SaveFile(AppendFileName(targetdir, "stats.html"), - HtmlImg("http://www.vol.cz/cgi-bin/wc/upp") + "
" + - HtmlLink("http://www.mygooglepagerank.com", "_blank") / - "" + - "" + - HtmlLink("http://www.mygooglepagerank.com", "_blank") / - "" + - "" - ); - Cout() << "Finished OK\n"; -} +#include "www.h" +#define IMAGECLASS WWW +#define IMAGEFILE +#include +#include + +#define TFILE +#include + +#define LLOG(x) // LOG(x) + +#ifdef PLATFORM_WIN32 +String rootdir = "u:\\upp.src"; +String uppbox = rootdir + "uppbox"; +String uppsrc = rootdir + "uppsrc"; +String reference = rootdir + "reference"; +String examples = rootdir + "examples"; +String targetdir = "u:\\uppwww"; +String pdfdir = "u:\\pdf"; +#else +String rootdir = "/root/upp.src"; +String uppbox = rootdir + "uppbox"; +String uppsrc = rootdir + "uppsrc"; +String reference = rootdir + "reference"; +String examples = rootdir + "examples"; +String targetdir = "/var/www"; +String diffdir = "/root/wwwupp"; +String pdfdir = "/var/www"; +#endif +String bazaar; +bool outPdf; +bool doSvn; + +String GetRcFile(const char *s) +{ + String f = GetDataFile(s); + if(FileExists(f)) + return f; + return GetHomeDirFile("upp.src/uppbox/uppweb/" + AsString(s)); +} + +bool ContainsAt(const String &source, const String &pattern, int pos) +{ + return pos >= 0 + && pos + pattern.GetLength() <= source.GetLength() + && 0 == memcmp(source.Begin() + pos, pattern.Begin(), pattern.GetLength()); +} + +bool StartsWith(const String &source, const String &pattern) +{ + return ContainsAt(source, pattern, 0); +} + +bool EndsWith(const String &source, const String &pattern) +{ + return ContainsAt(source, pattern, source.GetLength() - pattern.GetLength()); +} + +String ImgName(int q) +{ + return Sprintf("%di.png", q); +} + +typedef Image (*ImageFn)(); + +namespace Upp { +template<> +unsigned GetHashValue(const ::ImageFn& fn) { return (unsigned)(uintptr_t) fn; } +}; + +String GetImageSrc(ImageFn img) +{ + static Index il; + int q = il.Find(img); + if(il.Find(img) < 0) { + q = il.GetCount(); + il.Add(img); + PNGEncoder png; + png.SaveFile(AppendFileName(targetdir, ImgName(q)),(*img)()); + } + return ImgName(q); +} + +Htmls Wimg(ImageFn img) +{ + return HtmlImg(GetImageSrc(img)).Border(0); +} + +Htmls RoundFrame(Htmls data, String border, Color bg) +{ + return HtmlPackedTable().BgColor(bg).Width(-100) + .Attr("style", "border-style: solid; border-width: 1px; border-color: #" + border + ";") + / HtmlLine() / data; +} + +HtmlTag BoxWidth(int width) +{ + return HtmlPackedTable().Width(width) / HtmlLine(); +} + +Htmls BarSection(const char *txt) +{ + Htmls bar; + bar.Br(); + bar << HtmlPackedTable().BgColor(WhiteGray).Width(-100) / + (HtmlRow() / ( + HtmlCell().Width(10) / " " + + HtmlCell() / HtmlArial(8) / HtmlBold() / txt + + HtmlCell().Width(10) / " " + )); + return bar; +} + +Htmls BarCaption(const char *text) +{ + return HtmlLine() + .Width(-100) + .VCenter() + .Style("background-image: url('" + GetImageSrc(WWW::Caption) + "'); " + "border: 0px solid black;" + "padding-left:12px; padding-right:0px; " + "padding-top:1px; padding-bottom:1px;" + "color:#FFFFFF;") + / HtmlBold() / HtmlArial(8) / text; +} + +Htmls BarCaptionLang(const char *text) +{ + return HtmlLine() + .Width(20) + .VCenter() + .Style("background-image: url('" + GetImageSrc(WWW::News2) + "'); " + "border: 0px solid black;" + "padding-left:12px; padding-right:0px; " + "padding-top:1px; padding-bottom:1px;" + "color:#FFFFFF;") + / HtmlBold() / HtmlArial(8) / text; +} + +Htmls BarItem(Htmls content, const char *style) +{ + String bgStyle = "background-image: url('" + GetImageSrc(WWW::Button) + "'); "; + return HtmlLine().Width(-100).VCenter().Style(bgStyle + style) + / content; +} + +Htmls BarLink(const char *link, const char *text, bool nxt = true) +{ + String style = "border: 0px solid black; " + "padding-left:12px; padding-right:0px; " + "padding-top:6px; padding-bottom:6px;"; + if(nxt) + style += " border-top: 1px solid #6E89AE;"; + + return BarItem( HtmlLink(link).Class("l1") / text, style ); +} + +Htmls SearchBar(const char *domain) +{ + Htmls form = + HtmlForm("http://www.google.com/search", false, "GET") + .Style("margin:0px;padding:0px;") / + ( HtmlHidden("ie", "UTF-8") + + HtmlHidden("oe", "UTF-8") + + HtmlEdit("q", 15) + + HtmlHidden("domains", domain) + + HtmlHidden("sitesearch", domain) + ); + + Htmls content; + content << HtmlPackedTable().Width(-100) + / HtmlRow() / ( + HtmlCell() / Wimg(WWW::google) + + HtmlCell() / form + ); + + String style = "border: 0px solid black; " + "padding-left:6px; padding-right:0px; " + "padding-top:4px; padding-bottom:4px;" + "border-top: 1px solid #6E89AE;"; + return BarItem(content, style); +} + +HtmlTag HtmlPadding(int p) +{ + return HtmlPackedTable().Width(-100) / + HtmlLine(); +} + +VectorMap escape; + +String QtfAsHtml(const char *qtf, Index& css, + const VectorMap& links, + const VectorMap& labels, + const String& outdir, const String& fn = Null) +{ + return EncodeHtml(ParseQTF(qtf), css, links, labels, outdir, fn, Zoom(8, 40), escape, 40); +} + +String GetText(const char *s) +{ + return GetTopic(s).text; +} + +String ChangeTopicLanguage(const String &topic, int lang) { + int pos = topic.ReverseFind('$'); + if (pos < 0) + return ""; + String langtxt = ToLower(LNGAsText(lang)); + return topic.Left(pos+1) + langtxt + topic.Mid(pos+1+langtxt.GetCount()); +} + +String GetTopicLanguage(const String &topic) { + int pos = topic.ReverseFind('$'); + if (pos < 0) + return ""; + return topic.Mid(pos+1, 5); +} + +String FormatDateRFC822(const Time& t) { + int tz = int((GetSysTime()-GetUtcTime())/60); + return Format("%s, %d %Mon %d %02d:%02d:%02d %s%04d", + DayName(DayOfWeek(t)).Left(3), + t.day,t.month,t.year, + t.hour,t.minute,t.second, + tz>0?"+":"",tz/60*100+(tz+1440)%60); +} + +void CreateRssFeed() { + String header="\n" + "\n" + "Ultimate++ svn changes\n" + "http://ultimatepp.org/\n" + "This feed offers list of commits to Ultimate++ framework svn repository\n" + ""+ FormatDateRFC822(GetSysTime()) + "\n" + "en-us\n" + "\n\n"; + + String items; + for(int i = 0; i < min(30,svnlog.GetCount()); i++){ + items+="\n" + "Revision " + svnlog[i].revision + "\n" + "http://code.google.com/p/upp-mirror/source/detail?r=" + svnlog[i].revision + "\n" + "http://code.google.com/p/upp-mirror/source/detail?r=" + svnlog[i].revision + "\n" + "" + FormatDateRFC822(svnlog[i].time) + "\n" + "\n" + " Revision:" + svnlog[i].revision + "\n" + " Description:" + svnlog[i].msg + "\n" + " Submitted:" + FormatDateRFC822(svnlog[i].time) + " by " + svnlog[i].author + "\n" + " Affected files: \n" + " \n" + "
\n"; + for(int j = 0; j < svnlog[i].changes.GetCount(); j++) + items+="" + svnlog[i].changes[j].action + " " + "" + svnlog[i].changes[j].path + "
\n"; + items+= + "
\n" + " \n" + " \n" + "]]>
\n" + "
\n\n"; + } + SaveFile(AppendFileName(targetdir, "svnchanges.xml"), header + items + "
\n
\n"); +} + +VectorMap tt; + +String Www(const char *topic, int lang, String topicLocation = "topic://uppweb/www/") +{ + String strLang = ToLower(LNGAsText(lang)); + String www = GatherTopics(tt, String().Cat() << topicLocation << topic << "$" << strLang); + if (www != "index.html") + return www; + return GatherTopics(tt, String().Cat() << topicLocation << topic << "$" << "en-us"); +} + +String FolderLinks(String package, String group, int lang) +{ + String qtf; + FindFile ff(AppendFileName(AppendFileName(AppendFileName(uppsrc, package), group + ".tpp"), "*.tpp")); + while(ff) { + if(ff.IsFile()) { + if (ff.GetName().Find("en-us") >= 0) { + String title; + String tl = "topic://" + package + '/' + group + '/' + GetFileTitle(ff.GetName()); + tl = ChangeTopicLanguage(tl, lang); + GatherTopics(tt, tl, title); + qtf << "________[^" << tl << "^ " << DeQtf(Nvl(title, tl)) << "]&"; + } + } + ff.Next(); + } + return qtf; +} + +void AddFiles(String& qtf, const String& dir, const char* ext, bool& b) +{ + FindFile ff(AppendFileName(dir, "*." + String(ext))); + while(ff) { + qtf << "[A4* " << DeQtf(ff.GetName()) << "]&&" + << CppAsQtf(LoadFile(AppendFileName(dir, ff.GetName()))) + << "&&&"; + ff.Next(); + b = true; + } +} + +struct Isort { + bool operator()(const String& a, const String& b) const + { + return ToUpper(a) < ToUpper(b); + } +}; + +String MakeExamples(const char *dir, const char *www, int language) +{ + String ttxt; + FindFile ff(AppendFileName(dir, "*.*")); + ttxt << "{{1:3 "; + bool next = false; + Vector ls; + while(ff) { + if(ff.IsFolder()) + ls.Add(ff.GetName()); + ff.Next(); + } + Sort(ls, Isort()); + for(int i = 0; i < ls.GetCount(); i++) { + String name = ls[i]; + String link = String().Cat() << www << '$' << name << "$" << ToLower(LNGAsText(language)) << ".html"; + Topic& topic = tt.Add(link); + topic.title = name; + String fn = AppendFileName( + AppendFileName( + AppendFileName(uppbox, "uppweb"), + String(www) + ".tpp" + ), + topic.title + "$" + ToLower(LNGAsText(language)) + ".tpp" + ); + String h = ReadTopic(LoadFile(fn)).text; + Package p; + p.Load(AppendFileName(AppendFileName(dir, name), name + ".upp")); + topic.text << "[R6* " << name << "]&&" << DeQtf(p.description) << "&"; + if(h.GetCount()) + topic.text << h; + topic.text << "[A2 &x, String& qtf, const char *folder, int lang) +{ + if(x.Find(folder) >= 0) + return; + x.Add(folder); + String srcdoc = FolderLinks(folder, "srcdoc", lang); + String src = FolderLinks(folder, "src", lang); + Package p; + p.Load(AppendFileName(uppsrc, AppendFileName(folder, GetFileName(folder) + ".upp"))); + if(srcdoc.GetLength() || src.GetLength()) { + qtf << "&&&[*4@b " << folder << "]&"; + if(!IsNull(p.description)) + qtf << "[2 " << p.description << "]&"; + if(srcdoc.GetCount()) { + qtf << "&[3/* " + Format(t_("Using %s"), folder) << "]&"; + qtf << srcdoc; + } + if(src.GetCount()) { + qtf << "&[3/* " << Format(t_("%s reference"), folder) << "]&"; + qtf << src; + } + } +} + +int CharFilterLbl(int c) +{ + return IsAlNum(c) ? c : '.'; +} + + +void QtfAsPdf(PdfDraw &pdf, const char *qtf) +{ + RichText txt = ParseQTF(qtf); + Size page = Size(3968, 6074); + UPP::Print(pdf, txt, page); +} + +VectorMap links; +VectorMap labels; +Htmls header, lastUpdate; + +Array bar; +Array languages; + +int GetLinkLanguage(const String &link) { + int pos = link.ReverseFind('$'); + if (pos < 0) + return 0; + int lang = LNGFromText(ToUpper(link.Mid(pos+1))); + for (int i = 0; i < languages.GetCount(); ++i) { + if (languages[i] == lang) + return i; + } + return 0; +} + +void ExportPage(int i) +{ + Index css; + String path = links.GetKey(i); + RLOG("Exporting " << path); + + int ilang = GetLinkLanguage(path); + SetLanguage(languages[ilang]); + String text = GetText(path); + int h; + h = ParseQTF(tt[i].text).GetHeight(1000); + + int isvn = svndata.Find(tt.GetKey(i)); + String qtflangs; + String googleFile; + if (isvn > -1) { + String txt = String("[2 ") + t_("Last edit by %s on %s") + ".]"; + qtflangs += Format(txt, svndata[isvn].author, Format(Date(svndata[isvn].time))); + googleFile = svndata[isvn].fullPath; + if (googleFile.GetCount() > rootdir.GetCount()) + googleFile = UnixPath(googleFile.Mid(rootdir.GetCount())); + else + googleFile = ""; + } + String strlang; + String jslang; + Array arrLangs; + for (int il = 0; il < languages.GetCount(); ++il) { + String topic = ChangeTopicLanguage(path, languages[il]); + int itopic; + if ((itopic = tt.Find(topic)) >= 0) { + if (tt[itopic].title.Find(" (translated)") < 0) { + if (il != ilang) { + if (!strlang.IsEmpty()) + strlang << ", "; + arrLangs.Add("[^" + links[itopic] + "^ [2 " + ToLower(GetNativeLangName(languages[il])) + "]]"); + } + jslang+="'"+ links[itopic] +"':'" + GetNativeLangName(languages[il]) + "',"; + } + } + } + if(!jslang.IsEmpty()) + jslang.Trim(jslang.GetCount()-1); + if (arrLangs.GetCount() > 0) { + for (int i = 0; i < arrLangs.GetCount(); ++i) { + if (i == arrLangs.GetCount()-1 && i != 0) + strlang << String(" ") + t_("and") + " "; + else if (i > 0) + strlang << ", "; + strlang << arrLangs[i]; + } + } + if (!strlang.IsEmpty()) + qtflangs += Format(String("[2 ") + t_("This page is also in %s") + ".]", strlang); + if (tt[i].title.Find("How to contribute. Web page") < 0) { + String help = "topic://uppweb/www/contribweb$" + ToLower(LNGAsText(languages[ilang])); + qtflangs += " " + String("[^") + help + "^ [ htmlrep; + int posB = 0; + while (true) { + posB = page.Find("[IHTMLTEXT", posB); + if (posB < 0) + break; + int posBB = posB + (int)strlen("[IHTMLTEXT"); + int pos0 = page.ReverseFind("[", posB-1); + int posE = page.Find(";2", posBB); + String html0 = page.Mid(posBB, posE - posBB); + html0.Replace("`", ""); + htmlrep.Add(html0); + int posEE = page.Find("]&]", posE) + (int)strlen("]&]"); + + page = page.Left(pos0) + "QTFHTMLTEXT" + FormatInt(htmlrep.GetCount()-1) + page.Mid(posEE+1); + } + + page = QtfAsHtml(page, css, links, labels, targetdir, links[i]); + for (int iHtml = 0; iHtml < htmlrep.GetCount(); ++iHtml) + page.Replace(String("QTFHTMLTEXT") + FormatInt(iHtml), htmlrep[iHtml]); + + Color paper = SWhite; + if(path == "topic://uppweb/www/download$en-us") + page << LoadFile(GetRcFile("adsense3.txt")); +/* if(path == "topic://uppweb/www/index$en-us") { + for(int q = 0; q < news.GetCount(); q++) { + String n = GetText("uppweb/www_news/" + news[q]); + String h = news[q]; + int i = h.Find('$'); + if(i >= 0) + h = h.Mid(0, i); + if(h.GetLength() == 8) + h = h.Mid(0, 4) + '-' + h.Mid(4, 2) + '-' + h.Mid(6, 2); + page << "
"; + page << "
  " + << h << "

"; + page << QtfAsHtml(n, css, links, targetdir, FormatIntAlpha(q) + "_n"); + page << "
"; + } + }*/ + Color bg = Color(210, 217, 210); + Htmls footer; + footer << HtmlTable().Border(0).Width(-100) / HtmlLine() + + RoundFrame(HtmlPadding(8) / langs , "6E89AE;padding: 10px;", White); + Htmls html; + html << + HtmlPackedTable().Width(-100) / + HtmlLine().ColSpan(3) / header + + HtmlPackedTable().Width(-100) / ( + HtmlLine().ColSpan(3).BgColor(bg).Height(6) / "" + + HtmlRow() / ( + HtmlTCell().Center() / BoxWidth(160).Center() / ( + bar[GetLinkLanguage(path)] + + "
" + + LoadFile(GetRcFile("facebook.txt")) + + "

" + +// "

" + + LoadFile(GetRcFile("adsense2.txt")) + + "

" + + LoadFile(GetRcFile("adlinks.txt")) + + (h > 25000 ? "

" + LoadFile(GetRcFile("adsense2.txt")) + : "") + + "


" + +// LoadFile(GetRcFile("referral.txt")) + +// LoadFile(GetRcFile("referral2.txt")) + +// LoadFile(GetRcFile("donations.txt")) + +// "

" + +// amazon[i % amazon.GetCount()] + + "


" + + HtmlLink("http://sourceforge.net/projects/upp/") / + HtmlImg("http://sourceforge.net/sflogo.php?group_id=93970&type=2", + "SourceForge.net Logo").Border(0).Width(125).Height(37) + + "

" + + HtmlLink("http://www.sdjournal.org/en/") / + HtmlImg(GetImageSrc(WWW::Sdj)).Border(0) + + "

" + + (links[i] == "index.html" ? lastUpdate : Htmls()) + + HtmlImg("http://www.vol.cz/cgi-bin/wc/upp").Width(1).Height(1) + ) + + HtmlTCell().BgColor(bg) / BoxWidth(6) / "" + + HtmlTCell().Width(-100).BgColor(bg) / ( + RoundFrame(HtmlPadding(8) / page , "6E89AE;padding: 10px;", White) + + footer + ) + ) + ) + Htmls(""); + + String topicTitle = tt.GetKey(i); + String pageTitle = tt[i].title; + if(IsNull(pageTitle)) + pageTitle = "Ultimate++"; + if(StartsWith(topicTitle, "examples$")) + pageTitle = "Demos / " + pageTitle; + else if(StartsWith(topicTitle, "reference$")) + pageTitle = "Examples / " + pageTitle; + + if(pageTitle != "Ultimate++") + pageTitle << " :: Ultimate++"; + + Htmls content = + "\n" + + HtmlHeader(pageTitle, AsCss(css) + + "a.l1 { text-decoration:none; font-size: 8pt; font-family: sans-serif; " + "font-weight: normal; }\n" + "a.l1:link { color:#000000; }\n" + "a.l1:visited { color:#000080; }\n" + "a.l1:hover { color:#9933CC; }\n" + "a.l1:active { color:#000000; }\n" + "a.l2 { text-decoration:none; font-size: 12pt; font-family: sans-serif; " + "font-variant: small-caps; }\n" + "a.l2:link { color:#0066FF; }\n" + "a.l2:visited { color:#FF6600; }\n" + "a.l2:hover { color:#BC0624; }\n" + "a.l2:active { color:#BC0024; }\n", + "" + "\n" + "" +// "" + ) + + + .BgColor(bg) + .Alink(Red).Link(Black).Vlink(Blue) + / html; + SaveFile(AppendFileName(targetdir, links[i]), content); + RLOG("Exported page " << links[i]); +} + +String Downloads() +{ + String r; + FindFile ff(AppendFileName(targetdir, "downloads/*.*")); + Vector

") + + BarItem(HtmlPackedTable().Width(-100) + / HtmlRow() / ( + HtmlCell() / Wimg(WWW::Language) + + HtmlCell() / Htmls("
"+GetNativeLangName(languages[i])+"
") + ),"border: 0px solid black;" + "padding-left:6px; padding-right:0px;" + "padding-top:4px; padding-bottom:4px;" + ) + Htmls("
"); + + + HtmlTag bf = HtmlPackedTable() + .Width(-100) + .BgColor(White) + .Attr("style", "border-style: solid; border-width: 1px; border-color: #6E89AE;" + "padding: 0px"); + String div = HtmlTable().Border(0).Width(-100) / HtmlLine(); + bar[i] = bf / bi + div + + // bf / bex + div + + // bf / bdoc + div + + // bf / bcom + div + + // bf / bcon + div + + bf / bsearch + div + + bf / blang + div; + } + SetLanguage(lang); + + for(int i = 0; i < tt.GetCount(); i++) { + String topic = tt.GetKey(i); + links.Add(topic, topic == "topic://uppweb/www/index$en-us" ? "index.html" : + memcmp(topic, "topic://", 8) ? topic : TopicFileNameHtml(topic)); + } + + String svntableStr = DeQtf("[svntable]"); + for(int i = 0; i < tt.GetCount(); i++) { + if (tt[i].title == "Svn releases") + tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 300, "")); + else if (tt[i].title == "Svn Web releases") + tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 100, "uppweb")); + else if (tt[i].title == "Svn Bazaar releases") + tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 100, "bazaar")); + else if (tt[i].title == "Svn Upp releases") + tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 100, "uppsrc")); + else if (tt[i].title == "Svn major releases") + tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 300, "", true)); + else if (tt[i].title == "Svn Web major releases") + tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 100, "uppweb", true)); + else if (tt[i].title == "Svn Bazaar major releases") + tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 100, "bazaar", true)); + else if (tt[i].title == "Svn Upp major releases") + tt[i].text.Replace(svntableStr, SvnChanges(svnlog, 100, "uppsrc", true)); + else + if(tt[i].title == "Nightly builds") + tt[i].text.Replace(String("<#downloads#>"), downloads); + else if (links[i].Find("index") >= 0) { + String win32 = "upp-win32-RELEASE.exe"; + String win32release = win32; + win32release.Replace(String("RELEASE"), release); + String x11 = "upp-x11-src-RELEASE.tar.gz"; + String x11release = x11; + x11release.Replace(String("RELEASE"), release); + tt[i].text.Replace(DeQtf(x11), DeQtf(x11release)); + tt[i].text.Replace(DeQtf(win32), DeQtf(win32release)); + } + } + + for(int i = 0; i < reflink.GetCount(); i++) { + String l = reflink.GetKey(i); + String lbl = Filter(l, CharFilterLbl); + String f = links.Get(reflink[i], Null) + '#' + lbl; + links.Add(l, f); + static const char *x[] = { "::struct", "::class", "::union" }; + for(int ii = 0; ii < 3; ii++) { + String e = x[ii]; + if(EndsWith(l, e)) { + links.Add(l.Mid(0, l.GetLength() - e.GetLength()), f); + } + } + labels.Add(l, lbl); + } + + Date d = GetSysDate(); + lastUpdate = HtmlItalic() / HtmlArial(8) / HtmlFontColor(Gray()) / + (String().Cat() << "Last update " << GetSysDate()); + +// Vector amazon = Split(LoadFile(GetRcFile("amazon.txt")), '\n');//440 + + Vector bazaarItems = SvnBazaarList(bazaar, svnlog); + + // To fill Bazaar page with real release dates and size + for(int i = 0; i < tt.GetCount(); i++) { + if (tt[i].title == "Bazaar") { + String page = tt[i]; + for (int j = 0; j < bazaarItems.GetCount(); ++j) { + int pos = page.Find("2 " + DeQtf(bazaarItems[j].name) + "]]"); + if (pos < 0) + pos = page.Find("2 " + DeQtf(bazaarItems[j].name) + "\r\n]]"); + if (pos >= 0) { + pos = page.Find("::", pos); + pos = page.Find("::", pos); + pos = page.Find(":: [s0;=2", pos); + if (pos >= 0) + pos += (int)strlen(":: [s0;=2"); + String strDate; + if (pos >= 0) { + Time t = bazaarItems[j].lastChange; + if (IsNull(t)) + strDate = "Not in Svn log"; + else + strDate = Format("%Mon", t.month) + " " + FormatInt(t.year); + page.Insert(pos, " " + strDate); + } + pos = page.Find(":: [s0;=2", pos); + if (pos >= 0) + pos += (int)strlen(":: [s0;=2"); + String strSz; + if (pos >= 0) { + if (bazaarItems[j].size == 0) + strSz = "Not in Svn log"; + else + strSz = BytesToString(bazaarItems[j].size); + + page.Insert(pos, " " + strSz); + } + } + } + tt[i].text = page; + } + } + + LLOG("G: " << MemoryUsedKb()); + +/* + if (outPdf) { + PdfDraw pdf; + for(int i = 0; i < tt.GetCount(); i++) + QtfAsPdf(pdf, tt[i]); + SaveFile(AppendFileName(pdfdir, "Upp.pdf"), pdf.Finish()); + } +*/ + + LLOG("H: " << MemoryUsedKb()); + + for(int i = 0; i < tt.GetCount(); i++) + ExportPage(i); + SetLanguage(lang); + + LLOG("I: " << MemoryUsedKb()); + +// SaveFile(AppendFileName(targetdir, "favicon.ico"), LoadFile(AppendFileName(uppsrc, "ide/ide.ico"))); + SaveFile(AppendFileName(targetdir, "stats.html"), + HtmlImg("http://www.vol.cz/cgi-bin/wc/upp") + "
" + + HtmlLink("http://www.mygooglepagerank.com", "_blank") / + "" + + "" + + HtmlLink("http://www.mygooglepagerank.com", "_blank") / + "" + + "" + ); + Cout() << "Finished OK\n"; +} diff --git a/uppbox/uppweb/www.tpp/documentation$en-us.tpp b/uppbox/uppweb/www.tpp/documentation$en-us.tpp index 476c673b9..b2d6245db 100644 --- a/uppbox/uppweb/www.tpp/documentation$en-us.tpp +++ b/uppbox/uppweb/www.tpp/documentation$en-us.tpp @@ -73,6 +73,7 @@ tutorial]&] tutorial]&] [s0;l256; [^topic`:`/`/Draw`/srcdoc`/ImgTutorial`$en`-us^ Image tutorial]&] [s0;l256; [^topic`:`/`/Sql`/srcdoc`/tutorial`$en`-us^ Sql Tutorial]&] +[s0;l256; [^topic`:`/`/Skylark`/srcdoc`/Tutorial`$en`-us^ Skylark tutorial]&] [s0;l256;^topic`:`/`/Sql`/srcdoc`/tutorial`$en`-us^ &] [s0;l256;~~~1024; [^topic`:`/`/Core`/srcdoc`/Packages`$en`-us^ Standard Ultimate`+`+ packages]&] @@ -84,4 +85,4 @@ Ultimate`+`+ packages]&] [s0;i256; [^topic`:`/`/uppweb`/www`/svnInstall`$en`-us^ SVN access]&] [s0;i256; [^topic`:`/`/uppweb`/www`/codestyle`$en`-us^ Code style]&] [s0;i256; &] -[s0; [*+117 Packages]] \ No newline at end of file +[s0; [*+117 Packages]]] \ No newline at end of file diff --git a/uppbox/uppweb/www.tpp/documentation$en-us.tppi b/uppbox/uppweb/www.tpp/documentation$en-us.tppi new file mode 100644 index 000000000..a42e70fe1 --- /dev/null +++ b/uppbox/uppweb/www.tpp/documentation$en-us.tppi @@ -0,0 +1,10 @@ +TITLE("Documentation") +COMPRESSED +120,156,149,87,107,83,219,70,20,253,43,59,3,237,36,198,49,251,148,86,246,151,52,144,38,158,166,132,9,164,237,140,199,169,101,121,49,42,178,228,72,107,140,167,211,252,246,158,149,100,91,6,130,67,152,128,181,220,115,238,189,231,62,180,12,56,57,60,164,109,122,64,247,252,235,158,154,171,112,145,216,225,32,225,90,247,98,159,202,94,200,252,222,199,160,247,237,219,183,78,16,240,158,163,98,160,98,84,10,198,25,147,148,74,238,51,21,208,64,105,166,169,240,37,87,62,85,221,121,152,135,179,225,32,212,162,215,250,228,1,197,219,234,64,48,193,40,243,184,132,21,21,148,75,198,21,211,90,50,95,105,17,120,94,55,10,231,54,206,210,225,96,236,112,206,153,0,140,250,218,147,12,32,169,184,240,149,4,88,74,198,240,153,41,223,243,253,174,141,109,98,0,98,158,223,11,37,239,157,56,164,108,123,7,8,143,251,128,74,46,61,41,52,23,76,115,238,5,66,6,18,113,51,222,141,173,65,148,99,96,28,206,193,20,28,74,37,153,128,32,210,87,2,102,62,126, +74,26,48,14,175,154,42,5,135,230,110,173,146,19,200,225,60,184,227,190,114,214,90,106,38,124,205,37,247,56,2,160,62,178,116,222,85,119,98,138,8,56,193,89,207,34,164,222,201,107,213,99,0,251,109,255,128,211,128,114,207,15,224,16,193,34,97,17,4,76,104,56,148,76,81,38,186,81,54,113,73,114,69,69,233,81,163,14,30,152,75,77,148,199,16,48,23,26,46,125,38,4,190,43,169,253,110,97,92,37,108,150,15,7,173,215,47,104,135,118,184,82,47,29,60,0,92,11,41,132,244,2,201,168,128,27,112,72,167,151,71,81,75,166,184,238,142,195,2,62,173,116,202,150,170,50,215,72,16,94,104,37,224,218,195,55,20,21,9,10,104,195,3,169,133,208,180,27,37,97,81,52,4,106,185,36,25,107,51,118,224,59,93,149,224,50,112,226,8,14,129,185,167,2,6,133,149,39,41,239,230,230,235,34,206,205,204,164,144,56,70,111,244,214,229,169,251,16,193,84,125,200,219,140,163,19,149,231,81,167,151,66,55,112,161,32,56,101,90,34,34,124,161,196,182,110, +197,241,54,7,209,102,226,32,224,82,32,146,64,74,40,0,2,22,48,198,168,198,23,50,131,46,101,111,48,132,80,38,81,185,175,224,178,205,228,129,143,30,70,165,2,233,220,7,194,233,199,33,63,247,168,66,29,120,5,231,78,117,126,8,221,25,215,238,127,169,60,83,109,134,97,64,136,76,41,228,45,32,53,215,200,93,65,123,81,246,55,243,117,247,204,44,139,211,208,154,186,97,90,39,135,85,167,49,175,205,188,3,234,240,74,7,40,32,147,78,63,33,101,192,3,33,20,15,148,240,40,116,44,170,89,118,96,55,79,229,44,110,72,252,54,243,49,89,200,85,41,100,95,194,144,185,207,92,40,92,7,158,83,161,38,25,189,74,226,212,197,129,206,232,85,205,208,58,57,98,204,119,68,26,3,163,181,71,69,0,49,160,1,85,232,116,108,3,141,66,163,206,28,99,224,214,65,116,19,78,205,232,85,61,170,255,254,253,223,79,111,207,94,125,190,32,131,130,247,200,105,22,45,92,193,67,55,253,63,15,7,5,189,119,70,178,43,242,57,177,241,12,122,140,142,70, +71,36,46,72,72,230,38,159,133,41,108,200,50,203,111,156,205,60,207,166,136,185,104,147,52,179,196,220,154,124,101,175,227,116,234,236,39,53,161,153,144,149,177,157,218,77,253,99,135,60,202,102,179,69,26,219,149,131,229,38,156,172,136,205,28,247,109,60,49,36,76,137,185,139,76,146,56,199,197,98,62,207,114,75,226,148,216,107,67,6,95,174,173,157,143,186,163,227,209,241,114,185,28,117,22,53,239,124,62,234,100,249,116,116,124,149,229,139,217,232,248,11,41,63,12,119,195,104,137,117,60,131,214,23,155,205,227,168,162,130,219,209,113,8,142,227,56,45,108,152,36,163,67,147,142,94,45,138,47,130,252,25,167,130,147,126,117,94,137,53,93,0,48,252,62,211,69,30,125,158,79,16,85,94,179,126,136,211,197,93,77,241,206,129,27,252,231,31,47,250,127,145,23,165,73,155,188,185,56,109,147,78,167,243,114,199,99,237,107,199,19,132,89,154,113,37,195,113,226,208,15,99,119,48,129,16,37,185,188,54,253,211,183,187,69,95,179,126,122,92,138,247,38,153,159,187, +166,90,243,201,141,120,143,3,222,25,107,209,11,23,54,204,209,4,27,24,169,207,73,81,253,130,44,99,123,93,7,52,124,154,241,188,106,235,226,151,162,48,179,113,18,227,83,58,57,51,133,45,182,236,107,155,54,217,90,161,135,38,164,180,219,227,224,36,75,175,226,233,34,71,120,15,125,109,125,52,204,54,254,74,31,91,227,61,142,126,141,147,38,161,123,36,118,53,223,139,251,205,172,26,48,247,180,207,81,18,78,27,136,55,139,56,153,144,43,119,184,7,120,89,30,110,128,213,35,166,117,15,12,10,196,133,221,226,234,231,253,192,89,24,229,89,35,210,223,203,231,31,107,136,75,51,155,99,50,154,138,238,44,152,243,60,251,199,68,150,108,236,246,208,98,150,26,76,37,69,189,81,201,149,171,20,118,9,184,247,144,68,179,137,91,227,13,9,171,153,115,219,14,189,82,47,249,167,57,250,81,150,158,54,211,234,207,18,130,91,77,60,77,77,62,220,93,169,223,203,101,118,179,133,227,97,237,223,121,39,99,215,14,63,202,116,130,122,20,39,217,172,214,102,58,134, +54,133,27,129,58,177,208,189,35,74,35,114,138,87,65,146,205,221,106,65,231,100,201,61,7,247,220,181,100,45,242,135,120,156,135,249,234,209,181,212,88,213,229,171,112,189,69,234,245,130,189,140,45,210,172,250,240,222,142,79,184,242,238,175,231,157,165,153,225,245,117,27,155,229,70,174,163,128,147,143,245,225,176,65,130,91,17,195,109,250,158,80,39,89,14,165,138,60,194,139,175,122,186,92,224,34,24,135,73,115,113,228,134,220,134,201,162,158,118,98,107,147,231,210,63,70,13,189,80,211,252,89,164,54,79,32,250,83,188,239,62,247,159,65,120,154,135,203,45,155,123,122,200,232,78,31,165,124,138,170,63,155,62,100,234,207,220,72,238,167,186,248,154,108,153,236,3,26,252,154,92,238,39,185,89,37,97,126,243,148,86,181,201,163,17,61,35,158,103,246,194,250,13,212,136,195,98,192,195,124,178,187,5,215,59,172,248,126,142,205,126,112,151,159,137,185,219,178,126,192,34,119,151,62,220,41,240,206,158,76,141,45,190,151,224,147,60,187,115,236,250,54,143,199,11,107, +220,165,239,177,1,46,205,170,207,241,195,144,119,70,56,170,200,220,193,198,221,251,108,233,152,163,141,159,225,143,113,21,183,105,255,222,13,138,92,252,113,70,194,40,194,141,247,7,73,220,31,145,133,93,37,166,57,168,184,212,150,103,59,28,187,170,172,107,58,28,14,255,7,80,154,32,164, +