Changeset 103 for trunk/Application/UWebSession.pas
- Timestamp:
- Oct 8, 2012, 8:48:16 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UWebSession.pas
r102 r103 7 7 uses 8 8 Classes, SysUtils, UHTTPServer, USqlDatabase, UHTTPSessionMySQL, UUser, 9 UHtmlClasses, UWebPage ;9 UHtmlClasses, UWebPage, UUtils, UXmlClasses, DateUtils; 10 10 11 11 type … … 14 14 TWebSession = class(THTTPHandlerData) 15 15 private 16 procedure TopMenu;17 procedure Footer;18 16 public 19 17 MainModule: TObject; … … 27 25 procedure LoadUserInfo; 28 26 procedure InitDatabase; 29 procedure GeneratePage(Page: TWebPage);30 27 constructor Create; override; 31 28 destructor Destroy; override; 29 procedure GeneratePage(Page: TWebPage); 32 30 end; 33 31 32 TGeneratePageEvent = procedure (Session: TWebSession; Page: TWebPage) of object; 34 33 35 34 implementation 35 36 uses 37 UCore; 36 38 37 39 { TWebSession } … … 60 62 end; 61 63 64 procedure TWebSession.GeneratePage(Page: TWebPage); 65 begin 66 with TCore(MainModule) do 67 if Assigned(GeneratePage) then GeneratePage(Self, Page) 68 else GeneratePageDefault(Self, Page); 69 end; 70 62 71 procedure TWebSession.InitDatabase; 63 72 var … … 65 74 begin 66 75 with Database do begin 76 Encoding := 'utf8'; 67 77 Connect; 68 end;69 try70 DbRows := TDbRows.Create;71 Database.Query(DbRows, 'SET NAMES utf8');72 finally73 DbRows.Free;74 78 end; 75 79 end; … … 77 81 procedure TWebSession.LoadUserInfo; 78 82 begin 79 if MainModule.ModuleManager.ModuleRunning('User') then begin83 if TCore(MainModule).ModuleManager.ModuleRunning('User') then begin 80 84 User.HandlerData := Self; 81 85 UserOnline.HandlerData := Self; … … 86 90 end; 87 91 88 procedure TWebSession.GeneratePage(Page: TWebPage);89 var90 I: Integer;91 TitleTag: THtmlString;92 begin93 HtmlDocument.ContentLanguage := 'cs';94 GlobalTitle := 'ZděchovNET';95 HtmlDocument.Styles.Add(NavigationLink('/Style/' + MainModule.Style + '/Style.css'));96 HtmlDocument.Scripts.Add(NavigationLink('/Style/' + MainModule.Style + '/Global.js'));97 HtmlDocument.Scripts.Add(NavigationLink('/Style/' + MainModule.Style + '/jquery.js'));98 99 TitleTag := THtmlString.Create;100 HtmlDocument.Body.SubItems.Insert(0, TitleTag);101 TopMenu;102 //Page.Page.OnProduce(HandlerData);103 HtmlDocument.Title := Page.Caption;104 TitleTag.Text := '<div class="TitlePanel"><span class="GlobalTitle">' + GlobalTitle +105 '</span> - ' + HtmlDocument.Title + '</div>';106 HtmlDocument.Title := GlobalTitle + ' - ' + HtmlDocument.Title;107 with HtmlDocument.AsXmlDocument do108 try109 Formated := MainModule.FormatHTML;110 Response.Content.WriteString(AsString);111 finally112 Free;113 end;114 end;115 116 92 end. 117 93
Note:
See TracChangeset
for help on using the changeset viewer.