define('DIR_TEMP', '/var/www/html/sites/default/files/civicrm/lp/tmp');
define('BIN_LPSTAT', '/usr/bin/lpstat');
+exec ("/bin/bash /var/www/civicrm_custom/extensions/org.fsf.lp/update.sh");
+
class CRM_Lp_Page_Greeter extends CRM_Core_Page {
function getTable($data) {
$output = '';
- $output .= '<table>';
+ $output .= '<table style="max-width:500px">';
$output .= '<tr><th>File</th><th>Status</th><th>Actions</th></tr>';
foreach($data as $item) {
$status = $this->checkStatus($item);
- $output .= '<tr>';
+ $output .= '<tr style="border-bottom:1px solid #ddd">';
$output .= '<td><a href="/civicrm/lp-admin?gfile='.$item.'">'.$item.'</a></td><td>'.$status['status'];
if(array_key_exists('printer', $status)) $output .= ' ('.$status['printer'].' #'.$status['jid'].')';
$output .= '</td><td><a href="/civicrm/lp-admin?file='.$item.'">Print</a>';
function printFile($file) {
$dir = $_SESSION['mode'] == 'history' ? DIR_STORE : DIR_SPOOL;
- $lph = popen('lp -d '.$_SESSION['printer'].' '.$dir.'/'.$file, 'r');
+ #quidam this fixes issues with unusual fonts
+ popen("/usr/bin/pdftops $dir/$file $dir/$file.ps", 'r');
+ $lph = popen('/usr/bin/lp -d '.$_SESSION['printer'].' '.$dir.'/'.$file.'.ps', 'r');
$data = fgets($lph);
$words = str_word_count($data, 1, '0123456789-_');
$tfh = fopen(DIR_TEMP.'/'.$file.'.dat', 'w');
fwrite($tfh, $jid."\n");
fclose($tfh);
+ popen("/bin/rm $dir/$file.ps", 'r');
}
/* FIXME: Use civicrm session functions */