Changeset 731
- Timestamp:
- Jan 17, 2015, 9:24:47 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r730 r731 1 1 <?php 2 2 3 $Revision = 73 0; // Subversion revision4 $DatabaseRevision = 73 0; // SQL structure revision5 $ReleaseTime = strtotime('2015-01-1 2');3 $Revision = 731; // Subversion revision 4 $DatabaseRevision = 731; // SQL structure revision 5 $ReleaseTime = strtotime('2015-01-14'); -
trunk/Common/AppModule.php
r657 r731 38 38 var $Id; 39 39 var $Name; 40 var $Title; 40 41 var $Version; 41 42 var $License; … … 65 66 $this->Enabled = false; 66 67 $this->Running = false; 68 $this->HomePage = ''; 69 $this->License = ''; 70 $this->Version = ''; 71 $this->Creator = ''; 72 $this->Description = ''; 67 73 $this->Dependencies = array(); 68 74 $this->Type = ModuleType::Normal; -
trunk/Common/Setup/Setup.php
r636 r731 208 208 $Output = ''; 209 209 210 $Pageing = new Pag eing();210 $Pageing = new Paging(); 211 211 $Pageing->TotalCount = count($this->System->ModuleManager->Modules); 212 212 $Table = new VisualTable(); -
trunk/Common/Setup/Updates.php
r730 r731 1222 1222 $Manager->Execute('ALTER TABLE `Scheduler` ADD CONSTRAINT `Schedule_ibfk_2` FOREIGN KEY (`Action`) REFERENCES `SchedulerAction` (`Id`);'); 1223 1223 $Manager->Execute('INSERT INTO `SchedulerAction` (`Id`, `Name`, `Class`) VALUES (NULL, "Import bankovních účtů", "ScheduleBankImport");'); 1224 } 1225 1226 function UpdateTo731($Manager) 1227 { 1228 // NetworkDomain 1229 $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkDomain` ( 1230 `Id` int(11) NOT NULL, 1231 `Name` varchar(255) NOT NULL, 1232 `Parent` int(11) DEFAULT NULL, 1233 `Serial` int(11) NOT NULL, 1234 `Refresh` int(11) NOT NULL, 1235 `Expire` int(11) NOT NULL, 1236 `Retry` int(11) NOT NULL, 1237 `Minimum` int(11) NOT NULL, 1238 `TTL` int(11) NOT NULL, 1239 `Description` varchar(255) NOT NULL 1240 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 1241 1242 $Manager->Execute('ALTER TABLE `NetworkDomain` ADD PRIMARY KEY (`Id`);'); 1243 1244 $Manager->Execute('ALTER TABLE `NetworkDomain` 1245 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;'); 1246 1247 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 1248 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 1249 NULL , "", "Síťová doména", "1", "/is/?t=NetworkDomain&a=list", NULL , NULL , NULL , "1");'); 1250 $ActionId = $Manager->Database->insert_id; 1251 $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Síť"'); 1252 if($DbResult->num_rows > 0) 1253 { 1254 $DbRow = $DbResult->fetch_assoc(); 1255 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1256 "VALUES (NULL , 'Síťová doména', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1257 } 1258 1259 // Model additions 1260 $Manager->Execute('ALTER TABLE `Model` ADD `Title` VARCHAR(255) NOT NULL , '. 1261 'ADD `Query` VARCHAR(255) NOT NULL , '. 1262 'ADD `DefaultSortColumn` VARCHAR(255) NOT NULL , '. 1263 'ADD `DefaultSortOrder` INT NOT NULL ;'); 1264 1265 // ModelField 1266 $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModelField` ( 1267 `Id` int(11) NOT NULL, 1268 `Name` varchar(255) NOT NULL, 1269 `Model` int(11) NOT NULL, 1270 `Query` varchar(255) NOT NULL, 1271 `Type` varchar(255) NOT NULL, 1272 `Title` varchar(255) NOT NULL, 1273 `DefaultValue` varchar(255) NOT NULL, 1274 `IsNull` int(11) NOT NULL, 1275 `Suffix` varchar(255) NOT NULL 1276 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 1277 1278 $Manager->Execute('ALTER TABLE `ModelField` 1279 ADD PRIMARY KEY (`Id`), ADD KEY `Model` (`Model`);'); 1280 1281 $Manager->Execute('ALTER TABLE `ModelField` 1282 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); 1283 1284 $Manager->Execute('ALTER TABLE `ModelField` 1285 ADD CONSTRAINT `ModelField_ibfk_1` FOREIGN KEY (`Model`) REFERENCES `Model` (`Id`);'); 1286 1287 // Module additions 1288 $Manager->Execute('ALTER TABLE `Module` ADD `Version` VARCHAR(255) NOT NULL , '. 1289 'ADD `Creator` VARCHAR(255) NOT NULL , '. 1290 'ADD `License` VARCHAR(255) NOT NULL , '. 1291 'ADD `Installed` INT NOT NULL , '. 1292 'ADD `HomePage` VARCHAR(255) NOT NULL , '. 1293 'ADD `Description` TEXT NOT NULL ;'); 1294 1295 // ModuleLink 1296 $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModuleLink` ( 1297 `Id` int(11) NOT NULL, 1298 `Module` int(11) NOT NULL, 1299 `LinkedModule` int(11) NOT NULL, 1300 `Type` int(11) NOT NULL 1301 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 1302 1303 $Manager->Execute('ALTER TABLE `ModuleLink` 1304 ADD PRIMARY KEY (`Id`), ADD KEY `Module` (`Module`), ADD KEY `LinkedModule` (`LinkedModule`);'); 1305 1306 $Manager->Execute('ALTER TABLE `ModuleLink` 1307 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); 1224 1308 } 1225 1309 … … 1287 1371 726 => array('Revision' => 729, 'Function' => 'UpdateTo729'), 1288 1372 729 => array('Revision' => 730, 'Function' => 'UpdateTo730'), 1373 730 => array('Revision' => 731, 'Function' => 'UpdateTo731'), 1289 1374 )); 1290 1375 } -
trunk/Modules/IS/IS.php
r721 r731 756 756 { 757 757 parent::__construct($System); 758 $this->Name = 'Information system'; 758 $this->Name = 'IS'; 759 $this->Title = 'Information system'; 759 760 $this->Version = '1.0'; 760 761 $this->Creator = 'Chronos'; -
trunk/Modules/Network/Network.php
r715 r731 15 15 function Show() 16 16 { 17 // http://en.wikipedia.org/wiki/List_of_WLAN_channels 18 //$ChannelList = array(2412 => 1, 2417 => 2, 2422 => 3, 2427 => 4, 2432 => 5, 2437 => 6, 2442 => 7, 2447 => 8, 2452 => 9, 2457 => 10, 2462 => 11, 2467 => 12, 2472 => 13, 5200 => 40, 5205 => 41, 5210 => 42, 5215 => 43, 5220 => 44, 5225 => 45, 5230 => 46, 5235 => 47, 5240 => 48, 5245 => 49, 5250 => 50, 5255 => 51, 5260 => 52, 5265 => 53, 5270 => 54, 5275 => 55, 5280 => 56, 5285 => 57, 5290 => 58, 5295 => 59, 5300 => 60, 5500 => 100, 5520 => 104, 5540 => 108, 5560 => 112, 5580 => 116, 5600 => 120, 5620 => 124, 5640 => 128, 5660 => 132, 5700 => 140, 5720 => 144); 19 $Output = '<div align="center">'. 20 '<a href="?section=obsazeni_wifi_kanalu&range=a">Pásmo 2,4 GHz (a)</a> '. 21 '<a href="?section=obsazeni_wifi_kanalu&range=bc">Pásmo 5 GHz dolní (b, c)</a> '. 22 '<a href="?section=obsazeni_wifi_kanalu&range=d">Pásmo 5 GHz horní (d)</a> '. 23 '<a href="http://www.ctu.cz/1/download/Opatreni%20obecne%20povahy/VO_R_12_08_2005_34.pdf">VO_R_12_08_2005_34</a><br/>'. 24 '<strong>Seznam známých AP a obsazení kmitočtových pásem:</strong></div>'. 25 '<table class="WideTable">'. 26 '<tr><th/><br/>SSID<br/><br/></th>'; 27 $ChannelList = array(); 28 if(!array_key_exists('range', $_GET)) $_GET['range'] = 'a'; 29 if($_GET['range'] == 'a') 30 { 31 $Where = '(Frequency < 5000)'; 32 for($Freq = 2402; $Freq <= 2482; $Freq = $Freq + 5) $ChannelList[] = $Freq; 33 } 34 if($_GET['range'] == 'bc') 35 { 36 $Where = '(Frequency >= 5000) AND (Frequency <= 5350)'; 37 for($Freq = 5150; $Freq <= 5350; $Freq = $Freq + 5) $ChannelList[] = $Freq; 38 } 39 if($_GET['range'] == 'd') 40 { 41 $Where = '(Frequency >= 5470)'; 42 for($Freq = 5470; $Freq <= 5725; $Freq = $Freq + 5) $ChannelList[] = $Freq; 43 } 44 17 // http://en.wikipedia.org/wiki/List_of_WLAN_channels 18 //$ChannelList = array(2412 => 1, 2417 => 2, 2422 => 3, 2427 => 4, 2432 => 5, 2437 => 6, 2442 => 7, 2447 => 8, 2452 => 9, 2457 => 10, 2462 => 11, 2467 => 12, 2472 => 13, 5200 => 40, 5205 => 41, 5210 => 42, 5215 => 43, 5220 => 44, 5225 => 45, 5230 => 46, 5235 => 47, 5240 => 48, 5245 => 49, 5250 => 50, 5255 => 51, 5260 => 52, 5265 => 53, 5270 => 54, 5275 => 55, 5280 => 56, 5285 => 57, 5290 => 58, 5295 => 59, 5300 => 60, 5500 => 100, 5520 => 104, 5540 => 108, 5560 => 112, 5580 => 116, 5600 => 120, 5620 => 124, 5640 => 128, 5660 => 132, 5700 => 140, 5720 => 144); 19 $Output = '<div align="center">'. 20 '<a href="?section=obsazeni_wifi_kanalu&range=a">Pásmo 2,4 GHz (a)</a> '. 21 '<a href="?section=obsazeni_wifi_kanalu&range=bc">Pásmo 5 GHz dolní (b, c)</a> '. 22 '<a href="?section=obsazeni_wifi_kanalu&range=d">Pásmo 5 GHz horní (d)</a> '. 23 '<a href="http://www.ctu.cz/1/download/Opatreni%20obecne%20povahy/VO_R_12_08_2005_34.pdf">VO_R_12_08_2005_34</a><br/>'. 24 '<strong>Seznam známých AP a obsazení kmitočtových pásem:</strong></div>'. 25 '<table class="WideTable">'. 26 '<tr><th/><br/>SSID<br/><br/></th>'; 27 $ChannelList = array(); 28 if(!array_key_exists('range', $_GET)) $_GET['range'] = 'a'; 29 if($_GET['range'] == 'a') 30 { 31 $Where = '(Frequency < 5000)'; 32 for($Freq = 2402; $Freq <= 2482; $Freq = $Freq + 5) $ChannelList[] = $Freq; 33 } 34 if($_GET['range'] == 'bc') 35 { 36 $Where = '(Frequency >= 5000) AND (Frequency <= 5350)'; 37 for($Freq = 5150; $Freq <= 5350; $Freq = $Freq + 5) $ChannelList[] = $Freq; 38 } 39 if($_GET['range'] == 'd') 40 { 41 $Where = '(Frequency >= 5470)'; 42 for($Freq = 5470; $Freq <= 5725; $Freq = $Freq + 5) $ChannelList[] = $Freq; 43 } 44 45 foreach($ChannelList as $Frequency) 46 { 47 $Output .= '<th><div class="RotatedHeader">'.$Frequency.'<div></th>'; 48 } 49 $Output .= '</tr>'; 50 $DbResult = $this->Database->query('SELECT `Frequency` FROM `NetworkInterfaceWireless` WHERE '.$Where.' AND (`Mode`=0) GROUP BY `Frequency`'); 51 while($DbRow = $DbResult->fetch_assoc()) 52 { 53 $DbResult2 = $this->Database->query('SELECT * FROM `NetworkInterfaceWireless` WHERE (`Frequency`='.$DbRow['Frequency'].') AND '.$Where); 54 while($DbRow2 = $DbResult2->fetch_assoc()) 55 { 56 $LowFrequency = $DbRow['Frequency'] - $DbRow2['ChannelWidth'] / 2 - $DbRow2['ChannelWidthLower']; 57 $HighFrequency = $DbRow['Frequency'] + $DbRow2['ChannelWidth'] / 2 + $DbRow2['ChannelWidthUpper']; 58 $Output .= '<tr><td>'.$DbRow2['SSID'].'</td>'; 45 59 foreach($ChannelList as $Frequency) 46 60 { 47 $Output .= '<th><div class="RotatedHeader">'.$Frequency.'<div></th>'; 61 if(($DbRow2['Frequency'] == $Frequency)) $Color = '#000000'; 62 else if(($LowFrequency <= ($Frequency - 2.5)) and ($HighFrequency >= ($Frequency + 2.5))) $Color = '#808080'; 63 else if(($LowFrequency == $Frequency) or ($HighFrequency == $Frequency)) $Color = '#c0c0c0'; 64 else $Color = '#ffffff'; 65 $Output .= '<td style="background-color: '.$Color.';"> </td>'; 48 66 } 49 $Output .= '</tr>'; 50 $DbResult = $this->Database->query('SELECT `Frequency` FROM `NetworkInterfaceWireless` WHERE '.$Where.' AND (`Mode`=0) GROUP BY `Frequency`'); 51 while($DbRow = $DbResult->fetch_assoc()) 52 { 53 $DbResult2 = $this->Database->query('SELECT * FROM `NetworkInterfaceWireless` WHERE (`Frequency`='.$DbRow['Frequency'].') AND '.$Where); 54 while($DbRow2 = $DbResult2->fetch_assoc()) 55 { 56 $LowFrequency = $DbRow['Frequency'] - $DbRow2['ChannelWidth'] / 2 - $DbRow2['ChannelWidthLower']; 57 $HighFrequency = $DbRow['Frequency'] + $DbRow2['ChannelWidth'] / 2 + $DbRow2['ChannelWidthUpper']; 58 $Output .= '<tr><td>'.$DbRow2['SSID'].'</td>'; 59 foreach($ChannelList as $Frequency) 60 { 61 if(($DbRow2['Frequency'] == $Frequency)) $Color = '#000000'; 62 else if(($LowFrequency <= ($Frequency - 2.5)) and ($HighFrequency >= ($Frequency + 2.5))) $Color = '#808080'; 63 else if(($LowFrequency == $Frequency) or ($HighFrequency == $Frequency)) $Color = '#c0c0c0'; 64 65 else $Color = '#ffffff'; 66 $Output .= '<td style="background-color: '.$Color.';"> </td>'; 67 } 68 69 $Output .= '</tr>'; 70 } 71 } 72 $Output .= '</table>'; 67 68 $Output .= '</tr>'; 69 } 70 } 71 $Output .= '</table>'; 73 72 return($Output); 74 73 } … … 250 249 ), 251 250 )); 252 $this->System->FormManager->RegisterClass('NetworkDeviceConfig', array(251 $this->System->FormManager->RegisterClass('NetworkDeviceConfig', array( 253 252 'Title' => 'Nastavení zařízení', 254 253 'Table' => 'NetworkDeviceConfig', … … 261 260 'ConfigCompact' => array('Type' => 'Text', 'Caption' => 'Rozdílové nastavení', 'Default' => ''), 262 261 ), 262 )); 263 $this->System->FormManager->RegisterClass('NetworkDomain', array( 264 'Title' => 'Síťová doména', 265 'Table' => 'NetworkDomain', 266 'DefaultSortColumn' => 'Name', 267 'DefaultSortOrder' => 1, 268 'Items' => array( 269 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 270 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''), 271 'Parent' => array('Type' => 'TNetworkDomain', 'Caption' => 'Nadřazená doména', 'Default' => '', 'Null' => true), 272 'Serial' => array('Type' => 'Integer', 'Caption' => 'Sériové číslo', 'Default' => '1'), 273 'Minimum' => array('Type' => 'Integer', 'Caption' => 'Minimum', 'Default' => '10800'), 274 'Retry' => array('Type' => 'Integer', 'Caption' => 'Opakování', 'Default' => '7200'), 275 'Expire' => array('Type' => 'Integer', 'Caption' => 'Čas vypršení', 'Default' => '2419200'), 276 'Refresh' => array('Type' => 'Integer', 'Caption' => 'Obnovení', 'Default' => '28800'), 277 'TTL' => array('Type' => 'Integer', 'Caption' => 'TTL', 'Default' => '86400', 'Suffix' => 'sekund'), 278 ), 279 )); 280 $this->System->FormManager->RegisterFormType('TNetworkDomain', array( 281 'Type' => 'Reference', 282 'Table' => 'NetworkDomain', 283 'Id' => 'Id', 284 'Name' => 'Name', 285 'Filter' => '1', 263 286 )); 264 287 $this->System->FormManager->RegisterClass('DeviceAPIType', array( … … 358 381 'Name' => 'Name', 359 382 'Filter' => '1', 360 )); 383 )); 361 384 $this->System->FormManager->RegisterFormType('TDeviceList', array( 362 385 'Type' => 'ManyToOne', -
trunk/Modules/System/System.php
r712 r731 14 14 { 15 15 $Output = ''; 16 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ` SystemModule`');16 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Module`'); 17 17 $DbRow = $DbResult->fetch_row(); 18 18 $PageList = GetPageList($DbRow[0]); … … 22 22 23 23 $TableColumns = array( 24 25 26 27 28 29 30 31 24 array('Name' => 'Name', 'Title' => 'Jméno'), 25 array('Name' => 'Creator', 'Title' => 'Tvůrce'), 26 array('Name' => 'Version', 'Title' => 'Verze'), 27 array('Name' => 'License', 'Title' => 'Licence'), 28 array('Name' => 'Installed', 'Title' => 'Instalováno'), 29 array('Name' => 'Description', 'Title' => 'Popis'), 30 array('Name' => 'Dependencies', 'Title' => 'Závislosti'), 31 array('Name' => '', 'Title' => 'Akce'), 32 32 ); 33 33 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 34 34 $Output .= $Order['Output']; 35 $Query = 'SELECT *, (SELECT GROUP_CONCAT(`T1`.`Name` SEPARATOR ", ") FROM ` SystemModuleDependency` '.36 'LEFT JOIN ` SystemModule` AS `T1` ON `T1`.`Id` = `SystemModuleDependency`.`DependencyModule` '.37 'WHERE ` SystemModuleDependency`.`Module` = `SystemModule`.`Id`) AS `Dependencies` '.38 'FROM ` SystemModule` '.$Order['SQL'].$PageList['SQLLimit'];35 $Query = 'SELECT *, (SELECT GROUP_CONCAT(`T1`.`Name` SEPARATOR ", ") FROM `ModuleLink` '. 36 'LEFT JOIN `Module` AS `T1` ON `T1`.`Id` = `ModuleLink`.`LinkedModule` '. 37 'WHERE `ModuleLink`.`Module` = `Module`.`Id`) AS `Dependencies` '. 38 'FROM `Module` '.$Order['SQL'].$PageList['SQLLimit']; 39 39 40 40 $DbResult = $this->Database->query($Query); … … 69 69 if($_GET['A'] == 'SaveToDb') 70 70 { 71 $ this->System->ModuleManager->Modules['System']->SaveToDatabase();71 $Output .= $this->System->ModuleManager->Modules['System']->SaveToDatabase(); 72 72 $Output .= $this->SystemMessage('Načtení modulů', 'Seznam modulů v databázi zaktualizován'); 73 73 } else … … 225 225 'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''), 226 226 'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''), 227 'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''), 228 'Version' => array('Type' => 'String', 'Caption' => 'Verze', 'Default' => ''), 229 'License' => array('Type' => 'String', 'Caption' => 'Licence', 'Default' => ''), 230 'Creator' => array('Type' => 'String', 'Caption' => 'Tvůrce', 'Default' => ''), 231 'HomePage' => array('Type' => 'Hyperlink', 'Caption' => 'Domovské stránky', 'Default' => ''), 232 'Installed' => array('Type' => 'Boolean', 'Caption' => 'Instalováno', 'Default' => '', 'ReadOnly' => true), 233 'Models' => array('Type' => 'TModelListModule', 'Caption' => 'Modely', 'Default' => ''), 234 'Links' => array('Type' => 'TModuleLinkListModule', 'Caption' => 'Vazby', 'Default' => ''), 235 ), 236 'Actions' => array( 237 array('Caption' => 'Aktualizovat z disku', 'URL' => '/module/?A=SaveToDb'), 238 ), 239 )); 240 $this->System->FormManager->RegisterFormType('TModule', array( 241 'Type' => 'Reference', 242 'Table' => 'Module', 243 'Id' => 'Id', 244 'Name' => 'Title', 245 'Filter' => '1', 246 )); 247 $this->System->FormManager->RegisterFormType('TModelListModule', array( 248 'Type' => 'ManyToOne', 249 'Table' => 'Model', 250 'Id' => 'Id', 251 'Ref' => 'Module', 252 'Filter' => '1', 253 )); 254 $this->System->FormManager->RegisterClass('Model', array( 255 'Title' => 'Modely', 256 'Table' => 'Model', 257 'Items' => array( 258 'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''), 259 'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''), 260 'Module' => array('Type' => 'TModule', 'Caption' => 'Module', 'Default' => ''), 261 'Query' => array('Type' => 'String', 'Caption' => 'SQL dotaz', 'Default' => ''), 262 'DefaultSortColumn' => array('Type' => 'String', 'Caption' => 'Výchozí sloupce řazení', 'Default' => ''), 263 'DefaultSortOrder' => array('Type' => 'Text', 'Caption' => 'Výchozí směr řazení', 'Default' => ''), 264 'Fields' => array('Type' => 'TModelFieldListModel', 'Caption' => 'Pole', 'Default' => ''), 265 ), 266 )); 267 $this->System->FormManager->RegisterFormType('TModel', array( 268 'Type' => 'Reference', 269 'Table' => 'Model', 270 'Id' => 'Id', 271 'Name' => 'Title', 272 'Filter' => '1', 273 )); 274 $this->System->FormManager->RegisterFormType('TModelFieldListModel', array( 275 'Type' => 'ManyToOne', 276 'Table' => 'ModelField', 277 'Id' => 'Id', 278 'Ref' => 'Model', 279 'Filter' => '1', 280 )); 281 $this->System->FormManager->RegisterClass('ModelField', array( 282 'Title' => 'Pole modelu', 283 'Table' => 'ModelField', 284 'Items' => array( 285 'Name' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''), 286 'Title' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''), 287 'Model' => array('Type' => 'TModel', 'Caption' => 'Model', 'Default' => ''), 288 'Query' => array('Type' => 'String', 'Caption' => 'SQL dotaz', 'Default' => ''), 289 'Type' => array('Type' => 'String', 'Caption' => 'Typ', 'Default' => ''), 290 'DefaultValue' => array('Type' => 'String', 'Caption' => 'Výchozí hodnota', 'Default' => ''), 291 'IsNull' => array('Type' => 'Boolean', 'Caption' => 'Také nulová hodnota', 'Default' => ''), 292 'Suffix' => array('Type' => 'String', 'Caption' => 'Text za', 'Default' => ''), 293 ), 294 )); 295 $this->System->FormManager->RegisterFormType('TModuleLink', array( 296 'Type' => 'Reference', 297 'Table' => 'ModuleLink', 298 'Id' => 'Id', 299 'Name' => 'Module', 300 'Filter' => '1', 301 )); 302 $this->System->FormManager->RegisterFormType('TModuleLinkListModule', array( 303 'Type' => 'ManyToOne', 304 'Table' => 'ModuleLink', 305 'Id' => 'Id', 306 'Ref' => 'Module', 307 'Filter' => '1', 308 )); 309 $this->System->FormManager->RegisterClass('ModuleLink', array( 310 'Title' => 'Vazby modulu', 311 'Table' => 'ModuleLink', 312 'Items' => array( 313 'Module' => array('Type' => 'TModule', 'Caption' => 'Modul', 'Default' => ''), 314 'LinkedModule' => array('Type' => 'TModule', 'Caption' => 'Vázaný modul', 'Default' => ''), 315 'Type' => array('Type' => 'String', 'Caption' => 'Typ vazby', 'Default' => ''), 227 316 ), 228 317 )); … … 232 321 'DefaultSortColumn' => 'Name', 233 322 'Items' => array( 234 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 323 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 235 324 ), 236 325 )); … … 337 426 if($Module->IsInstalled()) $Installed = 1; 338 427 else $Installed = 0; 339 $this->Database->query('UPDATE ` SystemModule` SET `Installed`=1 WHERE `Name`="'.$Module->Name.'"');428 $this->Database->query('UPDATE `Module` SET `Installed`=1 WHERE `Name`="'.$Module->Name.'"'); 340 429 } 341 430 } … … 345 434 //DebugLog('Loading modules...'); 346 435 $this->Modules = array(); 347 $Query = 'SELECT `Id`, `Name`,`Installed` FROM ` SystemModule`';436 $Query = 'SELECT `Id`, `Name`,`Installed` FROM `Module`'; 348 437 $DbResult = $this->Database->query($Query); 349 438 while($Module = $DbResult->fetch_array()) … … 361 450 function SaveToDatabase() 362 451 { 452 $Output = ''; 363 453 $Modules = array(); 364 $DbResult = $this->Database->query('SELECT * FROM ` SystemModule`');454 $DbResult = $this->Database->query('SELECT * FROM `Module`'); 365 455 while($DbRow = $DbResult->fetch_assoc()) 366 456 { … … 375 465 if(!array_key_exists($Module->Name, $Modules)) 376 466 { 377 $this->Database->insert('SystemModule', array('Name' => $Module->Name, 378 'Version' => $Module->Version, 'Creator' => $Module->Creator, 467 $this->Database->insert('Module', array('Name' => $Module->Name, 468 'Version' => $Module->Version, 'Creator' => $Module->Creator, 469 'HomePage' => $Module->HomePage, 'Title' => $Module->Title, 379 470 'Description' => $Module->Description, 'License' => $Module->License, 380 471 'Installed' => $Module->Installed)); 381 472 $this->System->ModuleManager->Modules[$Module->Name]->Id = $this->Database->insert_id; 382 473 } 383 else $this->Database->update('SystemModule', 'Name = "'.$Module->Name.'"', array( 384 'Version' => $Module->Version, 'Creator' => $Module->Creator, 474 else $this->Database->update('Module', 'Name = "'.$Module->Name.'"', array( 475 'Version' => $Module->Version, 'Creator' => $Module->Creator, 476 'HomePage' => $Module->HomePage, 'Title' => $Module->Title, 385 477 'Description' => $Module->Description, 'License' => $Module->License, 386 478 'Installed' => $Module->Installed)); … … 391 483 if(!$this->System->ModuleManager->ModulePresent($Module['Name'])) 392 484 { 393 DebugLog('Removing module '.$Module['Name'].' from list'); 394 $this->Database->query('DELETE FROM `SystemModule` WHERE `Id` = '.$Module['Id']); 485 $Output .= 'Removing module '.$Module['Name'].' from list</br/>'; 486 $this->Database->query('DELETE FROM `ModuleLink` WHERE `Module` = '.$Module['Id']); 487 $this->Database->query('DELETE FROM `ModuleLink` WHERE `LinkedModule` = '.$Module['Id']); 488 $DbResult = $this->Database->query('SELECT Id FROM `PermissionOperation` WHERE `Module` = '.$Module['Id']); 489 while($DbRow = $DbResult->fetch_assoc()) 490 { 491 $this->Database->query('DELETE FROM `PermissionGroupAssignment` WHERE `AssignedOperation` = '.$DbRow['Id']); 492 $this->Database->query('DELETE FROM `PermissionUserAssignment` WHERE `AssignedOperation` = '.$DbRow['Id']); 493 } 494 $this->Database->query('DELETE FROM `PermissionOperation` WHERE `Module` = '.$Module['Id']); 495 $this->Database->query('DELETE FROM `Model` WHERE `Module` = '.$Module['Id']); 496 $DbResult = $this->Database->query('SELECT Id FROM `Model` WHERE `Module` = '.$Module['Id']); 497 while($DbRow = $DbResult->fetch_assoc()) 498 $this->Database->query('DELETE FROM `ModelField` WHERE `Model` = '.$DbRow['Id']); 499 $this->Database->query('DELETE FROM `Module` WHERE `Id` = '.$Module['Id']); 395 500 } 396 501 397 502 // Reload dependencies 398 503 $DbDependency = array(); 399 $DbResult = $this->Database->query('SELECT * FROM ` SystemModuleDependency`');504 $DbResult = $this->Database->query('SELECT * FROM `ModuleLink`'); 400 505 while($DbRow = $DbResult->fetch_assoc()) 401 $DbDependency[$DbRow['Module']][] = $DbRow[' DependencyModule'];506 $DbDependency[$DbRow['Module']][] = $DbRow['LinkedModule']; 402 507 403 508 foreach($this->System->ModuleManager->Modules as $Module) … … 412 517 $DependencyId = $this->System->ModuleManager->Modules[$Dependency]->Id; 413 518 else throw new Exception('Dependent module '.$Dependency.' not found'); 414 $this->Database->insert(' SystemModuleDependency', array('Module' => $Module->Id,415 ' DependencyModule' => $DependencyId));519 $this->Database->insert('ModuleLink', array('Module' => $Module->Id, 520 'LinkedModule' => $DependencyId, 'Type' => 'DependOn')); 416 521 } 417 522 } … … 423 528 $DepModName = $this->System->ModuleManager->SearchModuleById($Dep); 424 529 if(!in_array($DepModName, $Module->Dependencies)) 425 $this->Database->query('DELETE FROM ` SystemModuleDependency` WHERE `Module` = '.426 $Module->Id.' AND DependencyModule='.$Dep);530 $this->Database->query('DELETE FROM `ModuleLink` WHERE `Module` = '. 531 $Module->Id.' AND LinkedModule='.$Dep); 427 532 } 428 533 } 534 return($Output); 429 535 } 430 536 } -
trunk/Modules/VPS/VPS.php
r631 r731 7 7 parent::__construct($System); 8 8 $this->Name = 'VPS'; 9 $this->Title = 'VPS'; 9 10 $this->Version = '1.0'; 10 11 $this->Creator = 'Chronos'; … … 12 13 $this->Description = 'VPS(Virtual Private Server) hosting management'; 13 14 $this->Dependencies = array('User'); 15 $this->Modules = array(); 14 16 } 15 17
Note:
See TracChangeset
for help on using the changeset viewer.