Changeset 103 for trunk/Modules/Portal


Ignore:
Timestamp:
Oct 8, 2012, 8:48:16 AM (12 years ago)
Author:
chronos
Message:
  • Upraveno: TWebSession zobecněno pro možnost implementace více modulů s obsluhou vstupní stránky.
Location:
trunk/Modules/Portal
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Portal/UModulePortal.pas

    r102 r103  
    66
    77uses
    8   Classes, SysUtils, UModularSystem, SpecializedDictionary, USqlDatabase;
     8  Classes, SysUtils, UModularSystem, SpecializedDictionary, USqlDatabase,
     9  UUtils, UWebSession, SpecializedList, UUser;
    910
    1011type
     
    1415  TModulePortal = class(TModule)
    1516  private
     17    Time: TDateTime;
     18    function ShowFooter(Session: TWebSession): string;
     19    function ShowHeader(Session: TWebSession): string;
    1620  public
    1721    constructor Create(Owner: TComponent); override;
     
    4044  License := 'GNU/LGPL v3';
    4145  Author := 'Chronosoft';
     46  Dependencies.Add('User');
    4247end;
    4348
     
    6974
    7075    Core.CommonDatabase.Query(DbRows,
    71     'CREATE TABLE IF NOT EXISTS `User` (' +
    72     '  `Id` int(11) NOT NULL AUTO_INCREMENT,' +
    73     '  `Name` varchar(255) NOT NULL,' +
    74     '  `FullName` varchar(255) NOT NULL,' +
    75     '  `Password` varchar(255) NOT NULL,' +
    76     '  `Salt` varchar(255) NOT NULL,' +
    77     '  `Email` varchar(255) NOT NULL,' +
    78     '  `RegistrationTime` datetime NOT NULL,' +
     76    'CREATE TABLE IF NOT EXISTS `Panel` (' +
     77    '  `Id` int(11) NOT NULL AUTO_INCREMENT,' +
     78    '  `Module` varchar(255) COLLATE utf8_czech_ci NOT NULL,' +
     79    '  `Parameters` varchar(255) COLLATE utf8_czech_ci NOT NULL,' +
     80    '  `Order` int(11) NOT NULL,' +
     81    '  `PanelColumn` int(11) NOT NULL,' +
     82    '  PRIMARY KEY (`Id`),' +
     83    '  KEY `PanelColumn` (`PanelColumn`)' +
     84    ') ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;');
     85
     86    Core.CommonDatabase.Query(DbRows,
     87    'CREATE TABLE IF NOT EXISTS `PanelColumn` (' +
     88    '  `Id` int(11) NOT NULL AUTO_INCREMENT,' +
     89    '  `Width` varchar(255) COLLATE utf8_czech_ci NOT NULL,' +
    7990    '  PRIMARY KEY (`Id`)' +
    80     ') ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
    81 
    82     Data.Add('Id', '1');
    83     Data.Add('Name', 'anonymous');
    84     Data.Add('FullName', 'Anonymous');
    85     Data.Add('RegistrationTime', 'NOW()');
    86     Data.Add('Password', '');
    87     Data.Add('Salt', '');
    88     Data.Add('Email', '');
    89     Core.CommonDatabase.Insert('User', Data);
    90 
    91     Core.CommonDatabase.Query(DbRows,
    92     'CREATE TABLE IF NOT EXISTS `UserOnline` (' +
    93     '  `Id` int(11) NOT NULL AUTO_INCREMENT,' +
    94     '  `User` int(11) NOT NULL DEFAULT ''0'',' +
    95     '  `ActivityTime` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',' +
    96     '  `LoginTime` datetime NOT NULL DEFAULT ''0000-00-00 00:00:00'',' +
    97     '  `SessionId` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '''',' +
    98     '  `IpAddress` varchar(16) COLLATE utf8_czech_ci NOT NULL DEFAULT '''',' +
    99     '  `HostName` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '''',' +
    100     '  `ScriptName` varchar(255) COLLATE utf8_czech_ci NOT NULL,' +
     91    ') ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;');
     92
     93    Core.CommonDatabase.Query(DbRows,
     94    'ALTER TABLE `Panel`' +
     95    '  ADD CONSTRAINT `Panel_ibfk_1` FOREIGN KEY (`PanelColumn`) REFERENCES `panelcolumn` (`Id`);');
     96
     97    Core.CommonDatabase.Query(DbRows,
     98    'CREATE TABLE IF NOT EXISTS `HyperlinkGroup` (' +
     99    '  `Id` int(11) NOT NULL AUTO_INCREMENT,' +
     100    '  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,' +
     101    '  PRIMARY KEY (`Id`)' +
     102    ') ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;');
     103
     104    Core.CommonDatabase.Query(DbRows,
     105    'CREATE TABLE IF NOT EXISTS `Hyperlink` (' +
     106    '  `Id` int(11) NOT NULL AUTO_INCREMENT,' +
     107    '  `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,' +
     108    '  `URL` varchar(255) COLLATE utf8_czech_ci NOT NULL,' +
     109    '  `Group` int(11) NOT NULL,' +
     110    '  `IconFile` varchar(255) COLLATE utf8_czech_ci NOT NULL,' +
     111    '  `PermissionModule` varchar(255) COLLATE utf8_czech_ci NOT NULL,' +
     112    '  `PermissionOperation` varchar(255) COLLATE utf8_czech_ci NOT NULL,' +
     113    '  `Enable` int(11) NOT NULL DEFAULT "1",' +
    101114    '  PRIMARY KEY (`Id`),' +
    102     '  KEY `User` (`User`)' +
    103     ') ENGINE=MEMORY  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;');
     115    '  KEY `Group` (`Group`),' +
     116    '  KEY `Enable` (`Enable`)' +
     117    ') ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;');
     118
     119    Core.CommonDatabase.Query(DbRows,
     120    'ALTER TABLE `Hyperlink`' +
     121    '  ADD CONSTRAINT `Hyperlink_ibfk_1` FOREIGN KEY (`Group`) REFERENCES `hyperlinkgroup` (`Id`);');
     122
    104123  finally
    105124    Data.Free;
     
    116135  try
    117136    DbRows := TDbRows.Create;
    118     Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `User`');
    119     Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `UserOnline`');
     137    Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `Panel`');
     138    Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `PanelColumn`');
     139    Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `Hyperlink`');
     140    Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `HyperlinkGroup`');
    120141  finally
    121142    DbRows.Free;
     
    128149end;
    129150
     151function TModulePortal.ShowHeader(Session: TWebSession): string;
     152var
     153  ScriptName: string;
     154  PathTreePath: string;
     155  Navigation: string;
     156  ScriptNameParts: TListString;
     157  ScriptNamePart: string;
     158  I: Integer;
     159  BodyParam: string;
     160  Path: string;
     161  Output: string;
     162begin
     163  try
     164    ScriptNameParts := TListString.Create;
     165
     166    //ScriptName := $_SERVER['SCRIPT_NAME'];
     167    while Pos('//', ScriptName) > 0 do
     168      ScriptName := StringReplace('//', '/', ScriptName, [rfReplaceAll]);
     169    PathTreePath := '/';
     170    //PathTreeItem := PathTree;
     171    //Navigation := '<a href="' + NavigationLink(PathTreePath) + '">' + PathTreeItem[0] + '</a> &gt; ';
     172    ScriptName := Copy(ScriptName, Length(Core.BaseURL), Length(ScriptName));
     173    ScriptNameParts.Explode(ScriptName, '/', StrToStr);
     174    ScriptNameParts.Delete(0);
     175    (*
     176    for I := 0 to ScriptNameParts.Count - 1 do begin
     177      ScriptNamePart := ScriptNameParts[I];
     178      //echo($ScriptNamePart.'<br />');
     179      if array_key_exists($ScriptNamePart, $PathTreeItem) then begin
     180        if  is_array($PathTreeItem[$ScriptNamePart]) then begin
     181
     182          PathTreeItem = $PathTreeItem[$ScriptNamePart];
     183          PathTreePath .= $ScriptNamePart.'/';
     184          if PathTreeItem[0] != '' then
     185            Navigation := Navigation + '<a href="' + $this->System->Config['Web']['RootFolder'] + PathTreePath + '">' + PathTreeItem[0] + '</a> &gt; ';
     186        end else begin
     187          if(PathTreeItem[ScriptNamePart] != '')
     188            Navigation := Navigation + '<a href="' + $this->System->Config['Web']['RootFolder'].$PathTreePath.$ScriptNamePart.'">'.$PathTreeItem[$ScriptNamePart].'</a> &gt; ';
     189        end;
     190      end;
     191    end;    *)
     192    Navigation := Copy(Navigation, 1, Length(Navigation) - 6);
     193
     194    BodyParam := '';
     195    //if(isset($this->Load)) BodyParam := BodyParam + ' onload="'.$this->Load.'"';
     196    //if(isset($this->Unload)) BodyParam := BodyParam + ' onunload="'.$this->Unload.'"';
     197    Output := '<?xml version="1.0" encoding="' + Core.Charset + '"?>' + LineEnding +
     198    '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' +
     199    '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">' +
     200    '<head><link rel="stylesheet" href="' + NavigationLink('/style/' + Core.Style + '/style.css') + '" type="text/css" media="all" />' +
     201    '<meta http-equiv="content-type" content="application/xhtml+xml; charset=' + Core.Charset + '" />' +
     202    '<script type="text/javascript" src="' + Core.BaseURL + '/style/' + Core.Style + '/global.js"></script>' +
     203    '<title>' + Session.GlobalTitle + ' - ' + Path + '</title>' +
     204    '</head><body' + BodyParam + '>' +
     205    '<div id="Title">' + Title + '</div>' +
     206    '<div class="Navigation"><span class="MenuItem"><strong>Navigace :: </strong> ';
     207    Output := Output + Navigation + '</span><div class="MenuItem2">';
     208    if Session.User.Id = UnknownUser then
     209      Output := Output + '<a href="' + MakeLink('Přihlášení',
     210        NavigationLink('/?Action=LoginForm')) + ' ' +
     211        MakeLink('Registrace', NavigationLink('/?Action=UserRegister'))
     212      else Output := Output + Session.User.Name + ' ' + MakeLink('Odhlásit',
     213        NavigationLink('/?Action=Logout'));
     214// <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Nastavení</a>';
     215  Output := Output + '</div></div>';
     216  Result := Output;
     217  finally
     218    ScriptNameParts.Free;
     219  end;
     220end;
     221
     222function TModulePortal.ShowFooter(Session: TWebSession): string;
     223begin
     224  //Time := Round(Now - $ScriptTimeStart, 2);
     225  Result := Result + '<div id="Footer">' +
     226    '<i>| Správa webu: ' + Core.Admin + ' | e-mail: ' + Core.AdminEmail + ' |';
     227//    if Core.ShowRuntimeInfo then Output := Output + ' Doba generování: ' +
     228//     Time + ' s / ' + ini_get('max_execution_time') + ' s | Použitá paměť: ' +
     229//     HumanSize(memory_get_peak_usage(FALSE)) + ' / ' + ini_get('memory_limit') + 'B |';
     230  Result := Result + '</i></div></body></html>';
     231end;
     232
    130233end.
    131234
  • trunk/Modules/Portal/UPagePortal.pas

    r102 r103  
    77uses
    88  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, USqlDatabase, UUtils,
    9   SpecializedDictionary;
     9  SpecializedDictionary, UWebSession, SpecializedList;
    1010
    1111type
     
    1717  private
    1818    Session: TWebSession;
     19    function ShowPanel(Title, Content: string; Menu: TListString = nil): string;
     20    function SystemMessage(Title, Text: string): string;
    1921    function ShowLinks(GroupId: Integer): string;
     22    function Show: string;
     23    function OnlineHostList: string;
     24    function UserPanel: string;
     25    function WebcamPanel: string;
    2026  public
    2127    { public declarations }
     
    3036
    3137uses
    32   UCore;
     38  UCore, UModuleUser, UWebObjects, UUser;
     39
     40function TWebPagePortal.SystemMessage(Title, Text: string): string;
     41begin
     42  Result := '<table align="center"><tr><td><div class="SystemMessage"><h3>' +
     43    Title + '</h3><div>' + Text + '</div></div</td></tr></table>';
     44end;
    3345
    3446procedure TWebPagePortal.DataModuleProduce(HandlerData: THTTPHandlerData);
    3547begin
    36   Session := TWebSessionHandlerData);
     48  Session := TWebSession(HandlerData);
    3749  with TWebSession(HandlerData) do begin
    3850
     
    5062    HyperlinkGroups := TDbRows.Create;
    5163    Hyperlinks := TDbRows.Create;
    52     Database.Query(HyperlinkGroups, 'SELECT * FROM `HyperlinkGroup` WHERE `Id`=' + IntToStr(GroupId));
     64    Session.Database.Query(HyperlinkGroups, 'SELECT * FROM `HyperlinkGroup` WHERE `Id`=' + IntToStr(GroupId));
    5365
    5466    Result := '';
    55     Database.Query(Hyperlinks, 'SELECT * FROM `Hyperlink` WHERE (`Group`=' + IntToStr(GroupId) + ') AND (`Enable` = 1)');
     67    Session.Database.Query(Hyperlinks, 'SELECT * FROM `Hyperlink` WHERE (`Group`=' + IntToStr(GroupId) + ') AND (`Enable` = 1)');
    5668    for I := 0 to HyperLinks.Count - 1 do begin
    5769      HyperLink := Hyperlinks[I];
     
    6072        if Copy(HyperLink.Values['URL'], 1, 4) <> 'http' then
    6173          HyperLink.Values['URL'] := NavigationLink(HyperLink.Values['URL']);
    62         if((HyperLink.Values['PermissionModule'] = '') or
     74        if ((HyperLink.Values['PermissionModule'] = '') or
    6375        ((HyperLink.Values['PermissionModule'] <> '') and
    64         Session.->Modules['User']->CheckPermission(HyperLink.Values['PermissionModule'], HyperLink.Values['PermissionOperation'])))
    65         Result := Result + '<img alt="' + HyperLink.Values['Name'] + '" src="images/favicons/'.$HyperLink.Values['IconFile'].'" width="16" height="16" /> <a href="' + $HyperLink.Values['URL'] + '">' + HyperLink.Values['Name'] + '</a><br />';
     76        Session.User.CheckPermission(HyperLink.Values['PermissionModule'], HyperLink.Values['PermissionOperation']))) then
     77        Result := Result + '<img alt="' + HyperLink.Values['Name'] + '" src="images/favicons/' + HyperLink.Values['IconFile'] + '" width="16" height="16" /> <a href="' + HyperLink.Values['URL'] + '">' + HyperLink.Values['Name'] + '</a><br />';
    6678    end;
    67     Result := Panel(HyperlinkGroup['Name'], Result);
     79    Result := ShowPanel(HyperlinkGroups[0].Values['Name'], Result);
    6880
    6981  finally
     
    7385end;
    7486
     87function TWebPagePortal.Show: string;
     88var
     89  Output: string;
     90  Form: TQueryForm;
     91  UserOptions: TQueryForm;
     92  PanelColumn: TDictionaryStringString;
     93  Panel: TDictionaryStringString;
     94  Width: string;
     95  DbRows: TDbRows;
     96  DbRows2: TDbRows;
     97  I, J: Integer;
     98begin
     99  Output := '';
     100  with Session.Request do
     101  if Query.SearchKey('Action') <> -1 then begin
     102    if Query.Values['Action'] = 'CustomizeNewsSave' then begin
     103      //Output := $this->System->Modules['News']->CustomizeSave();
     104    end else
     105    if Query.Values['Action'] = 'LoginForm' then begin
     106      Form := TQueryForm.Create; // UserLogin
     107      Form.AddNewAction('Přihlásit', '?Action=Login');
     108      Output := Output + Form.AsXmlElement.AsString;
     109      Output := Output + '<div class="Centred"><a href="?Action=UserRegister">Registrovat se</a> ' +
     110        '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
     111    end else
     112    if Query.Values['Action'] = 'Login' then begin
     113      Form := TQueryForm.Create; // UserLogin
     114      Form.Load(Session.Request.Post);
     115      Session.UserOnline.Login(
     116        Session.User.GetIdByNamePassword(
     117      TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Username').Value.Value,
     118        TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Password').Value.Value));
     119      Output := Output + SystemMessage('Přihlášení', Result);
     120      if Session.User.Id <> UnknownUser then begin
     121        //Form.LoadValuesFromForm;
     122        TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Password').Value.Value := '';
     123        Output := Output + Form.AsXmlElement.AsString;
     124        Output := Output + '<div class="Centred"><a href="?Action=UserRegister">Registrovat se</a> ' +
     125          '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
     126      end;
     127    end else
     128    if Query.Values['Action'] = 'Logout' then begin
     129      Session.UserOnline.Logout;
     130      Output := Output + SystemMessage('Odhlášení', 'Uživatel odhlášen');
     131    end else
     132    if Query.Values['Action'] = 'UserOptions' then begin
     133      UserOptions := TQueryForm.Create; // UserOptions
     134      //UserOptions.LoadValuesFromDatabase(Session.User.Id);
     135      UserOptions.AddNewAction('Uložit', '?Action=UserOptionsSave');
     136      Output := Output + UserOptions.AsXmlElement.AsString;
     137    end else
     138    if Query.Values['Action'] = 'UserOptionsSave' then begin
     139      UserOptions := TQueryForm.Create; // UserOptions
     140      UserOptions.Load(Session.Request.Post);
     141      //UserOptions.SaveValuesToDatabase($this->System->Modules['User']->User['Id']);
     142      Output := Output + SystemMessage('Nastavení', 'Nastavení uloženo.');
     143      //this->System->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $UserOptions->Values['Name']);
     144      //UserOptions.LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
     145      UserOptions.AddNewAction('Uložit', '?Action=UserOptionsSave');
     146      Output := Output + UserOptions.AsXmlElement.AsString;
     147    end else
     148    if Query.Values['Action'] = 'UserRegister' then begin
     149      Form := TQueryForm.Create; //'UserRegister');
     150      Form.Load(Session.Request.Post);
     151      Form.AddNewAction('Uložit', '?Action=UserRegisterSave');
     152      Output := Output + Form.AsXmlElement.AsString;
     153    end else
     154    if Query.Values['Action'] = 'UserRegisterConfirm' then begin
     155      //Session.User.RegisterConfirm($_GET['User'], $_GET['H']);
     156      Output := Output + SystemMessage('Potvrzení registrace', 'Registrace potvrzena');
     157    end else
     158    if Query.Values['Action'] = 'PasswordRecovery' then begin
     159      Form := TQueryForm.Create; // PasswordRecovery
     160      Form.AddNewAction('Obnovit', '?Action=PasswordRecovery2');
     161      Output := Output + Form.AsXmlElement.AsString;
     162    end else
     163    if Query.Values['Action'] = 'PasswordRecovery2' then begin
     164      Form := TQueryForm.Create; // PasswordRecovery
     165      Form.Load(Session.Request.Post);
     166      //Result = Session.User.PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);
     167      Output := Output + SystemMessage('Obnova hesla', Result);
     168      //if Result <> USER_PASSWORD_RECOVERY_SUCCESS then begin
     169        Output := Output + Form.AsXmlElement.AsString;
     170      //end;
     171    end else
     172    if Query.Values['Action'] = 'PasswordRecoveryConfirm' then begin
     173      //Session.User.PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']);
     174      Output := Output + SystemMessage('Obnova hesla', 'Potvrzení obnovení hesla');
     175    end (*else
     176    if Query.Values['Action'] = 'UserRegisterSave' then begin
     177          Form := TQueryForm.Create; // UserRegister
     178          Form.Load(Session.Request.Post);
     179          Session.User.Register(Form->Values['Login'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name'], $Form->Values['PhoneNumber'], $Form->Values['ICQ']);
     180          $Output := Output + $this->SystemMessage('Registrace nového účtu', $Result);
     181          if Result <> USER_REGISTRATED then begin
     182            Form.OnSubmit := '?Action=UserRegisterSave';
     183            $Output := Output + Form.ShowEditForm;
     184      end;
     185    end else
     186    if Query.Values['Action'] = 'MemberOptions' then begin
     187          $UserOptions = new Form('MemberOptions');
     188          $DbResult = $this->Database->query('SELECT Member.Id, Member.InternetTariffNextMonth, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']);
     189          $DbRow = $DbResult->fetch_array();
     190          foreach($UserOptions->Definition['Items'] as $Index => $Item)
     191          begin
     192            $UserOptions->Values[$Index] = $DbRow[$Index];
     193          end;
     194          $UserOptions->OnSubmit = '?Action=MemberOptionsSave';
     195          $Output .= $UserOptions->ShowEditForm();
     196     end else
     197     if Query.Values['Action'] = 'MemberOptionsSave' then begin
     198          $UserOptions = new Form('MemberOptions');
     199          $UserOptions->LoadValuesFromForm();
     200          if($UserOptions->Values['FamilyMemberCount'] < 0)
     201            $UserOptions->Values['FamilyMemberCount'] = 0;
     202          if($UserOptions->Values['BillingPeriodNext'] < 2)
     203            $UserOptions->Values['BillingPeriodNext'] = 2;
     204
     205          $DbResult = $this->Database->update('Member', 'Id='.$this->System->Modules['User']->User['Member'], array('InternetTariffNextMonth' => $UserOptions->Values['InternetTariffNextMonth'], 'FamilyMemberCount' => $UserOptions->Values['FamilyMemberCount'], 'BillingPeriodNext' => $UserOptions->Values['BillingPeriodNext']));
     206          $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System->Modules['User']->User['Member']);
     207          $Member = $DbResult->fetch_assoc();
     208          $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'], array('Name' => $UserOptions->Values['Name'], 'AddressStreet' => $UserOptions->Values['AddressStreet'], 'AddressTown' => $UserOptions->Values['AddressTown'], 'AddressPSC' => $UserOptions->Values['AddressPSC'], 'IC' => $UserOptions->Values['IC'], 'DIC' => $UserOptions->Values['DIC']));
     209          $Output .= $this->SystemMessage('Nastavení', 'Nastavení domácnosti uloženo.');
     210          $this->System->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno', $UserOptions->Values['Name']);
     211          $DbResult = $this->Database->query('SELECT Member.Id, Member.InternetTariffNextMonth, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']);
     212          $DbRow = $DbResult->fetch_array();
     213          foreach($UserOptions->Definition['Items'] as $Index => $Item)
     214          {
     215            $UserOptions->Values[$Index] = $DbRow[$Index];
     216          }
     217          $UserOptions->OnSubmit = '?Action=MemberOptionsSave';
     218          $Output .= $UserOptions->ShowEditForm();
     219      end;
     220    end *);
     221
     222    //Session.Database.Database := Config['Database']['Database'];
     223
     224    // Show pannels
     225    //if(IsInternetAddr()) echo('Internet'); else echo('LAN');
     226    //$Output .= $this->InfoBar();
     227    Output := Output + '<table id="MainTable"><tr>';
     228    Session.Database.Select(DbRows, 'PanelColumn', '*');
     229    for I := 0 to DbRows.Count - 1 do begin
     230      PanelColumn := DbRows[I];
     231      if PanelColumn.Values['Width'] <> '' then
     232          Width := ' width="' + PanelColumn.Values['Width'] + '"'
     233        else Width := '';
     234      Output := Output + '<td valign="top"' + Width + '>';
     235      Session.Database.Query(DbRows2, 'SELECT * FROM `Panel` WHERE `PanelColumn`=' +
     236        PanelColumn.Values['Id'] + ' ORDER BY `Order`');
     237      for J := 0 to DbRows2.Count - 1 do
     238        Panel := DbRows[J];
     239        if Panel.Values['Module'] = 'HyperlinkGroup' then
     240          Output := Output + ShowLinks(StrToInt(Panel.Values['Parameters']))
     241        else if Panel.Values['Module'] = 'OnlineHostList' then
     242          Output := Output + ShowPanel('Online počítače', OnlineHostList)
     243        else if Panel.Values['Module'] = 'UserOptions' then
     244        begin
     245          if Session.User.Id <> UnknownUser then
     246            Output := Output + ShowPanel('Přihlášený uživatel', UserPanel);
     247        end else
     248        if Panel.Values['Module'] = 'Webcam' then
     249          Output := Output + ShowPanel('Kamery', WebcamPanel)
     250        else if Panel.Values['Module'] = 'NewsGroupList' then
     251//          Output := Output + Panel('Aktuality', $this->System->Modules['News']->Show(), array('<a href="?Action=CustomizeNews">Upravit</a>'));
     252      end;
     253      Output := Output + '</td>';
     254    end;
     255    Output := Output + '</table>';
     256    Result := Output;
     257  end;
     258
     259function TWebPagePortal.OnlineHostList: string;
     260begin
     261
     262end;
     263
     264function TWebPagePortal.UserPanel: string;
     265begin
     266
     267end;
     268
     269function TWebPagePortal.ShowPanel(Title, Content: string; Menu: TListString): string;
     270var
     271  I: Integer;
     272  TitleCombined: string;
     273begin
     274  TitleCombined := '';
     275  if Assigned(Menu) then
     276    if Menu.Count > 0 then
     277      for I := 0 to Menu.Count - 1 do
     278        TitleCombined := TitleCombined + '<div class="Action">' + Menu[I] + '</div>';
     279  Result := '<div class="Panel"><div class="Title">' + TitleCombined +
     280    '</div><div class="Content">' + Content + '</div></div>';
     281end;
     282
     283function TWebPagePortal.WebcamPanel: string;
     284begin
     285
     286end;
    75287
    76288end.
Note: See TracChangeset for help on using the changeset viewer.