diff --git a/main/document/create_document.php b/main/document/create_document.php index 8f7d5fb412..39b5d420d0 100755 --- a/main/document/create_document.php +++ b/main/document/create_document.php @@ -425,19 +425,35 @@ if (!$is_certificate_mode && !is_my_shared_folder($_user['user_id'], $_GET['dir' if (is_array($folders)) { $escaped_folders = array(); foreach ($folders as $key => & $val) { - $escaped_folders[$key] = Database::escape_string($val); + //Hide some folders + if($val=='/HotPotatoes_files' || $val=='/certificates' || basename($val)=='css'){ + continue; + } + //Admin setting for Hide/Show the folders of all users + if(api_get_setting('show_users_folders') == 'false' && (strstr($val, '/shared_folder') || strstr($val, 'shared_folder_session_'))){ + continue; + } + //Admin setting for Hide/Show Default folders to all users + if(api_get_setting('show_default_folders') == 'false' && ($val=='/images' || $val=='/flash' || $val=='/audio' || $val=='/video' || strstr($val, '/images/gallery') || $val=='/video/flv')){ + continue; + } + //Admin setting for Hide/Show chat history folder + if(api_get_setting('show_chat_folder') == 'false' && $val=='/chat_files'){ + continue; + } + + $escaped_folders[$key] = Database::escape_string($val); } $folder_sql = implode("','", $escaped_folders); $doc_table = Database::get_course_table(TABLE_DOCUMENT); $sql = "SELECT * FROM $doc_table WHERE filetype='folder' AND path IN ('".$folder_sql."')"; $res = Database::query($sql); $folder_titles = array(); - while ($obj = Database::fetch_object($res)) { + while ($obj = Database::fetch_object($res)) { $folder_titles[$obj->path] = $obj->title; } } - } else { - + } else { if (is_array($folders)) { foreach ($folders as & $folder) { $folder_titles[$folder] = basename($folder); @@ -449,6 +465,23 @@ if (!$is_certificate_mode && !is_my_shared_folder($_user['user_id'], $_GET['dir' $parent_select -> addOption(get_lang('HomeDirectory'), '/'); if (is_array($folders)) { foreach ($folders as & $folder) { + //Hide some folders + if($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css'){ + continue; + } + //Admin setting for Hide/Show the folders of all users + if(api_get_setting('show_users_folders') == 'false' && (strstr($folder, '/shared_folder') || strstr($folder, 'shared_folder_session_'))){ + continue; + } + //Admin setting for Hide/Show Default folders to all users + if(api_get_setting('show_default_folders') == 'false' && ($folder=='/images' || $folder=='/flash' || $folder=='/audio' || $folder=='/video' || strstr($folder, '/images/gallery') || $folder=='/video/flv')){ + continue; + } + //Admin setting for Hide/Show chat history folder + if(api_get_setting('show_chat_folder') == 'false' && $folder=='/chat_files'){ + continue; + } + $selected = (substr($dir,0,-1) == $folder) ? ' selected="selected"' : ''; $path_parts = explode('/', $folder); $folder_titles[$folder] = cut($folder_titles[$folder], 80); diff --git a/main/document/document.inc.php b/main/document/document.inc.php index 73ecb06a3f..bd21193012 100755 --- a/main/document/document.inc.php +++ b/main/document/document.inc.php @@ -146,33 +146,30 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility $tooltip_title = $tooltip_title[0]; $tooltip_title_alt = $tooltip_title; - if ($tooltip_title == 'shared_folder') { + if ($path == '/shared_folder') { $tooltip_title_alt = get_lang('UserFolders'); - }elseif(strstr($tooltip_title, 'shared_folder_session_')) { + }elseif(strstr($path, 'shared_folder_session_')) { $tooltip_title_alt = get_lang('UserFolders').' ('.api_get_session_name($current_session_id).')'; }elseif(strstr($tooltip_title, 'sf_user_')) { $userinfo = Database::get_user_info_from_id(substr($tooltip_title, 8)); $tooltip_title_alt = get_lang('UserFolder').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']); } - elseif($tooltip_title == 'chat_files') { + elseif($path == '/chat_files') { $tooltip_title_alt = get_lang('ChatFiles'); } - elseif($tooltip_title == 'certificates') { - $tooltip_title_alt = get_lang('CertificatesFiles'); - } - elseif($tooltip_title == 'video') { + elseif($path == '/video') { $tooltip_title_alt = get_lang('Video'); } - elseif($tooltip_title == 'audio') { + elseif($path == '/audio') { $tooltip_title_alt = get_lang('Audio'); } - elseif($tooltip_title == 'flash') { + elseif($path == '/flash') { $tooltip_title_alt = get_lang('Flash'); } - elseif($tooltip_title == 'images') { + elseif($path == '/images') { $tooltip_title_alt = get_lang('Images'); } - elseif($tooltip_title == 'gallery') { + elseif($path == '/images/gallery') { $tooltip_title_alt = get_lang('DefaultCourseImages'); } @@ -211,10 +208,10 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility } else{ if(preg_match('/shared_folder/', urldecode($url)) && preg_match('/shared_folder$/', urldecode($url))==false && preg_match('/shared_folder_session_'.$current_session_id.'$/', urldecode($url))==false){ - return ''.build_document_icon_tag($filetype, $tooltip_title).Display::return_icon('shared.png', get_lang('ResourceShared'), array('hspace' => '5', 'align' => 'middle', 'height' => 22, 'width' => 22)).''; + return ''.build_document_icon_tag($filetype, $path).Display::return_icon('shared.png', get_lang('ResourceShared'), array('hspace' => '5', 'align' => 'middle', 'height' => 22, 'width' => 22)).''; } else{ - return ''.build_document_icon_tag($filetype, $tooltip_title).''; + return ''.build_document_icon_tag($filetype, $path).''; } } } @@ -234,16 +231,16 @@ function build_document_icon_tag($type, $path) { if ($type == 'file') { $icon = choose_image($basename); } else { - if ($basename == 'shared_folder') { + if ($path == '/shared_folder') { $icon = 'folder_users.gif'; if ($is_allowed_to_edit) { $basename = get_lang('HelpUsersFolder'); } else { $basename = get_lang('UserFolders'); } - }elseif(strstr($basename, 'shared_folder_session_')) { + }elseif(strstr($path, 'shared_folder_session_')) { if ($is_allowed_to_edit) { - $basename = '***('.api_get_session_name($current_session_id).')*** '.get_lang('HelpSharedFolder'); + $basename = '***('.api_get_session_name($current_session_id).')*** '.get_lang('HelpUsersFolder'); } else { $basename = get_lang('UserFolders').' ('.api_get_session_name($current_session_id).')'; } @@ -259,10 +256,10 @@ function build_document_icon_tag($type, $path) { } $basename = get_lang('UserFolder').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']); - } else { $icon = 'folder_document.gif'; - if($basename=='audio'){ + + if($path=='/audio'){ $icon = 'folder_audio.gif'; if(api_is_allowed_to_edit()){ $basename=get_lang('HelpDefaultDirDocuments'); @@ -270,8 +267,8 @@ function build_document_icon_tag($type, $path) { else{ $basename=get_lang('Audio'); } - } - elseif($basename =='flash'){ + } + elseif($path =='/flash'){ $icon = 'folder_flash.gif'; if(api_is_allowed_to_edit()){ $basename=get_lang('HelpDefaultDirDocuments'); @@ -280,7 +277,7 @@ function build_document_icon_tag($type, $path) { $basename=get_lang('Flash'); } } - elseif($basename =='images'){ + elseif($path =='/images'){ $icon = 'folder_images.gif'; if(api_is_allowed_to_edit()){ $basename=get_lang('HelpDefaultDirDocuments'); @@ -289,7 +286,7 @@ function build_document_icon_tag($type, $path) { $basename=get_lang('Images'); } } - elseif($basename =='video'){ + elseif($path =='/video'){ $icon = 'folder_video.gif'; if(api_is_allowed_to_edit()){ $basename=get_lang('HelpDefaultDirDocuments'); @@ -298,7 +295,7 @@ function build_document_icon_tag($type, $path) { $basename=get_lang('Video'); } } - elseif($basename =='gallery'){ + elseif($path =='/images/gallery'){ $icon = 'folder_gallery.gif'; if(api_is_allowed_to_edit()){ $basename=get_lang('HelpDefaultDirDocuments'); @@ -307,7 +304,7 @@ function build_document_icon_tag($type, $path) { $basename=get_lang('Gallery'); } } - elseif($basename =='chat_files'){ + elseif($path =='/chat_files'){ $icon = 'folder_chat.gif'; if(api_is_allowed_to_edit()){ $basename=get_lang('HelpFolderChat'); @@ -316,15 +313,6 @@ function build_document_icon_tag($type, $path) { $basename=get_lang('ChatFiles'); } } - elseif($basename =='certificates'){ - $icon = 'folder_certificates.gif'; - if(api_is_allowed_to_edit()){ - $basename = get_lang('HelpFolderCertificates'); - } - else{ - $basename = get_lang('Certificates'); - } - } } } @@ -470,6 +458,23 @@ function build_move_to_selector($folders, $curdirpath, $move_file, $group_dir = if (is_array($folders)) { foreach ($folders as & $folder) { + //Hide some folders + if($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css'){ + continue; + } + //Admin setting for Hide/Show the folders of all users + if(api_get_setting('show_users_folders') == 'false' && (strstr($folder, '/shared_folder') || strstr($folder, 'shared_folder_session_'))){ + continue; + } + //Admin setting for Hide/Show Default folders to all users + if(api_get_setting('show_default_folders') == 'false' && ($folder=='/images' || $folder=='/flash' || $folder=='/audio' || $folder=='/video' || strstr($folder, '/images/gallery') || $folder=='/video/flv')){ + continue; + } + //Admin setting for Hide/Show chat history folder + if(api_get_setting('show_chat_folder') == 'false' && $folder=='/chat_files'){ + continue; + } + // You cannot move a file to: // 1. current directory // 2. inside the folder you want to move @@ -489,7 +494,7 @@ function build_move_to_selector($folders, $curdirpath, $move_file, $group_dir = if (($curdirpath != $folder) && ($folder != $move_file) && (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')) { // Cannot copy dir into his own subdir if (api_get_setting('use_document_title')) { $path_displayed = get_titles_of_path($folder); - } + } $display_folder = substr($path_displayed,strlen($group_dir)); $display_folder = ($display_folder == '') ? get_lang('Documents') : $display_folder; $form .= ''."\n"; diff --git a/main/document/document.php b/main/document/document.php index 02cff57db5..6b2a79aa80 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -823,11 +823,26 @@ if (isset($docs_and_folders) && is_array($docs_and_folders)) { // Data for checkbox if (($is_allowed_to_edit || $group_member_with_upload_rights) && count($docs_and_folders) > 1) { $row[] = $id['path']; + } + + // Hide HotPotatoes Certificates and all css folders + if($id['path']=='/HotPotatoes_files' || $id['path']=='/certificates' || basename($id['path'])=='css'){ + continue; + } + + //Admin setting for Hide/Show the folders of all users + if(api_get_setting('show_users_folders') == 'false' && ($id['path']=='/shared_folder' || strstr($id['path'], 'shared_folder_session_'))){ + continue; + } + + //Admin setting for Hide/Show Default folders to all users + if(api_get_setting('show_default_folders') == 'false' && ($id['path']=='/images' || $id['path']=='/flash' || $id['path']=='/audio' || $id['path']=='/video')){ + continue; } - // Hide HotPotatoes and css folders - if(basename($id['path'])=='HotPotatoes_files' || basename($id['path'])=='css'){ - break; + //Admin setting for Hide/Show chat history folder + if(api_get_setting('show_chat_folder') == 'false' && $id['path']=='/chat_files'){ + continue; } // Show the owner of the file only in groups diff --git a/main/inc/banner.inc.php b/main/inc/banner.inc.php index 1d2a70c08d..ce03a88bdd 100755 --- a/main/inc/banner.inc.php +++ b/main/inc/banner.inc.php @@ -430,10 +430,6 @@ if (isset($interbreadcrumb) && is_array($interbreadcrumb)) { $navigation_item['title'] = get_lang('ChatFiles'); } - elseif($breadcrumb_step['name'] == 'certificates') { - - $navigation_item['title'] = get_lang('CertificatesFiles'); - } elseif($breadcrumb_step['name'] == 'images') { $navigation_item['title'] = get_lang('Images'); diff --git a/main/install/db_main.sql b/main/install/db_main.sql index 68fef4e9c6..3aa441e40f 100755 --- a/main/install/db_main.sql +++ b/main/install/db_main.sql @@ -784,6 +784,9 @@ VALUES ('students_export2pdf', NULL,'radio', 'Tools', 'true', 'EnabledStudentExport2PDFTitle', 'EnabledStudentExport2PDFComment',NULL,NULL, 0), ('exercise_min_score', NULL,'textfield', 'Course', '', 'ExerciseMinScoreTitle', 'ExerciseMinScoreComment','platform',NULL, 1), ('exercise_max_score', NULL,'textfield', 'Course', '', 'ExerciseMaxScoreTitle', 'ExerciseMaxScoreComment','platform',NULL, 1), +('show_users_folders', NULL,'radio', 'Tools', 'true', 'ShowUsersFoldersTitle','ShowUsersFoldersComment',NULL,NULL, 0), +('show_default_folders', NULL,'radio', 'Tools', 'true', 'ShowDefaultFoldersTitle','ShowDefaultFoldersComment',NULL,NULL, 0), +('show_chat_folder', NULL,'radio', 'Tools', 'true', 'ShowChatFolderTitle','ShowChatFolderComment',NULL,NULL, 0), ('chamilo_database_version', NULL,'textfield', NULL, '1.8.8.13174','DokeosDatabaseVersion','', NULL, NULL, 0); @@ -1026,7 +1029,13 @@ VALUES ('enabled_insertHtml','true','Yes'), ('enabled_insertHtml','false','No'), ('students_export2pdf','true','Yes'), -('students_export2pdf','false','No'); +('students_export2pdf','false','No'), +('show_users_folders','true','Yes'), +('show_users_folders','false','No'), +('show_default_folders','true','Yes'), +('show_default_folders','false','No'), +('show_chat_folder','true','Yes'), +('show_chat_folder','false','No'); UNLOCK TABLES; diff --git a/main/install/migrate-db-1.8.7-1.8.8-pre.sql b/main/install/migrate-db-1.8.7-1.8.8-pre.sql index af6a46a30f..b91600eabd 100755 --- a/main/install/migrate-db-1.8.7-1.8.8-pre.sql +++ b/main/install/migrate-db-1.8.7-1.8.8-pre.sql @@ -97,6 +97,23 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('students_e INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('exercise_min_score', NULL,'textfield', 'Course', '', 'ExerciseMinScoreTitle', 'ExerciseMinScoreComment','platform',NULL, 1); INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('exercise_max_score', NULL,'textfield', 'Course', '', 'ExerciseMaxScoreTitle', 'ExerciseMaxScoreComment','platform',NULL, 1); +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_users_folders',NULL,'radio','Tools','true','ShowUsersFoldersTitle','ShowUsersFoldersComment',NULL,NULL, 0); +INSERT INTO settings_options (variable, value, display_text) VALUES ('show_users_folders', 'true', 'Yes'); +INSERT INTO settings_options (variable, value, display_text) VALUES ('show_users_folders', 'false', 'No'); + +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_default_folders',NULL,'radio','Tools','true','ShowDefaultFoldersTitle','ShowDefaultFoldersComment',NULL,NULL, 0); +INSERT INTO settings_options (variable, value, display_text) VALUES ('show_default_folders', 'true', 'Yes'); +INSERT INTO settings_options (variable, value, display_text) VALUES ('show_default_folders', 'false', 'No'); + +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('show_chat_folder',NULL,'radio','Tools','true','ShowChatFolderTitle','ShowChatFolderComment',NULL,NULL, 0); +INSERT INTO settings_options (variable, value, display_text) VALUES ('show_chat_folder', 'true', 'Yes'); +INSERT INTO settings_options (variable, value, display_text) VALUES ('show_chat_folder', 'false', 'No'); + + + + + + -- xxSTATSxx ALTER TABLE track_e_exercices ADD COLUMN orig_lp_item_view_id INT NOT NULL DEFAULT 0;