Skip to content

Commit d4e8604

Browse files
committed
Merge branch '1.10.x' of https://github.com/chamilo/chamilo-lms into 1.10.0-rc
2 parents 99ddda7 + cab2809 commit d4e8604

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

main/document/create_document.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@
5252
});
5353
});
5454
55+
$(document).on("click", ".dropdown-menu li a", function () {
56+
var textValue = $(this).text();
57+
$.ajax({
58+
contentType: "application/x-www-form-urlencoded",
59+
data: "textValue="+textValue,
60+
url: "' . api_get_path(WEB_AJAX_PATH) . 'document.ajax.php?a=documentDestination",
61+
type: "POST"
62+
});
63+
});
64+
5565
function setFocus() {
5666
$("#document_title").focus();
5767
}
@@ -432,6 +442,20 @@ function document_exists($filename)
432442
$values = $form->exportValues();
433443
$readonly = isset($values['readonly']) ? 1 : 0;
434444
$values['title'] = trim($values['title']);
445+
446+
$textValue = $_SESSION['textValue'];
447+
$homeDirectory = get_lang('HomeDirectory');
448+
if ($textValue === $homeDirectory){
449+
$dir = "/";
450+
} else if ($dir != "/") {
451+
$posTextValue = strpos($textValue, '');
452+
$textValue = substr($textValue, ($posTextValue + 4));
453+
foreach ($folder_titles as $dirValue => $dirText) {
454+
if ($dirText === $textValue) {
455+
$dir = $dirValue;
456+
}
457+
}
458+
}
435459

436460
if ($dir[strlen($dir) - 1] != '/') {
437461
$dir .= '/';

main/inc/ajax/document.ajax.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,10 @@
7373
);
7474
}
7575
break;
76+
case 'documentDestination':
77+
//obtained the bootstrap-select selected value via ajax
78+
$textValue = isset($_POST['textValue']) ? $_POST['textValue'] : null;
79+
$_SESSION['textValue'] = $textValue;
80+
break;
7681
}
7782
exit;

0 commit comments

Comments
 (0)