navigator.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. // Copyright (C) 2010-2012 Combodo SARL
  3. //
  4. // This file is part of iTop.
  5. //
  6. // iTop is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU Affero General Public License as published by
  8. // the Free Software Foundation, either version 3 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // iTop is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU Affero General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU Affero General Public License
  17. // along with iTop. If not, see <http://www.gnu.org/licenses/>
  18. /**
  19. * Display the Flash navigator, in the whole pane
  20. */
  21. require_once('../approot.inc.php');
  22. require_once(APPROOT.'/application/application.inc.php');
  23. require_once(APPROOT.'/application/itopwebpage.class.inc.php');
  24. require_once(APPROOT.'/application/startup.inc.php');
  25. require_once(APPROOT.'/application/loginwebpage.class.inc.php');
  26. LoginWebPage::DoLogin(); // Check user rights and prompt if needed
  27. $sOperation = utils::ReadParam('operation', 'menu');
  28. $oAppContext = new ApplicationContext();
  29. $oP = new iTopWebPage("iTop - Navigator");
  30. // Main program
  31. $sClass = utils::ReadParam('class', '');
  32. $id = utils::ReadParam('id', 0);
  33. $sRelation = utils::ReadParam('relation', 'neighbours');
  34. try
  35. {
  36. $width = 1000;
  37. $height = 700;
  38. $sDrillUrl = urlencode(utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=details');
  39. // $sParams = "pWidth=$width&pHeight=$height&drillUrl=".urlencode('../pages/UI.php?operation=details')."&displayController=false&xmlUrl=".urlencode("./xml.navigator.php")."&obj_class=$sClass&obj_id=$id&relation=$sRelation";
  40. // $oP->add("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"$width\" height=\"$height\" id=\"navigator\" align=\"middle\">
  41. // <param name=\"allowScriptAccess\" value=\"sameDomain\" />
  42. // <param name=\"allowFullScreen\" value=\"false\" />
  43. // <param name=\"FlashVars\" value=\"$sParams\" />
  44. // <param name=\"movie\" value=\"../images/navigator.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" />
  45. // <embed src=\"../images/navigator.swf\" flashVars=\"$sParams\" quality=\"high\" bgcolor=\"#ffffff\" width=\"$width\" height=\"$height\" name=\"navigator\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" />
  46. // </object>\n");
  47. $oP->add("<div id=\"navigator\">If the chart does not display, <a href=\"http://get.adobe.com/flash/\" target=\"_blank\">install Flash</a></div>\n");
  48. $oP->add_ready_script(<<<EOF
  49. var iWidth = $('.ui-layout-content').width();
  50. var iHeight = $('.ui-layout-content').height();
  51. swfobject.embedSWF("../navigator/navigator.swf", "navigator", "100%", "100%","9.0.0", "expressInstall.swf",
  52. { pWidth: iWidth, pHeight: iHeight, drillUrl: '$sDrillUrl', displayController: false, obj_class: '$sClass', obj_id: $id, relation: '$sRelation'},
  53. {wmode: 'transparent'}
  54. );
  55. EOF
  56. );
  57. }
  58. catch(CoreException $e)
  59. {
  60. $oP->p('<b>An error occured while running the query:</b>');
  61. $oP->p($e->getHtmlDesc());
  62. }
  63. catch(Exception $e)
  64. {
  65. $oP->p('<b>An error occured while running the query:</b>');
  66. $oP->p($e->getMessage());
  67. }
  68. $oP->output();
  69. ?>