Skip to content

Commit

Permalink
3.59.0 stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
mcagigas-at-wiris authored Dec 12, 2017
1 parent d5b9689 commit 9df2b77
Show file tree
Hide file tree
Showing 9 changed files with 205 additions and 126 deletions.
2 changes: 1 addition & 1 deletion quizzes/configuration.ini.dist
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
;
; Enable WIRIS calc for algorithm edition

;quizzes.calc.enabled = "true"
;quizzes.calc.enabled = "false"

;
; Log correct answers for WIRIS hand training.
Expand Down
23 changes: 17 additions & 6 deletions quizzes/lib/com/wiris/quizzes/impl/Assertion.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,10 @@ static function initParams() {
com_wiris_quizzes_impl_Assertion::$paramnames->set(com_wiris_quizzes_impl_Assertion::$CHECK_NO_MORE_DECIMALS, new _hx_array(array("digits")));
com_wiris_quizzes_impl_Assertion::$paramnames->set(com_wiris_quizzes_impl_Assertion::$CHECK_NO_MORE_DIGITS, new _hx_array(array("digits")));
com_wiris_quizzes_impl_Assertion::$paramnames->set(com_wiris_quizzes_impl_Assertion::$CHECK_PRECISION, new _hx_array(array("min", "max", "relative")));
com_wiris_quizzes_impl_Assertion::$paramnames->set(com_wiris_quizzes_impl_Assertion::$EQUIVALENT_FUNCTION, new _hx_array(array("name")));
com_wiris_quizzes_impl_Assertion::$paramnames->set(com_wiris_quizzes_impl_Assertion::$EQUIVALENT_SYMBOLIC, new _hx_array(array("ordermatters", "repetitionmatters")));
com_wiris_quizzes_impl_Assertion::$paramnames->set(com_wiris_quizzes_impl_Assertion::$EQUIVALENT_LITERAL, new _hx_array(array("ordermatters", "repetitionmatters")));
com_wiris_quizzes_impl_Assertion::$paramnames->set(com_wiris_quizzes_impl_Assertion::$EQUIVALENT_FUNCTION, new _hx_array(array("name", com_wiris_quizzes_api_QuizzesConstants::$OPTION_TOLERANCE, com_wiris_quizzes_api_QuizzesConstants::$OPTION_RELATIVE_TOLERANCE)));
com_wiris_quizzes_impl_Assertion::$paramnames->set(com_wiris_quizzes_impl_Assertion::$EQUIVALENT_SYMBOLIC, new _hx_array(array("ordermatters", "repetitionmatters", com_wiris_quizzes_api_QuizzesConstants::$OPTION_TOLERANCE, com_wiris_quizzes_api_QuizzesConstants::$OPTION_RELATIVE_TOLERANCE)));
com_wiris_quizzes_impl_Assertion::$paramnames->set(com_wiris_quizzes_impl_Assertion::$EQUIVALENT_LITERAL, new _hx_array(array("ordermatters", "repetitionmatters", com_wiris_quizzes_api_QuizzesConstants::$OPTION_TOLERANCE, com_wiris_quizzes_api_QuizzesConstants::$OPTION_RELATIVE_TOLERANCE)));
com_wiris_quizzes_impl_Assertion::$paramnames->set(com_wiris_quizzes_impl_Assertion::$EQUIVALENT_EQUATIONS, new _hx_array(array(com_wiris_quizzes_api_QuizzesConstants::$OPTION_TOLERANCE, com_wiris_quizzes_api_QuizzesConstants::$OPTION_RELATIVE_TOLERANCE)));
$paramvalues = null;
com_wiris_quizzes_impl_Assertion::$paramdefault = new Hash();
$constantsExpression = com_wiris_quizzes_impl_Assertion_0($paramvalues) . ", e, i, j";
Expand Down Expand Up @@ -355,12 +356,25 @@ static function initParams() {
$paramvalues = new Hash();
$paramvalues->set("ordermatters", "true");
$paramvalues->set("repetitionmatters", "true");
$paramvalues->set(com_wiris_quizzes_api_QuizzesConstants::$OPTION_TOLERANCE, "");
$paramvalues->set(com_wiris_quizzes_api_QuizzesConstants::$OPTION_RELATIVE_TOLERANCE, "");
com_wiris_quizzes_impl_Assertion::$paramdefault->set(com_wiris_quizzes_impl_Assertion::$EQUIVALENT_SYMBOLIC, $paramvalues);
$paramvalues = new Hash();
$paramvalues->set("ordermatters", "true");
$paramvalues->set("repetitionmatters", "true");
$paramvalues->set(com_wiris_quizzes_api_QuizzesConstants::$OPTION_TOLERANCE, "");
$paramvalues->set(com_wiris_quizzes_api_QuizzesConstants::$OPTION_RELATIVE_TOLERANCE, "");
com_wiris_quizzes_impl_Assertion::$paramdefault->set(com_wiris_quizzes_impl_Assertion::$EQUIVALENT_LITERAL, $paramvalues);
$paramvalues = new Hash();
$paramvalues->set("name", "");
$paramvalues->set(com_wiris_quizzes_api_QuizzesConstants::$OPTION_TOLERANCE, "");
$paramvalues->set(com_wiris_quizzes_api_QuizzesConstants::$OPTION_RELATIVE_TOLERANCE, "");
com_wiris_quizzes_impl_Assertion::$paramdefault->set(com_wiris_quizzes_impl_Assertion::$EQUIVALENT_FUNCTION, $paramvalues);
$paramvalues = new Hash();
$paramvalues->set(com_wiris_quizzes_api_QuizzesConstants::$OPTION_TOLERANCE, "");
$paramvalues->set(com_wiris_quizzes_api_QuizzesConstants::$OPTION_RELATIVE_TOLERANCE, "");
com_wiris_quizzes_impl_Assertion::$paramdefault->set(com_wiris_quizzes_impl_Assertion::$EQUIVALENT_EQUATIONS, $paramvalues);
$paramvalues = new Hash();
$paramvalues->set("value", "");
com_wiris_quizzes_impl_Assertion::$paramdefault->set(com_wiris_quizzes_impl_Assertion::$CHECK_DIVISIBLE, $paramvalues);
$paramvalues = new Hash();
Expand All @@ -380,9 +394,6 @@ static function initParams() {
$paramvalues->set("max", "");
$paramvalues->set("relative", "true");
com_wiris_quizzes_impl_Assertion::$paramdefault->set(com_wiris_quizzes_impl_Assertion::$CHECK_PRECISION, $paramvalues);
$paramvalues = new Hash();
$paramvalues->set("name", "");
com_wiris_quizzes_impl_Assertion::$paramdefault->set(com_wiris_quizzes_impl_Assertion::$EQUIVALENT_FUNCTION, $paramvalues);
}
static function getParameterNames($name) {
if(com_wiris_quizzes_impl_Assertion::$paramnames === null) {
Expand Down
5 changes: 3 additions & 2 deletions quizzes/lib/com/wiris/quizzes/impl/HTMLGui.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,12 @@ public function printAssertionsControls($h, $q, $correctAnswer, $userAnswer, $un
$h->openFieldset("wiriscomparisonfieldset" . _hx_string_rec($unique, "") . $answers, $this->t->t("comparisonwithstudentanswer"), "wirismainfieldset wiriscomparisonfieldset");
$h->help("wiriscomparisonhelp" . _hx_string_rec($unique, ""), "http://www.wiris.com/quizzes/docs/moodle/manual/validation#comparison", $this->t->t("manual"));
$h->openDivClass("wiristolerance" . _hx_string_rec($unique, ""), "wiristolerance");
$idtol = "wirisoption" . _hx_string_rec($unique, "") . "[" . com_wiris_quizzes_api_QuizzesConstants::$OPTION_TOLERANCE . "]";
$idtolPrefix = "wirisassertionparam" . _hx_string_rec($unique, "") . "[" . com_wiris_quizzes_impl_Assertion::$EQUIVALENT_LITERAL . "," . com_wiris_quizzes_impl_Assertion::$EQUIVALENT_SYMBOLIC . "," . com_wiris_quizzes_impl_Assertion::$EQUIVALENT_EQUATIONS . "," . com_wiris_quizzes_impl_Assertion::$EQUIVALENT_FUNCTION . "]";
$idtol = $idtolPrefix . "[" . com_wiris_quizzes_api_QuizzesConstants::$OPTION_TOLERANCE . "]" . $answers;
$h->label($this->t->t("tolerancedigits") . ":", $idtol, "wirisleftlabel2");
$h->text(" ");
$h->input("text", $idtol, "", null, null, null);
$idRelTol = "wirisoption" . _hx_string_rec($unique, "") . "[" . com_wiris_quizzes_api_QuizzesConstants::$OPTION_RELATIVE_TOLERANCE . "]";
$idRelTol = $idtolPrefix . "[" . com_wiris_quizzes_api_QuizzesConstants::$OPTION_RELATIVE_TOLERANCE . "]" . $answers;
$h->input("checkbox", $idRelTol, "", null, null, null);
$h->label($this->t->t("relative"), $idRelTol, null);
$h->close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static function getContentType($name) {
static function appendQuizzesJS() {
$cfg = com_wiris_quizzes_impl_QuizzesBuilderImpl::getInstance()->getConfiguration();
$config = $cfg->getJSConfig();
$expose = "if(!window.com) window.com={};\x0A" . "if(!window.com.wiris) window.com.wiris={};\x0A" . "if(!window.com.wiris.quizzes) window.com.wiris.quizzes={};\x0A" . "if(!window.com.wiris.quizzes.api) window.com.wiris.quizzes.api={};\x0A" . "if(!window.com.wiris.quizzes.api.ui) window.com.wiris.quizzes.api.ui={};\x0A" . "window.com.wiris.quizzes.api.QuizzesBuilder = com.wiris.quizzes.api.QuizzesBuilder;\x0A" . "window.com.wiris.quizzes.api.ConfigurationKeys = com.wiris.quizzes.api.ConfigurationKeys;\x0A" . "window.com.wiris.quizzes.api.ui.QuizzesUIConstants = com.wiris.quizzes.api.ui.QuizzesUIConstants;\x0A";
$expose = "if(!window.com) window.com={};\x0A" . "if(!window.com.wiris) window.com.wiris={};\x0A" . "if(!window.com.wiris.quizzes) window.com.wiris.quizzes={};\x0A" . "if(!window.com.wiris.quizzes.api) window.com.wiris.quizzes.api={};\x0A" . "if(!window.com.wiris.quizzes.api.ui) window.com.wiris.quizzes.api.ui={};\x0A" . "window.com.wiris.quizzes.api.QuizzesBuilder = com.wiris.quizzes.api.QuizzesBuilder;\x0A" . "window.com.wiris.quizzes.api.ConfigurationKeys = com.wiris.quizzes.api.ConfigurationKeys;\x0A" . "window.com.wiris.quizzes.api.QuizzesConstants = com.wiris.quizzes.api.QuizzesConstants;\x0A" . "window.com.wiris.quizzes.api.ui.QuizzesUIConstants = com.wiris.quizzes.api.ui.QuizzesUIConstants;\x0A";
$main = "com.wiris.quizzes.JsQuizzesFilter.main();\x0A";
return $config . $expose . $main;
}
Expand Down
122 changes: 61 additions & 61 deletions quizzes/lib/com/wiris/system/service/HttpRequest.class.php
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.


class com_wiris_system_service_HttpRequest {
public $extraParams;
private $wrap;

public function __construct() {
if(!php_Boot::$skip_constructor) {
$this->extraParams = new Hash();
$this->wrap = com_wiris_system_CallWrapper::getInstance();
}}

public function setParameter($key, $value) {
$this->extraParams->set($key, $value);
}
public function getParameterNames() {
// At this point we need to access directly to $_GET and $_POST variables because
// we don't know what params are sended via POST or GET.
// For security reasons this method only returns the params names.
// To get the param value optional_param method.
$param = new _hx_array(array());
$key = "";
foreach ($_GET as $key => $value) {
$param->insert(0, $key);
}
foreach ($_POST as $key => $value) {
$param->insert(0, $key);
}
return $param;
}

public function getContextURL() {
return "";
}

public function getParameter($key) {
$this->wrap->stop();
$parameter = null;
if (optional_param($key, null, PARAM_RAW) != null) {
$parameter = optional_param($key, null, PARAM_RAW);
} else {
if ($this->extraParams->exists($key)) {
$parameter = $this->extraParams->get($key);
}
}
$this->wrap->start();
return $parameter;
}

public function __construct() {
if(!php_Boot::$skip_constructor) {
$this->extraParams = new Hash();
$this->headers = new Hash();
$this->setHeaders();
}}
public function getHeader($key) {
$httpKey = null;
$httpKey = "HTTP_" . $this->headers->get($key);
$header = null;
$header = isset($_SERVER[$httpKey]) ? $_SERVER[$httpKey] : '';
return $header;
}
public function setParameter($key, $value) {
$this->extraParams->set($key, $value);
}
public function getParameterNames() {
$param = new _hx_array(array());
$key = "";
foreach ($_GET as $key => $value) {
$param->insert(0, $key);
}
foreach ($_POST as $key => $value) {
$param->insert(0, $key);
}
return $param;
}
public function getContextURL() {
return "";
}
public function getParameter($key) {
$param = null;
if(isset($_POST[$key])) {
$param = $_POST[$key];
} else {
if(isset($_GET[$key])) {
$param = $_GET[$key];
} else {
if($this->extraParams->exists($key)) {
return $this->extraParams->get($key);
}
}
}
return $param;
}
public function setHeaders() {
$this->headers->set("User-Agent", "USER_AGENT");
}
public $headers;
public $extraParams;
public function __call($m, $a) {
if(isset($this->$m) && is_callable($this->$m))
return call_user_func_array($this->$m, $a);
else if(isset($this->»dynamics[$m]) && is_callable($this->»dynamics[$m]))
return call_user_func_array($this->»dynamics[$m], $a);
else if('toString' == $m)
return $this->__toString();
else
throw new HException('Unable to call «'.$m.'»');
}
function __toString() { return 'com.wiris.system.service.HttpRequest'; }
}
Loading

0 comments on commit 9df2b77

Please sign in to comment.