diff --git a/main/exercice/admin.php b/main/exercice/admin.php index 83c8a68a3d..16a8806e25 100644 --- a/main/exercice/admin.php +++ b/main/exercice/admin.php @@ -1,4 +1,4 @@ - processCreation($form,'simple'); if($form -> getSubmitValue('edit') == 'true') Display::display_confirmation_message(get_lang('ExerciseEdited')); - } + } + if(api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { + Display::display_error_message(get_lang('SearchXapianModuleNotInstaled')); + } $form -> display (); echo '
'; // question list management diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index 05253b2f91..03e33b0597 100644 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -25,7 +25,7 @@ * Exercise class: This class allows to instantiate an object of type Exercise * @package dokeos.exercise * @author Olivier Brouckaert -* @version $Id: exercise.class.php 20975 2009-05-25 18:09:56Z cvargas1 $ +* @version $Id: exercise.class.php 21662 2009-06-29 14:55:09Z iflorespaz $ */ @@ -598,7 +598,7 @@ class Exercise // insert into the item_property table api_item_property_update($_course, TOOL_QUIZ, $this->id,'QuizAdded',$_user['user_id']); - if (api_get_setting('search_enabled')=='true') { + if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { $this -> search_engine_save(); } @@ -846,7 +846,7 @@ class Exercise api_sql_query($sql); api_item_property_update($_course, TOOL_QUIZ, $this->id,'QuizDeleted',$_user['user_id']); - if (api_get_setting('search_enabled')=='true') { + if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian') ) { $this -> search_engine_delete(); } } @@ -1156,7 +1156,7 @@ class Exercise function search_engine_edit() { // update search enchine and its values table if enabled - if (api_get_setting('search_enabled')=='true') { + if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { $course_id = api_get_course_id(); // actually, it consists on delete terms from db, insert new ones, create a new search engine document, and remove the old one @@ -1230,7 +1230,7 @@ class Exercise function search_engine_delete() { // remove from search engine if enabled - if (api_get_setting('search_enabled') == 'true') { + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian') ) { $course_id = api_get_course_id(); $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); $sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level IS NULL LIMIT 1'; diff --git a/main/exercice/exercise_admin.php b/main/exercice/exercise_admin.php index 7c81d71ae2..89cbdb0d1e 100644 --- a/main/exercice/exercise_admin.php +++ b/main/exercice/exercise_admin.php @@ -141,6 +141,9 @@ if ($form -> validate()) { Display::display_header($nameTools,"Exercise"); if ($objExercise->feedbacktype==1) Display::display_normal_message(get_lang("DirectFeedbackCantModifyTypeQuestion")); + if(api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { + Display::display_error_message(get_lang('SearchXapianModuleNotInstaled')); + } $form -> display (); } Display::display_footer(); \ No newline at end of file diff --git a/main/exercice/question.class.php b/main/exercice/question.class.php index 518c935043..b3f8f44d27 100644 --- a/main/exercice/question.class.php +++ b/main/exercice/question.class.php @@ -1,4 +1,4 @@ -removeFromList($deleteFromEx); - if (api_get_setting('search_enabled')=='true') { + if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { // disassociate question with this exercise $this -> search_engine_edit($deleteFromEx, FALSE, TRUE); } diff --git a/main/link/link.php b/main/link/link.php index da88afd455..4e695c1abe 100644 --- a/main/link/link.php +++ b/main/link/link.php @@ -1,4 +1,4 @@ -'; echo ''.Display::return_icon('back.png',get_lang('BackToLinksOverview')).get_lang('BackToLinksOverview').''; echo ''; - +if(api_get_setting('search_enabled')=='true') { + if (!extension_loaded('xapian')) { + Display::display_error_message(get_lang('SearchXapianModuleNotInstaled')); + } +} // Displaying the correct title and the form for adding a category or link. This is only shown when nothing // has been submitted yet, hence !isset($submitLink) if (($_GET['action']=="addlink" or $_GET['action']=="editlink") and empty($_POST['submitLink'])) { @@ -272,6 +276,7 @@ if (is_allowed_to_edit() and isset($_GET['action'])) { '; + if(api_get_setting('search_enabled')=='true') { require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'); diff --git a/main/link/linkfunctions.php b/main/link/linkfunctions.php index ea6ba0d76b..2d00f2ddf7 100644 --- a/main/link/linkfunctions.php +++ b/main/link/linkfunctions.php @@ -115,7 +115,8 @@ function addlinkcategory($type) api_sql_query($sql, __FILE__, __LINE__); $link_id = Database::insert_id(); - if ( (api_get_setting('search_enabled')=='true') && $link_id) { + + if ( (api_get_setting('search_enabled')=='true') && $link_id && extension_loaded('xapian')) { require_once(api_get_path(LIBRARY_PATH) .'search/DokeosIndexer.class.php'); require_once(api_get_path(LIBRARY_PATH) .'search/IndexableChunk.class.php'); require_once(api_get_path(LIBRARY_PATH) .'specific_fields_manager.lib.php');