fixing small bug
This commit is contained in:
@@ -59,7 +59,7 @@
|
|||||||
<option selected value="not_set">Bitte wähle einen Drucker</option>
|
<option selected value="not_set">Bitte wähle einen Drucker</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<a style="cursor: pointer" onclick="start_upload(1)" class="btn btn-primary">Drucken</a>
|
<a style="cursor: pointer" onclick="start_upload(1)" class="btn btn-secondary">Drucken</a>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
const option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
option.value = item.id;
|
option.value = item.id;
|
||||||
if(item.free==0){
|
if(item.free==1){
|
||||||
option.textContent = `Drucker ${item.id} - ${item.color}`;
|
option.textContent = `Drucker ${item.id} - ${item.color}`;
|
||||||
}else{
|
}else{
|
||||||
option.textContent = `Drucker ${item.id} - ${item.color} - Warteschlange`;
|
option.textContent = `Drucker ${item.id} - ${item.color} - Warteschlange`;
|
||||||
@@ -101,6 +101,7 @@
|
|||||||
.catch(error => console.error("Error fetching data:", error));
|
.catch(error => console.error("Error fetching data:", error));
|
||||||
});
|
});
|
||||||
async function start_upload(use_checks){
|
async function start_upload(use_checks){
|
||||||
|
document.getElementById("close_progress_modal2").click();
|
||||||
//main function handles the steps from user pressing upload button via checking params to starting job via api
|
//main function handles the steps from user pressing upload button via checking params to starting job via api
|
||||||
//we have a modal that shows progress to the user
|
//we have a modal that shows progress to the user
|
||||||
document.getElementById("close_progress_modal").style.display = "none";
|
document.getElementById("close_progress_modal").style.display = "none";
|
||||||
@@ -110,8 +111,7 @@
|
|||||||
"Datei auf System0 Hochladen",
|
"Datei auf System0 Hochladen",
|
||||||
"Nach Reservationskonflikten suchen",
|
"Nach Reservationskonflikten suchen",
|
||||||
"Nach Invaliden Druckeinstellungen suchen",
|
"Nach Invaliden Druckeinstellungen suchen",
|
||||||
"Job an Drucker senden",
|
"Job an Drucker senden"
|
||||||
"Fertig!"
|
|
||||||
];
|
];
|
||||||
let progressContent = document.getElementById("progressContent");
|
let progressContent = document.getElementById("progressContent");
|
||||||
progressContent.innerHTML = ""; // Clear previous content
|
progressContent.innerHTML = ""; // Clear previous content
|
||||||
@@ -185,21 +185,27 @@
|
|||||||
status=await start_job();
|
status=await start_job();
|
||||||
if(status==0){
|
if(status==0){
|
||||||
finish_step(4,progressContent,steps);
|
finish_step(4,progressContent,steps);
|
||||||
add_step(5,progressContent,steps);
|
//add_step(5,progressContent,steps);
|
||||||
finish_step(5,progressContent,steps);
|
//finish_step(5,progressContent,steps);
|
||||||
add_success("Job erfolgreich gestartet",progressContent);
|
add_success("Job erfolgreich gestartet",progressContent);
|
||||||
|
}else if(status==2){
|
||||||
|
finish_step(4,progressContent,steps);
|
||||||
|
//add_step(5,progressContent,steps);
|
||||||
|
//finish_step(5,progressContent,steps);
|
||||||
|
add_success("Job erfolgreich an Warteschlange gesendet",progressContent);
|
||||||
}else{
|
}else{
|
||||||
add_error("Fehler beim starten des Jobs. "+global_error, progressContent);
|
add_error("Fehler beim starten des Jobs. "+global_error, progressContent);
|
||||||
cancel_step(4,progressContent,steps);
|
cancel_step(4,progressContent,steps);
|
||||||
show_close_button();
|
show_close_button();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
show_close_button();
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_circumvent_link(progressContent) {
|
function add_circumvent_link(progressContent) {
|
||||||
let stepHtml = `
|
let stepHtml = `
|
||||||
<div>
|
<div>
|
||||||
<a onclick="start_upload(0);" target="_blank" class="step-link">Drücke hier, um alle überprüfungen zu umgehen</a>
|
<a onclick="start_upload(0);" style="cursor:pointer" target="_blank" class="step-link">Drücke hier, um alle überprüfungen zu umgehen</a>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -352,7 +358,7 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
<!-- progress modal -->
|
<!-- progress modal -->
|
||||||
<div class="modal fade" id="progressModal" tabindex="1" data-bs-backdrop="static" data-bs-keyboard="false" role="dialog" aria-labelledby="progressModalLabel" aria-hidden="false">
|
<div class="modal fade" id="progressModal" tabindex="-1" data-bs-backdrop="static" data-bs-keyboard="false" role="dialog" aria-labelledby="progressModalLabel" aria-hidden="false">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
include "../../config/config.php";
|
include "../../config/config.php";
|
||||||
//if printer is ready, upload to printer, else upload to queue
|
//if printer is ready, upload to printer, else upload to queue
|
||||||
//return 0 if success, else return any int
|
//return 0 if success, else return any int
|
||||||
$printer_id=intval($_GET["printer_id"]);
|
$printer_id=intval($_GET["printer"]);
|
||||||
//check if printer is ready
|
//check if printer is ready
|
||||||
$sql="select printer_url, free, system_status,apikey,printer_url from printer where id=$printer_id";
|
$sql="select printer_url, free, system_status,apikey,printer_url from printer where id=$printer_id";
|
||||||
$stmt = mysqli_prepare($link, $sql);
|
$stmt = mysqli_prepare($link, $sql);
|
||||||
@@ -22,12 +22,13 @@
|
|||||||
$result=1;
|
$result=1;
|
||||||
$username=$_SESSION["username"];
|
$username=$_SESSION["username"];
|
||||||
$userid=$_SESSION["id"];
|
$userid=$_SESSION["id"];
|
||||||
|
|
||||||
if($free==1 && $status==0){
|
if($free==1 && $status==0){
|
||||||
//upload to printer
|
//upload to printer
|
||||||
exec('curl -k -H "X-Api-Key: '.$apikey.'" -F "select=true" -F "print=true" -F "file=@'.$path.'" "'.$printer_url.'/api/files/local" > /var/www/html/user_files/'.$username.'/json.json');
|
exec('curl -k -H "X-Api-Key: '.$apikey.'" -F "select=true" -F "print=true" -F "file=@'.$path.'" "'.$printer_url.'/api/files/local" > /var/www/html/user_files/'.$username.'/json.json');
|
||||||
$fg=file_get_contents("/var/www/html/user_files/$username/json.json");
|
$fg=file_get_contents("/var/www/html/user_files/$username/json.json");
|
||||||
$json=json_decode($fg,true);
|
$json=json_decode($fg,true);
|
||||||
if($json['effectivePrint']==false or $json["effectiveSelect"]==false)
|
if($json['effectivePrint']!=true or $json["effectiveSelect"]!=true)
|
||||||
{
|
{
|
||||||
$result=1;
|
$result=1;
|
||||||
}
|
}
|
||||||
@@ -47,7 +48,7 @@
|
|||||||
mysqli_stmt_bind_param($stmt, "isi", $userid,$path,$printer_id);
|
mysqli_stmt_bind_param($stmt, "isi", $userid,$path,$printer_id);
|
||||||
mysqli_stmt_execute($stmt);
|
mysqli_stmt_execute($stmt);
|
||||||
mysqli_stmt_close($stmt);
|
mysqli_stmt_close($stmt);
|
||||||
$result=0;
|
$result=2;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
//error
|
//error
|
||||||
|
|||||||
Reference in New Issue
Block a user