<commit_before>$(document).ready(function () {

/**
 * easyui tree extend for 'unselect' event
 * @author <NAME>
 * @since 04/04/2016
 */
$.extend($.fn.tree.methods,{
    unselect:function(jq,target){
        return jq.each(function(){
            var opts = $(this).tree('options');
            $(target).removeClass('tree-node-selected');
            if (opts.onUnselect){
                    opts.onUnselect.call(this, $(this).tree('getNode',target));
            }
        });
    }
});
     
/**
 * multilanguage plugin 
 * @type Lang
 */
var lang = new Lang();
lang.dynamic($('#ln').val(), '/plugins/jquery-lang-js-master/langpack/'+$('#ln').val()+'.json');
lang.init({
    defaultLang: 'en'
});
lang.change($('#ln').val());
    
/**
 * !! Important , do not delete
 * @type node
 */
var selectedNode;
    
/**
 * loader image for resource and rol tree loading process
 * @type @call;$@call;loadImager
 * @author <NAME>
 * @since 15/07/2016
 */
var loader_resource = $("#loading-image-resource").loadImager();

var sm  = $(window).successMessage();
var dm  = $(window).dangerMessage();
var wm  = $(window).warningMessage();
var wcm = $(window).warningComplexMessage({ denyButtonLabel : 'Vazgeç' ,
                                           actionButtonLabel : 'İşleme devam et'});
    
/*
* 
* ACL resource and rol tree
* <NAME>
* 15/07/2016
*/
$('#tt_tree_menu2').tree({  
   url: 'https://proxy.sanalfabrika.com/SlimProxyBoot.php?url=pkFillResourceGroups_sysAclResources&pk=' + $("#pk").val()+ '&language_code='+$("#langCode").val(),
   method: 'get',
   animate: true,
   checkbox: false,
   cascadeCheck: false,
   lines: true,
   onLoadSuccess: function (node, data) {
        loader_resource.loadImager('removeLoadImage');
   },
   onClick: function (node) {
        selectedRoot = $(this).tree('getRoot', node.target);
        selectedItem = $(this).tree('getData', node.target);
    },
   onSelect : function(node) {
       var self = $(this);
       var tagBuilderNot;
       var tagBuilder = $('#test-cabin').tagCabin({
                tagCopy         : false,
                tagDeletable    : true,
                tagDeletableAll : false, 
                tagBox          : $('.tag-container').find('ul'),
                dataMapper      : {attributes : Array('role_id', 'resource_id', 'privilege_id')}

        }); 
        tagBuilder.tagCabin({
            onTagRemoved : function(event, data) {
                var self = $(this);
                var elementData = data.element;
                //console.log(elementData);
                var id = data.id;
                //self.tagCabin()
                window.deleteRolePrivilege(id, elementData, tagBuilderNot);

            }
        });
        
        
        tagBuilderNot = $('#test-cabin-not').tagCabin({
                tagCopy         : true,
                tagDeletable    : false,
                tagDeletableAll : false, 
                tagBox          : $('.tag-container-not').find('ul'),
                dataMapper      : {attributes : Array('role_id', 'resource_id', 'privilege_id')}

        });
        tagBuilderNot.tagCabin({
            onTagCopied : function(event, data) {
                var self = $(this);
                window.assignRolePrivilege(data.id, data.element, tagBuilder);
            }
        });
        
        
        if(!self.tree('isLeaf', node.target)) {
            wm.warningMessage( {
                onShown : function (event ,data ) {
                   self.tree('uncheck', node.target); 
                }
            });
            wm.warningMessage('show','ACL Rol Seçiniz',
                                     'ACL resource (kaynak) seçtiniz, Lütfen rol seçiniz...');

        } else {
            window.clearRolePrivilege(node, tagBuilder);
            window.getRolePrivileges(node, self, tagBuilder);
            window.clearRolePrivilege(node, tagBuilderNot);
            window.getRolePrivilegesNotAssigned(node, self, tagBuilderNot);
        }
        
   },
});

/**
 * assign privilege to role
 * @param {type} nodeID
 * @param {type} nodeName
 * @returns {undefined}
 * @author <NAME>
 * @since 15/07/2016
 */
window.assignRolePrivilege = function (property_id, tag, tagBuilder) {
    var tag = tag;
    var tagBuilder = tagBuilder;
    var loader = $("#rolePrivilegeBlock").loadImager();
    loader.loadImager('appendImage');
    
    console.log(tag.attr('data-attribute'));
    console.log(tag.text());
    console.log(tag.attr('data-resource_id'));
    console.log(tag.attr('data-privilege_id'));
    console.log(tag.attr('data-role_id'));
    var role_id = tag.attr('data-role_id');
    var privilege_id = tag.attr('data-privilege_id');
    var resource_id = tag.attr('data-resource_id');

    var aj = $(window).ajaxCall({
         proxy : 'https://proxy.sanalfabrika.com/SlimProxyBoot.php',   
         data : {
             url:'pkTransferRolesPrivilege_sysAclRrp' ,
             role_id : role_id,
             resource_id : resource_id,
             privilege_id : privilege_id,
             pk : $("#pk").val()
         }
    })
    aj.ajaxCall ({  
          onError : function (event, textStatus, errorThrown) {   
              dm.dangerMessage('resetOnShown');
              dm.dangerMessage('show', 'Tanımlanmış Özellik Ekleme İşlemi Başarısız...', 
                                       'Tanımlanmış Özellik ekleme işlemi başarısız, sistem yöneticisi ile temasa geçiniz... ')
              console.error('"pkTransferPropertyMachineGroup_sysMachineToolPropertyDefinition" servis hatası->'+textStatus);
          },
          onSuccess : function (event, data) {
              var data = data;
              console.log(data);
              console.warn(data.lastInsertId);
              var id = data.lastInsertId;
             tagBuilder.tagCabin('addTagManuallyDataAttr', id, 
                                                            tag.text(),
                                                            {role_id : role_id,
                                                             resource_id : resource_id,
                                                             privilege_id : privilege_id });<commit_msg>Js console kodları silindi<commit_after>$(document).ready(function () {

/**
 * easyui tree extend for 'unselect' event
 * @author <NAME>
 * @since 04/04/2016
 */
$.extend($.fn.tree.methods,{
    unselect:function(jq,target){
        return jq.each(function(){
            var opts = $(this).tree('options');
            $(target).removeClass('tree-node-selected');
            if (opts.onUnselect){
                    opts.onUnselect.call(this, $(this).tree('getNode',target));
            }
        });
    }
});
     
/**
 * multilanguage plugin 
 * @type Lang
 */
var lang = new Lang();
lang.dynamic($('#ln').val(), '/plugins/jquery-lang-js-master/langpack/'+$('#ln').val()+'.json');
lang.init({
    defaultLang: 'en'
});
lang.change($('#ln').val());
    
/**
 * !! Important , do not delete
 * @type node
 */
var selectedNode;
    
/**
 * loader image for resource and rol tree loading process
 * @type @call;$@call;loadImager
 * @author <NAME>
 * @since 15/07/2016
 */
var loader_resource = $("#loading-image-resource").loadImager();

var sm  = $(window).successMessage();
var dm  = $(window).dangerMessage();
var wm  = $(window).warningMessage();
var wcm = $(window).warningComplexMessage({ denyButtonLabel : 'Vazgeç' ,
                                           actionButtonLabel : 'İşleme devam et'});
    
/*
* 
* ACL resource and rol tree
* <NAME>
* 15/07/2016
*/
$('#tt_tree_menu2').tree({  
   url: 'https://proxy.sanalfabrika.com/SlimProxyBoot.php?url=pkFillResourceGroups_sysAclResources&pk=' + $("#pk").val()+ '&language_code='+$("#langCode").val(),
   method: 'get',
   animate: true,
   checkbox: false,
   cascadeCheck: false,
   lines: true,
   onLoadSuccess: function (node, data) {
        loader_resource.loadImager('removeLoadImage');
   },
   onClick: function (node) {
        selectedRoot = $(this).tree('getRoot', node.target);
        selectedItem = $(this).tree('getData', node.target);
    },
   onSelect : function(node) {
       var self = $(this);
       var tagBuilderNot;
       var tagBuilder = $('#test-cabin').tagCabin({
                tagCopy         : false,
                tagDeletable    : true,
                tagDeletableAll : false, 
                tagBox          : $('.tag-container').find('ul'),
                dataMapper      : {attributes : Array('role_id', 'resource_id', 'privilege_id')}

        }); 
        tagBuilder.tagCabin({
            onTagRemoved : function(event, data) {
                var self = $(this);
                var elementData = data.element;
                //console.log(elementData);
                var id = data.id;
                //self.tagCabin()
                window.deleteRolePrivilege(id, elementData, tagBuilderNot);

            }
        });
        
        
        tagBuilderNot = $('#test-cabin-not').tagCabin({
                tagCopy         : true,
                tagDeletable    : false,
                tagDeletableAll : false, 
                tagBox          : $('.tag-container-not').find('ul'),
                dataMapper      : {attributes : Array('role_id', 'resource_id', 'privilege_id')}

        });
        tagBuilderNot.tagCabin({
            onTagCopied : function(event, data) {
                var self = $(this);
                window.assignRolePrivilege(data.id, data.element, tagBuilder);
            }
        });
        
        
        if(!self.tree('isLeaf', node.target)) {
            wm.warningMessage( {
                onShown : function (event ,data ) {
                   self.tree('uncheck', node.target); 
                }
            });
            wm.warningMessage('show','ACL Rol Seçiniz',
                                     'ACL resource (kaynak) seçtiniz, Lütfen rol seçiniz...');

        } else {
            window.clearRolePrivilege(node, tagBuilder);
            window.getRolePrivileges(node, self, tagBuilder);
            window.clearRolePrivilege(node, tagBuilderNot);
            window.getRolePrivilegesNotAssigned(node, self, tagBuilderNot);
        }
        
   },
});

/**
 * assign privilege to role
 * @param {type} nodeID
 * @param {type} nodeName
 * @returns {undefined}
 * @author <NAME>
 * @since 15/07/2016
 */
window.assignRolePrivilege = function (property_id, tag, tagBuilder) {
    var tag = tag;
    var tagBuilder = tagBuilder;
    var loader = $("#rolePrivilegeBlock").loadImager();
    loader.loadImager('appendImage');
    
    console.log(tag.attr('data-attribute'));
    console.log(tag.text());
    console.log(tag.attr('data-resource_id'));
    console.log(tag.attr('data-privilege_id'));
    console.log(tag.attr('data-role_id'));
    var role_id = tag.attr('data-role_id');
    var privilege_id = tag.attr('data-privilege_id');
    var resource_id = tag.attr('data-resource_id');

    var aj = $(window).ajaxCall({
         proxy : 'https://proxy.sanalfabrika.com/SlimProxyBoot.php',   
         data : {
             url:'pkTransferRolesPrivilege_sysAclRrp' ,
             role_id : role_id,
             resource_id : resource_id,
             privilege_id : privilege_id,
             pk : $("#pk").val()
         }
    })
    aj.ajaxCall ({  
          onError : function (event, textStatus, errorThrown) {   
              dm.dangerMessage('resetOnShown');
              dm.dangerMessage('show', 'Tanımlanmış Özellik Ekleme İşlemi Başarısız...', 
                                       'Tanımlanmış Özellik ekleme işlemi başarısız, sistem yöneticisi ile temasa geçiniz... ')
              console.error('"pkTransferPropertyMachineGroup_sysMachineToolPropertyDefinition" servis hatası->'+textStatus);
          },
          onSuccess : function (event, data) {
              var data = data;
              var id = data.lastInsertId;
             tagBuilder.tagCabin('addTagManuallyDataAttr', id, 
                                                            tag.text(),
                                                            {role_id : role_id,
                                                             resource_id : resource_id,
                                                             privilege_id : privilege_id });
{'fraction_non_alphanumeric': 0.1409079834321449, 'fraction_numerical': 0.005360188418744417, 'mean_word_length': 1.8643870667597116, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2637847', 'n_tokens_mistral': 3686, 'n_tokens_neox': 3509, 'n_words': 641}