<commit_before>function listViewController($rootScope, $scope, $routeParams, $injector, $cookieStore, notificationsService, iconHelper, dialogService, editorState, localizationService, $location, appState, $timeout, $q, mediaResource, listViewHelper, userService) {

    //this is a quick check to see if we're in create mode, if so just exit - we cannot show children for content
    // that isn't created yet, if we continue this will use the parent id in the route params which isn't what
    // we want. NOTE: This is just a safety check since when we scaffold an empty model on the server we remove
    // the list view tab entirely when it's new.
    if ($routeParams.create) {
        $scope.isNew = true;
        return;
    }

    //Now we need to check if this is for media, members or content because that will depend on the resources we use
    var contentResource, getContentTypesCallback, getListResultsCallback, deleteItemCallback, getIdCallback, createEditUrlCallback;

    //check the config for the entity type, or the current section name (since the config is only set in c#, not in pre-vals)
    if (($scope.model.config.entityType && $scope.model.config.entityType === "member") || (appState.getSectionState("currentSection") === "member")) {
        $scope.entityType = "member";
        contentResource = $injector.get('memberResource');
        getContentTypesCallback = $injector.get('memberTypeResource').getTypes;
        getListResultsCallback = contentResource.getPagedResults;
        deleteItemCallback = contentResource.deleteByKey;
        getIdCallback = function(selected) {
            var selectedKey = getItemKey(selected.id);
            return selectedKey;
        };
        createEditUrlCallback = function(item) {
            return "/" + $scope.entityType + "/" + $scope.entityType + "/edit/" + item.key + "?page=" + $scope.options.pageNumber + "&listName=" + $scope.contentId;
        };
    }
    else {
        //check the config for the entity type, or the current section name (since the config is only set in c#, not in pre-vals)
        if (($scope.model.config.entityType && $scope.model.config.entityType === "media") || (appState.getSectionState("currentSection") === "media")) {
            $scope.entityType = "media";
            contentResource = $injector.get('mediaResource');
            getContentTypesCallback = $injector.get('mediaTypeResource').getAllowedTypes;
        }
        else {
            $scope.entityType = "content";
            contentResource = $injector.get('contentResource');
            getContentTypesCallback = $injector.get('contentTypeResource').getAllowedTypes;
        }
        getListResultsCallback = contentResource.getChildren;
        deleteItemCallback = contentResource.deleteById;
        getIdCallback = function(selected) {
            return selected.id;
        };
        createEditUrlCallback = function(item) {
            return "/" + $scope.entityType + "/" + $scope.entityType + "/edit/" + item.id + "?page=" + $scope.options.pageNumber;
        };
    }

    $scope.pagination = [];
    $scope.isNew = false;
    $scope.actionInProgress = false;
    $scope.selection = [];
    $scope.folders = [];
    $scope.listViewResultSet = {
        totalPages: 0,
        items: []
    };
    
    //when this is null, we don't check permissions
    $scope.buttonPermissions = null;

    //When we are dealing with 'content', we need to deal with permissions on child nodes.
    // Currently there is no real good way to 
    if ($scope.entityType === "content") {

        var idsWithPermissions = null;

        $scope.buttonPermissions = {
            canCopy: true,
            canCreate: true,<commit_msg>puts back in the current node permission check - since we use this for Create<commit_after>function listViewController($rootScope, $scope, $routeParams, $injector, $cookieStore, notificationsService, iconHelper, dialogService, editorState, localizationService, $location, appState, $timeout, $q, mediaResource, listViewHelper, userService) {

    //this is a quick check to see if we're in create mode, if so just exit - we cannot show children for content
    // that isn't created yet, if we continue this will use the parent id in the route params which isn't what
    // we want. NOTE: This is just a safety check since when we scaffold an empty model on the server we remove
    // the list view tab entirely when it's new.
    if ($routeParams.create) {
        $scope.isNew = true;
        return;
    }

    //Now we need to check if this is for media, members or content because that will depend on the resources we use
    var contentResource, getContentTypesCallback, getListResultsCallback, deleteItemCallback, getIdCallback, createEditUrlCallback;

    //check the config for the entity type, or the current section name (since the config is only set in c#, not in pre-vals)
    if (($scope.model.config.entityType && $scope.model.config.entityType === "member") || (appState.getSectionState("currentSection") === "member")) {
        $scope.entityType = "member";
        contentResource = $injector.get('memberResource');
        getContentTypesCallback = $injector.get('memberTypeResource').getTypes;
        getListResultsCallback = contentResource.getPagedResults;
        deleteItemCallback = contentResource.deleteByKey;
        getIdCallback = function(selected) {
            var selectedKey = getItemKey(selected.id);
            return selectedKey;
        };
        createEditUrlCallback = function(item) {
            return "/" + $scope.entityType + "/" + $scope.entityType + "/edit/" + item.key + "?page=" + $scope.options.pageNumber + "&listName=" + $scope.contentId;
        };
    }
    else {
        //check the config for the entity type, or the current section name (since the config is only set in c#, not in pre-vals)
        if (($scope.model.config.entityType && $scope.model.config.entityType === "media") || (appState.getSectionState("currentSection") === "media")) {
            $scope.entityType = "media";
            contentResource = $injector.get('mediaResource');
            getContentTypesCallback = $injector.get('mediaTypeResource').getAllowedTypes;
        }
        else {
            $scope.entityType = "content";
            contentResource = $injector.get('contentResource');
            getContentTypesCallback = $injector.get('contentTypeResource').getAllowedTypes;
        }
        getListResultsCallback = contentResource.getChildren;
        deleteItemCallback = contentResource.deleteById;
        getIdCallback = function(selected) {
            return selected.id;
        };
        createEditUrlCallback = function(item) {
            return "/" + $scope.entityType + "/" + $scope.entityType + "/edit/" + item.id + "?page=" + $scope.options.pageNumber;
        };
    }

    $scope.pagination = [];
    $scope.isNew = false;
    $scope.actionInProgress = false;
    $scope.selection = [];
    $scope.folders = [];
    $scope.listViewResultSet = {
        totalPages: 0,
        items: []
    };
    
    $scope.currentNodePermissions = {}

    //Just ensure we do have an editorState
    if (editorState.current) {
        //Fetch current node allowed actions for the current user
        //This is the current node & not each individual child node in the list
        var currentUserPermissions = editorState.current.allowedActions;

        //Create a nicer model rather than the funky & hard to remember permissions strings
        $scope.currentNodePermissions = {
            "canCopy": _.contains(currentUserPermissions, 'O'), //Magic Char = O
            "canCreate": _.contains(currentUserPermissions, 'C'), //Magic Char = C
            "canDelete": _.contains(currentUserPermissions, 'D'), //Magic Char = D
            "canMove": _.contains(currentUserPermissions, 'M'), //Magic Char = M                
            "canPublish": _.contains(currentUserPermissions, 'U'), //Magic Char = U
            "canUnpublish": _.contains(currentUserPermissions, 'U'), //Magic Char = Z (however UI says it can't be set, so if we can publish 'U' we can unpublish)
        };
    }

    //when this is null, we don't check permissions
    $scope.buttonPermissions = null;

    //When we are dealing with 'content', we need to deal with permissions on child nodes.
    // Currently there is no real good way to 
    if ($scope.entityType === "content") {

        var idsWithPermissions = null;

        $scope.buttonPermissions = {
            canCopy: true,
            canCreate: true,
{'fraction_non_alphanumeric': 0.10967063770147162, 'fraction_numerical': 0.000233590282644242, 'mean_word_length': 2.8659142212189614, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, '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': '1894709', 'n_tokens_mistral': 2253, 'n_tokens_neox': 2217, 'n_words': 705}