-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/maddy_tests
- Loading branch information
Showing
9 changed files
with
102 additions
and
517 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
<?php | ||
function userdel_GET(Web $w) { | ||
$w->pathMatch("id"); | ||
$user = AuthService::getInstance($w)->getObject("User",$w->ctx("id")); | ||
$user = AuthService::getInstance($w)->getObject("User", $w->ctx("id")); | ||
if ($user) { | ||
$user->delete(); | ||
$w->msg("User ".$user->login." deleted.","/admin/users"); | ||
|
||
if ($w->session('user_id') == $w->ctx("id")) { | ||
// We deleted our own user, force logout | ||
$w->sessionDestroy(); | ||
$w->redirect($w->localUrl("/auth/login")); | ||
} else { | ||
$w->msg("User " . $user->login . " deleted.", "/admin/users"); | ||
} | ||
} else { | ||
$w->error("User ".$w->ctx("id")." does not exist.","/admin/users"); | ||
$w->error("User " . $w->ctx("id") . " does not exist.", "/admin/users"); | ||
} | ||
|
||
} | ||
} |
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 |
---|---|---|
@@ -1,74 +1,82 @@ | ||
<div> | ||
<h3 class="subheading columns large-6">Search</h3> | ||
<span class="columns large-6" style="text-align: right;"> | ||
<p style="font-size: 12px;"> | ||
<strong>Note:</strong> Search terms must contain minimum 3 characters. | ||
<br> | ||
<strong>Tip:</strong> To search by Id, use 'id##' eg. id5. | ||
</p> | ||
</span> | ||
<h3 class="subheading columns large-6">Search</h3> | ||
<span class="columns large-6" style="text-align: right;"> | ||
<p style="font-size: 12px;"> | ||
<strong>Note:</strong> Search terms must contain minimum 3 characters. | ||
<br> | ||
<strong>Tip:</strong> To search by Id, use 'id##' eg. id5. | ||
</p> | ||
</span> | ||
</div> | ||
<hr> | ||
<div class="row-fluid"> | ||
<!-- <form action="<?php // echo $webroot; ?>/search/results" method="GET">--> | ||
<form id="search_form" class="clearfix"> | ||
<input type="hidden" name="<?php echo CSRF::getTokenID(); ?>" value="<?php echo CSRF::getTokenValue(); ?>" /> | ||
<div class="row-fluid"> | ||
<div class="small-12 medium-6 columns"> | ||
<input class="input-large" type="text" name="q" id="q" autofocus/> | ||
</div> | ||
<!-- <form action="<?php // echo $webroot; | ||
?>/search/results" method="GET">--> | ||
<form id="search_form" class="clearfix"> | ||
<input type="hidden" name="<?php echo CSRF::getTokenID(); ?>" value="<?php echo CSRF::getTokenValue(); ?>" /> | ||
<div class="row-fluid"> | ||
<div class="small-12 medium-6 columns"> | ||
<input class="input-large" type="text" name="q" id="q" autofocus /> | ||
</div> | ||
<div class="small-12 medium-2 columns"> | ||
<?php echo Html::select("idx", $indexes); ?> | ||
</div> | ||
<div class="small-12 medium-2 columns"> | ||
<?php echo Html::select("tags", $tags); ?> | ||
</div> | ||
<div class="small-12 medium-2 columns"> | ||
<button class="button tiny small-12" type="submit">Go</button> | ||
</div> | ||
</div> | ||
</form> | ||
<?php echo Html::select("idx", $indexes); ?> | ||
</div> | ||
<div class="small-12 medium-2 columns"> | ||
<?php echo Html::select("tags", $tags); ?> | ||
</div> | ||
<div class="small-12 medium-2 columns"> | ||
<button class="button tiny small-12" type="submit">Go</button> | ||
</div> | ||
</div> | ||
</form> | ||
|
||
|
||
</div> | ||
|
||
<div id="search_message" class="row hide"> | ||
<div data-alert class="alert-box warning" id="message_box"></div> | ||
<div id="search_message" class="row"> | ||
<div data-alert style="margin-top: 1rem" class="alert-box warning" id="message_box"></div> | ||
</div> | ||
|
||
<div id="result" class="row" style="display: none;"> | ||
|
||
</div> | ||
|
||
<script> | ||
$("#search_form").submit(function(event) { | ||
event.preventDefault(); | ||
$("#search_message").hide(); | ||
$("#result").hide(); | ||
const setError = (str) => { | ||
if (!str) { | ||
document.querySelector("#search_message").style.display = "none"; | ||
document.querySelector("#result").style.display = "block"; | ||
return; | ||
} | ||
|
||
document.querySelector("#message_box").innerText = str; | ||
document.querySelector("#search_message").style.display = "block"; | ||
document.querySelector("#result").style.display = "none"; | ||
} | ||
|
||
document.querySelector("#search_form").addEventListener("submit", async function(event) { | ||
event.preventDefault(); | ||
|
||
setError(false); | ||
|
||
const form = new FormData(event.target); | ||
const body = new URLSearchParams(form); | ||
|
||
try { | ||
const response = await fetch(`/search/results?` + body.toString()); | ||
|
||
var data = $("#search_form").serialize(); | ||
const json = await response.json(); | ||
|
||
$.getJSON("/search/results", data, | ||
function(response) { | ||
if (response.success === false) { | ||
$("#message_box").html(response.data); | ||
$("#search_message").show(); | ||
} else { | ||
var text_data = "<span style='padding-left: 20px;'>No results found</span>"; | ||
if (response.data) { | ||
text_data = response.data; | ||
} | ||
$("#result").html(text_data).delay(100).fadeIn(); | ||
} | ||
}, | ||
function(response) { | ||
$("#message_box").html("Failed to receive a response from search"); | ||
$("#search_message").show(); | ||
} | ||
); | ||
if (!json.success) | ||
return setError(json.data); | ||
|
||
return false; | ||
}); | ||
document.querySelector("#result").innerHTML = | ||
json.data || `<span style="padding-left: 20px;">No results found</span>`; | ||
} catch (e) { | ||
setError(`Failed to receive a response from search`); | ||
} | ||
|
||
return false; | ||
}); | ||
</script> | ||
<br> | ||
<br> |
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
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
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
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
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
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 |
---|---|---|
|
@@ -50,4 +50,8 @@ form { | |
width: 100%; | ||
} | ||
} | ||
|
||
input.input-large { | ||
width: 100%; | ||
} | ||
} |
Oops, something went wrong.