diff --git a/plugin/h5p/node_process.php b/plugin/h5p/node_process.php index 768db900b5..8893dae907 100644 --- a/plugin/h5p/node_process.php +++ b/plugin/h5p/node_process.php @@ -64,13 +64,24 @@ if ($id > 0) { $h5pDestination = 'cache-h5p/launch/'.$fieldId; //mkdir($dest_h5p); + $installH5P = true; - copyr($h5pSource, $h5pDestination); - + if (!file_exists('cache-h5p/launch/img/dialogcard.jpg')) { + $installH5P = false; + } + if (!file_exists( 'cache-h5p/launch/images/dialogcard.jpg')) { + $installH5P = false; + } + if (!file_exists($h5pSource)) { + $installH5P = false; + } else { + copyr($h5pSource, $h5pDestination); + } + $contentSource = 'cache-h5p/launch/'.$fieldId.'/content/content.json'; $contentFlx = file_get_contents($contentSource); - if ($nodeType == 'dialogcard' || $nodeType == 'memory') { + if (($nodeType == 'dialogcard' || $nodeType == 'memory') && $installH5P) { if (controlSourceCards($termA)) { $baseFlx = getSourceCards($termA, $nodeType); } @@ -98,7 +109,7 @@ if ($id > 0) { $contentFlx = str_replace("\"@base_cards@\"", $baseFlx, $contentFlx); } - if ($nodeType == 'guesstheanswer') { + if ($nodeType == 'guesstheanswer' && $installH5P) { $extractImgData = "images/dialogcard.jpg"; $pathParts = pathinfo($termB); $fileN = $pathParts['filename']; @@ -138,6 +149,10 @@ if ($id > 0) { $contentFlx = str_replace("\"You got :num out of :total points\"", "\"Votre score :num out sur :total points\"", $contentFlx); $contentFlx = str_replace("\"Show solution\"", "\"Voir la solution\"", $contentFlx); + $contentFlx = str_replace("\"Match found.\"", "\"Correspondance trouvée.\"", $contentFlx); + $contentFlx = str_replace("\"Reset\"", "\"Recommencer\"", $contentFlx); + $contentFlx = str_replace("\"Close\"", "\"Fermer\"", $contentFlx); + $contentFlx = str_replace("\"Time spent\"", "\"Temps\"", $contentFlx); } elseif ($interfaceLanguage == 'es') { $contentFlx = str_replace("\"solution label\"", "\"Ver la solución\"", $contentFlx); $contentFlx = str_replace("\"Turn\"", "\"Girar\"", $contentFlx); @@ -149,6 +164,10 @@ if ($id > 0) { $contentFlx = str_replace("\"You got :num out of :total points\"", "\"Su nota es de :num sobre :total puntos\"", $contentFlx); $contentFlx = str_replace("\"Show solution\"", "\"Ver la solución\"", $contentFlx); + $contentFlx = str_replace("\"Match found.\"", "\"Coincidencia encontrada.\"", $contentFlx); + $contentFlx = str_replace("\"Reset\"", "\"Reiniciar\"", $contentFlx); + $contentFlx = str_replace("\"Close\"", "\"Cerrar\"", $contentFlx); + $contentFlx = str_replace("\"Time spent\"", "\"El tiempo pasado\"", $contentFlx); } $fp = fopen($contentSource, 'w'); @@ -180,6 +199,10 @@ $contentForm .= ''; $contentForm .= ''.get_lang('Close').''; $contentForm .= '

'; +if ($installH5P == false) { + $contentForm = Display::return_message(get_lang('FolderDoesntExistsInFileSystem'), 'error'); +} + $tpl = new Template("H5P"); $tpl->assign('form', $contentForm); $content = $tpl->fetch('/h5p/view/view.tpl'); @@ -262,3 +285,4 @@ function getSourceCards($termData, $nodeType) return $baseFlx; } + diff --git a/plugin/h5p/resources/css/H5P.css b/plugin/h5p/resources/css/H5P.css index 11586eb304..3c482bb257 100644 --- a/plugin/h5p/resources/css/H5P.css +++ b/plugin/h5p/resources/css/H5P.css @@ -115,4 +115,48 @@ .deleteBlockCard:hover{ border : solid 2px rgb(224, 73, 35); border-radius : 50%; -} \ No newline at end of file +} + + +/* header cell in data table in tools */ +.data_table { + margin-bottom: 18px; + width: 100%; + border: 1px solid #DDDDDD; +} +.data_table td { + font-size: 12px; +} +.data_table th, .data_table td { + border-top: 1px solid #DDDDDD; + line-height: 18px; + padding: 10px; +} +.data_table th { + padding: 8px 10px; + font-weight: normal; + background-color: #EEEEEE; + border-bottom: 1px solid #DDDDDD; + color: #333; +} +.data_table th a { + color: #333; +} +.data_table_no_border { + border-collapse: collapse; + border-spacing: 0; + font-size: 12px; + margin-bottom: 15px; + margin-top: 8px; + text-align: left; + width: 100%; +} +.data_table_no_border td { + line-height: normal; + padding: 6px; + text-align: left; + vertical-align: middle; +} +.data_table tr.row_odd { + background-color: #F9F9F9; +} diff --git a/plugin/h5p/resources/js/h5p_extras.js b/plugin/h5p/resources/js/h5p_extras.js index a6c16c407e..773c662ebb 100644 --- a/plugin/h5p/resources/js/h5p_extras.js +++ b/plugin/h5p/resources/js/h5p_extras.js @@ -62,10 +62,12 @@ function insertExtrasObjectsH5p(){ if($(".cke_dialog_background_cover").length==0){ $("body").append(''); } - + if($("#extrasobjectH5p").length==0){ $("body").append('
'+inExtrasObjectsH5p()+'
'); showEditH5pLoad(); + }else{ + loadDataH5Pbase(); } }