forked from GerardWassink/gawspool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gawspcla.php
87 lines (73 loc) · 3.6 KB
/
gawspcla.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/* ------------------------------------------------------------------------ *
* Program : classa.php
* Author : Gerard Wassink
* Date : January 2019
*
* Function : Show files in an output directory
*
* ------------------------------------------------------------------------ *
* GNU LICENSE CONDITIONS
* ------------------------------------------------------------------------ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* ------------------------------------------------------------------------ *
* Copyright (C) 2019 Gerard Wassink
* ------------------------------------------------------------------------ */
$path = "./classa"; /* --- directory for class A output --- */
$patt = "*.pdf"; /* --- Search pattern --- */
$srchfor = $path."/".$patt;
$files = array_diff(glob($srchfor), array('.', '..')); /* --- get file names - */
include 'gawsphdr.php';
print "<h1>class A output queue</h1>"; /* --- Create headers --- */
print "<table border='0'>"; /* --- Start of table --- */
print "<tr bgcolor='#1a5ab3'><th> # </th><th>jobnum</th><th>jobname</th><th>purge</th></tr>";
$num = 1; /* --- sequence number --- */
foreach($files as $filename) { /* --- cycle thru file names--- */
$filename = basename($filename);
$parts = explode("-", $filename); /* --- split filename and get-- */
$jobnum = $parts[0]; /* --- the jobnumber --- */
$jobnam = explode(".", $parts[1])[0]; /* --- and the jobname --- */
/* --- check writability --- */
if ( is_writable($path."/".$filename) && is_file($path."/".$filename) ) {
$pur_txt = "<a href='./gawspurg.php?fn=" . $filename . "&jn=" . $jobnum . "'>purge</a>";
} else {
$pur_txt = "<a href='./gawspurg.php?fn=" . $filename . "&jn=" . $jobnum . "'>noauth</a>";
}
/* --- write table lines --- */
if ( $num % 2 ) { /* --- odd or even ? --- */
$bg = "#dddddd"; /* --- color for odd numbers--- */
} else {
$bg = "#ffffff"; /* --- color for even number--- */
}
/* --- print every line --- */
print "<tr bgcolor='" . $bg . "'>"; /* --- row header --- */
print "<td align='center'>" . $num . "</td>"; /* --- Sequence number --- */
print "<td align='center'>"; /* --- print --- */
print "<a href='" . $path."/".$filename . "' target='_blank'>"; /* jobnumber*/
print $jobnum . "</a></td>"; /* --- and create link for viewing */
print "<td align='left' >" . $jobnam . "</td>"; /* --- Job name --- */
print "<td align='center'>" . $pur_txt . "</td>"; /* --- Can we purge? --- */
print "</tr>"; /* --- End of row --- */
$num++; /* --- next line --- */
}
print "</table>"; /* --- End of table --- */
print "<h3>Usage:</h3>";
print "<ul>";
print "<li>Click on jobnumber to view the job in a seperate window</li>";
print "<li>Click on 'purge' to purge the job</li>";
print "</ul>";
include 'gawspftr.php';
?>