diff --git a/main/document/document.inc.php b/main/document/document.inc.php index c2abe7c3f6..81d422e854 100755 --- a/main/document/document.inc.php +++ b/main/document/document.inc.php @@ -173,14 +173,16 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility } else { $force_download_html = ($size==0)?'':''.Display::return_icon($forcedownload_icon, get_lang('Download'), array('height'=>'16', 'width' => '16')).''; } - //copy files to users myfiles - $copy_myfiles_link = ($filetype == 'file') ? api_get_self().'?'.api_get_cidreq().'&action=copytomyfiles&id='.$url_path.$req_gid :api_get_self().'?'.api_get_cidreq(); - if($filetype == 'file') - { - $copy_to_myfiles=''.Display::return_icon('briefcase_small.png', get_lang('CopyToMyFiles'), array('height'=>'16', 'width' => '16')).'  '; + //copy files to users myfiles + if(api_get_setting('users_copy_files') == 'true'){ + $copy_myfiles_link = ($filetype == 'file') ? api_get_self().'?'.api_get_cidreq().'&curdirpath='.$_GET['curdirpath'].'&action=copytomyfiles&id='.$url_path.$req_gid :api_get_self().'?'.api_get_cidreq(); + + if($filetype == 'file') + { + $copy_to_myfiles=''.Display::return_icon('briefcase_small.png', get_lang('CopyToMyFiles'), array('height'=>'16', 'width' => '16')).'  '; + } } - return ''.$title.''.$force_download_html.$copy_to_myfiles; //end copy files to users myfiles } else { diff --git a/main/document/document.php b/main/document/document.php index 3c8b19cbb3..4a92e13387 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -318,7 +318,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'downloadfolder' && (api_get_se } // Copy a file to general my files user's -if (isset($_GET['action']) && $_GET['action'] == 'copytomyfiles' && (api_get_setting('students_copy_files') == 'true')) { +if (isset($_GET['action']) && $_GET['action'] == 'copytomyfiles' && api_get_setting('users_copy_files') == 'true') { $clean_get_id = Security::remove_XSS($_GET['id']); $user_folder = api_get_path(SYS_CODE_PATH).'upload/users/'.api_get_user_id().'/my_files/'; @@ -327,13 +327,15 @@ if (isset($_GET['action']) && $_GET['action'] == 'copytomyfiles' && (api_get_set } $file = $sys_course_path.$_course['path'].'/document'.$clean_get_id; - $copyfile = $user_folder.basename($clean_get_id); + $copyfile = $user_folder.basename($clean_get_id); if (file_exists($copyfile)) { - //Display::display_error_message(get_lang('Overwrite. Warning already copy'));//TODO: fix message and show acept or cancel - } - if (!copy($file, $copyfile)) { - //Display::display_error_message(get_lang('Copy Failled'));//TODO: fix message + $copy_to_myfiles_message_overwrite = get_lang('AlreadyCopy'); + }elseif (!copy($file, $copyfile)) { + $copy_to_myfiles_message_failled = get_lang('CopyFailled'); + }else{ + $copy_to_myfiles_message_relased = get_lang('CopyReleased'); } + } @@ -401,6 +403,19 @@ if (!empty($_SESSION['_gid'])) { Display::display_introduction_section(TOOL_DOCUMENT); } +/* COPY TO MY FILES MESSAGES */ +if(!empty($copy_to_myfiles_message_failled)){ + Display::display_error_message($copy_to_myfiles_message_failled); +} +else{ + if(!empty($copy_to_myfiles_message_overwrite)){ + Display::display_warning_message($copy_to_myfiles_message_overwrite); + } + if (!empty($copy_to_myfiles_message_relased)){ + Display::display_confirmation_message($copy_to_myfiles_message_relased); + } +} + if ($is_allowed_to_edit || $group_member_with_upload_rights) { // TEACHER ONLY /* MOVE FILE OR DIRECTORY */ diff --git a/main/install/db_main.sql b/main/install/db_main.sql index cf78bc5030..0c0aa97415 100755 --- a/main/install/db_main.sql +++ b/main/install/db_main.sql @@ -753,7 +753,7 @@ VALUES ('block_copy_paste_for_students',NULL,'radio','Editor','false','BlockCopyPasteForStudentsTitle','BlockCopyPasteForStudentsComment',NULL,NULL, 0), ('more_buttons_maximized_mode',NULL,'radio','Editor','false','MoreButtonsForMaximizedModeTitle','MoreButtonsForMaximizedModeComment',NULL,NULL, 0), ('students_download_folders',NULL,'radio','Tools','true','AllowStudentsDownloadFoldersTitle','AllowStudentsDownloadFoldersComment',NULL,NULL, 0), -('students_copy_files',NULL,'radio','Tools','true','AllowStudentsCopyFilesTitle','AllowStudentsCopyFilesComment',NULL,NULL, 0), +('users_copy_files',NULL,'radio','Tools','true','AllowUsersCopyFilesTitle','AllowUsersCopyFilesComment',NULL,NULL, 0), ('show_tabs', 'social', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsSocial', 0), ('allow_students_to_create_groups_in_social',NULL,'radio','Tools','false','AllowStudentsToCreateGroupsInSocialTitle','AllowStudentsToCreateGroupsInSocialComment',NULL,NULL, 0), ('allow_send_message_to_all_platform_users',NULL,'radio','Tools','false','AllowSendMessageToAllPlatformUsersTitle','AllowSendMessageToAllPlatformUsersComment',NULL,NULL, 0), @@ -968,8 +968,8 @@ VALUES ('more_buttons_maximized_mode','false','No'), ('students_download_folders','true','Yes'), ('students_download_folders','false','No'), -('students_copy_files','true','Yes'), -('students_copy_files','false','No'), +('users_copy_files','true','Yes'), +('users_copy_files','false','No'), ('allow_students_to_create_groups_in_social','true','Yes'), ('allow_students_to_create_groups_in_social','false','No'), ('allow_send_message_to_all_platform_users','true','Yes'), diff --git a/main/lang/english/admin.inc.php b/main/lang/english/admin.inc.php index 9263e85c12..dd4f41bb4f 100644 --- a/main/lang/english/admin.inc.php +++ b/main/lang/english/admin.inc.php @@ -1269,6 +1269,6 @@ $ErrorReadingZip = "Error reading ZIP file"; $ErrorStylesheetFilesExtensionsInsideZip = "The only accepted extensions in the ZIP file are jpg, jpeg, png, gif and css."; $MyTextHere = "Enter your text here..."; $FieldTypeSocialProfile = "Social network link"; -$AllowStudentsCopyFilesTitle = "Allow students to copy files from a course in your area personal file"; -$AllowStudentsCopyFilesComment = "Allows students to copy files from a course in your personal area, visible through the Social Network or through the html editor when they are out of a course"; +$AllowUsersCopyFilesTitle = "Allow users to copy files from a course in your area personal file"; +$AllowUsersCopyFilesComment = "Allows users to copy files from a course in your personal area, visible through the Social Network or through the html editor when they are out of a course"; ?> \ No newline at end of file diff --git a/main/lang/spanish/admin.inc.php b/main/lang/spanish/admin.inc.php index 693c84d9cf..dce2f42eb6 100644 --- a/main/lang/spanish/admin.inc.php +++ b/main/lang/spanish/admin.inc.php @@ -1269,6 +1269,6 @@ $ErrorReadingZip = "Error leyendo el archivo ZIP"; $ErrorStylesheetFilesExtensionsInsideZip = "Las únicas extensiones aceptadas en el archivo ZIP son jpg, jpeg, png, gif y css."; $MyTextHere = "Introduzca su texto aquí..."; $FieldTypeSocialProfile = "Vínculo red social"; -$AllowStudentsCopyFilesTitle = "Permitir a los estudiantes copiar archivos de un curso en su área de archivos personales"; -$AllowStudentsCopyFilesComment = "Permite a los estudiantes copiar archivos de un curso en su área personal, visible a través de la herramienta de Red Social o mediante el editor de HTML cuando se encuentran fuera de un curso"; +$AllowUsersCopyFilesTitle = "Permitir a los usuarios copiar archivos de un curso en su área de archivos personales"; +$AllowUsersCopyFilesComment = "Permite a los usuarios copiar archivos de un curso en su área personal, visible a través de la herramienta de Red Social o mediante el editor de HTML cuando se encuentran fuera de un curso"; ?> \ No newline at end of file