Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-74129

[sectioned-view] Extract inline script blocks in hudson/plugins/sectioned_view/ViewListingSection/config.jelly

XMLWordPrintable

    • 1.28

      Problems

      == Inline Script Block
      Line: 44
      ----
      <script>
              hudsonRules["DIV.views-tree"] = function(e) {
                var tree = new YAHOO.widget.TreeView(e);
                var root = tree.getRoot();
      
                var values = (e.getAttribute("values") || "").split(",");
                function has(v) {
                  return values.includes(v) ? 'checked="checked" ' : "";
                }
                var views = {};
                <local:add-children parentView="root" views="${it.owner.views}" prefix=""/>
      
                tree.draw();
                <!--
                  force the rendering of HTML, so that input fields are there
                  even when the form is submitted without this tree expanded.
                -->
                tree.expandAll();
                tree.collapseAll();
      
                <!--
                  cancel the event.
      
                  from http://yuilibrary.com/forum/viewtopic.php?f=89&t=8209&p=26239&hilit=HTMLNode#p26239
                  "To prevent toggling and allow the link to work, add a listener to the clickEvent on that tree and simply return false"
                -->
                tree.subscribe("clickEvent", function(node) {
                    return false;
                });
              };
            </script>
      ----
      
      == Inline Script Block
      Line: 44
      ----
      <script>
              hudsonRules["DIV.views-tree"] = function(e) {
                var tree = new YAHOO.widget.TreeView(e);
                var root = tree.getRoot();
      
                var values = (e.getAttribute("values") || "").split(",");
                function has(v) {
                  return values.includes(v) ? 'checked="checked" ' : "";
                }
                var views = {};
                <local:add-children parentView="root" views="${it.owner.views}" prefix=""/>
      
                tree.draw();
                <!--
                  force the rendering of HTML, so that input fields are there
                  even when the form is submitted without this tree expanded.
                -->
                tree.expandAll();
                tree.collapseAll();
      
                <!--
                  cancel the event.
      
                  from http://yuilibrary.com/forum/viewtopic.php?f=89&t=8209&p=26239&hilit=HTMLNode#p26239
                  "To prevent toggling and allow the link to work, add a listener to the clickEvent on that tree and simply return false"
                -->
                tree.subscribe("clickEvent", function(node) {
                    return false;
                });
              };
            </script>
      ----
      

      Solution

      https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks

            mawinter69 Markus Winter
            basil Basil Crow
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: