mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merged from 1.7.
This commit is contained in:
parent
54dc87b845
commit
22206b6722
@ -540,7 +540,7 @@ resource_class.prototype.init_resource = function(id, group, config, parentObj)
|
||||
resource_class.prototype.init_buttons = function() {
|
||||
|
||||
var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands',
|
||||
'span', this.getEl())[0];
|
||||
'span', this.getEl())[0];
|
||||
|
||||
if (commandContainer == null) {
|
||||
YAHOO.log('Cannot find command container for '+this.getEl().id, 'error');
|
||||
@ -596,13 +596,15 @@ resource_class.prototype.init_buttons = function() {
|
||||
|
||||
// Add indentation buttons if needed (move left, move right).
|
||||
if (moveLeft) {
|
||||
var button = main.mk_button('a', '/t/left.gif', [['title', main.portal.strings['moveleft']]]);
|
||||
YAHOO.util.Event.addListener(button, 'click', this.move_left_button, this, true);
|
||||
var button = main.mk_button('a', '/t/left.gif', [['title', main.portal.strings['moveleft']],
|
||||
['class', 'editing_moveleft']]);
|
||||
YAHOO.util.Event.addListener(button, 'click', this.indent_left, this, true);
|
||||
commandContainer.appendChild(button);
|
||||
}
|
||||
if (moveRight) {
|
||||
var button = main.mk_button('a', '/t/right.gif', [['title', main.portal.strings['moveright']]]);
|
||||
YAHOO.util.Event.addListener(button, 'click', this.move_right_button, this, true);
|
||||
var button = main.mk_button('a', '/t/right.gif', [['title', main.portal.strings['moveright']],
|
||||
['class', 'editing_moveright']]);
|
||||
YAHOO.util.Event.addListener(button, 'click', this.indent_right, this, true);
|
||||
commandContainer.appendChild(button);
|
||||
}
|
||||
|
||||
@ -640,6 +642,70 @@ resource_class.prototype.init_buttons = function() {
|
||||
}
|
||||
|
||||
|
||||
resource_class.prototype.indent_left = function() {
|
||||
|
||||
var spacer = YAHOO.util.Dom.getElementsByClassName('spacer',
|
||||
'img', this.getEl())[0];
|
||||
if (!spacer) {
|
||||
return;
|
||||
}
|
||||
if (spacer.width > 20) {
|
||||
spacer.width -= 20;
|
||||
} else {
|
||||
// Remove the spacer.
|
||||
resource = this.getEl();
|
||||
resource.removeChild(spacer);
|
||||
|
||||
// Remove the indent left button as well.
|
||||
var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands',
|
||||
'span', this.getEl())[0];
|
||||
|
||||
var indentLeftBtn = YAHOO.util.Dom.getElementsByClassName('editing_moveleft',
|
||||
'a', commandContainer)[0];
|
||||
|
||||
commandContainer.removeChild(indentLeftBtn);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
resource_class.prototype.indent_right = function() {
|
||||
|
||||
var spacer = YAHOO.util.Dom.getElementsByClassName('spacer',
|
||||
'img', this.getEl())[0];
|
||||
if (!spacer) {
|
||||
var spacer = document.createElement('img');
|
||||
|
||||
spacer.setAttribute('src', main.portal.strings['pixpath']+'/spacer.gif');
|
||||
spacer.setAttribute('class', 'spacer');
|
||||
spacer.setAttribute('width', '20');
|
||||
spacer.setAttribute('height', '12');
|
||||
|
||||
var resource = this.getEl();
|
||||
resource.insertBefore(spacer, resource.childNodes[0]);
|
||||
} else {
|
||||
spacer.width += 20;
|
||||
}
|
||||
// Add a indent left button if none is present.
|
||||
var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands',
|
||||
'span', this.getEl())[0];
|
||||
|
||||
var indentLeftBtn = YAHOO.util.Dom.getElementsByClassName('editing_moveleft',
|
||||
'a', commandContainer)[0];
|
||||
|
||||
var indentRightBtn = YAHOO.util.Dom.getElementsByClassName('editing_moveright',
|
||||
'a', commandContainer)[0];
|
||||
|
||||
if (!indentLeftBtn) {
|
||||
var button = main.mk_button('a', '/t/left.gif', [['title', main.portal.strings['moveleft']],
|
||||
['class', 'editing_moveleft']]);
|
||||
YAHOO.util.Event.addListener(button, 'click', this.indent_left, this, true);
|
||||
commandContainer.insertBefore(button, indentRightBtn);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
resource_class.prototype.toggle_hide = function(target, e, superficial, force) {
|
||||
if (force != null) {
|
||||
if (this.debug) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user