Now is possible to save an exercise description with FF

skala
Julio Montoya 15 years ago
parent 0a71b57212
commit 432d135392
  1. 34
      main/exercice/exercise.class.php
  2. 45
      main/exercice/exercise_admin.php
  3. 6
      main/exercice/hotspot_admin.inc.php

@ -1,25 +1,5 @@
<?php <?php
/* /* For licensing terms, see /dokeos_license.txt */
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2008 Dokeos SPRL
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program 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 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/** /**
* Exercise class: This class allows to instantiate an object of type Exercise * Exercise class: This class allows to instantiate an object of type Exercise
@ -520,7 +500,6 @@ class Exercise
$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
$TBL_QUIZ_QUESTION= Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); $TBL_QUIZ_QUESTION= Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$id=$this->id; $id=$this->id;
$exercise=$this->exercise; $exercise=$this->exercise;
$description=$this->description; $description=$this->description;
@ -530,7 +509,6 @@ class Exercise
$feedbacktype=$this->feedbacktype; $feedbacktype=$this->feedbacktype;
$random=$this->random; $random=$this->random;
$active=$this->active; $active=$this->active;
if ($feedbacktype==1){ if ($feedbacktype==1){
$results_disabled = 1; $results_disabled = 1;
} else { } else {
@ -595,7 +573,6 @@ class Exercise
'".Database::escape_string($attempts)."', '".Database::escape_string($attempts)."',
'".Database::escape_string($feedbacktype)."' '".Database::escape_string($feedbacktype)."'
)"; )";
//var_dump($description);
api_sql_query($sql,__FILE__,__LINE__); api_sql_query($sql,__FILE__,__LINE__);
$this->id=Database::insert_id(); $this->id=Database::insert_id();
// insert into the item_property table // insert into the item_property table
@ -878,7 +855,7 @@ class Exercise
$form -> addElement('html','<div class="row"> $form -> addElement('html','<div class="row">
<div class="label"></div> <div class="label"></div>
<div class="formw" style="height:50px"> <div class="formw" style="height:50px">
<a href="javascript://" onclick=" return show_media()"> <span id="media_icon"> <img style="vertical-align: middle;" src="../img/looknfeelna.png" alt="" />&nbsp;'.get_lang('ExerciseDescription').'</span></a> <a href="javascript://" onclick=" return show_media()"> <span id="media_icon"> <img style="vertical-align: middle;" src="../img/looknfeel.png" alt="" />&nbsp;'.get_lang('ExerciseDescription').'</span></a>
</div> </div>
</div>'); </div>');
@ -886,13 +863,8 @@ class Exercise
if(is_array($type)){ if(is_array($type)){
$editor_config = array_merge($editor_config, $type); $editor_config = array_merge($editor_config, $type);
} }
/*
$form -> addElement ('html','<div id="media" style="display:none;">');
$form -> add_html_editor ('exerciseDescription', get_lang('langQuestionDescription'), null, null, array('ToolbarSet' => 'TestDescription', 'Width' => '100%', 'Height' => '200'));
$form -> addElement ('html','</div>');
*/
$form -> addElement ('html','<div id="media" style="display:block;">'); $form -> addElement ('html','<div class="HideFCKEditor" id="HiddenFCKexerciseDescription" >');
$form -> add_html_editor('exerciseDescription', get_lang('langExerciseDescription'), false, false, $editor_config); $form -> add_html_editor('exerciseDescription', get_lang('langExerciseDescription'), false, false, $editor_config);
$form -> addElement ('html','</div>'); $form -> addElement ('html','</div>');

@ -1,24 +1,5 @@
<?php <?php
/* /* For licensing terms, see /dokeos_license.txt */
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2009 Dokeos SPRL
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program 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 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/** /**
* Exercise administration * Exercise administration
@ -57,12 +38,26 @@ $htmlHeadXtra[] = '<script>
} }
} }
function FCKeditor_OnComplete( editorInstance )
{
if (document.getElementById ( \'HiddenFCK\' + editorInstance.Name )) {
HideFCKEditorByInstanceName (editorInstance.Name);
}
}
function HideFCKEditorByInstanceName ( editorInstanceName ) {
if (document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className == "HideFCKEditor" ) {
document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className = "media";
}
}
function show_media() { function show_media() {
if(document.getElementById(\'media\').style.display == \'none\') { var my_display = document.getElementById(\'HiddenFCKexerciseDescription\').style.display;
document.getElementById(\'media\').style.display = \'block\'; if(my_display== \'none\' || my_display == \'\') {
document.getElementById(\'HiddenFCKexerciseDescription\').style.display = \'block\';
document.getElementById(\'media_icon\').innerHTML=\'&nbsp;<img src="../img/looknfeelna.png" alt="" />&nbsp;'.get_lang('ExerciseDescription').'\'; document.getElementById(\'media_icon\').innerHTML=\'&nbsp;<img src="../img/looknfeelna.png" alt="" />&nbsp;'.get_lang('ExerciseDescription').'\';
} else { } else {
document.getElementById(\'media\').style.display = \'none\'; document.getElementById(\'HiddenFCKexerciseDescription\').style.display = \'none\';
document.getElementById(\'media_icon\').innerHTML=\'&nbsp;<img src="../img/looknfeel.png" alt="" />&nbsp;'.get_lang('ExerciseDescription').'\'; document.getElementById(\'media_icon\').innerHTML=\'&nbsp;<img src="../img/looknfeel.png" alt="" />&nbsp;'.get_lang('ExerciseDescription').'\';
} }
@ -97,7 +92,6 @@ $htmlHeadXtra[] = '<script>
include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
$objExercise = new Exercise(); $objExercise = new Exercise();
/********************* /*********************
* INIT FORM * INIT FORM
*********************/ *********************/
@ -144,6 +138,9 @@ if ($form -> validate()) {
if(api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { if(api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) {
Display::display_error_message(get_lang('SearchXapianModuleNotInstaled')); Display::display_error_message(get_lang('SearchXapianModuleNotInstaled'));
} }
// to hide the exercise description
echo '<style> .media { display:none;}</style>';
$form -> display (); $form -> display ();
} }
Display::display_footer(); Display::display_footer();

@ -192,18 +192,14 @@ if($modifyAnswers)
{ {
// At least 1 answer // At least 1 answer
if ($nbrAnswers > 1) { if ($nbrAnswers > 1) {
$nbrAnswers--; $nbrAnswers--;
// Remove the last answer // Remove the last answer
$tmp = array_pop($_SESSION['tmp_answers']['answer']); $tmp = array_pop($_SESSION['tmp_answers']['answer']);
$tmp = array_pop($_SESSION['tmp_answers']['comment']); $tmp = array_pop($_SESSION['tmp_answers']['comment']);
$tmp = array_pop($_SESSION['tmp_answers']['weighting']); $tmp = array_pop($_SESSION['tmp_answers']['weighting']);
$tmp = array_pop($_SESSION['tmp_answers']['hotspot_coordinates']); $tmp = array_pop($_SESSION['tmp_answers']['hotspot_coordinates']);
$tmp = array_pop($_SESSION['tmp_answers']['hotspot_type']); $tmp = array_pop($_SESSION['tmp_answers']['hotspot_type']);
} } else {
else
{
$msgErr=get_lang('MinHotspot'); $msgErr=get_lang('MinHotspot');
} }
} }

Loading…
Cancel
Save