Changeset 817 for trunk/Modules


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

Legend:

Unmodified
Added
Removed
  • 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      {
Note: See TracChangeset for help on using the changeset viewer.