Bläddra i källkod

Improving comments history

Igor 3 år sedan
förälder
incheckning
4d28012bbc
3 ändrade filer med 20 tillägg och 10 borttagningar
  1. 2 2
      ilm_handlers/html5.php
  2. 1 1
      lang/pt_br/iassign.php
  3. 17 7
      locallib.php

+ 2 - 2
ilm_handlers/html5.php

@@ -337,8 +337,8 @@ class html5 implements ilm_handle {
 
       //$iassign .= "<p><textarea rows='2' cols='60' name='submission_comment'></textarea></p>\n";
       $iassign .= "<center>\n<!-- load button -->\n" .
-      " <br> <br> <input $disabled_button type=button value='" . get_string('submit_iassign', 'iassign') . "' onClick = 'javascript:window.jsAnalyseAnswer();' title='" .
-      get_string('message_submit_iassign', 'iassign') . "'>\n" . "</center>\n";
+      " <br> <br> <button $disabled_button class='btn btn-primary' type=button value='" . get_string('submit_iassign', 'iassign') . "' onClick = 'javascript:window.jsAnalyseAnswer();' title='" .
+      get_string('message_submit_iassign', 'iassign') . "'>" . get_string('submit_iassign', 'iassign') . "</button>\n" . "</center>\n";
 
 
     } // if (!isguestuser() && $iassign_statement_activity_item->type_iassign != 1)

+ 1 - 1
lang/pt_br/iassign.php

@@ -331,7 +331,7 @@ $string['hide']                           = 'Ocultar';
 $string['hide_iassign']                   = 'Ocultar atividade';
 $string['hide_ilm']                       = 'Ocultar';
 $string['hide_param']                     = 'Ocultar parâmetro';
-$string['history_comments']               = 'Histórico de comentários';
+$string['history_comments']               = 'Comentários';
 $string['home']                           = 'Página inicial';
 $string['home_course']                    = 'Página do curso';
 $string['iassign']                        = 'iTarefa';

+ 17 - 7
locallib.php

@@ -2598,33 +2598,43 @@ class iassign {
 
       //if (!empty($history_comment)) {
         $output .= "  <table id='outlinetable' class='generaltable boxaligncenter' cellpadding='5' width='100%'> \n";
-        $output .= "     <tr><th>" . get_string('history_comments', 'iassign') . "</th></tr>";
-        $output .= $history_comment;
+        $output .= "     <tr><th><i style='font-size: 20px' class='icon fa fa-comments-o'></i>" . get_string('history_comments', 'iassign') . "</th></tr>";
         $output .= "</table>";
 
         print " <script type='text/javascript'>
         //<![CDATA[
         function submit_comment(url) {
+          if (document.formEnvioComment.submission_comment.value.length < 1) return;
+
           var formData = new FormData();
           formData.append('submission_comment', document.formEnvioComment.submission_comment.value);
           var request = new XMLHttpRequest();
           request.open('POST', url);
+          document.getElementById('comments_history').innerHTML = '';
           request.onload = function (e) {
             if (request.readyState === 4) {
               if (request.status === 200) {
-                alert(request.responseText);
+                document.getElementById('comments_history').innerHTML = request.responseText;
+                document.getElementById('check-message-success').style.visibility = 'visible';
+                setTimeout(function(){
+                  document.getElementById('check-message-success').style.visibility = 'hidden';
+              }, 3000);
               }
             }
-          };          
+          };
+          document.formEnvioComment.submission_comment.value = '';     
           request.send(formData);
         }
         //]]>
         </script>";
 
         $output .= "<center><form name='formEnvioComment' id='formEnvioComment1' enctype='multipart/form-data'>\n";
-        $output .= "<br><p><textarea rows='2' cols='60' name='submission_comment'></textarea></p>\n";
-        $output .= "<p><input onclick=\"submit_comment('$enderecoPOSTcomment')\" type=button value='" . get_string('submit_comment', 'iassign') . "'\></p>\n";
-        $output .= "</form></center>\n";
+        $output .= "<br><p><textarea class='form-control w-50' rows='2' cols='60' name='submission_comment'></textarea></p>\n";
+        $output .= "<p><button class='btn btn-primary' onclick=\"submit_comment('$enderecoPOSTcomment')\" type=button value='" . get_string('submit_comment', 'iassign') . "'>".get_string('submit_comment', 'iassign')."</button> <i id='check-message-success' class='fa fa-check' aria-hidden='true' style='position: absolute; color: green; font-size: 2.0rem; margin-left: 1rem; visibility: hidden;'></i> </p> \n";
+        
+        $output .= "</form> </center>\n";
+
+        $output .= "<table id='comments_history' class='generaltable boxaligncenter' cellpadding='5' width='100%'>".$history_comment."</table>";
 
       //  }
       $output .= $OUTPUT->box_end();