Issue Details (XML | Word | Printable)

Key: CONTRIB-959
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Anthony Borrow
Reporter: Ralf Krause
Votes: 0
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Non-core contributed modules

Conflicts in the html header code with MRBS

Created: 29/Dec/08 09:39 PM   Updated: 04/Jan/09 06:29 AM
Component/s: Block: Mrbs
Affects Version/s: 1.9.3
Fix Version/s: None

File Attachments: 1. HTML File moodle4mac.html (22 kB)
2. File mrbs_header.diff (0.8 kB)

Image Attachments:

1. moodle4mac.png
(135 kB)
Environment: Moodle4Mac 1.9.3+ (Build: 20081227)

Database: MySQL
Participants: Anthony Borrow and Ralf Krause
Security Level: None
Affected Branches: MOODLE_19_STABLE


 Description  « Hide
Hi Anthony,

I found a very stupid bug. The header code of the MRBS pages contains code from two html header sections ... one from Moodle and one from MRBS.

To control this bug I reinstalled the newest code from http://download.moodle.org/plugins/blocks/mrbs.zip
Please go to my page and look at the source code of the current version on http://moodle4mac.dyndns.org:8888/moodle19/course/view.php?id=12

You will get <head> in line 3 and a lot of code from Moodle 1.9.3 .... the tag </html> follows in line 105.
After this you find the tag <body> with some class additions .... and in line 118 comes an <!-- END OF HEADER -->

In line 120 starts the real header code from MRBS which needs until line 210 and </HEAD>

I don't know if this problem will be offered in any other Moodle installation. My test Moodle runs without any modification on a MAMP server so it should be a normal and clean Moodle. If you follow my link you can see the problem yourself. Additionally I installed MRBS from 20080510 .... there is no conflict with the headers in the same Moodle.

Ralf



 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Anthony Borrow added a comment - 01/Jan/09 06:51 AM
Ralf - I went to the link you provided but did not find two <head> tags and nothing related to the MRBS other than the links. I'm attaching a screen shot. It is not clear to me what you are describing as being the problem and why this may be a security issue. Could you provide me step by step instructions where I could see the problem? Peace - Anthony

Anthony Borrow added a comment - 01/Jan/09 06:54 AM
here is screen shot along with source code I found at given link which only has on <head> tag

Ralf Krause added a comment - 01/Jan/09 10:47 AM
Hi Anthony,

if you go up to my page and then to the current version of MRBS then you will see the double html header. If you go to the older version you will see that everything is okay. additional I added a link to the new version of MRBS 1.4 that runs without Moodle.

Ralf


Anthony Borrow added a comment - 01/Jan/09 11:17 AM
Ralf - Yep, I see what you mean now. Good catch! Could you test this patch and see if that resolves the issue? If not, could you upload a patch file. The issue is in the print_header_mrbs function in the functions.php file. I began using the Moodle print_header function and forgot that mrbs was doing some of its own function definitions. I've not checked to see if there is some duplication that might be avoided. If there is please feel free to make suggestions. Peace - Anthony

Ralf Krause added a comment - 01/Jan/09 10:23 PM
Yes,
after I deleted the 3 lines from the file moodle/blocks/mrbs/web/functions.php everything seems to be okay with the html header of the MRBS page.

Ralf Krause added a comment - 04/Jan/09 01:33 AM
Anthony,

sorry but I should look better next time .... yes, it's correct that there is only one head and only one body ....

But there is some overlapping code that should better stay in the header of the html page. Yes, it's correct that you can have javascipts in your body code but it would be better to move them into the header. And I found some code that should always stay in the header ... see next three lines

<LINK REL="stylesheet" href="mrbs.css" type="text/css">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8">
<META NAME="Robots" content="noindex">

I hope that it would be easy to repair the header code.

Regards, Ralf

                                1. html code starting at line 104
                                  </script>
                                  </head>
                                1. end of the head
                                2. start of the body

<body class="blocks-mrbs-web course-1 dir-ltr lang-de_utf8" id="blocks-mrbs-web-day">

