index.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. <title>iVProgH - LInE (free educational software and contents)</title>
  7. <link href="../css/bootstrap.min.css" rel="stylesheet">
  8. <link href="../css/style.css" rel="stylesheet">
  9. </head>
  10. <!--
  11. -------------------------------------------------------------------------------
  12. JavaScript code: starting point
  13. This JavaScript code could be inserted in any LMS to get the iLM content and send it to the server.
  14. In this example it use a single "applet" instance, here from iHanoi.
  15. -->
  16. <script Language="JavaScript">
  17. //<![CDATA[
  18. var strAnswer = '';
  19. var evaluationResult = '';
  20. var comment = '';
  21. function submit_iMA_Answer () {
  22. // alert('./ex_pt/index.html: window.frames=' + window.frames);
  23. // alert('./ex_pt/index.html: window.frames.iLM=' + window.frames.iLM);
  24. /* DEBUG
  25. var strFrames = "";
  26. var arrFrames = parent.document.getElementsByTagName("IFRAME");
  27. for (var i=0; i<arrFrames.length; i++) {
  28. strFrames += ', ' + arrFrames[i].name; // if (arrFrames[i].contentWindow === window) alert("yay!");
  29. } // acho 'window.frames' de nome 'iLM'!!!
  30. alert('./ex_pt/index.html: window.frames=' + strFrames);
  31. */
  32. window.frames.iLM.getEvaluation(); // ../ivprogh/js/iassign-integration-functions.js
  33. // window.frames.iLM.runCodeAssessment();
  34. var strAnswer = window.frames.iLM.getAnswer();
  35. alert('./ex_pt/index.html: getAnswer()=' + strAnswer);
  36. /*
  37. var docForm = document.formEnvio;
  38. // Prepared to be used with more than 1 "applet'
  39. var exercise_answer = new Array(3); // answer: to get the learner answer
  40. var exercise_value = new Array(3); // value from the iLM automatic evaluator
  41. // var doc = document.formEnvio; // ----------------------------------------------------------
  42. // var doc = javascript:window.jsAnalyseAnswer();
  43. try {
  44. alert('submit_iMA_Answer(): evaluationResult=' + evaluationResult);
  45. exercise_answer[0] = doc.getAnswer(); // answer: it must be first (usually the iLM first get the answer to compute the evaluation grade)
  46. exercise_value[0] = doc.getEvaluation(); // value from the iLM automatic evaluator
  47. } catch (Exception) { alert("Error!"); }
  48. docForm.iLM_POST_Archive_0.value = exercise_answer[0]; // Content coming from the iLM
  49. docForm.iLM_POST_Value_0.value = exercise_value[0]; // The activity evaluation coming from the iLM
  50. // This is used to help the developer to debug his iLM
  51. // It presents the file content that will be registered.
  52. alert('The file activity value is: ' + exercise_value[0] + '\nThe activity content is:\n' + exercise_answer[0]);
  53. //uncomment_this docForm.submit(); // envia de fato o formulario
  54. //uncomment_this return true;
  55. */
  56. }
  57. function getEvaluationCallback (evaluation) {
  58. evaluationResult = evaluation;
  59. strAnswer = window.frames.iLM.getAnswer();
  60. alert('getEvaluationCallback(...)' + evaluation + ', strAnswer=' + strAnswer);
  61. comment = document.formEnvio.submission_comment.value;
  62. //leo
  63. if ((strAnswer==null || strAnswer=='' || strAnswer==-1) && (comment==null || comment=='')) { // undefined
  64. alert('Activity sent without content.'); // 'Activity sent without content.'
  65. return false; // error...
  66. }
  67. else {
  68. //leo alert('getEvaluationCallback: enviando evaluationResult=' + evaluation + ', strAnswer=' + strAnswer);
  69. document.formEnvio.iLM_PARAM_ArchiveContent.value = strAnswer;
  70. document.formEnvio.iLM_PARAM_ActivityEvaluation.value = evaluationResult;
  71. document.formEnvio.submit();
  72. return true; // success
  73. }
  74. }
  75. //]]>
  76. </script>
  77. <!--
  78. JavaScript code: final -------------------------------------------------------------------------------
  79. -->
  80. <body>
  81. <nav class="navbar navbar-expand-md navbar-dark fixed-top" style="background-color: #03396c;">
  82. <b><a class="navbar-brand" href="#">iVProgH</a></b>
  83. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
  84. <span class="navbar-toggler-icon"></span>
  85. </button>
  86. <div class="collapse navbar-collapse" id="navbarsExampleDefault">
  87. <ul class="navbar-nav mr-auto">
  88. <li class="nav-item active">
  89. <a class="nav-link" href="#">Home</a>
  90. </li>
  91. <li class="nav-item">
  92. <a class="nav-link" href="#">Conheça</a>
  93. </li>
  94. <li class="nav-item">
  95. <a class="nav-link" href="#">Exemplos</a>
  96. </li>
  97. <li class="nav-item">
  98. <a class="nav-link" href="#">Download</a>
  99. </li>
  100. <li class="nav-item">
  101. <a class="nav-link" href="#">LInE</a>
  102. </li>
  103. <li class="nav-item">
  104. <a class="nav-link" href="#">Ajuda</a>
  105. </li>
  106. </ul>
  107. <div class="form-inline my-2 my-lg-0">
  108. <img src="../img/img_flag_brazil.png">
  109. <img src="../img/img_flag_usa.png">
  110. </div>
  111. </div>
  112. </nav>
  113. <main role="main">
  114. <div class="jumbotron ivprogh-desc">
  115. <div class="container">
  116. <h1>iVProgH</h1>
  117. <p class="text-reduced">
  118. <!--
  119. O <b>iVProg</b> (<i>Programação Visual interativa na Internet</i>) é um dos sistemas educacionais de código livre do
  120. <a href="http://line.ime.usp.br" title="pagina LInE no IME-USP">LInE</a>, sendo destinado ao ensino e à aprendizagem
  121. de <b>algoritmos</b> e <b>programação</b>.
  122. -->
  123. Exemplo de exercício com <i>avaliação automática</i> no <i>iVProg</i>.
  124. </p>
  125. <p class="text-reduced">
  126. <b>Fazer um programa que solicite do usuário um valor inteiro, depois imprima o valor por ele digitado.
  127. </p>
  128. <a class="btn btn-primary" href="manual_pt/index.html" role="button" title="manual iVProgH">Saiba mais &raquo;</a>
  129. </div>
  130. </div>
  131. <div class="container ivprog-container">
  132. <form name='formEnvio' id='formEnvio' method='post' \
  133. action='#'\
  134. enctype='multipart/form-data'>
  135. <div class="embed-responsive embed-responsive-16by9"> <!-- 4by3 -->
  136. <iframe name="iLM" id="iLM" class="embed-responsive-item"
  137. src="../ivprogh/index.html?iLM_PARAM_AssignmentURL=true&iLM_PARAM_Assignment=./exerc/exerc_1_1_ler_imprimir_novo.ivphiLM_PARAM_SendAnswer=false&lang=en"
  138. allowfullscreen></iframe><br/>
  139. </div>
  140. <div class="embed-responsive embed-responsive"> <!-- 4by3 -->
  141. <center>
  142. <input type='button' name='Submit' value='Enviar resposta'
  143. title='clique aqui para vesualizar seu codigo'
  144. onclick='javascript:window.submit_iMA_Answer();' /><!-- chama funcao iMA-->
  145. </center>
  146. </div>
  147. </form>
  148. </div>
  149. </main>
  150. <footer class="container text-center">
  151. <a href="http://www.ime.usp.br/line">iVProgH</a> |
  152. <a href="http://www.ime.usp.br/line">LInE</a> |
  153. <a href="http://www.matematica.br">iM&aacute;tica</a>
  154. </footer>
  155. <script src="js/jquery-min.js"></script>
  156. <script src="js/bootstrap.min.js"></script>
  157. </body>
  158. </html>