1var TyCmsUser = new function(){ 2 var my_permissions = []; 3 var my_page_create_under = []; 4 var my_current_page_update = false; 5 6 this.init = function(){ 7 this.addEvent(); 8 if(load_permissions){ 9 this.updatePermissions(); 10 } 11 }; 12 13 this.updatePermissions = function(){ 14 var url = uri_ajax + 'ajax/get_my_permissions'; 15 $.ajax({ 16 type: 'post', 17 url : url, 18 data:{page_id: getCurrentPageID()}, 19 dataType : 'json', 20 success: function(json) { 21 my_permissions = json.permissions; 22 my_page_create_under = json.page_create_under; 23 my_page_create_under_recursive = json.page_create_under_recursive; 24 my_current_page_update = json.current_page_update; 25 // console.log("permission---"); 26 // console.log(json); 27 }, 28 error : function(jqXHR, textStatus, errorThrown) { 29 //showAlert(form, "ãã¼ããã·ã§ã³å徿ã«ã·ã¹ãã ã¨ã©ã¼ãçºçãã¾ããã"); 30 console.log($(jqXHR.responseText).text()); 31 }, 32 complete: function(XMLHttpRequest, textStatus){ 33 } 34 }); 35 } 36 37 this.hasAccessPageCreateUnder = function(dirname){ 38 var found = false; 39 if(this.hasAccess('page.create')){ 40 return true; 41 }else if(this.hasAccess('page.create-under')){ 42 $.each(my_page_create_under, function (index, d) { 43 if(dirname == d){ 44 found = true; 45 } 46 }); 47 } 48 return found; 49 } 50 51 this.hasAccessPageCreateUnderRecursive = function(fullpath, contain){// contain = true: create-under-recursiveã§æå®ãããã£ã¬ã¯ããªãå«ã 52 var found = false; 53 if(this.hasAccess('page.create')){ 54 return true; 55 }else if(this.hasAccess('page.create-under-recursive')){ 56 $.each(my_page_create_under_recursive, function (index, d) { 57 var dirs = fullpath.split('/'); 58 for(i=0;i<dirs.length;i++){ 59 var dir = dirs[i]; 60 //console.log("dir=" + dir + ",d=" + d, ",contain=" + contain); 61 if(dir && dir == d && (contain || i != dirs.length -2)){ 62 found = true; 63 break; 64 } 65 } 66 }); 67 } 68 return found; 69 } 70 71 this.hasAccessCurrentPageUpdate = function(){ 72 return my_current_page_update; 73 } 74 75 this.hasAccess = function(permission_str){ 76 var data = permission_str.split('.'); 77 if(data.length!=2){ 78 return false; 79 } 80 81 var permission = data[0]; 82 var sub_permission = data[1]; 83 var found = false; 84 85 $.each(my_permissions, function (p, sps) { 86 if(permission == p){ 87 $.each(sps, function (index, sp) { 88 89 if(sub_permission == sp){ 90 found = true; 91 return; 92 } 93 }); 94 } 95 }); 96 return found; 97 } 98 99 this.addEvent = function(){ 100 // Email validation for the new member entry. 101 $('.btn-email-validation').on('click', function(){ 102 showEmailValidationDialog(); 103 return false; 104 }); 105 106 $('body').on('click', '.send-email-validation', function(){ 107 sendEmailValidation(); 108 return false; 109 }); 110 111 // Withdraw from this site. 112 $('body').on('click', '.btn-withdraw', function(){ 113 showWithdrawDialog(); 114 return false; 115 }); 116 117 $('body').on('click', '#withdraw-dialog .withdraw', function(){ 118 var btn = $(this); 119 popoverConfirmation(btn, 'æ¬å½ã«éä¼ãã¦ããããã§ããï¼','top', 120 function(){ 121 destroyAllPopovers(); 122 withdraw(btn); 123 } 124 ); 125 return false; 126 }); 127 128 $('body').on('click', '#withdraw-dialog .ok', function(){ 129 var dialog = $(this).closest('.modal'); 130 dialog.modal('hide'); 131 return false; 132 }); 133 }; 134}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.