Changeset 134 for devel/web/UMainPage.pas
- Timestamp:
- Jan 14, 2009, 9:46:16 AM (16 years ago)
- Location:
- devel/web
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/web
-
Property svn:ignore
set to
*.ppu
*.a
*.o
-
Property svn:ignore
set to
-
devel/web/UMainPage.pas
r1 r134 1 1 unit UMainPage; 2 2 3 {$mode delphi}{$H+} 4 3 5 interface 4 6 5 uses 6 UHtmlClasses; 7 function MainPage: string; 7 8 8 9 implementation 9 10 11 uses 12 USqlDatabase, UCore, UHtmlClasses, SysUtils; 13 14 function ShowNews(Category: Integer): string; 10 15 var 11 MainPage: THtmlPage; 16 DbRows: TDbRows; 17 Index: Integer; 18 FontSize: Integer; 19 I: Integer; 20 II: Integer; 21 Enclosures: TArrayOfString; 22 const 23 NewsCountPerCategory = 3; 24 UploadedFilesFolder = 'aktuality/uploads/'; 25 begin 26 // global $NewsCategoryNames, $NewsCountPerCategory, $UploadedFilesFolder; 27 28 DbRows := Database.Select('news_category', '*', 'id=' + IntToStr(Category)); 29 30 Result := '<table cellspacing="0" cellpadding="0" border="0" width="100%" style="font-size: small; padding-bottom: 5px;"><tr>'+ 31 '<td width="40%">' + DbRows[0].Values['caption'] + '</td><td width="80%" align="right">'+ 32 '<a href="aktuality/index.php?category=' + IntToStr(Category) + '">Zobrazit všechny aktuality</a> '; 33 if StrToInt(DbRows[0].Values['permission']) = 1 then Result := Result + '<a href="aktuality/index.php?action=add&category=' + IntToStr(Category) + '">Přidat aktualitu</a> '; 34 Result := Result + '</td></tr><tr><td colspan="2">'+ 35 '<table cellspacing="0" width="100%" style="padding: 2px 2px 2px 2px; font-size: small; border-style: solid; border-color: red; border-width: 1; background-color: #FFF0F0;">'; 36 Index := 0; 37 FontSize := 12; 38 DbRows := Database.Select('news', '*', 'category=' + IntToStr(Category) + ' ORDER BY date DESC LIMIT 0,' + IntToStr(NewsCountPerCategory)); 39 for I := 0 to DbRows.Count - 1 do with DbRows[I] do begin 40 Result := Result + '<tr><td onmouseover="zobraz(''."''new".$Category.$Index."''".'')" style="cursor: pointer; margin: 0px;"><table cellspacing="0" cellpadding="0" style="padding: 0px; margin: 0px; font-size: small; color: red;" width="100%">'+ 41 '<tr><td style="font-size: ' + IntToStr(FontSize) + 'pt"><strong>' + Values['title'] + '</strong></td>'+ 42 '<td align="right" style="font-size: ' + IntToStr(FontSize) + 'pt">' + Values['author'] + ' (' + HumanDate(Values['date']) + ')</td></tr></table>'+ 43 '<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;">' + Values['content']; 44 45 if Values['enclosure'] <> '' then begin 46 Result := Result + '<br>Přílohy: '; 47 Enclosures := Explode(';', Values['enclosure']); 48 for II := 0 to High(Enclosures) do begin 49 // if(file_exists($UploadedFilesFolder.$Enclosure)) echo(' <a href="'.$UploadedFilesFolder.$Enclosure.'">'.$Enclosure.'</a>') 50 end; 51 end; 52 Result := Result + '</div></td></tr>'; 53 Index := Index + 1; 54 FontSize := FontSize - 2; 55 end; 56 Result := Result + '</table></td></tr></table>'; 57 end; 58 59 function MainPage: string; 60 var 61 Output: string; 62 DbRows: TDbRows; 63 I: Integer; 64 begin 65 Output := ShowHeader('<strong>ZděchovNET</strong> - komunitní počítačová síť', 'Rozcestník'); 66 Output := Output + '<script type="text/javascript">'+ 67 '<!--'+ 68 'function openClient(client_type)'+ 69 '{'+ 70 'if(client_type=="java")clientWindow = window.open("http://go.icq.com/icq2go/web.html","ICQ2Go","left=20,top=20,width=156,height=446,toolbar=0,resizable=0");'+ 71 'else clientWindow = window.open("http://go.icq.com/icq2go/flicq.html","ICQ2Go","left=20,top=20,width=176,height=441,toolbar=0,resizable=0");'+ 72 '}'+ 73 74 'var predchozi = ''first'';'+ 75 ''+ 76 'function zobraz(idecko)'+ 77 '{'+ 78 ' skryj(predchozi);'+ 79 'el=document.getElementById(idecko).style;'+ 80 ' el.display=''block'';'+ 81 'predchozi = idecko;'+ 82 '}'+ 83 ''+ 84 'function skryj(idecko)'+ 85 '{'+ 86 'if(idecko != ''first'')'+ 87 '{'+ 88 ' el=document.getElementById(idecko).style;'+ 89 ' el.display=''none'';'+ 90 '}'+ 91 '}'+ 92 '//-->'+ 93 '</script>'+ 94 ''+ 95 '<table width="100%"><tr><td valign="top">' + 96 '<table width="100%">' + 97 '<tr><td width="20%" valign="top">' + 98 '<strong>Důležité odkazy:</strong><br>' + 99 InsertIcon('money.gif') + ' <a href="?p=finance">Finance</a><br>' + 100 InsertIcon('chart.gif') + ' <a href="?p=statistic">Statistika</a><br>' + 101 InsertIcon('prohledavac_sdileni.gif') + ' <a href="/share">Prohledat sdílení</a><br>' + 102 InsertIcon('comp.gif') + ' <a href="/userlist.php">Seznam uživatelů</a><br>' + 103 InsertIcon('comp.gif') + ' <a href="/hostlist.php">Seznam počítačù</a><br>' + 104 InsertIcon('sunrisechat.gif') + ' <a href="/sunrisechat/history.php">Historie SunriseChatu</a><br>' + 105 InsertIcon('sunrisechat.gif') + ' <a href="/sunrisechat/webchat.php">Webový SunriseChatu</a><br>' + 106 InsertIcon('discus.gif') + ' <a href="/forum">Diskusní fórum</a><br>' + 107 InsertIcon('openwebmail.gif') + ' <a href="https://centrala.zdechov.net/cgi-bin/openwebmail/openwebmail.pl">WebMail</a><br>' + 108 InsertIcon('apple.gif') + ' <a href="/jidelna">Jídelníček</a><br>' + 109 InsertIcon('clear.gif') + ' <a href="http://tv.zdechov.net/">Televize</a><br>' + 110 InsertIcon('cube.gif') + ' <a href="http://game-server.zdechov.net/">Herní server</a><br>' + 111 InsertIcon('cfix.gif') + ' <a href="/farnost">Rozpis mší</a><br>' + 112 InsertIcon('tel.gif') + ' <a href="/telseznam.php">Telefonní seznam</a><br>' + 113 InsertIcon('pripoj.gif') + ' <a href="/nabidky_pripojeni.php">Nabídky připojení</a><br>' + 114 InsertIcon('zapisy.gif') + ' <a href="/docs/zapisy/zapisy.php">Zápisy ze schůzí</a><br>' + 115 InsertIcon('lear.gif') + ' <a href="/mapy/mapa.php">Mapa Zděchova</a><br>' + 116 InsertIcon('otv_doby.gif') + '<a href="/otevreno.php">Otvírací doby</a><br>' + 117 InsertIcon('topologie.gif') + ' <a href="/is/topologie.php">Topologie sítě</a><br>' + 118 InsertIcon('satellite.gif') + ' <a href="/is/dostupnost.php">Dostupnost sítě</a><br>' + 119 InsertIcon('tech.gif') + ' <a href="/network.php">Technické informace</a><br>' + 120 InsertIcon('socer.gif') + ' <a href="http://fotbal.zdechov.net/">Fotbal Sokol Zděchov</a><br>' + 121 '<br>' + 122 '<strong>Další odkazy:</strong><br>' + 123 InsertIcon('tv.gif') + ' <a href="/tkr.php">Kanály kabelovky</a><br>'+ 124 InsertIcon('clear.gif') + ' <a href="/mapy/mapa_nabidka.php">Nabídka mapy</a><br>'+ 125 InsertIcon('clear.gif') + ' <a href="/history.php">Historie sítě</a><br>'+ 126 InsertIcon('electric.gif') + ' <a href="/merak.php">Měřič spotřeby</a><br>'+ 127 InsertIcon('clear.gif') + ' <a href="/sluzby.php">Seznam služeb</a><br>'+ 128 InsertIcon('clear.gif') + ' <a href="/ukoly.php">Plány do budoucna</a><br>'+ 129 InsertIcon('clear.gif') + ' <a href="/navody.php">Návody</a><br>'+ 130 InsertIcon('info.gif') + ' <a href="/infokanal/index.htm">Infokanál</a><br>'+ 131 InsertIcon('progman.gif') + ' <a href="/manualy.php">Programátorské manuály</a><br>'+ 132 '<br>'+ 133 '</td><td width="13%" valign="top">'+ 134 '<strong>Vyhledávání:</strong><br>'+ 135 InsertIcon('www_google_com.gif') + ' <a href="http://www.google.cz/">Google</a><br>'+ 136 InsertIcon('morfeo.png') + ' <a href="http://morfeo.centrum.cz">Morfeo</a><br>'+ 137 InsertIcon('www_centrum_cz.gif"') + '<a href="http://www.centrum.cz">Centrum</a><br>'+ 138 InsertIcon('www_seznam_cz.gif') + ' <a href="http://www.seznam.cz">Seznam</a><br>'+ 139 InsertIcon('www_atlas_cz.gif') + ' <a href="http://www.atlas.cz">Atlas</a><br>'+ 140 InsertIcon('www_tiscali_cz.gif') + ' <a href="http://www.tiscali.cz">Tiscali</a><br>'+ 141 '<br>'+ 142 '<strong>Užitečné:</strong><br>'+ 143 InsertIcon('clear.gif') + ' <a href="http://www.zdechov.net">Stránky naší sítě</a><br>'+ 144 InsertIcon('www_tvinfo_cz.gif') + ' <a href="http://www.tvinfo.cz/live/televize/cz">Online TV</a><br>'+ 145 InsertIcon('www_idos_cz.gif') + ' <a href="http://www.idos.cz/ConnForm.asp?tt=c">Jízdní řády</a><br>'+ 146 InsertIcon('www_atlas_cz.gif') + ' <a href="http://tv.atlas.cz">TV programy</a><br>'+ 147 InsertIcon('www_icq_com.gif') + ' Web ICQ <a href="javascript:openClient(''flash'')">Flash</a> <a href="javascript:openClient(''java'')">Java</a><br>'+ 148 InsertIcon('www_centrum_cz.gif') + ' <a href="http://slovniky.centrum.cz">Slovníky</a><br>'+ 149 InsertIcon('pocasi.gif') + ' <a href="http://www.meteopress.cz/">Počasí</a><br>'+ 150 InsertIcon('www_tzones_cz.gif') + ' <a href="http://www.tzones.cz/">T-Mobile SMS</a><br>'+ 151 InsertIcon('www_mvk_cz.png') + ' <a href="http://www.mvk.cz/">Knihovna Vsetín</a><br>'+ 152 '<br>'+ 153 '<strong>Prodej počítačů:</strong><br>'+ 154 InsertIcon('www_computershop_cz.png') + ' <a href="http://shop.computershop.cz/eshop/">SOFTCOM</a><br>'+ 155 InsertIcon('www_alfacomp_cz.gif') + ' <a href="http://www.alfacomp.cz/php/zbozi.php?akc=2">Alfacomp</a><br>'+ 156 InsertIcon('www_petracomp_cz.png') + ' <a href="http://www.petracomp.cz/">Petracomp</a><br>'+ 157 InsertIcon('www_tsbohemia_cz.png') + ' <a href="http://interlink.tsbohemia.cz/">TS Bohemia</a><br>'+ 158 '<br>' + 159 '</td>' + 160 '<td width="15%" valign="top">'; 161 // Zobrazení seznamu online poèítaèù 162 Output := Output + '<strong>Online počítače:</strong><br><span style="font-size: smaller;">'; 163 DbRows := Database.Select('hosts', 'name', 'online=1 AND show_online=1 ORDER BY name'); 164 for I := 0 to DbRows.Count - 1 do with DbRows[I] do begin 165 Output := Output + Values['name'] + '<br>'; 166 end; 167 DbRows.Free; 168 Output := Output + '</span><br>'; 169 170 // Zobrazení seznamu dlu¾níkù 171 Output := Output + '<strong>Dlužníci:</strong><br><span style="font-size: smaller;">'; 172 DbRows := Database.Select('users', 'fullname', 'cash<0 ORDER BY cash'); 173 for I := 0 to DbRows.Count - 1 do with DbRows[I] do begin 174 Output := Output + Values['fullname'] + '<br>'; 175 end; 176 DbRows.Free; 177 Output := Output + '</span>'; 178 Output := Output + '</td></tr></table>'; 179 180 (* 181 // Zobrazení èasu bìhu poèítaèe 182 Data = explode(' ', exec('uptime')); 183 Data = array_slice($Data,3,-8); 184 Uptime = ''; 185 foreach($Data as $Item) 186 { 187 if(strpos($Item,':')) $Uptime .= substr($Item,0,-1).' hodin'; 188 else $Uptime .= $Item.' '; 189 } 190 $Uptime = str_replace('2 days,','2 dny a',$Uptime); 191 $Uptime = str_replace('3 days,','3 dny a',$Uptime); 192 $Uptime = str_replace('4 days,','4 dny a',$Uptime); 193 $Uptime = str_replace('days,','dní a',$Uptime); 194 $Uptime = str_replace('day,','den a',$Uptime); 195 $Uptime = str_replace('min,','minut',$Uptime); 196 echo('Server bì¾í '.$Uptime); 197 *) 198 Output := Output + '</td><td width="50%" valign="top" style="font-size: smaller;">'; 199 200 (* 201 $File = fopen('/tmp/temperature2','r'); 202 $Teplota = fgets($File); 203 $Teplota = round($Teplota*10)/10; 204 fclose($File); 205 206 Output := Output + '<table width="100%"><tr><td><strong>Aktuálnì:</strong></td><td align="right">'+ 207 '<img alt="Teplomer" width="10" height="18" src="images/teplomer3.png"><a href="statistic/trafficview2.php?type=temp">' + Teplota + '°C (mimo provoz)</a></td></tr></table>'; 208 *) 209 210 Output := Output + '<div onmouseout="skryj(predchozi)">'+ ShowNews(5) + ShowNews(3) + ShowNews(1) + ShowNews(2) + ShowNews(4) + ShowNews(6) + ShowNews(8) + ShowNews(9) + ShowNews(10); 211 212 Output := Output + '<a href="aktuality/subscription.php"><img style="margin: 0px 0px 0px 0px;" border="0" src="images/rss20.png" alt="Aktuality pøes RSS"></a> <a href="aktuality/subscription.php">Automatické sledování novinek</a>'+ 213 '</div></td></tr></table>'; 214 Output := Output + ShowFooter; 215 Result := Output; 216 end; 217 218 //var 219 // MainPage: THtmlPage; 12 220 begin 13 221 //MainPage := THtmlPage.Create; 14 15 222 RegisterPage('index', @MainPage); 16 223 end.
Note:
See TracChangeset
for help on using the changeset viewer.