title: jsTree: open "add folder" (or any right-click option) with modal
body: <p>I inherited a somewhat-spaghetti coded upload program, and it uses jsTree to list the files that were uploaded. When you right-click jsTree, you get an option box with some options (Upload File, Add Folder, Delete Folder, etc.) These lead to separate pages. I was wondering if it's possible that when you click those options, such as Add Folder, it would trigger a modal pop-up rather than go to a separate page?</p>
  
  <p>Here's the code I am trying to work with:</p>
  
  <pre><code>function buildTreeViewContextMenu(node)
  {
      var items = {};
      if ($(node).attr('id') == 'trash')
      {
          &lt;?php if($totalTrash &gt; 0): ?&gt;
          var items = {
              "Empty": {
                  "label": "&lt;?php echo t('empty_trash', 'Empty Trash'); ?&gt;",
                  "action": function(obj) {
                      confirmEmptyTrash();
                  }
              }
          };
          &lt;?php endif; ?&gt;
      }
      else if ($(node).attr('id') == '-1')
      {
          var items = {
              "Upload": {
                  "label": "&lt;?php echo t('upload_files', 'Upload Files'); ?&gt;",
                  "separator_after": true,
                  "action": function(obj) {
  
                      window.location='/';
                  }
              },
  
              "Add": {
                  "label": "&lt;?php echo t('add_folder', 'Add Folder'); ?&gt;",
                  "action": function(obj) {                       
                      window.location='/view/folder/add?p='+obj.attr("id"); // this part I want to convert to a modal
                  }
              }
          };
  
      }
  </code></pre>
  
  <p>And for example, here is the modal for "Add Folder":</p>
  
  <pre><code>&lt;div class="panel-body"&gt;
              &lt;!-- Modal --&gt;
              &lt;div class="modal fade" id="modalAddFolder" tabindex="-1" role="dialog" aria-labelledby="modalAddFolder" aria-hidden="true"&gt;
                      &lt;div class="modal-dialog"&gt;
                              &lt;div class="modal-content"&gt;
                                  &lt;div class="modal-header"&gt;
                                          &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
                                          &lt;h4 class="modal-title"&gt;Add Folder&lt;/h4&gt;
                                  &lt;/div&gt;
                                  &lt;div class="modal-body"&gt;
                                      &lt;?php require_once("folder/add.php"); ?&gt;
                                  &lt;/div&gt;
                          &lt;/div&gt;
                  &lt;/div&gt;
          &lt;/div&gt;
          &lt;!-- /Add Folder modal --&gt;
      &lt;/div&gt;
      &lt;!-- /modal --&gt;
  </code></pre>
  
  <p>I've tried working with <a href="https://stackoverflow.com/questions/12352929/open-a-jstree-in-a-jquery-dialog-box">this page</a> but have not been able to integrate it.</p>