diff --git a/core/misc.cpp b/core/misc.cpp index b45730f..b9be1a3 100755 --- a/core/misc.cpp +++ b/core/misc.cpp @@ -343,7 +343,7 @@ std::wstring::iterator i; { if( !CorrectUrlChar(*i) ) { - wchar_t c = TemplatesFunctions::locale.Subst(*i); + wchar_t c = TemplatesFunctions::locale.UrlSubst(*i); if( CorrectUrlChar(c) ) *i = c; diff --git a/html/fun_cat.html b/html/fun_cat.html index 905edf0..2787bca 100755 --- a/html/fun_cat.html +++ b/html/fun_cat.html @@ -34,7 +34,4 @@ -[include "item_options.html"] - - diff --git a/html/fun_gallery.html b/html/fun_gallery.html index bc6bb95..d2af30b 100755 --- a/html/fun_gallery.html +++ b/html/fun_gallery.html @@ -77,5 +77,3 @@ [end] -[include "item_options.html"] - diff --git a/html/fun_ls.html b/html/fun_ls.html index a41eb84..a2d0e72 100755 --- a/html/fun_ls.html +++ b/html/fun_ls.html @@ -96,7 +96,6 @@ [end] - [include "item_options.html"] [end] diff --git a/html/fun_run.html b/html/fun_run.html index 998f1b1..0377beb 100755 --- a/html/fun_run.html +++ b/html/fun_run.html @@ -20,6 +20,3 @@ -[include "item_options.html"] - - diff --git a/locale/substitute b/locale/substitute index dd4ce35..90fd84e 100755 --- a/locale/substitute +++ b/locale/substitute @@ -1,7 +1,16 @@ # these tables are used to change url characters -# one character from 'original' table at a specific position -# will be translated to one character from 'changeto' at the same position +# one character from 'url_original' table at a specific position +# will be translated to one character from 'url_changeto' at the same position + +url_original = "ąćęłńóśźżĄĆĘŁŃÓŚŹŻ" +url_changeto = "acelnoszzacelnoszz" + + +# these tables are used to change from small to capital letters +# ASCII characters (a-z, A-Z) are tested beforehand +# so these tables are not used for such characters + +smallleters = "ąćęłńóśźż" +capitalics = "ĄĆĘŁŃÓŚŹŻ" -original = "ąćęłńóśźżĄĆĘŁŃÓŚŹŻ" -changeto = "acelnoszzacelnoszz" diff --git a/static/basic/winix.css b/static/basic/winix.css new file mode 100755 index 0000000..d8892ff --- /dev/null +++ b/static/basic/winix.css @@ -0,0 +1,474 @@ +/* ---------------------- clearing -------------------------- */ + +html, body { +color: black; +background: white; +} + +html, body, div, span, +applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +dd, dl, dt, li, ol, ul, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; + padding: 0; + border: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + line-height: 1.4em; + font-family: inherit; + text-align: left; + vertical-align: baseline; +} + +a img, :link img, :visited img { + border: 0; +} + +table { + border-collapse: collapse; + border-spacing: 0; +} + +ol, ul { + list-style: none; +} + +q:before, q:after, +blockquote:before, blockquote:after { + content: ""; +} + + + +p.withnext { +margin: 1em 0 0 0; +width: 520px; +} + +p.iteminfo { +font-size: 0.7em; +color: #AAAAAA; +margin: 0.4em 0 1.8em 0; +} + +p.itemtabinfo { +font-size: 0.7em; +color: #AAAAAA; +margin: 0 0 1em 0; +padding: 0.5em 0 0 0; +} + +p.itemtabinfo2 { +font-size: 0.7em; +color: #AAAAAA; +margin: 0 0 1em 0; +padding: 1.5em 0 0 0; +} + +.error { +color: red; +font-weight: bold; +} + + +#additem legend { +display: none; +} + + +#additem .edit { +margin: 0.3em 0 0.3em 0; +padding: 0.2em; +border: 1px solid #dedede; +display: block; +width: 530px; +} + +#additem .editshort { +margin: 0.3em 0 0.3em 0; +padding: 0.2em; +border: 1px solid #dedede; +display: block; +width: 250px; +} + +#additem .check { +vertical-align: middle; +} + + +#additem label { +vertical-align: top; +margin: 0.3em 0 0.3em 0; +padding: 0.2em; +display: block; +} + + + +#additem select { +border: 1px solid #dedede; +width: 100px; +margin: 0.3em 0 0.3em 0; +} + + +#additem select.contenttype { +width: 150px; +} + + +#additem select.template { +width: 200px; +} + + +#additem .privileges { +margin: 0.5em 0 0.5em 0; +border: 1px solid #dedede; +display: block; +width: 100px; +} + + +#additem .multitext { +margin: 0.5em 0 0.5em 0; +border: 1px solid #dedede; +display: block; +width: 530px; +} + +#additem .multitextfull { +margin: 0.5em 0 0.5em 0; +border: 1px solid #dedede; +display: block; +width: 630px; +} + + +#additem .submit { +margin: 1.5em 0 0.5em 0; +display: block; +width: 10em; +padding: 0.2em; +} + +div.itemoptions { +clear: both; +border-top: 1px solid #D1D1E1; +padding: 1em; +margin: 5em 0 1em 0; +} + +div.itemoptions h2 { +margin-top: 0; +font-size: 1.1em; +} + + +ul.itemmenu { +overflow: hidden; +margin: 1em 0 2em 0; +display: block; +} + + +/* ie6 has some problems */ +* html ul.itemmenu { +overflow: visible; +height: 1em; +} + +ul.itemmenu li { +display: block; +margin-right: 2em; +font-size: 0.8em; +line-height: 1.8em; +} + + +div.threadbox { +padding: 0.2em 1em 1em 1em; +} + + +div.threadboxcolor { +background: #F4F4F4; +border-radius: 8px; +-moz-border-radius: 8px; +-webkit-border-radius: 8px; +} + + +div.threadbox a.threadedit { +margin: 0.5em 0 0 0; +float: right; +font-size: 0.8em; +} + + +table.forum { +border: 1px solid #D1D1E1; +} + + +table.forum th { +border: 1px solid #D1D1E1; +} + + +table.forum td { +border: 1px solid #D1D1E1; +} + +table.forum a { +display: block; +padding: 0 4px 0 4px; +} + +.smallfont { +font-size: 0.7em; +} + +table.tickettab { +border: 1px solid #D1D1E1; +} + + +table.tickettab th { +font-weight: bold; +} + + +table.tickettab th, table.tickettab td { +text-align: center; +border: 0; +font-size: 0.7em; +border: 1px solid #D1D1E1; +vertical-align: middle; +} + +table.tickettab td.tickettabtitle { +font-size: 1em; +text-align: left; +padding: 0 4px 0 4px; +} + +table.tickettab a { +display: block; +padding: 0 4px 0 4px; +} + +table.ticket { +margin: 1em 0 1em 0; +} + + +table.ticket th { +text-align: left; +font-weight: normal; +padding: 0 1em 0 0; +} + + +table.ticket th, table.ticket td { +border: 0; +vertical-align: middle; +} + + +table.ticket input { +margin: 0.3em 0 0.3em 0; +padding: 0.2em; +border: 1px solid #dedede; +display: block; +width: 100px; +} + + +div.ticketinfo { +background: #FFFED5; +padding: 2em; +border: 1px dotted #AFAFAF; +} + + +div.ticketinfo table th { +text-align: left; +border: 0; +padding: 0 1em 0 0; +} + + +div.ticketinfo table td { +border: 0; +} + + +div.ticketinfo p.edit { +font-size: 0.8em; +text-align: right; +float: right; +} + + +ul.ls_browse li { +display: block; +float: left; +margin: 10px; +list-style-type: none; +} + + +strong { +font-weight: bold; +} + +img.catimage { +max-width: 600px; +} + +pre.nowinixbreak { +display: inline; +white-space: normal; +} + + + +/* + from bbcode +*/ + +span.bbitalic { +font-style: italic; +} + + +span.bbunderline { +text-decoration: underline; +} + + +span.bbstrike { +text-decoration: line-through; +} + + +div.bbquote { +display: block; +padding: 0.5em; +margin: 0.5em 0 1em 0; +border: 1px solid #C3C3C3; +background: #F0F0F0; +} + +div.bbquote span.bbquotewho { +font-size: 0.8em; +color: #BABABA; +} + +code.bbcode { +display: block; +background-color: #fafafa; +padding: 1em; +font-size: 0.8em; +} + + +ul.bblist { +margin-left: 2em; +} + + +ul.bblist li { +list-style-type: disc; +} + +span.bbcolyellow { +color: yellow; +} + +span.bbcolred { +color: red; +} + +span.bbcolgreen { +color: green; +} + +span.bbcolblue { +color: blue; +} + +span.bbcolbrown { +color: brown; +} + +span.bbcolblack { +color: black; +} + + + +ul.galleryimages li { +display: block; +float: left; +margin: 0 0 6px 10px; +} + +ul.galleryimages a, ul.galleryimages a:hover, ul.galleryimages a:focus, ul.galleryimages a:active { +background: none; +} + +ul.galleryimages img { +background: none; +} + +table.mountpoints { + +} + +table.mountpoints th { +font-weight: bold; +white-space: normal; +text-align: center; +} + +table.slog th, table.slog td { +border: 0; +} + +td.slogerror { +background: red; +color: white; +} + +ul#sortable li{ +list-style-type: none; +display: block; +padding: 0.2em 1em 0.2em 1em; +border: 1px solid #D3D3D3; +background: #EDEDED; +margin: 0.3em 0 0.3em 0; +} + +ul#sortable input{ +width: 30px; +margin: 0 10px 0 0; +} + +ul#sortable img { +height: 50px; +} + + +div#fileupload { +font-size: 0.8em; +} + diff --git a/templates/filters.cpp b/templates/filters.cpp index f744272..6b21cf5 100755 --- a/templates/filters.cpp +++ b/templates/filters.cpp @@ -2,7 +2,7 @@ * This file is a part of Winix * and is not publicly distributed * - * Copyright (c) 2008-2010, Tomasz Sowa + * Copyright (c) 2008-2011, Tomasz Sowa * All rights reserved. * */ @@ -36,12 +36,7 @@ void fil_capitalize(Info & i) const std::wstring & str = i.in.Str(); for(size_t a=0 ; a='a' && str[a]<='z' ) - i.out << R(wchar_t(str[a] - 'a' + 'A')); - else - i.out << R(str[a]); - } + i.out << R(locale.ToCapital(str[a])); } @@ -50,12 +45,7 @@ void fil_tosmall(Info & i) const std::wstring & str = i.in.Str(); for(size_t a=0 ; a='A' && str[a]<='Z' ) - i.out << R(wchar_t(str[a] - 'A' + 'a')); - else - i.out << R(str[a]); - } + i.out << R(locale.ToSmall(str[a])); } @@ -72,10 +62,7 @@ void fil_firstup(Info & i) if( str[a]!=' ' && str[a]!='\t' && str[a]!=13 && str[a]!=10 && str[a]!=160 ) was_dot = false; - if( str[a]>='a' && str[a]<='z' ) - i.out << R(wchar_t(str[a] - 'a' + 'A')); - else - i.out << R(str[a]); + i.out << R(locale.ToCapital(str[a])); } else { diff --git a/templates/locale.cpp b/templates/locale.cpp index 63fc865..01b50d2 100755 --- a/templates/locale.cpp +++ b/templates/locale.cpp @@ -6,7 +6,8 @@ * All rights reserved. * */ - + +#include #include "locale.h" #include "core/log.h" #include "utf8.h" @@ -102,8 +103,9 @@ void Locale::ReadSubstTable(const char * dir, const char * dir_def) { bool read = false; - subst_original.clear(); - subst_changeto.clear(); + subst_url.clear(); + subst_smalllet.clear(); + subst_capitallet.clear(); if( dir_def && ReadSubstTable(dir_def) ) read = true; @@ -130,8 +132,10 @@ bool read = false; if( loc_parser.Parse(file_name) == ConfParser::ok ) { read = true; - subst_original = loc_parser.table_single[L"original"]; - subst_changeto = loc_parser.table_single[L"changeto"]; + CreateSubstVector(subst_url, loc_parser.table_single[L"url_original"], loc_parser.table_single[L"url_changeto"]); + CreateSubstVector(subst_smalllet, loc_parser.table_single[L"smallleters"], loc_parser.table_single[L"capitalics"]); + CreateSubstVector(subst_capitallet, loc_parser.table_single[L"capitalics"], loc_parser.table_single[L"smallleters"]); + log << log3 << "Locale: read characters substitution tables from: " << file_name << logend; } @@ -139,6 +143,28 @@ return read; } +void Locale::CreateSubstVector(std::vector & vect, const std::wstring & tab1, const std::wstring & tab2) +{ + size_t i, min_size = (tab1.size() < tab2.size()) ? tab1.size() : tab2.size(); + SubstItem s; + + vect.clear(); + + if( min_size == 0 ) + return; + + vect.reserve(min_size); + + for(i=0 ; i & vect, wchar_t val) { -size_t i = subst_original.find(c); + if( vect.empty() ) + return val; - if( i == std::wstring::npos || i >= subst_changeto.size() ) - return c; + size_t o1 = 0; + size_t o2 = vect.size() - 1; -return subst_changeto[i]; + if( val < vect[o1].from ) + return val; + + if( val == vect[o1].from ) + return vect[o1].to; + + if( val > vect[o2].from ) + return val; + + if( val == vect[o2].from ) + return vect[o2].to; + + while( o1 + 1 < o2 ) + { + size_t o = (o1 + o2) / 2; + + if( val == vect[o].from ) + return vect[o].to; + + if( val < vect[o].from ) + o2 = o; + else + o1 = o; + } + +return val; } -void Locale::Subst(std::wstring & str) + +wchar_t Locale::UrlSubst(wchar_t c) +{ + return SubstFind(subst_url, c); +} + + +void Locale::UrlSubst(std::wstring & str) { for(size_t i=0 ; i='A' && c<='Z' ) + return c - 'A' + 'a'; + + return SubstFind(subst_capitallet, c); +} + + +void Locale::ToSmall(std::wstring & str) +{ + for(size_t i=0 ; i='a' && c<='z' ) + return c - 'a' + 'A'; + + return SubstFind(subst_smalllet, c); +} + + +void Locale::ToCapital(std::wstring & str) +{ + for(size_t i=0 ; i & vect, const std::wstring & tab1, const std::wstring & tab2); + wchar_t SubstFind(const std::vector & vect, wchar_t val); // locale files // we have at least one item "en" @@ -115,9 +128,10 @@ private: // this table has the same size as locale_files (at least one item) std::vector loc_tab_multi; - // these tables are used to change url characters - std::wstring subst_original; - std::wstring subst_changeto; + // vectors of characters substitution (sort by 'from') + std::vector subst_url; + std::vector subst_smalllet; // changing from small to capital + std::vector subst_capitallet; // changing from capital to small ConfParser loc_parser;