Changeset 817


Ignore:
Timestamp:
Mar 16, 2016, 8:51:59 PM (9 years ago)
Author:
chronos
Message:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/FormClasses.php

    r786 r817  
    143143    'States' => array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>'),
    144144  ),
    145   'TNetworkConfigurationState' => array(
    146     'Type' => 'Enumeration',
    147     'States' => array('Neplánováno', 'V plánu', 'Provádí se'),
    148   ),
    149145  'TAntennaPolarity' => array(
    150146    'Type' => 'Enumeration',
  • trunk/Application/UpdateTrace.php

    r814 r817  
    19701970  $Manager->Execute('ALTER TABLE `NetworkDevice` CHANGE `LastOnline` `LastOnline` DATETIME NULL;');
    19711971  $Manager->Execute('UPDATE `NetworkDevice` SET `LastOnline` = NULL WHERE `LastOnline` = "0000-00-00 00:00:00"');
     1972}
     1973
     1974function UpdateTo817($Manager)
     1975{
     1976  $Manager->Execute('ALTER TABLE `NetworkConfiguration` ADD `SysName` VARCHAR(255) NOT NULL FIRST;');
     1977  $Manager->Execute('UPDATE `NetworkConfiguration` SET `SysName`="LinuxDNS" WHERE `Id`=1');
     1978  $Manager->Execute('UPDATE `NetworkConfiguration` SET `SysName`="LinuxIptables" WHERE `Id`=2');
     1979  $Manager->Execute('UPDATE `NetworkConfiguration` SET `SysName`="LinuxTrafficShaping" WHERE `Id`=3');
     1980  $Manager->Execute('UPDATE `NetworkConfiguration` SET `SysName`="LinuxDHCP" WHERE `Id`=4');
     1981  $Manager->Execute('UPDATE `NetworkConfiguration` SET `SysName`="LinuxVPN" WHERE `Id`=5');
     1982  $Manager->Execute('UPDATE `NetworkConfiguration` SET `SysName`="RouterosDHCP" WHERE `Id`=7');
     1983  $Manager->Execute('UPDATE `NetworkConfiguration` SET `SysName`="RouterosNetwatch" WHERE `Id`=8');
     1984  $Manager->Execute('UPDATE `NetworkConfiguration` SET `SysName`="RouterosQueue" WHERE `Id`=9');
     1985  $Manager->Execute('UPDATE `NetworkConfiguration` SET `SysName`="RouterosFirewallNAT" WHERE `Id`=10');
     1986  $Manager->Execute('UPDATE `NetworkConfiguration` SET `SysName`="RouterosFirewallMangle" WHERE `Id`=11');
     1987  $Manager->Execute('UPDATE `NetworkConfiguration` SET `SysName`="RouterosFirewallFilter" WHERE `Id`=12');
     1988  $Manager->Execute('UPDATE `NetworkConfiguration` SET `SysName`="RouterosDNS" WHERE `Id`=13');
     1989  $Manager->Execute('ALTER TABLE `NetworkConfiguration` DROP `Execute`;');
    19721990}
    19731991
     
    20612079      807 => array('Revision' => 808, 'Function' => 'UpdateTo808'),
    20622080      808 => array('Revision' => 814, 'Function' => 'UpdateTo814'),
     2081      814 => array('Revision' => 817, 'Function' => 'UpdateTo817'),
    20632082    ));
    20642083  }
  • trunk/Application/Version.php

    r815 r817  
    11<?php
    22
    3 $Revision = 815; // Subversion revision
    4 $DatabaseRevision = 814; // SQL structure revision
    5 $ReleaseTime = strtotime('2016-03-09');
     3$Revision = 817; // Subversion revision
     4$DatabaseRevision = 817; // SQL structure revision
     5$ReleaseTime = strtotime('2016-03-16');
  • trunk/Modules/Customer/Customer.php

    r793 r817  
    1313    $this->Dependencies = array('User');
    1414  }
    15 
     15 
    1616  function DoStart()
    1717  {
  • trunk/Modules/Network/Network.php

    r815 r817  
    171171        'API' => array('Type' => 'TDeviceAPIType', 'Caption' => 'API', 'Default' => '', 'Null' => true),
    172172      ),
     173      'AfterInsert' => array($this, 'AfterInsertNetworkDevice'),
     174      'AfterModify' => array($this, 'AfterModifyNetworkDevice'),
     175      'AfterDelete' => array($this, 'AfterModifyNetworkDevice'),
    173176    ));
    174177    $this->System->FormManager->RegisterClass('NetworkDeviceType', array(
     
    201204        'Ports' => array('Type' => 'TDevicePortListInterface', 'Caption' => 'Síťové porty', 'Default' => ''),
    202205      ),
     206      'AfterInsert' => array($this, 'AfterInsertNetworkInterface'),
     207      'AfterModify' => array($this, 'AfterModifyNetworkInterface'),
     208      'AfterDelete' => array($this, 'AfterModifyNetworkInterface'),
    203209    ));
    204210    $this->System->FormManager->RegisterClass('NetworkInterfaceType', array(
     
    594600    $this->System->ModuleManager->Modules['IS']->RegisterDashboardItem('Network',
    595601      array('ModuleNetwork', 'ShowDashboardItem'));
    596   }
    597 
     602
     603    $this->System->RegisterModel('NetworkDevice', array(
     604      'Title' => 'Síťové zařízení',
     605    ));
     606    $this->System->RegisterModel('NetworkInterface', array(
     607      'Title' => 'Síťové rozhraní',
     608    ));
     609  }
     610 
     611  function AfterInsertNetworkDevice($Form)
     612  {
     613    $this->System->Models['NetworkDevice']->DoOnChange();
     614  }
     615
     616  function AfterModifyNetworkDevice($Form, $Id)
     617  {
     618    $this->System->Models['NetworkDevice']->DoOnChange();
     619  }
     620 
     621  function AfterInsertNetworkInterface($Form)
     622  {
     623    $this->System->Models['NetworkInterface']->DoOnChange();
     624  }
     625
     626  function AfterModifyNetworkInterface($Form, $Id)
     627  {
     628    $this->System->Models['NetworkInterface']->DoOnChange();
     629  }
     630 
    598631  function ShowDashboardItem()
    599632  {
  • trunk/Modules/NetworkConfig/Generate.php

    r790 r817  
    1313  if($Service['UNIX_TIMESTAMP(LastTime)'] < (time() - $Service['Period']))
    1414  {
    15     $System->Database->update('NetworkConfiguration', 'Id='.$Service['Id'], array('Changed' => 2));
     15    $System->Database->update('NetworkConfiguration', '`Id`='.$Service['Id'], array('Changed' => 2));
    1616    $ExecutionStart = time();
    1717    //echo($Service['Caption'].'...');
     
    2727    //echo("Done\n");
    2828    $ExecutionTime = time() - $ExecutionStart;
    29     $System->Database->update('NetworkConfiguration', 'Id='.$Service['Id'], array('Changed' => 0, 'LastTime' => 'NOW()', 'ExecutionTime' => $ExecutionTime));
    30     $System->Database->update('NetworkConfiguration', 'Id='.$Service['Id'], array('Log' => implode("\n", $Output)));
     29    $System->Database->update('NetworkConfiguration', '`Id`='.$Service['Id'], array('Changed' => 0, 'LastTime' => 'NOW()', 'ExecutionTime' => $ExecutionTime));
     30    $System->Database->update('NetworkConfiguration', '`Id`='.$Service['Id'], array('Log' => implode("\n", $Output)));
    3131  }
    3232}
  • trunk/Modules/NetworkConfig/NetworkConfig.php

    r781 r817  
    5151      ),
    5252    ));
     53    $this->System->FormManager->RegisterFormType('TNetworkConfigurationState', array(
     54      'Type' => 'Enumeration',
     55      'States' => array('Neplánováno', 'V plánu', 'Provádí se'),
     56    ));
     57   
    5358    $this->System->RegisterCommandLine('config', array($this, 'Config'));
     59    $this->System->Models['NetworkDevice']->RegisterOnChange('NetworkConfig', array($this, 'DoNetworkChange'));
     60    $this->System->Models['NetworkInterface']->RegisterOnChange('NetworkConfig', array($this, 'DoNetworkChange'));
     61  }
     62 
     63  function DoNetworkChange()
     64  {
     65    $this->Database->query('UPDATE `NetworkConfiguration` SET `Changed`=1 WHERE '.
     66      '(`Id`=1) OR (`Id`=7) OR (`Id`=8) OR (`Id`=9) OR (`Id`=10) OR (`Id`=11) OR (`Id`=12) OR (`Id`=13)');
    5467  }
    5568
  • trunk/Modules/NetworkConfigRouterOS/Generators/DHCP.php

    r781 r817  
    2020      $Items = array();
    2121      $Server = 'dhcp'.$Subnet['Id'];
    22       $DbResult2 = $this->Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM `NetworkInterface` '.
    23           ' LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE '.
    24           ' CompareNetworkPrefix(INET_ATON(LocalIP), INET_ATON("'.$Subnet['AddressRange'].'"), '.$Subnet['Mask'].') AND (`MAC` != "00:00:00:00:00:00") ORDER BY `LocalIP`');
     22      $DbResult2 = $this->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface` '.
     23        'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '.
     24        'WHERE CompareNetworkPrefix(INET_ATON(`LocalIP`), INET_ATON("'.$Subnet['AddressRange'].'"), '.$Subnet['Mask'].') '.
     25        'AND (`MAC` != "00:00:00:00:00:00") ORDER BY `LocalIP`');
    2526      while($Interface = $DbResult2->fetch_assoc())
    2627      {
  • trunk/Packages/Common/AppModule.php

    r791 r817  
    6969    $this->License = '';
    7070    $this->Version = '';
    71     $this->Creator = '';
    7271    $this->Description = '';
    7372    $this->Dependencies = array();
    7473    $this->Type = ModuleType::Normal;
    7574  }
    76 
     75 
    7776  function Install()
    7877  {
  • trunk/Packages/Common/Application.php

    r790 r817  
    11<?php
     2
     3class ModelDef
     4{
     5  var $OnChange;
     6 
     7  function __construct()
     8  {
     9    $this->OnChange = array();
     10  }
     11 
     12  function DoOnChange()
     13  {
     14    foreach($this->OnChange as $Callback)
     15    {
     16      call_user_func($Callback);
     17    }
     18  }
     19 
     20  function RegisterOnChange($SysName, $Callback)
     21  {
     22    $this->OnChange[$SysName] = $Callback;
     23  }
     24 
     25  function UnregisterOnChange($SysName)
     26  {
     27    unset($this->OnChange[$SysName]);
     28  }
     29}
    230
    331class Application extends System
     
    735  var $ModuleManager;
    836  var $Modules;
    9 
     37  var $Models;
     38 
    1039  function __construct()
    1140  {
     
    1443    $this->ModuleManager = new AppModuleManager($this);
    1544    $this->Modules = array();
     45    $this->Models = array();
     46  }
     47 
     48  function RegisterModel($SysName, $Model)
     49  {
     50    $NewModelDef = new ModelDef();
     51    $NewModelDef->Title = $Model['Title'];
     52    $this->Models[$SysName] = $NewModelDef;
    1653  }
    1754
     55  function UnregisterModel($SysName)
     56  {
     57    unset($this->Models[$SysName]);
     58  }
     59 
    1860  function Run()
    1961  {
Note: See TracChangeset for help on using the changeset viewer.