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:
parent
66e0f51b70
commit
035bfe0101
@ -6,6 +6,15 @@
|
|||||||
.urlContainer .urlId, .urlContainer .urlLink, .urlContainer .urlControl {
|
.urlContainer .urlId, .urlContainer .urlLink, .urlContainer .urlControl {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
.urlId button {
|
||||||
|
width: 35px;
|
||||||
|
height: 35px;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: aqua;
|
||||||
|
border-radius: 7px;
|
||||||
|
border: 0px;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
.urlContainer .urlLink {
|
.urlContainer .urlLink {
|
||||||
border: none;
|
border: none;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
@ -17,7 +17,7 @@ function insertNewURL() {
|
|||||||
div.appendChild ( document.createElement ( 'text' ) );
|
div.appendChild ( document.createElement ( 'text' ) );
|
||||||
div.appendChild ( document.createElement ( 'div' ) );
|
div.appendChild ( document.createElement ( 'div' ) );
|
||||||
div.childNodes [ 1 ].classList.add ( "urlId" );
|
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 ( 'text' ) );
|
||||||
div.appendChild ( document.createElement ( 'input' ) );
|
div.appendChild ( document.createElement ( 'input' ) );
|
||||||
div.childNodes [ 3 ].type = 'text';
|
div.childNodes [ 3 ].type = 'text';
|
||||||
@ -58,7 +58,7 @@ function insertNewURL() {
|
|||||||
}
|
}
|
||||||
function editURL(node) {
|
function editURL(node) {
|
||||||
var url = node.childNodes[3].value;
|
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 ( );
|
var xhr = new XMLHttpRequest ( );
|
||||||
xhr.open ( "POST", 'edit', true );
|
xhr.open ( "POST", 'edit', true );
|
||||||
xhr.onreadystatechange = function ( ) {
|
xhr.onreadystatechange = function ( ) {
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<button onclick="logout()">Logout</button>
|
<button onclick="logout()">Logout</button>
|
||||||
<div class="urlList">
|
<div class="urlList">
|
||||||
<?php
|
<?php
|
||||||
if ( $result->rowCount ( ) == 0 ) {
|
if ( $result->rowCount ( ) == 0 ) {
|
||||||
echo ( "You have not created any URL yet.<br>" );
|
echo ( "You have not created any URL yet.<br>" );
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@
|
|||||||
$rows = $result->fetchAll ( PDO::FETCH_ASSOC );
|
$rows = $result->fetchAll ( PDO::FETCH_ASSOC );
|
||||||
foreach ( $rows as $row ) {
|
foreach ( $rows as $row ) {
|
||||||
echo ( "\t\t\t<div class=\"urlContainer\">\n" );
|
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<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<div class=\"urlControl\" style=\"display: none;\">\n" );
|
||||||
echo ( "\t\t\t\t\t<button><i class=\"fas fa-check\"></i></button>\n" );
|
echo ( "\t\t\t\t\t<button><i class=\"fas fa-check\"></i></button>\n" );
|
||||||
|
Reference in New Issue
Block a user