Changeset 139 for devel/web/UNewsPage.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/UNewsPage.pas
r138 r139 12 12 13 13 uses 14 USqlDatabase, UCore, SysUtils, pwmain, UNews; 14 USqlDatabase, UCore, SysUtils, pwmain, UNews, UConfig; 15 16 function NewsChannelBuild: string; 17 var 18 URL: string; 19 I: Integer; 20 Count: Integer; 21 Index: string; 22 begin 23 Result := ShowHeader('<strong>ZděchovNET</strong> - komunitní počítačová síť', 'Aktuality'); 24 URL := ''; 25 Count := CountCgiVars; 26 for I := 0 to Count - 1 do begin 27 Index := FetchCgiVarName(I); 28 if Copy(Index, 1, 8) = 'category' then URL := URL + '-' + Copy(Index, 9, Length(Index)); 29 end; 30 URL := WebServerAddress + '?p=news-rss&select=' + Copy(URL, 2, Length(URL)); 31 Result := Result + 'Výsledný RSS kanál: <a href="' + URL + '">' + URL + '</a>'; 32 Result := Result + ShowFooter; 33 end; 15 34 16 35 function NewsChannelSelection: string; 36 var 37 DbRows: TDbRows; 38 I: Integer; 17 39 begin 18 40 Result := ShowHeader('<strong>ZděchovNET</strong> - komunitní počítačová síť', 'Aktuality'); 41 Result := Result + 'Vytvořte si vlastní RSS kanál, díky kterému budete moci automaticky sledovat novinky pomocí vaší RSS čtečky. ' + 42 'Informace o technologii RSS a programech pro čtení kanálů najdete např. <a href="http://www.lupa.cz/clanky/prehled-rss-ctecek/">zde</a><br />' + 43 '<br />Kategorie:<br />'; 44 Result := Result + '<form action="?p=news-build" method="post">'; 45 DbRows := Database.Select('news_category', '*', '1 ORDER BY caption'); 46 for I := 0 to DbRows.Count - 1 do 47 Result := Result + '<input type="checkbox" name="category' + DbRows[I].Values['id'] + '">' + 48 DbRows[I].Values['caption']+ '<br />'; 49 Result := Result + '<input type="submit" value="Sestavit ">' + 50 '</form>'; 19 51 Result := Result + ShowFooter; 20 52 end; … … 36 68 Result := ShowHeader('<strong>ZděchovNET</strong> - komunitní počítačová síť', 'Aktuality'); 37 69 if GetCgiVar('id') = '' then Id := 1 else Id := StrToInt(GetCgiVar('id')); 38 DbRows := Database.Query('SELECT `news`.*, `User`.`Name` FROM `news` LEFT JOIN `User` ON `User`.`Id`=`news`.`User` WHERE `news`.`id`=' + IntToStr(Id));70 DbRows := Database.Query('SELECT `news`.*, UNIX_TIMESTAMP(`news`.date) as time, `User`.`Name` FROM `news` LEFT JOIN `User` ON `User`.`Id`=`news`.`User` WHERE `news`.`id`=' + IntToStr(Id)); 39 71 if DbRows.Count > 0 then begin 40 72 NewsItem.LoadFromDbRecord(DbRows[0]); … … 89 121 Result := Result + PagesList('?p=news-list&category=' + IntToStr(Category) + '&page=', Page, PageMax, PerPage); 90 122 91 DbRows := Database.Query('SELECT `news`.*, `User`.`Name` FROM `news` LEFT JOIN `User` ON `User`.`Id`=`news`.`User` WHERE `category`=' + IntToStr(Category) + ' ORDER BY `news`.`id` DESC LIMIT ' + IntToStr(Page * PerPage) + ',' + IntToStr(PerPage));123 DbRows := Database.Query('SELECT `news`.*, UNIX_TIMESTAMP(`news`.date) as time, `User`.`Name` FROM `news` LEFT JOIN `User` ON `User`.`Id`=`news`.`User` WHERE `category`=' + IntToStr(Category) + ' ORDER BY `news`.`id` DESC LIMIT ' + IntToStr(Page * PerPage) + ',' + IntToStr(PerPage)); 92 124 for I := 0 to DbRows.Count - 1 do begin 93 125 NewsItem.LoadFromDbRecord(DbRows[I]); … … 128 160 RegisterPage('news-rss', @RSSChannel); 129 161 RegisterPage('news-selection', @NewsChannelSelection); 162 RegisterPage('news-build', @NewsChannelBuild); 130 163 131 164 end.
Note:
See TracChangeset
for help on using the changeset viewer.