Changeset 6743
- Timestamp:
- 10/06/08 17:45:50 (2 months ago)
- Location:
- trunk/centreon/www
- Files:
-
- 1 removed
- 5 modified
-
class/centreonLogAction.class.php (modified) (2 diffs)
-
include/configuration/configObject/host/DB-Func.php (modified) (4 diffs)
-
include/configuration/configObject/service/DB-Func.php (modified) (4 diffs)
-
include/options/configurationChangelog/DB-Func.php (deleted)
-
include/options/configurationChangelog/viewLogs.ihtml (modified) (2 diffs)
-
include/options/configurationChangelog/viewLogs.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/centreon/www/class/centreonLogAction.class.php
r6665 r6743 18 18 class CentreonLogAction { 19 19 var $logUser; 20 20 21 21 /* 22 22 * Initializes variables … … 60 60 61 61 /* 62 * Returns logs 63 */ 64 function displayLog() { 65 66 } 62 * returns the contact name 63 */ 64 function getContactname($id) { 65 global $pearDB; 66 67 $DBRESULT =& $pearDB->query("SELECT contact_name FROM `contact` WHERE contact_id = '$id' LIMIT 1"); 68 if (PEAR::isError($DBRESULT)) { 69 print "DB Error : ".$DBRESULT->postDebugInfo()."<br />"; 70 } 71 72 while ($data =& $DBRESULT->fetchRow()) { 73 $name = $data["contact_name"]; 74 } 75 76 return $name; 77 } 78 79 /* 80 * returns the list of actions ("create","delete","change","massive change", "enable", "disable") 81 */ 82 function listAction($id) { 83 global $pearDBO; 84 $list_actions = array(); 85 $i = 0; 86 87 $DBRESULT =& $pearDBO->query("SELECT * FROM log_action WHERE object_id ='".$id."' ORDER BY action_log_date DESC"); 88 if (PEAR::isError($DBRESULT)) { 89 print "DB Error : ".$DBRESULT->postDebugInfo()."<br />"; 90 } 91 92 while ($data =& $DBRESULT->fetchRow()) { 93 $list_actions[$i]["action_log_id"] = $data["action_log_id"]; 94 $list_actions[$i]["action_log_date"] = date("d/m/Y H:i",$data["action_log_date"]); 95 $list_actions[$i]["object_type"] = $data["object_type"]; 96 $list_actions[$i]["object_id"] = $data["object_id"]; 97 $list_actions[$i]["object_name"] = $data["object_name"]; 98 $list_actions[$i]["action_type"] = $this->replaceActiontype($data["action_type"]); 99 $list_actions[$i]["log_contact_id"] = $this->getContactname($data["log_contact_id"]); 100 $i++; 101 } 102 103 return $list_actions; 104 } 105 106 /* 107 * returns list of modifications 108 */ 109 function listModification($id) { 110 global $pearDBO; 111 $list_modifications = array(); 112 $ref = array(); 113 $i = 0; 114 $j = 0; 115 $first_ref_flag = 0; 116 117 $DBRESULT =& $pearDBO->query("SELECT action_log_id, action_log_date, action_type FROM log_action WHERE object_id ='".$id."' ORDER BY action_log_date ASC"); 118 if (PEAR::isError($DBRESULT)) { 119 print "DB Error : ".$DBRESULT->postDebugInfo()."<br />"; 120 } 121 while ($row =& $DBRESULT->fetchRow()) { 122 $DBRESULT2 =& $pearDBO->query("SELECT action_log_id,field_name,field_value FROM `log_action_modification` WHERE action_log_id='".$row['action_log_id']."'"); 123 if (PEAR::isError($DBRESULT2)) { 124 print "DB Error : ".$DBRESULT2->postDebugInfo()."<br />"; 125 } 126 while ($field =& $DBRESULT2->fetchRow()) { 127 if (($row["action_type"] == "mc" || $row["action_type"] == "a" || $row["action_type"] == "c") && (!$first_ref_flag || $first_ref_flag == $field["action_log_id"])) { 128 $ref[$field["field_name"]] = $field["field_value"]; 129 $first_ref_flag = $field["action_log_id"]; 130 131 $list_modifications[$i]["action_log_id"] = $field["action_log_id"]; 132 $list_modifications[$i]["field_name"] = $field["field_name"]; 133 $list_modifications[$i]["field_value_before"] = $field["field_value"]; 134 $list_modifications[$i]["field_value_after"] = $field["field_value"]; 135 $j++; 136 } 137 else { 138 foreach ($ref as $key => $value) { 139 if (!isset($ref[$field["field_name"]])) { 140 $list_modifications[$i]["field_value_before"] = ""; 141 $list_modifications[$i]["action_log_id"] = $field["action_log_id"]; 142 $list_modifications[$i]["field_name"] = $field["field_name"]; 143 $list_modifications[$i]["field_value_after"] = $field["field_value"]; 144 $ref[$field["field_name"]] = $field["field_value"]; 145 } 146 else if (($field["field_name"] == $key) && ($field["field_value"] != $value)) { 147 $list_modifications[$i]["field_value_before"] = $value; 148 $list_modifications[$i]["action_log_id"] = $field["action_log_id"]; 149 $list_modifications[$i]["field_name"] = $field["field_name"]; 150 $list_modifications[$i]["field_value_after"] = $field["field_value"]; 151 $ref[$key] = $field["field_value"]; 152 } 153 } 154 } 155 $i++; 156 } 157 } 158 return $list_modifications; 159 } 160 161 /* 162 * Display clear action labels 163 */ 164 function replaceActiontype($action) { 165 166 $actionList = array(); 167 $actionList["d"] = "Delete"; 168 $actionList["c"] = "Change"; 169 $actionList["a"] = "Create"; 170 $actionList["disable"] = "Disable"; 171 $actionList["enable"] = "Enable"; 172 $actionList["mc"] = "Massive change"; 173 174 foreach($actionList as $key => $value) { 175 if ($action == $key) { 176 $action = $value; 177 } 178 } 179 180 return $action; 181 } 182 183 /* 184 * list object types 185 */ 186 function listObjecttype() { 187 $object_type_tab = array(); 188 189 $object_type_tab[0] = _("Please select an object"); 190 $object_type_tab[1] = "command"; 191 $object_type_tab[2] = "timeperiod"; 192 $object_type_tab[3] = "contact"; 193 $object_type_tab[4] = "contactgroup"; 194 $object_type_tab[5] = "host"; 195 $object_type_tab[6] = "hostgroup"; 196 $object_type_tab[7] = "service"; 197 $object_type_tab[8] = "servicegroup"; 198 $object_type_tab[9] = "snmp traps"; 199 $object_type_tab[10] = "escalation"; 200 $object_type_tab[11] = "host dependency"; 201 $object_type_tab[12] = "hostgroup dependency"; 202 $object_type_tab[13] = "service dependency"; 203 $object_type_tab[14] = "servicegroup dependency"; 204 205 return $object_type_tab; 206 } 67 207 } 68 208 ?> -
trunk/centreon/www/include/configuration/configObject/host/DB-Func.php
r6731 r6743 347 347 if (PEAR::isError($DBRESULT4)) 348 348 print "DB Error : ".$DBRESULT4->getDebugInfo()."<br />"; 349 $fields["_". $macName."_"] = $hst['host_macro_value'];349 $fields["_".strtoupper($macName)."_"] = $hst['host_macro_value']; 350 350 } 351 351 } … … 613 613 if (PEAR::isError($DBRESULT)) 614 614 print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 615 $fields["_". $_POST[$macInput]."_"] = $_POST[$macValue];615 $fields["_".strtoupper($_POST[$macInput])."_"] = $_POST[$macValue]; 616 616 $already_stored[$_POST[$macInput]] = 1; 617 617 } … … 1040 1040 if (PEAR::isError($DBRESULT)) 1041 1041 print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 1042 $fields["_". $_POST[$macInput]."_"] = $_POST[$macValue];1042 $fields["_".strtoupper($_POST[$macInput])."_"] = $_POST[$macValue]; 1043 1043 $already_stored[$_POST[$macInput]] = 1; 1044 1044 } … … 1379 1379 $already_stored[$_POST[$macInput]] = 1; 1380 1380 } 1381 $fields["_". $$_POST[$macInput]."_"] = $_POST[$macValue];1381 $fields["_".strtoupper($_POST[$macInput])."_"] = $_POST[$macValue]; 1382 1382 } 1383 1383 } -
trunk/centreon/www/include/configuration/configObject/service/DB-Func.php
r6731 r6743 364 364 if (PEAR::isError($DBRESULT4)) 365 365 print "DB Error : ".$DBRESULT4->getDebugInfo()."<br />"; 366 $fields["_". $macName."_"] = $sv['svc_macro_value'];366 $fields["_".strtoupper($macName)."_"] = $sv['svc_macro_value']; 367 367 } 368 368 } … … 560 560 if (PEAR::isError($DBRESULT)) 561 561 print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 562 $fields["_". $_POST[$macInput]."_"] = $_POST[$macValue];562 $fields["_".strtoupper($_POST[$macInput])."_"] = $_POST[$macValue]; 563 563 $already_stored[$_POST[$macInput]] = 1; 564 564 } … … 790 790 if (PEAR::isError($DBRESULT)) 791 791 print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 792 $fields["_". $_POST[$macInput]."_"] = $_POST[$macValue];792 $fields["_".strtoupper($_POST[$macInput])."_"] = $_POST[$macValue]; 793 793 $already_stored[$_POST[$macInput]] = 1; 794 794 } … … 1098 1098 $already_stored[$_POST[$macInput]] = 1; 1099 1099 } 1100 $fields["_". $_POST[$macInput]."_"] = $_POST[$macValue];1100 $fields["_".strtoupper($_POST[$macInput])."_"] = $_POST[$macValue]; 1101 1101 } 1102 1102 } -
trunk/centreon/www/include/options/configurationChangelog/viewLogs.ihtml
r6731 r6743 47 47 {/if} 48 48 </td> 49 <td class="ListColCenter" width=" 100">49 <td class="ListColCenter" width="200"> 50 50 {if $modif.action_log_id == $list.action_log_id} 51 51 {$modif.field_value_before} 52 52 {/if} 53 53 </td> 54 <td class="ListColCenter" width=" 100">54 <td class="ListColCenter" width="200"> 55 55 {if $modif.action_log_id == $list.action_log_id} 56 56 {$modif.field_value_after} … … 66 66 </tr> 67 67 {/if} 68 </table> 69 {/if} 68 </table> 69 {/if} 70 70 </td> 71 71 </tr> -
trunk/centreon/www/include/options/configurationChangelog/viewLogs.php
r6733 r6743 31 31 32 32 #PHP functions 33 require_once $path."DB-Func.php";34 33 require_once "./include/common/common-Func.php"; 35 34 require_once("./DBOdsConnect.php"); … … 37 36 if ($cmd2) { 38 37 $listAction = array(); 39 $listAction = listAction($cmd2);38 $listAction = $oreon->CentreonLogAction->listAction($cmd2); 40 39 $listModification = array(); 41 $listModification = listmodification($cmd2);40 $listModification = $oreon->CentreonLogAction->listmodification($cmd2); 42 41 } 43 42 … … 67 66 $tpl->assign("display_flag", $display_flag); 68 67 69 $objects_list = array(); 70 $objects_List = listObjecttype(); 71 72 $object_type_tab[0] = _("Please select an object"); 73 $object_type_tab[1] = "command"; 74 $object_type_tab[2] = "timeperiod"; 75 $object_type_tab[3] = "contact"; 76 $object_type_tab[4] = "contactgroup"; 77 $object_type_tab[5] = "host"; 78 $object_type_tab[6] = "hostgroup"; 79 $object_type_tab[7] = "service"; 80 $object_type_tab[8] = "servicegroup"; 81 $object_type_tab[9] = "snmp traps"; 82 $object_type_tab[10] = "escalation"; 83 $object_type_tab[11] = "host dependency"; 84 $object_type_tab[12] = "hostgroup dependency"; 85 $object_type_tab[13] = "service dependency"; 86 $object_type_tab[14] = "servicegroup dependency"; 87 88 //$objects_list[] = _("Hosts : Disable Check"); 68 $objects_type_tab = array(); 69 $objects_type_tab = $oreon->CentreonLogAction->listObjecttype(); 89 70 90 71 ?> … … 98 79 function setO2(_i) { 99 80 document.forms['form'].elements['cmd2'].value = _i; 100 //document.forms['form'].elements['o2'].selectedIndex = _i;101 81 } 102 82 … … 105 85 106 86 if ($cmd) { 107 $DBRESULT = $pearDBO->query("SELECT DISTINCT object_name, object_id FROM log_action WHERE object_type='".$object _type_tab[$cmd]."' ORDER BY object_id");87 $DBRESULT = $pearDBO->query("SELECT DISTINCT object_name, object_id FROM log_action WHERE object_type='".$objects_type_tab[$cmd]."' ORDER BY object_id"); 108 88 if (PEAR::isError($DBRESULT)) 109 89 print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; … … 122 102 123 103 $attrs = array( 'onchange'=>"javascript: setO1(this.form.elements['o1'].value); submit();"); 124 $form->addElement('select', 'o1', NULL, $object _type_tab, $attrs);104 $form->addElement('select', 'o1', NULL, $objects_type_tab, $attrs); 125 105 $form->setDefaults(array('o1' => NULL)); 126 106 $o1 =& $form->getElement('o1'); 127 107 $o1->setValue(NULL); 128 108 129 $objects = array();130 $objects = listObjectname(NULL);131 109 $attrs = array( 'onchange'=>"javascript: setO2(this.form.elements['o2'].value); submit();"); 132 110 $form->addElement('select', 'o2', NULL, $objNameTab, $attrs);
