Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed May 11, 2015
1 parent 4e844ad commit e24a776
Show file tree
Hide file tree
Showing 14 changed files with 1,288 additions and 1,312 deletions.
11 changes: 3 additions & 8 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,11 @@ function xmldb_geogebra_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2013050600, 'geogebra');
}

if ($oldversion < 2014011305) {
// Change default codebase to avoid problems sending data
$sql = "UPDATE {config} SET value='".GEOGEBRA_DEFAULT_CODEBASE."' WHERE name='geogebra_javacodebase'";
$DB->execute($sql);

// geogebra savepoint reached
upgrade_mod_savepoint(true, 2014011305, 'geogebra');
if ($oldversion < 2015050600) {
unset_config('geogebra_javacodebase');
upgrade_mod_savepoint(true, 2015050600, 'geogebra');
}


// Final return of upgrade result (true, all went good) to Moodle.
return true;
}
63 changes: 36 additions & 27 deletions geogebra_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,24 @@ var adapter = {

propertyString : "",

initialized: false,

init : function() {
this.decodeProperties();
if (this.properties['state'] != undefined) {
this.applet.setBase64(unescape(this.properties['state']));
}
if (this.properties['duration'] === undefined) {
this.properties['duration'] = 0;
if (!this.initialized) {
tmp = this.propertyString.split('&');
for (i in tmp) {
tmppr = tmp[i].split('=');
this.properties[tmppr[0]] = tmppr[1];
}
if (this.properties['duration'] === undefined) {
this.properties['duration'] = 0;
}
if (this.properties['state'] != undefined) {
console.log('Geogebra data loaded');
this.applet.setBase64(unescape(this.properties['state']));
}
this.encodeProperties();
this.initialized = true;
}
},

Expand All @@ -25,14 +36,6 @@ var adapter = {
this.encodeProperties();
},

decodeProperties : function() {
tmp = this.propertyString.split('&');
for (i in tmp) {
tmppr = tmp[i].split('=');
this.properties[tmppr[0]] = tmppr[1];
}
},

encodeProperties : function() {
tmp = "";
for ( var i in this.properties) {
Expand All @@ -52,27 +55,33 @@ function geogebra_addEvent(object, eventName, callback) {

function geogebra_submit_attempt(){
var form = document.getElementById('geogebra_form');
var movie = document.getElementById('geogebra_object');

if (movie.nodeName.toLowerCase() == 'applet') { // is java
adapter.doExit();
form.appletInformation.value = adapter.propertyString;
return true;
}

alert('The geogebra_object applet is missing');
return false;
adapter.doExit();
form.appletInformation.value = adapter.propertyString;
form.submit();
}


geogebra_addEvent(window, 'load', function() {
function ggbOnInit() {
var form = document.getElementById('geogebra_form');

adapter.propertyString = form.prevAppletInformation.value;
adapter.applet = document.ggbApplet;
if (ggbApplet == undefined) {
adapter.applet = document.ggbApplet;
} else {
adapter.applet = ggbApplet;
}
adapter.init();

geogebra_addEvent(form, 'submit', function(e) {
var save = document.getElementById('geogebra_form_save');
geogebra_addEvent(save, 'click', function(e) {
return geogebra_submit_attempt();
});

var submit = document.getElementById('geogebra_form_submit');
geogebra_addEvent(submit, 'click', function(e) {
form.f.value = 1;
return geogebra_submit_attempt();
});
});
}

12 changes: 3 additions & 9 deletions gradeform.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ function definition() {
$this->geogebra = $geogebra;

$attemptelement = $mform->addElement('text', 'attempt', get_string('attempt', 'geogebra'), array('style' => 'border:none'));
$mform->setType('attempt', PARAM_TEXT);
$attemptelement->freeze();

$durationelement = $mform->addElement('text', 'duration', get_string('duration', 'geogebra'), array('style' => 'border:none'));
$mform->setType('duration', PARAM_TEXT);
$durationelement->freeze();


Expand Down Expand Up @@ -91,16 +93,8 @@ function definition() {
$mform->setType('action', PARAM_ALPHA);

// Buttons
$buttonarray=array();
$buttonarray[] = $mform->createElement('submit', 'savegrade', get_string('savechanges', 'assign'));
$buttonarray[] = $mform->createElement('cancel', 'cancelbutton', get_string('cancel'));
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
$this->add_action_buttons(true, get_string('savechanges', 'assign'));
$mform->closeHeaderBefore('buttonar');
$buttonarray=array();

if (!empty($buttonarray)) {
$mform->addGroup($buttonarray, 'navar', '', array(' '), false);
}

if ($data) {
$this->set_data($data);
Expand Down
12 changes: 6 additions & 6 deletions lang/ca/geogebra.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@

$string['modulename'] = 'GeoGebra';
$string['modulenameplural'] = 'GeoGebra';

$string['noattempts'] = '-';
$string['name'] = 'Nom';
$string['choosescripttype'] = 'Escull el tipus d\'activitat';
$string['javacodebase'] = 'Codebase de GeoGebra';
$string['manualgrade'] = 'Qualificació manual?'; //Unused
$string['contentheader'] = 'Contingut';
$string['width'] = 'Amplada';
$string['height'] = 'Alçada';
$string['showsubmit'] = 'Mostra el botó d\'entrega';
Expand Down Expand Up @@ -74,13 +75,12 @@
$string['errorattempt'] = 'S\'ha produït un error. No s\'ha pogut desar l\'intent.';

$string['viewtab'] = 'Mostra';
$string['resultstab'] = 'Resultats';
$string['results'] = 'Resultats';
$string['reviewtab'] = 'Revisió';

$string['availabledate'] = 'Disponible des de';
$string['duedate'] = 'Fins a';

$string['javacodebase_help'] = 'URL dels fitxers JAR de GeoGebra';
$string['filename'] = 'Nom del fitxer';
$string['enableRightClick'] = 'Habilita el botó dret';
$string['enableLabelDrags'] = 'Permet arrossegar les etiquetes';
Expand All @@ -91,7 +91,6 @@
$string['showAlgebraInput'] = 'Mostra la barra d\'inserció'; //Unused
$string['functionalityoptionsgrp'] = 'Funcionalitats';
$string['interfaceoptionsgrp'] = 'Interfície';
$string['warningnojava'] = 'Aquest Applet Java s\'ha creat utilitzant GeoGebra (www.geogebra.org) - possiblement no tingueu el Java correctament instal·lat, comproveu-ho a www.java.com';
$string['filenotfound'] = 'El fitxer indicat no existeix';
$string['httpnotallowed'] = 'No és possible utilitzar fitxers remots';

Expand All @@ -105,6 +104,7 @@
$string['deleteallattempts'] = 'Suprimeix tots els intents';
$string['view'] = 'Visualitza';
$string['gradeit'] = 'Qualificació';
$string['timing'] = 'Temporització';
$string['ungraded'] = 'Sense qualificar';
//$string['save'] = 'Desa';
$string['autograde'] = 'Activitat autopuntuable';
Expand All @@ -129,8 +129,6 @@
$string['geogebra:grade'] = 'Avalua GeoGebra';

$string['geogebra:addinstance'] = 'Afegeix una activitat GeoGebra';
$string['header_geogebra']='Paràmetres del GeoGebra';
$string['header_score']='Paràmetres d\'avaluació del GeoGebra';
$string['filetype'] = 'Tipus';
$string['filetype_help'] = 'Aquest paràmetre determina com s\'incorporarà l\'activitat GeoGebra al curs. Hi ha dues opcions:
Expand All @@ -152,6 +150,7 @@
$string['status'] = 'Estat';
$string['viewattempt'] = 'Visualitza';
$string['previewtab'] = 'Previsualitza';
$string['preview_geogebra'] = 'Previsualitza l\'activitat Geogebra';

$string['notopenyet'] = 'Ho sentim, aquesta activitat no estarà disponible fins {$a}';
$string['expired'] = 'Ho sentim, aquesta activitat es va tancar el {$a} i, per tant, ja no està disponible';
Expand All @@ -160,3 +159,4 @@
$string['lastmodifiedgrade'] = $string['dateteacher'];
$string['viewattempttab'] = 'Intent';
$string['extractedfromggb'] = 'arxius extrets des del ggb';
$string['msg_nosessions'] = 'Aquesta activitat Geogebra encara no té cap sessió';
19 changes: 9 additions & 10 deletions lang/en/geogebra.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
$string['noattempts'] = '-';
$string['name'] = 'Name';
$string['choosescripttype'] = 'Choose the script type';
$string['javacodebase'] = 'GeoGebra codebase';
$string['manualgrade'] = 'Is manual grade?';
$string['contentheader'] = 'Content';
$string['width'] = 'Width';
$string['height'] = 'Height';
$string['showsubmit'] = 'Show submit button';
Expand Down Expand Up @@ -75,13 +75,13 @@
$string['errorattempt'] = 'Error: attempt could not be saved.';

$string['viewtab'] = 'View';
$string['results'] = 'Results';
$string['resultstab'] = 'Results';
$string['reviewtab'] = 'Review';

$string['availabledate'] = 'Available from';
$string['duedate'] = 'Due date';

$string['javacodebase_help'] = 'GeoGebra jar files URL';
$string['filename'] = 'Filename';
$string['enableRightClick'] = 'Enable right click';
$string['enableLabelDrags'] = 'Enable dragging of labels';
Expand All @@ -92,20 +92,20 @@
$string['showAlgebraInput'] = 'Show inputbar';
$string['functionalityoptionsgrp'] = 'Functionality';
$string['interfaceoptionsgrp'] = 'User interface';
$string['warningnojava'] = 'This is a Java Applet created using GeoGebra from www.geogebra.org - it looks like you don\'t have Java installed, please go to www.java.com';
$string['filenotfound'] = 'Specified file doesn\'t exist';
$string['httpnotallowed'] = 'At the moment is not allowed to use external files';

$string['submitandfinish'] = 'Submit and finish';
$string['savewithoutsubmitting'] = 'Save without submitting';
$string['redirecttocourse'] = 'The activity has been saved. Going back to the course home page';
$string['unfinished'] = 'Unfinished';
$string['language']='Language';
$string['language'] = 'Language';
$string['resumeattempt'] = 'Resuming unfinished attempt';
$string['coursewithoutstudents'] = 'Course without students';
$string['deleteallattempts'] = 'Delete all attempts';
$string['view'] = 'View';
$string['gradeit'] = 'Grade';
$string['timing'] = 'Timing';
$string['ungraded'] = 'Ungraded';
$string['save'] = 'Save';
$string['autograde'] = 'Selfgrade activity';
Expand All @@ -131,8 +131,6 @@
$string['geogebra:grade'] = 'Grade GeoGebra';

$string['geogebra:addinstance'] = 'Add GeoGebra';
$string['header_geogebra']='GeoGebra Settings';
$string['header_score']='Avaluation Settings';
$string['filetype'] = 'Type';
$string['filetype_help'] = 'This setting determines how the GeoGebra activity is included in the course. There are up to 2 options:
Expand All @@ -150,20 +148,21 @@
$string['urledit_help'] = 'The ".ggb" file where you will find the GeoGebra activity.';

$string['datestudent'] = 'Last modified (submission)';
$string['dateteacher']= 'Last modified (grade)';
$string['dateteacher'] = 'Last modified (grade)';
$string['status'] = 'Estat';
$string['viewattempt'] = 'View';
$string['previewtab'] = 'Preview';

$string['preview_geogebra'] = 'Preview Geogebra activity';

$string['notopenyet'] = 'Sorry, this activity is not available until {$a}';
$string['expired'] = 'Sorry, this activity closed on {$a} and is no longer available';
$string['msg_noattempts']= 'You have done this activity the maximum number of times';
$string['msg_noattempts'] = 'You have done this activity the maximum number of times';
$string['lastmodifiedsubmission'] = 'Last modified (submission)';
$string['lastmodifiedgrade'] = 'Last modified (grade)';
$string['viewattempttab'] = 'View attempt';
$string['extractedfromggb'] = 'extracted files from ggb';

/* Revision Moodle 2.6 */
$string['event_course_module_viewed'] = 'Course module viewed';
$string['event_instances_list_viewed'] = 'Instances list viewed';
$string['event_instances_list_viewed'] = 'Instances list viewed';
$string['msg_nosessions'] = 'This Geogebra activity hasn\'t yet any session';
13 changes: 7 additions & 6 deletions lang/es/geogebra.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


/**
* Catalan strings for geogebra
* Spanish strings for geogebra
*
* You can have a rather longer description of the file as well,
* if you like, and it can span multiple lines.
Expand All @@ -35,8 +35,8 @@
$string['noattempts'] = '-';
$string['name'] = 'Nombre';
$string['choosescripttype'] = 'Escoge el tipo de actividad';
$string['javacodebase'] = 'Codebase de GeoGebra';
$string['manualgrade'] = 'Calificación manual?'; //Unused
$string['contentheader'] = 'Contenido';
$string['width'] = 'Ancho';
$string['height'] = 'Alto';
$string['showsubmit'] = 'Muestra el botón de entrega';
Expand Down Expand Up @@ -74,13 +74,12 @@
$string['errorattempt'] = 'Se ha producido un error. No se ha podido guardar el intento.';

$string['viewtab'] = 'Muestra';
$string['resultstab'] = 'Resultados';
$string['results'] = 'Resultados';
$string['reviewtab'] = 'Revisión';

$string['availabledate'] = 'Disponible desde';
$string['duedate'] = 'Hasta';

$string['javacodebase_help'] = 'URL de los archivos JAR de GeoGebra';
$string['filename'] = 'Nombre del archivo';
$string['enableRightClick'] = 'Habilita el botón derecho';
$string['enableLabelDrags'] = 'Permite arrastrar las etiquetas';
Expand All @@ -91,20 +90,20 @@
$string['showAlgebraInput'] = 'Muestra la barra de inserción'; //Unused
$string['functionalityoptionsgrp'] = 'Funcionalidades';
$string['interfaceoptionsgrp'] = 'Interfaz';
$string['warningnojava'] = 'Este Applet Java ha sido creado utilizando GeoGebra (www.geogebra.org) - posiblemente no tenga Java correctamente instalado, puede comprobarlo en www.java.com';
$string['filenotfound'] = 'El archivo indicado';
$string['httpnotallowed'] = 'No es posible utilizar archivos remotos';

$string['submitandfinish'] = 'Entrega y termina';
$string['savewithoutsubmitting'] = 'Guarda sin entregar';
$string['redirecttocourse'] = 'La actividad se ha guardado correctamente. Se está volviendo a la pantalla de inicio.';
$string['unfinished'] = 'No finalizado';
$string['language']='Idioma';
$string['language'] = 'Idioma';
$string['resumeattempt'] = 'Continuación de un intento anterior';
$string['coursewithoutstudents'] = 'No hay estudiantes inscritos en este curso';
$string['deleteallattempts'] = 'Eliminar todos los intentos';
$string['view'] = 'Ver';
$string['gradeit'] = 'Calificación';
$string['timing'] = 'Temporización';
$string['ungraded'] = 'Sin calificar';
$string['save'] = 'Guardar';
$string['autograde'] = 'Actividad autopuntuable';
Expand Down Expand Up @@ -154,6 +153,7 @@
$string['status'] = 'Estado';
$string['viewattempt'] = 'Visualizar';
$string['previewtab'] = 'Previsualizar';
$string['preview_geogebra'] = 'Previsualizar la actividad Geogebra';

$string['notopenyet'] = 'Esta actividad no estará disponible hasta {$a}';
$string['expired'] = 'Esta actividad se cerró el {$a} y, por lo tanto, ya no está disponible.';
Expand All @@ -162,3 +162,4 @@
$string['lastmodifiedgrade'] = $string['dateteacher'];
$string['viewattempttab'] = 'Intento';
$string['extractedfromggb'] = 'archivos extraidos desde el ggb';
$string['msg_nosessions'] = 'Esta actividad Geogebra todavía no tiene ninguna sessión';
Loading

0 comments on commit e24a776

Please sign in to comment.