Index: trunk/kernel/admin_templates/incs/toolbar.js
===================================================================
diff -u -r5044 -r5057
--- trunk/kernel/admin_templates/incs/toolbar.js (.../toolbar.js) (revision 5044)
+++ trunk/kernel/admin_templates/incs/toolbar.js (.../toolbar.js) (revision 5057)
@@ -1,9 +1,9 @@
-function ToolBarButton(title, alt, onclick, $hidden)
+function ToolBarButton(title, alt, onclick, $hidden, prefix)
{
this.Title = title || '';
this.CheckTitleModule();
this.Alt = RemoveTranslationLink(alt || '');
-
+
if (typeof(onclick) == 'function') {
this.onClick = onclick;
}
@@ -19,6 +19,7 @@
this.Enabled = true;
this.Hidden = $hidden ? true : false;
this.ToolBar = null;
+ this.Prefix = prefix ? prefix : '';
}
ToolBarButton.prototype.CheckTitleModule = function()
@@ -40,19 +41,25 @@
}
ToolBarButton.prototype.GetHTML = function() {
- return '
';
+ return '
';
}
ToolBarButton.prototype.GetObject = function() {
var $img = document.createElement('IMG');
- $img.id = 'tool_' + this.Title;
+ $img.id = this.GetToolId();
$img.src = this.IconsPath() + this.ToolBar.IconPrefix + this.Title + '.gif';
$img.title = this.Alt;
return $img;
}
+ToolBarButton.prototype.GetToolId = function() {
+ return this.Prefix == '' ? 'tool_' + this.Title : 'tool_['+this.Prefix+'][' + this.Title+']'
+}
+
ToolBarButton.prototype.Init = function() {
- img = document.getElementById('tool_' + this.Title);
+
+ img = document.getElementById(this.GetToolId());
+
this.imgObject = img;
img.btn = this;
this.SetOnMouseOver();
@@ -187,9 +194,15 @@
ToolBar.prototype.Render = function($container)
{
if ($container) {
+ html = '';
for (var i in this.Buttons) {
btn = this.Buttons[i];
- $container.appendChild( btn.GetObject() );
+ html += btn.GetHTML();
+// appendChild( btn.GetObject() );
+ }
+ $container.innerHTML = html;
+ for (var i in this.Buttons) {
+ btn = this.Buttons[i];
btn.Init();
}
}