From fac25689b6c30d1826d65ce2e184636bdaa97385 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 12 Aug 2011 13:02:29 +0200 Subject: [PATCH 01/10] Using Thickbox to show images instead of yoxview see #3745 --- main/document/document.inc.php | 12 ++-- main/document/document.php | 51 ++++++++-------- main/document/show_content.php | 104 +++++++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+), 29 deletions(-) create mode 100644 main/document/show_content.php diff --git a/main/document/document.inc.php b/main/document/document.inc.php index fe0e7213b4..dec6e3da94 100755 --- a/main/document/document.inc.php +++ b/main/document/document.inc.php @@ -258,15 +258,17 @@ function create_document_link($document_data, $show_as_icon = false, $counter = //|| (preg_match('/wav$/', urldecode($url)) && api_get_setting('enable_nanogong') == 'true') ) { //yox view - $url = 'showinframesmin.php?'.api_get_cidreq().'&id='.$document_data['id'].$req_gid; - $class = 'yoxview'; + //$url = 'showinframesmin.php?'.api_get_cidreq().'&id='.$document_data['id'].$req_gid; + //Simpler version of showinframesmin.php with no headers + $url = 'show_content.php?'.api_get_cidreq().'&id='.$document_data['id'].$req_gid.'&width=700&height=500'; + $class = 'thickbox'; if ($visibility == false) { - $class = "yoxview invisible"; + $class = "thickbox invisible"; } - return ''.$title.''.$force_download_html.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon; + return ''.$title.''.$force_download_html.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon; } else { $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'].$req_gid; - //No yoxview + //No plugin just the old and good showinframes.php page return ''.$title.''.$force_download_html.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon; } } else { diff --git a/main/document/document.php b/main/document/document.php index 29797746d0..e896e5cab7 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -69,6 +69,19 @@ $session_id = api_get_session_id(); $course_code = api_get_course_id(); $to_group_id = api_get_group_id(); +$is_allowed_to_edit = api_is_allowed_to_edit(null, true); +$group_member_with_upload_rights = false; + +// If the group id is set, we show them group documents +$group_properties = array(); +$group_properties['directory'] = null; + +// For sessions we should check the parameters of visibility +if (api_get_session_id() != 0) { + $group_member_with_upload_rights = $group_member_with_upload_rights && api_is_allowed_to_session_edit(false, true); +} + + //Setting group variables if (api_get_group_id()) { // Needed for group related stuff @@ -274,6 +287,7 @@ $tool_sql = 'SELECT visibility FROM ' . $table_course_tool . ' WHERE n $tool_result = Database::query($tool_sql); $tool_row = Database::fetch_array($tool_result); $tool_visibility = $tool_row['visibility']; + if ($tool_visibility == '0' && $to_group_id == '0' && !($is_allowed_to_edit || $group_member_with_upload_rights)) { api_not_allowed(true); } @@ -288,18 +302,6 @@ function confirmation (name) { } "; -$is_allowed_to_edit = api_is_allowed_to_edit(null, true); -$group_member_with_upload_rights = false; - -// If the group id is set, we show them group documents -$group_properties = array(); -$group_properties['directory'] = null; - -// For sessions we should check the parameters of visibility -if (api_get_session_id() != 0) { - $group_member_with_upload_rights = $group_member_with_upload_rights && api_is_allowed_to_session_edit(false, true); -} - // If they are looking at group documents they can't see the root if ($to_group_id != 0 && $curdirpath == '/') { $curdirpath = $group_properties['directory']; @@ -392,23 +394,25 @@ if (empty($document_data['parents'])) { if (isset($_GET['createdir'])) { $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('CreateDir')); } - -$htmlHeadXtra[] = api_get_jquery_js(); $htmlHeadXtra[] = api_get_jquery_ui_js(); +$js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/'; +/* +$htmlHeadXtra[] = ''; $htmlHeadXtra[] = api_get_js('yoxview/yoxview-init.js'); -$js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/'; -$htmlHeadXtra[] = ''; +*/ + $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; + $mediaplayer_path = api_get_path(WEB_LIBRARY_PATH).'mediaplayer/player.swf'; //automatic loading the course language for yoxview -$yoxview_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); +/*$yoxview_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); $lang_yoxview = api_get_language_isocode(); $lang_yoxview = isset($yoxview_code_translation_table[$lang_yoxview]) ? $yoxview_code_translation_table[$lang_yoxview] : $lang_yoxview; - +*/ $docs_and_folders = DocumentManager::get_all_document_data($_course, $curdirpath, $to_group_id, null, $is_allowed_to_edit || $group_member_with_upload_rights, false); $file_list = $format_list = ''; @@ -443,15 +447,14 @@ foreach ($docs_and_folders as $file) { } $htmlHeadXtra[] = '