appshare.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php // $Id: infocours.php 10902 2007-01-25 14:44:35Z elixir_julian $
  2. /* For licensing terms, see /dokeos_license.txt */
  3. /*
  4. ==============================================================================
  5. INIT SECTION
  6. ==============================================================================
  7. */
  8. // name of the language file that needs to be included
  9. $language_file = array('create_course', 'course_info');
  10. require '../inc/global.inc.php';
  11. $this_section = SECTION_COURSES;
  12. $nameTools = get_lang("ModifInfo");
  13. $course_code = $_course["sysCode"];
  14. $app_share_tmp_dir_base = api_get_path(SYS_ARCHIVE_PATH).'app_share/';
  15. //mkdir ($app_share_tmp_dir_base, 0700);
  16. mkdir ($app_share_tmp_dir_base, api_get_permissions_for_new_directories());
  17. $app_share_tmp_dir = $app_share_tmp_dir_base.$course_code;
  18. $app_base_file = api_get_path(SYS_CODE_PATH).'app_share/DokeosAppShare.exe';
  19. $app_share_app_file = $app_share_tmp_dir.'/DokeosAppShare.exe';
  20. $specialCode='';
  21. if (!file_exists($app_share_app_file)) {
  22. //mkdir ($app_share_tmp_dir, 0700);
  23. mkdir ($app_share_tmp_dir, api_get_permissions_for_new_directories());
  24. if (!file_exists($app_base_file)) {
  25. echo('FATAL ERROR: file <strong>'.$app_base_file.'</strong> not found.<br />');
  26. } else {
  27. $source = fopen($app_base_file, "r");
  28. $target = fopen($app_share_app_file, "a" );
  29. $specialCode = rand(100000,999999).time().rand(100000,999999);
  30. $contents = fread ($source, filesize ($app_base_file));
  31. fwrite ($target, $contents, filesize ($app_base_file));
  32. fwrite ($target, $specialCode, filesize ($app_base_file));
  33. fclose($source);
  34. fclose($target);
  35. }
  36. } else {
  37. $source = fopen($app_share_app_file, "r" );
  38. fread ($source, filesize ($app_base_file)); // skip binary content
  39. $serverID = fread ($source, filesize($app_share_app_file)-filesize ($app_base_file));
  40. fclose($source);
  41. }
  42. if ($_GET["client"] == 'true') {
  43. ?>
  44. <HTML>
  45. <HEAD><TITLE> [test viewApplet appShare] </TITLE></HEAD>
  46. <BODY>
  47. <SPAN style='position: absolute; top:0px;left:0px'>
  48. <OBJECT style="width: 100%; height: 100%"
  49. ID='DokeosSharing'
  50. classid = 'clsid:8AD9C840-044E-11D1-B3E9-00805F499D93'
  51. codebase = 'http://java.sun.com/update/1.4.2/jinstall-1_4-windows-i586.cab#Version=1,4,0,0'
  52. WIDTH = 1000 HEIGHT = 700 >
  53. <PARAM NAME = CODE VALUE = VncViewer.class >
  54. <PARAM NAME = ARCHIVE VALUE = VncViewer.jar >
  55. <PARAM NAME = 'type' VALUE = 'application/x-java-applet;version=1.4'>
  56. <PARAM NAME = 'scriptable' VALUE = 'false'>
  57. <PARAM NAME = PORT VALUE=443>
  58. <PARAM NAME = 'HOST' VALUE='dokeos.noctis.be'>
  59. <PARAM NAME = 'SERVERID' VALUE='<?php echo($serverID);?>'>
  60. <PARAM NAME = ENCODING VALUE=Tight>
  61. <PARAM NAME = 'Open New Window' VALUE='Yes'>
  62. <COMMENT>
  63. <EMBED
  64. type = 'application/x-java-applet;version=1.4' \
  65. CODE = VncViewer.class \
  66. ARCHIVE = VncViewer.jar \
  67. WIDTH = 1000 \
  68. HEIGHT = 700 \
  69. PORT = 443 \
  70. SERVERID = '<?php echo($serverID);?>' \
  71. ENCODING =Tight \
  72. scriptable = false \
  73. pluginspage ='http://java.sun.com/products/plugin/index.html#download'>
  74. <NOEMBED>
  75. </NOEMBED>
  76. </EMBED>
  77. </COMMENT>
  78. </OBJECT>
  79. </SPAN>
  80. </BODY>
  81. </HTML>
  82. <?php
  83. } else {
  84. if (api_is_allowed_to_edit()) {
  85. $linkToFile = api_get_path(WEB_ARCHIVE_PATH).'app_share/'.$course_code.'/DokeosAppShare.exe';
  86. ?>
  87. <h3><?php echo get_lang('PrerequisitesForAppShare'); ?></h3>
  88. <ul>
  89. <li>Microsoft .NET : <a target="top" href="http://www.microsoft.com/downloads/details.aspx?familyid=0856eacb-4362-4b0d-8edd-aab15c5e04f5&displaylang=en">install</a></li>
  90. <li style="margin-top: 5px;">Visual J# Redistributable Packages : <a target="top" href="http://msdn2.microsoft.com/en-us/vjsharp/bb188598.aspx">install</a></li>
  91. </ul>
  92. <form style="float: left;" id="view_screen" action="<?php echo($linkToFile);?>">
  93. <input style="width: 220px; font-size: 14px; font-weight: bold;" type="submit" value="Partager mon �cran" />
  94. </form>
  95. <?php
  96. }?>
  97. <form style="float: left;" id="view_screen" action="">
  98. <input type="hidden" name="client" value="true" />
  99. <input style="margin-left: 20px; width: 220px; font-size: 14px; font-weight: bold;" type="submit" value="Visualiser l'�cran partag�" />
  100. </form><?php
  101. }?>