<div id="page">

                                1. navigation and user message
                                  <div id="header" class=" clearfix"> <h1 class="headermain">Raumbuchungssystem</h1>
                                  <div class="headermenu"><div class="logininfo">Sie sind angemeldet als <a href="http://moodle4mac.dyndns.org:8888/moodle19/user/view.php?id=2&course=1">- Admin -</a> (<a href="http://moodle4mac.dyndns.org:8888/moodle19/login/logout.php?sesskey=kIHHEpr9Bd">Logout</a>)</div></div>
                                  </div> <div class="navbar clearfix">
                                  <div class="breadcrumb"><h2 class="accesshide " >Sie sind hier</h2> <ul>
                                  <li class="first"><a onclick="this.target='_top'" href="http://moodle4mac.dyndns.org:8888/moodle19/">Start</a></li><li class="first"> <span class="accesshide " >/ </span><span class="arrow sep">▶</span> Raumbuchungssystem</li></ul></div>
                                  <div class="navbutton"> </div>
                                  </div>
                                  <!-- END OF HEADER -->
                                  <div id="content" class=" clearfix">
                                1. code that should stay in the head
                                  <LINK REL="stylesheet" href="mrbs.css" type="text/css">
                                  <META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8">
                                  <META NAME="Robots" content="noindex">

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

/* Script inspired by "True Date Selector"
Created by: Lee Hinder, lee.hinder@ntlworld.com

Tested with Windows IE 6.0
Tested with Linux Opera 7.21, Mozilla 1.3, Konqueror 3.1.0

*/

function daysInFebruary (year){
// February has 28 days unless the year is divisible by four,
// and if it is the turn of the century then the century year
// must also be divisible by 400 when it has 29 days
return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

//function for returning how many days there are in a month including leap years
function DaysInMonth(WhichMonth, WhichYear)
{
var DaysInMonth = 31;
if (WhichMonth == "4" || WhichMonth == "6" || WhichMonth == "9" || WhichMonth == "11")
DaysInMonth = 30;
if (WhichMonth == "2")
DaysInMonth = daysInFebruary( WhichYear );
return DaysInMonth;
}

//function to change the available days in a months
function ChangeOptionDays(formObj, prefix)
{
var DaysObject = eval("formObj." + prefix + "day");
var MonthObject = eval("formObj." + prefix + "month");
var YearObject = eval("formObj." + prefix + "year");

if (DaysObject.selectedIndex && DaysObject.options)

{ // The DOM2 standard way // alert("The DOM2 standard way"); var DaySelIdx = DaysObject.selectedIndex; var Month = parseInt(MonthObject.options[MonthObject.selectedIndex].value); var Year = parseInt(YearObject.options[YearObject.selectedIndex].value); }

else if (DaysObject.selectedIndex && DaysObject[DaysObject.selectedIndex])

{ // The legacy MRBS way // alert("The legacy MRBS way"); var DaySelIdx = DaysObject.selectedIndex; var Month = parseInt(MonthObject[MonthObject.selectedIndex].value); var Year = parseInt(YearObject[YearObject.selectedIndex].value); }

else if (DaysObject.value)

{ // Opera 6 stores the selectedIndex in property 'value'. // alert("The Opera 6 way"); var DaySelIdx = parseInt(DaysObject.value); var Month = parseInt(MonthObject.options[MonthObject.value].value); var Year = parseInt(YearObject.options[YearObject.value].value); }

// alert("Day="(DaySelIdx+1)" Month="Month" Year="+Year);

var DaysForThisSelection = DaysInMonth(Month, Year);
var CurrentDaysInSelection = DaysObject.length;
if (CurrentDaysInSelection > DaysForThisSelection)
{
for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)

{ DaysObject.options[DaysObject.options.length - 1] = null }

}
if (DaysForThisSelection > CurrentDaysInSelection)
{
for (i=0; i<DaysForThisSelection; i++)

{ DaysObject.options[i] = new Option(eval(i + 1)); }

}
if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex = 0;
if (DaySelIdx >= DaysForThisSelection)
DaysObject.selectedIndex = DaysForThisSelection-1;
else
DaysObject.selectedIndex = DaySelIdx;
}

// End -->
</SCRIPT>


Anthony Borrow added a comment - 04/Jan/09 06:29 AM
No problem - I am wondering if we would be better off removing the MRBS header functions. I'll have to look more carefully at this. By using the Moodle header call it automatically closes itself so we do not have the option to just move the </head> tag. This will have to wait unti I get back from Nepal. Peace - Anthony