Changeset 687
- Timestamp:
- Sep 7, 2014, 12:28:06 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r684 r687 1 1 <?php 2 2 3 $Revision = 68 4; // Subversion revision3 $Revision = 687; // Subversion revision 4 4 $DatabaseRevision = 679; // SQL structure revision 5 $ReleaseTime = strtotime('2014-0 8-13');5 $ReleaseTime = strtotime('2014-09-07'); -
trunk/Common/Form/Form.php
r647 r687 42 42 } 43 43 44 function GetValue($Index, $Event = 'OnView') 45 { 46 $Item = $this->Definition['Items'][$Index]; 47 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 48 { 49 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 50 $this->FormManager->Type->RegisterType($Item['Type'], '', $this->FormManager->FormTypes[$Item['Type']]); 51 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 52 $UseType = 'OneToMany'; 53 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 54 $UseType = 'Enumeration'; 55 } else $UseType = $Item['Type']; 56 return $this->FormManager->Type->ExecuteTypeEvent($UseType, $Event, 57 array('Value' => $this->Values[$Index], 'Name' => $Index, 58 'Type' => $Item['Type'], 'Values' => $this->Values, 59 'Filter' => $this->Values[$Index])); 60 } 61 44 62 function ShowViewForm() 45 63 { … … 53 71 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 54 72 { 55 56 57 58 59 60 61 62 63 73 if(array_key_exists($Item['Type'], $this->FormManager->FormTypes)) 74 { 75 if(!array_key_exists($Item['Type'], $this->FormManager->Type->TypeDefinitionList)) 76 $this->FormManager->Type->RegisterType($Item['Type'], '', $this->FormManager->FormTypes[$Item['Type']]); 77 if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Reference') 78 $UseType = 'OneToMany'; 79 else if($this->FormManager->FormTypes[$Item['Type']]['Type'] == 'Enumeration') 80 $UseType = 'Enumeration'; 81 } else $UseType = $Item['Type']; 64 82 $Edit = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnView', 65 83 array('Value' => $this->Values[$Index], 'Name' => $Index, -
trunk/Modules/IS/IS.php
r684 r687 123 123 } 124 124 125 function LogChange($Form, $Action, $NewId, $OldId) 126 { 127 $Values = $Form->Definition['Table'].' (Id: '.$OldId.' => '.$NewId.'):'."\n"; 128 // Compare old values loaded from database with new values in Form variable 129 $NewValues = $Form->Values; 130 if($OldId != 0) 131 { 132 $FormOld = new Form($this->System->FormManager); 133 $FormOld->SetClass($Form->Definition['Table']); 134 $FormOld->LoadValuesFromDatabase($OldId); 135 $OldValues = $FormOld->Values; 136 // Keep only changes values 137 foreach($NewValues as $Index => $Value) 138 { 139 if($OldValues[$Index] != $NewValues[$Index]) 140 { 141 $Values .= $Index.': '.$FormOld->GetValue($Index); 142 if($NewId != 0) $Values .= ' => '.$Form->GetValue($Index); 143 $Values .= "\n"; 144 } 145 } 146 } else { 147 foreach($NewValues as $Index => $Value) 148 { 149 $Values .= $Index.': '.$Form->GetValue($Index)."\n"; 150 } 151 } 152 $this->System->ModuleManager->Modules['Log']->NewRecord('IS', $Action, $Values); 153 } 154 125 155 function ShowEdit($Table, $Id) 126 156 { … … 139 169 try { 140 170 $Form->Validate(); 171 $this->LogChange($Form, 'Edit', $Id, $Id); 141 172 $Form->SaveValuesToDatabase($Id); 142 $Values = $Table.': '.str_replace('=>', '=', str_replace('array', '', var_export($Form->Values, true)));143 $this->System->ModuleManager->Modules['Log']->NewRecord('IS', 'Edit', $Values);144 173 $Output .= $this->SystemMessage('Úprava položky', 'Položka upravena'); 145 174 $Output .= $this->ShowView($Table, $Id); … … 190 219 $DbRow = $DbResult->fetch_assoc(); 191 220 try { 221 $Form = new Form($this->System->FormManager); 222 $Form->SetClass($Table); 223 $this->LogChange($Form, 'Delete', 0, $Id); 192 224 $this->Database->delete($Table, '`Id`='.$Id); 193 $Values = $Table.': '.str_replace('=>', '=', str_replace('array', '', var_export($DbRow, true)));194 $this->System->ModuleManager->Modules['Log']->NewRecord('IS', 'Delete', $Values);195 225 $Output .= $this->SystemMessage('Smazání položky', 'Položka odstraněna'); 196 226 } catch (Exception $E) … … 227 257 $Form->SaveValuesToDatabase(0); 228 258 $Id = $this->Database->insert_id; 229 $Values = $Table.': '.str_replace('=>', '=', str_replace('array', '', var_export($Form->Values, true))); 230 $this->System->ModuleManager->Modules['Log']->NewRecord('IS', 'Add', $Values); 259 $this->LogChange($Form, 'Add', $Id, 0); 231 260 $Output .= $this->SystemMessage('Přidání položky', 'Nová položka vytvořena'); 232 261 $Output .= $this->ShowView($Table, $Id, $_GET['a'] == 'addsub'); -
trunk/Modules/Network/Availability.php
r548 r687 8 8 var $PeriodCount = 24; 9 9 var $Period = array( 10 array('Column' => 'Hour', 'Title' => 'Hodina', 'Period' => 1, 'MinPercent' => 100), 11 array('Column' => 'Day', 'Title' => 'Den', 'Period' => 24, 'MinPercent' => 98), 12 array('Column' => 'Week', 'Title' => 'Týden', 'Period' => 168, 'MinPercent' => 96), // 24 * 7 10 array('Column' => 'Hour', 'Title' => 'Hodina', 'Period' => 1, 'MinPercent' => 100), 11 array('Column' => 'Day', 'Title' => 'Den', 'Period' => 24, 'MinPercent' => 98), 12 array('Column' => 'Week', 'Title' => 'Týden', 'Period' => 168, 'MinPercent' => 96), // 24 * 7 13 13 array('Column' => 'Month', 'Title' => 'Měsíc', 'Period' => 720, 'MinPercent' => 93), // 24 * 30 14 14 array('Column' => 'Year', 'Title' => 'Rok', 'Period' => 8760, 'MinPercent' => 92), // 365 * 24 … … 19 19 { 20 20 $Output = '<div style="font-size: small;">Dostupnost zařízení se kontroluje jednou za minutu. '. 21 'Hodnoty u delších intervalů nemusí odpovídat skutečnosti, protože záznam byl spuštěn až v průběhu těchto intervalu.'. 21 'Hodnoty u delších intervalů nemusí odpovídat skutečnosti, protože záznam byl spuštěn až v průběhu těchto intervalu.'. 22 22 'Všechny prvky sítě jsou kontrolovány ze směrovačů, tj. pokud vypadne některé blízké zařízení, všechny další zařízení propojené přes něj jsou také nedostupné.</div>'; 23 23 $Output .= '<div align="center">'; … … 36 36 while($DbRow = $DbResult->fetch_assoc()) 37 37 $HostTypeList[$DbRow['Id']] = $DbRow; 38 39 38 40 39 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `NetworkInterface` '. 41 40 'JOIN `NetworkDevice` ON `NetworkInterface`.`Device` = `NetworkDevice`.`Id` WHERE `NetworkDevice`.`Used` = 1 AND `NetworkDevice`.`PermanentOnline`=1'); 42 41 $DbRow = $DbResult->fetch_row(); 43 $PageList = GetPageList($DbRow[0]); 42 $PageList = GetPageList($DbRow[0]); 44 43 45 44 $Output .= '<br />'; … … 47 46 $Output .= $PageList['Output']; 48 47 $Output .= '<table class="WideTable" style="font-size: small;">'; 49 48 50 49 $TableColumns = array( 51 array('Name' => 'Name', 'Title' => 'Jméno'), 52 ); 53 54 50 array('Name' => 'Name', 'Title' => 'Jméno'), 51 ); 52 55 53 $Join = ''; 56 54 $Columns = ''; … … 66 64 $Columns .= ', `Period'.$Period['Column'].'`.`Percent` AS `'.$Period['Column'].'`'; 67 65 } 68 } else 66 } else 69 67 { 70 68 if(array_key_exists($_GET['Period'], $this->Period)) … … 85 83 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 86 84 $Output .= $Order['Output']; 87 85 88 86 $DbResult2 = $this->Database->query('SELECT `NetworkInterface`.`Name` AS `InterfaceName`'.$Columns.', '. 89 87 'CONCAT(`NetworkDevice`.`Name`, "-", `NetworkInterface`.`Name`) AS `Name`, `NetworkDevice`.`Name` AS `DeviceName` FROM `NetworkInterface` '. … … 103 101 $Output .= '<td style="text-align: right;'.$Color.'">'.sprintf('%01.2f', $Interface[$Period['Column']]).'</td>'; 104 102 } 105 } else 103 } else 106 104 { 107 105 if(array_key_exists($_GET['Period'], $this->Period))
Note:
See TracChangeset
for help on using the changeset viewer.