improve document breadcrumb

skala
Juan Carlos Raña 15 years ago
parent 924c9ef817
commit 73569787d5
  1. 5
      main/document/create_document.php
  2. 5
      main/document/create_drawing.php
  3. 8
      main/document/document.inc.php
  4. 31
      main/document/document.php
  5. 15
      main/document/showinframes.php

@ -596,6 +596,9 @@ if ($form->validate()) {
// Copied from document.php
$dir_array = explode('/', $dir);
$array_len = count($dir_array);
/*
TODO:check and delete this code
if (!$is_certificate_mode) {
if ($array_len > 1) {
if (empty($_SESSION['_gid'])) {
@ -604,6 +607,8 @@ if ($form->validate()) {
}
}
}
*/
$dir_acum = '';
for ($i = 0; $i < $array_len; $i++) {
$url_dir = 'document.php?&curdirpath='.$dir_acum.$dir_array[$i];

@ -105,6 +105,9 @@ if (isset ($group)) {
// Copied from document.php
$dir_array = explode('/', $dir);
$array_len = count($dir_array);
/*
TODO:check and delete this code
if (!$is_certificate_mode) {
if ($array_len > 1) {
if (empty($_SESSION['_gid'])) {
@ -113,6 +116,8 @@ if (isset ($group)) {
}
}
}
*/
$dir_acum = '';
for ($i = 0; $i < $array_len; $i++) {
$url_dir = 'document.php?&curdirpath='.$dir_acum.$dir_array[$i];

@ -51,7 +51,7 @@ function build_directory_selector($folders, $curdirpath, $group_dir = '', $chang
// Group documents cannot be uploaded in the root
if (empty($group_dir)) {
$parent_select -> addOption(get_lang('HomeDirectory'), '/');
$parent_select -> addOption(get_lang('Documents'), '/');
if (is_array($folders)) {
foreach ($folders as & $folder) {
$selected = ($curdirpath == $folder) ? ' selected="selected"' : '';
@ -69,7 +69,7 @@ function build_directory_selector($folders, $curdirpath, $group_dir = '', $chang
$selected = ($curdirpath==$folder) ? ' selected="selected"' : '';
$label = $folder_titles[$folder];
if ($folder == $group_dir) {
$label = '/ ('.get_lang('HomeDirectory').')';
$label = get_lang('Documents');
} else {
$path_parts = explode('/', str_replace($group_dir, '', $folder));
$label = cut($label, 80);
@ -380,7 +380,7 @@ function build_move_to_selector($folders, $curdirpath, $move_file, $group_dir =
// Group documents cannot be uploaded in the root
if ($group_dir == '') {
if ($curdirpath != '/') {
$form .= '<option value="/">/ ('.get_lang('HomeDirectory').')</option>';
$form .= '<option value="/">'.get_lang('Documents').'</option>';
}
if (is_array($folders)) {
foreach ($folders as & $folder) {
@ -405,7 +405,7 @@ function build_move_to_selector($folders, $curdirpath, $move_file, $group_dir =
$path_displayed = get_titles_of_path($folder);
}
$display_folder = substr($path_displayed,strlen($group_dir));
$display_folder = ($display_folder == '') ? '/ ('.get_lang('HomeDirectory').')' : $display_folder;
$display_folder = ($display_folder == '') ? get_lang('Documents') : $display_folder;
$form .= '<option value="'.$folder.'">'.$display_folder.'</option>'."\n";
}
}

@ -160,7 +160,7 @@ if (isset($_SESSION['_gid']) && $_SESSION['_gid'] != '') {
$to_group_id = $_SESSION['_gid'];
$req_gid = '&amp;gidReq='.$_SESSION['_gid'];
$interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$_SESSION['_gid'], 'name' => get_lang('GroupSpace').' ('.$group_properties['name'].')');
$interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$_SESSION['_gid'], 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
//they are allowed to upload
$group_member_with_upload_rights = true;
} else {
@ -171,7 +171,7 @@ if (isset($_SESSION['_gid']) && $_SESSION['_gid'] != '') {
$to_group_id = $_SESSION['_gid'];
$req_gid = '&amp;gidReq='.$_SESSION['_gid'];
$interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$_SESSION['_gid'], 'name' => get_lang('GroupSpace').' ('.$group_properties['name'].')');
$interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$_SESSION['_gid'], 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
//allowed to upload?
if ($is_allowed_to_edit || GroupManager::is_subscribed($_user['user_id'], $_SESSION['_gid'])) { // Only courseadmin or group members can upload
$group_member_with_upload_rights = true;
@ -338,6 +338,8 @@ if ($is_certificate_mode) {
$dir_array = explode('/', $curdirpath);
$array_len = count($dir_array);
/*
TODO:check and delete this code
if (!$is_certificate_mode) {
if ($array_len > 1) {
if (empty($_SESSION['_gid'])) {
@ -346,6 +348,7 @@ if (!$is_certificate_mode) {
}
}
}
*/
$dir_acum = '';
for ($i = 0; $i < $array_len; $i++) {
@ -356,16 +359,29 @@ for ($i = 0; $i < $array_len; $i++) {
//Max char 80
$url_to_who = cut($dir_array[$i],80);
if ($is_certificate_mode) {
if ($is_certificate_mode) {
$interbreadcrumb[] = array('url' => $url_dir.'&selectcat='.Security::remove_XSS($_GET['selectcat']), 'name' => $url_to_who);
} else {
$interbreadcrumb[] = array('url' => $url_dir, 'name' => $url_to_who);
}
else{
$interbreadcrumb[] = array('url' => $url_dir, 'name' => $url_to_who);
}
//does not repeat the name group in the url
if (!empty($_SESSION['_gid'])) {
unset($dir_array[1]);
}
$dir_acum .= $dir_array[$i].'/';
}
if (isset($_GET['createdir'])) {
$interbreadcrumb[] = array('url' => '', 'name' => get_lang('CreateDir'));
}
Display::display_header('','Doc');
// Lib for event log, stats & tracking & record of the access
@ -573,8 +589,7 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights) { // TEACHER ONLY
}
// Show them the form for the directory name
if (isset($_GET['createdir'])) {
// Show the form
if (isset($_GET['createdir'])) {
echo create_dir_form();
}

@ -28,6 +28,7 @@
$language_file[] = 'document';
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'glossary.lib.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
$noPHP_SELF = true;
$header_file = Security::remove_XSS($_GET['file']);
@ -36,14 +37,24 @@ $path_array = array_map('urldecode', $path_array);
$header_file = implode('/', $path_array);
$nameTools = $header_file;
$name_to_show = cut($header_file, 80);
$current_group = GroupManager :: get_group_properties($_SESSION['_gid']);
$current_group_name=$current_group['name'];
if (isset($_SESSION['_gid']) && $_SESSION['_gid'] != '') {
$req_gid = '&amp;gidReq='.$_SESSION['_gid'];
$interbreadcrumb[] = array ('url' => '../group/group.php?', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$_SESSION['_gid'], 'name' => get_lang('GroupSpace'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$_SESSION['_gid'], 'name' => get_lang('GroupSpace').' '.$current_group_name);
$name_to_show = explode('/', $name_to_show);
unset ($name_to_show[1]);
$name_to_show = implode('/', $name_to_show);
}
$interbreadcrumb[] = array('url' => './document.php?curdirpath='.dirname($header_file).$req_gid, 'name' => get_lang('Documents'));
$name_to_show = cut($header_file, 80);
$interbreadcrumb[] = array('url' => 'showinframes.php?gid='.$req_gid.'&file='.$header_file, 'name' => $name_to_show);
$file_url_sys = api_get_path(SYS_COURSE_PATH).'document'.$header_file;

Loading…
Cancel
Save