Changeset 105 for trunk/Modules/Portal
- Timestamp:
- Oct 9, 2012, 1:58:45 PM (12 years ago)
- Location:
- trunk/Modules/Portal
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Portal/UModulePortal.pas
r104 r105 7 7 uses 8 8 Classes, SysUtils, UModularSystem, SpecializedDictionary, USqlDatabase, 9 UUtils, UWebSession, SpecializedList, UUser, UWebPage, UHtmlClasses; 9 UUtils, UWebSession, SpecializedList, UUser, UWebPage, UHtmlClasses, 10 UModuleBase, UModuleUser; 10 11 11 12 type … … 16 17 private 17 18 Time: TDateTime; 19 WebPagePortal: TWebPage; 18 20 function ShowFooter(Session: TWebSession): string; 19 21 function ShowHeader(Session: TWebSession): string; 20 22 procedure GeneratePage(ASession: TWebSession; Page: TWebPage); 21 23 public 24 ModuleBase: TModuleBase; 25 ModuleUser: TModuleUser; 22 26 constructor Create(Owner: TComponent); override; 23 27 destructor Destroy; override; … … 46 50 Author := 'Chronosoft'; 47 51 Dependencies.Add('User'); 52 Dependencies.Add('Finance'); 53 Dependencies.Add('News'); 48 54 end; 49 55 … … 55 61 procedure TModulePortal.Start; 56 62 begin 57 Core.GeneratePage := GeneratePage; 58 Core.Pages.RegisterPage(TWebPagePortal, WebPagePortal, 'portal'); 59 inherited; 63 BeforeStart; 64 ModuleBase := TModuleBase(Manager.FindModuleByName('Base')); 65 ModuleBase.GeneratePage := GeneratePage; 66 WebPagePortal := TWebPagePortal.Create(nil); 67 ModuleBase.Pages.RegisterPage(WebPagePortal, ''); 68 TWebPagePortal(WebPagePortal).ModuleUser := TModuleUser(Manager.FindModuleByName('User')); 69 AfterStart; 60 70 end; 61 71 62 72 procedure TModulePortal.Stop; 63 73 begin 64 inherited; 65 Core.Pages.UnregisterPage('portal'); 74 BeforeStop; 75 ModuleBase.Pages.UnregisterPage(WebPagePortal); 76 FreeAndNil(WebPagePortal); 77 ModuleBase := nil; 78 AfterStop; 66 79 end; 67 80 … … 208 221 '<div class="Navigation"><span class="MenuItem"><strong>Navigace :: </strong> '; 209 222 Output := Output + Navigation + '</span><div class="MenuItem2">'; 210 if Session.User.Id = UnknownUser then223 if ModuleUser.User.Id = UnknownUser then 211 224 Output := Output + '<a href="' + MakeLink('Přihlášení', 212 225 NavigationLink('/?Action=LoginForm')) + ' ' + 213 226 MakeLink('Registrace', NavigationLink('/?Action=UserRegister')) 214 else Output := Output + Session.User.Name + ' ' + MakeLink('Odhlásit',227 else Output := Output + ModuleUser.User.Name + ' ' + MakeLink('Odhlásit', 215 228 NavigationLink('/?Action=Logout')); 216 229 // <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserOptions">Nastavení</a>'; -
trunk/Modules/Portal/UPagePortal.pas
r104 r105 8 8 Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, USqlDatabase, UUtils, 9 9 SpecializedDictionary, UWebSession, SpecializedList, UHtmlClasses, 10 UModularSystem ;10 UModularSystem, UModuleUser, UModuleNews; 11 11 12 12 type … … 26 26 function WebcamPanel: string; 27 27 public 28 { public declarations } 28 ModuleUser: TModuleUser; 29 ModuleNews: TModuleNews; 29 30 end; 30 31 … … 37 38 38 39 uses 39 UCore, U ModuleUser, UWebObjects, UUser;40 UCore, UWebObjects, UUser; 40 41 41 42 function TWebPagePortal.SystemMessage(Title, Text: string): string; … … 76 77 if ((HyperLink.Values['PermissionModule'] = '') or 77 78 ((HyperLink.Values['PermissionModule'] <> '') and 78 Session.User.CheckPermission(HyperLink.Values['PermissionModule'], HyperLink.Values['PermissionOperation']))) then79 ModuleUser.User.CheckPermission(HyperLink.Values['PermissionModule'], HyperLink.Values['PermissionOperation']))) then 79 80 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 />'; 80 81 end; … … 118 119 Form := TQueryForm.Create; // UserLogin 119 120 Form.Load(Session.Request.Post); 120 Session.UserOnline.Login(121 Session.User.GetIdByNamePassword(121 ModuleUser.UserOnline.Login( 122 ModuleUser.User.GetIdByNamePassword( 122 123 TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Username').Value.Value, 123 124 TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Password').Value.Value)); 124 125 Output := Output + SystemMessage('Přihlášení', 'Přihlášení provedeno'); 125 if Session.User.Id <> UnknownUser then begin126 if ModuleUser.User.Id <> UnknownUser then begin 126 127 //Form.LoadValuesFromForm; 127 128 TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Password').Value.Value := ''; … … 132 133 end else 133 134 if Query.Values['Action'] = 'Logout' then begin 134 Session.UserOnline.Logout;135 ModuleUser.UserOnline.Logout; 135 136 Output := Output + SystemMessage('Odhlášení', 'Uživatel odhlášen'); 136 137 end else … … 249 250 else if Panel.Values['Module'] = 'UserOptions' then 250 251 begin 251 if Session.User.Id <> UnknownUser then252 if ModuleUser.User.Id <> UnknownUser then 252 253 Output := Output + ShowPanel('Přihlášený uživatel', UserPanel); 253 254 end else … … 255 256 Output := Output + ShowPanel('Kamery', WebcamPanel) 256 257 else if Panel.Values['Module'] = 'NewsGroupList' then 257 // Output := Output + Panel('Aktuality', $this->System->Modules['News']->Show(), array('<a href="?Action=CustomizeNews">Upravit</a>')); 258 //Output := Output + ShowPanel('Aktuality', 259 //ModuleNews.Show, 260 //['<a href="?Action=CustomizeNews">Upravit</a>']); 258 261 end; 259 262 Output := Output + '</td>';
Note:
See TracChangeset
for help on using the changeset viewer.