Changeset 103 for trunk/Modules/ZdechovNET/UModuleZdechovNET.pas
- Timestamp:
- Oct 8, 2012, 8:48:16 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/ZdechovNET/UModuleZdechovNET.pas
r98 r103 6 6 7 7 uses 8 Classes, SysUtils, UModularSystem, SpecializedDictionary; 8 Classes, SysUtils, UModularSystem, SpecializedDictionary, UWebPage, 9 UWebSession, DateUtils; 9 10 10 11 type … … 13 14 14 15 TModuleZdechovNET = class(TModule) 16 private 17 procedure Footer(Session: TWebSession); 18 procedure GeneratePage(ASession: TWebSession; Page: TWebPage); 19 procedure TopMenu(Session: TWebSession); 15 20 public 16 21 constructor Create(Owner: TComponent); override; … … 29 34 UCore, USqlDatabase, UXmlClasses, UHtmlClasses, UUtils, 30 35 UInternetPage, UHostingPage, UHistoryPage, UDocumentsPage, UVoIPPage, 31 ULinksPage, UPlansPage, UServerInfoPage, UWebCamPage, 36 ULinksPage, UPlansPage, UServerInfoPage, UWebCamPage, UUser, 32 37 UNetworkPage, UAboutPage, UContactPage, UProjectsPage; 33 38 … … 42 47 License := 'GNU/LGPL v3'; 43 48 Author := 'Chronosoft'; 49 Dependencies.Add('User'); 44 50 end; 45 51 … … 98 104 Data := TDictionaryStringString.Create; 99 105 106 Core.GeneratePage := GeneratePage; 107 100 108 Core.CommonDatabase.Query(DbRows, 101 109 'CREATE TABLE IF NOT EXISTS `VPSHosting` (' + … … 172 180 begin 173 181 inherited Uninstall; 182 Core.GeneratePage := nil; 174 183 try 175 184 DbRows := TDbRows.Create; … … 189 198 end; 190 199 200 procedure TModuleZdechovNET.Footer(Session: TWebSession); 201 var 202 Tag: TXMLTag; 203 AdminTag: TXMLTag; 204 EmailTag: TXMLTag; 205 ExecutionTimeTag: TXMLTag; 206 UsedMemoryTag: TXMLTag; 207 TextNode: TXmlString; 208 begin 209 with Session do 210 with TXmlTag(HtmlDocument.Body.SubItems.AddNew(TXmlTag.Create)) do begin 211 Name := 'ul'; 212 Attributes.Values['class'] := 'Footer'; 213 with TXmlTag(SubElements.AddNew(TXmlTag.Create)) do begin 214 Name := 'li'; 215 with TXmlString(SubElements.AddNew(TXmlString.Create)) do begin 216 Text := TCore(MainModule).Admin; 217 end; 218 end; 219 with TXmlTag(SubElements.AddNew(TXmlTag.Create)) do begin 220 Name := 'li'; 221 with TXmlString(SubElements.AddNew(TXmlString.Create)) do begin 222 Text := TCore(MainModule).AdminEmail; 223 end; 224 end; 225 if TCore(MainModule).ShowRuntimeInfo then begin 226 with TXmlTag(SubElements.AddNew(TXmlTag.Create)) do begin 227 Name := 'li'; 228 with TXmlString(SubElements.AddNew(TXmlString.Create)) do begin 229 Text := 'Doba generování: ' + 230 FloatToStr(Round(((Now - TimeStart) / OneMillisecond) * 100) / 100) + ' s / '; // + ini_get('max_execution_time') + ' s'; 231 end; 232 end; 233 with TXmlTag(SubElements.AddNew(TXmlTag.Create)) do begin 234 Name := 'li'; 235 with TXmlString(SubElements.AddNew(TXmlString.Create)) do begin 236 //Text := 'Použitá paměť: ' + System.PrefixMultiplier.AddPrefixMultipliers(memory_get_peak_usage(FALSE), 'B').' / '.ini_get('memory_limit').'B'; 237 end; 238 end; 239 end; 240 end; 241 end; 242 243 procedure TModuleZdechovNET.TopMenu(Session: TWebSession); 244 begin 245 with Session, THtmlString(HtmlDocument.Body.SubItems.InsertNew(1, THtmlString.Create)) do begin 246 Text := '<div class="Navigation">'; 247 // Visitor 248 Text := Text + '<ul class="MenuItem">' + 249 '<li>' + MakeLink('Úvod', NavigationLink('/')) + '</li>' + 250 '<li>' + MakeLink('Internet', NavigationLink('/internet/')) + '</li>' + 251 '<li>' + MakeLink('Hosting', NavigationLink('/hosting/')) + '</li>' + 252 '<li>' + MakeLink('VoIP', NavigationLink('/voip/')) + '</li>' + 253 '<li>' + MakeLink('Síť', NavigationLink('/sit/')) + '</li>' + 254 '<li>' + MakeLink('Odkazy', NavigationLink('/odkazy/')) + '</li>' + 255 '<li>' + MakeLink('Kontakt', NavigationLink('/kontakt/')) + '</li>' + 256 '<li>' + MakeLink('Kamery', NavigationLink('/kamery/')) + '</li>' + 257 '<li><a href="https://mail.zdechov.net/">Pošta</a></li>' + 258 '<li><a href="http://wiki.zdechov.net/">Wiki</a></li>' + 259 '</ul><ul class="MenuItem2">'; //<li> </li>'; 260 if Assigned(TCore(MainModule).Pages.FindByName('uzivatel')) then begin 261 if UserOnline.User = UnknownUser then begin 262 Text := Text + '</ul>' + 263 '<ul class="MenuItem2">' + 264 '<li>' + MakeLink('Přihlášení', NavigationLink('/uzivatel/prihlaseni/')) + '</li>' + 265 '<li>' + MakeLink('Registrace', NavigationLink('/uzivatel/registrace/')) + '</li>' + 266 '<li></li>'; 267 // $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Translate('UserRegistration'), $this->System->MakeLink('UserList', 'Register')).'</li>'; 268 end else begin 269 Text := Text + '</ul>' + 270 '<ul class="MenuItem2">' + 271 '<li>' + User.FullName + '</li>' + 272 '<li>' + MakeLink('Odhlášení', NavigationLink('/uzivatel/odhlaseni/')) + '</li>' + 273 '<li>' + MakeLink('Profil', NavigationLink('/uzivatel/profil/')) + '</li>'; 274 end; 275 end else Text := Text + '</ul><ul class="MenuItem2"> '; 276 Text := Text + '</ul></div>'; 277 end; 278 end; 279 280 procedure TModuleZdechovNET.GeneratePage(ASession: TWebSession; Page: TWebPage); 281 var 282 I: Integer; 283 TitleTag: THtmlString; 284 begin 285 with ASession do begin 286 HtmlDocument.ContentLanguage := 'cs'; 287 GlobalTitle := 'ZděchovNET'; 288 HtmlDocument.Styles.Add(NavigationLink('/Style/' + TCore(MainModule).Style + '/Style.css')); 289 HtmlDocument.Scripts.Add(NavigationLink('/Style/' + TCore(MainModule).Style + '/Global.js')); 290 HtmlDocument.Scripts.Add(NavigationLink('/Style/' + TCore(MainModule).Style + '/jquery.js')); 291 292 TitleTag := THtmlString.Create; 293 HtmlDocument.Body.SubItems.Insert(0, TitleTag); 294 TopMenu(ASession); 295 //Page.Page.OnProduce(HandlerData); 296 HtmlDocument.Title := Page.Caption; 297 TitleTag.Text := '<div class="TitlePanel"><span class="GlobalTitle">' + GlobalTitle + 298 '</span> - ' + HtmlDocument.Title + '</div>'; 299 HtmlDocument.Title := GlobalTitle + ' - ' + HtmlDocument.Title; 300 with HtmlDocument.AsXmlDocument do 301 try 302 Formated := TCore(MainModule).FormatHTML; 303 Response.Content.WriteString(AsString); 304 finally 305 Free; 306 end; 307 end; 308 end; 309 310 191 311 end. 192 312
Note:
See TracChangeset
for help on using the changeset viewer.