}
-main_class.prototype.mk_button = function(tag, imgSrc, attributes, imgAttributes) {
- //create button and return object
+main_class.prototype.mk_button = function(tag, imgSrc, text, attributes, imgAttributes) {
+ //Create button and return object.
+ //Set the text: the container TITLE or image ALT attributes can be overridden, eg.
+ // main.mk_button('a', '/i/move_2d.gif', strmove, [['title', strmoveshort]]);
var container = document.createElement(tag);
- container.style.cursor = 'pointer';
+ container.style.cursor = 'pointer';
+ container.setAttribute('title', text);
var image = document.createElement('img');
image.setAttribute('src', main.portal.strings['pixpath']+imgSrc);
+ image.setAttribute('alt', text);
+ //image.setAttribute('title', '');
container.appendChild(image);
if (attributes != null) {
}
if (imgAttributes != null) {
for (var c=0; c<imgAttributes.length; c++) {
- image.setAttribute(imgAttributes[c][0], imgAttributes[c][1]);
+ image.setAttribute(imgAttributes[c][0], imgAttributes[c][1]);
}
}
image.setAttribute('hspace', '3');
}
-main_class.prototype.getString = function(title, variable) {
- if (this.portal.strings[title]) {
- return this.portal.strings[title].replace(/_var_/, variable);
+main_class.prototype.getString = function(identifier, variable) {
+ if (this.portal.strings[identifier]) {
+ return this.portal.strings[identifier].replace(/_var_/, variable);
}
}
block_class.prototype.init_buttons = function() {
- var viewbutton = main.mk_button('a', '/t/hide.gif', [['class', 'icon hide']]);
+ var viewbutton = main.mk_button('a', '/t/hide.gif', main.portal.strings['hide'], [['class', 'icon hide']]);
YAHOO.util.Event.addListener(viewbutton, 'click', this.toggle_hide, this, true);
- var deletebutton = main.mk_button('a', '/t/delete.gif', [['class', 'icon delete']]);
+ var deletebutton = main.mk_button('a', '/t/delete.gif', main.portal.strings['delete'], [['class', 'icon delete']]);
YAHOO.util.Event.addListener(deletebutton, 'click', this.delete_button, this, true);
this.viewbutton = viewbutton;
block_class.prototype.toggle_hide = function(e, target, isCosmetic) {
-
+ var strhide = main.portal.strings['hide'];
+ var strshow = main.portal.strings['show'];
if (YAHOO.util.Dom.hasClass(this.getEl(), 'hidden')) {
this.getEl().className = this.originalClass;
this.viewbutton.childNodes[0].src = this.viewbutton.childNodes[0].src.replace(/show.gif/i, 'hide.gif');
+ this.viewbutton.childNodes[0].alt = this.viewbutton.childNodes[0].alt.replace(strshow, strhide);
+ this.viewbutton.title = this.viewbutton.title.replace(strshow, strhide);
if (!isCosmetic) {
main.connect('POST', 'class=block&field=visible', null,
this.originalClass = this.getEl().className;
this.getEl().className = "hidden sideblock";
this.viewbutton.childNodes[0].src = this.viewbutton.childNodes[0].src.replace(/hide.gif/i,'show.gif');
+ this.viewbutton.childNodes[0].alt = this.viewbutton.childNodes[0].alt.replace(strhide, strshow);
+ this.viewbutton.title = this.viewbutton.title.replace(strhide, strshow);
if (!isCosmetic) {
main.connect('POST', 'class=block&field=visible', null,
commandContainer.removeChild(commandContainer.childNodes[i])
}
- if (!this.isWeekFormat) {
- var highlightbutton = main.mk_button('div', '/i/marker.gif');
+ if (!this.isWeekFormat) {
+ var highlightbutton = main.mk_button('div', '/i/marker.gif', main.getString('marker', this.sectionId));
YAHOO.util.Event.addListener(highlightbutton, 'click', this.mk_marker, this, true);
commandContainer.appendChild(highlightbutton);
- this.highlightButton = highlightbutton;
+ this.highlightButton = highlightbutton;
}
- var viewbutton = main.mk_button('div', '/i/hide.gif');
+ var viewbutton = main.mk_button('div', '/i/hide.gif', main.getString('hidesection', this.sectionId),
+ [['title', main.portal.strings['hide'] ]]);
YAHOO.util.Event.addListener(viewbutton, 'click', this.toggle_hide, this,true);
commandContainer.appendChild(viewbutton);
this.viewButton = viewbutton;
section_class.prototype.add_handle = function() {
- var handleRef = main.mk_button('a', '/i/move_2d.gif',
- [['style','cursor:move'], ['title', main.portal.strings['move']]]);
+ var handleRef = main.mk_button('a', '/i/move_2d.gif', main.getString('movesection', this.sectionId),
+ [['title', main.portal.strings['move'] ], ['style','cursor:move']]);
YAHOO.util.Dom.generateId(handleRef, 'sectionHandle');
section_class.prototype.toggle_hide = function(e,target,superficial) {
- if (this.hidden) {
+ var strhide = main.portal.strings['hide'];
+ var strshow = main.portal.strings['show'];
+ if (this.hidden) {
YAHOO.util.Dom.removeClass(this.getEl(), 'hidden');
- this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/show.gif/i, 'hide.gif');
+ this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/show.gif/i, 'hide.gif');
+ this.viewButton.childNodes[0].alt = this.viewButton.childNodes[0].alt.replace(strshow, strhide);
+ this.viewButton.title = this.viewButton.title.replace(strshow, strhide);
this.hidden = false;
if (!superficial) {
} else {
YAHOO.util.Dom.addClass(this.getEl(), 'hidden');
- this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/hide.gif/i, 'show.gif');
+ this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/hide.gif/i, 'show.gif');
+ this.viewButton.childNodes[0].alt = this.viewButton.childNodes[0].alt.replace(strhide, strshow);
+ this.viewButton.title = this.viewButton.title.replace(strhide, strshow);
this.hidden = true;
if (!superficial) {
commandContainer.innerHTML = '';
// Add move-handle for drag and drop.
- var handleRef = main.mk_button('a', '/i/move_2d.gif',
- [['style', 'cursor:move'], ['title', main.portal.strings['move']]],
+ var handleRef = main.mk_button('a', '/i/move_2d.gif', main.portal.strings['move'],
+ [['style', 'cursor:move']],
[['height', '11'], ['width', '11'], ['style', 'margin-right:3px; border:0;']]);
YAHOO.util.Dom.generateId(handleRef, 'sectionHandle');
// 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']],
- ['class', 'editing_moveleft']]);
+ var button = main.mk_button('a', '/t/left.gif', main.portal.strings['moveleft'],
+ [['class', 'editing_moveleft']]);
YAHOO.util.Event.addListener(button, 'click', this.indent_left, this, true);
commandContainer.appendChild(button);
this.indentLeftButton = button;
}
if (moveRight) {
- var button = main.mk_button('a', '/t/right.gif', [['title', main.portal.strings['moveright']],
- ['class', 'editing_moveright']]);
+ var button = main.mk_button('a', '/t/right.gif', main.portal.strings['moveright'],
+ [['class', 'editing_moveright']]);
YAHOO.util.Event.addListener(button, 'click', this.indent_right, this, true);
commandContainer.appendChild(button);
this.indentRightButton = button;
commandContainer.appendChild(updateButton);
// Add the delete button.
- var button = main.mk_button('a', '/t/delete.gif');
+ var button = main.mk_button('a', '/t/delete.gif', main.portal.strings['delete']);
YAHOO.util.Event.addListener(button, 'click', this.delete_button, this, true);
commandContainer.appendChild(button);
// Add the hide or show button.
if (this.hidden) {
- var button = main.mk_button('a', '/t/show.gif');
+ var button = main.mk_button('a', '/t/show.gif', main.portal.strings['show']);
} else {
- var button = main.mk_button('a', '/t/hide.gif');
+ var button = main.mk_button('a', '/t/hide.gif', main.portal.strings['hide']);
}
YAHOO.util.Event.addListener(button, 'click', this.toggle_hide, this, true);
commandContainer.appendChild(button);
// Add the groupmode button if needed.
if (this.groupmode != null) {
if (this.groupmode == this.NOGROUPS) {
- var button = main.mk_button('a', '/t/groupn.gif', [['title', strgroupsnone]]);
+ var button = main.mk_button('a', '/t/groupn.gif', strgroupsnone);
} else if (this.groupmode == this.SEPARATEGROUPS) {
- var button = main.mk_button('a', '/t/groups.gif', [['title', strgroupsseparate]]);
+ var button = main.mk_button('a', '/t/groups.gif', strgroupsseparate);
} else {
- var button = main.mk_button('a', '/t/groupv.gif', [['title', strgroupsvisible]]);
+ var button = main.mk_button('a', '/t/groupv.gif', strgroupsvisible);
}
YAHOO.util.Event.addListener(button, 'click', this.toggle_groupmode, this, true);
commandContainer.appendChild(button);
spacer.setAttribute('src', main.portal.strings['pixpath']+'/spacer.gif');
spacer.className = 'spacer';
+ spacer.setAttribute('alt', '');
spacer.setAttribute('width', '20');
spacer.setAttribute('height', '12');
'span', this.getEl())[0];
if (!this.indentLeftButton) {
- var button = main.mk_button('a', '/t/left.gif', [['title', main.portal.strings['moveleft']],
- ['class', 'editing_moveleft']]);
+ var button = main.mk_button('a', '/t/left.gif', main.portal.strings['moveleft'],
+ [['class', 'editing_moveleft']]);
YAHOO.util.Event.addListener(button, 'click', this.indent_left, this, true);
commandContainer.insertBefore(button, this.indentRightButton);
this.indentLeftButton = button;
resource_class.prototype.toggle_hide = function(target, e, superficial, force) {
+ var strhide = main.portal.strings['hide'];
+ var strshow = main.portal.strings['show'];
if (force != null) {
if (this.debug) {
YAHOO.log("Resource "+this.getEl().id+" forced to "+force);
if (this.hidden) {
YAHOO.util.Dom.removeClass(this.linkContainer, 'dimmed');
this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/show.gif/i, 'hide.gif');
+ this.viewButton.childNodes[0].alt = this.viewButton.childNodes[0].alt.replace(strshow, strhide);
+ this.viewButton.title = this.viewButton.title.replace(strshow, strhide);
this.hidden = false;
if (!superficial) {
} else {
YAHOO.util.Dom.addClass(this.linkContainer, 'dimmed');
this.viewButton.childNodes[0].src = this.viewButton.childNodes[0].src.replace(/hide.gif/i, 'show.gif');
+ this.viewButton.childNodes[0].alt = this.viewButton.childNodes[0].alt.replace(strhide, strshow);
+ this.viewButton.title = this.viewButton.title.replace(strhide, strshow);
this.hidden = true;
if (!superficial) {
this.groupmode = 0;
}
- var newtitle = this.groupButton.getElementsByTagName('img')[0].title;
+ var newtitle = this.groupButton.title;
switch (this.groupmode) {
case 0:
newtitle = main.portal.strings['groupsvisible']+' ('+main.portal.strings['clicktochange']+')';
break;
}
-
- this.groupButton.getElementsByTagName('img')[0].title = newtitle;
+
+ this.groupButton.getElementsByTagName('img')[0].alt = newtitle;
+ this.groupButton.title = newtitle;
this.groupButton.getElementsByTagName('img')[0].src = main.portal.strings['pixpath']+this.groupImages[this.groupmode];
main.connect('POST', 'class=resource&field=groupmode', null, 'value='+this.groupmode+'&id='+this.id);