Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test UI tidying #190

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions css/jquery-ui.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 75 additions & 20 deletions do_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,38 +190,51 @@ function do_test_desktop_page($property = null)
<div id="frame-h">
<?php
start_test_header_page($language);
?>
?>
</div>
<hr />
<div id="frame-l">
<?php
if (getreq('type') == 'table') {
do_test_table();
} else {
$identifier = do_test_get_identifier(
$_REQUEST['selection'] ?? null,
$_SESSION['testsql'] ?? null,
$_REQUEST['lang'] ?? null,
$_REQUEST['text'] ?? null
);
do_test_test_content_ajax($identifier[0], $identifier[1]);
}
?>
if (getreq('type') == 'table') {
do_test_table();
} else {
$identifier = do_test_get_identifier(
$_REQUEST['selection'] ?? null, $_SESSION['testsql'] ?? null,
$_REQUEST['lang'] ?? null, $_REQUEST['text'] ?? null
);
do_test_test_content_ajax($identifier[0], $identifier[1]);
}
?>
</div>
</div>
<div id="frames-r"
style="position: fixed; top: 2%; right: 0; height: 90%;
width: <?php echo 97 - $frame_l_width; ?>%;">
style="position: fixed; top: 2%; right: 0; height: 98vh;
width: <?php echo 100 - $frame_l_width; ?>%;display:flex; flex-direction: column;">
<!-- iFrames wrapper for events -->
<iframe src="empty.html" scrolling="auto" name="ro"
<iframe src="empty.html" scrolling="auto" id="ro" name="ro"
style="height: 50%; width: 100%;">
Your browser doesn't support iFrames, update it!
</iframe>
<iframe src="empty.html" scrolling="auto" name="ru"
<iframe src="empty.html" scrolling="auto" id="ru" name="ru"
style="height: 50%; width: 100%;">
Your browser doesn't support iFrames, update it!
</iframe>
</div>
<script>
function adjustIframeHeights(entries) {
for (const entry of entries) {




const heightDifference = $("#frames-r").height() - entry.contentRect.height - $('#ru').height();
$('#ru').height($('#ru').height() + heightDifference + 'px');
}
}

var iframeObserver = new ResizeObserver(adjustIframeHeights);
iframeObserver.observe(document.getElementById("ro"));
</script>
<audio id="success_sound">
<source src="<?php print_file_path("sounds/success.mp3") ?>" type="audio/mpeg" />
Your browser does not support audio element!
Expand All @@ -248,12 +261,54 @@ function do_test_page($p)
{
pagestart_nobody(
'Test',
"body {
"
#test-html {
display: flex;
flex-direction: column;
height: 100vh;
overflow: none;
}

body {
margin: 20px;
max-width: 100%;
}"
);
overflow: hidden;
}
#frame-h {
display: flex;
flex-flow: column;
justify-content: center;
align-items: stretch;
overflow: hidden;
height: 10.773em;
}
#frames-l {
top: 2%;
left: 0;
width: 50%;
position: absolute;
overflow: hidden;
}
#frames-r{
overflow: hidden;
position: absolute;
top: 2%;
right: 0;
height: 99vh;
width: 50%;
}
.h4{

display: block;
margin-top: 1.33em;
margin-bottom: 1.33em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}
"
);

if (is_mobile()) {
do_test_mobile_page();
} else {
Expand Down
29 changes: 13 additions & 16 deletions do_test_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,32 +132,32 @@ function get_test_counts($testsql)

/**
* Make the header row for tests.
*
*
* @param mixed $_p URL property to use (unnused), will be removed in LWT 3.0.0
*
*
* @return void
*/
function do_test_header_row($_p)
{
?>
<div class="flex-header">
<div class="h4" style="
display: flex;">
<div>
<a href="edit_texts.php" target="_top">
<?php echo_lwt_logo(); ?>
</a>
</div>
<?php
LWT-fork
</a>&nbsp; | &nbsp;</div>
<?php
// This part only works if $textid is set
if (is_numeric(getreq('text'))) {
$textid = (int) getreq('text');
echo '<div>' . getPreviousAndNextTextLinks(
$textid,
'do_test.php?text=',
false,
''
) . '</div>';

$textid, 'do_test.php?text=', false, ''
) . '</div>&nbsp; | &nbsp;';

?>
<div>
<?php quickMenu("test"); ?>&nbsp; | &nbsp;</div>
<div>
<a href="do_text.php?start=<?php echo $textid; ?>" target="_top">
<img src="icn/book-open-bookmark.png" title="Read" alt="Read" />
Expand All @@ -170,9 +170,6 @@ function do_test_header_row($_p)
<?php
}
?>
<div>
<?php quickMenu(); ?>
</div>
</div>
<?php
}
Expand Down Expand Up @@ -246,7 +243,7 @@ function startTestTable(property) {
function do_test_header_content($title, $p, $totalcountdue, $totalcount, $language)
{
?>
<h1>TEST ▶ <?php echo tohtml($title) ?></h1>
<h3>TEST ▶ <?php echo tohtml($title) ?></h3>
<div style="margin: 5px;">
Word<?php echo intval($totalcount) > 1 ? 's' : ''; ?> due today:
<?php echo htmlspecialchars($totalcount); ?>,
Expand Down
2 changes: 1 addition & 1 deletion do_test_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1098,13 +1098,13 @@ function do_test_test_content_ajax($selector, $selection)
}
$notyettested = (int) $count;

prepare_test_footer($notyettested);
$total_tests = do_test_prepare_ajax_test_area(
$selector,
$selection,
$notyettested,
$testtype
);
prepare_test_footer($notyettested);
do_test_test_javascript($total_tests);
}

Expand Down
4 changes: 2 additions & 2 deletions inc/kernel_utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,11 @@ function my_die($text)
/**
* Display the main menu of navigation as a dropdown
*/
function quickMenu(): void
function quickMenu($page = ""): void
{
?>

<select id="quickmenu" onchange="quickMenuRedirection(value)">
<select id="quickmenu<?php echo $page;?>" onchange="quickMenuRedirection(value)">
<option value="" selected="selected">[Menu]</option>
<option value="index">Home</option>
<optgroup label="Texts">
Expand Down
4 changes: 2 additions & 2 deletions inc/session_utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -4158,7 +4158,7 @@ function framesetheader($title): void
@header('Cache-Control: no-cache, must-revalidate, max-age=0');
@header('Pragma: no-cache');
?><!DOCTYPE html>
<?php echo '<html lang="en">'; ?>
<?php echo '<html id="'. strtolower($title).'-html" lang="en">'; ?>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="<?php print_file_path('css/styles.css');?>" />
Expand Down Expand Up @@ -4216,7 +4216,7 @@ function pagestart_nobody($title, $addcss=''): void
@header('Pragma: no-cache');
?><!DOCTYPE html>
<?php
echo '<html lang="en">';
echo '<html id="'. strtolower($title).'-html" lang="en">';
?>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
Expand Down
Loading