0
0

Added URL redirect support directly in management panel

Added buttons that automatically redirects the user to the corresponding URL, in a new page.
Modified css and javascript accordingly.
This commit is contained in:
Bryan Pedini 2019-07-25 03:01:16 +02:00
parent 66e0f51b70
commit 035bfe0101
No known key found for this signature in database
GPG Key ID: F59032DC40EB11E0
3 changed files with 14 additions and 5 deletions

View File

@ -6,6 +6,15 @@
.urlContainer .urlId, .urlContainer .urlLink, .urlContainer .urlControl {
display: inline;
}
.urlId button {
width: 35px;
height: 35px;
cursor: pointer;
background-color: aqua;
border-radius: 7px;
border: 0px;
outline: none;
}
.urlContainer .urlLink {
border: none;
background-color: transparent;

View File

@ -17,7 +17,7 @@ function insertNewURL() {
div.appendChild ( document.createElement ( 'text' ) );
div.appendChild ( document.createElement ( 'div' ) );
div.childNodes [ 1 ].classList.add ( "urlId" );
div.childNodes [ 1 ].innerHTML = response [ 'last_insert' ];
div.childNodes [ 1 ].innerHTML = "<button onclick=\"window.open('" + script_name + "/go/" + response [ 'last_insert' ] + "', '_blank');\">" + response [ 'last_insert' ] + "</button>";
div.appendChild ( document.createElement ( 'text' ) );
div.appendChild ( document.createElement ( 'input' ) );
div.childNodes [ 3 ].type = 'text';
@ -58,7 +58,7 @@ function insertNewURL() {
}
function editURL(node) {
var url = node.childNodes[3].value;
var url_id = node.childNodes[1].innerHTML
var url_id = node.childNodes[1].childNodes[0].innerHTML;
var xhr = new XMLHttpRequest ( );
xhr.open ( "POST", 'edit', true );
xhr.onreadystatechange = function ( ) {

View File

@ -22,7 +22,7 @@
<body>
<button onclick="logout()">Logout</button>
<div class="urlList">
<?php
<?php
if ( $result->rowCount ( ) == 0 ) {
echo ( "You have not created any URL yet.<br>" );
}
@ -30,7 +30,7 @@
$rows = $result->fetchAll ( PDO::FETCH_ASSOC );
foreach ( $rows as $row ) {
echo ( "\t\t\t<div class=\"urlContainer\">\n" );
echo ( "\t\t\t\t<div class=\"urlId\">" . $row [ 'ID' ] . "</div>\n" );
echo ( "\t\t\t\t<div class=\"urlId\"><button onclick=\"window.open('" . $config [ 'installation_path' ] . "/go/" . $row [ 'ID' ] . "', '_blank');\">" . $row [ 'ID' ] . "</button></div>\n" );
echo ( "\t\t\t\t<input type=\"text\" class=\"urlLink\" value=\"" . $row [ 'URL' ] . "\">\n" );
echo ( "\t\t\t\t<div class=\"urlControl\" style=\"display: none;\">\n" );
echo ( "\t\t\t\t\t<button><i class=\"fas fa-check\"></i></button>\n" );