From f057119a2be3d57ec2123090702a5e913e62ca65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Ra=C3=B1a?= Date: Mon, 27 Dec 2010 15:46:24 +0100 Subject: [PATCH 1/6] remove save button in this bar --- main/inc/lib/fckeditor/toolbars/extended/wiki_feedback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/inc/lib/fckeditor/toolbars/extended/wiki_feedback.php b/main/inc/lib/fckeditor/toolbars/extended/wiki_feedback.php index 1bd251a237..9dc82df7a2 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/wiki_feedback.php +++ b/main/inc/lib/fckeditor/toolbars/extended/wiki_feedback.php @@ -26,7 +26,7 @@ $config['ToolbarSets']['Normal'] = array( // This is the visible toolbar set when the editor is maximized. // If it has not been defined, then the toolbar set for the "normal" size is used. $config['ToolbarSets']['Maximized'] = array( - array('Save','NewPage','Templates','-','Preview','Print'), + array('NewPage','Templates','-','Preview','Print'), array('Cut','Copy','Paste','PasteText','PasteWord'), array('Undo','Redo','-','SelectAll','Find','-','RemoveFormat'), array('Link','Unlink','Anchor','Glossary'), From be889b4323e920b3c8c6b020106f72bfc0c346a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Ra=C3=B1a?= Date: Mon, 27 Dec 2010 17:28:16 +0100 Subject: [PATCH 2/6] Feature #2479 rev. documents tool bars --- .../fckeditor/toolbars/extended/documents.php | 55 +++++++++++-------- .../toolbars/extended/documents_student.php | 54 ++++++++++-------- 2 files changed, 63 insertions(+), 46 deletions(-) diff --git a/main/inc/lib/fckeditor/toolbars/extended/documents.php b/main/inc/lib/fckeditor/toolbars/extended/documents.php index 3680008dae..d5aa8603b0 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/documents.php +++ b/main/inc/lib/fckeditor/toolbars/extended/documents.php @@ -7,37 +7,46 @@ // For more information: http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options +//NOTE: Does not include Replace because it is redundant, being in the same tab to Find +//TODO: DocProps, fckeditor_wiris_openFormulaEditor,fckeditor_wiris_openCAS don't run ok here. + +// Hide/show SpellCheck buttom +if ((api_get_setting('allow_spellcheck') == 'true')) { + $VSpellCheck='SpellCheck'; +} +else{ + $VSpellCheck=''; +} + // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('Save','FitWindow','PasteWord','-','Undo','Redo'), - array('Link','Unlink','Anchor','Glossary'), - array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex','asciimath'), - array('Table','SpecialChar'), - array('Outdent','Indent','-','TextColor','BGColor','-','OrderedList','UnorderedList','-','Source'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('Bold','Italic','Underline'), - array('JustifyLeft','JustifyCenter','JustifyRight') + array('Save','NewPage','Templates','-','PasteWord'), + array('Undo','Redo'), + array('Link','Image','flvPlayer','Table','mimetex','asciimath'), + array('UnorderedList','OrderedList','Rule'), + array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'), + array('FontFormat','FontName','FontSize','Bold','Italic','Underline','TextColor','BGColor'), + array('FitWindow') ); // This is the visible toolbar set when the editor is maximized. // If it has not been defined, then the toolbar set for the "normal" size is used. $config['ToolbarSets']['Maximized'] = array( - array('FitWindow','DocProps','-','Save','NewPage','Preview','-','Templates'), - array('Cut','Copy','Paste','PasteText','PasteWord','-','Print'), - array('Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'), + array('Save','NewPage','Templates','-','Preview','Print'), + array('Cut','Copy','Paste','PasteText','PasteWord'), + array('Undo','Redo','-','SelectAll','Find','-','RemoveFormat'), array('Link','Unlink','Anchor','Glossary'), - '/', - array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'), - array('OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'), - array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'), - array('Rule','SpecialChar','PageBreak'), - array('mimetex','asciimath','Image','imgmapPopup','Flash','MP3','EmbedMovies','flvPlayer','YouTube','googlemaps','Smiley'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp'), - array('ShowBlocks','Source') + array('Image','imgmapPopup','flvPlayer','EmbedMovies','YouTube','Flash','MP3','googlemaps','Smiley','SpecialChar','insertHtml','mimetex','asciimath'), +'/', + array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp','-','CreateDiv'), + array('UnorderedList','OrderedList','Rule','-','Outdent','Indent','Blockquote'), + array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'), + array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript','-','TextColor','BGColor'), + array($VSpellCheck), + array('Style','FontFormat','FontName','FontSize'), + array('PageBreak','ShowBlocks','Source'), + array('FitWindow') + ); // Sets whether the toolbar can be collapsed/expanded or not. diff --git a/main/inc/lib/fckeditor/toolbars/extended/documents_student.php b/main/inc/lib/fckeditor/toolbars/extended/documents_student.php index f1e83eb810..4fda9677c2 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/documents_student.php +++ b/main/inc/lib/fckeditor/toolbars/extended/documents_student.php @@ -7,38 +7,46 @@ // For more information: http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options +//NOTE: Does not include Replace because it is redundant, being in the same tab to Find +//TODO: DocProps, fckeditor_wiris_openFormulaEditor,fckeditor_wiris_openCAS don't run ok here. + +// Hide/show SpellCheck buttom +if ((api_get_setting('allow_spellcheck') == 'true')) { + $VSpellCheck='SpellCheck'; +} +else{ + $VSpellCheck=''; +} + // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('Save','FitWindow','PasteWord','-','Undo','Redo'), - array('Link','Unlink','Anchor'), - array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex','asciimath'), - array('Table','SpecialChar'), - array('Outdent','Indent','-','TextColor','BGColor','-','OrderedList','UnorderedList'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('Bold','Italic','Underline'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('ShowBlocks') + array('Save','NewPage','Templates','-','PasteWord'), + array('Undo','Redo'), + array('Link','Image','flvPlayer','Table','mimetex','asciimath'), + array('UnorderedList','OrderedList','Rule'), + array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'), + array('FontFormat','FontName','FontSize','Bold','Italic','Underline','TextColor','BGColor'), + array('FitWindow') ); // This is the visible toolbar set when the editor is maximized. // If it has not been defined, then the toolbar set for the "normal" size is used. $config['ToolbarSets']['Maximized'] = array( - array('FitWindow','DocProps','-','Save','NewPage','Preview','-','Templates'), + array('Save','NewPage','Templates','-','Preview','Print'), array('Cut','Copy','Paste','PasteText','PasteWord'), - array('Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'), + array('Undo','Redo','-','SelectAll','Find','-','RemoveFormat'), array('Link','Unlink','Anchor','Glossary'), - '/', - array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'), - array('OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'), - array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'), - array('Rule','SpecialChar','PageBreak'), - array('mimetex','asciimath','Image','imgmapPopup','Flash','MP3','EmbedMovies','flvPlayer','googlemaps','Smiley'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp'), - array('ShowBlocks') + array('Image','imgmapPopup','flvPlayer','EmbedMovies','YouTube','Flash','MP3','googlemaps','Smiley','SpecialChar','insertHtml','mimetex','asciimath'), +'/', + array('Table','TableInsertRowAfter','TableDeleteRows','TableInsertColumnAfter','TableDeleteColumns','TableInsertCellAfter','TableDeleteCells','TableMergeCells','TableHorizontalSplitCell','TableVerticalSplitCell','TableCellProp','-','CreateDiv'), + array('UnorderedList','OrderedList','Rule','-','Outdent','Indent','Blockquote'), + array('JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'), + array('Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript','-','TextColor','BGColor'), + array($VSpellCheck), + array('Style','FontFormat','FontName','FontSize'), + array('PageBreak','ShowBlocks'), + array('FitWindow') + ); // Sets whether the toolbar can be collapsed/expanded or not. From 2b76080097881697d955ac8aa8e1913a58cbca73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Ra=C3=B1a?= Date: Mon, 27 Dec 2010 18:53:32 +0100 Subject: [PATCH 3/6] Feature #2482 switch so that students can export thml documents to PDF --- main/document/document.inc.php | 3 +- main/document/document.php | 534 ++++++++++---------- main/install/db_main.sql | 5 +- main/install/migrate-db-1.8.7-1.8.8-pre.sql | 4 +- 4 files changed, 281 insertions(+), 265 deletions(-) diff --git a/main/document/document.inc.php b/main/document/document.inc.php index 56147f0bd5..55ad1b527e 100755 --- a/main/document/document.inc.php +++ b/main/document/document.inc.php @@ -359,8 +359,7 @@ function build_edit_icons($curdirpath, $type, $path, $visibility, $id, $is_templ } else { $modify_icons .= ' '; } - //$modify_icons .= ' '; - $modify_icons .= ' '; + $modify_icons .= ' '; } return $modify_icons; diff --git a/main/document/document.php b/main/document/document.php index 40d5ba9f8a..9161d4c697 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -307,21 +307,22 @@ if (isset($_GET['action']) && $_GET['action'] == 'downloadfolder' && (api_get_se //filter when I am into shared folder, I can donwload only my shared folder - if(is_any_user_shared_folder($_GET['path'],$current_session_id)) { - if(is_my_shared_folder($_user['user_id'], $_GET['path'], $current_session_id) || api_is_allowed_to_edit() || api_is_platform_admin()) { + if(is_any_user_shared_folder($_GET['path'],$current_session_id)){ + if(is_my_shared_folder($_user['user_id'], $_GET['path'], $current_session_id) || api_is_allowed_to_edit() || api_is_platform_admin()){ require 'downloadfolder.inc.php'; } - } else { + } + else{ require 'downloadfolder.inc.php'; } } -if (isset($_GET['action']) && $_GET['action'] == 'export_to_pdf') { +// Export to PDF +if (isset($_GET['action']) && $_GET['action'] == 'export_to_pdf' && (api_get_setting('students_export2pdf') == 'true' || api_is_allowed_to_edit() || api_is_platform_admin())) { DocumentManager::export_to_pdf($_GET['id'],$course_code); } - // Slideshow inititalisation $_SESSION['image_files_only'] = ''; $image_files_only = ''; @@ -436,286 +437,295 @@ if (isset($_GET['action']) && $_GET['action'] == 'copytomyfiles' && api_get_sett } } -if ($is_allowed_to_edit || $group_member_with_upload_rights) { // TEACHER ONLY +//START ACTION MENU /* MOVE FILE OR DIRECTORY */ - - $my_get_move = Security::remove_XSS($_GET['move']); - if (isset($_GET['move']) && $_GET['move'] != '') { - - if (api_is_coach()) { - if (!DocumentManager::is_visible_by_id($my_get_move, $_course,api_get_session_id())) { - api_not_allowed(); - } - } - - if (!$is_allowed_to_edit) { - if (DocumentManager::check_readonly($_course, $_user['user_id'], $my_get_move)) { - api_not_allowed(); + //Only teacher and all users into their group + if($is_allowed_to_edit || $group_member_with_upload_rights){ + $my_get_move = Security::remove_XSS($_GET['move']); + if (isset($_GET['move']) && $_GET['move'] != '') { + + if (api_is_coach()) { + if (!DocumentManager::is_visible_by_id($my_get_move, $_course,api_get_session_id())) { + api_not_allowed(); + } + } + + if (!$is_allowed_to_edit) { + if (DocumentManager::check_readonly($_course, $_user['user_id'], $my_get_move)) { + api_not_allowed(); + } } - } - - if (DocumentManager::get_document_id($_course, $my_get_move)) { - $folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit || $group_member_with_upload_rights); - - - echo '
'.get_lang('Move').'
'; - echo build_move_to_selector($folders, Security::remove_XSS($_GET['curdirpath']), $my_get_move, $group_properties['directory']); - } - } - - if (isset($_POST['move_to']) && isset($_POST['move_file'])) { - if (!$is_allowed_to_edit) { - if (DocumentManager::check_readonly($_course, $_user['user_id'], $my_get_move)) { - api_not_allowed(); + + if (DocumentManager::get_document_id($_course, $my_get_move)) { + $folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit || $group_member_with_upload_rights); + + echo '
'.get_lang('Move').'
'; + echo build_move_to_selector($folders, Security::remove_XSS($_GET['curdirpath']), $my_get_move, $group_properties['directory']); } } - - if (api_is_coach()) { - if (!DocumentManager::is_visible_by_id($my_get_move, $_course,api_get_session_id())) { - api_not_allowed(); - } - } - - - require_once $lib_path.'fileManage.lib.php'; - // This is needed for the update_db_info function - //$dbTable = $_course['dbNameGlu'].'document'; - $dbTable = Database::get_course_table(TABLE_DOCUMENT); - - // Security fix: make sure they can't move files that are not in the document table - if (DocumentManager::get_document_id($_course, $_POST['move_file'])) { - if (move($base_work_dir.$_POST['move_file'], $base_work_dir.$_POST['move_to'])) { - update_db_info('update', $_POST['move_file'], $_POST['move_to'].'/'.basename($_POST['move_file'])); - // Set the current path - $curdirpath = $_POST['move_to']; - $curdirpathurl = urlencode($_POST['move_to']); - Display::display_confirmation_message(get_lang('DirMv')); + + if (isset($_POST['move_to']) && isset($_POST['move_file'])) { + if (!$is_allowed_to_edit) { + if (DocumentManager::check_readonly($_course, $_user['user_id'], $my_get_move)) { + api_not_allowed(); + } + } + + if (api_is_coach()) { + if (!DocumentManager::is_visible_by_id($my_get_move, $_course,api_get_session_id())) { + api_not_allowed(); + } + } + + + require_once $lib_path.'fileManage.lib.php'; + // This is needed for the update_db_info function + //$dbTable = $_course['dbNameGlu'].'document'; + $dbTable = Database::get_course_table(TABLE_DOCUMENT); + + // Security fix: make sure they can't move files that are not in the document table + if (DocumentManager::get_document_id($_course, $_POST['move_file'])) { + if (move($base_work_dir.$_POST['move_file'], $base_work_dir.$_POST['move_to'])) { + update_db_info('update', $_POST['move_file'], $_POST['move_to'].'/'.basename($_POST['move_file'])); + // Set the current path + $curdirpath = $_POST['move_to']; + $curdirpathurl = urlencode($_POST['move_to']); + Display::display_confirmation_message(get_lang('DirMv')); + } else { + Display::display_error_message(get_lang('Impossible')); + } } else { Display::display_error_message(get_lang('Impossible')); } - } else { - Display::display_error_message(get_lang('Impossible')); } } - /* DELETE FILE OR DIRECTORY */ - - if (isset($_GET['delete'])) { - - if (api_is_coach()) { - if (!DocumentManager::is_visible($_GET['delete'], $_course)) { - api_not_allowed(); - } - } - - if (!$is_allowed_to_edit) { - if (DocumentManager::check_readonly($_course, $_user['user_id'], $_GET['delete'], '', true)) { - api_not_allowed(); + //Only teacher and all users into their group + if($is_allowed_to_edit || $group_member_with_upload_rights){ + if (isset($_GET['delete'])) { + + if (api_is_coach()) { + if (!DocumentManager::is_visible($_GET['delete'], $_course)) { + api_not_allowed(); + } + } + + if (!$is_allowed_to_edit) { + if (DocumentManager::check_readonly($_course, $_user['user_id'], $_GET['delete'], '', true)) { + api_not_allowed(); + } } - } - - require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; - - if (DocumentManager::delete_document($_course, $_GET['delete'], $base_work_dir)) { - if ( isset($_GET['delete_certificate_id']) && $_GET['delete_certificate_id'] == strval(intval($_GET['delete_certificate_id']))) { - $course_id = api_get_course_id(); - $default_certificate_id = $_GET['delete_certificate_id']; - DocumentManager::remove_attach_certificate($course_id, $default_certificate_id); + + require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; + + if (DocumentManager::delete_document($_course, $_GET['delete'], $base_work_dir)) { + if ( isset($_GET['delete_certificate_id']) && $_GET['delete_certificate_id'] == strval(intval($_GET['delete_certificate_id']))) { + $course_id = api_get_course_id(); + $default_certificate_id = $_GET['delete_certificate_id']; + DocumentManager::remove_attach_certificate($course_id, $default_certificate_id); + } + Display::display_confirmation_message(get_lang('DocDeleted')); + } else { + Display::display_error_message(get_lang('DocDeleteError')); } - Display::display_confirmation_message(get_lang('DocDeleted')); - } else { - Display::display_error_message(get_lang('DocDeleteError')); } - } - - if (isset($_POST['action'])) { - switch ($_POST['action']) { - case 'delete': - - foreach ($_POST['path'] as $index => & $path) { - if (!$is_allowed_to_edit) { - if (DocumentManager::check_readonly($_course, $_user['user_id'], $path)) { - Display::display_error_message(get_lang('CantDeleteReadonlyFiles')); - break 2; + + if (isset($_POST['action'])) { + switch ($_POST['action']) { + case 'delete': + + foreach ($_POST['path'] as $index => & $path) { + if (!$is_allowed_to_edit) { + if (DocumentManager::check_readonly($_course, $_user['user_id'], $path)) { + Display::display_error_message(get_lang('CantDeleteReadonlyFiles')); + break 2; + } } } - } - - foreach ($_POST['path'] as $index => & $path) { - if (in_array($path, array('/audio', '/flash', '/images', '/shared_folder', '/video', '/chat_files', '/certificates'))) { - continue; - } else { - $delete_document = DocumentManager::delete_document($_course, $path, $base_work_dir); + + foreach ($_POST['path'] as $index => & $path) { + if (in_array($path, array('/audio', '/flash', '/images', '/shared_folder', '/video', '/chat_files', '/certificates'))) { + continue; + } else { + $delete_document = DocumentManager::delete_document($_course, $path, $base_work_dir); + } } - } - if (!empty($delete_document)) { - Display::display_confirmation_message(get_lang('DocDeleted')); - } - break; + if (!empty($delete_document)) { + Display::display_confirmation_message(get_lang('DocDeleted')); + } + break; + } } } - + /* CREATE DIRECTORY */ - - // Create directory with $_POST data - if (isset($_POST['create_dir']) && $_POST['dirname'] != '') { - // Needed for directory creation - require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; - $post_dir_name = Security::remove_XSS($_POST['dirname']); - - if ($post_dir_name == '../' || $post_dir_name == '.' || $post_dir_name == '..') { - Display::display_error_message(get_lang('CannotCreateDir')); - } else { - $added_slash = ($curdirpath == '/') ? '' : '/'; - $dir_name = $curdirpath.$added_slash.replace_dangerous_char($post_dir_name); - $dir_name = disable_dangerous_file($dir_name); - $dir_check = $base_work_dir.$dir_name; - - if (!is_dir($dir_check)) { - $created_dir = create_unexisting_directory($_course, $_user['user_id'], $to_group_id, $to_user_id, $base_work_dir, $dir_name, $post_dir_name); - - if ($created_dir) { - Display::display_confirmation_message(''.get_lang('DirCr').'', false); - // Uncomment if you want to enter the created dir - //$curdirpath = $created_dir; - //$curdirpathurl = urlencode($curdirpath); + //Only teacher and all users into their group + if($is_allowed_to_edit || $group_member_with_upload_rights){ + // Create directory with $_POST data + if (isset($_POST['create_dir']) && $_POST['dirname'] != '') { + // Needed for directory creation + require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; + $post_dir_name = Security::remove_XSS($_POST['dirname']); + + if ($post_dir_name == '../' || $post_dir_name == '.' || $post_dir_name == '..') { + Display::display_error_message(get_lang('CannotCreateDir')); + } else { + $added_slash = ($curdirpath == '/') ? '' : '/'; + $dir_name = $curdirpath.$added_slash.replace_dangerous_char($post_dir_name); + $dir_name = disable_dangerous_file($dir_name); + $dir_check = $base_work_dir.$dir_name; + + if (!is_dir($dir_check)) { + $created_dir = create_unexisting_directory($_course, $_user['user_id'], $to_group_id, $to_user_id, $base_work_dir, $dir_name, $post_dir_name); + + if ($created_dir) { + Display::display_confirmation_message(''.get_lang('DirCr').'', false); + // Uncomment if you want to enter the created dir + //$curdirpath = $created_dir; + //$curdirpathurl = urlencode($curdirpath); + } else { + Display::display_error_message(get_lang('CannotCreateDir')); + } } else { Display::display_error_message(get_lang('CannotCreateDir')); } - } else { - Display::display_error_message(get_lang('CannotCreateDir')); } } + + // Show them the form for the directory name + if (isset($_GET['createdir'])) { + echo create_dir_form(); + } } - - // Show them the form for the directory name - if (isset($_GET['createdir'])) { - echo create_dir_form(); - } - + /* VISIBILITY COMMANDS */ - - if ((isset($_GET['set_invisible']) && !empty($_GET['set_invisible'])) || (isset($_GET['set_visible']) && !empty($_GET['set_visible'])) && $_GET['set_visible'] != '*' && $_GET['set_invisible'] != '*') { - // Make visible or invisible? - if (isset($_GET['set_visible'])) { - $update_id = $_GET['set_visible']; - $visibility_command = 'visible'; - } else { - $update_id = $_GET['set_invisible']; - $visibility_command = 'invisible'; - } - - if (api_is_coach()) { - if (!DocumentManager::is_visible_by_id($update_id, $_course)) { - api_not_allowed(); - } - } - - if (!$is_allowed_to_edit) { - if(DocumentManager::check_readonly($_course, $_user['user_id'], '', $update_id)) { - api_not_allowed(); + //Only teacher and all users into their group + if($is_allowed_to_edit || $group_member_with_upload_rights){ + if ((isset($_GET['set_invisible']) && !empty($_GET['set_invisible'])) || (isset($_GET['set_visible']) && !empty($_GET['set_visible'])) && $_GET['set_visible'] != '*' && $_GET['set_invisible'] != '*') { + // Make visible or invisible? + if (isset($_GET['set_visible'])) { + $update_id = $_GET['set_visible']; + $visibility_command = 'visible'; + } else { + $update_id = $_GET['set_invisible']; + $visibility_command = 'invisible'; + } + + if (api_is_coach()) { + if (!DocumentManager::is_visible_by_id($update_id, $_course)) { + api_not_allowed(); + } + } + + if (!$is_allowed_to_edit) { + if(DocumentManager::check_readonly($_course, $_user['user_id'], '', $update_id)) { + api_not_allowed(); + } + } + + // Update item_property to change visibility + if (api_item_property_update($_course, TOOL_DOCUMENT, $update_id, $visibility_command, $_user['user_id'], null, null, null, null, $current_session_id)) { + Display::display_confirmation_message(get_lang('VisibilityChanged'));//don't use ViMod because firt is load ViMdod (Gradebook). VisibilityChanged (trad4all) + } else { + Display::display_error_message(get_lang('ViModProb')); } - } - - // Update item_property to change visibility - if (api_item_property_update($_course, TOOL_DOCUMENT, $update_id, $visibility_command, $_user['user_id'], null, null, null, null, $current_session_id)) { - Display::display_confirmation_message(get_lang('VisibilityChanged'));//don't use ViMod because firt is load ViMdod (Gradebook). VisibilityChanged (trad4all) - } else { - Display::display_error_message(get_lang('ViModProb')); } } - + /* TEMPLATE ACTION */ - - if (isset($_GET['add_as_template']) && !isset($_POST['create_template'])) { - - $document_id_for_template = intval($_GET['add_as_template']); - - // Create the form that asks for the directory name - $template_text = '
'; - $template_text .= ''; - $template_text .= ''; - $template_text .= ''; - //$template_text .= ''; - //$template_text .= ''; - $template_text .= ''; - $template_text .= ''; - $template_text .= '
'; - $template_text .= get_lang('TemplateName').' :
'.get_lang('TemplateDescription').' :
'.get_lang('TemplateImage').' :
'; - $template_text .= ''; - $template_text .= '
'; - // Show the form - Display::display_normal_message($template_text, false); - - } elseif (isset($_GET['add_as_template']) && isset($_POST['create_template'])) { - - $document_id_for_template = intval(Database::escape_string($_GET['add_as_template'])); - - $title = Security::remove_XSS($_POST['template_title']); - //$description = Security::remove_XSS($_POST['template_description']); - $course_code = api_get_course_id(); - $user_id = api_get_user_id(); - - // Create the template_thumbnails folder in the upload folder (if needed) - if (!is_dir(api_get_path(SYS_PATH).'courses/'.$_course['path'].'/upload/template_thumbnails/')) { - @mkdir(api_get_path(SYS_PATH).'courses/'.$_course['path'].'/upload/template_thumbnails/', api_get_permissions_for_new_directories()); - } - // Upload the file - if (!empty($_FILES['template_image']['name'])) { - - require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; - $upload_ok = process_uploaded_file($_FILES['template_image']); - - if ($upload_ok) { - // Try to add an extension to the file if it hasn't one - $new_file_name = $_course['sysCode'].'-'.add_ext_on_mime(stripslashes($_FILES['template_image']['name']), $_FILES['template_image']['type']); - - // Upload dir - $upload_dir = api_get_path(SYS_PATH).'courses/'.$_course['path'].'/upload/template_thumbnails/'; - - // Resize image to max default and end upload - require_once (api_get_path(LIBRARY_PATH).'image.lib.php'); - $temp = new image($_FILES['template_image']['tmp_name']); - $picture_infos = @getimagesize($_FILES['template_image']['tmp_name']); - - $max_width_for_picture = 100; - - if ($picture_infos[0] > $max_width_for_picture) { - $thumbwidth = $max_width_for_picture; - if (empty($thumbwidth) || $thumbwidth == 0) { - $thumbwidth = $max_width_for_picture; + //Only teacher and all users into their group + if($is_allowed_to_edit || $group_member_with_upload_rights){ + if (isset($_GET['add_as_template']) && !isset($_POST['create_template'])) { + + $document_id_for_template = intval($_GET['add_as_template']); + + // Create the form that asks for the directory name + $template_text = '
'; + $template_text .= ''; + $template_text .= ''; + $template_text .= ''; + //$template_text .= ''; + //$template_text .= ''; + $template_text .= ''; + $template_text .= ''; + $template_text .= '
'; + $template_text .= get_lang('TemplateName').' :
'.get_lang('TemplateDescription').' :
'.get_lang('TemplateImage').' :
'; + $template_text .= ''; + $template_text .= '
'; + // Show the form + Display::display_normal_message($template_text, false); + + } elseif (isset($_GET['add_as_template']) && isset($_POST['create_template'])) { + + $document_id_for_template = intval(Database::escape_string($_GET['add_as_template'])); + + $title = Security::remove_XSS($_POST['template_title']); + //$description = Security::remove_XSS($_POST['template_description']); + $course_code = api_get_course_id(); + $user_id = api_get_user_id(); + + // Create the template_thumbnails folder in the upload folder (if needed) + if (!is_dir(api_get_path(SYS_PATH).'courses/'.$_course['path'].'/upload/template_thumbnails/')) { + @mkdir(api_get_path(SYS_PATH).'courses/'.$_course['path'].'/upload/template_thumbnails/', api_get_permissions_for_new_directories()); + } + // Upload the file + if (!empty($_FILES['template_image']['name'])) { + + require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; + $upload_ok = process_uploaded_file($_FILES['template_image']); + + if ($upload_ok) { + // Try to add an extension to the file if it hasn't one + $new_file_name = $_course['sysCode'].'-'.add_ext_on_mime(stripslashes($_FILES['template_image']['name']), $_FILES['template_image']['type']); + + // Upload dir + $upload_dir = api_get_path(SYS_PATH).'courses/'.$_course['path'].'/upload/template_thumbnails/'; + + // Resize image to max default and end upload + require_once (api_get_path(LIBRARY_PATH).'image.lib.php'); + $temp = new image($_FILES['template_image']['tmp_name']); + $picture_infos = @getimagesize($_FILES['template_image']['tmp_name']); + + $max_width_for_picture = 100; + + if ($picture_infos[0] > $max_width_for_picture) { + $thumbwidth = $max_width_for_picture; + if (empty($thumbwidth) || $thumbwidth == 0) { + $thumbwidth = $max_width_for_picture; + } + $new_height = round(($thumbwidth/$picture_infos[0])*$picture_infos[1]); + + $temp->resize($thumbwidth, $new_height, 0); + } + + $type = $picture_infos[2]; + + switch (!empty($type)) { + case 2 : $temp->send_image('JPG', $upload_dir.$new_file_name); + break; + case 3 : $temp->send_image('PNG', $upload_dir.$new_file_name); + break; + case 1 : $temp->send_image('GIF', $upload_dir.$new_file_name); + break; } - $new_height = round(($thumbwidth/$picture_infos[0])*$picture_infos[1]); - - $temp->resize($thumbwidth, $new_height, 0); - } - - $type = $picture_infos[2]; - - switch (!empty($type)) { - case 2 : $temp->send_image('JPG', $upload_dir.$new_file_name); - break; - case 3 : $temp->send_image('PNG', $upload_dir.$new_file_name); - break; - case 1 : $temp->send_image('GIF', $upload_dir.$new_file_name); - break; } - } - } - - DocumentManager::set_document_as_template($title, $description, $document_id_for_template, $course_code, $user_id, $new_file_name); - Display::display_confirmation_message(get_lang('DocumentSetAsTemplate')); - } - - if (isset($_GET['remove_as_template'])) { - $document_id_for_template = intval($_GET['remove_as_template']); - $course_code = api_get_course_id(); - $user_id = api_get_user_id(); - DocumentManager::unset_document_as_template($document_id_for_template, $course_code, $user_id); - Display::display_confirmation_message(get_lang('DocumentUnsetAsTemplate')); + } + + DocumentManager::set_document_as_template($title, $description, $document_id_for_template, $course_code, $user_id, $new_file_name); + Display::display_confirmation_message(get_lang('DocumentSetAsTemplate')); + } + + if (isset($_GET['remove_as_template'])) { + $document_id_for_template = intval($_GET['remove_as_template']); + $course_code = api_get_course_id(); + $user_id = api_get_user_id(); + DocumentManager::unset_document_as_template($document_id_for_template, $course_code, $user_id); + Display::display_confirmation_message(get_lang('DocumentUnsetAsTemplate')); + } } -} // END is allowed to edit + +// END ACTION MENU // Attach certificate in the gradebook if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates' && isset($_GET['set_certificate']) && $_GET['set_certificate'] == strval(intval($_GET['set_certificate']))) { @@ -831,13 +841,12 @@ if (isset($docs_and_folders) && is_array($docs_and_folders)) { $last_edit_date = api_get_local_time($last_edit_date, null, date_default_timezone_get()); $display_date = date_to_str_ago($last_edit_date).'
'.api_format_date($last_edit_date).''; $row[] = $invisibility_span_open.$display_date.$invisibility_span_close; - // Admins get an edit column - if ($is_allowed_to_edit || $group_member_with_upload_rights) { + if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder($_user['user_id'], $curdirpath, $current_session_id)) { $is_template = isset($id['is_template']) ? $id['is_template'] : false; // If readonly, check if it the owner of the file or if the user is an admin if ($id['insert_user_id'] == $_user['user_id'] || api_is_platform_admin()) { - $edit_icons = build_edit_icons($curdirpath, $id['filetype'], $id['path'], $id['visibility'], $key, $is_template, 0); + $edit_icons = build_edit_icons($curdirpath, $id['filetype'], $id['path'], $id['visibility'], $key, $is_template, 0); } else { $edit_icons = build_edit_icons($curdirpath, $id['filetype'], $id['path'], $id['visibility'], $key, $is_template, $id['readonly']); } @@ -846,7 +855,6 @@ if (isset($docs_and_folders) && is_array($docs_and_folders)) { $row[] = $last_edit_date; $row[] = $size; $total_size = $total_size + $size; - if ((isset ($_GET['keyword']) && search_keyword($document_name, $_GET['keyword'])) || !isset($_GET['keyword']) || empty($_GET['keyword'])) { $sortable_data[] = $row; } @@ -892,7 +900,6 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_fold   @@ -901,11 +908,16 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_fold   - + +   set_header($column++, get_lang('Name')); $table->set_header($column++, get_lang('Size'),true,array ('style' => 'width:50px;')); $table->set_header($column++, get_lang('Date'),true,array ('style' => 'width:150px;')); // Admins get an edit column -if ($is_allowed_to_edit || $group_member_with_upload_rights) { - $table->set_header($column++, get_lang('Modify'), false,array ('style' => 'width:150px;')); +if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder($_user['user_id'], $curdirpath, $current_session_id)) { + $table->set_header($column++, get_lang('Actions'), false,array ('style' => 'width:150px;')); } // Actions on multiple selected documents diff --git a/main/install/db_main.sql b/main/install/db_main.sql index dd3da2c354..543480e4ff 100755 --- a/main/install/db_main.sql +++ b/main/install/db_main.sql @@ -781,6 +781,7 @@ VALUES ('pdf_export_watermark_by_course', NULL,'radio', 'Platform', 'false','PDFExportWatermarkByCourseTitle', 'PDFExportWatermarkByCourseComment','platform',NULL, 1), ('pdf_export_watermark_text', NULL,'textfield', 'Platform', '', 'PDFExportWatermarkTextTitle', 'PDFExportWatermarkTextComment', 'platform',NULL, 1), ('enabled_insertHtml',NULL,'radio','Editor','false','EnabledInsertHtmlTitle','EnabledInsertHtmlComment',NULL,NULL, 0), +('students_export2pdf', NULL,'radio', 'Tools', 'true', 'EnabledStudentExport2PDFTitle','EnabledStudentExport2PDFComment',NULL,NULL, 0), ('chamilo_database_version', NULL, 'textfield', NULL, '1.8.8.13050', 'DokeosDatabaseVersion', '', NULL, NULL, 0); @@ -1021,7 +1022,9 @@ VALUES ('pdf_export_watermark_by_course','true','Yes'), ('pdf_export_watermark_by_course','false','No'), ('enabled_insertHtml','true','Yes'), -('enabled_insertHtml','false','No'); +('enabled_insertHtml','false','No'), +('students_export2pdf','true','Yes'), +('students_export2pdf','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 3c061e2310..d8efc16ecf 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 @@ -90,7 +90,9 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value, INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_insertHtml', 'true', 'Yes'); INSERT INTO settings_options (variable, value, display_text) VALUES ('enabled_insertHtml', 'false', 'No'); - +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('students_export2pdf',NULL,'radio','Tools','true','EnabledStudentExport2PDFTitle','EnabledStudentExport2PDFComment',NULL,NULL, 0); +INSERT INTO settings_options (variable, value, display_text) VALUES ('students_export2pdf', 'true', 'Yes'); +INSERT INTO settings_options (variable, value, display_text) VALUES ('students_export2pdf', 'false', 'No'); -- xxSTATSxx From a813e3f82d30cdbc430b293c77785799e9999291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Ra=C3=B1a?= Date: Mon, 27 Dec 2010 20:37:50 +0100 Subject: [PATCH 4/6] adding a empty template for students --- main/inc/lib/fckeditor/fcktemplates.xml.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main/inc/lib/fckeditor/fcktemplates.xml.php b/main/inc/lib/fckeditor/fcktemplates.xml.php index 1fb217d6c3..31d3b73e91 100755 --- a/main/inc/lib/fckeditor/fcktemplates.xml.php +++ b/main/inc/lib/fckeditor/fcktemplates.xml.php @@ -229,6 +229,14 @@ function load_empty_template() { function load_student_templates() { $fckeditor_template_path='/main/inc/lib/fckeditor/editor/dialog/fck_template/images/'; ?> +