Browse Source

Merge with ac90fc517e581d4df0b04e77f5ee3cfdc908970b

Ivan Tcholakov 14 years ago
parent
commit
46778bb915

+ 23 - 16
main/create_course/add_course.php

@@ -121,23 +121,30 @@ $form->applyFilter('select_language', 'html_filter');
 
 if ($course_validation_feature) {
 
-    // Terms and conditions to be accepted before sending a course request.
-    $form->addElement('checkbox', 'legal', get_lang('IAcceptTermsAndConditions'), '', 1);
-    $form->addRule('legal', get_lang('YouHaveToAcceptTermsAndConditions'), 'required', '', '');
-    // Link to terms and conditios.
-    // TODO: This hardcoded value is to be corrected/eliminated.
-    $link_terms_and_conditions = '<script type="text/JavaScript">
-    <!--
-    function MM_openBrWindow(theURL,winName,features) { //v2.0
-      window.open(theURL,winName,features);
+    // URL to terms and conditions.
+    $terms_and_conditions_url = trim(api_get_setting('course_validation_terms_and_conditions_url'));
+    if (empty($terms_and_conditions_url)) {
+        // TODO: If Chamilo's module "Terms and conditions" is active, we may get the URL from there.
+    }
+
+    if (!empty($terms_and_conditions_url)) {
+        // Terms and conditions to be accepted before sending a course request.
+        $form->addElement('checkbox', 'legal', get_lang('IAcceptTermsAndConditions'), '', 1);
+        $form->addRule('legal', get_lang('YouHaveToAcceptTermsAndConditions'), 'required', '', '');
+        // Link to terms and conditions.
+        $link_terms_and_conditions = '<script type="text/JavaScript">
+        <!--
+        function MM_openBrWindow(theURL,winName,features) { //v2.0
+            window.open(theURL,winName,features);
+        }
+        //-->
+        </script>
+        <div class="row">
+        <div class="formw">
+        <a href="#" onclick="javascript: MM_openBrWindow(\''.$terms_and_conditions_url.'\',\'Conditions\',\'scrollbars=yes, width=800\')">';
+        $link_terms_and_conditions .= get_lang('ReadTermsAndConditions').'</a></div></div>';
+        $form->addElement('html', $link_terms_and_conditions);
     }
-    //-->
-    </script>
-    <div class="row">
-    <div class="formw">
-    <a href="#" onclick="javascript: MM_openBrWindow(\'http://TODO.change.this/hardcoded/value/use/a/setting.html\',\'Conditions\',\'scrollbars=yes, width=800\')">';
-    $link_terms_and_conditions .= get_lang('ReadTermsAndConditions').'</a></div></div>';
-    $form->addElement('html', $link_terms_and_conditions);
 
 }
 

+ 2 - 1
main/install/db_main.sql

@@ -763,7 +763,8 @@ VALUES
 ('timezone_value', 'timezones', 'select', 'Timezones', '', 'TimezoneValueTitle','TimezoneValueComment',NULL,'Timezones', 1),
 ('allow_user_course_subscription_by_course_admin', NULL, 'radio', 'Security', 'true', 'AllowUserCourseSubscriptionByCourseAdminTitle', 'AllowUserCourseSubscriptionByCourseAdminComment', NULL, NULL, 1),
 ('show_link_bug_notification', NULL, 'radio', 'Platform', 'true', 'ShowLinkBugNotificationTitle', 'ShowLinkBugNotificationComment', NULL, NULL, 0),
-('course_validation', NULL, 'radio', 'Platform', 'false', 'EnableCourseValidation', 'EnableCourseValidationComment', NULL, NULL, 0),
+('course_validation', NULL, 'radio', 'Platform', 'false', 'EnableCourseValidation', 'EnableCourseValidationComment', NULL, NULL, 1),
+('course_validation_terms_and_conditions_url', NULL, 'textfield', 'Platform', '', 'CourseValidationTermsAndConditionsLink', 'CourseValidationTermsAndConditionsLinkComment', NULL, NULL, 1),
 ('chamilo_database_version', NULL, 'textfield', NULL, '1.8.8.12378', 'DokeosDatabaseVersion', '', NULL, NULL, 0);
 
 

+ 2 - 1
main/install/migrate-db-1.8.7-1.8.8-pre.sql

@@ -36,9 +36,10 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('users_copy
 UPDATE settings_current SET selected_value='1' WHERE variable='allow_social_tool';
 UPDATE settings_current SET selected_value='1' WHERE variable='allow_message_tool';
 
-INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_validation', NULL, 'radio', 'Platform', 'false', 'EnableCourseValidation', 'EnableCourseValidationComment', NULL, NULL, 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_validation', NULL, 'radio', 'Platform', 'false', 'EnableCourseValidation', 'EnableCourseValidationComment', NULL, NULL, 1);
 INSERT INTO settings_options (variable, value, display_text) VALUES ('course_validation', 'true', 'Yes');
 INSERT INTO settings_options (variable, value, display_text) VALUES ('course_validation', 'false', 'No');
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_validation_terms_and_conditions_url', NULL, 'textfield', 'Platform', '', 'CourseValidationTermsAndConditionsLink', 'CourseValidationTermsAndConditionsLinkComment', NULL, NULL, 1);
 UPDATE settings_current SET selected_value='1' WHERE variable='advanced_filemanager';
 -- xxSTATSxx
 ALTER TABLE track_e_exercices ADD COLUMN orig_lp_item_view_id INT NOT NULL DEFAULT 0;

+ 2 - 0
main/lang/bulgarian/admin.inc.php

@@ -1209,4 +1209,6 @@ $AcceptedCourseRequests = "Одобрени заявки за курсове";
 $RejectedCourseRequests = "Отхвърлени заявки за курсове";
 $EnableCourseValidation = "Одобряване на новите курсове";
 $EnableCourseValidationComment = "Когато функцията \"Одобряване на новите курсове\" е активирана, преподавател не може да създава нов курс. Той/тя попълва заявка за нов курс. Администраторът на системата преглежда заявката и или я одобрява, или я отхвърля.<br />Тази функция силно зависи от автоматично генерирани e-mail съобщения; настройте достъп на системата до e-mail сървър чрез специално открит за нея акаунт.";
+$CourseValidationTermsAndConditionsLink = "Одобряване на новите курсове - връзка към Условията за ползване";
+$CourseValidationTermsAndConditionsLinkComment = "Това е URL на документа \"Условия за ползване\", който е валиден при подаване на заявка за нов курс. Ако адресът тук е зададен, преди потребителят да подаде заявката ще трябва да прочете и да се съгласи с условията за ползаване.";
 ?>

+ 2 - 0
main/lang/english/admin.inc.php

@@ -1277,4 +1277,6 @@ $RejectedCourseRequests = "Rejected training requests";
 $BrowscapInfo = "Browscap loading browscap.ini file that contains a large amount of data on the browser and its capabilities, so it can be used by the function get_browser () PHP";
 $EnableCourseValidation = "Training validation";
 $EnableCourseValidationComment = "When \"Training validation\" feature is activated, a teacher is not able to create a training alone. He/she fills a training request. The platform administrator reviews the request and approves it or rejects it.<br />This feature relies on automated e-mail messages; set Chamilo to access an e-mail server and to use a dedicated an e-mail account.";
+$CourseValidationTermsAndConditionsLink = "Training validation - a link to the terms and conditions";
+$CourseValidationTermsAndConditionsLinkComment = "This is the URL to the \"Terms and Conditions\" document that is valid for making a training request. If the address here is set, before sending a training request the user should read and agree with these terms and conditions.";
 ?>