diff --git a/trunk/application/displayblock.class.inc.php b/trunk/application/displayblock.class.inc.php
index f41ab6a28..b12486d5e 100644
--- a/trunk/application/displayblock.class.inc.php
+++ b/trunk/application/displayblock.class.inc.php
@@ -553,7 +553,13 @@ class HistoryBlock extends DisplayBlock
switch($this->m_sStyle)
{
case 'toggle':
- $oLatestChangeOp = $oSet->Fetch();
+ // First the latest change that the user is allowed to see
+ do
+ {
+ $oLatestChangeOp = $oSet->Fetch();
+ }
+ while(is_object($oLatestChangeOp) && ($oLatestChangeOp->GetDescription() == ''));
+
if (is_object($oLatestChangeOp))
{
global $oContext; // User Context.. should be statis instead of global...
@@ -561,9 +567,36 @@ class HistoryBlock extends DisplayBlock
$sDate = $oLatestChangeOp->GetAsHTML('date');
$oChange = $oContext->GetObject('CMDBChange', $oLatestChangeOp->Get('change'));
$sUserInfo = $oChange->GetAsHTML('userinfo');
- $oSet->Load(); // Reset the pointer to the beginning of the set: there should be a better way to do this...
+ $oSet->Rewind(); // Reset the pointer to the beginning of the set
$sHtml .= $oPage->GetStartCollapsibleSection("Last modified on $sDate by $sUserInfo.");
- $sHtml .= cmdbAbstractObject::GetDisplaySet($oPage, $oSet);
+ //$sHtml .= cmdbAbstractObject::GetDisplaySet($oPage, $oSet);
+ $aChanges = array();
+ while($oChangeOp = $oSet->Fetch())
+ {
+ $sChangeDescription = $oChangeOp->GetDescription();
+ if ($sChangeDescription != '')
+ {
+ // The change is visible for the current user
+ $changeId = $oChangeOp->Get('change');
+ $aChanges[$changeId]['date'] = $oChangeOp->Get('date');
+ $aChanges[$changeId]['userinfo'] = $oChangeOp->Get('userinfo');
+ if (!isset($aChanges[$changeId]['log']))
+ {
+ $aChanges[$changeId]['log'] = array();
+ }
+ $aChanges[$changeId]['log'][] = $sChangeDescription;
+ }
+ }
+ $aAttribs = array('date' => array('label' => 'Date', 'description' => 'Date of the change'),
+ 'userinfo' => array('label' => 'User', 'description' => 'User who made the change'),
+ 'log' => array('label' => 'Changes', 'description' => 'Changes made to the object'),
+ );
+ $aValues = array();
+ foreach($aChanges as $aChange)
+ {
+ $aValues[] = array('date' => $aChange['date'], 'userinfo' => $aChange['userinfo'], 'log' => "
- ".implode('
- ', $aChange['log'])."
");
+ }
+ $sHtml .= $oPage->GetTable($aAttribs, $aValues);
$sHtml .= $oPage->GetEndCollapsibleSection();
}
break;
@@ -605,10 +638,10 @@ class MenuBlock extends DisplayBlock
// Just one object in the set, possible actions are "new / clone / modify and delete"
if (isset($aExtraParams['linkage']))
{
- if ($bIsModifyAllowed) { $aActions[] = array ('label' => 'New...', 'url' => "#"); }
- if ($bIsBulkModifyAllowed) { $aActions[] = array ('label' => 'Modify All...', 'url' => "#"); }
- if ($bIsBulkDeleteAllowed) { $aActions[] = array ('label' => 'Remove All', 'url' => "#"); }
- if ($bIsModifyAllowed | $bIsDeleteAllowed) { $aActions[] = array ('label' => 'Manage Links...', 'url' => "#"); }
+ if ($bIsModifyAllowed) { $aActions[] = array ('label' => 'Add #...', 'url' => "../pages/$sUIPage?operation=new&class=$sClass&$sContext"); }
+ if ($bIsModifyAllowed) { $aActions[] = array ('label' => 'Clone #...', 'url' => "../pages/$sUIPage?operation=clone&class=$sClass&id=$id&$sContext"); }
+ if ($bIsModifyAllowed) { $aActions[] = array ('label' => 'Modify #...', 'url' => "../pages/$sUIPage?operation=modify&class=$sClass&id=$id&$sContext"); }
+ if ($bIsDeleteAllowed) { $aActions[] = array ('label' => 'Remove #', 'url' => "../pages/$sUIPage?operation=delete&class=$sClass&id=$id&$sContext"); }
}
else
{
@@ -652,10 +685,11 @@ class MenuBlock extends DisplayBlock
if (isset($aExtraParams['linkage']))
{
$bIsDeleteAllowed = UserRights::IsActionAllowed($sClass, UR_ACTION_DELETE, $oSet);
- if ($bIsModifyAllowed) { $aActions[] = array ('label' => 'New...', 'url' => "#"); }
- if ($bIsBulkModifyAllowed) { $aActions[] = array ('label' => 'Modify All...', 'url' => "#"); }
- if ($bIsBulkDeleteAllowed) { $aActions[] = array ('label' => 'Remove All', 'url' => "#"); }
- if ($bIsModifyAllowed | $bIsDeleteAllowed) { $aActions[] = array ('label' => 'Manage Links...', 'url' => "#"); }
+ if ($bIsModifyAllowed) { $aActions[] = array ('label' => 'Add #...', 'url' => "../pages/$sUIPage?operation=new&class=$sClass&$sContext"); }
+ if ($bIsDeleteAllowed) { $aActions[] = array ('label' => 'Remove #', 'url' => "../pages/$sUIPage?operation=delete&class=$sClass&id=$id&$sContext"); }
+ if ($bIsModifyAllowed) { $aActions[] = array ('label' => 'Modify #...', 'url' => "../pages/$sUIPage?operation=modify&class=$sClass&id=$id&$sContext"); }
+ if ($bIsBulkModifyAllowed) { $aActions[] = array ('label' => 'Modify All #...', 'url' => "../pages/$sUIPage?operation=new&class=$sClass&$sContext"); }
+ if ($bIsBulkDeleteAllowed) { $aActions[] = array ('label' => 'Remove All #...', 'url' => "#"); }
}
else
{
diff --git a/trunk/application/template.class.inc.php b/trunk/application/template.class.inc.php
index b6bdd8a61..db768c3af 100644
--- a/trunk/application/template.class.inc.php
+++ b/trunk/application/template.class.inc.php
@@ -195,7 +195,7 @@ class DisplayTemplate
$sTemplate = '
bizNetworkDevice: pkey = $pkey$
diff --git a/trunk/application/templates/audit_category.html b/trunk/application/templates/audit_category.html
index 7a25e8791..a5e1c89c5 100644
--- a/trunk/application/templates/audit_category.html
+++ b/trunk/application/templates/audit_category.html
@@ -1,7 +1,7 @@
$class$: pkey = $pkey$
diff --git a/trunk/business/itop.business.class.inc.php b/trunk/business/itop.business.class.inc.php
index dcad88f70..764149007 100644
--- a/trunk/business/itop.business.class.inc.php
+++ b/trunk/business/itop.business.class.inc.php
@@ -260,7 +260,7 @@ class bizPerson extends bizContact
MetaModel::Init_AddAttribute(new AttributeString("first_name", array("label"=>"first Name", "description"=>"First name", "allowed_values"=>null, "sql"=>"first_name", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("employe_number", array("label"=>"Employe Number", "description"=>"employe number", "allowed_values"=>null, "sql"=>"employe_number", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
- MetaModel::Init_AddAttribute(new AttributeExternalKey("login_id", array("targetclass"=>"URP_Users", "label"=>"Login", "description"=>"Login information", "allowed_values"=>null, "sql"=>"login_id", "is_null_allowed"=>true, "depends_on"=>array())));
+// MetaModel::Init_AddAttribute(new AttributeExternalKey("login_id", array("targetclass"=>"URP_Users", "label"=>"Login", "description"=>"Login information", "allowed_values"=>null, "sql"=>"login_id", "is_null_allowed"=>true, "depends_on"=>array())));
MetaModel::Init_InheritFilters();
MetaModel::Init_AddFilterFromAttribute("first_name");
@@ -1425,6 +1425,7 @@ class bizApplication extends logInfra
MetaModel::Init_AddFilterFromAttribute("function");
MetaModel::Init_AddFilterFromAttribute("version");
MetaModel::Init_AddFilterFromAttribute("device_id");
+ MetaModel::Init_AddFilterFromAttribute("device_name");
diff --git a/trunk/business/templates/Circuits.html b/trunk/business/templates/Circuits.html
index f04fe3a87..3af174814 100644
--- a/trunk/business/templates/Circuits.html
+++ b/trunk/business/templates/Circuits.html
@@ -1,7 +1,7 @@
$class$: pkey = $pkey$
diff --git a/trunk/business/templates/application.html b/trunk/business/templates/application.html
index f934b7b48..a17bdd05b 100644
--- a/trunk/business/templates/application.html
+++ b/trunk/business/templates/application.html
@@ -1,7 +1,7 @@
bizApplication: pkey = $pkey$
diff --git a/trunk/business/templates/change.html b/trunk/business/templates/change.html
index f2bcd67d7..700a83983 100644
--- a/trunk/business/templates/change.html
+++ b/trunk/business/templates/change.html
@@ -1,7 +1,7 @@
$class$: pkey = $pkey$
diff --git a/trunk/business/templates/contract.html b/trunk/business/templates/contract.html
index 110fcdb0e..e6c5fdcc8 100644
--- a/trunk/business/templates/contract.html
+++ b/trunk/business/templates/contract.html
@@ -1,7 +1,7 @@
bizContract: pkey = $pkey$
diff --git a/trunk/business/templates/default.html b/trunk/business/templates/default.html
index 564b009b5..2464cd216 100644
--- a/trunk/business/templates/default.html
+++ b/trunk/business/templates/default.html
@@ -1,7 +1,7 @@
$class$: pkey = $pkey$
diff --git a/trunk/business/templates/document.html b/trunk/business/templates/document.html
index cd40cfe78..b957b2457 100644
--- a/trunk/business/templates/document.html
+++ b/trunk/business/templates/document.html
@@ -1,7 +1,7 @@
$class$: pkey = $pkey$
diff --git a/trunk/business/templates/group.html b/trunk/business/templates/group.html
index fca5fb154..e8741bf00 100644
--- a/trunk/business/templates/group.html
+++ b/trunk/business/templates/group.html
@@ -1,7 +1,7 @@
bizInfraGroup: pkey = $pkey$
diff --git a/trunk/business/templates/interface.html b/trunk/business/templates/interface.html
index ffa8c7495..81bb5fbba 100644
--- a/trunk/business/templates/interface.html
+++ b/trunk/business/templates/interface.html
@@ -1,7 +1,7 @@
bizInterface: pkey = $pkey$
diff --git a/trunk/business/templates/knownError.html b/trunk/business/templates/knownError.html
index 75bcc9eaf..87d4184f1 100644
--- a/trunk/business/templates/knownError.html
+++ b/trunk/business/templates/knownError.html
@@ -1,7 +1,7 @@
bizKnownError: pkey = $pkey$
diff --git a/trunk/business/templates/location.html b/trunk/business/templates/location.html
index 748ccd739..82f8c4377 100644
--- a/trunk/business/templates/location.html
+++ b/trunk/business/templates/location.html
@@ -1,7 +1,7 @@
bizLocation: pkey = $pkey$
diff --git a/trunk/business/templates/network.device.html b/trunk/business/templates/network.device.html
index 01085e2ec..cbad128d7 100644
--- a/trunk/business/templates/network.device.html
+++ b/trunk/business/templates/network.device.html
@@ -1,13 +1,13 @@
bizNetworkDevice: pkey = $pkey$
- bizInterface: device_id = $pkey$
+ SELECT bizInterface WHERE device_id = $pkey$
lnkContactRealObject: object_id = $pkey$
@@ -21,5 +21,8 @@
lnkDocumentRealObject: object_id = $pkey$
+
+
+
diff --git a/trunk/business/templates/pc.html b/trunk/business/templates/pc.html
index 9323a913d..41dc445c3 100644
--- a/trunk/business/templates/pc.html
+++ b/trunk/business/templates/pc.html
@@ -1,7 +1,7 @@
bizPC: pkey = $pkey$
@@ -16,7 +16,7 @@
lnkContactRealObject: object_id = $pkey$
- bizInterface: device_id = $pkey$
+ SELECT bizInterface WHERE device_id = $pkey$
bizIncidentTicket: PKEY IS ticket_id IN (lnkInfraTicket: infra_id = $pkey$)
diff --git a/trunk/business/templates/person.html b/trunk/business/templates/person.html
index 567f7b543..6bc94916d 100644
--- a/trunk/business/templates/person.html
+++ b/trunk/business/templates/person.html
@@ -1,7 +1,7 @@
bizPerson: pkey = $pkey$
diff --git a/trunk/business/templates/server.html b/trunk/business/templates/server.html
index 98185836b..8f72fd878 100644
--- a/trunk/business/templates/server.html
+++ b/trunk/business/templates/server.html
@@ -1,7 +1,7 @@
bizServer: pkey = $pkey$
@@ -13,7 +13,7 @@
bizPatch: device_id = $pkey$
- bizInterface: device_id = $pkey$
+ SELECT bizInterface WHERE device_id = $pkey$
lnkContactRealObject: object_id = $pkey$
diff --git a/trunk/business/templates/service.html b/trunk/business/templates/service.html
index 7e6443eba..a99953b4a 100644
--- a/trunk/business/templates/service.html
+++ b/trunk/business/templates/service.html
@@ -1,7 +1,7 @@
$class$: pkey = $pkey$
diff --git a/trunk/business/templates/software.html b/trunk/business/templates/software.html
index 3f690daad..fb50db6a6 100644
--- a/trunk/business/templates/software.html
+++ b/trunk/business/templates/software.html
@@ -1,7 +1,7 @@
bizSoftware: pkey = $pkey$
diff --git a/trunk/business/templates/team.html b/trunk/business/templates/team.html
index 7e1e5cd6e..12537bdd5 100644
--- a/trunk/business/templates/team.html
+++ b/trunk/business/templates/team.html
@@ -1,7 +1,7 @@
$class$: pkey = $pkey$
diff --git a/trunk/business/templates/ticket.html b/trunk/business/templates/ticket.html
index 425c92840..efce97e2d 100644
--- a/trunk/business/templates/ticket.html
+++ b/trunk/business/templates/ticket.html
@@ -1,7 +1,7 @@
$class$: pkey = $pkey$
diff --git a/trunk/core/cmdbchangeop.class.inc.php b/trunk/core/cmdbchangeop.class.inc.php
index 0ed8776de..05da24db5 100644
--- a/trunk/core/cmdbchangeop.class.inc.php
+++ b/trunk/core/cmdbchangeop.class.inc.php
@@ -42,6 +42,16 @@ class CMDBChangeOp extends DBObject
MetaModel::Init_AddFilterFromAttribute("objkey");
MetaModel::Init_AddFilterFromAttribute("date");
MetaModel::Init_AddFilterFromAttribute("userinfo");
+
+ MetaModel::Init_SetZListItems('details', array('change', 'date', 'userinfo')); // Attributes to be displayed for the complete details
+ MetaModel::Init_SetZListItems('list', array('change', 'date', 'userinfo')); // Attributes to be displayed for the complete details
+ }
+ /**
+ * Describe (as a text string) the modifications corresponding to this change
+ */
+ public function GetDescription()
+ {
+ return '';
}
}
@@ -80,6 +90,14 @@ class CMDBChangeOpCreate extends CMDBChangeOp
MetaModel::Init_InheritFilters();
}
+
+ /**
+ * Describe (as a text string) the modifications corresponding to this change
+ */
+ public function GetDescription()
+ {
+ return 'Object created';
+ }
}
@@ -116,6 +134,13 @@ class CMDBChangeOpDelete extends CMDBChangeOp
MetaModel::Init_InheritFilters();
}
+ /**
+ * Describe (as a text string) the modifications corresponding to this change
+ */
+ public function GetDescription()
+ {
+ return 'Object deleted';
+ }
}
@@ -162,6 +187,24 @@ class CMDBChangeOpSetAttribute extends CMDBChangeOp
MetaModel::Init_SetZListItems('details', array('date', 'userinfo', 'attcode', 'oldvalue', 'newvalue')); // Attributes to be displayed for the complete details
MetaModel::Init_SetZListItems('list', array('date', 'userinfo', 'attcode', 'oldvalue', 'newvalue')); // Attributes to be displayed for a list
}
+
+ /**
+ * Describe (as a text string) the modifications corresponding to this change
+ */
+ public function GetDescription()
+ {
+ $sResult = '';
+ $oEmptySet = new DBObjectSet($this->Get('objclass'));
+ if (UserRights::IsActionAllowedOnAttribute($this->Get('objclass'), $this->Get('attcode'), UR_ACTION_READ, $oEmptySet) == UR_ALLOWED_YES)
+ {
+ $oAttDef = MetaModel::GetAttributeDef($this->Get('objclass'), $this->Get('attcode'));
+ $sAttName = $oAttDef->GetLabel();
+ $sNewValue = $this->Get('newvalue');
+ $sOldValue = $this->Get('oldvalue');
+ $sResult = "$sAttName set to $sNewValue (previous value: $sOldValue)";
+ }
+ return $sResult;
+ }
}
?>