Changeset 102
- Timestamp:
- Oct 4, 2012, 2:06:55 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Network/UModuleNetwork.pas
r101 r102 81 81 ' PRIMARY KEY (`Id`)' + 82 82 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1; '); 83 84 Core.CommonDatabase.Query(DbRows, 85 'CREATE TABLE IF NOT EXISTS `NetworkDevice` (' + 86 ' `Id` int(11) NOT NULL AUTO_INCREMENT,' + 87 ' `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,' + 88 ' `Member` int(11) NOT NULL COMMENT "Member",' + 89 ' `Location` int(11) NOT NULL COMMENT "Member",' + 90 ' `Type` int(11) NOT NULL COMMENT "NetworkDeviceType",' + 91 ' `PositionLatitude` double NOT NULL DEFAULT "0",' + 92 ' `PositionLongitude` double NOT NULL DEFAULT "0",' + 93 ' `Used` int(11) NOT NULL DEFAULT "1",' + 94 ' `Online` int(11) NOT NULL DEFAULT "0",' + 95 ' `LastOnline` datetime NOT NULL,' + 96 ' `PermanentOnline` int(11) NOT NULL DEFAULT "0",' + 97 ' `InboundNATPriority` int(11) NOT NULL DEFAULT "1",' + 98 ' PRIMARY KEY (`Id`),' + 99 ' UNIQUE KEY `Name` (`Name`),' + 100 ' KEY `Member` (`Member`),' + 101 ' KEY `Location` (`Location`),' + 102 ' KEY `Type` (`Type`)' + 103 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;'); 104 105 Core.CommonDatabase.Query(DbRows, 106 'CREATE TABLE IF NOT EXISTS `NetworkInterface` (' + 107 ' `Id` int(11) NOT NULL AUTO_INCREMENT,' + 108 ' `Name` varchar(16) COLLATE utf8_czech_ci NOT NULL,' + 109 ' `Type` int(11) NOT NULL,' + 110 ' `MAC` varchar(17) COLLATE utf8_czech_ci NOT NULL,' + 111 ' `LocalIP` varchar(16) COLLATE utf8_czech_ci NOT NULL,' + 112 ' `IPv6` varchar(255) COLLATE utf8_czech_ci NOT NULL,' + 113 ' `ExternalIP` varchar(16) COLLATE utf8_czech_ci NOT NULL,' + 114 ' `Device` int(11) NOT NULL,' + 115 ' `Online` int(11) NOT NULL DEFAULT "0",' + 116 ' `LastOnline` datetime NOT NULL,' + 117 ' PRIMARY KEY (`Id`),' + 118 ' KEY `Device` (`Device`),' + 119 ' KEY `Type` (`Type`)' + 120 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;'); 121 122 Core.CommonDatabase.Query(DbRows, 123 'CREATE TABLE IF NOT EXISTS `NetworkInterfaceType` (' + 124 ' `Id` int(11) NOT NULL AUTO_INCREMENT,' + 125 ' `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,' + 126 ' `MaxSpeed` int(11) NOT NULL,' + 127 ' `FullDuplex` int(11) NOT NULL DEFAULT "1",' + 128 ' `Color` varchar(6) COLLATE utf8_czech_ci NOT NULL DEFAULT "ffffff",' + 129 ' PRIMARY KEY (`Id`)' + 130 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;'); 131 132 Core.CommonDatabase.Query(DbRows, 133 'CREATE TABLE IF NOT EXISTS `NetworkDeviceType` (' + 134 ' `Id` int(11) NOT NULL AUTO_INCREMENT,' + 135 ' `Name` varchar(255) COLLATE utf8_czech_ci NOT NULL,' + 136 ' `ShowOnline` int(11) NOT NULL DEFAULT "0",' + 137 ' `IconName` varchar(255) COLLATE utf8_czech_ci NOT NULL,' + 138 ' PRIMARY KEY (`Id`)' + 139 ') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;'); 140 83 141 finally 84 142 Data.Free; … … 95 153 try 96 154 DbRows := TDbRows.Create; 155 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `NetworkInterfaceType`'); 156 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `NetworkInterface`'); 157 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `NetworkDeviceType`'); 158 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `NetworkDevice`'); 97 159 Core.CommonDatabase.Query(DbRows, 'DROP TABLE IF EXISTS `NetworkConfiguration`'); 98 160 finally -
trunk/Modules/ZdechovNET/UInternetPage.pas
r97 r102 28 28 29 29 uses 30 UCore, UHtmlClasses ;30 UCore, UHtmlClasses, UWebSession; 31 31 32 32 { TInternetPage } -
trunk/UCore.pas
r101 r102 19 19 TCore = class; 20 20 21 { TWebSession }22 23 TWebSession = class(THTTPHandlerData)24 private25 procedure TopMenu;26 procedure Footer;27 public28 MainModule: TCore;29 Database: TSqlDatabase;30 SessionStorage: THTTPSessionStorageMySQL;31 User: TWebUser;32 UserOnline: TWebOnlineUser;33 HtmlDocument: THtmlDocument;34 GlobalTitle: string;35 TimeStart: TDateTime;36 procedure LoadUserInfo;37 procedure InitDatabase;38 procedure GeneratePage(Page: TWebPage);39 constructor Create; override;40 destructor Destroy; override;41 end;42 21 43 22 { TCore } … … 87 66 uses 88 67 UModuleSystem, UModuleZdechovNET, UModuleUser, UPageAdmin, UModuleTV, 89 UModuleFinance, UModuleNetwork ;68 UModuleFinance, UModuleNetwork, UModulePortal, UModuleIS; 90 69 91 70 resourcestring 92 71 SError = '<div>Error: %s</div>'; 93 94 { TWebSession }95 96 constructor TWebSession.Create;97 begin98 inherited;99 Database := TSqlDatabase.Create(nil);100 SessionStorage := THTTPSessionStorageMySQL.Create(nil);101 SessionStorage.Database := Database;102 HtmlDocument := THtmlDocument.Create;103 User := TWebUser.Create;104 User.Database := Database;105 UserOnline := TWebOnlineUser.Create;106 UserOnline.Database := Database;107 end;108 109 destructor TWebSession.Destroy;110 begin111 FreeAndNil(HtmlDocument);112 FreeAndNil(User);113 FreeAndNil(UserOnline);114 FreeAndNil(SessionStorage);115 FreeAndNil(Database);116 inherited;117 end;118 119 procedure TWebSession.InitDatabase;120 var121 DbRows: TDbRows;122 begin123 with Database do begin124 Connect;125 end;126 try127 DbRows := TDbRows.Create;128 Database.Query(DbRows, 'SET NAMES utf8');129 finally130 DbRows.Free;131 end;132 end;133 134 procedure TWebSession.LoadUserInfo;135 begin136 if Core.ModuleManager.ModuleRunning('User') then begin137 User.HandlerData := Self;138 UserOnline.HandlerData := Self;139 UserOnline.Update;140 User.Id := UserOnline.User;141 User.Load;142 end;143 end;144 145 procedure TWebSession.GeneratePage(Page: TWebPage);146 var147 I: Integer;148 TitleTag: THtmlString;149 begin150 HtmlDocument.ContentLanguage := 'cs';151 GlobalTitle := 'ZděchovNET';152 HtmlDocument.Styles.Add(NavigationLink('/Style/' + MainModule.Style + '/Style.css'));153 HtmlDocument.Scripts.Add(NavigationLink('/Style/' + MainModule.Style + '/Global.js'));154 HtmlDocument.Scripts.Add(NavigationLink('/Style/' + MainModule.Style + '/jquery.js'));155 156 TitleTag := THtmlString.Create;157 HtmlDocument.Body.SubItems.Insert(0, TitleTag);158 TopMenu;159 //Page.Page.OnProduce(HandlerData);160 HtmlDocument.Title := Page.Caption;161 TitleTag.Text := '<div class="TitlePanel"><span class="GlobalTitle">' + GlobalTitle +162 '</span> - ' + HtmlDocument.Title + '</div>';163 HtmlDocument.Title := GlobalTitle + ' - ' + HtmlDocument.Title;164 with HtmlDocument.AsXmlDocument do165 try166 Formated := MainModule.FormatHTML;167 Response.Content.WriteString(AsString);168 finally169 Free;170 end;171 end;172 72 173 73 … … 282 182 RegisterModule(TModuleFinance.Create(nil), True); 283 183 RegisterModule(TModuleNetwork.Create(nil), True); 184 RegisterModule(TModulePortal.Create(nil), True); 185 RegisterModule(TModuleIS.Create(nil), True); 284 186 end; 285 187 end; -
trunk/ZdechovNET.lpi
r101 r102 36 36 </Target> 37 37 <SearchPaths> 38 <OtherUnitFiles Value="/usr/lib/mysql;/usr/lib64/mysql;Application;WebServer;Network;Pages;Modules/User;Common;Modules/System;Modules/ZdechovNET;Modules/TV;Modules/Finance;Modules/Network "/>38 <OtherUnitFiles Value="/usr/lib/mysql;/usr/lib64/mysql;Application;WebServer;Network;Pages;Modules/User;Common;Modules/System;Modules/ZdechovNET;Modules/TV;Modules/Finance;Modules/Network;Modules/Portal;Modules/IS"/> 39 39 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 40 40 </SearchPaths> … … 117 117 </Item7> 118 118 </RequiredPackages> 119 <Units Count="3 0">119 <Units Count="34"> 120 120 <Unit0> 121 121 <Filename Value="ZdechovNET.lpr"/> … … 214 214 <IsPartOfProject Value="True"/> 215 215 <HasResources Value="True"/> 216 <UnitName Value="UInternetPage"/> 216 217 </Unit16> 217 218 <Unit17> … … 272 273 <IsPartOfProject Value="True"/> 273 274 <ComponentName Value="WebPageFinance"/> 275 <HasResources Value="True"/> 274 276 <ResourceBaseClass Value="DataModule"/> 275 277 <UnitName Value="UPageFinance"/> … … 284 286 <IsPartOfProject Value="True"/> 285 287 <ComponentName Value="WebPageNetwork"/> 288 <HasResources Value="True"/> 286 289 <ResourceBaseClass Value="DataModule"/> 287 290 <UnitName Value="UPageNetwork"/> 288 291 </Unit29> 292 <Unit30> 293 <Filename Value="Modules/Portal/UModulePortal.pas"/> 294 <IsPartOfProject Value="True"/> 295 <UnitName Value="UModulePortal"/> 296 </Unit30> 297 <Unit31> 298 <Filename Value="Modules/Portal/UPagePortal.pas"/> 299 <IsPartOfProject Value="True"/> 300 <ComponentName Value="WebPagePortal"/> 301 <ResourceBaseClass Value="DataModule"/> 302 <UnitName Value="UPagePortal"/> 303 </Unit31> 304 <Unit32> 305 <Filename Value="Modules/IS/UModuleIS.pas"/> 306 <IsPartOfProject Value="True"/> 307 <UnitName Value="UModuleIS"/> 308 </Unit32> 309 <Unit33> 310 <Filename Value="Application/UWebSession.pas"/> 311 <IsPartOfProject Value="True"/> 312 <UnitName Value="UWebSession"/> 313 </Unit33> 289 314 </Units> 290 315 </ProjectOptions>
Note:
See TracChangeset
for help on using the changeset viewer.