<commit_before>{% load ndf_tags %}
{% load i18n %}

{% block head %}
  <link href="/static/ndf/bower_components/jqtree/jqtree.css" rel="stylesheet">
  <script src="/static/ndf/bower_components/jqtree/tree.jquery.js"></script> <!-- checked -->


  <script type="text/javascript">
    iconMapping = {
      'WARNING': 'fa-exclamation-circle',
      'COMPLETED': 'fa-check',
      'INPROGRESS': 'fa-clock-o',
      'PENDING': ''
    }


    $(document).ready(function() {
      {% check_is_gstaff groupid request.user as is_gstaff %}

      // Funtion for loading tree for showing collection list left side panel
      doc();

      // Function for manipulating tree when user visits to page directly via browser url
      TreeTillNode();
    });

    function TreeTillNode () {
      // This gives the last hierarchy node id from browser url.
      // var url = window.location.search.replace("?selected=", "")
      url = "{{selected}}";

      // Condition to check whether the tree has been loaded on the page completely or not before attempting any function on tree(such as 'getNodeById')
      if (url && $(".collection").not(".jqtree-loading").length > 0){
        var tree_build = $(".collection").not(".jqtree-loading");
        selected_node = tree_build.tree('getNodeById', url);
        tree_build.tree('selectNode', selected_node);
        return;
      }

      // Javascript function to be used for checking objects in specific time of interval
      setTimeout(function(){
        // console.log($(".collection"))
        if(url && ($(".collection").length > 0)) { TreeTillNode() }
        $(".jqtree-title-folder").addClass('jqtree-toggler').removeClass('jqtree-title').removeClass('jqtree-title-folder');}, 100 );
    }


    function doc(){
      cs_ids = []
      css_ids = []
      cu_ids = []
      cr_ids = []
      var $tree = $('.collection');
      var arr = [];
      {% get_node_type node as node_type %}

      var node_type = "{{node_type}}";

      $tree.tree({
        selectable: true,
        keyboardSupport: false,
        autoOpen: false,
        onCreateLi: function(node, $li) {
          if(node.node_type == "CourseSectionEvent"){
            cs_ids.push(node.id)
          }
          else if(node.node_type == "CourseSubSectionEvent"){
            css_ids.push(node.id)
          }
          $li.find('.jqtree-title').attr('data-id',node.id);
          if (node.node_type == "CourseUnitEvent"){
          // if (node.node_type == "Page" || node.node_type == "File"  || node.node_type == "QuizItemEvent" ) {
            cu_ids.push(node.id)
            if (node.collection_set.length > 0 ){
              cr_ids = cr_ids.concat(node.collection_set)
              $li.find('.jqtree-title').addClass('module-page');
              url = '/{{group_name_tag}}/gcourse/course_section/' + node.parent.id + '/' + node.id + '/' + node.collection_set[0]
              $li.find('.jqtree-title')<commit_msg>Additional validation for loading jQtree for<commit_after>{% load ndf_tags %}
{% load i18n %}

{% block head %}
  <link href="/static/ndf/bower_components/jqtree/jqtree.css" rel="stylesheet">
  <script src="/static/ndf/bower_components/jqtree/tree.jquery.js"></script> <!-- checked -->


  <script type="text/javascript">
    iconMapping = {
      'WARNING': 'fa-exclamation-circle',
      'COMPLETED': 'fa-check',
      'INPROGRESS': 'fa-clock-o',
      'PENDING': ''
    }


    $(document).ready(function() {
      {% check_is_gstaff groupid request.user as is_gstaff %}

      // Funtion for loading tree for showing collection list left side panel
      doc();

      // Function for manipulating tree when user visits to page directly via browser url
      TreeTillNode();
    });

    function TreeTillNode () {
      // This gives the last hierarchy node id from browser url.
      // var url = window.location.search.replace("?selected=", "")
      url = "{{selected}}";

      // Condition to check whether the tree has been loaded on the page completely or not before attempting any function on tree(such as 'getNodeById')
      if (url && $(".collection").not(".jqtree-loading").length > 0){
        var tree_build = $(".collection").not(".jqtree-loading");
        selected_node = tree_build.tree('getNodeById', url);
        tree_build.tree('selectNode', selected_node);
        return;
      }

      // Javascript function to be used for checking objects in specific time of interval
      setTimeout(function(){
        // console.log($(".collection"))
        if(url && ($(".collection").length > 0)) { TreeTillNode() }
        $(".jqtree-title-folder").addClass('jqtree-toggler').removeClass('jqtree-title').removeClass('jqtree-title-folder');}, 100 );
    }


    function doc(){
      cs_ids = []
      css_ids = []
      cu_ids = []
      cr_ids = []
      var $tree = $('.collection');
      var arr = [];
      {% get_node_type node as node_type %}

      var node_type = "{{node_type}}";

      $tree.tree({
        selectable: true,
        keyboardSupport: false,
        autoOpen: false,
        onCreateLi: function(node, $li) {
          if(node.node_type == "CourseSectionEvent"){
            cs_ids.push(node.id)
          }
          else if(node.node_type == "CourseSubSectionEvent"){
            css_ids.push(node.id)
          }
          $li.find('.jqtree-title').attr('data-id',node.id);
          if (node.node_type == "CourseUnitEvent"){
          // if (node.node_type == "Page" || node.node_type == "File"  || node.node_type == "QuizItemEvent" ) {
            cu_ids.push(node.id)
            if (node.collection_set && node.collection_set.length > 0 ){
              cr_ids = cr_ids.concat(node.collection_set)
              $li.find('.jqtree-title').addClass('module-page');
              url = '/{{group_name_tag}}/gcourse/course_section/' + node.parent.id + '/' + node.id + '/' + node.collection_set[0]
              $li.find('.jqtree-title')
{'fraction_non_alphanumeric': 0.15788584937521108, 'fraction_numerical': 0.00303951367781155, 'mean_word_length': 2.4902769593400116, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3436839', 'n_tokens_mistral': 1837, 'n_tokens_neox': 1745, 'n_words': 381}