Merge pull request #879 from jloguercio/7897temp

Fixes create new document that fails when select a destination - Refs #7897
1.10.x
Yannick Warnier 9 years ago
commit cab2809cca
  1. 24
      main/document/create_document.php
  2. 5
      main/inc/ajax/document.ajax.php

@ -52,6 +52,16 @@ $(document).ready(function() {
});
});
$(document).on("click", ".dropdown-menu li a", function () {
var textValue = $(this).text();
$.ajax({
contentType: "application/x-www-form-urlencoded",
data: "textValue="+textValue,
url: "' . api_get_path(WEB_AJAX_PATH) . 'document.ajax.php?a=documentDestination",
type: "POST"
});
});
function setFocus() {
$("#document_title").focus();
}
@ -432,6 +442,20 @@ if ($form->validate()) {
$values = $form->exportValues();
$readonly = isset($values['readonly']) ? 1 : 0;
$values['title'] = trim($values['title']);
$textValue = $_SESSION['textValue'];
$homeDirectory = get_lang('HomeDirectory');
if ($textValue === $homeDirectory){
$dir = "/";
} else if ($dir != "/") {
$posTextValue = strpos($textValue, '—');
$textValue = substr($textValue, ($posTextValue + 4));
foreach ($folder_titles as $dirValue => $dirText) {
if ($dirText === $textValue) {
$dir = $dirValue;
}
}
}
if ($dir[strlen($dir) - 1] != '/') {
$dir .= '/';

@ -73,5 +73,10 @@ switch ($action) {
);
}
break;
case 'documentDestination':
//obtained the bootstrap-select selected value via ajax
$textValue = isset($_POST['textValue']) ? $_POST['textValue'] : null;
$_SESSION['textValue'] = $textValue;
break;
}
exit;

Loading…
Cancel
Save