index.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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">
  89. <a class="nav-link" href="../"
  90. title="Navegue para a página inicial do site do iVProgH.">Home</a>
  91. </li>
  92. <li class="nav-item">
  93. <a class="nav-link" href="../sobre_ivprog.html"
  94. title="Conheça resumidamente o que é e para que serve o iVProgH.">Conheça</a>
  95. </li>
  96. <li class="nav-item active">
  97. <a class="nav-link" href="../ex_pt/index.html"
  98. title="Veja alguns exemplos e teste o iVProgH online.">Exemplos</a>
  99. </li>
  100. <li class="nav-item">
  101. <a class="nav-link" href="../download.html"
  102. title="Faça uma cópia do iVProgH para sua máquina.">Download</a>
  103. </li>
  104. <li class="nav-item">
  105. <a class="nav-link" href="../manual_pt/index.html"
  106. title="Acesse um manual online do iVProgH e conheça todos os recursos.">Ajuda</a>
  107. </li>
  108. <li class="nav-item">
  109. <a class="nav-link" href="../bugs/report.html"
  110. title="Envie uma mensagem para a equipe do iVProgH.">Contato</a>
  111. </li>
  112. <li class="nav-item">
  113. <a class="nav-link" href="//www.usp.br/line/"
  114. title="Conheça o Laboratório de Informática na Educação do Instituto de Matemática e Estatística da USP.">LInE</a>
  115. </li>
  116. <li class="nav-item">
  117. <a class="nav-link" href="../docs/"
  118. title="Tenha acesso a toda a documentação do iVProgH.">Desenvolvedores</a>
  119. </li>
  120. <li class="nav-item">
  121. <a class="nav-link" href="../publicacoes.html"
  122. title="Leia as publicações da equipe a respeito do iVProgH.">Publicações</a>
  123. </li>
  124. </ul>
  125. <div class="form-inline my-2 my-lg-0">
  126. <img src="../img/img_flag_brazil.png" />
  127. <img src="../img/img_flag_usa.png" ;>
  128. </div>
  129. </div>
  130. </nav>
  131. <main role="main">
  132. <div class="jumbotron ivprogh-desc">
  133. <div class="container">
  134. <h1>Exemplos</h1>
  135. </div>
  136. </div>
  137. <!-- Para cada exemplo, copiar toda a DIV abaixo e não alterar as classes dos elementos :) -->
  138. <div class="container example-large-div">
  139. <div class="text-count-example"><span class="octicon octicon-rocket"></span> Exemplo 1</div>
  140. <p class="text-reduced">
  141. Exemplo de exercício com <i>avaliação automática</i> no <i>iVProg</i>.
  142. </p>
  143. <p class="text-reduced">
  144. <b>Faça um programa que solicite do usuário um valor inteiro, depois imprima o valor por ele digitado.</b>
  145. </p>
  146. <div class="container text-center">
  147. <form name='formEnvio' id='formEnvio' method='post' \
  148. action='#'\
  149. enctype='multipart/form-data'>
  150. <div class="embed-responsive embed-responsive-16by9"> <!-- 4by3 -->
  151. <iframe name="iLM" id="iLM" class="embed-responsive-item"
  152. src="../ivprogh/index.html?iLM_PARAM_AssignmentURL=true&iLM_PARAM_Assignment=../ex_pt/exerc/exerc_1_1_ler_imprimir_novo.ivph&iLM_PARAM_SendAnswer=false&lang=en"
  153. allowfullscreen></iframe><br/>
  154. </div>
  155. <input type='button' name='Submit' value='Enviar resposta' class="btn btn-warning"
  156. title='clique aqui para vesualizar seu codigo'
  157. onclick='javascript:window.submit_iMA_Answer();' /><!-- chama funcao iMA-->
  158. </form>
  159. </div>
  160. </div> <!-- Este é o final da DIV que deve ser copiada para cada exemplo -->
  161. </main>
  162. <footer class="container text-center">
  163. <a href="http://www.ime.usp.br/line">iVProgH</a> |
  164. <a href="http://www.ime.usp.br/line">LInE</a> |
  165. <a href="http://www.matematica.br">iM&aacute;tica</a>
  166. </footer>
  167. <script src="../js/jquery.min.js"></script>
  168. <script src="../js/bootstrap.bundle.min.js"></script>
  169. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">
  170. </body>
  171. </html>