public function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { if (!$this->IsNew()) { $oPage->SetCurrentTab(Dict::S('Core:SynchroAttributes')); $oAttributeSet = $this->Get('attribute_list'); $aAttributes = array(); while ($oAttribute = $oAttributeSet->Fetch()) { $aAttributes[$oAttribute->Get('attcode')] = $oAttribute; } // Columns of the form $aAttribs = array(); foreach (array('attcode', 'reconciliation', 'update', 'update_policy', 'reconciliation_attcode') as $s) { $aAttribs[$s] = array('label' => Dict::S("Core:SynchroAtt:{$s}"), "description" => Dict::S("Core:SynchroAtt:{$s}+")); } // Rows of the form $aValues = array(); foreach (MetaModel::ListAttributeDefs($this->GetTargetClass()) as $sAttCode => $oAttDef) { if ($oAttDef->IsWritable()) { if (isset($aAttributes[$sAttCode])) { $oAttribute = $aAttributes[$sAttCode]; } else { if ($oAttDef->IsExternalKey()) { $oAttribute = new SynchroAttExtKey(); $oAttribute->Set('reconciliation_attcode', ''); // Blank means by pkey } elseif ($oAttDef->IsLinkSet() && $oAttDef->IsIndirect()) { $oAttribute = new SynchroAttLinkSet(); // Todo - add these settings into the form $oAttribute->Set('row_separator', MetaModel::GetConfig()->Get('link_set_item_separator')); $oAttribute->Set('attribute_separator', MetaModel::GetConfig()->Get('link_set_attribute_separator')); $oAttribute->Set('value_separator', MetaModel::GetConfig()->Get('link_set_value_separator')); $oAttribute->Set('attribute_qualifier', MetaModel::GetConfig()->Get('link_set_attribute_qualifier')); } elseif ($oAttDef->IsScalar()) { $oAttribute = new SynchroAttribute(); } else { $oAttribute = null; } if (!is_null($oAttribute)) { $oAttribute->Set('sync_source_id', $this->GetKey()); $oAttribute->Set('attcode', $sAttCode); $oAttribute->Set('reconcile', MetaModel::IsReconcKey($this->GetTargetClass(), $sAttCode) ? 1 : 0); $oAttribute->Set('update', 1); $oAttribute->Set('update_policy', 'master_locked'); } } if (!is_null($oAttribute)) { if (!$bEditMode) { // Read-only mode $aRow['reconciliation'] = $oAttribute->Get('reconcile') == 1 ? Dict::S('Core:SynchroReconcile:Yes') : Dict::S('Core:SynchroReconcile:No'); $aRow['update'] = $oAttribute->Get('update') == 1 ? Dict::S('Core:SynchroUpdate:Yes') : Dict::S('Core:SynchroUpdate:No'); $aRow['attcode'] = MetaModel::GetLabel($this->GetTargetClass(), $oAttribute->Get('attcode')) . ' (' . $oAttribute->Get('attcode') . ')'; $aRow['update_policy'] = $oAttribute->GetAsHTML('update_policy'); if ($oAttDef->IsExternalKey()) { $aRow['reconciliation_attcode'] = $oAttribute->GetAsHTML('reconciliation_attcode'); } else { $aRow['reconciliation_attcode'] = ' '; } } else { // Edit mode $sAttCode = $oAttribute->Get('attcode'); $sChecked = $oAttribute->Get('reconcile') == 1 ? 'checked' : ''; $aRow['reconciliation'] = "<input type=\"checkbox\" name=\"reconciliation[{$sAttCode}]\" {$sChecked}/>"; $sChecked = $oAttribute->Get('update') == 1 ? 'checked' : ''; $aRow['update'] = "<input type=\"checkbox\" name=\"update[{$sAttCode}]\" {$sChecked}/>"; $aRow['attcode'] = MetaModel::GetLabel($this->GetTargetClass(), $oAttribute->Get('attcode')) . ' (' . $oAttribute->Get('attcode') . ')'; $oUpdateAttDef = MetaModel::GetAttributeDef(get_class($oAttribute), 'update_policy'); $aRow['update_policy'] = cmdbAbstractObject::GetFormElementForField($oPage, get_class($oAttribute), 'update_policy', $oUpdateAttDef, $oAttribute->Get('update_policy'), '', 'update_policy_' . $sAttCode, "[{$sAttCode}]"); if ($oAttDef->IsExternalKey()) { $aRow['reconciliation_attcode'] = $oAttribute->GetReconciliationFormElement($oAttDef->GetTargetClass(), "attr_reconciliation_attcode[{$sAttCode}]"); } else { $aRow['reconciliation_attcode'] = ' '; } } $aValues[] = $aRow; } } } $oPage->p(Dict::Format('Class:SynchroDataSource:DataTable', $this->GetDataTable())); $oPage->Table($aAttribs, $aValues); $this->DisplayStatusTab($oPage); } parent::DisplayBareRelations($oPage, $bEditMode); }
function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); if (!$bEditMode) { $oPage->SetCurrentTab(Dict::S('Class:Subnet/Tab:IPUsage')); $bit_ip = ip2long($this->Get('ip')); $bit_mask = ip2long($this->Get('ip_mask')); $iIPMin = sprintf('%u', $bit_ip & $bit_mask | 1); // exclude the first one: identifies the subnet itself $iIPMax = sprintf('%u', ($bit_ip | ~$bit_mask) & 0xfffffffe); // exclude the last one : broadcast address $sIPMin = long2ip($iIPMin); $sIPMax = long2ip($iIPMax); $oPage->p(Dict::Format('Class:Subnet/Tab:IPUsage-explain', $sIPMin, $sIPMax)); $oIfFilter = DBObjectSearch::FromOQL("SELECT IPInterface AS if WHERE INET_ATON(if.ipaddress) >= INET_ATON('{$sIPMin}') AND INET_ATON(if.ipaddress) <= INET_ATON('{$sIPMax}')"); $oIfSet = new CMDBObjectSet($oIfFilter); $oBlock = new DisplayBlock($oIfFilter, 'list', false); $oBlock->Display($oPage, 'nwif', array('menu' => false)); $iCountUsed = $oIfSet->Count(); $iCountRange = $iIPMax - $iIPMin; // On 32-bit systems the substraction will be computed using floats for values greater than PHP_MAX_INT; $iFreeCount = $iCountRange - $iCountUsed; $oPage->SetCurrentTab(Dict::S('Class:Subnet/Tab:FreeIPs')); $oPage->p(Dict::Format('Class:Subnet/Tab:FreeIPs-count', $iFreeCount)); $oPage->p(Dict::S('Class:Subnet/Tab:FreeIPs-explain')); $aUsedIPs = $oIfSet->GetColumnAsArray('ipaddress', false); $iAnIP = $iIPMin; $iFound = 0; while ($iFound < min($iFreeCount, 10) && $iAnIP <= $iIPMax) { $sAnIP = long2ip($iAnIP); if (!in_array($sAnIP, $aUsedIPs)) { $iFound++; $oPage->p($sAnIP); } else { } $iAnIP++; } } }
public function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); if (!$bEditMode) { $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/fraphael.js'); $oPage->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot() . 'css/jquery.contextMenu.css'); $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/jquery.contextMenu.js'); $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/simple_graph.js'); $oPage->AddAjaxTab(Dict::S('Ticket:ImpactAnalysis'), utils::GetAbsoluteUrlAppRoot() . 'pages/ajax.render.php?operation=ticket_impact&class=' . get_class($this) . '&id=' . $this->GetKey(), true); } }
function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); if (!$bEditMode) { $oPage->SetCurrentTab(Dict::S('UI:UserManagement:GrantMatrix')); $this->DoShowGrantSumary($oPage, 'bizmodel'); // debug if (false) { $oPage->SetCurrentTab('More on user rigths (dev only)'); $oPage->add("<h3>User rights</h3>\n"); $this->DoShowGrantSumary($oPage, 'addon/userrights'); $oPage->add("<h3>Change log</h3>\n"); $this->DoShowGrantSumary($oPage, 'core/cmdb'); $oPage->add("<h3>Application</h3>\n"); $this->DoShowGrantSumary($oPage, 'application'); $oPage->add("<h3>GUI</h3>\n"); $this->DoShowGrantSumary($oPage, 'gui'); } } }
public function DisplayBareRelations(WebPage $oPage, $bEditMode = false) { parent::DisplayBareRelations($oPage, $bEditMode); // Display the impact analysis for tickets not in 'closed' or 'resolved' status... and not in edition if (!$bEditMode && !in_array($this->Get('status'), array('resolved', 'closed'))) { $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/fraphael.js'); $oPage->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot() . 'css/jquery.contextMenu.css'); $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/jquery.contextMenu.js'); $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot() . 'js/simple_graph.js'); $oPage->AddAjaxTab(Dict::S('Ticket:ImpactAnalysis'), utils::GetAbsoluteUrlAppRoot() . 'pages/ajax.render.php?operation=ticket_impact&class=' . get_class($this) . '&id=' . $this->GetKey(), true); } }