| 1 |
function get_parentid(arr, depth) |
| 2 |
{ |
| 3 |
for(var i=arr.length-1; i>=0; i--) |
| 4 |
{ |
| 5 |
if (arr[i]['depth'] == depth) return arr[i]['forumid']; |
| 6 |
} |
| 7 |
} |
| 8 |
|
| 9 |
function get_forums_hierarchy() |
| 10 |
{ |
| 11 |
|
| 12 |
var ul_content = document.getElementById('menu-to-edit'); |
| 13 |
var lis = ul_content.getElementsByTagName('LI'); |
| 14 |
|
| 15 |
var forums_hierarchy_arr = new Array(); |
| 16 |
|
| 17 |
for(var i = 0; i < lis.length; i++) |
| 18 |
{ |
| 19 |
forums_hierarchy_arr[i] = new Array(); |
| 20 |
forums_hierarchy_arr[i]['forumid'] = lis[i].id.replace('menu-item-', ''); |
| 21 |
var depth = lis[i].getAttribute('class').replace('menu-item menu-item-depth-', ''); |
| 22 |
|
| 23 |
forums_hierarchy_arr[i]['depth'] = depth; |
| 24 |
|
| 25 |
if(depth == 0) |
| 26 |
{ |
| 27 |
forums_hierarchy_arr[i]['parentid'] = 0; |
| 28 |
}else |
| 29 |
{ |
| 30 |
var previous_depth = depth - 1; |
| 31 |
forums_hierarchy_arr[i]['parentid'] = get_parentid(forums_hierarchy_arr, previous_depth); |
| 32 |
} |
| 33 |
|
| 34 |
forums_hierarchy_arr[i]['order'] = i + 1; |
| 35 |
|
| 36 |
var h_id = 'forumid-' + forums_hierarchy_arr[i]['forumid']; |
| 37 |
var h_parentid = 'parentid-' + forums_hierarchy_arr[i]['forumid']; |
| 38 |
var h_order = 'order-' + forums_hierarchy_arr[i]['forumid']; |
| 39 |
|
| 40 |
document.getElementById(h_id).value = forums_hierarchy_arr[i]['forumid']; |
| 41 |
document.getElementById(h_parentid).value = forums_hierarchy_arr[i]['parentid']; |
| 42 |
document.getElementById(h_order).value = forums_hierarchy_arr[i]['order']; |
| 43 |
|
| 44 |
} |
| 45 |
|
| 46 |
document.getElementById("forum-hierarchy").submit(); |
| 47 |
|
| 48 |
} |
| 49 |
|
| 50 |
function mode_changer(v){ |
| 51 |
|
| 52 |
if(v=='true'){ |
| 53 |
document.getElementById("forum_submit").value= wpforo_admin.phrases.move; |
| 54 |
document.getElementById("forum_select").disabled=false |
| 55 |
}else{ |
| 56 |
document.getElementById("forum_submit").value= wpforo_admin.phrases.delete; |
| 57 |
document.getElementById("forum_select").disabled=true |
| 58 |
} |
| 59 |
} |
| 60 |
function select_all(){ |
| 61 |
|
| 62 |
var sel_all = document.getElementById('cb-select-all-1'); |
| 63 |
|
| 64 |
if(sel_all.checked){ |
| 65 |
var table = document.getElementById('the-list'); |
| 66 |
var list=table.getElementsByTagName("INPUT"); |
| 67 |
|
| 68 |
for (var i=0; i<list.length; i++){ |
| 69 |
document.getElementById(list[i].id).checked=true |
| 70 |
} |
| 71 |
}else{ |
| 72 |
var table = document.getElementById('the-list'); |
| 73 |
var list=table.getElementsByTagName("INPUT"); |
| 74 |
|
| 75 |
for (var i=0; i<list.length; i++){ |
| 76 |
document.getElementById(list[i].id).checked=false |
| 77 |
} |
| 78 |
} |
| 79 |
} |
| 80 |
function costum_or_inherit(){ |
| 81 |
|
| 82 |
var chack = document.getElementById('custom'); |
| 83 |
|
| 84 |
if(chack.checked){ |
| 85 |
document.getElementById("permis").disabled=true; |
| 86 |
}else{ |
| 87 |
document.getElementById("permis").disabled=false; |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
function mode_changer_ug(v){ |
| 92 |
|
| 93 |
if(v=='true'){ |
| 94 |
document.getElementById("ug_select").disabled=false |
| 95 |
}else{ |
| 96 |
document.getElementById("ug_select").disabled=true |
| 97 |
} |
| 98 |
} |
| 99 |
|
| 100 |
|
| 101 |
|