diff --git a/public/main/lp/learnpath.class.php b/public/main/lp/learnpath.class.php index 68f1836307e..328c684e970 100644 --- a/public/main/lp/learnpath.class.php +++ b/public/main/lp/learnpath.class.php @@ -5110,6 +5110,11 @@ public function create_document( ); } + $ext = strtolower((string) $extension); + if (in_array($ext, ['html','htm'], true)) { + $docFiletype = 'html'; + } + $document = DocumentManager::addDocument( $courseInfo, null, @@ -5127,6 +5132,19 @@ public function create_document( $parentId ); + if ($document && in_array($ext, ['html','htm'], true)) { + $em = Database::getManager(); + $docRepo = Container::getDocumentRepository(); + $docEntity = $docRepo->find($document->getIid()); + if ($docEntity && $docEntity->hasResourceNode()) { + $rf = $docEntity->getResourceNode()->getResourceFiles()->first(); + if ($rf && $rf->getMimeType() !== 'text/html') { + $rf->setMimeType('text/html'); + $em->flush(); + } + } + } + $document_id = $document->getIid(); if ($document_id) { $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : ''; diff --git a/public/main/lp/lp_controller.php b/public/main/lp/lp_controller.php index 09380a4e398..f6c7c1e6a8c 100644 --- a/public/main/lp/lp_controller.php +++ b/public/main/lp/lp_controller.php @@ -174,7 +174,7 @@ } $__returnTo = $_GET['returnTo'] ?? ''; -$__listUrlForSpa = $listUrl; // el de resources/lp/... +$__listUrlForSpa = $listUrl; $goList = static function () use ($__listUrlForSpa, $__returnTo) { header('Location: '.$__listUrlForSpa); exit; @@ -589,7 +589,10 @@ $goList(); } else { Session::write('refresh', 1); - $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($oLP->lp_id).'&'.api_get_cidreq(); + $url = api_get_self() + .'?action=add_item&type=step&lp_id='.intval($oLP->lp_id) + .'&'.api_get_cidreq() + .'&isStudentView=false'; header('Location: '.$url); exit; }