Ad Widget

Collapse

Open URL assigned to map elements

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Stefan Witzel
    Junior Member
    • Feb 2006
    • 7

    #1

    Open URL assigned to map elements

    Hi,

    when creating maps it's possible to assign an url to the map elements. Clicking on the map element the link is openend replacing the current zabbix map.

    I use this feature to point to a documentation site, so it would be nice, if there will be opened a new browser window or tab (HTML: target="_blank"), not replacing zabbix in the current window.

    Is this (already) possible?

    Thanks in advance.

    Stefan
  • shansylvia
    Junior Member
    • Jul 2012
    • 1

    #2
    Have you found an answer to this post?

    Hello Stefan,

    I was wondering if you had found a solution to opening a URL in the map to a new window? I am using Zabbix 2.0.1

    Thanks!
    Shannon

    Comment

    • generix
      Junior Member
      • Sep 2011
      • 9

      #3
      With the assigned changed in source code you could achieve this.

      [ZABBIX_WEBROOT]/js/menu.js line 451
      if(this.a_config[1] && (this.a_config[1].substr(0, 4)=='ext:')) {
      this.a_config[1] = this.a_config[1].substr(4);
      el.setAttribute('target', '_blank');
      }

      To open the links in a new tab/window just prefix your link with "ext:".

      Comment

      • Crypty
        Member
        • Jul 2012
        • 80

        #4
        Hi,

        the current configuration of Zabbix 2.4.0 is as follows:

        442 // url action
        443 else {
        444 if (!is_null(this.a_config[1]) && (this.a_config[1].indexOf('javascript') == -1)
        445 && !(!is_null(this.a_config[2]) || this.a_config[2] == 'nosid')) {
        446 var url = new Curl(this.a_config[1]);
        447 this.a_config[1] = url.getUrl();
        448 }
        449
        450 el.setAttribute('href', this.a_config[1]);
        451 if (this.a_config[2] && this.a_config[2]['tw']) {
        452 el.setAttribute('target', this.a_config[2]['tw']);
        453 }
        454 }

        How should I change it so I could use that "ext:" for opening it in the new window?

        Comment

        • generix
          Junior Member
          • Sep 2011
          • 9

          #5
          I think the syntax is still valid.
          I'd place my code fragment at line 449.

          As soon as I set up my Z2.4 I'll try this one out. But for now it's untested.

          Comment

          • Crypty
            Member
            • Jul 2012
            • 80

            #6
            I tried it somehow, but I haven't been successful...

            But added this to menupopup.js file:

            if (options.url.indexOf("http") === 0) {
            link.attr('target', '_blank');
            }

            I put it it after the line 1000... And it seems it's doing the job...

            Comment

            • generix
              Junior Member
              • Sep 2011
              • 9

              #7
              I'm fairly sure your code will open all links in a different tab/window. Not only the desired ones.
              But thanks for your answer.

              Comment

              Working...