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

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

XMLWordPrintable

    • 1.28

      Problems

      == Inline Script Block
      Line: 48
      ----
      <script>
                      hudsonRules["DIV.folders-tree"] = function(e) {
                          var tree = new YAHOO.widget.TreeView(e);
                          var rootNode = tree.getRoot();
      
                          var values = (e.getAttribute("values") || "").split(",");
      
                          function has(v) {
                              return values.includes(v) ? 'checked="true" ' : "";
                          }
                          var items = {};
      
                          <local:add-children parentNode="rootNode" items="${descriptor.getAvailableFolders(it.ownerItemGroup, it)}" 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: 48
      ----
      <script>
                      hudsonRules["DIV.folders-tree"] = function(e) {
                          var tree = new YAHOO.widget.TreeView(e);
                          var rootNode = tree.getRoot();
      
                          var values = (e.getAttribute("values") || "").split(",");
      
                          function has(v) {
                              return values.includes(v) ? 'checked="true" ' : "";
                          }
                          var items = {};
      
                          <local:add-children parentNode="rootNode" items="${descriptor.getAvailableFolders(it.ownerItemGroup, it)}" 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: