Skip to content

Commit

Permalink
PDF tag print + other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketMan committed Jun 17, 2018
1 parent 457a1f4 commit 64b5069
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 58 deletions.
3 changes: 3 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# set php error reporting to E_ALL & ~E_NOTICE (=32759)
php_value error_reporting 32759

AddDefaultCharset UTF-8
php_value default_charset UTF-8

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^zkrss\.php$ index.php?target=rss [QSA,L]
Expand Down
4 changes: 2 additions & 2 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
/**
* supported print methods (0 or more of 'lpr', 'pdf')
*/
'print_methods' => ['lpr', 'pdf'],
'print_methods' => [ 'pdf' ],
/**
* lpr print queue name
*/
Expand All @@ -122,7 +122,7 @@
/**
* escape seq to switch to box drawing mode, if any (empty for UTF-8)
*/
'box_mode' => "\x1bt1\x1b6", // ESC+t+1 graphics mode, ESC+6 for GCS 2
'box_mode' => "",
],

/**
Expand Down
1 change: 1 addition & 0 deletions controllers/PrintTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function processRequest($dispatcher) {
$pdf->SetFont(self::FONT_FACE, '', self::FONT_SIZE);
$pdf->Set_Font_Size(self::LINE_SIZE);
$pdf->SetFontSize(self::FONT_SIZE);
$pdf->SetCreator("Zookeeper Online");
$pdf->AddPage();

$tags = explode(",", $_REQUEST["tags"]);
Expand Down
1 change: 0 additions & 1 deletion controllers/SSOLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public function processRequest($dispatcher) {

if($location) {
// external redirection requested
$rq["access"] = $access;
$target = $location;
} else
$target = UI::getBaseUrl();
Expand Down
3 changes: 3 additions & 0 deletions ui/3rdp/PDF_Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
// 1.4: + Page scaling is disabled in printing options
// 1.5: + Added 3422 format
// 1.6: + FPDF 1.8 compatibility
// 1.6.1: Zookeeper-specific changes:
// 1. use tFPDF (for unicode and ttf)
// 2. left-justify the label cells
//////////////////////////////////////////////////////////////////////////////

/**
Expand Down
18 changes: 14 additions & 4 deletions ui/Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,16 @@ public function queueConfirm($validate) {
foreach(explode(",", $_REQUEST["seltags"]) as $tag)
$this->emitHidden("tag".$tag, "on");
} else {
$selCount = $_REQUEST["selcount"];
foreach(explode(",", $_REQUEST["seltags"]) as $tag)
Engine::api(IEditor::class)->dequeueTag($tag, $this->session->getUser());
if($selCount-- > 0)
Engine::api(IEditor::class)->dequeueTag($tag, $this->session->getUser());
else
$this->emitHidden("tag".$tag, "on");
}
$this->skipVar("sel");
$this->skipVar("seltags");
$this->skipVar("selcount");
$this->skipVar("back");
$this->skipVar("done");
return $validate;
Expand All @@ -440,9 +445,14 @@ public function queueConfirm($validate) {

$selLabels = explode(",", $_REQUEST["sel"]);
$selTags = explode(",", $_REQUEST["seltags"]);
for($i=0, $j=0; $i<sizeof($selLabels); $i++)
if($selLabels[$i])
$selCount = 0;
for($i=0, $j=0; $i<sizeof($selLabels); $i++) {
if($selLabels[$i]) {
$selLabels[$i] = $selTags[$j++];
$selCount++;
}
}
$this->emitHidden("selcount", $selCount);
$merged = implode(",", $selLabels);
echo " <SCRIPT TYPE=\"text/javascript\" LANGUAGE=\"JavaScript\"><!--\n";
echo " window.open('?target=print&session=".$this->session->getSessionID()."&form=".self::LABEL_FORM_CODE."&tags=$merged', '_blank', 'toolbar=no,location=no,width=800,height=800');\n";
Expand Down Expand Up @@ -909,7 +919,7 @@ private function emitAlbumSel() {
<!--P ALIGN=CENTER-->
<INPUT TYPE=SUBMIT NAME=new CLASS=submit VALUE=" New ">&nbsp;
<INPUT TYPE=SUBMIT NAME=edit CLASS=submit VALUE=" Edit ">&nbsp; <?php
if(!empty($this->printConfig['print_methods']))
if(!empty($this->printConfig['print_methods']))

echo " <INPUT TYPE=SUBMIT NAME=print CLASS=submit VALUE=\" Print \">&nbsp;\n"; ?>
<!--/P-->
Expand Down
97 changes: 48 additions & 49 deletions ui/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ private function emitHeader() {
<LINK REL="alternate" TYPE="application/rss+xml" TITLE="<?php echo $station; ?> Radio Airplay Charts" HREF="zkrss.php?feed=charts">
<LINK REL="alternate" TYPE="application/rss+xml" TITLE="<?php echo $station; ?> Radio A-File Adds" HREF="zkrss.php?feed=adds">
<LINK REL="search" TYPE="application/opensearchdescription+xml" HREF="?target=opensearch" title="<?php echo $banner;?>">
</HEAD><?php
</HEAD>
<?php
}

private function emitNavbar($dispatcher, $action) {
Expand Down Expand Up @@ -161,55 +162,55 @@ private function emitBody($dispatcher) {
$urls = Engine::param('urls');
$station_full = Engine::param('station_full');
?>
<BODY onLoad="setFocus()">
<DIV CLASS="box">
<DIV CLASS="header">
<DIV CLASS="headerLogo">
<A HREF="<?php echo $urls['home']; ?>">
<IMG SRC="<?php echo Engine::param('logo'); ?>" ALT="<?php echo $station_full; ?>" TITLE="<?php echo $station_full; ?>">
</A>
</DIV>
<DIV CLASS="headerNavbar">
<SPAN>Music with a difference...</SPAN>
</DIV>
</DIV>
<?php
<BODY onLoad="setFocus()">
<DIV CLASS="box">
<DIV CLASS="header">
<DIV CLASS="headerLogo">
<A HREF="<?php echo $urls['home']; ?>">
<IMG SRC="<?php echo Engine::param('logo'); ?>" ALT="<?php echo $station_full; ?>" TITLE="<?php echo $station_full; ?>">
</A>
</DIV>
<DIV CLASS="headerNavbar">
<SPAN>Music with a difference...</SPAN>
</DIV>
</DIV>
<?php
echo " <DIV CLASS=\"leftNav\">\n";
$this->emitNavBar($dispatcher, $_REQUEST["action"]);
echo " </DIV>\n";
echo " <DIV CLASS=\"content\">\n";

$this->emitMain($dispatcher, $_REQUEST["action"], $_REQUEST["subaction"]);
?>
</DIV>
<DIV CLASS="footer">
<?php echo Engine::param('copyright'); ?><BR>
<A HREF="#about">Zookeeper Online &copy; 1997-2018 Jim Mason. All rights reserved.</A>
</DIV>
</DIV>
<DIV CLASS="lightbox" ID="about">
<DIV CLASS="lightbox-modal">
<DIV CLASS="close"><A HREF="#">[x]</A></DIV>
<DIV CLASS="body">
<P class="title">Zookeeper Online version 2.0.0</P>
<P>Zookeeper Online &copy; 1997-2018 Jim Mason &ltjmason@ibinx.com&gt;</P>
<P>This program is free software; you are welcome to redistribute it
under certain conditions. See the <A HREF="LICENSE.md" TARGET="_blank">LICENSE</A>
for details.</P>
<P><A HREF="https://zookeeper.ibinx.com/" TARGET="_blank">Zookeeper Online project homepage</A></P>
</DIV>
</DIV>
?>
</DIV>
<DIV CLASS="footer">
<?php echo Engine::param('copyright'); ?><BR>
<A HREF="#about">Zookeeper Online &copy; 1997-2018 Jim Mason. All rights reserved.</A>
</DIV>
</DIV>
<DIV CLASS="lightbox" ID="about">
<DIV CLASS="lightbox-modal">
<DIV CLASS="close"><A HREF="#">[x]</A></DIV>
<DIV CLASS="body">
<P class="title">Zookeeper Online version 2.0.0</P>
<P>Zookeeper Online &copy; 1997-2018 Jim Mason &ltjmason@ibinx.com&gt;</P>
<P>This program is free software; you are welcome to redistribute it
under certain conditions. See the <A HREF="LICENSE.md" TARGET="_blank">LICENSE</A>
for details.</P>
<P><A HREF="https://zookeeper.ibinx.com/" TARGET="_blank">Zookeeper Online project homepage</A></P>
</DIV>
</BODY>
</HTML>
</DIV>
</DIV>
</BODY>
</HTML>
<?php
}

private function emitLogin($invalid="") {
?>
?>
<FORM ACTION="?" METHOD=POST>
<TABLE CELLPADDING=2>
<?php
<?php
switch ($invalid) {
case "badCredentials":
if($this->session->isAuth("g"))
Expand All @@ -235,7 +236,7 @@ private function emitLogin($invalid="") {
echo " <TR><TD></TD><TD CLASS=\"sub\">AUTHORIZED USE ONLY!<BR>\n";
break;
}
?>
?>
<TR><TD COLSPAN=2>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD><TD>Enter your user name and password to login</TD></TR>
<TR><TD ALIGN=RIGHT>User:</TD>
Expand All @@ -253,7 +254,7 @@ private function emitLogin($invalid="") {
</TABLE>
<INPUT TYPE=HIDDEN NAME=action VALUE="loginValidate">
</FORM>
<?php
<?php
UI::setFocus("user");
}

Expand All @@ -271,15 +272,13 @@ private function emitLoginHelp() {
go to the <A HREF="?action=login">classic login</A> page and enter your
existing <?php echo Engine::param('application'); ?> user name and password.
<B>Classic login may be deprecated or restricted in future.</B></P>
<?php
<?php
}

private function emitLoginValidate() {
if($this->session->isAuth("u")) {
?>
<H3>login successful</H3>
<?php
if($this->session->isAuth("g"))
echo " <H3>login successful</H3>\n";
if($this->session->isAuth("g"))
echo " <P><B>IMPORTANT: This login can be used ONLY at the station.</B></P>\n";
Editor::emitQueueHook($this->session);
UI::setFocus();
Expand Down Expand Up @@ -388,9 +387,9 @@ private function doSSOOptionsPage() {
<FORM ACTION="?" METHOD=POST>
<P><INPUT TYPE="radio" NAME="account" VALUE="old" ID="oldRadio" onClick="showOld();">I already have a Zookeeper account and wish to use it</P>
<DIV ID="oldSect" style="display:none;margin-left:50px;">
<?php if($_REQUEST["user"]) { ?>
<?php if($_REQUEST["user"]) { ?>
<P><FONT CLASS="error">Invalid user or password</FONT></P>
<?php } ?>
<?php } ?>
<P>Enter your existing Zookeeper login</P>
<TABLE>
<TR><TD ALIGN=RIGHT>User:</TD>
Expand All @@ -417,13 +416,13 @@ function showNew() {
document.getElementById("oldSect").style.display = "none";
document.getElementById("newSect").style.display = "block"; }
function setFocus() {
<?php if($_REQUEST["user"]) { ?>
<?php if($_REQUEST["user"]) { ?>
document.getElementById("oldRadio").checked = true;
showOld();
<?php } ?>
<?php } ?>
}
// -->
</SCRIPT>
<?php
<?php
}
}
4 changes: 2 additions & 2 deletions ui/Reviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function viewRecentReviews() {
echo " <TR><TH ALIGN=LEFT>Album</TH><TH ALIGN=LEFT>Artist</TH><TH ALIGN=LEFT>Collection</TH><TH ALIGN=LEFT>Reviewed by</TH></TR>\n";
$results = Engine::api(IReview::class)->getRecentReviews("", 2);
$libAPI = Engine::api(ILibrary::class);
while($row = $results->fetch()) {
while($results && ($row = $results->fetch())) {
$albums = $libAPI->search(ILibrary::ALBUM_KEY, 0, 1, $row[0]);
$this->emitReviewRow($row, $albums);
}
Expand All @@ -97,7 +97,7 @@ public function viewRecentReviews() {
echo " <TR><TD COLSPAN=5>&nbsp;</TD></TR>\n";
echo "<TR><TH COLSPAN=5 CLASS=\"subhead\" ALIGN=LEFT>Your Most Recent Reviews</TH></TR>\n";
echo " <TR><TH ALIGN=LEFT>Album</TH><TH ALIGN=LEFT>Artist</TH><TH ALIGN=LEFT>Collection</TH><TH ALIGN=LEFT>Reviewed by</TH><TH>&nbsp;</TH></TR>\n";
while($row = $results->fetch()) {
while($results && ($row = $results->fetch())) {
$albums = $libAPI->search(ILibrary::ALBUM_KEY, 0, 1, $row[0]);
$this->emitReviewRow($row, $albums);
}
Expand Down

0 comments on commit 64b5069

Please sign in to comment.