mirror of
https://gitlab.com/Shinobi-Systems/ShinobiCE.git
synced 2025-03-09 15:40:15 +00:00
Blue Turtle - The Refactoring
This commit is contained in:
parent
04011678fb
commit
b7d08eb500
67 changed files with 11651 additions and 8452 deletions
|
@ -1,32 +1,18 @@
|
|||
<% include blocks/header %>
|
||||
<script>$user=<%-JSON.stringify($user)%></script>
|
||||
<style>
|
||||
.shinobi-bg {
|
||||
background: url(/libs/img/bg.jpg);
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
position: relative;
|
||||
}.shinobi-bg-shade {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background: rgba(0,0,0,0.5);
|
||||
}
|
||||
nav{margin-top:20px}
|
||||
</style>
|
||||
<link rel="stylesheet" href="<%-originalURL%>libs/css/pnotify.custom.min.css">
|
||||
<link rel="stylesheet" href="<%-originalURL%>libs/css/vbox.css">
|
||||
<link rel="stylesheet" href="<%-originalURL%>libs/css/circles.css">
|
||||
<link rel="stylesheet" href="<%-originalURL%>libs/css/admin-page.css">
|
||||
<link rel="stylesheet" href="<%-originalURL%>libs/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="<%-originalURL%>libs/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="<%-originalURL%>libs/css/fullcalendar.min.css">
|
||||
<link rel="stylesheet" href="<%-originalURL%>libs/css/bootstrap-table.min.css">
|
||||
<link rel="stylesheet" href="<%-originalURL%>libs/css/main.dash2.css">
|
||||
<body class="shinobi-bg">
|
||||
<div class="shinobi-bg-shade">
|
||||
<div class="container-fluid">
|
||||
<div class="container">
|
||||
<nav class="navbar navbar-default">
|
||||
<nav class="navbar navbar-default navbar-forestgreen">
|
||||
<div class="container-fluid">
|
||||
<!-- Brand and toggle get grouped for better mobile display -->
|
||||
<div class="navbar-header">
|
||||
|
@ -51,18 +37,18 @@
|
|||
</ul>
|
||||
</div><!-- /.container-fluid -->
|
||||
</nav>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group-group grey">
|
||||
<div class="form-group-group forestgreen">
|
||||
<h4>Sub-Accounts</h4>
|
||||
<table class="table table-striped" id="sub_accounts"></table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<form id="add_new">
|
||||
<div class="form-group-group grey">
|
||||
<div class="form-group-group forestgreen">
|
||||
<h4>Add<small id="msg" class="pull-right" style="color:#fff"></small></h4>
|
||||
<div class="form-group">
|
||||
<label><div><span>Email</span></div>
|
||||
|
@ -93,7 +79,6 @@
|
|||
</div>
|
||||
<% include blocks/confirm.ejs %>
|
||||
<% include blocks/subpermissions.ejs %>
|
||||
</div>
|
||||
</body>
|
||||
<script><% include ../libs/js/socket.io.js %></script>
|
||||
<script><% include ../libs/js/pnotify.custom.min.js %></script>
|
||||
|
@ -109,6 +94,7 @@ $.ccio.cx=function(x){if(!x.ke){x.ke=$user.ke;};if(!x.uid){x.uid=$user.uid;};ret
|
|||
$.ccio.ws.on('connect',function(d){
|
||||
$.ccio.cx({f:'init',auth:$user.auth_token});
|
||||
})
|
||||
PNotify.prototype.options.styling = "fontawesome";
|
||||
$.ccio.ws.on('f',function(d){
|
||||
console.log(d);
|
||||
switch(d.f){
|
||||
|
@ -117,13 +103,30 @@ $.ccio.ws.on('f',function(d){
|
|||
$.each(d.form,function(n,v){
|
||||
account[n]=v;
|
||||
});
|
||||
account.detailsJSON=JSON.parse(account.details);
|
||||
account.detailsJSON=JSON.parse(account.details)
|
||||
new PNotify({
|
||||
title : 'Account Edited',
|
||||
text : '<b>' + account.mail + '</b> has been updated.',
|
||||
type : 'success'
|
||||
})
|
||||
break;
|
||||
case'add_sub_account':
|
||||
$.ccio.tm(0,d,'#sub_accounts')
|
||||
var account = $.ccio.subs[d.uid]
|
||||
new PNotify({
|
||||
title : 'Account Added',
|
||||
text : '<b>' + account.mail + '</b> has been added.',
|
||||
type : 'success'
|
||||
})
|
||||
break;
|
||||
case'delete_sub_account':
|
||||
$('#sub_accounts tr[uid="'+d.uid+'"]').remove()
|
||||
var account = $.ccio.subs[d.uid]
|
||||
new PNotify({
|
||||
title : 'Account Deleted',
|
||||
text : '<b>' + account.mail + '</b> has been deleted.',
|
||||
type : 'info'
|
||||
})
|
||||
break;
|
||||
}
|
||||
})
|
||||
|
@ -146,30 +149,36 @@ $subs=<%-JSON.stringify($subs)%>;
|
|||
$.each($subs,function(n,v){
|
||||
$.ccio.tm(0,v,'#sub_accounts')
|
||||
})
|
||||
|
||||
|
||||
//add new
|
||||
$.aN={e:$('#add_new')};
|
||||
$.aN.e.submit(function(e){
|
||||
e.preventDefault();
|
||||
e.s=$.aN.e.serializeObject();e.m=$('#msg').empty()
|
||||
$.post($user.auth_token+'/register/'+$user.ke+'/'+$user.uid,e.s,function(d){
|
||||
e.s = $.aN.e.serializeObject()
|
||||
e.m = $('#msg').empty()
|
||||
$.post('<%=originalURL%><%=config.webPaths.adminApiPrefix%>'+$user.auth_token+'/accounts/'+$user.ke+'/register',{data:e.s},function(d){
|
||||
if(d.msg){
|
||||
e.m.text(d.msg)
|
||||
};
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//sub simple lister
|
||||
$.sU={e:$('#sub_accounts')};
|
||||
$.sU.e.on('click','.delete',function(e){
|
||||
e.e=$(this).parents('tr');e.m=e.e.find('.mail').text();e.u=e.e.attr('uid');
|
||||
$.confirm.e.modal('show');
|
||||
$.confirm.title.html('Delete Sub-Account <small>'+e.u+'</small>')
|
||||
e.html='Do you want to delete <b>'+e.m+'</b>? You cannot recover this account.'
|
||||
$.confirm.body.html(e.html)
|
||||
var el = $(this).parents('tr')
|
||||
var subAccountEmail = el.find('.mail').text()
|
||||
var subAccountUid = el.attr('uid')
|
||||
$.confirm.e.modal('show')
|
||||
$.confirm.title.html('Delete Sub-Account <small>'+subAccountUid+'</small>')
|
||||
var html = 'Do you want to delete <b>'+subAccountEmail+'</b>? You cannot recover this account.'
|
||||
$.confirm.body.html(html)
|
||||
$.confirm.click({title:'Delete',class:'btn-danger'},function(){
|
||||
$.ccio.cx({f:'accounts',ff:'delete',$uid:e.u,auth:$user.auth_token,mail:e.m})
|
||||
});
|
||||
$.post('<%=originalURL%><%=config.webPaths.adminApiPrefix%>'+$user.auth_token+'/accounts/'+$user.ke+'/delete',{
|
||||
uid: subAccountUid,
|
||||
mail: subAccountEmail
|
||||
},function(data){})
|
||||
})
|
||||
})
|
||||
$.sU.e.on('click','.permission',function(e){
|
||||
e.e=$(this).parents('tr');e.m=e.e.find('.mail').text();e.u=e.e.attr('uid');
|
||||
|
@ -235,15 +244,28 @@ $.pR.e.on('change','[monitor]',function(e){
|
|||
e.details.val(JSON.stringify(e.detail))
|
||||
});
|
||||
$.pR.f.submit(function(e){
|
||||
e.preventDefault();
|
||||
e.s=$(this).serializeObject()
|
||||
$.ccio.cx({f:'accounts',ff:'edit',$uid:$.pR.user,auth:$user.auth_token,mail:$.ccio.subs[$.pR.user].mail,form:e.s})
|
||||
$.pR.e.modal('hide')
|
||||
return false;
|
||||
e.preventDefault()
|
||||
var form = $(this).serializeObject()
|
||||
$.post('<%=originalURL%><%=config.webPaths.adminApiPrefix%>'+$user.auth_token+'/accounts/'+$user.ke+'/edit',{
|
||||
uid: $.pR.user,
|
||||
mail: $.ccio.subs[$.pR.user].mail,
|
||||
data: form
|
||||
},function(data){
|
||||
if(data.ok){
|
||||
$.pR.e.modal('hide')
|
||||
}else{
|
||||
new PNotify({
|
||||
title : 'Failed to Add Account',
|
||||
text : data.msg,
|
||||
type : 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
return false
|
||||
})
|
||||
|
||||
$('body')
|
||||
.on('click','.logout',function(e){
|
||||
localStorage.removeItem('ShinobiLogin_'+location.host);location.href=location.href;
|
||||
})
|
||||
</script>
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue