function doTemplate($node) { global $jzUSER; $display =& new jzDisplay(); $smarty = mobileSmarty(); $jb = new jzJukebox(); if (!$jb->connect()) { //jzTemplate($smarty,'jukeboxError'); echo 'Error connecting to jukebox.'; return; } $smarty->assign('Play', word('Play')); $smarty->assign('Pause', word('Pause')); $smarty->assign('Stop', word('Stop')); $smarty->assign('Previous', word('Previous')); $smarty->assign('Next', word('Next')); $smarty->assign('Shuffle', word('Shuffle')); $smarty->assign('Clear', word('Clear')); /* buttons */ if (checkPermission($jzUSER, "jukebox_admin")) { $func = $jb->jbAbilities(); if ($func['playbutton']) { $smarty->assign('openPlayTag', $display->getOpenJukeboxActionTag('play')); } if ($func['pausebutton']) { $smarty->assign('openPauseTag', $display->getOpenJukeboxActionTag('pause')); } if ($func['stopbutton']) { $smarty->assign('openStopTag', $display->getOpenJukeboxActionTag('stop')); } if ($func['prevbutton']) { $smarty->assign('openPrevTag', $display->getOpenJukeboxActionTag('previous')); } if ($func['nextbutton']) { $smarty->assign('openNextTag', $display->getOpenJukeboxActionTag('next')); } if ($func['shufflebutton']) { $smarty->assign('openShuffleTag', $display->getOpenJukeboxActionTag('random_play')); } if ($func['clearbutton']) { $smarty->assign('openClearTag', $display->getOpenJukeboxActionTag('clear')); } if ($func['volume']) { $smarty->assign('Volume', word('Volume:')); $smarty->assign('volumeSteps', range(0, 100, 5)); $vol = $_SESSION['jz_jbvol-' . $_SESSION['jb_id']]; if (!isset($vol) || !is_numeric($vol)) { $vol = 0; } $smarty->assign('currentVolume', $vol); } if ($func['addtype']) { /* how to add media */ $smarty->assign('whereAdd', word('Add media:')); function jbHREF($type) { return "javascript:sendJukeboxRequest('addwhere','{$type}');"; } $set = array(); $set[] = array('href' => jbHREF('current'), 'label' => 'After current track', 'selected' => $_SESSION['jb-addtype'] == "current"); $set[] = array('href' => jbHREF('begin'), 'label' => 'At beginning of playlist', 'selected' => $_SESSION['jb-addtype'] == "begin"); $set[] = array('href' => jbHREF('end'), 'label' => 'At end of playlist', 'selected' => $_SESSION['jb-addtype'] == "end"); $set[] = array('href' => jbHREF('replace'), 'label' => 'Replace current playlist', 'selected' => $_SESSION['jb-addtype'] == "replace"); $smarty->assign('addTypes', $set); } } jzTemplate($smarty, 'jukebox'); }
} else { if ($_SESSION['jb_playwhere'] != 'quickbox') { $_SESSION['jb_playwhere'] = $jbArr[0]['description']; } } } $jb_playwhere = $_SESSION['jb_playwhere']; ?> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="jz_block_td" height="100%"> <tr> <td width="5%" valign="top" height="100%"> <nobr> <?php // Now let's create our Jukebox class and connect to it to make sure it works $jb = new jzJukebox(); if (!$jb->connect()) { echo "We had a problem connecting to the player, sorry this is a fatal error!<br><br>"; echo "Player Settings:<br>"; for ($i = 0; $i < count($jbArr); $i++) { if ($jbArr[$i]['description'] == $_SESSION['jb_playwhere']) { foreach ($jbArr[$i] as $setting => $value) { echo $setting . " - " . $value . "<br>"; } } } echo "<br>Please check these with your player's settings"; echo "<br>"; ?> Playback to:<br> <?php $arr = array();
/** * Creates a small version of the jukebox block. * * @author Ben Dodson * @since 4/29/05 * @version 4/29/05 * @param text: the text to display in the box. 'off' means no text. * @buttons: one of: "top|default|off". Top means toggle with the header text when applicable. **/ function smallJukebox($text = false, $buttons = "default", $linebreaks = true) { global $jbArr, $jzUSER, $include_path, $jukebox_display; if ($text == "") { $text = false; } $display = new jzDisplay(); include_once $include_path . "jukebox/class.php"; $jb = new jzJukebox(); if (!$jb->connect()) { echo '<strong>Error connecting to jukebox. Please make sure your jukebox settings are correct. (jukebox/settings.php)</strong>'; $jb_playwhere = ""; } else { if (isset($_SESSION['jb_playwhere'])) { $jb_playwhere = $_SESSION['jb_playwhere']; } else { $jb_playwhere = "stream"; } } $url_array = array(); $url_array['action'] = "popup"; $url_array['ptype'] = "jukezora"; ?> <script> sm_text = '<?php echo $text; ?> '; sm_buttons = '<?php echo $buttons; ?> '; sm_linebreaks = '<?php echo $linebreaks; ?> '; </script> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td width="100%" valign="top"> <?php $showText = true; if ($buttons == "top" && checkPermission($jzUSER, "jukebox_admin") === true && $_SESSION['jb_playwhere'] != "stream") { // Ok, now we need to make sure we can do things $func = $jb->jbAbilities(); echo "<nobr>"; if ($func['playbutton']) { $display->displayJukeboxButton("play"); $showText = false; } if ($func['pausebutton']) { $display->displayJukeboxButton("pause"); $showText = false; } if ($func['stopbutton']) { $display->displayJukeboxButton("stop"); $showText = false; } if ($func['nextbutton']) { $display->displayJukeboxButton("previous"); $showText = false; } if ($func['prevbutton']) { $display->displayJukeboxButton("next"); $showText = false; } if ($func['shufflebutton']) { //$display->displayJukeboxButton("random_play"); //$showText = false; } if ($func['clearbutton']) { $display->displayJukeboxButton("clear"); $showText = false; } echo "</nobr>"; } if ($showText) { ?> <?php if (isNothing($text)) { ?> <font size="1"> <strong> <?php if (checkPlayback() == "jukebox") { $theJWord = word("Jukebox"); } else { $theJWord = word("Playback"); } $display->popupLink("jukezora", $theJWord); if (checkPlayback() == "jukebox") { $jz_jbstatus = $jb->getPlayerStatus(); echo " - " . ucwords($jz_jbstatus); } ?> </strong> </font> <?php } else { if ($text != "off") { echo $text; } } ?> <?php } ?> </td> </tr> <tr> <td width="100%" valign="top"> <?php $arr = array(); $arr['action'] = "jukebox"; $arr['subaction'] = "jukebox-command"; $arr['command'] = "playwhere"; ?> <form action="<?php echo urlize($arr); ?> " method="POST" name="playbackForm"> <select name="jbplaywhere" id="smallJukeboxSelect" class="jz_select" style="width:132;" onChange="updateSmallJukebox()"> <?php if (checkPermission($jzUSER, 'stream')) { ?> <option value="stream">Stream</option> <?php } // Now let's get a list of all the jukeboxes that are installed for ($i = 0; $i < count($jbArr); $i++) { echo '<option '; if ($jb_playwhere == $jbArr[$i]['description']) { echo " selected "; } echo 'value="' . $jbArr[$i]['description'] . '">' . $jbArr[$i]['description'] . '</option>'; } ?> </select> </form> <?php if ($linebreaks) { echo '</td></tr><tr><td width="100%">'; } else { echo "   "; } if ($jb_playwhere != "stream" && checkPermission($jzUSER, "jukebox_admin") === true && $buttons == "default") { // Ok, now we need to make sure we can do things $func = $jb->jbAbilities(); echo "<nobr>"; if ($func['playbutton']) { $display->displayJukeboxButton("play"); } if ($func['pausebutton']) { $display->displayJukeboxButton("pause"); } if ($func['stopbutton']) { $display->displayJukeboxButton("stop"); } if ($func['nextbutton']) { $display->displayJukeboxButton("previous"); } if ($func['prevbutton']) { $display->displayJukeboxButton("next"); } if ($func['shufflebutton']) { //$display->displayJukeboxButton("random_play"); } if ($func['clearbutton']) { $display->displayJukeboxButton("clear"); } echo "</nobr>"; } ?> </td> </tr> </table> <?php }
/** * Draws the play controller for the Jukezora interface * * @author Ross Carlson * @version 01/21/05 * @since 01/21/05 */ function jukeboxBlock() { global $this_page, $media_dirs, $jbArr, $root_dir, $include_path; $display = new jzDisplay(); include_once $include_path . "jukebox/class.php"; if (!isset($_SESSION['jb_playwhere'])) { $_SESSION['jb_playwhere'] = "stream"; } $jb_playwhere = $_SESSION['jb_playwhere']; ?> <table width="100%" cellpadding="2" cellspacing="0" border="0" class="jz_block_td" height="100%"> <tr> <td width="50%" valign="top" height="100%"> <nobr> <?php // Now let's create our Jukebox class and connect to it to make sure it works $jb = new jzJukebox(); if (!$jb->connect()) { echo "We had a problem connecting to the player, sorry this is a fatal error!<br><br>"; echo "Player Settings:<br>"; for ($i = 0; $i < count($jbArr); $i++) { if ($jbArr[$i]['description'] == $_SESSION['jb_playwhere']) { foreach ($jbArr[$i] as $setting => $value) { echo $setting . " - " . $value . "<br>"; } } } echo "<br>Please check these with your player's settings"; echo "<br>"; ?> Playback to:<br> <?php $arr = array(); $arr['action'] = "jukebox"; $arr['subaction'] = "jukebox-command"; $arr['command'] = "playwhere"; ?> <form action="<?php echo urlize($arr); ?> " method="post"> <select name="jbplaywhere" class="jz_select" style="width:142;" onChange="submit()"> <option <?php if ($jb_playwhere == "stream") { echo " selected "; } ?> value="stream">Stream</option> <?php // Now let's get a list of all the jukeboxes that are installed for ($i = 0; $i < count($jbArr); $i++) { echo '<option '; if ($jb_playwhere == $jbArr[$i]['description']) { echo " selected "; } echo 'value="' . $jbArr[$i]['description'] . '">' . $jbArr[$i]['description'] . '</option>'; } ?> </select> </form> <?php return; } // Let's figure out where they are playing if (isset($_SESSION['jb_playwhere'])) { $jb_playwhere = $_SESSION['jb_playwhere']; } else { $jb_playwhere = ""; } $remain = $jb->getCurrentTrackRemaining() + 1; $jz_jbstatus = $jb->getPlayerStatus(); if ($jz_jbstatus != "playing") { $remain = 0; } if ($remain == 1) { $remain = 0; } if ($jb_playwhere != "stream") { // Ok, now we need to make sure we can do things $func = $jb->jbAbilities(); if ($func['playbutton']) { $display->displayJukeboxButton("play"); } if ($func['pausebutton']) { $display->displayJukeboxButton("pause"); } if ($func['stopbutton']) { $display->displayJukeboxButton("stop"); } if ($func['shufflebutton']) { $display->displayJukeboxButton("random_play"); } echo "<br>"; if ($func['nextbutton']) { $display->displayJukeboxButton("previous"); } if ($func['prevbutton']) { $display->displayJukeboxButton("next"); } if ($func['clearbutton']) { $display->displayJukeboxButton("clear"); } ?> <br> <?php if ($func['status']) { ?> Status: <?php echo ucwords($jz_jbstatus); ?> <br> <?php } ?> <?php if ($func['stats']) { $jb->returnJBStats(); echo '<br>'; } ?> <?php if ($func['progress']) { ?> Progress: <span id="timer"></span> <script> <!--// var loadedcolor='green' ; // PROGRESS BAR COLOR var unloadedcolor='lightgrey'; // BGCOLOR OF UNLOADED AREA var barheight=10; // HEIGHT OF PROGRESS BAR IN PIXELS var barwidth=120; // WIDTH OF THE BAR IN PIXELS var bordercolor='black'; // COLOR OF THE BORDER var waitTime=<?php echo $remain; ?> ; // NUMBER OF SECONDS FOR PROGRESSBAR --> </script> <script language="javascript" src="<?php echo $root_dir; ?> /jukebox/pbar.js"></script> <?php if ($jz_jbstatus == 'playing') { ?> <script> <!--// var seconds = <?php echo $jb->getCurrentTrackLocation(); ?> ; var time = ''; t = document.getElementById("timer"); function converTime(sec){ ctr=0; while (sec >= 60){ sec = sec - 60; ctr++; } if (ctr<0){ctr=0} if (sec<0){sec=0} if (sec < 10){ sec = "0" + sec; } return ctr + ":" + sec; } function display(){ seconds++ t.innerHTML = converTime(seconds) + "/" + "<?php echo convertSecMins($jb->getCurrentTrackLength()); ?> "; ctr=0; setTimeout("display()",1000) } display() --> </script> <?php } ?> <?php } ?> <?php if ($func['volume']) { ?> <?php $arr = array(); $arr['action'] = "jukebox"; $arr['subaction'] = "jukebox-command"; $arr['command'] = "volume"; $arr['frame'] = $_GET['frame']; ?> <form action="<?php echo urlize($arr); ?> " method="post"> <input type="hidden" name="action" value="jukebox"> <input type="hidden" name="subaction" value="jukebox-command"> <input type="hidden" name="command" value="volume"> <input type="hidden" name="frame" value="top"> <select name="jbvol" class="jz_select" style="width:120px;" onChange="submit()"> <?php $vol = ""; if (isset($_SESSION['jz_jbvol-' . $_SESSION['jb_id']])) { $vol = $_SESSION['jz_jbvol-' . $_SESSION['jb_id']]; } $c = 100; while ($c > 0) { echo '<option '; if ($c == $vol) { echo ' selected '; } echo 'value="' . $c . '">Volume ' . $c . '%</option>'; $c = $c - 10; } ?> <option value="0">Mute</option> </select> </form> <br> <?php } ?> <?php // This closes our if to see if we are streaming or not } ?> Playback to:<br> <?php $arr = array(); $arr['action'] = "jukebox"; $arr['subaction'] = "jukebox-command"; $arr['command'] = "playwhere"; $arr['frame'] = $_GET['frame']; ?> <form action="<?php echo urlize($arr); ?> " method="post"> <input type="hidden" name="action" value="jukebox"> <input type="hidden" name="subaction" value="jukebox-command"> <input type="hidden" name="command" value="playwhere"> <input type="hidden" name="frame" value="top"> <select name="jbplaywhere" class="jz_select" style="width:120px;" onChange="submit()"> <option <?php if ($jb_playwhere == "stream") { echo " selected "; } ?> value="stream">Stream</option> <?php // Now let's get a list of all the jukeboxes that are installed for ($i = 0; $i < count($jbArr); $i++) { echo '<option '; if ($jb_playwhere == $jbArr[$i]['description']) { echo " selected "; } echo 'value="' . $jbArr[$i]['description'] . '">' . $jbArr[$i]['description'] . '</option>'; } ?> </select> </form> <?php if ($jb_playwhere != "stream" and $func['addtype']) { ?> <br> Add type:<br> <?php // Now let's set the add type IF it hasn't been set if (!isset($_SESSION['jb-addtype'])) { $_SESSION['jb-addtype'] = "current"; } ?> <?php $arr = array(); $arr['action'] = "jukebox"; $arr['subaction'] = "jukebox-command"; $arr['command'] = "addwhere"; $arr['frame'] = $_GET['frame']; ?> <form action="<?php echo urlize($arr); ?> " method="post"> <input type="hidden" name="action" value="jukebox"> <input type="hidden" name="subaction" value="jukebox-command"> <input type="hidden" name="command" value="addwhere"> <select name="addplat" class="jz_select" style="width:142;" onChange="submit()"> <option <?php if ($_SESSION['jb-addtype'] == "current") { echo " selected "; } ?> value="current">At Current</option> <option <?php if ($_SESSION['jb-addtype'] == "end") { echo " selected "; } ?> value="end">At End</option> <option <?php if ($_SESSION['jb-addtype'] == "begin") { echo " selected "; } ?> value="begin">At Beginning</option> <option <?php if ($_SESSION['jb-addtype'] == "replace") { echo " selected "; } ?> value="replace">Replace</option> </select> </form> </nobr> <?php } ?> </td> <td width="50%" valign="top"> <?php // Let's make sure they aren't streaming if ($jb_playwhere == "stream") { return; } ?> <?php if ($func['nowplaying']) { ?> <nobr><?php echo word("Now Playing:"); ?> <br> <?php $curTrack = $jb->getCurrentTrackName(); if (strlen($curTrack) > 20) { $curTrack = substr($curTrack, 0, 20) . "..."; } echo ' ' . $curTrack . "</nobr>"; ?> <br> <?php } ?> <?php if ($func['nexttrack']) { ?> <nobr><?php echo word("Next Track:"); ?> <br> <?php // Now let's figure out the next track and clean it up $fullList = $jb->getCurrentPlaylist(); if (getCurPlayingTrack() + 1 < sizeof($fullList)) { $nextTrack = $fullList[getCurPlayingTrack() + 1]; } else { $nextTrack = '-'; } if (stristr($nextTrack, "/")) { $nArr = explode("/", $nextTrack); $nextTrack = $nArr[count($nArr) - 1]; } $nextTrack = str_replace(".mp3", "", $nextTrack); if (strlen($nextTrack) > 20) { $nextTrack = substr($nextTrack, 0, 20) . "..."; } echo ' ' . $nextTrack . "</nobr>"; ?> <br><br> <?php } ?> <?php if ($func['fullplaylist']) { ?> Complete Playlist <br> <?php // Now let's get the full playlist back $curTrackNum = $jb->getCurrentPlayingTrack(); ?> <?php $arr = array(); $arr['action'] = "jukebox"; $arr['subaction'] = "jukebox-command"; $arr['command'] = "jumpto"; ?> <form action="<?php echo urlize($arr); ?> " method="post"> <input type="hidden" name="action" value="jukebox"> <input type="hidden" name="subaction" value="jukebox-command"> <input type="hidden" name="command" value="jumpto"> <input type="hidden" name="frame" value="top"> <select name="jbjumpto" class="jz_select" size="5" style="width:165px;"<?php if ($func['jump']) { echo 'onChange="submit()"'; } ?> > <?php for ($i = 0; $i < count($fullList); $i++) { echo '<option value="' . $i . '"'; if ($curTrackNum == $i) { echo " selected "; } echo '>' . $fullList[$i] . '</option>'; } ?> </select> </form> <?php } ?> </td> </tr> </table> <?php }