{% extends "data_edit.html" %} {% load i18n %} {% load iclock_tags %} {% block addjs %} $(function(){ $("#id_company").empty(); var pid=$("#id_company").val() var html=''; $("#id_company").parent().html(html) ic_permission=[] ic_ids=[]; ic_selected_ids=[]; ic_allowed_perm=[ " department ", " employee ", " device ", " transaction ", " administration log ", " command to device ", " data from device ", " device operation log ", " user "]; ic_allowed_perm_trans={ " department ": "{% trans ' department ' %}", " employee ": "{% trans ' employee ' %}", " device ": "{% trans ' device ' %}", " transaction ": "{% trans ' transaction ' %}", " administration log ": "{% trans ' administration log ' %}", " command to device ":"{% trans ' log of command to device ' %}", " data from device ":"{% trans ' log of data from device ' %}", " device operation log ": "{% trans ' device operation log ' %}", " user ": "{% trans 'User' %}" }; sec_perm=ic_allowed_perm; getInitData(); $("#id_permissions").parent().html("
" +''); $("#permBrowser").treeview(); $(".class_perm_parent").click(function(event){ if($(".class_perm_parent").attr("checked")) { $(".class_perm_sec").attr("checked","checked"); $(".class_permission").addClass("checked"); } else { $(".class_perm_sec").removeAttr("checked"); $(".class_permission").removeClass("checked"); } event.stopPropagation(); }); $(".class_perm_sec").click(function(event){ $(".class_perm_parent").removeAttr("checked"); selected_sec=$(this).attr("alt"); for(var i=0;i"+ic_permission.length+"\n"+ic_permission.join("\r\n")+""
return tree;
}
//权限翻译
var general_perm={
"Can add": "{% trans 'Add' %}",
"Can browse": "{% trans 'Browse' %}",
"Can change": "{% trans 'Modify' %}",
"Can delete": "{% trans 'Delete' %}"
};
var third_perm={
" employee ": {
'Delete employee from the device': "{% trans 'Delete employee from the device' %}",
'Employee leave': "{% trans 'Employee leave' %}",
'Move employee to a new device': "{% trans 'Move employee to a new device' %}",
"Change employee's department": "{% trans "Change employee's department" %}",
'Transfer to the device templately': "{% trans 'Transfer to the device templately' %}",
'Transfer employee to the device': "{% trans 'Transfer employee to the device' %}",
'DataBase': "{% trans 'DataBase' %}",
"Enroll employee's fingerprint": "{% trans "Enroll employee's fingerprint" %}"
},
" device ": {
'Clear data in device': "{% trans 'Clear data in device' %}",
'Clear transactions in device': "{% trans 'Clear transactions in device' %}",
'Clear all employee': "{% trans 'Clear all employee' %}",
'Copy data between device': "{% trans 'Copy data between device' %}",
'Set power suspend': "{% trans 'Set power suspend' %}",
'Refresh device information': "{% trans 'Refresh device information' %}",
'Upload new data': "{% trans 'Upload new data' %}",
'Pause device': "{% trans 'Pause device' %}",
'Reboot device': "{% trans 'Reboot device' %}",
'Upload data again': "{% trans 'Upload data again' %}",
'Upload transactions again': "{% trans 'Upload transactions again' %}",
'Reset Password in device': "{% trans 'Reset Password in device' %}",
'Restore employee to device': "{% trans 'Restore employee to device' %}",
'Resume a resumed device': "{% trans 'Resume a resumed device' %}",
'Output unlock signal': "{% trans 'Output unlock signal' %}",
'Terminate alarm signal': "{% trans 'Terminate alarm signal' %}",
'Upgrade firmware': "{% trans 'Upgrade firmware' %}",
'Set options of device': "{% trans 'Set options of device' %}",
'Upgrade by u-pack': "{% trans 'Upgrade by u-pack' %}",
'edit company': "{% trans 'Edit company' %}"
},
" transaction ":
{
'Clear Obsolete Data': "{% trans 'Clear Obsolete Data' %}",
'Init database': "{% trans 'Init database' %}"
},
" device operation log ":
{
'Transaction Monitor': "{% trans 'Transaction Monitor' %}"
},
" special leave ":
{
'Audit Sepcial Leave': "{% trans 'Audit Sepcial Leave' %}",
'operate Forget to clock in and out': "{% trans 'Forgetting to Clock in/out' %}",
'operate reports': "{% trans 'Reports' %}",
'ReCalculate Reports': "{% trans 'ReCalculate Reports' %}"
},
" shift ":
{
'Add time-table': "{% trans 'Add time-table' %}",
'Delete time-table': "{% trans 'Delete time-table' %}"
}
}
function getTransText(table, permName)
{
for(n in general_perm)
if(permName.indexOf(n)==1)
return general_perm[n];
if(table in third_perm)
{
var perms=third_perm[table];
for(n in perms) if(permName.indexOf(n)==1) return perms[n];
}
return permName;
}
function getTreeString(sec_str,index)
{
var tree_sub="