Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Nov 8, 6:19 PM

in-portal

Index: trunk/kernel/admin_templates/incs/toolbar.js
===================================================================
--- trunk/kernel/admin_templates/incs/toolbar.js (revision 2478)
+++ trunk/kernel/admin_templates/incs/toolbar.js (revision 2479)
@@ -1,191 +1,197 @@
function ToolBarButton(title, alt, onclick)
{
this.Title = title || '';
this.CheckTitleModule();
this.Alt = RemoveTranslationLink(alt || '');
-
+
if (typeof(onclick) == 'function') {
this.onClick = onclick;
}
else {
this.onClick = function() {
if (eval('typeof('+this.Title+')') == 'function')
eval(this.Title + '()');
}
-
+
}
-
+
this.imgObject = null;
this.Enabled = true;
this.Hidden = false;
this.ToolBar = null;
}
ToolBarButton.prototype.CheckTitleModule = function()
{
if (this.Title.match(/([^:]+):(.*)$/)) {
this.Title = RegExp.$2;
this.Module = RegExp.$1 + '/';
}
else this.Module = '';
}
ToolBarButton.prototype.IconsPath = function()
{
if( !isset(img_path) ) alert('img path not set');
return img_path + this.Module + 'toolbar/';
}
ToolBarButton.prototype.GetHTML = function() {
return '<img id="tool_' + this.Title + '" src="' + this.IconsPath() + this.ToolBar.IconPrefix + this.Title + '.gif" title="' + this.Alt + '">';
}
ToolBarButton.prototype.Init = function() {
img = document.getElementById('tool_' + this.Title);
this.imgObject = img;
img.btn = this;
this.SetOnMouseOver();
this.SetOnMouseOut();
this.SetOnClick();
}
ToolBarButton.prototype.SetOnMouseOver = function() {
this.imgObject.onmouseover = function() {
- this.src = this.btn.IconsPath() + this.btn.ToolBar.IconPrefix + this.btn.Title + '_f2.gif';
+ this.src = this.btn.IconsPath() + this.btn.ToolBar.IconPrefix + this.btn.Title + '_f2.gif';
};
}
ToolBarButton.prototype.SetOnMouseOut = function() {
this.imgObject.onmouseout = function() {
- this.src = this.btn.IconsPath() + this.btn.ToolBar.IconPrefix + this.btn.Title + '.gif';
+ this.src = this.btn.IconsPath() + this.btn.ToolBar.IconPrefix + this.btn.Title + '.gif';
};
}
ToolBarButton.prototype.SetOnClick = function() {
this.imgObject.onmouseout = function() {
- this.src = this.btn.IconsPath() + this.btn.ToolBar.IconPrefix + this.btn.Title + '.gif';
+ this.src = this.btn.IconsPath() + this.btn.ToolBar.IconPrefix + this.btn.Title + '.gif';
};
this.imgObject.inClick = false;
if (typeof(this.onClick) != 'function') {
this.imgObject.onclick = function() {
if (this.inClick) return;
this.inClick = true;
if (eval('typeof('+this.btn.Title+')') == 'function')
eval(this.btn.Title + '()');
this.inClick = false;
}
}
else {
this.imgObject.onclick = function() {
if (this.inClick) return;
this.inClick = true;
this.btn.onClick();
this.inClick = false;
}
}
-
- // the following lines are correct, as long as mozilla understands 'pointer', but IE 'hand',
+
+ // the following lines are correct, as long as mozilla understands 'pointer', but IE 'hand',
// do not change the order of these lines!
- this.imgObject.style.cursor = 'pointer';
- this.imgObject.style.cursor = 'hand';
+ if (is.ie6up || is.gecko) {
+ this.imgObject.style.cursor = 'pointer';
+ this.imgObject.style.cursor = 'hand';
+ }
+ else {
+ // somehow set cursor hand for IE 5/ 5.5
+ //this.imgObject.style = 'cursor: hand';
+ }
}
ToolBarButton.prototype.Disable = function() {
if ( !this.Enabled ) return;
this.imgObject.src = this.IconsPath() + this.ToolBar.IconPrefix + this.Title + '_f3.gif';
this.imgObject.onmouseover = null;
this.imgObject.onmouseout = null;
this.imgObject.onclick = null;
this.imgObject.style.cursor = 'default';
this.Enabled = false;
-}
+}
ToolBarButton.prototype.Enable = function() {
if (this.Enabled) return;
this.imgObject.src = this.IconsPath() + this.ToolBar.IconPrefix + this.Title + '.gif';
this.SetOnMouseOver();
this.SetOnMouseOut();
this.SetOnClick();
this.Enabled = true;
-}
+}
ToolBarButton.prototype.Hide = function() {
this.imgObject.style.display = 'none';
this.Hidden = true;
-}
+}
ToolBarButton.prototype.Show = function() {
this.imgObject.style.display = '';
this.Hidden = false;
-}
+}
/* ----------- */
function ToolBarSeparator(title) //extends ToolBarButton
{
- this.Title = title;
+ this.Title = title;
}
ToolBarSeparator.prototype = new ToolBarButton;
ToolBarSeparator.prototype.GetHTML = function() {
return '<img id="tool_' + this.Title + '" src="' + this.IconsPath() + 'tool_divider.gif">';
}
ToolBarSeparator.prototype.Init = function() {
img = document.getElementById(this.ToolBar.IconPrefix + this.Title);
this.imgObject = img;
img.btn = this;
}
/* ----------- */
function ToolBar(icon_prefix)
{
- if (typeof(icon_prefix) == 'undefined')
+ if (typeof(icon_prefix) == 'undefined')
this.IconPrefix = 'tool_';
- else
+ else
this.IconPrefix = icon_prefix;
this.Buttons = new Array();
}
ToolBar.prototype.AddButton = function(a_button)
{
a_button.ToolBar = this;
this.Buttons[a_button.Title] = a_button;
}
ToolBar.prototype.Render = function()
{
for (var i in this.Buttons) {
btn = this.Buttons[i];
document.write( btn.GetHTML() );
btn.Init();
}
}
ToolBar.prototype.EnableButton = function(button_id) {
if(this.ButtonExists(button_id)) this.Buttons[button_id].Enable();
}
ToolBar.prototype.DisableButton = function(button_id) {
if(this.ButtonExists(button_id)) this.Buttons[button_id].Disable();
}
ToolBar.prototype.HideButton = function(button_id) {
if(this.ButtonExists(button_id)) this.Buttons[button_id].Hide();
}
ToolBar.prototype.ShowButton = function(button_id) {
if(this.ButtonExists(button_id)) this.Buttons[button_id].Show();
}
ToolBar.prototype.GetButtonImage = function(button_id) {
if( this.ButtonExists(button_id) ) return this.Buttons[button_id].imgObject;
}
ToolBar.prototype.ButtonExists = function(button_id) {
return typeof(this.Buttons[button_id]) == 'object';
}
Property changes on: trunk/kernel/admin_templates/incs/toolbar.js
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property

Event Timeline