Changeset 137 for devel/web/UCore.pas
Legend:
- Unmodified
- Added
- Removed
-
devel/web
- Property svn:ignore
-
old new 4 4 backup 5 5 6 index 6 index.cgi 7 8 index.compiled
-
- Property svn:ignore
-
devel/web/UCore.pas
r135 r137 19 19 function HumanDate(Date: string): string; 20 20 procedure RegisterPage(Name: string; Producer: TPageProducer); 21 function PagesList(URL: string; Page, TotalCount, CountPerPage: Integer): string; 22 function StrRepeat(Data: string; Count: Integer): string; 23 function FormatOutput(Data: string): string; 21 24 22 25 type … … 52 55 begin 53 56 Navigace := CgiEnvVar.RequestURI; 54 Result := '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' + 55 '<html><head>' + 56 ' <meta http-equiv="Content-Language" content="cs">' + 57 ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' + 57 Result := '<?xml version="1.0" encoding="utf-8"?>' + 58 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' + 59 '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">' + 60 '<head>' + 61 ' <meta http-equiv="Content-Language" content="cs" />' + 62 ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' + 63 ' <link rel="stylesheet" href="style/style.css" type="text/css" media="all" />' + 64 ' <script type="text/javascript" src="style/global.js"></script>' + 58 65 ' <title>Centrála - ' + Path + '</title>' + 59 ' </head><body style="font-family: sans-serif;">' +60 '<div style="padding: 3px; font-size: 20px; border-style: solid; border-color: blue; border-width: 1; background-color: #F0F0FF; margin-bottom: 4px;">' + Title + '</div>'+61 '<div style="border-style: solid; border-bottom-color: gray; border-width: 0 0 1 0; margin-bottom: 3px; padding-bottom: 2px;"><strong>Navigace >></strong> ' + Navigace + '</div>';66 ' </head><body>' + 67 '<div id="Title">' + Title + '</div>'+ 68 '<div class="Navigation"><strong>Navigace >></strong> ' + Navigace + '</div>'; 62 69 end; 63 70 … … 69 76 UpdateDate := '2.5.2007'; 70 77 GenerateTime := '1 s'; 71 Result := '<div style="border-style: solid; border-top-color: gray; border-width: 1 0 0 0; margin-top: 7px; padding-top: 2px;" align="center">'+ 72 ' <i style="font-size: 10;">| Web mistr: Jiří Hajda | e-mail: robie@centrum.cz | ICQ: 277158770 | Vygenerováno za ' + GenerateTime + ' s | Verze: 1.0 | Naposledy aktualizováno: ' + UpdateDate + ' |</i>'+ 73 ' </div>'; 78 Result := '<div id="Footer">| Web mistr: Jiří Hajda | e-mail: robie@centrum.cz | ICQ: 277158770 | Vygenerováno za ' + GenerateTime + ' s | Verze: 1.0 | Naposledy aktualizováno: ' + UpdateDate + ' |' + 79 '</div>'; 74 80 //ShowArray($GLOBALS); 75 81 Result := Result + '</body></html>'; … … 102 108 function InsertIcon(FileName: string): string; 103 109 begin 104 Result := '<img alt="" src=" /dev/centrala/www/images/favicons/' + FileName + '" width="16" height="16">';110 Result := '<img alt="" src="images/favicons/' + FileName + '" width="16" height="16" />'; 105 111 end; 106 112 … … 126 132 end; 127 133 134 function PagesList(URL: string; Page, TotalCount, CountPerPage: Integer): string; 135 const 136 Around: Integer = 10; 137 var 138 Count: Integer; 139 PagesMax: Integer; 140 PagesMin: Integer; 141 I: Integer; 142 begin 143 Count := Round(TotalCount / CountPerPage); 144 Result := ''; 145 if Count > 1 then begin 146 if Page > 0 then begin 147 Result := Result + '<a href="' + URL + '0"><<</a> '; 148 Result := Result + '<a href="' + URL + IntToStr(Page - 1) + '"><</a> '; 149 end; 150 PagesMax := Count - 1; 151 PagesMin := 0; 152 if PagesMax > (Page + Around) then PagesMax := Page + Around; 153 if PagesMin < (Page - Around) then begin 154 Result := Result + ' .. '; 155 PagesMin := Page - Around; 156 end; 157 for I := PagesMin to PagesMax do begin 158 if I = Page then Result := Result + '<strong>'; 159 Result := Result + '<a href="' + URL + IntToStr(I) + '">' + IntToStr(I + 1) + '</a> '; 160 if I = Page then Result := Result + '</strong>'; 161 end; 162 if PagesMax < (Count - 1) then Result := Result + ' .. '; 163 if Page < (Count - 1) then begin 164 Result := Result + '<a href="' + URL + IntToStr(Page + 1) + '">></a> '; 165 Result := Result + '<a href="' + URL + IntToStr(Count - 1) + '">>></a>'; 166 end; 167 end; 168 end; 169 170 function StrRepeat(Data: string; Count: Integer): string; 171 var 172 I: Integer; 173 begin 174 Result := ''; 175 for I := 1 to Count do 176 Result := Result + Data; 177 end; 178 179 function FormatOutput(Data: string): string; 180 var 181 BlockStart, BlockEnd: Integer; 182 Indention: Integer; 183 Indention2: Integer; 184 Line: string; 185 Command: string; 186 begin 187 Result := ''; 188 Indention := 0; 189 Indention2 := 0; 190 while Data <> '' do begin 191 //WebWrite('.'); 192 BlockStart := Pos('<', Data); 193 BlockEnd := Pos('>', Data); 194 if BlockStart > 1 then begin 195 BlockEnd := BlockStart - 1; 196 BlockStart := 1; 197 end; 198 Line := Trim(Copy(Data, BlockStart, BlockEnd)); 199 //WebWriteLn(Line); 200 if Length(Line) > 0 then 201 if Line[1] = '<' then begin 202 if Data[BlockStart + 1] = '/' then begin 203 Indention := Indention - 2; 204 Indention2 := Indention; 205 end else begin 206 if Pos(' ', Line) > 0 then Command := Copy(Line, 2, Pos(' ', Line) - 2) 207 else Command := Copy(Line, 2, Length(Line) - 2); 208 //WebWriteLn(Command + ' ' + IntToStr(Indention)); 209 if Pos('</' + Command + '>', Data) > 0 then Indention := Indention + 2; 210 //WebWriteLn(IntToStr(Indention) + ',' + IntToStr(Indention2)); 211 end; 212 end; 213 if Line <> '' then Result := Result + StrRepeat(' ', Indention2) + Line + #13#10; 214 Data := Copy(Data, BlockEnd + 1, Length(Data)); 215 Indention2 := Indention; 216 end; 217 end; 218 128 219 initialization 129 220
Note:
See TracChangeset
for help on using the changeset viewer.