Fixing breadcrumb when creating a folder

skala
Julio Montoya 15 years ago
parent 6cc4a16cf1
commit 059bd61fcb
  1. 5
      main/document/document.inc.php
  2. 14
      main/document/document.php

@ -701,10 +701,11 @@ function display_user_link_document($user_id, $name) {
* Creates form that asks for the directory name. * Creates form that asks for the directory name.
* @return string html-output text for the form * @return string html-output text for the form
*/ */
function create_dir_form() { function create_dir_form($current_dir_id) {
global $document_id; global $document_id;
$new_folder_text = '<form action="'.api_get_self().'" method="post">'; $new_folder_text = '<form action="'.api_get_self().'" method="post">';
$new_folder_text .= '<input type="hidden" name="dir_id" value="'.$document_id.'" />'; $new_folder_text .= '<input type="hidden" name="dir_id" value="'.intval($document_id).'" />';
$new_folder_text .= '<input type="hidden" name="id" value="'.intval($current_dir_id).'" />';
// Form title // Form title
$new_folder_text .= '<div class="row"><div class="form_header">'.get_lang('CreateDir').'</div></div>'; $new_folder_text .= '<div class="row"><div class="form_header">'.get_lang('CreateDir').'</div></div>';

@ -87,22 +87,16 @@ $(document).ready( function() {
}); });
</script>'; </script>';
// Session
/*
if (isset($_GET['id_session'])) {
$_SESSION['id_session'] = intval($_GET['id_session']);
}*/
// Create directory certificates // Create directory certificates
DocumentManager::create_directory_certificate_in_course(api_get_course_id()); DocumentManager::create_directory_certificate_in_course(api_get_course_id());
//Hack in order to use document.php?id=X //Hack in order to use document.php?id=X
if (isset($_GET['id'])) { if (isset($_REQUEST['id'])) {
$document_data = DocumentManager::get_document_data_by_id($_GET['id'], api_get_course_id()); $document_data = DocumentManager::get_document_data_by_id($_REQUEST['id'], api_get_course_id());
//@todo replace all //@todo replace all
$_GET['curdirpath'] = $document_data['path']; $_GET['curdirpath'] = $document_data['path'];
} }
// What's the current path? // What's the current path?
// We will verify this a bit further down // We will verify this a bit further down
if (isset($_GET['curdirpath']) && $_GET['curdirpath'] != '') { if (isset($_GET['curdirpath']) && $_GET['curdirpath'] != '') {
@ -359,7 +353,7 @@ $image_files_only = '';
if ($is_certificate_mode) { if ($is_certificate_mode) {
$interbreadcrumb[]= array('url' => '../gradebook/index.php', 'name' => get_lang('Gradebook')); $interbreadcrumb[]= array('url' => '../gradebook/index.php', 'name' => get_lang('Gradebook'));
} else { } else {
if ((isset($_GET['id']) && $_GET['id'] != 0) || isset($_GET['curdirpath'])) { if ((isset($_GET['id']) && $_GET['id'] != 0) || isset($_GET['curdirpath']) || isset($_GET['createdir'])) {
$interbreadcrumb[]= array('url' => 'document.php', 'name' => get_lang('Documents')); $interbreadcrumb[]= array('url' => 'document.php', 'name' => get_lang('Documents'));
} else { } else {
$interbreadcrumb[]= array('url' => '#', 'name' => get_lang('Documents')); $interbreadcrumb[]= array('url' => '#', 'name' => get_lang('Documents'));
@ -673,7 +667,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folde
// Show them the form for the directory name // Show them the form for the directory name
if (isset($_GET['createdir'])) { if (isset($_GET['createdir'])) {
echo create_dir_form(); echo create_dir_form($document_id);
} }
} }

Loading…
Cancel
Save