Note: You are currently viewing documentation for Moodle 3.4. Up-to-date documentation for the latest stable version of Moodle is likely available here: question/type/essayautograde.

question/type/essayautograde: Difference between revisions

From MoodleDocs
(Added 400px)
(added page redirect)
 
(23 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Infobox plugin
#Redirect [[Essay (auto-grade) question type]]
|type = Question type
|entry =
|tracker = https://github.com/gbateson/moodle-qtype_essayautograde/issues
|discussion = https://moodle.org/mod/forum/discuss.php?d=221420
|maintainer = [[User:Gordon Bateson|Gordon Bateson]]
|float = right
}}


This is a stub for the awesome Essay (auto-grade) additional plugin by Gordon Bateson currently [https://github.com/gbateson/moodle-qtype_essayautograde hosted in GitHub].
[[es:question/type/essayautograde]]
 
=Download=
* [https://github.com/gbateson/moodle-qtype_essayautograde From GitHub].
 
=Install=
* Download from [https://github.com/gbateson/moodle-qtype_essayautograde GitHub] and [[Installing_plugins#Installing_via_uploaded_ZIP_file|install the ZIP file]], or
* [[Installing_plugins#Installing_manually_at_the_server|install the files directly into the server]]
 
=(Re-)Create an awesome Essay (auto-grade) question=
 
* Write a reasonable question name (Summer vacation essay writing)
* For the question text, you will have to click on the advanced toools button of your editor (Atto or TinyMCE) and then click on the <> button to show HTML code and enter the following HTML code
 
<code php>
<p>Write a short paragraph of 50 words or more about your summer vacation. Try to include the following phrases:</p>
<ul>
<li>First</li>
<li>Next OR Then</li>
<li>Finally OR In the end</li>
</ul>
<p class="essayautograde_questiontext_lastline">If you will get special bonus points, if you use ALL of the above phrases</p>
<script type="text/javascript">
//<![CDATA[
window.addEventListener("load", function(){
    if ($("body").is("#page-mod-quiz-review")) {
        $(".essayautograde_questiontext_lastline").each(function(){
            $(this).closest(".qtext")
                  .next(".ablock")
                  .find(".answer .qtype_essay_response")
                  .css({"overflow":"auto", "max-width":"640px"});
        });
    } else {
        var txt = "This summer vacation I went back to my hometown. ";
        txt += "First, I visited my grandparents and told them about my life in Kochi. ";
        txt += "Then, I went to a firework display near a large river. ";
        txt += "There many people and lots of food stalls. The fireworks were amazing. ";
        txt += "Finally, I went to a reunion with some of my old friends from high school.";
        $(".essayautograde_questiontext_lastline").each(function(){
            if ($(this).find(".cheat").length==0) {
                this.appendChild(document.createTextNode(" "));
                var small = document.createElement("SMALL");
                small.style.fontWeight = "bold";
                small.style.color = "red";
                small.appendChild(document.createTextNode("[Show example]"));
                small.addEventListener("click", function(){
 
                    // Should we show or hide the example
                    if ($(this).text().match('Show')) {
                        $(this).text($(this).text().replace("Show", "Hide"));
                        $(this).css("color", "purple");
                        var newtxt = txt;
                    } else {
                        $(this).text($(this).text().replace("Hide", "Show"));
                        $(this).css("color", "red");
                        var newtxt = "";
                    }
 
                    // locate response element in DOM
                    var r = $(this).closest(".qtext").next(".ablock").find(".answer .qtype_essay_response");
                    var editor = null;
                    if (r.is("[name$='_answer']")) {
                        // Plain text (i.e. no editor)
                        editor = r;
                    } else {
                        // Atto
                        editor = r.find("[contenteditable=true]");
                        if (editor.length==0) {
                            // TinyMCE
                            editor = r.find("iframe").contents().find("[contenteditable=true]");
                            if (editor.length==0) {
                                // Plain text editor
                                editor = r.find("[name$='_answer']");
                            }
                        }
                    }
 
                    if (editor===null || editor.length==0) {
                        return false; // shouldn't happen !!
                    }
 
                    if (editor.prop("tagName")=="TEXTAREA") {
                        editor.val(newtxt).keyup();
                    } else {
                        editor.text(newtxt).keyup();
                    }
                    return true;
                });
                this.appendChild(small);
            }
        });
    }
});
// ]]>
</script>
</code>
 
* Click again in the <> button to return to the normal edit mode.
 
* Type the following General feedback:
You grade is generated automatically. Your teacher may change the grade later.
 
* Type the following combined feedback for any correct response:
Your essay has been marked as correct. Your teacher will review this mark later.
 
* Type the following combined feedback for any partially correct response:
Good try. Please check to see if you have written enough words and include all the target phrases.
 
 
* Type the following combined feedback for any incorrect response:
No essay was received. Please ask you teacher about how to input and submit an essay.
 
* Type the following Response Template:
Type your essay here.
 
* For Auto.grading:
Enable automatic grading
Type of countable items: Words
Expected number of items: 50
Show student feedback to teachers and students
Show text statistics for Words, Unique words, long words and lexical density
 
* Do not show grade bands
* Do show partial grades
Grade band [1]_ For 0 items award 0%
Grade band [2] For 50 or more items award 60%
 
* Do NOT show target phrases
Target phrase [1] : If [First] is used, award [10% of the question grade.]
Target phrase [2] : If [Next OR Then] is used, award [10% of the question grade.]
Target phrase [1] : If [Finally] is used, award [10% of the question grade.]
Target phrase [1] : If [First AND (Next OR Then) AND Finally] is used, award [10% of the question grade.]
 
* Save changes
* Try it :)
 
=Images=
 
[[File:Essay(auto-grade) question type screen 01.png|400px|]]
 
 
[[File:Essay(auto-grade) question type screen 02.png|400px|]]
 
 
[[File:Essay(auto-grade) question type screen 03.png|400px|]]

Latest revision as of 22:01, 4 August 2018