Moving to GIT
This commit is contained in:
commit
691cee8c0f
10
.htaccess
Normal file
10
.htaccess
Normal file
@ -0,0 +1,10 @@
|
||||
RewriteEngine on
|
||||
|
||||
RewriteRule ^$ index.php
|
||||
RewriteRule ^browse$ index.php?w=browse
|
||||
RewriteRule ^search$ index.php?w=search
|
||||
RewriteRule ^searchResults$ index.php?w=searchResults
|
||||
RewriteRule ^insert$ index.php?w=insert
|
||||
RewriteRule ^displayItem index.php?w=displayItem&%{QUERY_STRING}
|
||||
|
||||
Header add Access-Control-Allow-Origin "http://biblio_backend/api/api.php"
|
124
index.php
Normal file
124
index.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
include ('settings.php');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>ESS Bibliography Tool</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="look/css.css">
|
||||
<script type="text/javascript">
|
||||
const API_URL = "<?=$API_URL?>";
|
||||
</script>
|
||||
<script type="text/javascript" src="script/jquery-3.6.0.min.js"></script>
|
||||
<script type="text/javascript" src="script/common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<a href="https://www.europeansocialsurvey.org"><h1><img src="look/ess-logo-top.png"> Bibliography tool <span style="font-size: 14px;">beta release 0.223</span></h1></a>
|
||||
<nav><?=menu()?></nav>
|
||||
</header>
|
||||
|
||||
<main class="<?=($_GET['w']??'')?>">
|
||||
<?php
|
||||
logic();
|
||||
?>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
University of Ljubljana, 2022
|
||||
<br>
|
||||
This website does not track you.
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
|
||||
// base logic for front-end
|
||||
|
||||
function logic() {
|
||||
switch ($_GET['w']??"") {
|
||||
case 'search':
|
||||
include 'parts/search.php';
|
||||
break;
|
||||
|
||||
case 'searchResults':
|
||||
include 'parts/searchResults.php';
|
||||
break;
|
||||
|
||||
case 'displayItem':
|
||||
include 'parts/displayItem.php';
|
||||
break;
|
||||
|
||||
case 'browse':
|
||||
include 'parts/browse.php';
|
||||
|
||||
break;
|
||||
|
||||
case 'insert':
|
||||
include 'parts/insert.php';
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
include 'parts/default.php';
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
function breadcrumbs() {
|
||||
$pre = $_GET['pre']??"";
|
||||
$part = $_GET['w']??"";
|
||||
|
||||
if (strlen ($pre) > 0) {
|
||||
$pre = base64_decode ($pre);
|
||||
}
|
||||
|
||||
if ($part != "") {
|
||||
if ($pre !='') {
|
||||
$pre = base64_decode (urldecode($pre));
|
||||
|
||||
echo '<a href="?w=' .$pre .'">' .cn($pre) .'</a> :: ';
|
||||
}
|
||||
|
||||
echo cn($part);
|
||||
}
|
||||
}
|
||||
*/
|
||||
function menu () {
|
||||
$part = $_GET['w']??"default";
|
||||
?>
|
||||
<ul>
|
||||
<li><a href="/"<?=($part=='default'?' class="active"':'')?>>Welcome</a></li>
|
||||
<li><a href="/browse"<?=($part=='browse'?' class="active"':'')?>>Search bibliography</a></li>
|
||||
<li><a href="/search"<?=($part=='search' || $part == 'searchResults' || $part== 'displayItem'?' class="active"':'')?>>Items</a></li>
|
||||
<li><a href="/insert"<?=($part=='insert'?' class="active"':'')?>>Insert entry</a></li>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
|
||||
/*
|
||||
function cn($url) {
|
||||
switch ($url) {
|
||||
case 'search':
|
||||
return 'Search';
|
||||
break;
|
||||
|
||||
case 'searchResults':
|
||||
return 'Search results';
|
||||
break;
|
||||
|
||||
case 'displayItem':
|
||||
return 'Item information';
|
||||
break;
|
||||
|
||||
default:
|
||||
return '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
?>
|
319
look/css.css
Normal file
319
look/css.css
Normal file
@ -0,0 +1,319 @@
|
||||
body, html {
|
||||
margin: 0;
|
||||
border: 0;
|
||||
font: normal 1em verdana, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
|
||||
body {
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
header {
|
||||
min-height: 50px;
|
||||
background-color: #c00000;
|
||||
color: white;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
header img {
|
||||
display: inline-block;
|
||||
margin-left: 25px;
|
||||
margin-top:5px;
|
||||
}
|
||||
|
||||
footer {
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
footer {
|
||||
margin-top: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
nav ul {
|
||||
margin: 0 auto 0 auto;
|
||||
}
|
||||
|
||||
nav ul li {
|
||||
display: inline;
|
||||
list-style-type: none;
|
||||
float: left;
|
||||
width: 250px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
nav ul li a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
nav ul li a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
nav ul li a.active {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
nav ul li a.active::before {
|
||||
content: '>> '
|
||||
}
|
||||
|
||||
nav ul li a.active::after {
|
||||
content: ' <<'
|
||||
}
|
||||
|
||||
|
||||
|
||||
h2 {
|
||||
max-width: 1000px;
|
||||
min-width: 500px;
|
||||
width: 80%;
|
||||
display: block;
|
||||
margin: 1em auto 1em 0;
|
||||
|
||||
text-align: left;
|
||||
color: #c00000;
|
||||
}
|
||||
|
||||
|
||||
/* */
|
||||
/* search */
|
||||
/* */
|
||||
|
||||
main.search {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-left: -252px;
|
||||
margin-top: -2.05em;
|
||||
}
|
||||
|
||||
main.search input#q {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 2.1em;
|
||||
font-size: 1.4em;
|
||||
width: 450px;
|
||||
border: none;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
main.search input:focus,
|
||||
#searchBar input:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
main.search input#ok,
|
||||
#searchBar input#ok {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 2.1em;
|
||||
font-size: 1.4em;
|
||||
font-weight: bold;
|
||||
width: 50px;
|
||||
border: none;
|
||||
color: white;
|
||||
background-color: #cccccc;
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
main.search input:focus,
|
||||
#searchBar input:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
main.search input#ok:hover,
|
||||
#searchBar input#ok:hover {
|
||||
background-color: #c00000;
|
||||
border-radius: 0 5px 5px 0;
|
||||
}
|
||||
|
||||
main.search form#search,
|
||||
#searchBar form#search {
|
||||
padding: 0 0 0 8px;
|
||||
border: 1px solid #cccccc;
|
||||
border-radius: 5px;
|
||||
box-shadow: 2px 2px #f3f3f3;
|
||||
}
|
||||
|
||||
main.search #Suggestions,
|
||||
#searchBar #Suggestions {
|
||||
padding: 5px;
|
||||
width: 503px;
|
||||
border-left: 1px solid #cccccc;
|
||||
border-right: 1px solid #cccccc;
|
||||
border-bottom: 1px solid #cccccc;
|
||||
|
||||
border-radius: 0px 0px 5px 5px;
|
||||
box-shadow: 2px 2px #f3f3f3;
|
||||
}
|
||||
|
||||
main.search #Suggestions div,
|
||||
#searchBar #Suggestions div {
|
||||
width: 100%;
|
||||
clear: both;
|
||||
margin: 0 0 5px 0;
|
||||
padding-left: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
main.search #Suggestions div:hover,
|
||||
#searchBar #Suggestions div:hover {
|
||||
background-color: #c00000;
|
||||
}
|
||||
|
||||
|
||||
/* search results page */
|
||||
|
||||
main {
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
main.search {
|
||||
padding-left: 0em;
|
||||
}
|
||||
|
||||
#searchBar input#q {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 2.1em;
|
||||
font-size: 1.4em;
|
||||
width: 450px;
|
||||
border: none;
|
||||
background-color: white;
|
||||
}
|
||||
#searchBar form#search {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* */
|
||||
/* DISPLAY RESULTS */
|
||||
/* */
|
||||
|
||||
div#itemData {
|
||||
max-width: 1000px;
|
||||
min-width: 500px;
|
||||
width: 80%;
|
||||
display: block;
|
||||
margin: 0 auto 0 25px;
|
||||
}
|
||||
|
||||
div#itemData div.line,
|
||||
div.browseFields div.line {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
clear: both;
|
||||
margin: 0 0 10px 0;
|
||||
|
||||
}
|
||||
|
||||
div#itemData label:first-of-type,
|
||||
div.browseFields label:first-of-type {
|
||||
font-weight: bold;
|
||||
width: 200px;
|
||||
display: block;
|
||||
|
||||
}
|
||||
|
||||
/* display item */
|
||||
div.line span {
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
#search_results ul li {
|
||||
list-style-type: none;
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
|
||||
#search_results a {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
#search_results a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Browse biblio
|
||||
*/
|
||||
|
||||
|
||||
div.browseFields {
|
||||
width: 500px;
|
||||
display: block;
|
||||
margin: 0 0 50px 0;
|
||||
}
|
||||
|
||||
div.browseFields select,
|
||||
div.browseFields input[type="text"] {
|
||||
width: 300px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
div.left {
|
||||
float: left;
|
||||
}
|
||||
div.right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
||||
div.browseFields.full {
|
||||
width: 1000px;
|
||||
}
|
||||
|
||||
div.browseFields label:nth-of-type(2),
|
||||
div.columns2 label,
|
||||
div.nolabel label,
|
||||
label.nolabel {
|
||||
font-weight: normal !important;
|
||||
font-style: italic;
|
||||
display: inline !important;
|
||||
}
|
||||
|
||||
div.container.w1000 {
|
||||
display: block;
|
||||
width: 1025px;
|
||||
margin: 30px auto 0 auto;
|
||||
clear: both;
|
||||
float: none;
|
||||
}
|
||||
|
||||
div.columns2 {
|
||||
columns: 2;
|
||||
}
|
||||
|
||||
div.w800 {
|
||||
width: 800px;
|
||||
}
|
||||
div.ml200 {
|
||||
margin-left: 200px;
|
||||
}
|
||||
|
||||
div.mb50 {
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
div.nomargin {
|
||||
margin: 0 !important;
|
||||
line-height: 2.2em;
|
||||
}
|
BIN
look/ess-logo-top.png
Normal file
BIN
look/ess-logo-top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
2
nbproject/private/private.properties
Normal file
2
nbproject/private/private.properties
Normal file
@ -0,0 +1,2 @@
|
||||
index.file=index.php
|
||||
url=http://localhost/frontend/
|
7
nbproject/project.properties
Normal file
7
nbproject/project.properties
Normal file
@ -0,0 +1,7 @@
|
||||
include.path=${php.global.include.path}
|
||||
php.version=PHP_80
|
||||
source.encoding=UTF-8
|
||||
src.dir=.
|
||||
tags.asp=false
|
||||
tags.short=false
|
||||
web.root=.
|
9
nbproject/project.xml
Normal file
9
nbproject/project.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.php.project</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/php-project/1">
|
||||
<name>biblio_frontend</name>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
8
package.json
Normal file
8
package.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "ess_biblio",
|
||||
"version": "1.0.0",
|
||||
"keywords": ["util", "functional", "server", "client", "browser"],
|
||||
"author": "may",
|
||||
"contributors": [],
|
||||
"dependencies": {}
|
||||
}
|
360
parts/browse.php
Normal file
360
parts/browse.php
Normal file
@ -0,0 +1,360 @@
|
||||
|
||||
<h2>Browse bibliography</h2>
|
||||
<p>To filter bibliography based on certain criteria, please set one or more options below as needed. To display filtered results based on selected criteria, press the "Filter results" buttons.</p>
|
||||
|
||||
<form id="browsing">
|
||||
|
||||
<div class="container w1000">
|
||||
|
||||
<div class="browseFields full">
|
||||
<div class="line nomargin"><label>Bibliographic type: </label>
|
||||
<select id="pubType" name="pubType"><option>Please wait, loading data...</option></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="browseFields left">
|
||||
|
||||
<div class="line">
|
||||
<label>Affilitation 1:</label>
|
||||
<select id="affiliation1" name="affiliation1"><option>Please wait, loading data...</option></select>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label> </label>
|
||||
<input type="checkbox" id="affil1auth1" name="affil1auth1" value="1"><label for="affil1auth1">Limit affiliation 1 to 1<sup>st</sup> author</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="browseFields right">
|
||||
<div class="line">
|
||||
<label>Affilitation 2:</label>
|
||||
<select id="affiliation2" name="affiliation2"><option>Please wait, loading data...</option></select>
|
||||
</div>
|
||||
<div class="line">
|
||||
<label> </label>
|
||||
<input type="checkbox" id="affil2auth2" name="affil2auth2" value="1"><label for="affil2auth2">Limit affiliation 2 to 2<sup>nd</sup> author</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="browseFields left">
|
||||
|
||||
<div class="line">
|
||||
<label>Author:</label>
|
||||
<input type="text" id="author" name="author">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="browseFields right">
|
||||
<div class="line">
|
||||
<label>Journal:</label>
|
||||
<input type="text" id="journal" name="journal">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="browseFields left">
|
||||
|
||||
<div class="line">
|
||||
<label>ESS round used:</label>
|
||||
<select id="round" name="round"><option>Please wait, loading data...</option></select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="browseFields right">
|
||||
<div class="line">
|
||||
<label>Journal field:</label>
|
||||
<select id="journalField" name="jField"><option>Please wait, loading data...</option></select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="browseFields left">
|
||||
|
||||
<div class="line">
|
||||
<label>Title (or part of it):</label>
|
||||
<input type="text" id="title_words" name="title_words">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php $de = 1; include ('topic-item-module.php'); ?>
|
||||
|
||||
|
||||
|
||||
<div class="browseFields full">
|
||||
<input type="button" value="SHOW RESULTS" onClick="getResults();">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<div id="toth2">
|
||||
<h2>Number of records in the database: <span id="numHitsTOT">loading...</span></h2>
|
||||
<p>Please use the form above to browse them. If you want to display all (published) records, just hit the "SHOW RESULTS" button.</p>
|
||||
</div>
|
||||
|
||||
<div id="results" style="display: none;">
|
||||
<h2>Results (n=<span id="numHits">loading...</span>)</h2>
|
||||
|
||||
<form id="spreadsheet" action="parts/spreadsheet.php" method="post" target="_blank">
|
||||
<input type="hidden" name="formdata" id="formdata">
|
||||
<input type="submit" value="Download this bibliography in a spreadheet format">
|
||||
</form>
|
||||
|
||||
<ul id="resultsList">
|
||||
Please wait, loading data...
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var numResults = 0;
|
||||
var toLoad = 0;
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'total_records_published'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
$('#numHitsTOT').html(msg['data']);
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
listCountries();
|
||||
})
|
||||
.fail (function() {
|
||||
console.log('No response received from API!');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
function listCountries() {
|
||||
// retrieve data via web
|
||||
// A: countries
|
||||
// ADD TEXT THAT SOMETHING IS HAPPENING
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'list_countries'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
$('#affiliation1').html('<option value="0">Any</option>');
|
||||
$('#affiliation2').html('<option value="0">Any</option>');
|
||||
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
msg['data'].forEach(function (item) {
|
||||
$('#affiliation1').html( $('#affiliation1').html() + '<option value="' + item['id'] + '">' + item['name'] + '</option>');
|
||||
$('#affiliation2').html( $('#affiliation2').html() + '<option value="' + item['id'] + '">' + item['name'] + '</option>');
|
||||
});
|
||||
console.log(msg);
|
||||
toLoad++;
|
||||
getTopicData();
|
||||
getRoundData();
|
||||
getPubTypes();
|
||||
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
console.log('No response received from API!');
|
||||
});
|
||||
}
|
||||
|
||||
function getPubTypes () {
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'list_pubType'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
$('#pubType').html('<option value="0">Any</option>');
|
||||
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
msg['data'].forEach(function (item) {
|
||||
$('#pubType').html( $('#pubType').html() + '<option value="' + item['id'] + '">' + item['name'] + '</option>');
|
||||
});
|
||||
console.log(msg);
|
||||
toLoad++;
|
||||
getRoundData();
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
console.log('No response received from API!');
|
||||
});
|
||||
}
|
||||
|
||||
function getRoundData() {
|
||||
// next is ess round
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'list_rounds'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
$('#round').html('<option value="0">Any</option>');
|
||||
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
msg['data'].forEach(function (item) {
|
||||
$('#round').html( $('#round').html() + '<option value="' + item['id'] + '">' + item['name'] + '</option>');
|
||||
});
|
||||
console.log(msg);
|
||||
toLoad++;
|
||||
getjFieldData();
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
console.log('No response received from API!');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getjFieldData() {
|
||||
// next is ess round
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'list_journalField'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
$('#journalField').html('<option value="0">Any</option>');
|
||||
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
msg['data'].forEach(function (item) {
|
||||
$('#journalField').html( $('#journalField').html() + '<option value="' + item['id'] + '">' + item['name'] + '</option>');
|
||||
});
|
||||
console.log(msg);
|
||||
toLoad++;
|
||||
// getResults(); NOT AUTO!
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
console.log('No response received from API!');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getResults() {
|
||||
if (toLoad < 6) return;
|
||||
var all_citations = '';
|
||||
|
||||
var data = $('#browsing').serializeArray();
|
||||
$('#formdata').val(JSON.stringify(data));
|
||||
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'browse',
|
||||
d: data
|
||||
}
|
||||
|
||||
})
|
||||
.done (function (msg) {
|
||||
|
||||
$('#toth2').hide();
|
||||
$('#results').show();
|
||||
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
console.log('Looks OK...');
|
||||
results = msg['data'];
|
||||
|
||||
$('#numHits').html(msg['data'].length);
|
||||
|
||||
if (msg['data'].length == 0) {
|
||||
$('#resultsList').html('No results found.');
|
||||
}
|
||||
|
||||
else {
|
||||
msg['data'].forEach(function (item) {
|
||||
if (item['citation']!='') {
|
||||
all_citations += '<li>' + item['citation'] + '</li>';
|
||||
}
|
||||
});
|
||||
$('#resultsList').html(all_citations);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function(jqXHR, textStatus, errorThrown) {
|
||||
console.log('Failure ' + jqXHR.stringify + textStatus + errorThrown);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
21
parts/default.php
Normal file
21
parts/default.php
Normal file
@ -0,0 +1,21 @@
|
||||
<div class="container w1000">
|
||||
|
||||
<div class="browseFields full">
|
||||
<h2>Welcome</h2>
|
||||
|
||||
<p>This tool provides browsing, as well as inserting into, the ESS bibliography database.</p>
|
||||
|
||||
<p><strong>Search bibliography</strong></p>
|
||||
<p>Should you wish to check usage of certain topics, modules, rounds, or even items, you can do so in the "Browse" section. You can also filter by journal name, journal field, author's affiliation, or even their names.</p>
|
||||
<p><strong>Items</strong></p>
|
||||
<p>Is just a sample of what could also be done with this tool - one could search by any parameter, get detailed data about it - and see all the bibliographic entries that are related to the given parameter.</p>
|
||||
<p><strong>Exporting database into spreadsheet</strong></p>
|
||||
<p>Data can be exported into a spreadsheet format (i.e. "Excel") in both browse and "item search" sections by pressing button above the list of items.</p>
|
||||
<p><strong>Inserting data</strong></p>
|
||||
<p>To make data quality as good as possible while also making entries easier, one should provide DOI - most of the fields will be populated automatically upon entering a correct one.<br>Please note that all entries will be revirewed by the team before appearing online.</p>
|
||||
<p><strong>Bugs and feature requests</strong></p>
|
||||
<p>This application is work in progress and will evolve according to user feedback. Please report bugs and feature requests to <a href="mailto: may.dousak@fdv.uni-lj.si" style="color: blue">May Doušak</a>.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
145
parts/displayItem.php
Normal file
145
parts/displayItem.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
$pre = $_GET['pre']??'';
|
||||
|
||||
if ($pre == 'search') {
|
||||
displaySearch();
|
||||
}
|
||||
?>
|
||||
|
||||
<h2>Item information</h2>
|
||||
|
||||
<div id="itemData">
|
||||
|
||||
<div class="line">
|
||||
<label>Item name</label>
|
||||
<span id="iName">(loading data, please wait...)</span>
|
||||
</div>
|
||||
|
||||
<div class="line">
|
||||
<label>Survey block</label>
|
||||
<span id="iBlock">(loading data, please wait...)</span>
|
||||
</div>
|
||||
|
||||
<div class="line">
|
||||
<label>Item name</label>
|
||||
<span id="iLabel">(loading data, please wait...)</span>
|
||||
</div>
|
||||
|
||||
<div class="line">
|
||||
<label>Item text</label>
|
||||
<span id="iText">(loading data, please wait...)</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Citation information (n=<span id="numHits">loading...</span>)</h2>
|
||||
<form id="spreadsheet" action="parts/spreadsheet.php" method="post" target="_blank">
|
||||
<input type="hidden" name="id_item" value="<?=$_GET['id']?>">
|
||||
<input type="submit" value="Download this bibliography in a spreadheet format">
|
||||
</form>
|
||||
|
||||
<ul id="resultsList">
|
||||
|
||||
</ul>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function itemError() {
|
||||
$('#itemData').html(GeneralLoadErrorText());
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
// retrieve data via web
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'display_item',
|
||||
id: '<?=($_GET['id']??'')?>'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
itemError();
|
||||
}
|
||||
else {
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
$('#iBlock').html(msg['data']['block']);
|
||||
$('#iName').html(msg['data']['name']);
|
||||
$('#iLabel').html(msg['data']['label']);
|
||||
$('#iText').html(msg['data']['txt']);
|
||||
|
||||
console.log(msg);
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
itemError();
|
||||
});
|
||||
|
||||
|
||||
|
||||
// citations
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'item_citations',
|
||||
d: <?=$_GET['id']?>
|
||||
}
|
||||
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
console.log('Looks OK...');
|
||||
results = msg['data'];
|
||||
var all_citations = '';
|
||||
|
||||
$('#numHits').html(msg['data'].length);
|
||||
|
||||
if (msg['data'].length == 0) {
|
||||
$('#resultsList').html('No results found.');
|
||||
}
|
||||
|
||||
else {
|
||||
msg['data'].forEach(function (item) {
|
||||
if (item['citation']!='') {
|
||||
all_citations += '<li>' + item['citation'] + '</li>';
|
||||
}
|
||||
});
|
||||
$('#resultsList').html(all_citations);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function(jqXHR, textStatus, errorThrown) {
|
||||
console.log('Failure ' + jqXHR.stringify + textStatus + errorThrown);
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
function displaySearch() {
|
||||
$id = $_GET['id']??'';
|
||||
|
||||
// include_once ('search_bar.php');
|
||||
}
|
||||
?>
|
5
parts/do_insert.php
Normal file
5
parts/do_insert.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
?>
|
458
parts/insert.php
Normal file
458
parts/insert.php
Normal file
@ -0,0 +1,458 @@
|
||||
|
||||
<h2>Insert bibliographic record</h2>
|
||||
<p></p>
|
||||
|
||||
<form id="insert" action="/do_insert" method="post">
|
||||
|
||||
<div class="container w1000">
|
||||
|
||||
<div class="browseFields full">
|
||||
<div class="line">
|
||||
<label>Enter DOI:</label>
|
||||
<input type="text" name="doi" id="doi"><input type="button" onClick="checkDOI();" value="↻">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container w1000" id="data" style="display: none;">
|
||||
<h2>Publication details</h2>
|
||||
<p>Please review all values returned from DOI and fix all missing / wrong data.</p>
|
||||
|
||||
|
||||
<div class="browseFields full">
|
||||
<div class="line">
|
||||
<label>Publication title:</label>
|
||||
<input type="text" id="title" name="title" style="width: 750px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="browseFields full">
|
||||
<div class="line">
|
||||
<label>Publication language:</label>
|
||||
<select id="language" name="language"><option>Please wait, loading data...</option></select>
|
||||
</div>
|
||||
<div class="line" id="lang_add" style="display: none;">
|
||||
<label>Add a new language:</label>
|
||||
<input type="text" id="newLang" name="newLang" style="width: 750px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="browseFields left" id="cnt_addauth">
|
||||
<div class="line">
|
||||
<input type="button" value="Add another author" onClick="addAuthorFields(_cnt_authors); _cnt_authors++;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="browseFields right">
|
||||
<div class="line">
|
||||
<input type="button" value="Remove last author" onClick="_cnt_authors--; $('#auth' + _cnt_authors).remove();">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="browseFields full">
|
||||
<div class="line">
|
||||
<label>Abstract:</label>
|
||||
<textarea id="abstract_orig" name="abstract_orig" style="width: 750px; height: 250px"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="browseFields full">
|
||||
<p>English abstract is applicable for non-English publications.</p>
|
||||
</div>
|
||||
|
||||
<div class="browseFields full">
|
||||
<div class="line">
|
||||
<label title="Applicable for non-English texts">English abstract:</label>
|
||||
<textarea id="abstract_eng" name="abstract_eng" style="width: 750px; height: 250px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="browseFields left nomargin">
|
||||
<div class="line">
|
||||
<label>Bibliographic type:</label>
|
||||
<select id="pubType" name="pubType"><option>Please wait, loading data...</option></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="browseFields right nomargin" id="cntyear">
|
||||
<div class="line">
|
||||
<label>Year:</label>
|
||||
<select id="year" name="year">
|
||||
<option value="0">Please select year</option>
|
||||
<?php for ($year = 1500; $year<=date('Y'); $year++) {echo '<option value="' .$year .'">' .$year .'</option>';}?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $de = 0; include ('topic-item-module.php');?>
|
||||
|
||||
<div class="line"><label>ESS rounds used:</label>
|
||||
<div class="columns2 w800 ml200 mb50" id="cnt_ess_round">
|
||||
Loading data, please wait...
|
||||
</div>
|
||||
|
||||
<div class="line"><label></label>
|
||||
<div class="w800 ml200 mb50">
|
||||
<input type="button" value="Add article" id="submit">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var countries = '<option value="0">Please select country</option>';
|
||||
var languages = '';
|
||||
|
||||
var _cnt_authors = 1;
|
||||
|
||||
function checkDOI() {
|
||||
_cnt_authors = 1;
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'doi',
|
||||
doi: $('#doi').val()
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
|
||||
console.log(msg);
|
||||
$('#title').val(msg['data']['title']);
|
||||
$('#year').val(msg['data']['year']);
|
||||
|
||||
|
||||
// journal article
|
||||
if (msg['data']['journal']) {
|
||||
$('#pubType option').each(function(){
|
||||
if($(this).text() == 'Journal Article'){
|
||||
$(this).prop('selected', true).trigger('change');
|
||||
}
|
||||
});
|
||||
addJournalFields();
|
||||
if (msg['data']['journal']) $('#journalName').val(msg['data']['journal']);
|
||||
if (msg['data']['publisher']) $('#publisher').val(msg['data']['publisher']);
|
||||
if (msg['data']['volume']) $('#volume').val(msg['data']['volume']);
|
||||
if (msg['data']['number']) $('#issue').val(msg['data']['number']);
|
||||
if (msg['data']['pages'])
|
||||
{
|
||||
var pages = msg['data']['pages'];
|
||||
pages = pages.split('--');
|
||||
|
||||
if (pages[0]) $('#fromPage').val(pages[0]);
|
||||
if (pages[1]) $('#toPage').val(pages[1]);
|
||||
}
|
||||
}
|
||||
else if (msg['data']['booktitle']) {
|
||||
$('#pubType option').each(function(){
|
||||
if($(this).text() == 'Book chapter'){
|
||||
$(this).prop('selected', true).trigger('change');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var authors = msg['data']['author'];
|
||||
authors = authors.split('and');
|
||||
|
||||
removeAuthorFields();
|
||||
|
||||
authors.forEach(function (author) {
|
||||
|
||||
author = author.trim();
|
||||
|
||||
addAuthorFields(_cnt_authors);
|
||||
$('#auth' + _cnt_authors + 'affil').html(countries);
|
||||
$('#auth' + _cnt_authors + 'citation').val(author);
|
||||
|
||||
author = author.split(' ');
|
||||
|
||||
$('#auth' + _cnt_authors + 'name1').val(author[0]);
|
||||
|
||||
if (author.length == 2) {
|
||||
$('#auth' + _cnt_authors + 'lastname').val(author[1]);
|
||||
}
|
||||
|
||||
else if (author.length == 3) {
|
||||
$('#auth' + _cnt_authors + 'name2').val(author[1]);
|
||||
$('#auth' + _cnt_authors + 'lastname').val(author[2]);
|
||||
}
|
||||
else if (author.length == 4) {
|
||||
$('#auth' + _cnt_authors + 'name2').val(author[1]);
|
||||
$('#auth' + _cnt_authors + 'lastname').val(author[2]);
|
||||
$('#auth' + _cnt_authors + 'lastname2').val(author[3]);
|
||||
}
|
||||
|
||||
_citation = ''
|
||||
_citation = author.pop() + ', ';
|
||||
|
||||
for (pos = 0; pos<author.length; pos++) {
|
||||
_citation += author[pos].charAt(0) +'. ';
|
||||
}
|
||||
$('#auth' + _cnt_authors + 'citation').val(_citation.trim());
|
||||
|
||||
_cnt_authors++;
|
||||
});
|
||||
|
||||
$('#data').show();
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
console.log('No response received from API!');
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'list_pubType'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
$('#pubType').html('');
|
||||
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
msg['data'].forEach(function (item) {
|
||||
$('#pubType').html( $('#pubType').html() + '<option value="' + item['id'] + '">' + item['name'] + '</option>');
|
||||
});
|
||||
|
||||
fetchLanguages();
|
||||
fetchCountries();
|
||||
getTopicData();
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
console.log('No response received from API!');
|
||||
});
|
||||
|
||||
$('#language').change(function () {
|
||||
if ($('#language').val() == '-1') {
|
||||
$('#lang_add').show();
|
||||
}
|
||||
else {
|
||||
$('#lang_add').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#submit').click(function () {
|
||||
myData = JSON.stringify($('#insert').serializeArray());
|
||||
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'do_insert',
|
||||
content: myData
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else if (msg['status'] == '406') {
|
||||
alert ('Unfortunaly, your record cannod be added. Reason: ' + msg['data']);
|
||||
}
|
||||
else if (msg['status'] == '200') {
|
||||
alert ('Thank you, your bibliographic entry has been accepted into the review process.');
|
||||
window.location.replace('/');
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
alert ('Unknown error has occured');
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
function fetchCountries () {
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'list_countries'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
msg['data'].forEach(function (item) {
|
||||
countries += '<option value="' + item['id'] + '">' + item['name'] + '</option>';
|
||||
});
|
||||
getRoundData();
|
||||
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
console.log('No response received from API!');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getRoundData() {
|
||||
// next is ess round
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'list_rounds'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
$('#cnt_ess_round').html('');
|
||||
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
msg['data'].forEach(function (item) {
|
||||
$('#cnt_ess_round').html( $('#cnt_ess_round').html() +
|
||||
'<input type="checkbox" name="round" value="' + item['id'] + '" id="_ess_round_' + item['id'] +'"><label for="_ess_round_' + item['id'] + '">' + item['name'] + '</label><br>');
|
||||
});
|
||||
console.log(msg);
|
||||
toLoad++;
|
||||
getItemsData();
|
||||
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
console.log('No response received from API!');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function fetchLanguages () {
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'list_languages'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
msg['data'].forEach(function (item) {
|
||||
languages += '<option value="' + item['id'] + '" ' + ((item['id'] == '2') ? 'selected="selected"' : '') + '>' + item['name'] + '</option>';
|
||||
});
|
||||
$('#language').html('<option value="-1">Add a new language</option>' + languages);
|
||||
}
|
||||
else {
|
||||
console.log('Napaka: ' + msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
console.log('No response received from API!');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function removeAuthorFields() {
|
||||
$('.author_field').remove();
|
||||
}
|
||||
|
||||
function addAuthorFields (offset) {
|
||||
|
||||
$('#cnt_addauth').before ('<div class="author_field" id="auth' + offset + '"><div class="browseFields left nomargin">'
|
||||
+ '<div class="line"><label>Author ' + offset + ' first name:</label>'
|
||||
+ '<input type="text" id="auth' + offset + 'name1" name="auth' + offset + 'name1"></div>'
|
||||
+ '</div>'
|
||||
+ ' <div class="browseFields right nomargin">'
|
||||
+ '<div class="line"><label>Auth. ' + offset + ' middle name:</label>'
|
||||
+ '<input type="text" id="auth' + offset + 'name2" name="auth' + offset + 'name2"></div>'
|
||||
+ '</div>'
|
||||
+ '<div class="browseFields left nomargin">'
|
||||
+ '<div class="line"><label>Auth. ' + offset + ' last name:</label>'
|
||||
+ '<input type="text" id="auth' + offset + 'lastname" name="auth' + offset + 'lastname"></div>'
|
||||
+ '</div>'
|
||||
+ '<div class="browseFields right nomargin">'
|
||||
+ '<div class="line"><label>Auth. ' + offset + ' last name 2:</label>'
|
||||
+ '<input type="text" id="auth' + offset + 'lastname2" name="auth' + offset + 'lastname2"></div>'
|
||||
+ '</div>'
|
||||
+ '<div class="browseFields left">'
|
||||
+ '<div class="line"><label>Auth. ' + offset + ' citation:</label>'
|
||||
+ '<input type="text" id="auth' + offset + 'citation" name="auth' + offset + 'citation"></div>'
|
||||
+ '</div>'
|
||||
+ '<div class="browseFields right">'
|
||||
+ '<div class="line"><label>Auth. ' + offset + ' affil.:</label>'
|
||||
+ '<select id="auth' + offset + 'affil" name="auth' + offset + 'affil"><option>Please wait...</option></select></div>'
|
||||
+ '</div></div>');
|
||||
}
|
||||
|
||||
function addJournalFields() {
|
||||
$('#cntyear').after ('<div class="browseFields left nomargin">'
|
||||
+ '<div class="line"><label>Journal name:</label>'
|
||||
+ '<input type="text" id="journalName" name="journalName"></div>'
|
||||
+ '</div>'
|
||||
+ ' <div class="browseFields right nomargin">'
|
||||
+ '<div class="line"><label>Publisher:</label>'
|
||||
+ '<input type="text" id="publisher" name="publisher"></div>'
|
||||
+ '</div>'
|
||||
+ '<div class="browseFields left nomargin">'
|
||||
+ '<div class="line"><label>Volume:</label>'
|
||||
+ '<input type="text" id="volume" name="volume"></div>'
|
||||
+ '</div>'
|
||||
+ ' <div class="browseFields right nomargin">'
|
||||
+ '<div class="line"><label>Issue:</label>'
|
||||
+ '<input type="text" id="issue" name="issue"></div>'
|
||||
+ '</div>'
|
||||
+ '<div class="browseFields left nomargin">'
|
||||
+ '<div class="line"><label>From page:</label>'
|
||||
+ '<input type="text" id="fromPage" name="fromPage"></div>'
|
||||
+ '</div>'
|
||||
+ ' <div class="browseFields right nomargin">'
|
||||
+ '<div class="line"><label>To page:</label>'
|
||||
+ '<input type="text" id="toPage" name="toPage"></div>'
|
||||
+ '</div>');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
9
parts/search.php
Normal file
9
parts/search.php
Normal file
@ -0,0 +1,9 @@
|
||||
<form id="search" action="index.php" method="GET">
|
||||
<input type="hidden" name="w" value="searchResults">
|
||||
<input id="q" type="text" name="q" autocomplete="off">
|
||||
<input type="submit" id="ok" value="?">
|
||||
</form>
|
||||
|
||||
<div id="SuggestionsCnt">
|
||||
|
||||
</div>
|
50
parts/searchResults.php
Normal file
50
parts/searchResults.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
include ('search_bar.php');
|
||||
?>
|
||||
<h2>Search results</h2>
|
||||
<section id="search_results">
|
||||
There are no results based on your query.
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready (function () {
|
||||
// retrieve search results
|
||||
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'search',
|
||||
txt: '<?=($_GET['q']??'')?>'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
// we received assoc json with id, name, label, block.
|
||||
var search_results = "";
|
||||
|
||||
for (let i = 0; i < msg['data'].length; i++) {
|
||||
|
||||
search_results += '<li><a href="index.php?w=displayItem&pre=searchResults&id=' + msg['data'][i]['id'] + '">'
|
||||
+ 'Item from block ' + msg['data'][i]['block'] + ': '
|
||||
+ msg['data'][i]['name'] + '</a> ('
|
||||
+ msg['data'][i]['label'] + ')<br>'
|
||||
+ '“<i>' + msg['data'][i]['txt'] + '</i>”</li>';
|
||||
}
|
||||
|
||||
if (search_results.length > 0) {
|
||||
$('#search_results').html('<ul class="results">' + search_results + '</ul>');
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
40
parts/search_bar.php
Normal file
40
parts/search_bar.php
Normal file
@ -0,0 +1,40 @@
|
||||
<h2>Search</h2>
|
||||
<section id="searchBar">
|
||||
<form id="search" action="index.php" method="GET">
|
||||
<input type="hidden" name="w" value="searchResults">
|
||||
<input id="q" type="text" name="q" autocomplete="off" value="<?=($_GET['q']??'')?>">
|
||||
<input type="submit" id="ok" value="?">
|
||||
</form>
|
||||
<div id="SuggestionsCnt">
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready (function () {
|
||||
// automatically fill in text of the selected item:
|
||||
// if they search by clicking on the suggestion, we pass on the ID. Now, retrieve the text we need to fill in.
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'search_query_text',
|
||||
id: new URLSearchParams(location.search).get('id')
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
// we received text to fill in
|
||||
$('#q').val(msg['data']['name'] + ': ' + msg['data']['label']);
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
26
parts/spreadsheet.php
Normal file
26
parts/spreadsheet.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
include ('../settings.php');
|
||||
|
||||
if (isset ($_POST['id_item'])) {
|
||||
$request = array ('w' => 'item2spreadsheet', 'id' => $_POST['id_item']);
|
||||
}
|
||||
else {
|
||||
$request = array ('w'=> 'browse2spreadsheet', 'spr'=>1, 'd' => $_POST['formdata']);
|
||||
}
|
||||
|
||||
$ch = curl_init($API_URL);
|
||||
|
||||
curl_setopt( $ch, CURLOPT_POSTFIELDS, $request);
|
||||
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
|
||||
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
|
||||
header("content-type:application/csv;charset=UTF-8");
|
||||
header("Content-Disposition:attachment;filename=\"CHS.csv\"");
|
||||
|
||||
$data = json_decode ($result, true);
|
||||
die ($data['data']);
|
||||
|
||||
?>
|
154
parts/topic-item-module.php
Normal file
154
parts/topic-item-module.php
Normal file
@ -0,0 +1,154 @@
|
||||
<div class="browseFields full">
|
||||
|
||||
<div class="line nomargin"><label>ESS topics used:</label>
|
||||
<?=($de==1?'Display entries that use <input type="radio" name="topic_logic" value="0" id="topic_logic_0" checked="checked"><label class="nolabel" for="topic_logic_0"><strong>any</strong></label>
|
||||
/<input type="radio" name="topic_logic" value="1" id="topic_logic_1"><label class="nolabel" for="topic_logic_1"><strong>all</strong> of selected below</label></div>
|
||||
<div class="line"><label> </label><i>(none selected means any)</i></div>':'')?>
|
||||
<div class="nolabel w800 ml200 mb50" id="cnt_ess_topic">
|
||||
Loading data, please wait...
|
||||
</div>
|
||||
|
||||
|
||||
<div class="line"><label>ESS items used:</label>
|
||||
<?=($de==1?'Display entries that use <input type="radio" name="item_logic" value="0" id="item_logic_0" checked="checked"><label class="nolabel" for="item_logic_0"><strong>any</strong></label>
|
||||
/<input type="radio" name="topic_item" value="1" id="item_logic_1"><label class="nolabel" for="item_logic_1"><strong>all</strong> of selected below</label></div>
|
||||
<div class="line"><label> </label><i>(none selected means any)</i></div>':'')?>
|
||||
|
||||
<div class="nolabel w800 ml200 mb50" id="cnt_ess_item">
|
||||
Loading data, please wait...
|
||||
</div>
|
||||
|
||||
<div class="line"><label>ESS modules used:</label>
|
||||
<?=($de==1?'Display entries that use <input type="radio" name="module_logic" value="0" id="module_logic_0" checked="checked"><label class="nolabel" for="module_logic_0"><strong>any</strong></label>
|
||||
/<input type="radio" name="module_logic" value="1" id="module_logic_1"><label class="nolabel" for="module_logic_1"><strong>all</strong> of selected below</label></div>
|
||||
<div class="line"><label> </label><i>(none selected means any)</i></div>':'')?>
|
||||
|
||||
<div class="columns2 w800 ml200 mb50" id="cnt_ess_module">
|
||||
Loading data, please wait...
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
function getTopicData() {
|
||||
if(typeof toLoad !== 'undefined'){
|
||||
|
||||
}
|
||||
else {
|
||||
toLoad = 0;
|
||||
}
|
||||
|
||||
// topics.
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'list_topics'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
$('#cnt_ess_topic').html('');
|
||||
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
msg['data'].forEach(function (item) {
|
||||
$('#cnt_ess_topic').html( $('#cnt_ess_topic').html() +
|
||||
'<input type="checkbox" name="topic" value="' + item['id'] + '" id="_ess_topic_' + item['id'] +'"><label for="_ess_topic_' + item['id'] + '">' + item['name'] + '</label><br>');
|
||||
});
|
||||
console.log(msg);
|
||||
toLoad++;
|
||||
getItemsData();
|
||||
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
console.log('No response received from API!');
|
||||
});
|
||||
// topics done
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getItemsData() {
|
||||
// items
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'list_items'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
$('#cnt_ess_item').html('');
|
||||
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
msg['data'].forEach(function (item) {
|
||||
$('#cnt_ess_item').html( $('#cnt_ess_item').html() +
|
||||
'<input type="checkbox" name="item" value="' + item['id'] + '" id="_ess_item_' + item['id'] +'"><label for="_ess_item_' + item['id'] + '">' + item['name'] + '</label><br>');
|
||||
});
|
||||
console.log(msg);
|
||||
toLoad++;
|
||||
getModulesData();
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
console.log('No response received from API!');
|
||||
});
|
||||
// items done
|
||||
}
|
||||
|
||||
function getModulesData() {
|
||||
|
||||
// modules
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'list_modules'
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
if (msg == '') {
|
||||
console.log('No response received from API!');
|
||||
}
|
||||
else {
|
||||
$('#cnt_ess_module').html('');
|
||||
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
msg['data'].forEach(function (item) {
|
||||
$('#cnt_ess_module').html( $('#cnt_ess_module').html() +
|
||||
'<input type="checkbox" name="module" value="' + item['id'] + '" id="_ess_module_' + item['id'] +'"><label for="_ess_module_' + item['id'] + '">' + item['name'] + '</label><br>');
|
||||
});
|
||||
console.log(msg);
|
||||
toLoad++;
|
||||
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail (function() {
|
||||
console.log('No response received from API!');
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
77
script/common.js
Normal file
77
script/common.js
Normal file
@ -0,0 +1,77 @@
|
||||
function GeneralLoadErrorText() {
|
||||
return "Could not load data from the server in a timely manner. Please try again or contact us";
|
||||
}
|
||||
|
||||
// click on search suggestion
|
||||
function displayItem (id) {
|
||||
document.location.href='/displayItem?pre=search&id=' + id;
|
||||
}
|
||||
|
||||
// display (or hide) search suggestions box
|
||||
function displaySuggestions (visibility) {
|
||||
console.log('(un)hiding suggestion');
|
||||
if (visibility == 0 && $('#SuggestionsCnt').is(':visible')) {
|
||||
$('#SuggestionsCnt').hide();
|
||||
}
|
||||
else if (visibility == 1 && $('#SuggestionsCnt').is(':hidden')) {
|
||||
$('#SuggestionsCnt').show();
|
||||
}
|
||||
}
|
||||
|
||||
// bold their text inside returned data (label / name)
|
||||
function highlight (text, what)
|
||||
{
|
||||
return text.replace( new RegExp( '(' + what + ')', 'gi' ), "<strong>$1</strong>" );
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
|
||||
// search suggestions
|
||||
$('#q').keyup(function () {
|
||||
$.ajax ({
|
||||
method: "POST",
|
||||
url: API_URL,
|
||||
data: {
|
||||
w: 'search_suggestions',
|
||||
txt: $('#q').val()
|
||||
}
|
||||
})
|
||||
.done (function (msg) {
|
||||
console.log(msg);
|
||||
|
||||
if (msg == '') {
|
||||
displaySuggestions(0);
|
||||
}
|
||||
else {
|
||||
// if everything is OK
|
||||
if (msg['status'] == "200") {
|
||||
// we received assoc json with id, name, label, block.
|
||||
var suggestions = "";
|
||||
|
||||
for (let i = 0; i < msg['data'].length; i++) {
|
||||
|
||||
suggestions += '<div><a onclick="displayItem(\''
|
||||
+ msg['data'][i]['id'] + '\');">'
|
||||
+ highlight(msg['data'][i]['name'], $('#q').val()) + ': '
|
||||
+ highlight(msg['data'][i]['label'], $('#q').val())
|
||||
+ '</a></div>';
|
||||
}
|
||||
|
||||
$('#SuggestionsCnt').html('<div id="Suggestions">' + suggestions + '</div>');
|
||||
|
||||
if (suggestions.length > 0) {
|
||||
displaySuggestions(1);
|
||||
}
|
||||
else {
|
||||
displaySuggestions(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.log(msg);
|
||||
displaySuggestions(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
2
script/jquery-3.6.0.min.js
vendored
Normal file
2
script/jquery-3.6.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
script/jquery.min.js
vendored
Normal file
2
script/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
settings.php
Normal file
4
settings.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$API_URL="http://biblio/api/api.php";
|
||||
header("Access-Control-Allow-Origin: http://biblio_backend/api/api.php");
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user