Browse Source

Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x

Yannick Warnier 9 years ago
parent
commit
75fe226c55

+ 1 - 1
app/Migrations/Schema/V110/Version110.php

@@ -439,7 +439,7 @@ class Version110 extends AbstractMigrationChamilo
         $this->addSql("ALTER TABLE c_survey MODIFY COLUMN anonymous char(10) NOT NULL default '0'");
         $this->addSql("ALTER TABLE c_course_setting MODIFY COLUMN value varchar(255) default ''");
 
-        $this->addSql("UPDATE course_field SET field_type = 1 WHERE field_variable = 'special_course'");
+        $this->addSql("UPDATE course_field SET field_type = 13 WHERE field_variable = 'special_course'");
         $this->addSql("UPDATE user SET registration_date = NULL WHERE registration_date = '0000-00-00 00:00:00'");
         $this->addSql("UPDATE user SET expiration_date = NULL WHERE expiration_date = '0000-00-00 00:00:00'");
         $this->addSql("UPDATE track_e_default SET default_date = NULL WHERE default_date = '0000-00-00 00:00:00'");

+ 3 - 0
main/admin/archive_cleanup.php

@@ -28,6 +28,8 @@ if ($form->validate()) {
 	$htaccess = @file_get_contents($archive_path.'.htaccess');
 	$result = rmdirr($archive_path, true, true);
 
+	\Chamilo\CoreBundle\Composer\ScriptHandler::dumpCssFiles();
+
 	if (!empty($htaccess)) {
 		@file_put_contents($archive_path.'/.htaccess', $htaccess);
 	}
@@ -38,6 +40,7 @@ if ($form->validate()) {
 		$message = 'ArchiveDirCleanupFailed';
 		$type = 'error';
 	}
+
 	header('Location: '.api_get_self().'?msg='.$message.'&type='.$type);
 	exit;
 }

+ 1 - 1
main/calendar/agenda_js.php

@@ -14,7 +14,7 @@ $use_anonymous = true;
 $type = isset($_REQUEST['type']) && in_array($_REQUEST['type'], array('personal', 'course', 'admin', 'platform')) ? $_REQUEST['type'] : 'personal';
 $userId = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : null;
 
