Changeset 49 for trunk/Application
- Timestamp:
- Mar 28, 2011, 9:40:06 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UCustomApplication.pas
r48 r49 18 18 Name: string; 19 19 Producer: TPageProducer; 20 end; 21 22 { TRegistredPageList } 23 24 TRegistredPageList = class(TListObject) 25 function FindByName(Name: string): TRegistredPage; 20 26 end; 21 27 … … 41 47 Keywords: string; 42 48 HtmlDocument: THtmlDocument; 43 Pages: T ListObject; // TListObject<TRegistredPage>49 Pages: TRegistredPageList; 44 50 Database: TSqlDatabase; 45 51 PageName: string; … … 61 67 SPageNotFound = 'Page not found'; 62 68 69 { TRegistredPageList } 70 71 function TRegistredPageList.FindByName(Name: string): TRegistredPage; 72 var 73 I: Integer; 74 begin 75 I := 0; 76 while (I < Count) and (TRegistredPage(Items[I]).Name <> Name) do Inc(I); 77 if I < Count then Result := TRegistredPage(Items[I]) 78 else Result := nil; 79 end; 80 63 81 { TCustomApplication } 64 82 … … 97 115 I: Integer; 98 116 TitleTag: THtmlString; 117 Page: TRegistredPage; 99 118 begin 100 119 User.HandlerData := HandlerData; … … 102 121 UserOnline.Update; 103 122 with HandlerData do begin 104 Style := Config.Style;105 BaseURL := Config.BaseURL;106 107 HtmlDocument.ContentLanguage := 'cs';108 GlobalTitle := 'ZděchovNET';109 HtmlDocument.Styles.Add(NavigationLink('/Style/' + Style + '/Style.css'));110 HtmlDocument.Scripts.Add(NavigationLink('/Style/' + Style + '/Global.js'));111 HtmlDocument.Scripts.Add(NavigationLink('/Style/' + Style + '/jquery.js'));112 113 Request.QueryParts.Count := 2;114 Request.QueryParts[0] := 'uzivatel';115 Request.QueryParts[1] := 'prihlaseni';116 117 if Request.QueryParts.Count > 0 then PageName := Request.QueryParts[0]118 else PageName := '';119 I := 0;120 while (I < Pages.Count) and (TRegistredPage(Pages[I]).Name <> PageName) do Inc(I);121 if (I < Pages.Count) then begin122 TitleTag := THtmlString.Create;123 HtmlDocument.Body.SubItems.Add(TitleTag);124 TopMenu;125 TRegistredPage(Pages[I]).Producer(Self, HandlerData);126 TitleTag.Text := '<div class="TitlePanel"><span class="GlobalTitle">' + GlobalTitle +127 '</span> - ' + HtmlDocument.Title + '</div>';128 HtmlDocument.Title := GlobalTitle + ' - ' + HtmlDocument.Title;129 with HtmlDocument.AsXmlDocument dotry130 Formated := Config.FormatHTML;131 Response.Stream.WriteString(AsString);132 finally133 Free;134 end;135 end else Response.Stream.WriteString(SPageNotFound);123 Style := Config.Style; 124 BaseURL := Config.BaseURL; 125 126 HtmlDocument.ContentLanguage := 'cs'; 127 GlobalTitle := 'ZděchovNET'; 128 HtmlDocument.Styles.Add(NavigationLink('/Style/' + Style + '/Style.css')); 129 HtmlDocument.Scripts.Add(NavigationLink('/Style/' + Style + '/Global.js')); 130 HtmlDocument.Scripts.Add(NavigationLink('/Style/' + Style + '/jquery.js')); 131 132 Request.QueryParts.Count := 2; 133 Request.QueryParts[0] := 'uzivatel'; 134 Request.QueryParts[1] := 'prihlaseni'; 135 136 if Request.QueryParts.Count > 0 then PageName := Request.QueryParts[0] 137 else PageName := ''; 138 Page := Pages.FindByName(PageName); 139 if Assigned(Page) then begin 140 TitleTag := THtmlString.Create; 141 HtmlDocument.Body.SubItems.Add(TitleTag); 142 TopMenu; 143 Page.Producer(Self, HandlerData); 144 TitleTag.Text := '<div class="TitlePanel"><span class="GlobalTitle">' + GlobalTitle + 145 '</span> - ' + HtmlDocument.Title + '</div>'; 146 HtmlDocument.Title := GlobalTitle + ' - ' + HtmlDocument.Title; 147 with HtmlDocument.AsXmlDocument do 148 try 149 Formated := Config.FormatHTML; 150 Response.Stream.WriteString(AsString); 151 finally 152 Free; 153 end; 154 end else Response.Stream.WriteString(SPageNotFound); 136 155 end; 137 156 end; … … 141 160 inherited; 142 161 Database := TSqlDatabase.Create; 143 Pages := T ListObject.Create;162 Pages := TRegistredPageList.Create; 144 163 HtmlDocument := THtmlDocument.Create; 145 164 User := TWebUser.Create;
Note:
See TracChangeset
for help on using the changeset viewer.