123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <title>iVProgH - LInE (free educational software and contents)</title>
- <link href="../css/bootstrap.min.css" rel="stylesheet">
- <link href="../css/style.css" rel="stylesheet">
- </head>
- <!--
- -------------------------------------------------------------------------------
- JavaScript code: starting point
- This JavaScript code could be inserted in any LMS to get the iLM content and send it to the server.
- In this example it use a single "applet" instance, here from iHanoi.
- -->
- <script Language="JavaScript">
- //<![CDATA[
- var strAnswer = '';
- var evaluationResult = '';
- var comment = '';
- function submit_iMA_Answer () {
- // alert('./ex_pt/index.html: window.frames=' + window.frames);
- // alert('./ex_pt/index.html: window.frames.iLM=' + window.frames.iLM);
- /* DEBUG
- var strFrames = "";
- var arrFrames = parent.document.getElementsByTagName("IFRAME");
- for (var i=0; i<arrFrames.length; i++) {
- strFrames += ', ' + arrFrames[i].name; // if (arrFrames[i].contentWindow === window) alert("yay!");
- } // acho 'window.frames' de nome 'iLM'!!!
- alert('./ex_pt/index.html: window.frames=' + strFrames);
- */
- window.frames.iLM.getEvaluation(); // ../ivprogh/js/iassign-integration-functions.js
- // window.frames.iLM.runCodeAssessment();
- var strAnswer = window.frames.iLM.getAnswer();
- alert('./ex_pt/index.html: getAnswer()=' + strAnswer);
- /*
- var docForm = document.formEnvio;
- // Prepared to be used with more than 1 "applet'
- var exercise_answer = new Array(3); // answer: to get the learner answer
- var exercise_value = new Array(3); // value from the iLM automatic evaluator
- // var doc = document.formEnvio; // ----------------------------------------------------------
- // var doc = javascript:window.jsAnalyseAnswer();
- try {
- alert('submit_iMA_Answer(): evaluationResult=' + evaluationResult);
- exercise_answer[0] = doc.getAnswer(); // answer: it must be first (usually the iLM first get the answer to compute the evaluation grade)
- exercise_value[0] = doc.getEvaluation(); // value from the iLM automatic evaluator
- } catch (Exception) { alert("Error!"); }
- docForm.iLM_POST_Archive_0.value = exercise_answer[0]; // Content coming from the iLM
- docForm.iLM_POST_Value_0.value = exercise_value[0]; // The activity evaluation coming from the iLM
- // This is used to help the developer to debug his iLM
- // It presents the file content that will be registered.
- alert('The file activity value is: ' + exercise_value[0] + '\nThe activity content is:\n' + exercise_answer[0]);
- //uncomment_this docForm.submit(); // envia de fato o formulario
- //uncomment_this return true;
- */
- }
- function getEvaluationCallback (evaluation) {
- evaluationResult = evaluation;
- strAnswer = window.frames.iLM.getAnswer();
- alert('getEvaluationCallback(...)' + evaluation + ', strAnswer=' + strAnswer);
- comment = document.formEnvio.submission_comment.value;
- //leo
- if ((strAnswer==null || strAnswer=='' || strAnswer==-1) && (comment==null || comment=='')) { // undefined
- alert('Activity sent without content.'); // 'Activity sent without content.'
- return false; // error...
- }
- else {
- //leo alert('getEvaluationCallback: enviando evaluationResult=' + evaluation + ', strAnswer=' + strAnswer);
- document.formEnvio.iLM_PARAM_ArchiveContent.value = strAnswer;
- document.formEnvio.iLM_PARAM_ActivityEvaluation.value = evaluationResult;
- document.formEnvio.submit();
- return true; // success
- }
- }
- //]]>
- </script>
- <!--
- JavaScript code: final -------------------------------------------------------------------------------
- -->
- <body>
- <nav class="navbar navbar-expand-md navbar-dark fixed-top" style="background-color: #03396c;">
- <b><a class="navbar-brand" href="../">iVProgH</a></b>
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
- <span class="navbar-toggler-icon"></span>
- </button>
- <div class="collapse navbar-collapse" id="navbarsExampleDefault">
- <ul class="navbar-nav mr-auto">
- <li class="nav-item">
- <a class="nav-link" href="../"
- title="Navegue para a página inicial do site do iVProgH.">Home</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="../sobre_ivprog.html"
- title="Conheça resumidamente o que é e para que serve o iVProgH.">Conheça</a>
- </li>
- <li class="nav-item active">
- <a class="nav-link" href="../ex_pt/index.html"
- title="Veja alguns exemplos e teste o iVProgH online.">Exemplos</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="../download.html"
- title="Faça uma cópia do iVProgH para sua máquina.">Download</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="../manual_pt/index.html"
- title="Acesse um manual online do iVProgH e conheça todos os recursos.">Ajuda</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="../bugs/report.html"
- title="Envie uma mensagem para a equipe do iVProgH.">Contato</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="//www.usp.br/line/"
- title="Conheça o Laboratório de Informática na Educação do Instituto de Matemática e Estatística da USP.">LInE</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="../docs/"
- title="Tenha acesso a toda a documentação do iVProgH.">Desenvolvedores</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="../publicacoes.html"
- title="Leia as publicações da equipe a respeito do iVProgH.">Publicações</a>
- </li>
- </ul>
- <div class="form-inline my-2 my-lg-0">
- <img src="../img/img_flag_brazil.png" />
- <img src="../img/img_flag_usa.png" ;>
- </div>
- </div>
- </nav>
- <main role="main">
- <div class="jumbotron ivprogh-desc">
- <div class="container">
- <h1>Exemplos</h1>
- </div>
- </div>
- <!-- Para cada exemplo, copiar toda a DIV abaixo e não alterar as classes dos elementos :) -->
- <div class="container example-large-div">
- <div class="text-count-example"><span class="octicon octicon-rocket"></span> Exemplo 1</div>
-
- <p class="text-reduced">
- Exemplo de exercício com <i>avaliação automática</i> no <i>iVProg</i>.
- </p>
-
- <p class="text-reduced">
- <b>Faça um programa que solicite do usuário um valor inteiro, depois imprima o valor por ele digitado.</b>
- </p>
- <div class="container text-center">
- <form name='formEnvio' id='formEnvio' method='post' \
- action='#'\
- enctype='multipart/form-data'>
- <div class="embed-responsive embed-responsive-16by9"> <!-- 4by3 -->
- <iframe name="iLM" id="iLM" class="embed-responsive-item"
- 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"
- allowfullscreen></iframe><br/>
- </div>
- <input type='button' name='Submit' value='Enviar resposta' class="btn btn-warning"
- title='clique aqui para vesualizar seu codigo'
- onclick='javascript:window.submit_iMA_Answer();' /><!-- chama funcao iMA-->
- </form>
- </div>
- </div> <!-- Este é o final da DIV que deve ser copiada para cada exemplo -->
- </main>
- <footer class="container text-center">
- <a href="http://www.ime.usp.br/line">iVProgH</a> |
- <a href="http://www.ime.usp.br/line">LInE</a> |
- <a href="http://www.matematica.br">iMática</a>
- </footer>
- <script src="../js/jquery.min.js"></script>
- <script src="../js/bootstrap.bundle.min.js"></script>
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">
- </body>
- </html>
|