Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/toolbar.js =================================================================== diff -u -r7283 -r7502 --- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/toolbar.js (.../toolbar.js) (revision 7283) +++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/toolbar.js (.../toolbar.js) (revision 7502) @@ -1,8 +1,13 @@ function ToolBarButton(title, alt, onclick, $hidden, prefix) { this.Title = title || ''; + this.TranslateLink = false; this.CheckTitleModule(); this.Alt = RemoveTranslationLink(alt || ''); + if (this.Alt != alt) { + this.TranslateLink = alt || ''; + this.TranslateLink = this.TranslateLink.replace(/<a href="(.*?)">(.*?)<\/a>/g, '$1'); + } if (this.Alt.match(/(.*)::(.*)/)) { this.Alt = RegExp.$1; @@ -78,7 +83,9 @@ this.SetOnMouseOver(); this.SetOnMouseOut(); this.SetOnClick(); + this.SetOnRightClick() if (this.Hidden) this.Hide(); + if (!img.complete) { var real_path = img_path.replace('#MODULE#', this.Module) + 'toolbar/'; var old_path = img_path.replace('#MODULE#', 'kernel') + 'toolbar/'+this.ToolBar.IconPrefix + this.Title+'.gif'; @@ -92,6 +99,36 @@ // preg_print_pre(img, /natural|compl/i) } +ToolBarButton.prototype.EditTitle = function() { + if (this.TranslateLink !== false) { + var $links = this.TranslateLink; + + $links = $links.split('::'); + var $i = 0; + while ($i < $links.length) { + var $link = $links[$i]; + if ($link.match(/(javascript:|http:\/\/)(.*)/)) { + var $link_type = RegExp.$1; + $link = RegExp.$2.replace(/'/g, '"'); + if ($link_type == 'javascript:') { + eval($link); + } + else { + window.location.href = 'http://' + $link; + } + + // edit one phrase at a time + break; + } + $i++; + } + + return false; + } + + return true; +} + ToolBarButton.prototype.SetOnMouseOver = function() { this.Container.onmouseover = function() { this.btn.imgObject.src = this.btn.IconsPath() + this.btn.ToolBar.IconPrefix + this.btn.Title + '_f2.gif'; @@ -141,6 +178,13 @@ } } +ToolBarButton.prototype.SetOnRightClick = function() { + this.Container.oncontextmenu = function() { + return this.btn.EditTitle(); + } +} + + ToolBarButton.prototype.Disable = function() { if ( !this.Enabled ) return; this.imgObject.src = this.IconsPath() + this.ToolBar.IconPrefix + this.Title + '_f3.gif';