Skip to content

Commit

Permalink
Merged from 1.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyshane committed Nov 17, 2006
1 parent 34941e0 commit 88c5092
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
4 changes: 3 additions & 1 deletion course/format/weeks/format.php
Expand Up @@ -173,7 +173,8 @@
echo '<tr id="section-'.$section.'" class="section main'.$sectionstyle.'">';
echo '<td class="left side">&nbsp;</td>';

if (!empty($USER->ajax) && $editing) {

if (ajaxenabled() && $editing) {
// Temporarily hide the dates for the weeks. We do it this way
// for now. Eventually, we'll have to modify the javascript code
// to handle re-calculation of dates when sections are moved
Expand All @@ -183,6 +184,7 @@
$weekperiod = $weekday.' '.$endweekday;
}


echo '<td class="content">';
if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) { // Hidden for students
echo '<div class="weekdates">'.$weekperiod.' ('.get_string('notavailable').')</div>';
Expand Down
27 changes: 23 additions & 4 deletions lib/ajax/ajaxlib.php
Expand Up @@ -9,10 +9,7 @@ function require_js($list) {
global $CFG;
$output = '';

if (!check_browser_version('MSIE', 6.0)
&& !check_browser_version('Firefox', 1.5)
&& !check_browser_version('Camino', '1.0.2')) {
// We still have issues with AJAX in other browsers.
if (!ajaxenabled()) {
return;
}

Expand Down Expand Up @@ -45,6 +42,28 @@ function require_js($list) {
}


/**
* Returns whether ajax is enabled/allowed or not.
*/
function ajaxenabled() {

global $CFG, $USER;

if (!check_browser_version('MSIE', 6.0)
&& !check_browser_version('Firefox', 1.5)
&& !check_browser_version('Camino', '1.0.2')) {
// We still have issues with AJAX in other browsers.
return false;
}

if (!empty($CFG->enableajax) && !empty($USER->ajax)) {
return true;
} else {
return false;
}
}


/**
* Used to create view of document to be passed to JavaScript on pageload.
* We use this class to pass data from PHP to JavaScript.
Expand Down
8 changes: 4 additions & 4 deletions lib/ajax/section_classes.js
Expand Up @@ -306,16 +306,16 @@ section_class.prototype.mk_marker = function() {
main.connect('POST', 'class=course&field=marker', null, 'value=0');
this.toggle_highlight();
}
}
}

section_class.prototype.changeId = function(newId) {
this.sectionId = newId;
this.numberDisplay.firstChild.data = newId;
this.numberDisplay.firstChild.data = newId;

//main.connectQueue_add('POST','class=section&field=all',null,'id='+newId+"&summary="+main.mk_safe_for_transport(this.summary)+"&sequence="+this.write_sequence_list(true)+'&visible='+(this.hidden?0:1))

if (main.marker == this) {
main.update_marker(this);
main.update_marker(this);
}
}

Expand Down Expand Up @@ -392,7 +392,7 @@ section_class.prototype.insert_resource = function(el, targetel) {
} else {
if (el.hiddenStored != null) {
el.toggle_hide(null, null, true, el.hiddenStored);
el.hiddenStored = null;
el.hiddenStored = null;
}
}
//update model
Expand Down

0 comments on commit 88c5092

Please sign in to comment.