diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 6ce6e85b5..0076f1a28 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -133,7 +133,7 @@ abstract class AttributeDefinition // Note: I could factorize this code with the parameter management made for the AttributeDef class // to be overloaded - static protected function ListExpectedParams() + static public function ListExpectedParams() { return array(); } @@ -447,7 +447,7 @@ abstract class AttributeDefinition */ class AttributeLinkedSet extends AttributeDefinition { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return array_merge(parent::ListExpectedParams(), array("allowed_values", "depends_on", "linked_class", "ext_key_to_me", "count_min", "count_max")); } @@ -757,7 +757,7 @@ class AttributeLinkedSet extends AttributeDefinition */ class AttributeLinkedSetIndirect extends AttributeLinkedSet { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return array_merge(parent::ListExpectedParams(), array("ext_key_to_remote")); } @@ -774,7 +774,7 @@ class AttributeLinkedSetIndirect extends AttributeLinkedSet */ class AttributeDBFieldVoid extends AttributeDefinition { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return array_merge(parent::ListExpectedParams(), array("allowed_values", "depends_on", "sql")); } @@ -860,7 +860,7 @@ class AttributeDBFieldVoid extends AttributeDefinition */ class AttributeDBField extends AttributeDBFieldVoid { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return array_merge(parent::ListExpectedParams(), array("default_value", "is_null_allowed")); } @@ -875,7 +875,7 @@ class AttributeDBField extends AttributeDBFieldVoid */ class AttributeInteger extends AttributeDBField { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return parent::ListExpectedParams(); //return array_merge(parent::ListExpectedParams(), array()); @@ -1007,7 +1007,7 @@ class AttributePercentage extends AttributeInteger */ class AttributeDecimal extends AttributeDBField { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return array_merge(parent::ListExpectedParams(), array('digits', 'decimals' /* including precision */)); } @@ -1102,7 +1102,7 @@ class AttributeDecimal extends AttributeDBField */ class AttributeBoolean extends AttributeInteger { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return parent::ListExpectedParams(); //return array_merge(parent::ListExpectedParams(), array()); @@ -1133,7 +1133,7 @@ class AttributeBoolean extends AttributeInteger */ class AttributeString extends AttributeDBField { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return parent::ListExpectedParams(); //return array_merge(parent::ListExpectedParams(), array()); @@ -1259,7 +1259,7 @@ class AttributeString extends AttributeDBField */ class AttributeClass extends AttributeString { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return array_merge(parent::ListExpectedParams(), array("class_category", "more_values")); } @@ -1311,7 +1311,7 @@ class AttributeClass extends AttributeString */ class AttributeApplicationLanguage extends AttributeString { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return parent::ListExpectedParams(); } @@ -1401,7 +1401,7 @@ class AttributeFinalClass extends AttributeString */ class AttributePassword extends AttributeString { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return parent::ListExpectedParams(); //return array_merge(parent::ListExpectedParams(), array()); @@ -1969,7 +1969,7 @@ class AttributeTemplateHTML extends AttributeText */ class AttributeEnum extends AttributeString { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return parent::ListExpectedParams(); //return array_merge(parent::ListExpectedParams(), array()); @@ -2146,7 +2146,7 @@ class AttributeDateTime extends AttributeDBField return "Y-m-d H:i:s"; } - static protected function ListExpectedParams() + static public function ListExpectedParams() { return parent::ListExpectedParams(); //return array_merge(parent::ListExpectedParams(), array()); @@ -2457,7 +2457,7 @@ class AttributeDate extends AttributeDateTime return "Y-m-d"; } - static protected function ListExpectedParams() + static public function ListExpectedParams() { return parent::ListExpectedParams(); //return array_merge(parent::ListExpectedParams(), array()); @@ -2543,7 +2543,7 @@ class AttributeDeadline extends AttributeDateTime */ class AttributeExternalKey extends AttributeDBFieldVoid { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return array_merge(parent::ListExpectedParams(), array("targetclass", "is_null_allowed", "on_target_delete")); } @@ -2660,7 +2660,7 @@ class AttributeHierarchicalKey extends AttributeExternalKey { protected $m_sTargetClass; - static protected function ListExpectedParams() + static public function ListExpectedParams() { $aParams = parent::ListExpectedParams(); $idx = array_search('targetclass', $aParams); @@ -2784,7 +2784,7 @@ class AttributeHierarchicalKey extends AttributeExternalKey */ class AttributeExternalField extends AttributeDefinition { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return array_merge(parent::ListExpectedParams(), array("extkey_attcode", "target_attcode")); } @@ -3011,7 +3011,7 @@ class AttributeExternalField extends AttributeDefinition */ class AttributeURL extends AttributeString { - static protected function ListExpectedParams() + static public function ListExpectedParams() { //return parent::ListExpectedParams(); return array_merge(parent::ListExpectedParams(), array("target")); @@ -3045,7 +3045,7 @@ class AttributeURL extends AttributeString */ class AttributeBlob extends AttributeDefinition { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return array_merge(parent::ListExpectedParams(), array("depends_on")); } @@ -3192,7 +3192,7 @@ class AttributeBlob extends AttributeDefinition */ class AttributeOneWayPassword extends AttributeDefinition { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return array_merge(parent::ListExpectedParams(), array("depends_on")); } @@ -3465,7 +3465,7 @@ class AttributePropertySet extends AttributeTable */ class AttributeComputedFieldVoid extends AttributeDefinition { - static protected function ListExpectedParams() + static public function ListExpectedParams() { return array_merge(parent::ListExpectedParams(), array()); } diff --git a/core/metamodel.class.php b/core/metamodel.class.php index d0224916a..c939a996b 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -1341,7 +1341,7 @@ abstract class MetaModel $sRemoteAttCode = $oAttDef->GetExtAttCode()."_friendlyname"; $sFriendlyNameAttCode = $sAttCode.'_friendlyname'; // propagate "is_null_allowed" ? - $oFriendlyName = new AttributeExternalField($sFriendlyNameAttCode, array("allowed_values"=>null, "extkey_attcode"=>$sKeyAttCode, "target_attcode"=>$sRemoteAttCode, "is_null_allowed"=>true, "depends_on"=>array())); + $oFriendlyName = new AttributeExternalField($sFriendlyNameAttCode, array("allowed_values"=>null, "extkey_attcode"=>$sKeyAttCode, "target_attcode"=>$sRemoteAttCode, "depends_on"=>array())); $oFriendlyName->SetHostClass($sClass); self::$m_aAttribDefs[$sClass][$sFriendlyNameAttCode] = $oFriendlyName; self::$m_aAttribOrigins[$sClass][$sFriendlyNameAttCode] = $sRemoteClass; diff --git a/datamodel/itop-attachments/datamodel.itop-attachments.xml b/datamodel/itop-attachments/datamodel.itop-attachments.xml index 6a7a37da4..3b62a2493 100644 --- a/datamodel/itop-attachments/datamodel.itop-attachments.xml +++ b/datamodel/itop-attachments/datamodel.itop-attachments.xml @@ -1,7 +1,7 @@ - + * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL */]]> - + addon,bizmodel + DBObject + false + autoincrement + attachment + id + + + %1$s %2$s - - + + - + - - - - - - + + expire + + false + + + temp_id + + true + + + item_class + + false + + + item_id + + true + + + item_org_id + 0 + true + + - + + true + public + Overload-ExNihilo + - + + + + false + public + Overload-ExNihilo + GetKey(); @@ -86,11 +125,17 @@ } } } - }]]> - + + + /** * Give a default value for item_org_id (if relevant...) * @return void - */]]> + false + public + Overload-ExNihilo + + }]]> +
diff --git a/datamodel/itop-change-mgmt-1.0.0/datamodel.itop-change-mgmt.xml b/datamodel/itop-change-mgmt-1.0.0/datamodel.itop-change-mgmt.xml index f953d5edd..c8973eb1d 100644 --- a/datamodel/itop-change-mgmt-1.0.0/datamodel.itop-change-mgmt.xml +++ b/datamodel/itop-change-mgmt-1.0.0/datamodel.itop-change-mgmt.xml @@ -1,7 +1,7 @@ - + * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL */]]> - + bizmodel,searchable,changemgmt + Ticket + true + autoincrement + change + id + + + %1$s - + images/change.png - + - + approved assigned @@ -38,478 +46,871 @@ rejected validated + status + new + true - - + + reason + + true + + + org_id]]> - + + requestor_id + Person + true + DEL_MANUAL + - - - - - - - - - - - + + requestor_id + email + + + org_id + Organization + false + DEL_AUTO + + + + org_id + name + + + workgroup_id + Team + true + DEL_MANUAL + + + + workgroup_id + name + + + creation_date + + true + + + last_update + + true + + + end_date + + true + + + close_date + + true + + + impact + + true + + + workgroup_id]]> - + + agent_id + Person + true + DEL_MANUAL + - - - - - + + agent_id + name + + + agent_id + email + + + supervisor_group_id + Team + true + DEL_MANUAL + + + + supervisor_group_id + name + + + supervisor_group_id]]> - + + supervisor_id + Person + true + DEL_MANUAL + - - - - + + supervisor_id + email + + + manager_group_id + Team + true + DEL_MANUAL + + + + manager_group_id + name + + + manager_group_id]]> - + + manager_id + Person + true + DEL_MANUAL + - - + + manager_id + email + + yes no + outage + no + false + + + fallback + + true - - + + status - - - - - - - - - - - + + + + + + + + + + + - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - + false + public + StimulusUserAction + Set('close_date', time()); return true; - }]]> - + + + false + protected + Overload-DBObject + Get('contact_list'); $oToImpact = $this->Get('ci_list'); @@ -540,12 +941,22 @@ $this->Set('creation_date', time()); $this->Set('last_update', time()); - }]]> - + + + false + protected + Overload-DBObject + Set('last_update', time()); - }]]> - + + + false + public + Overload-DBObject + Get('ref'); if (strlen($sCurrRef) == 0) @@ -559,12 +970,18 @@ $sName = sprintf('C-%06d', $iKey); $this->Set('ref', $sName); } - }]]> - + + + /** * Get the icon representing this object * @param boolean $bImgTag If true the result is a full IMG tag (or an emtpy string if no icon is defined) * @return string Either the full IMG tag ($bImgTag == true) or just the path to the icon file - */]]> + false + public + Overload-DBObject + Get('status'); switch($this->GetState()) @@ -588,8 +1005,13 @@ $sIcon = MetaModel::GetClassIcon(get_class($this), $bImgTag); } return $sIcon; - }]]> - + + + true + protected + Overload-DBObject + + }]]> +
@@ -672,466 +1095,767 @@ - + - + bizmodel,searchable,changemgmt + Change + false + autoincrement + change_routine + id + + + %1$s - + images/change.png - + - + + false + - + + status - - - - - - - - - - - + + + + + + + + + + + - + - - - - - + + ev_assign + assigned - + - - - - - + - - - - - + - - - - - + + ev_plan + plannedscheduled - + - - - - - - - - - - - - - - - - - - - - - - + + ev_implement + implemented - + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + + ev_monitor + monitored - + + ev_finish + closed - + + SetClosureDate + - + - - - - - - - - - - - - - - - - - - - - - - + + ev_finish + closed - + + SetClosureDate + - + - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1145,9 +1869,9 @@ ci_list contact_list incident_list - + - + ref title @@ -1158,7 +1882,7 @@ description - + outage fallback @@ -1166,9 +1890,9 @@ - + - + creation_date start_date @@ -1176,7 +1900,7 @@ close_date - + requestor_id workgroup_id @@ -1226,457 +1950,788 @@ - + - + bizmodel,searchable,changemgmt + Change + true + autoincrement + change_approved + id + + + %1$s - + images/change.png - + - - + + approval_date + + true + + + approval_comment + + true + - + + status - - - - - - - - - - - + + + + + + + + + + + - + - - - - - + - - - - - + - - - - - + - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1749,531 +2804,926 @@ - + - + bizmodel,searchable,changemgmt + ApprovedChange + false + autoincrement + change_normal + id + + + %1$s - + images/change.png - + - + + false + - - + + acceptance_date + + true + + + acceptance_comment + + true + - + + status - - - - - - - - - - - + + + + + + + + + + + - + - - - - - + + ev_validate + validated - + + ev_reject + rejected - + - - - - - + + ev_assign + assigned - + - - - - - + + ev_reopen + new - + - - - - - + + ev_plan + plannedscheduled - + - - - - - - - - - - - - - - - - - - - - - - + + ev_approve + approved - + + ev_notapprove + notapproved - + - - - - - - - - - - - - - - - - - - - - - - + + ev_implement + implemented - + - - - - - - - - - - - - - - - - - - - - - - + + ev_replan + plannedscheduled - + - - - - - - - - - - - - - - - - - - - - - - + + ev_monitor + monitored - + + ev_finish + closed - + + SetClosureDate + - + - - - - - - - - - - - - - - - - - - - - - - + + ev_finish + closed - + + SetClosureDate + - + - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2287,9 +3737,9 @@ ci_list contact_list incident_list - + - + ref title @@ -2300,7 +3750,7 @@ description - + acceptance_comment approval_comment @@ -2310,9 +3760,9 @@ - + - + creation_date start_date @@ -2322,7 +3772,7 @@ close_date - + requestor_id workgroup_id @@ -2369,497 +3819,844 @@ - + - + bizmodel,searchable,changemgmt + ApprovedChange + false + autoincrement + change_emergency + id + + + %1$s - + images/change.png - + - + + false + - + + status - - - - - - - - - - - + + + + + + + + + + + - + - - - - - + + ev_assign + assigned - + - - - - - + - - - - - + - - - - - + + ev_plan + plannedscheduled - + - - - - - - - - - - - - - - - - - - - - - - + + ev_approve + approved - + + ev_notapprove + notapproved - + - - - - - - - - - - - - - - - - - - - - - - + + ev_implement + implemented - + - - - - - - - - - - - - - - - - - - - - - - + + ev_replan + plannedscheduled - + - - - - - - - - - - - - - - - - - - - - - - + + ev_monitor + monitored - + + ev_finish + closed - + + SetClosureDate + - + - - - - - - - - - - - - - - - - - - - - - - + + ev_finish + closed - + + SetClosureDate + - + - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2873,9 +4670,9 @@ ci_list contact_list incident_list - + - + ref title @@ -2886,7 +4683,7 @@ description - + approval_comment outage @@ -2895,9 +4692,9 @@ - + - + creation_date start_date @@ -2906,7 +4703,7 @@ close_date - + requestor_id workgroup_id @@ -2960,55 +4757,55 @@ - + 50 - - - + 0 + ChangeManagement + overview.html - - - + 1 + ChangeManagement + Change - - - + 2 + ChangeManagement + Change - - - + 3 + ChangeManagement + - - - - - + 1 + Change:Shortcuts + + + fast - - - - - + 2 + Change:Shortcuts + + + fast - - - - - + 3 + Change:Shortcuts + + + fast - - - - - + 4 + Change:Shortcuts + + + fast diff --git a/datamodel/itop-config-mgmt-1.0.0/datamodel.itop-config-mgmt.xml b/datamodel/itop-config-mgmt-1.0.0/datamodel.itop-config-mgmt.xml index 83d493510..f36b9fc22 100644 --- a/datamodel/itop-config-mgmt-1.0.0/datamodel.itop-config-mgmt.xml +++ b/datamodel/itop-config-mgmt-1.0.0/datamodel.itop-config-mgmt.xml @@ -1,7 +1,7 @@ - + * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL */]]> - + bizmodel,searchable,structure + cmdbAbstractObject + false + autoincrement + organization + id + + + %1$s - + - + - - - + + name + + false + + + code + + true + + active inactive + status + active + true + + + parent_id + true + DEL_MANUAL + + + parent_id + name - - @@ -62,45 +88,102 @@ - + - + bizmodel,searchable,structure + cmdbAbstractObject + false + autoincrement + location + id + + + %1$s - + images/location.png - - - + + + - - + + name + + false + + active inactive + status + active + true - - - - - - - + + org_id + Organization + false + DEL_MANUAL + + + + org_id + name + + + address + + true + + + postal_code + + true + + + city + + true + + + country + + true + + - + + parent_id + true + DEL_MANUAL + org_id]]> + + + parent_id + name + + + Contact + location_id + 0 + 0 + + + InfrastructureCI + location_id + 0 + 0 - - - @@ -138,47 +221,118 @@ - + - + bizmodel,searchable,structure + cmdbAbstractObject + true + autoincrement + contact + id + finalclass + + %1$s - + images/team.png - - - - + + + + - - + + name + + false + + active inactive + status + active + false - - - - - + + org_id + Organization + false + DEL_MANUAL + + + + org_id + name + + + email + + false + + + phone + + true + + + org_id]]> - + + location_id + Location + true + DEL_MANUAL + + + + location_id + name + + + lnkContractToContact + contact_id + 0 + 0 + contract_id + + + lnkServiceToContact + contact_id + 0 + 0 + service_id + + + lnkTicketToContact + contact_id + 0 + 0 + ticket_id + + + lnkCIToContact + contact_id + 0 + 0 + ci_id + + + lnkTeamToContact + contact_id + 0 + 0 + team_id - - - - - - @@ -219,28 +373,44 @@ - + - + bizmodel,searchable,structure + Contact + false + autoincrement + person + id + + + %1$s %2$s - - + + images/person.png - - - - + + + + - - + + first_name + + false + + + employee_id + + true + @@ -286,24 +456,38 @@ - + - + bizmodel,searchable,structure + Contact + false + autoincrement + team + id + + + %1$s - + images/team.png - - + + - + + lnkTeamToContact + team_id + 0 + 0 + contact_id + @@ -344,31 +528,74 @@ - + - + 1 + bizmodel,searchable,structure + cmdbAbstractObject + false + autoincrement + lnkteamtocontact + id + + + %1$s - + - + - - - - - - - - - + + team_id + Team + false + DEL_AUTO + + + + team_id + name + + + contact_id + Contact + false + DEL_AUTO + + + + contact_id + name + + + contact_id + location_id + + + contact_id + location_name + + + contact_id + email + + + contact_id + phone + + + role + + true + @@ -398,29 +625,54 @@ - + - + bizmodel,searchable,documentation + cmdbAbstractObject + true + autoincrement + document + id + finalclass + + %1$s - + images/document.png - - - + + + - - - - - + + name + + false + + + org_id + Organization + false + DEL_MANUAL + + + + org_id + name + + + description + + true + + contract networkmap @@ -429,18 +681,48 @@ whitePaper workinginstructions + type + presentation + true - + draft published obsolete + status + draft + false + + + lnkContractToDoc + document_id + 0 + 0 + contract_id + + + lnkServiceToDoc + document_id + 0 + 0 + service_id + + + lnkTicketToDoc + document_id + 0 + 0 + ticket_id + + + lnkCIToDoc + document_id + 0 + 0 + ci_id - - - - @@ -475,25 +757,38 @@ - + - + bizmodel,searchable,documentation + Document + false + autoincrement + externaldoc + id + + + %1$s - + images/document.png - - - + + + - + + url + + false + _blank + @@ -531,25 +826,37 @@ - + - + bizmodel,searchable,documentation + Document + false + autoincrement + note + id + + + %1$s - + images/document.png - - - + + + - + + note + + true + @@ -587,31 +894,44 @@ - + - + bizmodel,searchable,documentation + Document + false + autoincrement + filedoc + id + + + %1$s - + images/document.png - - - + + + - + - + /** * Overload the display of the properties to add a tab (the first one) * with the preview of the document - */]]> + false + public + Overload-cmdbAbstractObject + + }]]> +
@@ -657,35 +978,89 @@ - + - + bizmodel,searchable,configmgmt + cmdbAbstractObject + false + autoincrement + licence + id + + + %1$s - + images/licence.png - - - + + + - - - - - - - - - - - + + provider + + false + + + org_id + Organization + false + DEL_MANUAL + + + + org_id + name + + + product + + false + + + name + + false + + + start + + true + + + end + + true + + + licence_key + + true + + + scope + + true + + + usage_limit + + true + + + SoftwareInstance + licence_id + 0 + 0 + @@ -726,34 +1101,67 @@ - + - + bizmodel,searchable,configmgmt + cmdbAbstractObject + false + autoincrement + subnet + id + + + %1$s / %2$s - - + + images/subnet.png - - - - + + + + - - - - - + + description + + true + + + org_id + Organization + false + DEL_MANUAL + + + + org_id + name + + + ip + + false + + + ip_mask + + false + - + false + public + Overload-cmdbAbstractObject + + }]]> +
@@ -830,35 +1239,68 @@ - + - + bizmodel,searchable,configmgmt + cmdbAbstractObject + false + autoincrement + patch + id + + + %1$s - + images/patch.png - + - - - - - + + name + + false + + + description + + true + + + target_sw + + true + + + version + + true + + application os security servicepack + type + security + false + + + lnkPatchToCI + patch_id + 0 + 0 + ci_id - @@ -890,24 +1332,40 @@ - + - + bizmodel,searchable,configmgmt + cmdbAbstractObject + true + autoincrement + software + id + finalclass + + %1$s - + images/software.png - + - - + + name + + false + + + description + + true + @@ -930,23 +1388,36 @@ - + - + bizmodel,searchable,configmgmt + Software + false + autoincrement + software_app + id + + + %1$s - + images/software.png - + - + + ApplicationInstance + software_id + 0 + 0 + @@ -970,23 +1441,36 @@ - + - + bizmodel,searchable,configmgmt + Software + false + autoincrement + software_db + id + + + %1$s - + images/software.png - + - + + DBServerInstance + software_id + 0 + 0 + @@ -1010,28 +1494,58 @@ - + - + 1 + bizmodel,configmgmt + cmdbAbstractObject + false + autoincrement + lnkpatchtoci + id + + + %1$s - + - - + + - - - - - + + patch_id + Patch + false + DEL_AUTO + + + + patch_id + name + + + ci_id + Device + false + DEL_AUTO + + + + ci_id + name + + + ci_id + status + @@ -1057,49 +1571,110 @@ - + - + bizmodel,searchable,configmgmt + cmdbAbstractObject + true + autoincrement + functionalci + id + finalclass + + %1$s - + images/server.png - - - + + + - - + + name + + false + + implementation production obsolete + status + implementation + false - - - + + org_id + Organization + false + DEL_MANUAL + + + + org_id + name + + low medium high + importance + medium + false + + + lnkCIToContact + ci_id + 0 + 0 + contact_id + + + lnkCIToDoc + ci_id + 0 + 0 + document_id + + + lnkSolutionToCI + ci_id + 0 + 0 + solution_id + + + lnkContractToCI + ci_id + 0 + 0 + contract_id + + + lnkTicketToCI + ci_id + 0 + 0 + ticket_id - - - - - - + true + public + Overload-DBObject + + }]]> +
@@ -1147,47 +1723,90 @@ - + - + bizmodel,searchable,configmgmt + FunctionalCI + true + autoincrement + softwareinstance + id + + + %1$s - %2$s - - + + images/application.png - - - - - + + + + + - + + org_id]]> - + + device_id + Device + false + DEL_MANUAL + - - + + device_id + name + + + org_id]]> - + + licence_id + Licence + true + DEL_MANUAL + + + + licence_id + name + + + version + + true + + + description + + true - - - - + false + public + Overload-DBObject + public function ComputeValues() { - }]]> - + + + true + public + Overload-DBObject + + }]]> +
@@ -1251,32 +1871,54 @@ - + - + bizmodel,searchable,configmgmt + SoftwareInstance + false + autoincrement + softwareinstance_dbserver + id + + + %1$s - %2$s - - + + images/database.png - - - - - - - + + + + + + + - - - + + software_id + DBServer + false + DEL_MANUAL + + + + software_id + name + + + DatabaseInstance + db_server_instance_id + 0 + 0 + @@ -1322,31 +1964,48 @@ - + - + bizmodel,searchable,configmgmt + SoftwareInstance + false + autoincrement + softwareinstance_application + id + + + %1$s - %2$s - - + + images/application.png - - - - - - - + + + + + + + - - + + software_id + Application + false + DEL_MANUAL + + + + software_id + name + @@ -1391,38 +2050,66 @@ - + - + bizmodel,searchable,configmgmt + FunctionalCI + false + autoincrement + databaseinstance + id + + + %1$s - %2$s - - + + images/database-instance.png - - - - - + + + + + - + + org_id]]> - + + db_server_instance_id + DBServerInstance + false + DEL_MANUAL + + + + db_server_instance_id + name + + + db_server_instance_id + version + + + description + + true - - - - + true + public + Overload-DBObject + + }]]> +
@@ -1476,30 +2164,58 @@ - + - + bizmodel,searchable,configmgmt + FunctionalCI + false + autoincrement + applicationsolution + id + + + %1$s - + images/solution.png - - - + + + - - - + + description + + true + + + lnkSolutionToCI + solution_id + 0 + 0 + ci_id + + + lnkProcessToSolution + solution_id + 0 + 0 + process_id + - + true + public + Overload-DBObject + + }]]> +
@@ -1556,29 +2273,51 @@ - + - + bizmodel,searchable,configmgmt + FunctionalCI + false + autoincrement + businessprocess + id + + + %1$s - + images/business-process.png - - - + + + - - + + description + + true + + + lnkProcessToSolution + process_id + 0 + 0 + solution_id + - + true + public + Overload-DBObject + + }]]> +
@@ -1627,28 +2367,52 @@ - + - + bizmodel,searchable,configmgmt + FunctionalCI + true + autoincrement + connectableci + id + + + %1$s - + images/server.png - - - + + + - - - - + + brand + + true + + + model + + true + + + serial_number + + true + + + asset_ref + + true + @@ -1695,33 +2459,50 @@ - + - + bizmodel,searchable,configmgmt + ConnectableCI + false + autoincrement + networkinterface + id + + + %1$s - %2$s - - + + images/interface.png - - - - + + + + - + + org_id]]> - + + device_id + Device + false + DEL_AUTO + - - + + device_id + name + + backup logical @@ -1729,45 +2510,95 @@ primary secondary + logical_type + primary + false - + atm ethernet framerelay vlan + physical_type + ethernet + false - - - - - + + ip_address + + true + + + ip_mask + + true + + + mac_address + + true + + + speed + + true + + full half auto unknown + duplex + full + true - + + org_id]]> - + + connected_if + NetworkInterface + true + DEL_AUTO + - - - - + + connected_if + name + + + connected_if + device_id + + + connected_if + device_name + + uplink downlink + link_type + uplink + false + + + connected_if + device_id_friendlyname - - + true + public + Overload-DBObject + - + + + false + protected + Overload-DBObject + m_aOrigValues['connected_if']; // The interface this interface was connected to @@ -1832,17 +2668,28 @@ self::$m_oCurrChange = $oCurrChange; } } - }]]> - + + + false + protected + Overload-DBObject + UpdateConnectedInterface(); parent::AfterInsert(); - }]]> - + + + false + protected + Overload-DBObject + UpdateConnectedInterface(); parent::AfterUpdate(); - }]]> + }]]> +
@@ -1902,28 +2749,45 @@ - + - + bizmodel,searchable,configmgmt + ConnectableCI + true + autoincrement + device + id + + + %1$s - + images/server.png - - - + + + - + + NetworkInterface + device_id + 0 + 0 + - + true + public + Overload-DBObject + + }]]> +
@@ -1992,31 +2857,70 @@ - + - + bizmodel,searchable,configmgmt + Device + false + autoincrement + pc + id + + + %1$s - + images/laptop.png - - - + + + - - - - - - - + + cpu + + true + + + ram + + true + + + hdd + + true + + + os_family + + true + + + os_version + + true + + + SoftwareInstance + device_id + 0 + 0 + + + lnkPatchToCI + ci_id + 0 + 0 + patch_id + @@ -2071,20 +2975,28 @@ - + - + bizmodel,searchable,configmgmt + Device + true + autoincrement + mobileci + id + + + %1$s - + images/mobile-phone.png - - - + + + @@ -2132,27 +3044,47 @@ - + - + bizmodel,searchable,configmgmt + MobileCI + false + autoincrement + mobilephone + id + + + %1$s - + images/mobile-phone.png - - - + + + - - - + + number + + true + + + IMIE + + true + + + hw_pin + + true + @@ -2202,36 +3134,69 @@ - + - + bizmodel,searchable,configmgmt + Device + true + autoincrement + infrastructureci + id + + + %1$s - + images/server.png - - - - - + + + + + - - - - - + + description + + true + + + org_id]]> + + + + location_id + Location + true + DEL_MANUAL + + + + location_id + name + + + location_details + + true + + + management_ip + + true + + + default_gateway + + true - - - - @@ -2285,27 +3250,35 @@ - + - + bizmodel,searchable,configmgmt + InfrastructureCI + false + autoincrement + networkdevice + id + + + %1$s - + images/switch.png - - - - - + + + + + - + wanaccelerator firewall @@ -2314,11 +3287,30 @@ router switch + type + switch + true + + + ios_version + + true + + + ram + + true + + + snmp_read + + true + + + snmp_write + + true - - - - @@ -2380,33 +3372,72 @@ - + - + bizmodel,searchable,configmgmt + InfrastructureCI + false + autoincrement + server + id + + + %1$s - + images/server.png - - - - - + + + + + - - - - - - - + + cpu + + true + + + ram + + true + + + hdd + + true + + + os_family + + true + + + os_version + + true + + + SoftwareInstance + device_id + 0 + 0 + + + lnkPatchToCI + ci_id + 0 + 0 + patch_id + @@ -2470,38 +3501,52 @@ - + - + bizmodel,searchable,configmgmt + InfrastructureCI + false + autoincrement + printer + id + + + %1$s - + images/printer.png - - - - - + + + + + - + mopier printer + type + printer + true - + laser inkjet tracer + technology + laser + true @@ -2568,43 +3613,87 @@ - + - + bizmodel,searchable,configmgmt + cmdbAbstractObject + false + autoincrement + group + id + + + %1$s - + images/group.png - - - + + + - - + + name + + false + + production implementation obsolete + status + implementation + false - - - - - + + org_id + Organization + false + DEL_MANUAL + + + + org_id + name + + + description + + true + + + type + + true + + - + + parent_id + true + DEL_MANUAL + + + parent_id + name + + + lnkGroupToCI + group_id + 0 + 0 + ci_id - - @@ -2637,29 +3726,63 @@ - + - + 1 + bizmodel,configmgmt + cmdbAbstractObject + false + autoincrement + lnkgrouptoci + id + + + %1$s - + - - + + - - - - - - + + group_id + Group + false + DEL_MANUAL + + + + group_id + name + + + ci_id + FunctionalCI + false + DEL_MANUAL + + + + ci_id + name + + + ci_id + status + + + reason + + true + @@ -2688,30 +3811,66 @@ - + - + 1 + bizmodel,configmgmt + cmdbAbstractObject + false + autoincrement + lnkcitodoc + id + + + %1$s - + - - + + - - - - - - - + + ci_id + FunctionalCI + false + DEL_AUTO + + + + ci_id + name + + + ci_id + status + + + document_id + Document + false + DEL_AUTO + + + + document_id + name + + + document_id + type + + + document_id + status + @@ -2741,30 +3900,67 @@ - + - + 1 + bizmodel,configmgmt + cmdbAbstractObject + false + autoincrement + lnkcitocontact + id + + + %1$s - + images/contact.png - - + + - - - - - - - + + ci_id + FunctionalCI + false + DEL_AUTO + + + + ci_id + name + + + ci_id + status + + + contact_id + Contact + false + DEL_AUTO + + + + contact_id + name + + + contact_id + email + + + role + + true + @@ -2795,29 +3991,63 @@ - + - + 1 + bizmodel,configmgmt + cmdbAbstractObject + false + autoincrement + lnksolutiontoci + id + + + %1$s - + - - + + - - - - - - + + solution_id + ApplicationSolution + false + DEL_AUTO + + + + solution_id + name + + + ci_id + FunctionalCI + false + DEL_AUTO + + + + ci_id + name + + + ci_id + status + + + utility + + true + @@ -2846,28 +4076,59 @@ - + - + 1 + bizmodel,configmgmt + cmdbAbstractObject + false + autoincrement + lnkprocesstosolution + id + + + %1$s - + - - + + - - - - - + + solution_id + ApplicationSolution + false + DEL_AUTO + + + + solution_id + name + + + process_id + BusinessProcess + false + DEL_AUTO + + + + process_id + name + + + reason + + true + @@ -2897,136 +4158,136 @@ - - - - - + 70 + Organization + UR_ACTION_MODIFY + UR_ALLOWED_YES + - - - + 33 + DataAdministration + $pages/audit.php - - - + 50 + DataAdministration + - - - - + 10 + Catalogs + SELECT Organization + 1 - - - - + 20 + Catalogs + SELECT Application + - - - - + 40 + Catalogs + SELECT DBServer + - + 20 - - - + 0 + ConfigManagement + overview.html - - - + 1 + ConfigManagement + contacts_menu.html - - - + 1 + Contact + Contact - - - + 2 + Contact + Contact - - - - + 2 + ConfigManagement + SELECT Document + 1 - - - - + 3 + ConfigManagement + SELECT Location + 1 - - - - + 4 + ConfigManagement + SELECT Group + 1 - - - + 5 + ConfigManagement + cis_menu.html - - - + 0 + ConfigManagementCI + FunctionalCI - - - + 1 + ConfigManagementCI + FunctionalCI - - - + 6 + ConfigManagement + - - - - + 1 + ConfigManagement:Shortcuts + SELECT Server + - - - - + 2 + ConfigManagement:Shortcuts + SELECT NetworkDevice + - - - - + 3 + ConfigManagement:Shortcuts + SELECT Printer + - - - - + 4 + ConfigManagement:Shortcuts + SELECT PC + - - - - + 5 + ConfigManagement:Shortcuts + SELECT BusinessProcess + - - - - + 6 + ConfigManagement:Shortcuts + SELECT ApplicationSolution + diff --git a/datamodel/itop-incident-mgmt-1.0.0/datamodel.itop-incident-mgmt.xml b/datamodel/itop-incident-mgmt-1.0.0/datamodel.itop-incident-mgmt.xml index 48908bb3e..e9f45b2ef 100644 --- a/datamodel/itop-incident-mgmt-1.0.0/datamodel.itop-incident-mgmt.xml +++ b/datamodel/itop-incident-mgmt-1.0.0/datamodel.itop-incident-mgmt.xml @@ -1,7 +1,7 @@ - + * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL */]]> - + bizmodel,searchable,incidentmgmt + ResponseTicket + false + autoincrement + ticket_incident + id + + + %1$s - + images/incident.png - + - + + false + - + + status - - - - - + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_assign + assigned - + + SetAssignedDate + - + + ev_timeout + escalated_tto - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_assign + assigned - + + SetAssignedDate + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_reassign + assigned - + + ev_timeout + escalated_ttr - + + ev_resolve + resolved - - + + SetResolveDate + + + SetClosureDeadline + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_reassign + escalated_ttr - + + ev_resolve + resolved - - + + SetResolveDate + + + SetClosureDeadline + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_reassign + assigned - + + ev_close + closed - + + SetClosureDate + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + false + public + Overload-DBObject + Get('ref'); if (strlen($sCurrRef) == 0) @@ -441,8 +673,13 @@ } return parent::ComputeValues(); - }]]> - + + + false + protected + Overload-DBObject + Get('contact_list'); $oToImpact = $this->Get('ci_list'); @@ -472,12 +709,18 @@ } } parent::OnInsert(); - }]]> - + + + /** * Get the icon representing this object * @param boolean $bImgTag If true the result is a full IMG tag (or an emtpy string if no icon is defined) * @return string Either the full IMG tag ($bImgTag == true) or just the path to the icon file - */]]> + false + public + Overload-DBObject + Get('status'); switch($this->GetState()) @@ -538,8 +781,13 @@ $sIcon = MetaModel::GetClassIcon(get_class($this), $bImgTag); } return $sIcon; - }]]> - + + + true + protected + Overload-DBObject + + }]]> +
@@ -564,9 +813,9 @@ ci_list contact_list incident_list - + - + ref title @@ -578,7 +827,7 @@ product - + impact urgency @@ -591,9 +840,9 @@ - + - + start_date last_update @@ -604,14 +853,14 @@ closure_deadline - + caller_id workgroup_id agent_id - + related_problem_id related_change_id @@ -659,28 +908,59 @@ - + - + 1 + bizmodel,searchable,incidentmgmt,requestmgmt,lnkincident + cmdbAbstractObject + false + autoincrement + lnktickettoincident + id + + + %1$s - + - - + + - - - - - + + ticket_id + Ticket + false + DEL_AUTO + + + + ticket_id + ref + + + incident_id + Incident + false + DEL_AUTO + + + + incident_id + ref + + + reason + + true + @@ -709,48 +989,48 @@ - + 40 - - - + 0 + IncidentManagement + overview.html - - - + 1 + IncidentManagement + Incident - - - + 2 + IncidentManagement + Incident - - - + 3 + IncidentManagement + - - - - - + 1 + Incident:Shortcuts + + + fast - - - - - + 2 + Incident:Shortcuts + + + fast - - - - - + 3 + Incident:Shortcuts + + + standard diff --git a/datamodel/itop-knownerror-mgmt-1.0.0/datamodel.itop-knownerror-mgmt.xml b/datamodel/itop-knownerror-mgmt-1.0.0/datamodel.itop-knownerror-mgmt.xml index a4002a7cf..6b0592f9f 100644 --- a/datamodel/itop-knownerror-mgmt-1.0.0/datamodel.itop-knownerror-mgmt.xml +++ b/datamodel/itop-knownerror-mgmt-1.0.0/datamodel.itop-knownerror-mgmt.xml @@ -1,49 +1,126 @@ - + - /** * Description of known error -*/]]> - +*/ + bizmodel,searchable,knownerrormgmt + cmdbAbstractObject + false + autoincrement + known_error + id + + + %1$s - + images/known-error.png - - + + - - - - - - - - - - - + + name + + false + + + cust_id + Organization + false + DEL_MANUAL + + + + org_id + name + + + problem_id + Problem + true + DEL_MANUAL + + + + problem_id + ref + + + symptom + + false + + + rootcause + + true + + + workaround + + true + + + solution + + true + + + error_code + + true + + Network Server Application Desktop + domain + Application + false + + + vendor + + true + + + model + + true + + + version + + true + + + lnkInfraError + error_id + 0 + 0 + infra_id + + + lnkDocumentError + error_id + 0 + 0 + doc_id - - - - - @@ -85,30 +162,64 @@ - + - /** * n-n link between any Infra and a Known Error -*/]]> - +*/ + 1 + bizmodel,searchable,knownerrormgmt,lnkknownerror + cmdbAbstractObject + false + autoincrement + infra_error_links + link_id + + + lnkInfraError - - + + - - - - - - + + infra_id + FunctionalCI + false + DEL_AUTO + + + + infra_id + name + + + infra_id + status + + + error_id + KnownError + false + DEL_AUTO + + + + error_id + name + + + dummy + + true + @@ -135,31 +246,62 @@ - + - /** * n-n link between any Contract and a Document -*/]]> - +*/ + 1 + bizmodel,searchable,knownerrormgmt,lnkknownerror + cmdbAbstractObject + false + autoincrement + documents_error_link + link_id + + + %1$s - + ../business/templates/default.html - - + + - - - - - + + doc_id + Document + false + DEL_AUTO + + + + doc_id + name + + + error_id + KnownError + false + DEL_AUTO + + + + error_id + name + + + link_type + + true + @@ -182,28 +324,28 @@ - + 42 - - - + 3 + ProblemManagement + KnownError - - - + 4 + ProblemManagement + KnownError - - - + 5 + ProblemManagement + - - - - + 3 + Problem:Shortcuts + SELECT KnownError + 1 diff --git a/datamodel/itop-problem-mgmt-1.0.0/datamodel.itop-problem-mgmt.xml b/datamodel/itop-problem-mgmt-1.0.0/datamodel.itop-problem-mgmt.xml index a1b66c272..804518eb0 100644 --- a/datamodel/itop-problem-mgmt-1.0.0/datamodel.itop-problem-mgmt.xml +++ b/datamodel/itop-problem-mgmt-1.0.0/datamodel.itop-problem-mgmt.xml @@ -1,7 +1,7 @@ - + * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL */]]> - + bizmodel,searchable,problemmgmt + Ticket + false + autoincrement + ticket_problem + id + + + %1$s - + images/problem.png - + - + + false + - + new assigned resolved closed + status + new + false - - - + + org_id + Organization + false + DEL_AUTO + + + + org_id + name + + + org_id]]> - + + service_id + Service + false + DEL_MANUAL + - - + + service_id + name + + + service_id]]> - + + servicesubcategory_id + ServiceSubcategory + false + DEL_MANUAL + - - - + + servicesubcategory_id + name + + + product + + true + + 1 2 3 + impact + 1 + false - + 1 2 3 + urgency + 1 + false - + 1 2 3 + priority + 1 + false - + + service_id AND cc.org_id = :this->org_id]]> - - + + + workgroup_id + Team + false + DEL_MANUAL + - - + + workgroup_id + name + + + workgroup_id]]> - + + agent_id + Person + true + DEL_MANUAL + + + + agent_id + name + + + agent_id + email + + + related_change_id + Change + true + DEL_MANUAL + + + + related_change_id + ref + + + close_date + + true + + + last_update + + true + + + assignment_date + + true + + + resolution_date + + true + + + KnownError + problem_id + 0 + 0 - - - - - - - - - - + + status - - - - + + + + - + - - - - - + + ev_assign + assigned - + + SetAssignedDate + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_reassign + assigned - + + ev_resolve + resolved - + + SetResolveDate + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_reassign + assigned - + + ev_close + closed - + + SetClosureDate + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + false + public + LifecycleAction + Set('assignment_date', time()); return true; - }]]> - + + + false + public + LifecycleAction + Set('resolution_date', time()); return true; - }]]> - + + + false + public + LifecycleAction + Set('close_date', time()); return true; - }]]> - + + + /** Compute the priority of the ticket based on its impact and urgency * @return integer The priority of the ticket 1(high) .. 3(low) - */]]> + false + public + LifecycleAction + Get('impact')][(int)$this->Get('urgency')]; return $iPriority; - }]]> - + + + false + public + Overload-DBObject + Set('priority', $this->ComputePriority()); @@ -343,7 +566,8 @@ $sName = sprintf('P-%06d', $iKey); $this->Set('ref', $sName); } - }]]> + }]]> +
@@ -352,9 +576,9 @@ ci_list contact_list incident_list - + - + ref title @@ -366,7 +590,7 @@ product - + impact urgency @@ -375,9 +599,9 @@ - + - + start_date last_update @@ -385,13 +609,13 @@ close_date - + workgroup_id agent_id - + related_change_id @@ -434,31 +658,31 @@ - - - + 0 + ProblemManagement + overview.html - - - + 1 + ProblemManagement + Problem - - - + 2 + ProblemManagement + Problem - - - - + 1 + Problem:Shortcuts + + - - - - + 2 + Problem:Shortcuts + + diff --git a/datamodel/itop-request-mgmt-1.0.0/datamodel.itop-request-mgmt.xml b/datamodel/itop-request-mgmt-1.0.0/datamodel.itop-request-mgmt.xml index a33c40708..c85c337d4 100644 --- a/datamodel/itop-request-mgmt-1.0.0/datamodel.itop-request-mgmt.xml +++ b/datamodel/itop-request-mgmt-1.0.0/datamodel.itop-request-mgmt.xml @@ -1,7 +1,7 @@ - + * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL */]]> - + bizmodel,searchable,requestmgmt + ResponseTicket + false + autoincrement + ticket_request + id + + + %1$s - + images/user-request.png - + - + + false + - + service request issue information + request_type + service request + false + + + freeze_reason + + true - - + + status - - - - - - + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_assign + assigned - + + SetAssignedDate + - + + ev_timeout + escalated_tto - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_assign + assigned - + + SetAssignedDate + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_reassign + assigned - + + ev_timeout + escalated_ttr - + + ev_resolve + resolved - - + + SetResolveDate + + + SetClosureDeadline + - + + ev_freeze + frozen - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_reassign + escalated_ttr - + + ev_resolve + resolved - - + + SetResolveDate + + + SetClosureDeadline + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_timeout + escalated_ttr - + + ev_assign + assigned - + + ev_resolve + resolved - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_reassign + assigned - + + ev_close + closed - + + SetClosureDate + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + false + public + Overload-DBObject + Get('ref'); if (strlen($sCurrRef) == 0) @@ -478,12 +754,18 @@ } return parent::ComputeValues(); - }]]> - + + + /** * Get the icon representing this object * @param boolean $bImgTag If true the result is a full IMG tag (or an emtpy string if no icon is defined) * @return string Either the full IMG tag ($bImgTag == true) or just the path to the icon file - */]]> + false + public + Overload-DBObject + Get('status'); switch($this->GetState()) @@ -544,8 +826,13 @@ $sIcon = MetaModel::GetClassIcon(get_class($this), $bImgTag); } return $sIcon; - }]]> - + + + true + protected + Overload-DBObject + + }]]> +
@@ -570,9 +858,9 @@ ci_list contact_list incident_list - + - + ref title @@ -585,7 +873,7 @@ product - + impact urgency @@ -599,9 +887,9 @@ - + - + start_date last_update @@ -612,14 +900,14 @@ closure_deadline - + caller_id workgroup_id agent_id - + related_problem_id related_change_id @@ -671,48 +959,48 @@ - + 30 - - - + 0 + RequestManagement + overview.html - - - + 1 + RequestManagement + UserRequest - - - + 2 + RequestManagement + UserRequest - - - + 3 + RequestManagement + - - - - - + 1 + UserRequest:Shortcuts + + + fast - - - - - + 2 + UserRequest:Shortcuts + + + fast - - - - - + 3 + UserRequest:Shortcuts + + + fast diff --git a/datamodel/itop-service-mgmt-1.0.0/datamodel.itop-service-mgmt.xml b/datamodel/itop-service-mgmt-1.0.0/datamodel.itop-service-mgmt.xml index e5311c670..01531b576 100644 --- a/datamodel/itop-service-mgmt-1.0.0/datamodel.itop-service-mgmt.xml +++ b/datamodel/itop-service-mgmt-1.0.0/datamodel.itop-service-mgmt.xml @@ -1,7 +1,7 @@ - + * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL */]]> - + bizmodel,searchable,servicemgmt + cmdbAbstractObject + true + autoincrement + contract + id + finalclass + + %1$s - + contract.png - + - - - - - - + + name + + false + + + description + + true + + + start_date + + true + + + end_date + + true + + + cost + + true + + dollars euros + cost_currency + euros + true + + + cost_unit + + true + + + billing_frequency + + true + + + lnkContractToContact + contract_id + 0 + 0 + contact_id + + + lnkContractToDoc + contract_id + 0 + 0 + document_id + + + lnkContractToCI + contract_id + 0 + 0 + ci_id - - - - - @@ -84,34 +141,64 @@ - + - + bizmodel,searchable,servicemgmt + Contract + false + autoincrement + providercontract + id + + + %1$s - + contract.png - - + + - - - - + + provider_id + Organization + false + DEL_AUTO + + + + provider_id + name + + + sla + + true + + + coverage + + true + - + + true + public + Overload-iDisplay + + }]]> +
@@ -168,36 +256,83 @@ - + - + bizmodel,searchable,servicemgmt + Contract + false + autoincrement + customercontract + id + + + %1$s - + contract.png - - - + + + - - - - - - - - + + org_id + Organization + false + DEL_AUTO + + + + org_id + name + + + provider_id + Organization + true + DEL_AUTO + + + + provider_id + name + + + provider_id]]> + + + + support_team_id + Team + false + DEL_AUTO + + + + support_team_id + name + + + lnkContractToSLA + contract_id + 0 + 0 + sla_id + + + lnkCustomerContractToProviderContract + customer_contract_id + 0 + 0 + provider_contract_id - - - @@ -247,29 +382,62 @@ - + - + 1 + bizmodel,searchable,servicemgmt,lnkservice + cmdbAbstractObject + false + autoincrement + lnkcustomercontracttoprovider + id + + + %1$s - + - - + + - - - - - - + + customer_contract_id + CustomerContract + false + DEL_AUTO + + + + customer_contract_id + name + + + provider_contract_id + ProviderContract + false + DEL_AUTO + + + + provider_contract_id + name + + + provider_contract_id + sla + + + provider_contract_id + coverage + @@ -297,29 +465,63 @@ - + - + 1 + bizmodel,searchable,servicemgmt,lnkservice + cmdbAbstractObject + false + autoincrement + lnkcontracttosla + id + + + %1$s - + - - + + - - - - - - + + contract_id + CustomerContract + false + DEL_AUTO + + + + contract_id + name + + + sla_id + SLA + false + DEL_AUTO + + + + sla_id + name + + + sla_id + service_name + + + coverage + + true + @@ -348,29 +550,62 @@ - + - + 1 + bizmodel,searchable,servicemgmt,lnkservice + cmdbAbstractObject + false + autoincrement + lnkcontracttodoc + id + + + %1$s - + - - + + - - - - - - + + contract_id + Contract + false + DEL_AUTO + + + + contract_id + name + + + document_id + Document + false + DEL_AUTO + + + + document_id + name + + + document_id + type + + + document_id + status + @@ -400,29 +635,63 @@ - + - + 1 + bizmodel,searchable,servicemgmt,lnkservice + cmdbAbstractObject + false + autoincrement + lnkcontracttocontact + id + + + %1$s - + - - + + - - - - - - + + contract_id + Contract + false + DEL_AUTO + + + + contract_id + name + + + contact_id + Contact + false + DEL_AUTO + + + + contact_id + name + + + contact_id + email + + + role + + true + @@ -452,28 +721,58 @@ - + - + 1 + bizmodel,searchable,servicemgmt,lnkservice + cmdbAbstractObject + false + autoincrement + lnkcontracttoci + id + + + %1$s - + - - + + - - - - - + + contract_id + Contract + false + DEL_AUTO + + + + contract_id + name + + + ci_id + FunctionalCI + false + DEL_AUTO + + + + ci_id + name + + + ci_id + status + @@ -500,47 +799,104 @@ - + - + bizmodel,searchable,servicemgmt + cmdbAbstractObject + false + autoincrement + service + id + + + %1$s - + service.png - - + + - - - - - + + org_id + Organization + false + DEL_AUTO + + + + org_id + name + + + name + + true + + + description + + true + + RequestManagement IncidentManagement + type + IncidentManagement + true - + design production obsolete + status + design + true + + + ServiceSubcategory + service_id + 0 + 0 + + + SLA + service_id + 0 + 0 + + + lnkServiceToDoc + service_id + 0 + 0 + document_id + + + lnkServiceToContact + service_id + 0 + 0 + contact_id - - - - - + false + public + Overload-cmdbAbstractObject + false, 'block_id' => 'service'); @@ -551,7 +907,8 @@ $oCustomerContracts=new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT CustomerContract AS cc JOIN lnkContractToSLA AS ln ON ln.contract_id=cc.id JOIN SLA AS sla ON ln.sla_id=sla.id WHERE sla.service_id=$ServiceID")); self::DisplaySet($oPage,$oCustomerContracts,$aExtraParam); } - }]]> + }]]> +
@@ -586,29 +943,60 @@ - + - + bizmodel,searchable,servicemgmt + cmdbAbstractObject + false + autoincrement + servicesubcategory + id + + + %1$s - + sla.png - - + + - - - - - - + + name + + true + + + description + + true + + + service_id + Service + false + DEL_MANUAL + + + + service_id + name + + + service_id + org_id + + + service_id + provider_name + @@ -636,27 +1024,54 @@ - + - + bizmodel,searchable,servicemgmt + cmdbAbstractObject + false + autoincrement + sla + id + + + %1$s - + sla.png - - + + - - - - + + name + + true + + + service_id + Service + false + DEL_MANUAL + + + + service_id + name + + + lnkSLTToSLA + sla_id + 0 + 0 + slt_id + @@ -680,45 +1095,76 @@ - + - + bizmodel,searchable,servicemgmt + cmdbAbstractObject + false + autoincrement + slt + id + + + %1$s - + slt.png - + - - + + name + + true + + TTO TTR + metric + TTO + false - + 1 2 3 + ticket_priority + 1 + true - - + + value + + true + + days hours minutes + value_unit + hours + true + + + lnkSLTToSLA + slt_id + 0 + 0 + sla_id - @@ -751,31 +1197,70 @@ - + - + 1 + bizmodel,searchable,servicemgmt,lnkservice + cmdbAbstractObject + false + autoincrement + lnkslttosla + id + + + %1$s - + - - + + - - - - - - - - + + sla_id + SLA + false + DEL_AUTO + + + + sla_id + name + + + slt_id + SLT + false + DEL_AUTO + + + + slt_id + name + + + slt_id + metric + + + slt_id + ticket_priority + + + slt_id + value + + + slt_id + value_unit + @@ -811,29 +1296,62 @@ - + - + 1 + bizmodel,searchable,servicemgmt,lnkservice + cmdbAbstractObject + false + autoincrement + lnkservicetodoc + id + + + %1$s - + - - + + - - - - - - + + service_id + Service + false + DEL_AUTO + + + + service_id + name + + + document_id + Document + false + DEL_AUTO + + + + document_id + name + + + document_id + type + + + document_id + status + @@ -863,29 +1381,63 @@ - + - + 1 + bizmodel,searchable,servicemgmt,lnkservice + cmdbAbstractObject + false + autoincrement + lnkservicetocontact + id + + + %1$s - + - - + + - - - - - - + + service_id + Service + false + DEL_AUTO + + + + service_id + name + + + contact_id + Contact + false + DEL_AUTO + + + + contact_id + name + + + contact_id + email + + + role + + true + @@ -915,28 +1467,57 @@ - + - + bizmodel,searchable,servicemgmt,lnkservice + cmdbAbstractObject + false + autoincrement + lnkservicetoci + id + + + %1$s - + - - + + - - - - - + + service_id + Service + false + DEL_AUTO + + + + service_id + name + + + ci_id + FunctionalCI + false + DEL_AUTO + + + + ci_id + name + + + ci_id + status + @@ -966,48 +1547,48 @@ - + 60 - - - + 0 + ServiceManagement + overview.html - - - - + 1 + ServiceManagement + SELECT ProviderContract + 1 - - - - + 2 + ServiceManagement + SELECT CustomerContract + 1 - - - - + 3 + ServiceManagement + SELECT Service + 1 - - - - + 4 + ServiceManagement + SELECT ServiceSubcategory + 1 - - - - + 5 + ServiceManagement + SELECT SLA + 1 - - - - + 6 + ServiceManagement + SELECT SLT + 1 diff --git a/datamodel/itop-tickets-1.0.0/datamodel.itop-tickets.xml b/datamodel/itop-tickets-1.0.0/datamodel.itop-tickets.xml index 99f44569e..233b32221 100644 --- a/datamodel/itop-tickets-1.0.0/datamodel.itop-tickets.xml +++ b/datamodel/itop-tickets-1.0.0/datamodel.itop-tickets.xml @@ -1,7 +1,7 @@ - + * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL */]]> - + bizmodel,searchable + cmdbAbstractObject + true + autoincrement + ticket + id + finalclass + + %1$s - + - + - - - - - - - - - + + ref + + true + + + title + + false + + + description + + false + + + ticket_log + + true + + + start_date + + false + + + lnkTicketToDoc + ticket_id + 0 + 0 + document_id + + + lnkTicketToCI + ticket_id + 0 + 0 + ci_id + + + lnkTicketToContact + ticket_id + 0 + 0 + contact_id + + + lnkTicketToIncident + ticket_id + 0 + 0 + incident_id + @@ -68,23 +120,31 @@ - + - + bizmodel + Ticket + true + autoincrement + ticket_response + id + + + %1$s - + - + - + new assigned @@ -94,514 +154,890 @@ resolved closed + status + new + false - + + org_id]]> - + + caller_id + Person + true + DEL_MANUAL + - - - - + + caller_id + email + + + org_id + Organization + false + DEL_AUTO + + + + org_id + name + + + org_id]]> - + + service_id + Service + false + DEL_MANUAL + - - + + service_id + name + + + service_id]]> - + + servicesubcategory_id + ServiceSubcategory + false + DEL_MANUAL + - - - + + servicesubcategory_id + name + + + product + + true + + 1 2 3 + impact + 1 + false - + 1 2 3 + urgency + 1 + false - + 1 2 3 + priority + 1 + false - + + service_id AND cc.org_id = :this->org_id]]> - - + + + workgroup_id + Team + false + DEL_MANUAL + - - + + workgroup_id + name + + + workgroup_id]]> - + + agent_id + Person + true + DEL_MANUAL + - - - - - - - - - - - - - - + + agent_id + name + + + agent_id + email + + + related_problem_id + Problem + true + DEL_MANUAL + + + + related_problem_id + ref + + + related_change_id + Change + true + DEL_MANUAL + + + + related_change_id + ref + + + close_date + + true + + + last_update + + true + + + assignment_date + + true + + + resolution_date + + true + + + tto_escalation_deadline + + true + + + ttr_escalation_deadline + + true + + + closure_deadline + + true + + fixed duplicate couldnotreproduce irrelevant + resolution_code + fixed + true - - + + solution + + true + + 1 2 3 4 + user_satisfaction + 1 + true + + + user_commment + + true - - + + status - - - - - + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_assign + assigned - + + SetAssignedDate + - + + ev_timeout + escalated_tto - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_assign + assigned - + + SetAssignedDate + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_reassign + assigned - + + ev_timeout + escalated_ttr - + + ev_resolve + resolved - - + + SetResolveDate + + + SetClosureDeadline + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_reassign + escalated_ttr - + + ev_resolve + resolved - - + + SetResolveDate + + + SetClosureDeadline + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + ev_reassign + assigned - + + ev_close + closed - + + SetClosureDate + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + false + public + LifecycleAction + Set('closure_deadline', time() + $iMaxWaitHours * 3600); return true; - }]]> - + + + false + public + LifecycleAction + Set('assignment_date', time()); return true; - }]]> - + + + false + public + LifecycleAction + Set('resolution_date', time()); return true; - }]]> - + + + false + public + LifecycleAction + Set('close_date', time()); return true; - }]]> - + + + name of the SLT selected, 'value' => duration in seconds of the SLT metric, null if no SLT applies to this ticket - */]]> + false + public + LifecycleAction + - + + + /** * Compute the priority of the ticket based on its impact and urgency * @return integer The priority of the ticket 1(high) .. 3(low) - */]]> + false + public + LifecycleAction + Get('impact')][(int)$this->Get('urgency')]; return $iPriority; - }]]> - + + + false + public + Overload-DBObject + Set('priority', $this->ComputePriority()); @@ -714,10 +1161,16 @@ { $this->Set('ttr_escalation_deadline', null); } - }]]> - + + + + false + public + Overload-iDisplay + GetState()) @@ -766,15 +1219,26 @@ break; } return $sHilightClass; - }]]> - + + + false + protected + Overload-DBObject + Set('last_update', time()); - }]]> - + + + false + protected + Overload-DBObject + Set('last_update', time()); - }]]> + }]]> +
@@ -853,27 +1317,54 @@ - + - + 1 + bizmodel,searchable,incidentmgmt,requestmgmt,changemgmt,problemmgmt,lnkticket + cmdbAbstractObject + false + autoincrement + lnktickettodoc + id + + + %1$s - + - - + + - - - - + + ticket_id + Ticket + false + DEL_AUTO + + + + ticket_id + ref + + + document_id + Document + false + DEL_AUTO + + + + document_id + name + @@ -897,29 +1388,63 @@ - + - + 1 + bizmodel,searchable,incidentmgmt,requestmgmt,changemgmt,problemmgmt,lnkticket + cmdbAbstractObject + false + autoincrement + lnktickettocontact + id + + + %1$s - + - - + + - - - - - - + + ticket_id + Ticket + false + DEL_AUTO + + + + ticket_id + ref + + + contact_id + Contact + false + DEL_AUTO + + + + contact_id + name + + + contact_id + email + + + role + + true + @@ -949,29 +1474,63 @@ - + - + 1 + bizmodel,searchable,incidentmgmt,requestmgmt,changemgmt,problemmgmt,lnkticket + cmdbAbstractObject + false + autoincrement + lnktickettoci + id + + + %1$s - + - - + + - - - - - - + + ticket_id + Ticket + false + DEL_AUTO + + + + ticket_id + ref + + + ci_id + FunctionalCI + false + DEL_AUTO + + + + ci_id + name + + + ci_id + status + + + impact + + true + diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php index 3af086bcb..fff3d81ef 100644 --- a/setup/compiler.class.inc.php +++ b/setup/compiler.class.inc.php @@ -141,14 +141,13 @@ EOF; foreach($oClasses as $oClass) { - $sClass = $oClass->getAttribute("name"); try { $this->CompileClass($oClass, $sResultFile, $sRelativeDir, $oP); } catch (ssDOMFormatException $e) { - $sClass = $oClass->getAttribute("name"); + $sClass = $oClass->getAttribute("id"); throw new Exception("Failed to process class '$sClass', from '$sModuleRootDir': ".$e->getMessage()); } } @@ -175,9 +174,9 @@ EOF; $aMenusToLoad = array(); foreach($oMenus as $oMenu) { - if ($oParent = $this->GetOptionalElement($oMenu, 'parent')) + if ($sParent = $oMenu->GetChildText('parent', null)) { - $aMenusToLoad[] = $oParent->GetAttribute('value'); + $aMenusToLoad[] = $sParent; } // Note: the order matters: the parents must be defined BEFORE $aMenusToLoad[] = $oMenu->GetAttribute('id'); @@ -192,7 +191,7 @@ EOF; } catch (ssDOMFormatException $e) { - $sMenu = $oMenu->getAttribute("name"); + $sMenu = $oMenu->getAttribute("id"); throw new Exception("Failed to process menu '$sMenu', from '$sModuleRootDir': ".$e->getMessage()); } } @@ -260,104 +259,6 @@ EOF; } } - - /** - * Helper to browse the DOM -could be factorized in ModelFactory - * Returns the node directly under the given node, and that is supposed to be always present and unique - */ - protected function GetUniqueElement($oDOMNode, $sTagName, $bMustExist = true) - { - $oNode = null; - if ($oDOMNode->hasChildNodes()) - { - foreach($oDOMNode->childNodes as $oChildNode) - { - if ($oChildNode->nodeName == $sTagName) - { - $oNode = $oChildNode; - break; - } - } - } - if ($bMustExist && is_null($oNode)) - { - throw new DOMFormatException('Missing unique tag: '.$sTagName); - } - return $oNode; - } - - /** - * Helper to browse the DOM -could be factorized in ModelFactory - * Returns the node directly under the given node, or null is missing - */ - protected function GetOptionalElement($oDOMNode, $sTagName) - { - return $this->GetUniqueElement($oDOMNode, $sTagName, false); - } - - - /** - * Helper to browse the DOM -could be factorized in ModelFactory - * Returns the TEXT of the given node (possibly from several subnodes) - */ - protected function GetNodeText($oNode) - { - $sText = ''; - if ($oNode->hasChildNodes()) - { - foreach($oNode->childNodes as $oChildNode) - { - if ($oChildNode instanceof DOMCharacterData) // Base class of DOMText and DOMCdataSection - { - $sText .= $oChildNode->wholeText; - } - } - } - return $sText; - } - - /** - * Helper to browse the DOM -could be factorized in ModelFactory - * Assumes the given node to be either a text or - * - * value - * value - * - * where value can be the either a text or an array of items... recursively - * Returns a PHP array - */ - protected function GetNodeAsArrayOfItems($oNode) - { - $oItems = $this->GetOptionalElement($oNode, 'items'); - if ($oItems) - { - $res = array(); - if ($oItems->hasChildNodes()) - { - foreach($oItems->childNodes as $oItem) - { - // When an attribute is msising - if ($oItem->hasAttributes() && $oItem->hasAttribute('key')) - { - $key = $oItem->getAttribute('key'); - $res[$key] = $this->GetNodeAsArrayOfItems($oItem); - } - else - { - $res[] = $this->GetNodeAsArrayOfItems($oItem); - } - } - } - } - else - { - $res = $this->GetNodeText($oNode); - } - return $res; - } - - - /** * Helper to format the flags for an attribute, in a given state * @param object $oAttNode DOM node containing the information to build the flags @@ -376,7 +277,7 @@ EOF; $aFlags = array(); foreach ($aNodeAttributeToFlag as $sNodeAttribute => $sFlag) { - $bFlag = ($oAttNode->GetAttribute($sNodeAttribute) == '1'); + $bFlag = ($oAttNode->GetOptionalElement($sNodeAttribute) != null); if ($bFlag) { $aFlags[] = $sFlag; @@ -426,22 +327,22 @@ EOF; protected function CompileClass($oClass, $sResFile, $sModuleRelativeDir, $oP) { - $sClass = $oClass->getAttribute('name'); - $oProperties = $this->GetUniqueElement($oClass, 'properties'); + $sClass = $oClass->getAttribute('id'); + $oProperties = $oClass->GetUniqueElement('properties'); // Class caracteristics // $aClassParams = array(); - $aClassParams['category'] = "'".$oClass->getAttribute('category')."'"; + $aClassParams['category'] = "'".$oProperties->GetChildText('category')."'"; $aClassParams['key_type'] = "'autoincrement'"; - $oNaming = $this->GetUniqueElement($oProperties, 'naming'); - $oNameAttributes = $this->GetUniqueElement($oNaming, 'attributes'); + $oNaming = $oProperties->GetUniqueElement('naming'); + $oNameAttributes = $oNaming->GetUniqueElement('attributes'); $oAttributes = $oNameAttributes->getElementsByTagName('attribute'); $aNameAttCodes = array(); foreach($oAttributes as $oAttribute) { - $aNameAttCodes[] = $oAttribute->getAttribute('name'); + $aNameAttCodes[] = $oAttribute->getAttribute('id'); } if (count($aNameAttCodes) > 1) { @@ -459,10 +360,10 @@ EOF; } $aClassParams['name_attcode'] = $sNameAttCode; - $oLifecycle = $this->GetOptionalElement($oClass, 'lifecycle'); + $oLifecycle = $oClass->GetOptionalElement('lifecycle'); if ($oLifecycle) { - $sStateAttCode = $oLifecycle->getAttribute('attribute'); + $sStateAttCode = $oLifecycle->GetChildText('attribute'); } else { @@ -470,43 +371,41 @@ EOF; } $aClassParams['state_attcode'] = "'$sStateAttCode'"; - $oReconciliation = $this->GetUniqueElement($oProperties, 'reconciliation'); + $oReconciliation = $oProperties->GetUniqueElement('reconciliation'); $oReconcAttributes = $oReconciliation->getElementsByTagName('attribute'); $aReconcAttCodes = array(); foreach($oReconcAttributes as $oAttribute) { - $aReconcAttCodes[] = $oAttribute->getAttribute('name'); + $aReconcAttCodes[] = $oAttribute->getAttribute('id'); } $sReconcKeys = "array('".implode("', '", $aReconcAttCodes)."')"; $aClassParams['reconc_keys'] = $sReconcKeys; - $aClassParams['db_table'] = "'".$oClass->getAttribute('db_table')."'"; - $aClassParams['db_key_field'] = "'".$oClass->getAttribute('db_key_field')."'"; - $aClassParams['db_finalclass_field'] = "'".$oClass->getAttribute('db_final_class_field')."'"; + $aClassParams['db_table'] = "'".$oProperties->GetChildText('db_table')."'"; + $aClassParams['db_key_field'] = "'".$oProperties->GetChildText('db_key_field')."'"; + $aClassParams['db_finalclass_field'] = "'".$oProperties->GetChildText('db_final_class_field')."'"; - $oDisplayTemplate = $this->GetOptionalElement($oProperties, 'display_template'); - if ($oDisplayTemplate && (strlen($oDisplayTemplate->textContent) > 0)) + if (($sDisplayTemplate = $oProperties->GetChildText('display_template')) && (strlen($sDisplayTemplate) > 0)) { - $sDisplayTemplate = $sModuleRelativeDir.'/'.$oDisplayTemplate->textContent; + $sDisplayTemplate = $sModuleRelativeDir.'/'.$sDisplayTemplate; $aClassParams['display_template'] = "utils::GetAbsoluteUrlModulesRoot().'$sDisplayTemplate'"; } - $oIcon = $this->GetOptionalElement($oProperties, 'icon'); - if ($oIcon && (strlen($oIcon->textContent) > 0)) + if (($sIcon = $oProperties->GetChildText('icon')) && (strlen($sIcon) > 0)) { - $sIcon = $sModuleRelativeDir.'/'.$oIcon->textContent; + $sIcon = $sModuleRelativeDir.'/'.$sIcon; $aClassParams['icon'] = "utils::GetAbsoluteUrlModulesRoot().'$sIcon'"; } - $oOrder = $this->GetOptionalElement($oProperties, 'order'); + $oOrder = $oProperties->GetOptionalElement('order'); if ($oOrder) { - $oColumnsNode = $this->GetUniqueElement($oOrder, 'columns'); + $oColumnsNode = $oOrder->GetUniqueElement('columns'); $oColumns = $oColumnsNode->getElementsByTagName('column'); $aSortColumns = array(); foreach($oColumns as $oColumn) { - $aSortColumns[] = "'".$oColumn->getAttribute('name')."' => ".(($oColumn->getAttribute('ascending') == 'true') ? 'true' : 'false'); + $aSortColumns[] = "'".$oColumn->getAttribute('id')."' => ".(($oColumn->getAttribute('ascending') == 'true') ? 'true' : 'false'); } if (count($aSortColumns) > 0) { @@ -526,15 +425,7 @@ EOF; // Comment on top of the class declaration // - $oComment = $this->GetOptionalElement($oProperties, 'comment'); - if ($oComment) - { - $sCodeComment = $oComment->textContent; - } - else - { - $sCodeComment = ''; - } + $sCodeComment = $oProperties->GetChildText('comment'); // Fields // @@ -542,17 +433,17 @@ EOF; foreach($this->oFactory->ListFields($oClass) as $oField) { // $oField - $sAttCode = $oField->getAttribute('name'); + $sAttCode = $oField->getAttribute('id'); $sAttType = $oField->getAttribute('xsi:type'); $aDependencies = array(); - $oDependencies = $this->GetOptionalElement($oField, 'dependencies'); + $oDependencies = $oField->GetOptionalElement('dependencies'); if (!is_null($oDependencies)) { $oDepNodes = $oDependencies->getElementsByTagName('attribute'); foreach($oDepNodes as $oDepAttribute) { - $aDependencies[] = "'".$oDepAttribute->getAttribute('name')."'"; + $aDependencies[] = "'".$oDepAttribute->getAttribute('id')."'"; } } $sDependencies = 'array('.implode(', ', $aDependencies).')'; @@ -561,31 +452,30 @@ EOF; if ($sAttType == 'AttributeLinkedSetIndirect') { - $aParameters['linked_class'] = "'".$oField->getAttribute('linked_class')."'"; - $aParameters['ext_key_to_me'] = "'".$oField->getAttribute('ext_key_to_me')."'"; - $aParameters['ext_key_to_remote'] = "'".$oField->getAttribute('ext_key_to_remote')."'"; + $aParameters['linked_class'] = "'".$oField->GetChildText('linked_class')."'"; + $aParameters['ext_key_to_me'] = "'".$oField->GetChildText('ext_key_to_me')."'"; + $aParameters['ext_key_to_remote'] = "'".$oField->GetChildText('ext_key_to_remote')."'"; // todo - utile ? $aParameters['allowed_values'] = 'null'; - $aParameters['count_min'] = $oField->getAttribute('count_min'); - $aParameters['count_max'] = $oField->getAttribute('count_max'); + $aParameters['count_min'] = $oField->GetChildText('count_min'); + $aParameters['count_max'] = $oField->GetChildText('count_max'); $aParameters['depends_on'] = $sDependencies; } elseif ($sAttType == 'AttributeLinkedSet') { - $aParameters['linked_class'] = "'".$oField->getAttribute('linked_class')."'"; - $aParameters['ext_key_to_me'] = "'".$oField->getAttribute('ext_key_to_me')."'"; + $aParameters['linked_class'] = "'".$oField->GetChildText('linked_class')."'"; + $aParameters['ext_key_to_me'] = "'".$oField->GetChildText('ext_key_to_me')."'"; // todo - utile ? $aParameters['allowed_values'] = 'null'; - $aParameters['count_min'] = $oField->getAttribute('count_min'); - $aParameters['count_max'] = $oField->getAttribute('count_max'); + $aParameters['count_min'] = $oField->GetChildText('count_min'); + $aParameters['count_max'] = $oField->GetChildText('count_max'); $aParameters['depends_on'] = $sDependencies; } elseif ($sAttType == 'AttributeExternalKey') { - $aParameters['targetclass'] = "'".$oField->getAttribute('target_class')."'"; - // todo = v�rifier l'utilit� + $aParameters['targetclass'] = "'".$oField->GetChildText('target_class')."'"; $aParameters['jointype'] = 'null'; - if (($sOql = $oField->getAttribute('filter')) != '') + if ($sOql = $oField->GetChildText('filter')) { $sEscapedOql = addslashes($sOql); $aParameters['allowed_values'] = "new ValueSetObjects('$sEscapedOql')"; // or "new ValueSetObjects('SELECT xxxx')" @@ -594,14 +484,14 @@ EOF; { $aParameters['allowed_values'] = 'null'; // or "new ValueSetObjects('SELECT xxxx')" } - $aParameters['sql'] = "'".$oField->getAttribute('sql')."'"; - $aParameters['is_null_allowed'] = $oField->getAttribute('is_null_allowed') == 'true' ? 'true' : 'false'; - $aParameters['on_target_delete'] = $oField->getAttribute('on_target_delete'); + $aParameters['sql'] = "'".$oField->GetChildText('sql')."'"; + $aParameters['is_null_allowed'] = $oField->GetChildText('is_null_allowed') == 'true' ? 'true' : 'false'; + $aParameters['on_target_delete'] = $oField->GetChildText('on_target_delete'); $aParameters['depends_on'] = $sDependencies; } elseif ($sAttType == 'AttributeHierarchicalKey') { - if (($sOql = $oField->getAttribute('filter')) != '') + if ($sOql = $oField->GetChildText('filter')) { $sEscapedOql = addslashes($sOql); $aParameters['allowed_values'] = "new ValueSetObjects('$sEscapedOql')"; // or "new ValueSetObjects('SELECT xxxx')" @@ -610,29 +500,29 @@ EOF; { $aParameters['allowed_values'] = 'null'; // or "new ValueSetObjects('SELECT xxxx')" } - $aParameters['sql'] = "'".$oField->getAttribute('sql')."'"; - $aParameters['is_null_allowed'] = $oField->getAttribute('is_null_allowed') == 'true' ? 'true' : 'false'; - $aParameters['on_target_delete'] = $oField->getAttribute('on_target_delete'); + $aParameters['sql'] = "'".$oField->GetChildText('sql')."'"; + $aParameters['is_null_allowed'] = $oField->GetChildText('is_null_allowed') == 'true' ? 'true' : 'false'; + $aParameters['on_target_delete'] = $oField->GetChildText('on_target_delete'); $aParameters['depends_on'] = $sDependencies; } elseif ($sAttType == 'AttributeExternalField') { $aParameters['allowed_values'] = 'null'; - $aParameters['extkey_attcode'] = "'".$oField->getAttribute('extkey_attcode')."'"; - $aParameters['target_attcode'] = "'".$oField->getAttribute('target_attcode')."'"; + $aParameters['extkey_attcode'] = "'".$oField->GetChildText('extkey_attcode')."'"; + $aParameters['target_attcode'] = "'".$oField->GetChildText('target_attcode')."'"; } elseif ($sAttType == 'AttributeURL') { - $aParameters['target'] = "'".$oField->getAttribute('target')."'"; + $aParameters['target'] = "'".$oField->GetChildText('target')."'"; $aParameters['allowed_values'] = 'null'; - $aParameters['sql'] = "'".$oField->getAttribute('sql')."'"; - $aParameters['default_value'] = "'".$oField->getAttribute('default_value')."'"; - $aParameters['is_null_allowed'] = $oField->getAttribute('is_null_allowed') == 'true' ? 'true' : 'false'; + $aParameters['sql'] = "'".$oField->GetChildText('sql')."'"; + $aParameters['default_value'] = "'".$oField->GetChildText('default_value')."'"; + $aParameters['is_null_allowed'] = $oField->GetChildText('is_null_allowed') == 'true' ? 'true' : 'false'; $aParameters['depends_on'] = $sDependencies; } elseif ($sAttType == 'AttributeEnum') { - $oValues = $this->GetUniqueElement($oField, 'values'); + $oValues = $oField->GetUniqueElement('values'); $oValueNodes = $oValues->getElementsByTagName('value'); $aValues = array(); foreach($oValueNodes as $oValue) @@ -643,9 +533,9 @@ EOF; // new style... $sValues = 'array('.implode(', ', $aValues).')'; $sValues = '"'.implode(',', $aValues).'"'; $aParameters['allowed_values'] = "new ValueSetEnum($sValues)"; - $aParameters['sql'] = "'".$oField->getAttribute('sql')."'"; - $aParameters['default_value'] = "'".$oField->getAttribute('default_value')."'"; - $aParameters['is_null_allowed'] = $oField->getAttribute('is_null_allowed') == 'true' ? 'true' : 'false'; + $aParameters['sql'] = "'".$oField->GetChildText('sql')."'"; + $aParameters['default_value'] = "'".$oField->GetChildText('default_value')."'"; + $aParameters['is_null_allowed'] = $oField->GetChildText('is_null_allowed') == 'true' ? 'true' : 'false'; $aParameters['depends_on'] = $sDependencies; } elseif ($sAttType == 'AttributeBlob') @@ -655,12 +545,12 @@ EOF; else { $aParameters['allowed_values'] = 'null'; // or "new ValueSetEnum('SELECT xxxx')" - $aParameters['sql'] = "'".$oField->getAttribute('sql')."'"; - $aParameters['default_value'] = "'".$oField->getAttribute('default_value')."'"; - $aParameters['is_null_allowed'] = $oField->getAttribute('is_null_allowed') == 'true' ? 'true' : 'false'; + $aParameters['sql'] = "'".$oField->GetChildText('sql')."'"; + $aParameters['default_value'] = "'".$oField->GetChildText('default_value')."'"; + $aParameters['is_null_allowed'] = $oField->GetChildText('is_null_allowed') == 'true' ? 'true' : 'false'; $aParameters['depends_on'] = $sDependencies; - if ($sValidationPattern = $oField->getAttribute('validation_pattern')) + if ($sValidationPattern = $oField->GetChildText('validation_pattern')) { $aParameters['validation_pattern'] = '"'.addslashes($sValidationPattern).'"'; } @@ -683,19 +573,19 @@ EOF; $sLifecycle .= "\t\t// Lifecycle (status attribute: $sStateAttCode)\n"; $sLifecycle .= "\t\t//\n"; - $oStimuli = $this->GetUniqueElement($oLifecycle, 'stimuli'); + $oStimuli = $oLifecycle->GetUniqueElement('stimuli'); foreach ($oStimuli->getElementsByTagName('stimulus') as $oStimulus) { - $sStimulus = $oStimulus->getAttribute('name'); - $sStimulusClass = $oStimulus->getAttribute('type'); + $sStimulus = $oStimulus->getAttribute('id'); + $sStimulusClass = $oStimulus->getAttribute('xsi:type'); $sLifecycle .= " MetaModel::Init_DefineStimulus(new ".$sStimulusClass."(\"".$sStimulus."\", array()));\n"; } - $oStates = $this->GetUniqueElement($oLifecycle, 'states'); + $oStates = $oLifecycle->GetUniqueElement('states'); foreach ($oStates->getElementsByTagName('state') as $oState) { - $sState = $oState->getAttribute('name'); + $sState = $oState->getAttribute('id'); $sLifecycle .= " MetaModel::Init_DefineState(\n"; $sLifecycle .= " \"".$sState."\",\n"; @@ -703,13 +593,13 @@ EOF; $sLifecycle .= " \"attribute_inherit\" => '',\n"; $sLifecycle .= " \"attribute_list\" => array(\n"; - $oFlags = $this->GetUniqueElement($oState, 'flags'); + $oFlags = $oState->GetUniqueElement('flags'); foreach ($oFlags->getElementsByTagName('attribute') as $oAttributeNode) { $sFlags = $this->FlagsToPHP($oAttributeNode); if (strlen($sFlags) > 0) { - $sAttCode = $oAttributeNode->GetAttribute('name'); + $sAttCode = $oAttributeNode->GetAttribute('id'); $sLifecycle .= " '$sAttCode' => $sFlags,\n"; } } @@ -718,17 +608,17 @@ EOF; $sLifecycle .= " )\n"; $sLifecycle .= " );\n"; - $oTransitions = $this->GetUniqueElement($oState, 'transitions'); + $oTransitions = $oState->GetUniqueElement('transitions'); foreach ($oTransitions->getElementsByTagName('transition') as $oTransition) { - $sStimulus = $oTransition->getAttribute('stimulus'); - $sTargetState = $oTransition->getAttribute('target'); + $sStimulus = $oTransition->GetChildText('stimulus'); + $sTargetState = $oTransition->GetChildText('target'); - $oActions = $this->GetUniqueElement($oTransition, 'actions'); + $oActions = $oTransition->GetUniqueElement('actions'); $aVerbs = array(); foreach ($oActions->getElementsByTagName('action') as $oAction) { - $sVerb = $oAction->getAttribute('verb'); + $sVerb = $oAction->GetChildText('verb'); $aVerbs[] = "'$sVerb'"; } $sActions = implode(', ', $aVerbs); @@ -745,14 +635,14 @@ EOF; 'list' => 'list' ); - $oPresentation = $this->GetUniqueElement($oClass, 'presentation'); + $oPresentation = $oClass->GetUniqueElement('presentation'); $sZlists = ''; foreach ($aListRef as $sListCode => $sListTag) { - $oListNode = $this->GetOptionalElement($oPresentation, $sListTag); + $oListNode = $oPresentation->GetOptionalElement($sListTag); if ($oListNode) { - $aAttributes = $this->GetNodeAsArrayOfItems($oListNode); + $aAttributes = $oListNode->GetNodeAsArrayOfItems(); $sZAttributes = var_export($aAttributes, true); $sZlists .= " MetaModel::Init_SetZListItems('$sListCode', $sZAttributes);\n"; @@ -761,14 +651,13 @@ EOF; // Methods $sMethods = ""; - $oMethods = $this->GetUniqueElement($oClass, 'methods'); + $oMethods = $oClass->GetUniqueElement('methods'); foreach($oMethods->getElementsByTagName('method') as $oMethod) { - $sMethodCode = $this->GetNodeText($oMethod); - $oMethodComment = $this->GetOptionalElement($oMethod, 'comment'); - if ($oMethodComment) + $sMethodCode = $oMethod->GetChildText('code'); + if ($sMethodComment = $oMethod->GetChildText('comment', null)) { - $sMethods .= "\n\t".$oMethodComment->textContent."\n".$sMethodCode."\n"; + $sMethods .= "\n\t$sMethodComment\n".$sMethodCode."\n"; } else { @@ -779,15 +668,15 @@ EOF; // Let's make the whole class declaration // $sPHP = "\n\n$sCodeComment\n"; - if ($oClass->getAttribute('abstract') == 'true') + if ($oProperties->GetChildText('abstract') == 'true') { - $sPHP .= 'abstract class '.$oClass->getAttribute('name'); + $sPHP .= 'abstract class '.$oClass->getAttribute('id'); } else { - $sPHP .= 'class '.$oClass->getAttribute('name'); + $sPHP .= 'class '.$oClass->getAttribute('id'); } - $sPHP .= " extends ".$oClass->getAttribute('parent')."\n"; + $sPHP .= " extends ".$oClass->GetUniqueElement('properties')->GetChildText('parent', 'DBObject')."\n"; $sPHP .= <<getAttribute("id"); $sMenuClass = $oMenu->getAttribute("xsi:type"); - $oParent = $this->GetOptionalElement($oMenu, 'parent'); - if ($oParent) + $sParent = $oMenu->GetChildText('parent', null); + if ($sParent) { - $sParent = $oParent->GetAttribute('value'); $sParentSpec = "\$__comp_menus__['$sParent']->GetIndex()"; } else @@ -827,45 +715,44 @@ EOF; $sParentSpec = '-1'; } - $fRank = $this->GetUniqueElement($oMenu, 'rank')->GetAttribute('value'); + $fRank = $oMenu->GetChildText('rank'); switch($sMenuClass) { case 'WebPageMenuNode': - $sUrl = $this->GetUniqueElement($oMenu, 'url')->GetAttribute('value'); + $sUrl = $oMenu->GetChildText('url'); $sUrlSpec = $this->PathToPHP($sUrl, $sModuleRelativeDir, true /* Url */); $sNewMenu = "new WebPageMenuNode('$sMenuId', $sUrlSpec, $sParentSpec, $fRank);"; break; case 'TemplateMenuNode': - $sTemplateFile = $this->GetUniqueElement($oMenu, 'template_file')->GetAttribute('value'); + $sTemplateFile = $oMenu->GetChildText('template_file'); $sTemplateSpec = $this->PathToPHP($sTemplateFile, $sModuleRelativeDir); $sNewMenu = "new TemplateMenuNode('$sMenuId', $sTemplateSpec, $sParentSpec, $fRank);"; break; case 'OQLMenuNode': - $sOQL = $this->GetUniqueElement($oMenu, 'oql')->GetAttribute('value'); - $bSearch = ($this->GetUniqueElement($oMenu, 'do_search')->GetAttribute('value') == '1') ? 'true' : 'false'; + $sOQL = $oMenu->GetChildText('oql'); + $bSearch = ($oMenu->GetChildText('do_search') == '1') ? 'true' : 'false'; $sNewMenu = "new OQLMenuNode('$sMenuId', '$sOQL', $sParentSpec, $fRank, $bSearch);"; break; case 'NewObjectMenuNode': - $sClass = $this->GetUniqueElement($oMenu, 'class')->GetAttribute('value'); + $sClass = $oMenu->GetChildText('class'); $sNewMenu = "new NewObjectMenuNode('$sMenuId', '$sClass', $sParentSpec, $fRank);"; break; case 'SearchMenuNode': - $sClass = $this->GetUniqueElement($oMenu, 'class')->GetAttribute('value'); + $sClass = $oMenu->GetChildText('class'); $sNewMenu = "new SearchMenuNode('$sMenuId', '$sClass', $sParentSpec, $fRank);"; break; case 'MenuGroup': default: - if ($oEnableClass = $this->GetOptionalElement($oMenu, 'enable_class')) + if ($sEnableClass = $oMenu->GetChildText('enable_class')) { - $sEnableClass = $oEnableClass->GetAttribute('value'); - $sEnableAction = $this->GetUniqueElement($oMenu, 'enable_action')->GetAttribute('value'); - $sEnablePermission = $this->GetUniqueElement($oMenu, 'enable_permission')->GetAttribute('value'); - $sEnableStimulus = $this->GetUniqueElement($oMenu, 'enable_stimulus')->GetAttribute('value'); + $sEnableAction = $oMenu->GetChildText('enable_action'); + $sEnablePermission = $oMenu->GetChildText('enable_permission'); + $sEnableStimulus = $oMenu->GetChildText('enable_stimulus'); if (strlen($sEnableStimulus) > 0) { $sNewMenu = "new MenuGroup('$sMenuId', $fRank, '$sEnableClass', $sEnableAction, $sEnablePermission, '$sEnableStimulus');"; @@ -884,14 +771,14 @@ EOF; $sIndent = ''; $aPHPMenu = array("\$__comp_menus__['$sMenuId'] = $sNewMenu"); - if ($oAutoReload = $this->GetOptionalElement($oMenu, 'auto_reload')) + if ($sAutoReload = $oMenu->GetChildText('auto_reload')) { - $sAutoReload = addslashes($oAutoReload->GetAttribute("value")); + $sAutoReload = addslashes($sAutoReload); $aPHPMenu[] = "\$__comp_menus__['$sMenuId']->SetParameters(array('auto_reload' => '$sAutoReload'));"; } - $oAdminOnly = $this->GetOptionalElement($oMenu, 'enable_admin_only'); - if ($oAdminOnly && $oAdminOnly->GetAttribute('value') == '1') + $sAdminOnly = $oMenu->GetChildText('enable_admin_only'); + if ($sAdminOnly && ($sAdminOnly == '1')) { $sPHP = $sIndent."if (UserRights::IsAdministrator())\n"; $sPHP .= $sIndent."{\n"; diff --git a/setup/itop_design.xsd b/setup/itop_design.xsd index 36c13f897..92febcdc9 100644 --- a/setup/itop_design.xsd +++ b/setup/itop_design.xsd @@ -15,12 +15,20 @@ + + + + + + + + + - @@ -40,8 +48,11 @@ - - + + + + + @@ -64,15 +75,12 @@ + + - - - - - - + @@ -88,12 +96,14 @@ - - - - - - + + + + + + + + @@ -106,27 +116,29 @@ + + - + + + - - - + @@ -134,7 +146,6 @@ - @@ -144,11 +155,12 @@ + + + + - - - - + @@ -164,15 +176,7 @@ - - - - - - - - - + @@ -195,7 +199,7 @@ - + @@ -206,23 +210,37 @@ + + + + + + + + - + - - + + + + + - + + + + @@ -230,7 +248,8 @@ - + + @@ -288,7 +307,9 @@ - + + + @@ -303,25 +324,6 @@ - - - - - - - - - - - - - - - - - - - @@ -329,25 +331,39 @@ - - - + + + + + + + + + - + + + + + + + - - - + + + + + @@ -362,10 +378,12 @@ - - - - + + + + + + @@ -373,11 +391,18 @@ + + + + + + + @@ -392,12 +417,34 @@ - + + + + + + + + + + + + + + + + + + + + + + + @@ -486,7 +533,10 @@ - + + + + diff --git a/setup/modelfactory.class.inc.php b/setup/modelfactory.class.inc.php index a1b2c0cdd..eaeb0f5a0 100644 --- a/setup/modelfactory.class.inc.php +++ b/setup/modelfactory.class.inc.php @@ -284,6 +284,7 @@ class ModelFactory { $this->sRootDir = $sRootDir; $this->oDOMDocument = new DOMDocument('1.0', 'UTF-8'); + $this->oDOMDocument->registerNodeClass('DOMElement', 'MFDOMElement'); $this->oRoot = $this->oDOMDocument->CreateElement('itop_design'); $this->oDOMDocument->AppendChild($this->oRoot); $this->oClasses = $this->oDOMDocument->CreateElement('classes'); @@ -319,6 +320,7 @@ class ModelFactory foreach($aDataModels as $sXmlFile) { $oDocument = new DOMDocument('1.0', 'UTF-8'); + $oDocument->registerNodeClass('DOMElement', 'MFDOMElement'); libxml_clear_errors(); $oDocument->load($sXmlFile, LIBXML_NOBLANKS); $bValidated = $oDocument->schemaValidate(APPROOT.'setup/itop_design.xsd'); @@ -326,6 +328,7 @@ class ModelFactory if (count($aErrors) > 0) { self::$aLoadErrors[$sModuleName] = $aErrors; + return; } $oXPath = new DOMXPath($oDocument); @@ -338,15 +341,8 @@ class ModelFactory $oNodeList = $oXPath->query('/itop_design/classes/class'); foreach($oNodeList as $oNode) { - if ($oNode->hasAttribute('parent')) - { - $sParentClass = $oNode->GetAttribute('parent'); - } - else - { - $sParentClass = ''; - } - $sClassName = $oNode->GetAttribute('name'); + $sParentClass = $oNode->GetUniqueElement('properties')->GetChildText('parent', ''); + $sClassName = $oNode->GetAttribute('id'); $aClasses[$sClassName] = array('name' => $sClassName, 'parent' => $sParentClass, 'node' => $oNode); } @@ -474,9 +470,9 @@ class ModelFactory */ protected function ClassExists(DOMNode $oClassNode) { - if ($oClassNode->hasAttribute('name')) + if ($oClassNode->hasAttribute('id')) { - $sClassName = $oClassNode->GetAttribute('name'); + $sClassName = $oClassNode->GetAttribute('id'); } else { @@ -504,9 +500,9 @@ class ModelFactory */ public function AddClass(DOMNode $oClassNode, $sModuleName) { - if ($oClassNode->hasAttribute('name')) + if ($oClassNode->hasAttribute('id')) { - $sClassName = $oClassNode->GetAttribute('name'); + $sClassName = $oClassNode->GetAttribute('id'); } else { @@ -517,11 +513,7 @@ class ModelFactory throw new Exception("ModelFactory::AddClass: Cannot add the already existing class $sClassName"); } - $sParentClass = ''; - if ($oClassNode->hasAttribute('parent')) - { - $sParentClass = $oClassNode->GetAttribute('parent'); - } + $sParentClass = $oClassNode->GetUniqueElement('properties')->GetChildText('parent', ''); //echo "Adding class: $sClassName, parent: $sParentClass
"; if (!in_array($sParentClass, self::$aWellKnownParents) && $this->ClassNameExists($sParentClass)) @@ -549,7 +541,7 @@ class ModelFactory } else { - throw new Exception("ModelFactory::AddClass: Cannot add the class $sClassName, unknown parent class: $sParentClass"); + throw new Exception("ModelFactory::AddClass: Cannot add the class $sClassName, unknown parent class: $sParentClass (loaded classes: ".implode(', ', array_keys(self::$aLoadedClasses)).")"); } } @@ -605,7 +597,7 @@ class ModelFactory } } $this->_priv_AlterNode($oDestNode, $oClassNode); - $sClassName = $oDestNode->getAttribute('name'); + $sClassName = $oDestNode->getAttribute('id'); if ($sOriginalName != $sClassName) { unset(self::$aLoadedClasses[$sOriginalName]); @@ -711,10 +703,10 @@ class ModelFactory { $sOperation = $oChildNode->getAttribute('_operation'); $sPath = $oChildNode->tagName; - $sName = $oChildNode->getAttribute('name'); + $sName = $oChildNode->getAttribute('id'); if ($sName != '') { - $sPath .= "[@name='$sName']"; + $sPath .= "[@id='$sName']"; } switch($sOperation) { @@ -762,15 +754,17 @@ class ModelFactory return << - - + + + $sIcon +
@@ -857,15 +851,15 @@ EOF $oClassNode = null; } } - $sXPath = "fields/field[@name='$sAttCode']"; + $sXPath = "fields/field[@id='$sAttCode']"; if ($bFlattenLayers) { - $sXPath = "fields/field[(@name='$sAttCode' and (not(@_operation) or @_operation!='removed'))]"; + $sXPath = "fields/field[(@id='$sAttCode' and (not(@_operation) or @_operation!='removed'))]"; } $oFieldNode = $this->_priv_GetNodes($sXPath, $oClassNode)->item(0); - if (($oFieldNode == null) && ($oClassNode->getAttribute('parent') != '')) + if (($oFieldNode == null) && ($sParentClass = $oClassNode->GetUniqueElement('properties')->GetChildText('parent'))) { - return $this->GetField($oClassNode->getAttribute('parent'), $sAttCode, $bFlattenLayers); + return $this->GetField($sParentClass, $sAttCode, $bFlattenLayers); } return $oFieldNode; } @@ -888,7 +882,7 @@ EOF public function AddField(DOMNode $oClassNode, $sFieldCode, $sFieldType, $sSQL, $defaultValue, $bIsNullAllowed, $aExtraParams) { $oNewField = $this->oDOMDocument->createElement('field'); - $oNewField->setAttribute('name', $sFieldCode); + $oNewField->setAttribute('id', $sFieldCode); $this->_priv_AlterField($oNewField, $sFieldType, $sSQL, $defaultValue, $bIsNullAllowed, $aExtraParams); $oFields = $oClassNode->getElementsByTagName('fields')->item(0); $oFields->AppendChild($oNewField); @@ -897,7 +891,7 @@ EOF public function RemoveField(DOMNode $oClassNode, $sFieldCode) { - $sXPath = "fields/field[@name='$sFieldCode']"; + $sXPath = "fields/field[@id='$sFieldCode']"; $oFieldNodes = $this->_priv_GetNodes($sXPath, $oClassNode); if (is_object($oFieldNodes) && (is_object($oFieldNodes->item(0)))) { @@ -916,7 +910,7 @@ EOF public function AlterField(DOMNode $oClassNode, $sFieldCode, $sFieldType, $sSQL, $defaultValue, $bIsNullAllowed, $aExtraParams) { - $sXPath = "fields/field[@name='$sFieldCode']"; + $sXPath = "fields/field[@id='$sFieldCode']"; $oFieldNodes = $this->_priv_GetNodes($sXPath, $oClassNode); if (is_object($oFieldNodes) && (is_object($oFieldNodes->item(0)))) { @@ -1031,7 +1025,7 @@ EOF foreach($aDeps as $sAttCode) { $oDep = $this->oDOMDocument->createElement('attribute'); - $oDep->setAttribute('name', $sAttCode); + $oDep->setAttribute('id', $sAttCode); $oDependencies->addChild($oDep); } $oFieldNode->addChild($oDependencies); @@ -1225,7 +1219,7 @@ EOF case 'removed': // marked as deleted, let's remove the node from the tree $oParent = $oClassNode->parentNode; - $sClass = $oClassNode->GetAttribute('name'); + $sClass = $oClassNode->GetAttribute('id'); echo "Calling removeChild...
"; $oParent->removeChild($oClassNode); unset(self::$aLoadedClasses[$sClass]); @@ -1246,6 +1240,7 @@ EOF public function GetDelta() { $oDelta = new DOMDocument('1.0', 'UTF-8'); + $oDelta->registerNodeClass('DOMElement', 'MFDOMElement'); $oRootNode = $oDelta->createElement('itop_design'); $oDelta->appendChild($oRootNode); $oClasses = $oDelta->createElement('classes'); @@ -1272,7 +1267,7 @@ EOF } else { - $sName = $oChildNode->getAttribute('name');; + $sName = $oChildNode->getAttribute('id');; $sOperation = $oChildNode->getAttribute('_operation'); } @@ -1292,18 +1287,18 @@ echo str_repeat('+', $iDepth)." $sNodeName [$sName], operation: $sOperation\n"; { $oDestNode->appendChild($oDeletedNode); } -echo "

".str_repeat('+', $iDepth).$oChildNode->getAttribute('name')." was removed...

"; +echo "

".str_repeat('+', $iDepth).$oChildNode->getAttribute('id')." was removed...

"; break; case 'added': -echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('name')." was created...

"; +echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('id')." was created...

"; $oModifiedNode = $oDoc->importNode($oChildNode, true); // Copies all the node's attributes, and the child nodes as well if ($oChildNode instanceof DOMElement) { $oModifiedNode->removeAttribute('_source'); if ($oModifiedNode->tagName == 'class') { -echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('name')." inserting under 'classes'...

"; +echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('id')." inserting under 'classes'...

"; // classes are always located under the root node $oDoc->firstChild->appendChild($oModifiedNode); @@ -1322,7 +1317,7 @@ echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAtt } else { -echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('name')." inserting in the hierarchy...

"; +echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('id')." inserting in the hierarchy...

"; $oDestNode->appendChild($oModifiedNode); } } @@ -1333,7 +1328,7 @@ echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAtt break; case 'replaced': -echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('name')." was replaced...

"; +echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('id')." was replaced...

"; $oModifiedNode = $oDoc->importNode($oChildNode, true); // Copies all the node's attributes, and the child nodes as well if ($oChildNode instanceof DOMElement) { @@ -1343,7 +1338,7 @@ echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAtt break; case 'modified': -echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('name')." was modified...

"; +echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('id')." was modified...

"; if ($oChildNode instanceof DOMElement) { echo str_repeat('+', $iDepth)." Copying (NON recursively) the modified node\n"; @@ -1370,11 +1365,11 @@ echo str_repeat('+', $iDepth)." Copying (recursively) the modified node\n"; default: // No change: do nothing -echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('name')." was NOT modified...

"; +echo "

".str_repeat('+', $iDepth).$oChildNode->tagName.':'.$oChildNode->getAttribute('id')." was NOT modified...

"; $oModifiedNode = $oDoc->importNode($oChildNode, true); // Importing the node for future recusrsion if needed if ($oChildNode->tagName == 'class') { -echo "

".str_repeat('+', $iDepth)."Checking if a subclass of ".$oChildNode->getAttribute('name')." was modified...

"; +echo "

".str_repeat('+', $iDepth)."Checking if a subclass of ".$oChildNode->getAttribute('id')." was modified...

"; // classes are always located under the root node $this->_priv_ImportModifiedChildren($oDoc, $oModifiedNode, $oChildNode); } @@ -1454,15 +1449,22 @@ echo "

".str_repeat('+', $iDepth)."Checking if a subclass of ".$oChildNode->ge public function _priv_SetNodeAttribute(DOMNode $oNode, $sAttributeName, $atttribueValue) { } - +} + + +/** + * MFDOMElement: helper to read the information from the DOM + * @package ModelFactory + */ +class MFDOMElement extends DOMElement +{ /** - * Helper to browse the DOM -could be factorized in ModelFactory - * Returns the node directly under the given node, and that is supposed to be always present and unique + * Returns the node directly under the given node */ - protected function GetUniqueElement($oDOMNode, $sTagName, $bMustExist = true) + public function GetUniqueElement($sTagName, $bMustExist = true) { $oNode = null; - foreach($oDOMNode->childNodes as $oChildNode) + foreach($this->childNodes as $oChildNode) { if ($oChildNode->nodeName == $sTagName) { @@ -1478,35 +1480,53 @@ echo "

".str_repeat('+', $iDepth)."Checking if a subclass of ".$oChildNode->ge } /** - * Helper to browse the DOM -could be factorized in ModelFactory - * Returns the node directly under the given node, or null is missing + * Returns the node directly under the current node, or null if missing */ - protected function GetOptionalElement($oDOMNode, $sTagName) + public function GetOptionalElement($sTagName) { - return $this->GetUniqueElement($oDOMNode, $sTagName, false); + return $this->GetUniqueElement($sTagName, false); } /** - * Helper to browse the DOM -could be factorized in ModelFactory - * Returns the TEXT of the given node (possibly from several subnodes) + * Returns the TEXT of the current node (possibly from several subnodes) */ - protected function GetNodeText($oNode) + public function GetText($sDefault = null) { - $sText = ''; - foreach($oNode->childNodes as $oChildNode) + $sText = null; + foreach($this->childNodes as $oChildNode) { if ($oChildNode instanceof DOMCharacterData) // Base class of DOMText and DOMCdataSection { + if (is_null($sText)) $sText = ''; $sText .= $oChildNode->wholeText; } } - return $sText; + if (is_null($sText)) + { + return $sDefault; + } + else + { + return $sText; + } } /** - * Helper to browse the DOM -could be factorized in ModelFactory - * Assumes the given node to be either a text or + * Get the TEXT value from the child node + */ + public function GetChildText($sTagName, $sDefault = null) + { + $sRet = $sDefault; + if ($oChild = $this->GetOptionalElement($sTagName)) + { + $sRet = $oChild->GetText($sDefault); + } + return $sRet; + } + + /** + * Assumes the current node to be either a text or * * value * value @@ -1514,31 +1534,30 @@ echo "

".str_repeat('+', $iDepth)."Checking if a subclass of ".$oChildNode->ge * where value can be the either a text or an array of items... recursively * Returns a PHP array */ - public function GetNodeAsArrayOfItems($oNode) + public function GetNodeAsArrayOfItems() { - $oItems = $this->GetOptionalElement($oNode, 'items'); + $oItems = $this->GetOptionalElement('items'); if ($oItems) { $res = array(); foreach($oItems->childNodes as $oItem) { // When an attribute is missing - if ($oItem->hasAttribute('key')) + if ($oItem->hasAttribute('id')) { - $key = $oItem->getAttribute('key'); - $res[$key] = $this->GetNodeAsArrayOfItems($oItem); + $key = $oItem->getAttribute('id'); + $res[$key] = $oItem->GetNodeAsArrayOfItems(); } else { - $res[] = $this->GetNodeAsArrayOfItems($oItem); + $res[] = $oItem->GetNodeAsArrayOfItems(); } } } else { - $res = $this->GetNodeText($oNode); + $res = $this->GetText(); } return $res; } - } \ No newline at end of file