Ignore:
Timestamp:
Jan 14, 2009, 9:46:16 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Přepracována hlavní stránky a přidány další dvě stránky přehledu financí a seznam členů.
  • Upraveno: Kompatibilita s Powtils 1.7.1.
Location:
devel/web
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/web

    • Property svn:ignore set to
      *.ppu
      *.a
      *.o
  • devel/web/UMainPage.pas

    r1 r134  
    11unit UMainPage;
    22
     3{$mode delphi}{$H+}
     4
    35interface
    46
    5 uses
    6   UHtmlClasses;
     7function MainPage: string;
    78 
    89implementation
    910
     11uses
     12  USqlDatabase, UCore, UHtmlClasses, SysUtils;
     13
     14function ShowNews(Category: Integer): string;
    1015var
    11   MainPage: THtmlPage;
     16  DbRows: TDbRows;
     17  Index: Integer;
     18  FontSize: Integer;
     19  I: Integer;
     20  II: Integer;
     21  Enclosures: TArrayOfString;
     22const
     23  NewsCountPerCategory = 3;
     24  UploadedFilesFolder = 'aktuality/uploads/'; 
     25begin
     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>&nbsp;';
     33  if StrToInt(DbRows[0].Values['permission']) = 1 then Result := Result + '<a href="aktuality/index.php?action=add&amp;category=' + IntToStr(Category) + '">Přidat aktualitu</a>&nbsp;';
     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>';
     57end;
     58
     59function MainPage: string;
     60var
     61  Output: string;
     62  DbRows: TDbRows;
     63  I: Integer;
     64begin
     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>' +
     99InsertIcon('money.gif') + ' <a href="?p=finance">Finance</a><br>' +
     100InsertIcon('chart.gif') + ' <a href="?p=statistic">Statistika</a><br>' +
     101InsertIcon('prohledavac_sdileni.gif') + ' <a href="/share">Prohledat sdílení</a><br>' +
     102InsertIcon('comp.gif') + ' <a href="/userlist.php">Seznam uživatelů</a><br>' +
     103InsertIcon('comp.gif') + ' <a href="/hostlist.php">Seznam počítačù</a><br>' +
     104InsertIcon('sunrisechat.gif') + ' <a href="/sunrisechat/history.php">Historie SunriseChatu</a><br>' +
     105InsertIcon('sunrisechat.gif') + ' <a href="/sunrisechat/webchat.php">Webový SunriseChatu</a><br>' +
     106InsertIcon('discus.gif') + ' <a href="/forum">Diskusní fórum</a><br>' +
     107InsertIcon('openwebmail.gif') + ' <a href="https://centrala.zdechov.net/cgi-bin/openwebmail/openwebmail.pl">WebMail</a><br>' +
     108InsertIcon('apple.gif') + ' <a href="/jidelna">Jídelníček</a><br>' +
     109InsertIcon('clear.gif') + ' <a href="http://tv.zdechov.net/">Televize</a><br>' +
     110InsertIcon('cube.gif') + ' <a href="http://game-server.zdechov.net/">Herní server</a><br>' +
     111InsertIcon('cfix.gif') + ' <a href="/farnost">Rozpis mší</a><br>' +
     112InsertIcon('tel.gif') + ' <a href="/telseznam.php">Telefonní seznam</a><br>' +
     113InsertIcon('pripoj.gif') + ' <a href="/nabidky_pripojeni.php">Nabídky připojení</a><br>' +
     114InsertIcon('zapisy.gif') + ' <a href="/docs/zapisy/zapisy.php">Zápisy ze schůzí</a><br>' +
     115InsertIcon('lear.gif') + ' <a href="/mapy/mapa.php">Mapa Zděchova</a><br>' +
     116InsertIcon('otv_doby.gif') + '<a href="/otevreno.php">Otvírací doby</a><br>' +
     117InsertIcon('topologie.gif') + ' <a href="/is/topologie.php">Topologie sítě</a><br>' +
     118InsertIcon('satellite.gif') + ' <a href="/is/dostupnost.php">Dostupnost sítě</a><br>' +
     119InsertIcon('tech.gif') + ' <a href="/network.php">Technické informace</a><br>' +
     120InsertIcon('socer.gif') + ' <a href="http://fotbal.zdechov.net/">Fotbal Sokol Zděchov</a><br>' +
     121'<br>' +
     122'<strong>Další odkazy:</strong><br>' +
     123InsertIcon('tv.gif') + ' <a href="/tkr.php">Kanály kabelovky</a><br>'+
     124InsertIcon('clear.gif') + ' <a href="/mapy/mapa_nabidka.php">Nabídka mapy</a><br>'+
     125InsertIcon('clear.gif') + ' <a href="/history.php">Historie sítě</a><br>'+
     126InsertIcon('electric.gif') + ' <a href="/merak.php">Měřič spotřeby</a><br>'+
     127InsertIcon('clear.gif') + ' <a href="/sluzby.php">Seznam služeb</a><br>'+
     128InsertIcon('clear.gif') + ' <a href="/ukoly.php">Plány do budoucna</a><br>'+
     129InsertIcon('clear.gif') + ' <a href="/navody.php">Návody</a><br>'+
     130InsertIcon('info.gif') + ' <a href="/infokanal/index.htm">Infokanál</a><br>'+
     131InsertIcon('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>'+
     135InsertIcon('www_google_com.gif') + ' <a href="http://www.google.cz/">Google</a><br>'+
     136InsertIcon('morfeo.png') + ' <a href="http://morfeo.centrum.cz">Morfeo</a><br>'+
     137InsertIcon('www_centrum_cz.gif"') + '<a href="http://www.centrum.cz">Centrum</a><br>'+
     138InsertIcon('www_seznam_cz.gif') + ' <a href="http://www.seznam.cz">Seznam</a><br>'+
     139InsertIcon('www_atlas_cz.gif') + ' <a href="http://www.atlas.cz">Atlas</a><br>'+
     140InsertIcon('www_tiscali_cz.gif') + ' <a href="http://www.tiscali.cz">Tiscali</a><br>'+
     141'<br>'+
     142'<strong>Užitečné:</strong><br>'+
     143InsertIcon('clear.gif') + ' <a href="http://www.zdechov.net">Stránky naší sítě</a><br>'+
     144InsertIcon('www_tvinfo_cz.gif') + ' <a href="http://www.tvinfo.cz/live/televize/cz">Online TV</a><br>'+
     145InsertIcon('www_idos_cz.gif') + ' <a href="http://www.idos.cz/ConnForm.asp?tt=c">Jízdní řády</a><br>'+
     146InsertIcon('www_atlas_cz.gif') + ' <a href="http://tv.atlas.cz">TV programy</a><br>'+
     147InsertIcon('www_icq_com.gif') + ' Web ICQ <a href="javascript:openClient(''flash'')">Flash</a>&nbsp;<a href="javascript:openClient(''java'')">Java</a><br>'+
     148InsertIcon('www_centrum_cz.gif') + ' <a href="http://slovniky.centrum.cz">Slovníky</a><br>'+
     149InsertIcon('pocasi.gif') + ' <a href="http://www.meteopress.cz/">Počasí</a><br>'+
     150InsertIcon('www_tzones_cz.gif') + ' <a href="http://www.tzones.cz/">T-Mobile SMS</a><br>'+
     151InsertIcon('www_mvk_cz.png') + ' <a href="http://www.mvk.cz/">Knihovna&nbsp;Vsetín</a><br>'+
     152'<br>'+
     153'<strong>Prodej počítačů:</strong><br>'+
     154InsertIcon('www_computershop_cz.png') + ' <a href="http://shop.computershop.cz/eshop/">SOFTCOM</a><br>'+
     155InsertIcon('www_alfacomp_cz.gif') + ' <a href="http://www.alfacomp.cz/php/zbozi.php?akc=2">Alfacomp</a><br>'+
     156InsertIcon('www_petracomp_cz.png') + ' <a href="http://www.petracomp.cz/">Petracomp</a><br>'+
     157InsertIcon('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);
     196echo('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;
     204fclose($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;
     216end;
     217
     218//var
     219//  MainPage: THtmlPage;
    12220begin
    13221  //MainPage := THtmlPage.Create;
    14  
    15  
     222  RegisterPage('index', @MainPage);   
    16223end.
Note: See TracChangeset for help on using the changeset viewer.