-if ($type == 'personal') {
+if ($type == 'personal' || $type == 'admin') {
     $cidReset = true; // fixes #5162
 }
 require_once '../inc/global.inc.php';

+ 9 - 12
main/exercice/upload_exercise.php

@@ -87,7 +87,7 @@ function lp_upload_quiz_main() {
 
     $link = '<a href="../exercice/quiz_template.xls">'.
         Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate')).get_lang('DownloadExcelTemplate').'</a>';
-    $form->addElement('advanced_settings', $link);
+    $form->addElement('label', '', $link);
 
     $table = new HTML_Table(array('class' => 'table'));
 
@@ -123,7 +123,7 @@ function lp_upload_quiz_main() {
     $form->addRule('user_upload_quiz', get_lang('ThisFieldIsRequired'), 'required');
 
     $form->add_progress_bar();
-    $form->addButtonUpload(get_lang('Send'), 'submit_upload_quiz');
+    $form->addButtonUpload(get_lang('Upload'), 'submit_upload_quiz');
 
     // Display the upload field
     $form->display();
@@ -181,7 +181,6 @@ function lp_upload_quiz_action_handling() {
     $questionTypeList = array();
     $questionTypeIndex = array();
     $categoryList = array();
-    $categoryIndex = array();
 
     // Reading all the first column items sequentially to create breakpoints
     for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
@@ -204,8 +203,6 @@ function lp_upload_quiz_action_handling() {
             $noNegativeScoreIndex[] = $i;
         } elseif ($data->sheets[0]['cells'][$i][1] == 'QuestionType') {
             $questionTypeIndex[] = $i;
-        } elseif ($data->sheets[0]['cells'][$i][1] == 'Category') {
-            $categoryIndex[] = $i;
         }
     }
 
@@ -249,6 +246,10 @@ function lp_upload_quiz_action_handling() {
                 if (isset($myData[1]) && $myData[1] == 'QuestionType') {
                     $questionTypeList[$k] = $myData[3];
                 }
+
+                if (isset($myData[1]) && $myData[1] == 'Category') {
+                    $categoryList[$k] = $myData[2];
+                }
             }
 
             if (!isset($questionTypeList[$k])) {
@@ -272,10 +273,6 @@ function lp_upload_quiz_action_handling() {
             //a complete line where 1st column is 'EnrichQuestion'
             $question_description[$m] = $column_data;
             $m++;
-        } elseif (in_array($i, $categoryIndex)) {
-            //a complete line where 1st column is 'Category'
-            $categoryList[$n] = $column_data;
-            $n++;
         } elseif (in_array($i, $noNegativeScoreIndex)) {
             //a complete line where 1st column is 'NoNegativeScore'
             $noNegativeScoreList[$z - 1] = $column_data;
@@ -346,9 +343,9 @@ function lp_upload_quiz_action_handling() {
                 $description = isset($question_description[$i][2]) ? $question_description[$i][2] : '';
 
                 $categoryId = null;
-                if (isset($categoryList[$i]) && isset($categoryList[$i][2]) && !empty($categoryList[$i][2])) {
-                    $categoryName = $categoryList[$i][2];
-                    $categoryId = TestCategory::get_category_id_for_title($categoryName, $courseId);
+                if (isset($categoryList[$i]) && !empty($categoryList[$i])) {
+                    $categoryName = $categoryList[$i];
+                    $categoryId = Testcategory::get_category_id_for_title($categoryName, $courseId);
                     if (empty($categoryId)) {
                         $category = new TestCategory(null, $categoryName, '');
                         $categoryId = $category->addCategoryInBDD();

+ 1 - 1
main/install/data.sql

@@ -753,7 +753,7 @@ INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, v
 INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable) VALUES (1, 1, 'user_chat_status','User chat status',0,0);
 INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable) VALUES (1, 1, 'google_calendar_url','Google Calendar URL',0,0);
 
-INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, default_value) VALUES (2, 1, 'special_course', 'Special course', 1 , 1, '');
+INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, default_value) VALUES (2, 13, 'special_course', 'Special course', 1 , 1, '');
 INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable) VALUES (2, 10, 'tags', 'Tags', 1, 1);
 INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable) VALUES (2, 19, 'video_url', 'VideoUrl', 1, 1);
 

+ 10 - 8
main/webservices/registration.soap.php

@@ -3082,6 +3082,7 @@ $server->wsdl->addComplexType(
         'subscribe' => array('name' => 'subscribe', 'type' => 'xsd:string'),
         'unsubscribe' => array('name' => 'unsubscribe', 'type' => 'xsd:string'),
         'visual_code' => array('name' => 'visual_code', 'type' => 'xsd:string'),
+        'disk_quota' => array('name' => 'disk_quota', 'type' => 'xsd:string'), // disk_quota in MB
         'original_course_id_name' => array('name' => 'original_course_id_name', 'type' => 'xsd:string'),
         'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'),
         'extra' => array('name' => 'extra', 'type' => 'tns:extrasList')
@@ -3162,21 +3163,24 @@ function WSEditCourse($params){
 
     foreach ($courses_params as $course_param) {
 
-        $tutor_id = $course_param['tutor_id'];
+        $tutor_id = isset($course_param['tutor_id']) ? $course_param['tutor_id'] : '';
         $title = $course_param['title'];
-        $category_code = $course_param['category_code'];
-        $department_name = $course_param['department_name'];
-        $department_url = $course_param['department_url'];
+        $category_code = isset($course_param['category_code']) ? $course_param['category_code'] : '';
+        $department_name = isset($course_param['department_name']) ? $course_param['department_name'] : '';
+        $department_url = isset($course_param['department_url']) ? $course_param['department_url'] : '';
         $course_language = $course_param['course_language'];
         $visibility = $course_param['visibility'];
         $subscribe = $course_param['subscribe'];
         $unsubscribe = $course_param['unsubscribe'];
         $visual_code = $course_param['visual_code'];
+        $diskQuota = isset($course_param['disk_quota']) ? $course_param['disk_quota'] : '100';
+        // Convert to MB
+        $diskQuota = $diskQuota * 1024 * 1024;
 
         $original_course_id_name = $course_param['original_course_id_name'];
         $original_course_id_value = $course_param['original_course_id_value'];
         $orig_course_id_value[] = $original_course_id_value;
-        $extra_list = $course_param['extra'];
+        $extra_list = isset($course_param['extra']) ? $course_param['extra'] : null;
 
         $courseInfo = CourseManager::getCourseInfoFromOriginalId(
             $original_course_id_value,
@@ -3204,8 +3208,6 @@ function WSEditCourse($params){
         if (empty($visual_code)) {
             $visual_code = CourseManager::generate_course_code(substr($title, 0, $maxlength));
         }
-
-        $disk_quota = '50000'; // TODO: A hard-coded value.
         $tutor_name = $tutor_name[0];
         $sql = "UPDATE $course_table SET
                     course_language='".Database::escape_string($course_language)."',
@@ -3215,9 +3217,9 @@ function WSEditCourse($params){
                     visual_code='".Database::escape_string($visual_code)."',
                     department_name='".Database::escape_string($department_name)."',
                     department_url='".Database::escape_string($department_url)."',
-                    disk_quota='".Database::escape_string($disk_quota)."',
                     visibility = '".Database::escape_string($visibility)."',
                     subscribe = '".Database::escape_string($subscribe)."',
+                    disk_quota='".Database::escape_string($diskQuota)."',
                     unsubscribe='".Database::escape_string($unsubscribe)."'
                 WHERE id ='".Database::escape_string($courseId)."'";
         $res = Database::query($sql);