Bladeren bron

Merge with 1.10.x

jmontoyaa 8 jaren geleden
bovenliggende
commit
94c592a9d7

+ 9 - 11
main/announcements/announcements.php

@@ -164,8 +164,6 @@ switch ($action) {
             $userIdToSearch = $filterData['user_id'];
         }
 
-        //$searchFormToString = $searchForm->returnForm();
-
         // jqgrid will use this URL to do the selects
         $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_course_announcements&'.api_get_cidreq().'&title_to_search='.$keyword.'&user_id_to_search='.$userIdToSearch;
         $deleteUrl = api_get_path(WEB_AJAX_PATH).'announcement.ajax.php?a=delete_item&'.api_get_cidreq();
@@ -312,7 +310,6 @@ switch ($action) {
                 if (!api_is_course_coach() ||
                     api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $_GET['id'])
                 ) {
-
                     AnnouncementManager::change_visibility_announcement(
                         $_course,
                         $_GET['id']
@@ -320,7 +317,6 @@ switch ($action) {
                     Display::addFlash(Display::return_message(get_lang('VisibilityChanged')));
                     header('Location: '.$homeUrl);
                     exit;
-
                 }
             }
         }
@@ -364,7 +360,7 @@ switch ($action) {
                     get_lang('RemindInactiveLearnersMailSubject'),
                     api_get_setting('siteName')
                 );
-            } elseif (isset($_GET['remindallinactives']) && $_GET['remindallinactives'] == 'true') {
+            } elseif (isset($_GET['remindallinactives']) && $_GET['remindallinactives'] === 'true') {
                 // we want to remind inactive users. The $_GET['since'] parameter
                 // determines which users have to be warned (i.e the users who have been inactive for x days or more
                 $since = isset($_GET['since']) ? intval($_GET['since']) : 6;
@@ -419,11 +415,10 @@ switch ($action) {
             );
         } else {
             if (!isset($announcement_to_modify)) {
-                $announcement_to_modify = "";
+                $announcement_to_modify = '';
             }
             $element = CourseManager::addGroupMultiSelect($form, $group_id, array());
             $form->setRequired($element);
-
             $form->addElement(
                 'checkbox',
                 'email_ann',
@@ -459,9 +454,7 @@ switch ($action) {
             $htmlTags .= "<b>".$tag."</b><br />";
         }
 
-        $form->addHtml(
-            "<div class='form-group'><div class='col-sm-2'></div><div class='col-sm-8'><div class='alert alert-info'>".$htmlTags."</div></div></div>"
-        );
+        $form->addLabel('', "<div class='alert alert-info'>".$htmlTags."</div>");
         $form->addHtmlEditor(
             'content',
             get_lang('Description'),
@@ -478,7 +471,12 @@ switch ($action) {
             $form->addCheckBox('send_to_users_in_session', null, get_lang('SendToUsersInSessions'));
         }
 
-        $form->addCheckBox('send_to_hrm_users', null, get_lang('SendAnnouncementCopyToDRH'));
+        $config = api_get_configuration_value('announcements_hide_send_to_hrm_users');
+
+        if ($config === false) {
+            $form->addCheckBox('send_to_hrm_users', null, get_lang('SendAnnouncementCopyToDRH'));
+        }
+
         $form->addButtonSave(get_lang('ButtonPublishAnnouncement'));
         $form->setDefaults($defaults);
 

+ 9 - 11
main/document/document.php

@@ -1120,7 +1120,7 @@ if ($is_allowed_to_edit ||
     if (isset($_POST['action']) && isset($_POST['ids'])) {
         $files = $_POST['ids'];
         $readonlyAlreadyChecked = false;
-        $messages = null;
+        $messages = '';
         $items = array(
             '/audio',
             '/flash',
@@ -1151,12 +1151,10 @@ if ($is_allowed_to_edit ||
                             null,
                             $sessionId
                         )) {
-                            Display::addFlash(Display::return_message(get_lang('VisibilityChanged').': '.$data['title'], 'confirmation'));
+                            $messages .= Display::return_message(get_lang('VisibilityChanged').': '.$data['title'], 'confirmation');
                         } else {
-                            Display::addFlash(Display::return_message(get_lang('ViModProb'), 'error'));
+                            $messages .= Display::return_message(get_lang('ViModProb'), 'error');
                         }
-                        header('Location: '.$currentUrl);
-                        exit;
                         break;
                     case 'set_visible':
                         $visibilityCommand = 'visible';
@@ -1172,12 +1170,10 @@ if ($is_allowed_to_edit ||
                             null,
                             $sessionId
                         )) {
-                            Display::addFlash(Display::return_message(get_lang('VisibilityChanged').': '.$data['title'], 'confirmation'));
+                            $messages .= Display::return_message(get_lang('VisibilityChanged').': '.$data['title'], 'confirmation');
                         } else {
-                            Display::addFlash(Display::return_message(get_lang('ViModProb'), 'error'));
+                            $messages .=  Display::return_message(get_lang('ViModProb'), 'error');
                         }
-                        header('Location: '.$currentUrl);
-                        exit;
                         break;
                     case 'delete':
                         // Check all documents scheduled for deletion
@@ -1193,8 +1189,7 @@ if ($is_allowed_to_edit ||
                                         $id,
                                         false,
                                         $sessionId
-                                    )
-                                    ) {
+                                    )) {
                                         $messages .= Display::return_message(
                                             get_lang('CantDeleteReadonlyFiles'),
                                             'error'
@@ -1224,7 +1219,10 @@ if ($is_allowed_to_edit ||
                 }
             }
         } // endforeach
+
         Display::addFlash($messages);
+        header('Location: '.$currentUrl);
+        exit;
     }
 }
 

