Changeset 139 for devel/web/UMainPage.pas
- Timestamp:
- Jan 16, 2009, 1:41:07 PM (16 years ago)
- Location:
- devel/web
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/web
- Property svn:ignore
-
old new 7 7 8 8 index.compiled 9 10 UConfig.pas
-
- Property svn:ignore
-
devel/web/UMainPage.pas
r138 r139 10 10 11 11 uses 12 USqlDatabase, UCore, UHtmlClasses, SysUtils; 13 14 function ShowNews(Category: Integer): string; 15 var 16 DbRows: TDbRows; 17 Index: Integer; 18 FontSize: Integer; 19 I: Integer; 20 II: Integer; 21 Enclosures: TArrayOfString; 22 Content: string; 23 const 24 NewsCountPerCategory = 3; 25 // UploadedFilesFolder = 'aktuality/uploads/'; 26 begin 27 // global $NewsCategoryNames, $NewsCountPerCategory, $UploadedFilesFolder; 28 29 DbRows := Database.Select('news_category', '*', 'id=' + IntToStr(Category)); 30 31 Result := '<table class="MainTable"><tr>' + 32 '<td>' + DbRows[0].Values['caption'] + '</td><td align="right">'+ 33 '<a href="?p=news-list&category=' + IntToStr(Category) + '">Zobrazit všechny aktuality</a> '; 34 if StrToInt(DbRows[0].Values['permission']) = 1 then 35 Result := Result + '<a href="aktuality/index.php?action=add&category=' + IntToStr(Category) + '">Přidat aktualitu</a> '; 36 Result := Result + '</td></tr><tr><td colspan="2">'+ 37 '<table>'; 38 Index := 0; 39 FontSize := 12; 40 DbRows := Database.Select('news', '*', 'category=' + IntToStr(Category) + ' ORDER BY date DESC LIMIT 0,' + IntToStr(NewsCountPerCategory)); 41 for I := 0 to DbRows.Count - 1 do with DbRows[I] do begin 42 Content := Values['content']; 43 Content := StringReplace(Content, '<br>', '<br />', [rfReplaceAll]); 44 Result := Result + '<tr><td onmouseover="zobraz(''new' + IntToStr(Category) + '_' + IntToStr(I) + ''')" style="cursor: pointer; margin: 0px;"><table cellspacing="0" cellpadding="0" style="padding: 0px; margin: 0px; font-size: small; color: red;" width="100%">'+ 45 '<tr><td style="font-size: ' + IntToStr(FontSize) + 'pt"><strong>' + Values['title'] + '</strong></td>'+ 46 '<td align="right" style="font-size: ' + IntToStr(FontSize) + 'pt">' + Values['author'] + ' (' + HumanDate(Values['date']) + ')</td></tr></table>'+ 47 '<div id="new' + IntToStr(Category) + '_' + IntToStr(Index) + '" class="skryty" style="display: none; border-width: 1; border-style: solid; border-color: blue; padding: 3px; font-size: 9pt;">' + Content; 48 49 if Values['enclosure'] <> '' then begin 50 Result := Result + '<br />Přílohy: '; 51 Enclosures := Explode(';', Values['enclosure']); 52 for II := 0 to High(Enclosures) do begin 53 // if(file_exists($UploadedFilesFolder.$Enclosure)) echo(' <a href="'.$UploadedFilesFolder.$Enclosure.'">'.$Enclosure.'</a>') 54 end; 55 end; 56 Result := Result + '</div></td></tr>'; 57 Index := Index + 1; 58 FontSize := FontSize - 2; 59 end; 60 Result := Result + '</table></td></tr></table>'; 61 end; 12 USqlDatabase, UCore, SysUtils, UNews; 62 13 63 14 function MainPage: string; … … 66 17 DbRows: TDbRows; 67 18 I: Integer; 19 News: TNews; 68 20 begin 69 21 Output := ShowHeader('<strong>ZděchovNET</strong> - komunitní počítačová síť', 'Rozcestník'); … … 132 84 '<div class="Panel">'; 133 85 134 // Zobrazení seznamu online po èítaèù86 // Zobrazení seznamu online počítačů 135 87 Output := Output + '<strong>Online počítače:</strong><br /><span style="font-size: smaller;">'; 136 88 DbRows := Database.Select('hosts', 'name', 'online=1 AND show_online=1 ORDER BY name'); … … 169 121 $Uptime = str_replace('day,','den a',$Uptime); 170 122 $Uptime = str_replace('min,','minut',$Uptime); 171 echo('Server b ì¾í '.$Uptime);123 echo('Server běží '.$Uptime); 172 124 *) 173 125 Output := Output + '</div></td><td valign="top">'; … … 183 135 *) 184 136 185 Output := Output + '<div onmouseout="skryj(predchozi)">' + ShowNews(5) + ShowNews(3) + ShowNews(1) + ShowNews(2) + ShowNews(4) + ShowNews(6) + ShowNews(8) + ShowNews(9) + ShowNews(10); 137 News := TNews.Create; 138 News.LoadFromDb; 139 with News do 140 Output := Output + '<div onmouseout="skryj(predchozi)">' + ShowNews(5) + ShowNews(3) + ShowNews(1) + ShowNews(2) + ShowNews(4) + ShowNews(6) + ShowNews(8) + ShowNews(9) + ShowNews(10); 141 News.Free; 186 142 187 Output := Output + '<a href=" aktuality/subscription.php"><img src="images/rss20.png" alt="Aktuality přes RSS" /></a> <a href="aktuality/subscription.php">Automatické sledování novinek</a>'+143 Output := Output + '<a href="?p=news-selection"><img src="images/rss20.png" alt="Aktuality přes RSS" /></a> <a href="?p=news-selection">Automatické sledování novinek</a>'+ 188 144 '</div></td></tr></table>'; 189 145 Output := Output + ShowFooter; … … 191 147 end; 192 148 193 //var194 // MainPage: THtmlPage;195 149 begin 196 //MainPage := THtmlPage.Create; 197 RegisterPage('index', @MainPage); 150 RegisterPage('index', @MainPage); 198 151 end.
Note:
See TracChangeset
for help on using the changeset viewer.