|
@@ -500,6 +500,148 @@ function DisplayMultipleSelectionForm($oP, $oFilter, $sNextOperation, $oChecker,
|
|
|
$oP->add_ready_script("$('#1 table.listResults').trigger('check_all');");
|
|
|
}
|
|
|
|
|
|
+function DisplayNavigatorListTab($oP, $aResults, $sRelation, $oObj)
|
|
|
+{
|
|
|
+ $oP->SetCurrentTab(Dict::S('UI:RelationshipList'));
|
|
|
+ $oP->add("<div id=\"impacted_objects\" style=\"width:100%;background-color:#fff;padding:10px;\">");
|
|
|
+ $iBlock = 1; // Zero is not a valid blockid
|
|
|
+ foreach($aResults as $sListClass => $aObjects)
|
|
|
+ {
|
|
|
+ $oSet = CMDBObjectSet::FromArray($sListClass, $aObjects);
|
|
|
+ $oP->add("<h1>".MetaModel::GetRelationDescription($sRelation).' '.$oObj->GetName()."</h1>\n");
|
|
|
+ $oP->add("<div class=\"page_header\">\n");
|
|
|
+ $oP->add("<h2>".MetaModel::GetClassIcon($sListClass)." <span class=\"hilite\">".Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', count($aObjects), Metamodel::GetName($sListClass))."</h2>\n");
|
|
|
+ $oP->add("</div>\n");
|
|
|
+ $oBlock = DisplayBlock::FromObjectSet($oSet, 'list');
|
|
|
+ $oBlock->Display($oP, $iBlock++);
|
|
|
+ $oP->P(' '); // Some space ?
|
|
|
+ }
|
|
|
+ $oP->add("</div>");
|
|
|
+}
|
|
|
+
|
|
|
+function DisplayNavigatorGraphicsTab($oP, $aResults, $sClass, $id, $sRelation, $oAppContext)
|
|
|
+{
|
|
|
+ $oP->SetCurrentTab(Dict::S('UI:RelationshipGraph'));
|
|
|
+
|
|
|
+ $oP->add("<div id=\"ds_flash\" class=\"SearchDrawer\">\n");
|
|
|
+ $oP->add_ready_script(
|
|
|
+<<<EOF
|
|
|
+ $("#dh_flash").click( function() {
|
|
|
+ $("#ds_flash").slideToggle('normal', function() { $("#ds_flash").parent().resize(); } );
|
|
|
+ $("#dh_flash").toggleClass('open');
|
|
|
+ });
|
|
|
+EOF
|
|
|
+ );
|
|
|
+ $aSortedElements = array();
|
|
|
+ foreach($aResults as $sClassIdx => $aObjects)
|
|
|
+ {
|
|
|
+ foreach($aObjects as $oCurrObj)
|
|
|
+ {
|
|
|
+ $sSubClass = get_class($oCurrObj);
|
|
|
+ $aSortedElements[$sSubClass] = MetaModel::GetName($sSubClass);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ asort($aSortedElements);
|
|
|
+ $idx = 0;
|
|
|
+ foreach($aSortedElements as $sSubClass => $sClassName)
|
|
|
+ {
|
|
|
+ $oP->add("<span style=\"padding-right:2em; white-space:nowrap;\"><input type=\"checkbox\" id=\"exclude_$idx\" name=\"excluded[]\" value=\"$sSubClass\" checked onChange=\"$('#ReloadMovieBtn').button('enable')\"><label for=\"exclude_$idx\"> ".MetaModel::GetClassIcon($sSubClass)." $sClassName</label></span> ");
|
|
|
+ $idx++;
|
|
|
+ }
|
|
|
+ $oP->add("<p style=\"text-align:right\"><button type=\"button\" id=\"ReloadMovieBtn\" onClick=\"DoReload()\">".Dict::S('UI:Button:Refresh')."</button></p>");
|
|
|
+ $oP->add("</div>\n");
|
|
|
+ $oP->add("<div class=\"HRDrawer\"></div>\n");
|
|
|
+ $oP->add("<div id=\"dh_flash\" class=\"DrawerHandle\">".Dict::S('UI:ElementsDisplayed')."</div>\n");
|
|
|
+
|
|
|
+ $width = 1000;
|
|
|
+ $height = 700;
|
|
|
+ $sDrillUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=details&'.$oAppContext->GetForLink();
|
|
|
+ $sParams = "pWidth=$width&pHeight=$height&drillUrl=".urlencode($sDrillUrl)."&displayController=false&xmlUrl=".urlencode("./xml.navigator.php")."&obj_class=$sClass&obj_id=$id&relation=$sRelation";
|
|
|
+
|
|
|
+ $oP->add("<div style=\"z-index:1;background:white;width:100%;height:{$height}px\"><object style=\"z-index:2\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"100%\" height=\"$height\" id=\"navigator\" align=\"middle\">
|
|
|
+ <param name=\"allowScriptAccess\" value=\"always\" />
|
|
|
+ <param name=\"allowFullScreen\" value=\"false\" />
|
|
|
+ <param name=\"FlashVars\" value=\"$sParams\" />
|
|
|
+ <param name=\"wmode\" value=\"transparent\">
|
|
|
+ <param name=\"movie\" value=\"../navigator/navigator.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" />
|
|
|
+ <embed src=\"../navigator/navigator.swf\" wmode=\"transparent\" flashVars=\"$sParams\" quality=\"high\" bgcolor=\"#ffffff\" width=\"100%\" height=\"$height\" name=\"navigator\" align=\"middle\" swliveconnect=\"true\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" />
|
|
|
+ </object></div>\n");
|
|
|
+ $oP->add_script(
|
|
|
+<<<EOF
|
|
|
+function getFlashMovieObject(movieName)
|
|
|
+{
|
|
|
+ if (window.document[movieName])
|
|
|
+ {
|
|
|
+ return window.document[movieName];
|
|
|
+ }
|
|
|
+ if (navigator.appName.indexOf("Microsoft Internet")==-1)
|
|
|
+ {
|
|
|
+ if (document.embeds && document.embeds[movieName])
|
|
|
+ return document.embeds[movieName];
|
|
|
+ }
|
|
|
+ else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
|
|
|
+ {
|
|
|
+ return document.getElementById(movieName);
|
|
|
+ }
|
|
|
+}
|
|
|
+ function DoReload()
|
|
|
+ {
|
|
|
+ $('#ReloadMovieBtn').button('disable');
|
|
|
+ var oMovie = getFlashMovieObject('navigator');
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var aExcluded = [];
|
|
|
+ $('input[name^=excluded]').each( function() {
|
|
|
+ if (!$(this).attr('checked'))
|
|
|
+ {
|
|
|
+ aExcluded.push($(this).val());
|
|
|
+ }
|
|
|
+ } );
|
|
|
+ oMovie.Filter(aExcluded.join(','));
|
|
|
+ //oMovie.SetVariable("/:message", "foo");
|
|
|
+ }
|
|
|
+ catch(err)
|
|
|
+ {
|
|
|
+ alert(err);
|
|
|
+ }
|
|
|
+ }
|
|
|
+EOF
|
|
|
+);
|
|
|
+ $oP->add_ready_script(
|
|
|
+<<<EOF
|
|
|
+ var ajax_request = null;
|
|
|
+
|
|
|
+ $('#ReloadMovieBtn').button().button('disable');
|
|
|
+
|
|
|
+ function UpdateImpactedObjects(sClass, iId, sRelation)
|
|
|
+ {
|
|
|
+ var class_name = sClass; //$('select[name=class_name]').val();
|
|
|
+ if (class_name != '')
|
|
|
+ {
|
|
|
+ $('#impacted_objects').block();
|
|
|
+
|
|
|
+ // Make sure that we cancel any pending request before issuing another
|
|
|
+ // since responses may arrive in arbitrary order
|
|
|
+ if (ajax_request != null)
|
|
|
+ {
|
|
|
+ ajax_request.abort();
|
|
|
+ ajax_request = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ ajax_request = $.get(GetAbsoluteUrlAppRoot()+'pages/xml.navigator.php', { 'class': sClass, id: iId, relation: sRelation, format: 'html' },
|
|
|
+ function(data)
|
|
|
+ {
|
|
|
+ $('#impacted_objects').empty();
|
|
|
+ $('#impacted_objects').append(data);
|
|
|
+ $('#impacted_objects').unblock();
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+EOF
|
|
|
+ );
|
|
|
+}
|
|
|
/***********************************************************************************
|
|
|
*
|
|
|
* Main user interface page, starts here
|
|
@@ -1975,136 +2117,26 @@ EOF
|
|
|
$sClass = utils::ReadParam('class', '', false, 'class');
|
|
|
$id = utils::ReadParam('id', 0);
|
|
|
$sRelation = utils::ReadParam('relation', 'impact');
|
|
|
-
|
|
|
- $oP->AddTabContainer('Navigator');
|
|
|
- $oP->SetCurrentTabContainer('Navigator');
|
|
|
- $oP->SetCurrentTab(Dict::S('UI:RelationshipGraph'));
|
|
|
|
|
|
- $oP->add("<div id=\"ds_flash\" class=\"SearchDrawer\">\n");
|
|
|
- $oP->add_ready_script(
|
|
|
-<<<EOF
|
|
|
- $("#dh_flash").click( function() {
|
|
|
- $("#ds_flash").slideToggle('normal', function() { $("#ds_flash").parent().resize(); } );
|
|
|
- $("#dh_flash").toggleClass('open');
|
|
|
- });
|
|
|
-EOF
|
|
|
- );
|
|
|
$aResults = array();
|
|
|
- $aSortedElements = array();
|
|
|
$oObj = MetaModel::GetObject($sClass, $id);
|
|
|
$oObj->GetRelatedObjects($sRelation, 20 /* iMaxDepth */, $aResults);
|
|
|
- foreach($aResults as $sClassIdx => $aObjects)
|
|
|
- {
|
|
|
- foreach($aObjects as $oCurrObj)
|
|
|
- {
|
|
|
- $sSubClass = get_class($oCurrObj);
|
|
|
- $aSortedElements[$sSubClass] = MetaModel::GetName($sSubClass);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- asort($aSortedElements);
|
|
|
- $idx = 0;
|
|
|
- foreach($aSortedElements as $sSubClass => $sClassName)
|
|
|
- {
|
|
|
- $oP->add("<span style=\"padding-right:2em; white-space:nowrap;\"><input type=\"checkbox\" id=\"exclude_$idx\" name=\"excluded[]\" value=\"$sSubClass\" checked onChange=\"$('#ReloadMovieBtn').button('enable')\"><label for=\"exclude_$idx\"> ".MetaModel::GetClassIcon($sSubClass)." $sClassName</label></span> ");
|
|
|
- $idx++;
|
|
|
- }
|
|
|
- $oP->add("<p style=\"text-align:right\"><button type=\"button\" id=\"ReloadMovieBtn\" onClick=\"DoReload()\">".Dict::S('UI:Button:Refresh')."</button></p>");
|
|
|
- $oP->add("</div>\n");
|
|
|
- $oP->add("<div class=\"HRDrawer\"></div>\n");
|
|
|
- $oP->add("<div id=\"dh_flash\" class=\"DrawerHandle\">".Dict::S('UI:ElementsDisplayed')."</div>\n");
|
|
|
-
|
|
|
- $width = 1000;
|
|
|
- $height = 700;
|
|
|
- $sDrillUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=details&'.$oAppContext->GetForLink();
|
|
|
- $sParams = "pWidth=$width&pHeight=$height&drillUrl=".urlencode($sDrillUrl)."&displayController=false&xmlUrl=".urlencode("./xml.navigator.php")."&obj_class=$sClass&obj_id=$id&relation=$sRelation";
|
|
|
+ $oP->AddTabContainer('Navigator');
|
|
|
+ $oP->SetCurrentTabContainer('Navigator');
|
|
|
|
|
|
- $oP->add("<div style=\"z-index:1;background:white;width:100%;height:{$height}px\"><object style=\"z-index:2\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"100%\" height=\"$height\" id=\"navigator\" align=\"middle\">
|
|
|
- <param name=\"allowScriptAccess\" value=\"always\" />
|
|
|
- <param name=\"allowFullScreen\" value=\"false\" />
|
|
|
- <param name=\"FlashVars\" value=\"$sParams\" />
|
|
|
- <param name=\"wmode\" value=\"transparent\">
|
|
|
- <param name=\"movie\" value=\"../navigator/navigator.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" />
|
|
|
- <embed src=\"../navigator/navigator.swf\" wmode=\"transparent\" flashVars=\"$sParams\" quality=\"high\" bgcolor=\"#ffffff\" width=\"100%\" height=\"$height\" name=\"navigator\" align=\"middle\" swliveconnect=\"true\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" />
|
|
|
- </object></div>\n");
|
|
|
- $oP->SetCurrentTab(Dict::S('UI:RelationshipList'));
|
|
|
- $oP->add("<div id=\"impacted_objects\" style=\"width:100%;background-color:#fff;padding:10px;\"><p style=\"height:150px;\"> </p></div>");
|
|
|
- $oP->add_script(
|
|
|
-<<<EOF
|
|
|
-function getFlashMovieObject(movieName)
|
|
|
-{
|
|
|
- if (window.document[movieName])
|
|
|
- {
|
|
|
- return window.document[movieName];
|
|
|
- }
|
|
|
- if (navigator.appName.indexOf("Microsoft Internet")==-1)
|
|
|
- {
|
|
|
- if (document.embeds && document.embeds[movieName])
|
|
|
- return document.embeds[movieName];
|
|
|
- }
|
|
|
- else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
|
|
|
- {
|
|
|
- return document.getElementById(movieName);
|
|
|
- }
|
|
|
-}
|
|
|
- function DoReload()
|
|
|
- {
|
|
|
- $('#ReloadMovieBtn').button('disable');
|
|
|
- var oMovie = getFlashMovieObject('navigator');
|
|
|
- try
|
|
|
+ $sFirstTab = MetaModel::GetConfig()->Get('impact_analysis_first_tab');
|
|
|
+ if ($sFirstTab == 'list')
|
|
|
{
|
|
|
- var aExcluded = [];
|
|
|
- $('input[name^=excluded]').each( function() {
|
|
|
- if (!$(this).attr('checked'))
|
|
|
- {
|
|
|
- aExcluded.push($(this).val());
|
|
|
- }
|
|
|
- } );
|
|
|
- oMovie.Filter(aExcluded.join(','));
|
|
|
- //oMovie.SetVariable("/:message", "foo");
|
|
|
+ DisplayNavigatorListTab($oP, $aResults, $sRelation, $oObj);
|
|
|
+ DisplayNavigatorGraphicsTab($oP, $aResults, $sClass, $id, $sRelation, $oAppContext);
|
|
|
}
|
|
|
- catch(err)
|
|
|
+ else
|
|
|
{
|
|
|
- alert(err);
|
|
|
+ DisplayNavigatorGraphicsTab($oP, $aResults, $sClass, $id, $sRelation, $oAppContext);
|
|
|
+ DisplayNavigatorListTab($oP, $aResults, $sRelation, $oObj);
|
|
|
}
|
|
|
- }
|
|
|
-EOF
|
|
|
-);
|
|
|
- $oP->add_ready_script(
|
|
|
-<<<EOF
|
|
|
- var ajax_request = null;
|
|
|
|
|
|
- $('#ReloadMovieBtn').button().button('disable');
|
|
|
-
|
|
|
- function UpdateImpactedObjects(sClass, iId, sRelation)
|
|
|
- {
|
|
|
- var class_name = sClass; //$('select[name=class_name]').val();
|
|
|
- if (class_name != '')
|
|
|
- {
|
|
|
- $('#impacted_objects').block();
|
|
|
-
|
|
|
- // Make sure that we cancel any pending request before issuing another
|
|
|
- // since responses may arrive in arbitrary order
|
|
|
- if (ajax_request != null)
|
|
|
- {
|
|
|
- ajax_request.abort();
|
|
|
- ajax_request = null;
|
|
|
- }
|
|
|
-
|
|
|
- ajax_request = $.get(GetAbsoluteUrlAppRoot()+'pages/xml.navigator.php', { 'class': sClass, id: iId, relation: sRelation, format: 'html' },
|
|
|
- function(data)
|
|
|
- {
|
|
|
- $('#impacted_objects').empty();
|
|
|
- $('#impacted_objects').append(data);
|
|
|
- $('#impacted_objects').unblock();
|
|
|
- }
|
|
|
- );
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- UpdateImpactedObjects('$sClass', $id, '$sRelation');
|
|
|
-EOF
|
|
|
- );
|
|
|
$oP->SetCurrentTab('');
|
|
|
break;
|
|
|
|