+ 16 - 1
main/inc/lib/document.lib.php

@@ -5588,12 +5588,27 @@ class DocumentManager
      */
     public static function build_edit_icons($document_data, $id, $is_template, $is_read_only = 0, $visibility)
     {
+        $sessionId = api_get_session_id();
         $web_odf_extension_list = DocumentManager::get_web_odf_extension_list();
         $document_id = $document_data['id'];
         $type = $document_data['filetype'];
         $is_read_only = $document_data['readonly'];
         $path = $document_data['path'];
-        $parent_id = DocumentManager::get_document_id(api_get_course_info(), dirname($path));
+
+        $parent_id = DocumentManager::get_document_id(
+            api_get_course_info(),
+            dirname($path),
+            0
+        );
+
+        if (empty($parent_id) && !empty($sessionId)) {
+            $parent_id = DocumentManager::get_document_id(
+                api_get_course_info(),
+                dirname($path),
+                $sessionId
+            );
+        }
+
         $curdirpath = dirname($document_data['path']);
         $is_certificate_mode = DocumentManager::is_certificate_mode($path);
         $curdirpath = urlencode($curdirpath);

+ 2 - 0
main/install/configuration.dist.php

@@ -247,3 +247,5 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
 //$_configuration['packager'] = 'chamilo';
 // List of driver to plugin in ckeditor
 //$_configuration['editor_driver_list'] = ['PersonalDriver', 'CourseDriver'];
+// Hide send to hrm users options in announcements
+//$_configuration['announcements_hide_send_to_hrm_users'] = true;

+ 6 - 6
main/template/default/agenda/month.tpl

@@ -126,7 +126,7 @@ $(document).ready(function() {
                 var end_date_value = end.format('{{ js_format_date }}');
 
                 $('#start_date').html(start_date_value);
-                
+
                 if (start_date_value == end_date_value) {
                     $('#end_date').html(' - ' + end_date_value);
                 } else {
@@ -138,7 +138,7 @@ $(document).ready(function() {
 				$('#color_calendar').removeClass('group_event');
 				$('#color_calendar').addClass('label_tag');
 				$('#color_calendar').addClass('{{ type_event_class }}');
-                                
+
                 //It shows the CKEDITOR while Adding an Event
                 $('#cke_content').show();
                 //It Fixing a minor bug with textarea ckeditor.remplace
@@ -153,7 +153,7 @@ $(document).ready(function() {
 						'{{ "Add" | get_lang }}' : function() {
 							var bValid = true;
 							bValid = bValid && checkLength(title, "title", 1, 255);
-                                                        
+
                             //Update the CKEditor Instance to the remplaced textarea, ready to be serializable
                             for ( instance in CKEDITOR.instances ) {
                                 CKEDITOR.instances[instance].updateElement();
@@ -277,7 +277,7 @@ $(document).ready(function() {
                 $('#color_calendar').removeClass('personal_event');
                 $('#color_calendar').removeClass('group_event');
                 $('#color_calendar').addClass(calEvent.type+'_event');
-                
+
                 //It hides the CKEDITOR while clicking an existing Event
                 $('#cke_content').hide();
 
@@ -540,8 +540,8 @@ $(document).ready(function() {
 				}
 			});
         },
-		axisFormat: 'h(:mm)a',
-		timeFormat: 'h:mm',
+		axisFormat: 'H(:mm)', // pm-am format -> h(:mm)a
+		timeFormat: 'H:mm',   // pm-am format -> h:mm
 		loading: function(bool) {
 			if (bool) $('#loading').show();
 			else $('#loading').hide();