Changeset 49
- Timestamp:
- Mar 28, 2011, 9:40:06 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 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; -
trunk/CGI.lpi
r48 r49 474 474 <EditorIndex Value="1"/> 475 475 <WindowIndex Value="0"/> 476 <TopLine Value="1 74"/>477 <CursorPos X=" 38" Y="187"/>476 <TopLine Value="129"/> 477 <CursorPos X="5" Y="155"/> 478 478 <UsageCount Value="339"/> 479 479 <Loaded Value="True"/> … … 556 556 <EditorIndex Value="7"/> 557 557 <WindowIndex Value="0"/> 558 <TopLine Value="1 8"/>559 <CursorPos X=" 1" Y="25"/>558 <TopLine Value="144"/> 559 <CursorPos X="2" Y="26"/> 560 560 <UsageCount Value="20"/> 561 561 <Loaded Value="True"/> … … 566 566 <EditorIndex Value="8"/> 567 567 <WindowIndex Value="0"/> 568 <TopLine Value=" 92"/>569 <CursorPos X=" 5" Y="106"/>568 <TopLine Value="744"/> 569 <CursorPos X="38" Y="434"/> 570 570 <UsageCount Value="21"/> 571 571 <Loaded Value="True"/> … … 602 602 <Filename Value="../../PascalClassLibrary/Network/CoolWeb/WebServer/UHTTPServer.pas"/> 603 603 <UnitName Value="UHTTPServer"/> 604 <WindowIndex Value="0"/> 605 <TopLine Value="14"/> 604 <EditorIndex Value="9"/> 605 <WindowIndex Value="0"/> 606 <TopLine Value="410"/> 606 607 <CursorPos X="5" Y="31"/> 607 <UsageCount Value="9"/> 608 <UsageCount Value="10"/> 609 <Loaded Value="True"/> 608 610 </Unit62> 609 611 <Unit63> … … 682 684 <Position1> 683 685 <Filename Value="Pages/UMainPage.pas"/> 684 <Caret Line="3 18" Column="56" TopLine="294"/>686 <Caret Line="368" Column="52" TopLine="344"/> 685 687 </Position1> 686 688 <Position2> 687 689 <Filename Value="Pages/UMainPage.pas"/> 688 <Caret Line="3 68" Column="52" TopLine="344"/>690 <Caret Line="391" Column="55" TopLine="367"/> 689 691 </Position2> 690 692 <Position3> 691 693 <Filename Value="Pages/UMainPage.pas"/> 692 <Caret Line=" 391" Column="55" TopLine="367"/>694 <Caret Line="416" Column="55" TopLine="392"/> 693 695 </Position3> 694 696 <Position4> 695 697 <Filename Value="Pages/UMainPage.pas"/> 696 <Caret Line="41 6" Column="55" TopLine="392"/>698 <Caret Line="419" Column="58" TopLine="395"/> 697 699 </Position4> 698 700 <Position5> 699 701 <Filename Value="Pages/UMainPage.pas"/> 700 <Caret Line="4 19" Column="58" TopLine="395"/>702 <Caret Line="422" Column="40" TopLine="398"/> 701 703 </Position5> 702 704 <Position6> 703 705 <Filename Value="Pages/UMainPage.pas"/> 704 <Caret Line="42 2" Column="40" TopLine="398"/>706 <Caret Line="424" Column="39" TopLine="400"/> 705 707 </Position6> 706 708 <Position7> 707 <Filename Value=" Pages/UMainPage.pas"/>708 <Caret Line=" 424" Column="39" TopLine="400"/>709 <Filename Value="Application/UCustomApplication.pas"/> 710 <Caret Line="7" Column="62" TopLine="1"/> 709 711 </Position7> 710 712 <Position8> 711 713 <Filename Value="Application/UCustomApplication.pas"/> 712 <Caret Line="7 " Column="62" TopLine="1"/>714 <Caret Line="72" Column="12" TopLine="48"/> 713 715 </Position8> 714 716 <Position9> 715 717 <Filename Value="Application/UCustomApplication.pas"/> 716 <Caret Line=" 72" Column="12" TopLine="48"/>718 <Caret Line="109" Column="26" TopLine="85"/> 717 719 </Position9> 718 720 <Position10> 719 721 <Filename Value="Application/UCustomApplication.pas"/> 720 <Caret Line="1 09" Column="26" TopLine="85"/>722 <Caret Line="110" Column="27" TopLine="86"/> 721 723 </Position10> 722 724 <Position11> 723 725 <Filename Value="Application/UCustomApplication.pas"/> 724 <Caret Line="1 10" Column="27" TopLine="86"/>726 <Caret Line="109" Column="26" TopLine="87"/> 725 727 </Position11> 726 728 <Position12> 727 729 <Filename Value="Application/UCustomApplication.pas"/> 728 <Caret Line="1 09" Column="26" TopLine="87"/>730 <Caret Line="110" Column="27" TopLine="87"/> 729 731 </Position12> 730 732 <Position13> 731 733 <Filename Value="Application/UCustomApplication.pas"/> 732 <Caret Line="11 0" Column="27" TopLine="87"/>734 <Caret Line="111" Column="27" TopLine="87"/> 733 735 </Position13> 734 736 <Position14> 735 737 <Filename Value="Application/UCustomApplication.pas"/> 736 <Caret Line="1 11" Column="27" TopLine="87"/>738 <Caret Line="123" Column="35" TopLine="99"/> 737 739 </Position14> 738 740 <Position15> 739 741 <Filename Value="Application/UCustomApplication.pas"/> 740 <Caret Line="1 23" Column="35" TopLine="99"/>742 <Caret Line="171" Column="65" TopLine="147"/> 741 743 </Position15> 742 744 <Position16> 743 745 <Filename Value="Application/UCustomApplication.pas"/> 744 <Caret Line="17 1" Column="65" TopLine="147"/>746 <Caret Line="176" Column="57" TopLine="150"/> 745 747 </Position16> 746 748 <Position17> 747 749 <Filename Value="Application/UCustomApplication.pas"/> 748 <Caret Line="1 76" Column="57" TopLine="150"/>750 <Caret Line="180" Column="49" TopLine="156"/> 749 751 </Position17> 750 752 <Position18> 751 753 <Filename Value="Application/UCustomApplication.pas"/> 752 <Caret Line="18 0" Column="49" TopLine="156"/>754 <Caret Line="182" Column="57" TopLine="158"/> 753 755 </Position18> 754 756 <Position19> 755 757 <Filename Value="Application/UCustomApplication.pas"/> 756 <Caret Line="18 2" Column="57" TopLine="158"/>758 <Caret Line="187" Column="51" TopLine="163"/> 757 759 </Position19> 758 760 <Position20> 759 761 <Filename Value="Application/UCustomApplication.pas"/> 760 <Caret Line="18 7" Column="51" TopLine="163"/>762 <Caret Line="189" Column="59" TopLine="165"/> 761 763 </Position20> 762 764 <Position21> 763 765 <Filename Value="Application/UCustomApplication.pas"/> 764 <Caret Line="1 89" Column="59" TopLine="165"/>766 <Caret Line="194" Column="51" TopLine="170"/> 765 767 </Position21> 766 768 <Position22> 767 769 <Filename Value="Application/UCustomApplication.pas"/> 768 <Caret Line="19 4" Column="51" TopLine="170"/>770 <Caret Line="196" Column="59" TopLine="172"/> 769 771 </Position22> 770 772 <Position23> 771 773 <Filename Value="Application/UCustomApplication.pas"/> 772 <Caret Line="19 6" Column="59" TopLine="172"/>774 <Caret Line="197" Column="73" TopLine="173"/> 773 775 </Position23> 774 776 <Position24> 775 777 <Filename Value="Application/UCustomApplication.pas"/> 776 <Caret Line=" 197" Column="73" TopLine="173"/>778 <Caret Line="224" Column="35" TopLine="200"/> 777 779 </Position24> 778 780 <Position25> 779 781 <Filename Value="Application/UCustomApplication.pas"/> 780 <Caret Line=" 224" Column="35" TopLine="200"/>782 <Caret Line="123" Column="27" TopLine="104"/> 781 783 </Position25> 782 784 <Position26> 783 785 <Filename Value="Application/UCustomApplication.pas"/> 784 <Caret Line="12 3" Column="27" TopLine="104"/>786 <Caret Line="125" Column="5" TopLine="104"/> 785 787 </Position26> 786 788 <Position27> 787 789 <Filename Value="Application/UCustomApplication.pas"/> 788 <Caret Line="12 5" Column="5" TopLine="104"/>790 <Caret Line="120" Column="17" TopLine="109"/> 789 791 </Position27> 790 792 <Position28> 791 <Filename Value=" Application/UCustomApplication.pas"/>792 <Caret Line="1 20" Column="17" TopLine="109"/>793 <Filename Value="CGI.lpr"/> 794 <Caret Line="18" Column="15" TopLine="9"/> 793 795 </Position28> 794 796 <Position29> 795 <Filename Value=" CGI.lpr"/>796 <Caret Line=" 18" Column="15" TopLine="9"/>797 <Filename Value="Pages/UMainPage.pas"/> 798 <Caret Line="419" Column="42" TopLine="417"/> 797 799 </Position29> 798 800 <Position30> 799 <Filename Value=" Pages/UMainPage.pas"/>800 <Caret Line=" 419" Column="42" TopLine="417"/>801 <Filename Value="Application/UCustomApplication.pas"/> 802 <Caret Line="25" Column="55" TopLine="10"/> 801 803 </Position30> 802 804 </JumpHistory>
Note:
See TracChangeset
for help on using the changeset viewer.