problems editor

This commit is contained in:
Michael Zhang 2016-01-07 02:01:18 -06:00
parent 6c76f0fc47
commit d6694d06a5
7 changed files with 145 additions and 4 deletions

View file

@ -9,7 +9,7 @@
}
* {
font-family: "Proxima Nova";
font-family: "Proxima Nova", Helvetica Neue, Helvetica, Arial, sans-serif;
}
.tab-content {
@ -21,3 +21,7 @@
display: block;
}
}
.NO_HOVER_UNDERLINE_DAMMIT:hover, .NO_HOVER_UNDERLINE_DAMMIT:focus, .NO_HOVER_UNDERLINE_DAMMIT:active {
text-decoration:none;
}

View file

@ -19,7 +19,9 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.9.3/js/bootstrap-select.min.js" integrity="sha384-1qZEXZBmj54fSiiWT8bZQGEpCumJWDrAoEqMdg6N5bTTLCkU5RXoNeUsKWekRYob" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.4.3/jquery.timeago.min.js" integrity="sha384-Bap3DetwPgo4GEFvaIDVSIrz5G0mUAUsfCUcEsi+JrrNu7dyj3gBmuAG4hDIGg/4" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/smooth-scroll/7.1.1/js/smooth-scroll.min.js" integrity="sha384-bznoxhRX5dRiE60JhQSru8t7g2RPG9lwqvyut8sjFFWmsAlp+R38e7DiATv1YyIu" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.5.4/ckeditor.js" integrity="sha384-N2/iPbB6nrU8RupS9WXTBZ1d2TRMI9qixvmdYNC+cbc12q9+YRW0Kw99QZfmYQzq" crossorigin="anonymous"></script>
<script src="/js/easyctf.js"></script>
<script src="/js/admin.js"></script>
</head>
<body ng-controller="mainController">

5
web/js/admin.js Normal file
View file

@ -0,0 +1,5 @@
$(document).ready(function() {
$(".panel-title > a[data-toggle=collapse]").click(function(e) {
e.preventDefault();
});
});

View file

@ -93,6 +93,12 @@ app.controller("profileController", ["$controller", "$scope", "$http", "$routePa
app.controller("adminProblemsController", ["$controller", "$scope", "$http", function($controller, $scope, $http) {
$controller("mainController", { $scope: $scope });
$.post("/api/admin/problems/list", function(result) {
if (result["success"] == 1) {
$scope.problems = result["problems"];
}
$scope.$apply();
});
}]);
function display_message(containerId, alertType, message, callback) {

View file

@ -1,5 +1,126 @@
<h1>Problems</h1>
<div class="page-header">
<h1>Problem Editor</h1>
</div>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#problems" aria-controls="problems" role="tab" data-toggle="tab">Problems</a></li>
<li role="presentation"><a href="#filesystem" aria-controls="filesystem" role="tab" data-toggle="tab">Filesystem</a></li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="problems">
<div class="row">
<div class="col-sm-12 col-md-6">
<div class="panel-group" id="problems" role="tablist" aria-multiselectable="true">
<div class="well" ng-show="problems.length==0">There are no problems to show!</div>
<!-- <div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading-new">
<h4 class="panel-title">
<a class="NO_HOVER_UNDERLINE_DAMMIT" style="display:block;" data-toggle="collapse" data-parent="#accordion" href="#collapse-new" aria-expanded="true" aria-controls="collapse-new">
<i class="fa fa-fw fa-plus"></i> Create New Problem
</a>
</h4>
</div>
<div id="collapse-new" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading-new">
<div class="panel-body">
</div>
</div>
</div> -->
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading-new">
<h4 class="panel-title">
<i class="fa fa-fw fa-plus"></i> Create New Problem
</h4>
</div>
<div id="collapse-new" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading-new">
<div class="panel-body">
<form class="form-horizontal" onsubmit="create_problem(); return false;" id="create_problem">
<fieldset>
<div id="register_msg"></div>
</fieldset>
<fieldset class="container-fluid">
<p>Be sure you are familiar with guidelines to writing problems before you submit!</p>
<div class="row">
<div class="col-sm-12 form-group">
<label class="col-sm-12" for="name"><small>Problem Title</small></label>
<div class="col-sm-12">
<input class="form-control" type="text" required name="name" placeholder="Problem Title" autocomplete="off" />
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 form-group">
<label class="col-sm-12" for="category"><small>Category</small></label>
<div class="col-sm-12">
<select name="category" class="selectpicker" data-width="100%">
<option value="Algorithm">Algorithm</option>
<option value="Binary Exploitation">Binary Exploitation</option>
<option value="Cryptography">Cryptography</option>
<option value="Forensics">Forensics</option>
<option value="Linux">Linux</option>
<option value="Miscellaneous">Miscellaneous</option>
<option value="Programming">Programming</option>
<option value="Reconnaissance">Reconnaissance</option>
<option value="Reverse Engineering">Reverse Engineering</option>
<option value="Web Exploitation">Web Exploitation</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 form-group">
<label class="col-sm-12" for="value"><small>Problem Value</small></label>
<div class="col-sm-12">
<input class="form-control" type="number" required name="value" placeholder="Problem Value" autocomplete="off" value="10" />
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 form-group">
<label class="col-sm-12" for="description"><small>Problem Description</small></label>
<div class="col-sm-12">
<textarea id="new-description" name="description"></textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 form-group">
<label class="col-sm-12" for="hint"><small>Problem Hint</small></label>
<div class="col-sm-12">
<input class="form-control" type="text" required name="hint" placeholder="Problem Hint" autocomplete="off" />
</div>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="filesystem">
<div class="well">Nothing here yet.</div>
</div>
</div>
<script type="text/javascript" src="/js/admin/problems.js"></script>
<script type="text/javascript">
$("ul[role=tablist]").tab();
$("a[role=tab]").click(function(e) {
e.preventDefault();
});
$(".selectpicker").selectpicker();
var config = {
toolbar: [
{ name: "basicstyles", items: [ "Bold", "Italic", "Underline", "-", "RemoveFormat" ] },
{ name: "links", items: [ "Link" ] },
{ name: "paragraph", items: [ "NumberedList", "BulletedList", "-", "Outdent", "Indent", "-", "Blockquote" ] },
{ name: "tools", items: [ "Maximize" ] },
{ name: "document", items: [ "Source" ] },
]
};
CKEDITOR.replace("new-description", config);
</script>

View file

@ -52,5 +52,8 @@
<script type="text/javascript">
$(document).ready(function() {
$("ul[role=tablist]").tab();
$("a[role=tab]").click(function(e) {
e.preventDefault();
});
});
</script>