Skip to content

Commit

Permalink
Partial fix for reopened bug MDL-7878, "Link identification and skipp…
Browse files Browse the repository at this point in the history
…ing" - affects all course formats + other files.
  • Loading branch information
nfreear committed Oct 22, 2007
1 parent 5b27c44 commit 5c35501
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 30 deletions.
2 changes: 1 addition & 1 deletion course/format/lams/format.php
Expand Up @@ -75,7 +75,7 @@
}

/// Start main column
echo '<td id="middle-column"><a name="startofcontent"></a>';
echo '<td id="middle-column">'. skip_main_destination();

print_heading_block(get_string('lamsoutline','lams'), 'outline');

Expand Down
2 changes: 1 addition & 1 deletion course/format/scorm/format.php
Expand Up @@ -35,7 +35,7 @@
echo '</td>';
}

echo '<td id="middle-column"><a name="startofcontent"></a>';
echo '<td id="middle-column">'. skip_main_destination();
$moduleformat = $module.'_course_format_display';
if (function_exists($moduleformat)) {
$moduleformat($USER,$course);
Expand Down
2 changes: 1 addition & 1 deletion course/format/social/format.php
Expand Up @@ -40,7 +40,7 @@

echo '<td id="middle-column">';
if (!empty($THEME->customcorners)) print_custom_corners_start();
echo '<a name="startofcontent"></a>';
echo skip_main_destination();
if ($forum = forum_get_course_forum($course->id, 'social')) {
print_heading_block(get_string('socialheadline'));

Expand Down
2 changes: 1 addition & 1 deletion course/format/topics/format.php
Expand Up @@ -93,7 +93,7 @@
/// Start main column
echo '<td id="middle-column">';
if (!empty($THEME->customcorners)) print_custom_corners_start();
echo '<a name="startofcontent"></a>';
echo skip_main_destination();

print_heading_block(get_string('topicoutline'), 'outline');

Expand Down
2 changes: 1 addition & 1 deletion course/format/weeks/format.php
Expand Up @@ -80,7 +80,7 @@

if (!empty($THEME->customcorners)) print_custom_corners_start();

echo '<a name="startofcontent"></a>';
echo skip_main_destination();

print_heading_block(get_string('weeklyoutline'), 'outline');

Expand Down
2 changes: 1 addition & 1 deletion course/format/weekscss/format.php
Expand Up @@ -85,7 +85,7 @@
}

/// Start main column
echo '<div id="middle-column"><a name="startofcontent"></a>';
echo '<div id="middle-column">'. skip_main_destination();

print_heading_block(get_string('weeklyoutline'), 'outline');

Expand Down
2 changes: 1 addition & 1 deletion lang/en_utf8/access.php
Expand Up @@ -21,7 +21,7 @@
$string['skipnavigation'] = 'Skip navigation';
$string['tabledata'] = 'Data table, $a';
$string['tablelayout'] = 'Layout table, $a';
$string['tocontent'] = 'Go to main content';
$string['tocontent'] = 'Skip to main content';
$string['tonavigation'] = 'Go to navigation';
$string['youarehere'] = 'You are here';

Expand Down
1 change: 0 additions & 1 deletion lang/en_utf8/moodle.php
Expand Up @@ -1332,7 +1332,6 @@
$string['sizekb'] = 'KB';
$string['sizemb'] = 'MB';
$string['skipped'] = 'Skipped';
$string['skiptomaincontent'] = 'Skip forward to main content';
$string['skypeid'] = 'Skype ID';
$string['socialheadline'] = 'Social forum - latest topics';
$string['someallowguest'] = 'Some courses may allow guest access';
Expand Down
2 changes: 1 addition & 1 deletion lib/pagelib.php
Expand Up @@ -439,7 +439,7 @@ function print_header($title, $morenavlinks=NULL, $meta='', $bodytags='') {
print_header($title, $this->courserecord->fullname, $navigation,
'', $meta, true, $buttons, user_login_string($this->courserecord, $USER), false, $bodytags);

echo '<div class="accesshide"><a href="#startofcontent">'.get_string('skiptomaincontent').'</a></div>';
echo '<a class="skip" href="#maincontent">'.get_string('tocontent', 'access').'</a>';
}

// SELF-REPORTING SECTION
Expand Down
16 changes: 16 additions & 0 deletions lib/weblib.php
Expand Up @@ -2257,6 +2257,13 @@ function get_html_lang($dir = false) {
return ($direction.' lang="'.$language.'" xml:lang="'.$language.'"');
}

/**
* Return the markup for the destination of the 'Skip to main content' links.
*/
function skip_main_destination() {
return '<span id="maincontent"></span>';
}


/// STANDARD WEB PAGE PARTS ///////////////////////////////////////////////////

Expand Down Expand Up @@ -2497,6 +2504,15 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
$output = ob_get_contents();
ob_end_clean();

/*// Skip to main content, TODO: 'site-index', 'course-index'
if ('course-view'==$pageid) {
$skiplink = '<a class="skip" href="#maincontent">'.get_string('tocontent', 'access').'</a>';
if (! preg_match('/(.*<div.*?page.>)(.*)/s', $output, $matches)) {
preg_match('/(.*<body.*?>)(.*)/s', $output, $matches);
}
$output = $matches[1]."\n". $skiplink .$matches[2];
}*/

$output = force_strict_header($output);

if (!empty($CFG->messaging)) {
Expand Down
6 changes: 0 additions & 6 deletions theme/formal_white/fw_layout.css
Expand Up @@ -97,12 +97,6 @@ input, select {
*** Header
***/

.headerskip {
position:absolute;
right:20em;
font-size:0.8em;
}

#header-home {
/* padding:1em 0.5em; */
height:100px;
Expand Down
6 changes: 0 additions & 6 deletions theme/standard/styles_color.css
Expand Up @@ -203,12 +203,6 @@ table.formtable tbody th {
color:#aaa;
}

.headerskip a:link,
.headerskip a:visited,
.headerskip a:hover {
color: #FFF;
}

.navigation select {
background-color:#FFFFFF;
}
Expand Down
13 changes: 4 additions & 9 deletions theme/standard/styles_layout.css
Expand Up @@ -668,12 +668,6 @@ div.phpinfo .center th {
*** Header
***/

.headerskip {
position:absolute;
right:20em;
font-size:0.8em;
}

#header-home {
}

Expand Down Expand Up @@ -1179,16 +1173,17 @@ body#admin-modules table.generaltable td.c0
***/

/*Accessibility: Skip block link, for keyboard-only users. */
a.skip-block {
a.skip-block, a.skip {
position: absolute;
top: -1000em;
font-size: 0.85em;
}
a.skip-block:focus, a.skip-block:active {
a.skip-block:focus, a.skip-block:active,
a.skip:focus, a.skip:active {
position: static;
display: block;
}
.skip-block-to {
.skip-block-to, #maincontent {
display: block;
height: 1px;
}
Expand Down

0 comments on commit 5c35501

Please sign in to comment.