This repository has been archived by the owner on Apr 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
MrCrankHank
committed
Sep 17, 2015
1 parent
434c1f6
commit 77fb83d
Showing
11 changed files
with
387 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: alexander.hank | ||
* Date: 28.08.2015 | ||
* Time: 19:43 | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: alexander.hank | ||
* Date: 29.08.2015 | ||
* Time: 14:49 | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: alexander.hank | ||
* Date: 30.08.2015 | ||
* Time: 19:02 | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<div class="workspacedirect"> | ||
<div class="container"> | ||
<div class="panel panel-default"> | ||
<ol class='panel-heading breadcrumb'> | ||
<li><a href='#'>Targets</a></li> | ||
<li><a href='#'>Configure</a></li> | ||
<li class='active'>Add user</li> | ||
</ol> | ||
|
||
<div class="panel-body"> | ||
<button id="adduserbutton" class="btn btn-success"><span class="glyphicon glyphicon-plus"></span> Add</button> | ||
|
||
<div class="btn-group" data-toggle="buttons"> | ||
<label class="btn btn-default active"> | ||
<input type="Radio" id="addusertypeincomingcheckbox" name="type" value="Incoming" checked="checked"> Incoming | ||
</label> | ||
<label class="btn btn-default"> | ||
<input id="addusertypeoutgoingcheckbox" type="Radio" name="type" value="Outgoing"> Outgoing | ||
</label> | ||
</div> | ||
</div> | ||
<div class="table-responsive"> | ||
<table id="addusertable" class="table table-striped searchabletable"> | ||
<thead> | ||
<tr> | ||
<th class="col-md-1"><span class="glyphicon glyphicon glyphicon-ok green glyphicon-20"></span> | ||
</th> | ||
<th class="col-md-11">Username</th> | ||
</tr> | ||
</thead> | ||
<?php if (is_array($data['user'])) { ?> | ||
<tbody id="addusertablebody"> | ||
<?php foreach ($data['user'] as $row) { ?> | ||
<tr> | ||
<td hidden class="userid"><?php echo htmlspecialchars($row['id']); ?></td> | ||
<td class="col-md-1"><input class="addusercheckbox" type="checkbox"></td> | ||
<td class="col-md-11"><?php echo htmlspecialchars($row['username']); ?></td> | ||
</tr> | ||
<?php } ?> | ||
</tbody> | ||
<?php } ?> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
require(['common'], function () { | ||
require(['pages/adduser'], function (methods) { | ||
methods.add_event_handler_adduserbutton(); | ||
methods.enable_filter_table_plugin(); | ||
}); | ||
}); | ||
</script> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
define(['jquery', 'mylibs', 'sweetalert'], function ($, mylibs, swal) { | ||
var methods; | ||
|
||
return methods = { | ||
enable_filter_table_plugin: function() { | ||
$(document).ready(function(){ | ||
// Enable filter table plugin | ||
$('.searchabletable').filterTable({minRows:0}); | ||
}); | ||
}, | ||
add_event_handler_adduserbutton: function () { | ||
$(document).ready(function () { | ||
$(document).once('click', '#adduserbutton', function () { | ||
var selector_targetselection = $('#targetselection'); | ||
var iqn = selector_targetselection.find("option:selected").val(); | ||
var defaultvalue = selector_targetselection.find('#default').val(); | ||
|
||
if (iqn == defaultvalue) { | ||
swal({ | ||
title: 'Error', | ||
type: 'error', | ||
text: 'Please select a iqn!' | ||
}); | ||
} else if (!$(".addusercheckbox:checked").val()) { | ||
swal({ | ||
title: 'Error', | ||
type: 'error', | ||
text: 'Please select a user!' | ||
}); | ||
} else { | ||
// Select radio | ||
var type = $("input[name='type']:checked").val(); | ||
|
||
// loop through checkboxes | ||
$(".addusercheckbox:checked").each(function () { | ||
var $this = $(this); | ||
var id = $this.closest('tr').find('.userid').text(); | ||
|
||
var data = { | ||
"iqn": iqn, | ||
"type": type, | ||
"id": id | ||
}; | ||
|
||
var request = mylibs.doajax("/phpietadmin/permission/adduser", data); | ||
|
||
request.done(function () { | ||
if (request.readyState == 4 && request.status == 200) { | ||
if (request.responseText == "Success") { | ||
// uncheck all the checkbox | ||
$this.removeAttr('checked'); | ||
|
||
swal({ | ||
title: 'Success', | ||
type: 'success' | ||
}); | ||
} else { | ||
swal({ | ||
title: 'Error', | ||
type: 'error', | ||
text: request.responseText | ||
}); | ||
} | ||
mylibs.loadconfiguretargetbody('/phpietadmin/permission/adduser', iqn); | ||
} | ||
}); | ||
}); | ||
|
||
} | ||
}); | ||
}); | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
define(['jquery', 'mylibs', 'sweetalert'], function($, mylibs, swal) { | ||
var Methods; | ||
return Methods = { | ||
add_event_handler_deletelunbutton: function() { | ||
$(document).ready(function(){ | ||
$(document).once('click', '#deletelunbutton', function() { | ||
var deletelunlunselection = $('#deletelunlunselection'); | ||
var iqn = $('#targetselection').find("option:selected").val(); | ||
|
||
var data = { | ||
"iqn": iqn, | ||
"lun": deletelunlunselection.find('option:selected').val(), | ||
"path": deletelunlunselection.find('option:selected').attr('name') | ||
}; | ||
|
||
var request = mylibs.doajax("/phpietadmin/targets/deletelun", data); | ||
|
||
request.done(function () { | ||
if (request.readyState == 4 && request.status == 200) { | ||
if (request.responseText == "Success") { | ||
swal({ | ||
title: 'Success', | ||
type: 'success' | ||
}, | ||
function () { | ||
// remove selected element | ||
deletelunlunselection.find('option:selected').remove(); | ||
|
||
if((deletelunlunselection.has('option').length) == 0) { | ||
$('#configuretargetbody').replaceWith('<div id="configuretargetbody">' + | ||
'<div class = "container">' + | ||
'<div class="alert alert-danger" role="alert"><h3 align="center">Error - No luns available</h3></div>' + | ||
'</div>' + | ||
'</div>') | ||
} | ||
}); | ||
} else { | ||
swal({ | ||
title: 'Error', | ||
type: 'error', | ||
text: request.responseText | ||
}); | ||
} | ||
|
||
} | ||
}) | ||
}); | ||
}); | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
define(['jquery', 'mylibs', 'sweetalert', 'qtip'], function($, mylibs, swal, qtip) { | ||
var methods; | ||
|
||
return methods = { | ||
add_qtip_sessiondeletebutton: function() { | ||
$(document).ready(function(){ | ||
$('.sessiondeletebutton').qtip({ | ||
content: { | ||
text: 'Normally the initiator immediately reconnects. ' + | ||
'To disconnect an initiator permanently you have to deleted the acl allowing the connection ' + | ||
'before deleting the session.' | ||
}, | ||
style: { | ||
classes: 'qtip-youtube' | ||
} | ||
}); | ||
}); | ||
}, | ||
add_event_handler_sessiondeletebutton: function() { | ||
$(document).ready(function(){ | ||
$(document).once('click', '.sessiondeletebutton', function() { | ||
var data = { | ||
iqn: $('#targetselection').find("option:selected").val(), | ||
cid: $(this).closest('tr').find('.cid').text(), | ||
sid: $(this).closest('tr').find('.sid').text() | ||
}; | ||
|
||
var request = mylibs.doajax('/phpietadmin/targets/deletesession', data); | ||
|
||
request.done(function () { | ||
if (request.readyState == 4 && request.status == 200) { | ||
if (request.responseText == "Success") { | ||
swal({ | ||
title: 'Success', | ||
type: 'success' | ||
}); | ||
} else { | ||
swal({ | ||
title: 'Error', | ||
type: 'error', | ||
text: request.responseText | ||
}); | ||
} | ||
|
||
var url= 'targets/deletesession'; | ||
var page = url.replace('/', '_'); | ||
url = '/phpietadmin/' + url; | ||
|
||
var array = { | ||
iqn: $('#targetselection').find("option:selected").val() | ||
}; | ||
|
||
request = mylibs.doajax(url, array); | ||
|
||
request.done(function () { | ||
if (request.readyState == 4 && request.status == 200) { | ||
var configuretargetbody = $('#configuretargetbody'); | ||
configuretargetbody.html(''); | ||
configuretargetbody.html(request.responseText); | ||
configuretargetbody.removeClass(); | ||
configuretargetbody.addClass(page); | ||
} | ||
}); | ||
|
||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
}; | ||
}); |
Oops, something went wrong.