Permalink
Browse files

removed mistakenly committed regexp plugin

  • Loading branch information...
joseph_rezeau
joseph_rezeau committed Oct 28, 2007
1 parent a0a1aeb commit 691d35efc29c1b8fd241fc2cd6e51bc64d5d8826
@@ -1,24 +0,0 @@
-<?php //$Id$
-
-// MySQL commands for upgrading this question type
-
-function qtype_regexp_upgrade($oldversion=0) {
- global $CFG;
-
- if ($oldversion == 0) { // First time install
- $result = modify_database("$CFG->dirroot/question/type/regexp/db/mysql.sql");
- return $result;
- }
-
- // Question type was installed before. Upgrades must be applied
-
- if ($oldversion < 2007012800) {
- $result = modify_database("$CFG->dirroot/question/type/regexp/db/mysql02.sql");
- return $result;
-
- }
-
- return true;
-}
-
-?>
@@ -1,15 +0,0 @@
-
-
---
--- Table structure for table `prefix_question_regexp`
---
-
-CREATE TABLE prefix_question_regexp (
- id int(10) unsigned NOT NULL auto_increment,
- question int(10) unsigned NOT NULL default '0',
- answers varchar(255) NOT NULL default '',
- usehint tinyint(2) NULL default '0', PRIMARY KEY (id),
- KEY question (question)
-) TYPE=MyISAM COMMENT='Options for regexp questions';
-
--- --------------------------------------------------------
@@ -1,8 +0,0 @@
-
-
---
--- Add the usehint field to table `prefix_question_regexp`
---
-
-ALTER TABLE `prefix_question_regexp` ADD `usehint` TINYINT( 2 ) NULL DEFAULT '0';
--- --------------------------------------------------------
@@ -1,23 +0,0 @@
-<?php //$Id$
-
-// PostgreSQL commands for upgrading this question type
-
-function qtype_regexp_upgrade($oldversion=0) {
- global $CFG;
-
-
- if ($oldversion == 0) { // First time install
- $result = modify_database("$CFG->dirroot/question/type/regexp/db/postgres7.sql");
- return $result;
- }
-
- // Question type was installed before. Upgrades must be applied
- if ($oldversion < 2007012800) {
- $result = modify_database("$CFG->dirroot/question/type/regexp/db/postgres7_02.sql");
- return $result;
-
- }
- return true;
-}
-
-?>
@@ -1,14 +0,0 @@
-
-# --------------------------------------------------------
-
-#
-# Table structure for table prefix_question_regexp
-#
-
-CREATE TABLE prefix_question_regexp (
- id SERIAL PRIMARY KEY,
- question integer NOT NULL default '0',
- answers varchar(255) NOT NULL default '',
- usehint integer NULL default '0'
-);
-CREATE INDEX prefix_question_regexp_question_idx ON prefix_question_regexp (question);
@@ -1,65 +0,0 @@
-<div class="qtext">
- <?php echo $questiontext; ?>
-</div>
-
-<?php if ($image) { ?>
- <img class="qimage" src="<?php echo $image; ?>" alt="" />
-<?php } ?>
-
-<div class="ablock clearfix">
- <div class="prompt">
- <?php echo get_string("answer", "quiz").': '; ?>
- </div>
-
- <div class="answer">
- <input type="text" <?php echo "$readonly $inputname $value"; ?> size="80"/>&nbsp;
- <?php
- // only print Hint button if all these conditions are met (readonly is set on Review page, where we do not want Hint button displayed)
- if ($question->options->usehint && ($cmoptions->optionflags == QUESTION_ADAPTIVE) && !$readonly ) {
- $p = get_string("hintpenalty", "qtype_regexp", $question->penalty);
- $q = 'resp'.$question->id.'_';
- $q2 = $q.'submit';
- $hint = get_string("hint", "qtype_regexp");
- echo('<input id ='.$q.' type="submit" name='.$q2.' value='.$hint.' title='.$p.' onclick="submittheform(this.id)" style="">');
- }
- ?>
-
- </div>
- <?php if ($feedback) { ?>
- <div class="feedback">
- <?php echo $feedback ?>
- </div>
- <?php } ?>
- </div>
- <?php $this->print_question_submit_buttons($question, $state, $cmoptions, $options); ?>
-<?php if ($correctanswer) { ?>
- <div class="correctness correct">
- <?php echo get_string('correctanswer', 'quiz').': '. $correctanswer; ?>
- </div>
-<?php } ?>
-<!--js script for showing / hiding regexp generated alternative sentences (for teacher only)-->
-<?php
-$show = get_string("showalternate", "qtype_regexp");
-$hide = get_string("hidealternate", "qtype_regexp");
-echo ("<script>
-function showdiv(id,thisbutton) {
-if (document.getElementById(id).style.display == 'none') {
- document.getElementById(id).style.display = 'block'
- thisbutton.value = '".$hide."'
- } else {
- document.getElementById(id).style.display = 'none'
- thisbutton.value = '".$show."'
- }
- return;
-}
-function submittheform (myid) {
- a = document.forms[0].action;
- if (a.indexOf('preview.php')!=-1) {
- document.forms[0].name = 'responseform';
- }
- a = document.getElementsByName(myid)[0].value;
- document.getElementsByName(myid)[0].value = a + '\t';
- this.document.forms.responseform.submit();
-}
-</script>");
- ?>
@@ -1,102 +0,0 @@
-<?php
-/** by Joseph Rézeau 23:43 24/02/2007
- * Defines the editing form for the shortanswer question type.
- *
- * @copyright &copy; 2007 Jamie Pratt
- * @author Jamie Pratt me@jamiep.org
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package questions
- */
-
-/**
- * shortanswer editing form definition.
- */
-
-class question_edit_regexp_form extends question_edit_form {
- /**
- * Add question-type specific form fields.
- *
- * @param MoodleQuickForm $mform the form being built.
- */
-
- function definition_inner(&$mform) {
- $langfile = 'qtype_'.$this->qtype();
-
- $mform->removeElement('generalfeedback'); //JR
- $menu = array(get_string('no', 'moodle'), get_string('yes', 'moodle'));
- $mform->addElement('select', 'usehint', get_string('usehint', 'qtype_regexp'), $menu);
- $mform->setHelpButton('usehint', array('regexphint', get_string('usehint', 'qtype_regexp'), 'qtype_regexp'));
- $mform->addElement('static', 'answersinstruct', get_string('correctanswers', 'quiz'), get_string('filloutoneanswer', $langfile));
- $mform->closeHeaderBefore('answersinstruct');
- $creategrades = get_grade_options();
- $gradeoptions = $creategrades->gradeoptions;
- $repeated = array();
- $repeated[] =& $mform->createElement('header', 'answerhdr', get_string('answerno', $langfile, '{no}'));
- $repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'),array('size'=>100)); //JR
- $repeated[] =& $mform->createElement('select', 'fraction', get_string('grade'), $gradeoptions);
- $repeated[] =& $mform->createElement('textarea', 'feedback', get_string('feedback', 'quiz'),array('cols'=>60, 'rows'=>1));
-
- if (isset($this->question->options)){
- $countanswers = count($this->question->options->answers);
- } else {
- $countanswers = 0;
- }
- $repeatsatstart = (QUESTION_NUMANS_START > ($countanswers + QUESTION_NUMANS_ADD))?
- QUESTION_NUMANS_START : ($countanswers + QUESTION_NUMANS_ADD);
- $repeatedoptions = array();
- $mform->setType('answer', PARAM_NOTAGS);
- $repeatedoptions['fraction']['default'] = 0;
- $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'noanswers', 'addanswers', QUESTION_NUMANS_ADD, get_string('addmoreanswerblanks', 'qtype_shortanswer'));
-
- }
-
- function set_data($question) {
- if (isset($question->options)){
- $answers = $question->options->answers;
- if (count($answers)) {
- $key = 0;
- foreach ($answers as $answer){
- $default_values['answer['.$key.']'] = $answer->answer;
- $default_values['fraction['.$key.']'] = $answer->fraction;
- $default_values['feedback['.$key.']'] = $answer->feedback;
- $key++;
- }
- }
- $default_values['image'] = "None";
- $default_values['usehint'] = $question->options->usehint;
- $question = (object)((array)$question + $default_values);
- } else {
- $key = 0;
- $default_values['fraction['.$key.']'] = 1;
- $question = (object)((array)$question + $default_values);
- }
- parent::set_data($question);
- }
- function validation($data){
- $langfile = 'qtype_'.$this->qtype();
- $errors = array();
- $answers = $data['answer'];
- $answercount = 0;
- foreach ($answers as $answer){
- $trimmedanswer = trim($answer);
- if (!empty($trimmedanswer)){
- $parenserror = check_my_parens($trimmedanswer);
- if ($parenserror) {
- $errors['answer['.$answercount.']'] = $parenserror;
- }
- $answercount++;
- }
- }
- if ($answercount==0){
- $errors['answer[0]'] = get_string('notenoughanswers', $langfile);
- }
- if ($data['fraction'][0] != 1) {
- $errors['fraction[0]'] = get_string('fractionsnomax', $langfile, 1);
- }
- return $errors;
- }
- function qtype() {
- return 'regexp';
- }
-}
-?>
Oops, something went wrong.

0 comments on commit 691d35e

Please sign in to comment.