diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-01-02 19:14:37 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-01-02 19:14:37 +0000 |
commit | cd4d2d79166c4f6d42fe021abec921bfeed7a906 (patch) | |
tree | 9bd87ee11641f25b9e762fb54266fb7f69a9097a /templates/show_mpdplay.inc | |
parent | dac2f19d709403be00af5ded76030f9edb44b9c1 (diff) | |
download | ampache-cd4d2d79166c4f6d42fe021abec921bfeed7a906.tar.gz ampache-cd4d2d79166c4f6d42fe021abec921bfeed7a906.tar.bz2 ampache-cd4d2d79166c4f6d42fe021abec921bfeed7a906.zip |
first wave of ajax
Diffstat (limited to 'templates/show_mpdplay.inc')
-rw-r--r-- | templates/show_mpdplay.inc | 138 |
1 files changed, 84 insertions, 54 deletions
diff --git a/templates/show_mpdplay.inc b/templates/show_mpdplay.inc index 84d95bd2..226a8fb6 100644 --- a/templates/show_mpdplay.inc +++ b/templates/show_mpdplay.inc @@ -33,41 +33,70 @@ global $condPL; ?> <div align="center"> +<!-- MPD Control table --> <table border="0" cellpadding="3" cellspacing="0" class="tabledata"> -<tr class="table-header"> + <tr class="table-header"> <td colspan="2"><?php echo _("MPD Play Control"); ?></td> -</tr> -<tr class="even"><td> - <table border="0" cellpadding="0" cellspacing="0" width="100%"> - <tr> - <td> + </tr> + <tr class="even"><td> + <table border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr> + <td> + <?php ${$myMpd->state} = "'selected_button'"; ?> + +<?php +if (true) /* rigged to do AJAX for now; change to conf('AJAX') later*/ { +?> +<!-- <input type="button" class="unselected_button" value="times" onclick="timestuff();"/> --> + <input type="button" class="unselected_button" value="|< " onclick="startRequest('action=Prev');"/> + <input type="button" class=<?php echo ($stop ? "selected_button" : "unselected_button") ?> id="stop_button" value=" X " onclick="startRequest('action=stop');"/> + <input type="button" class=<?php echo ($play ? "selected_button" : "unselected_button") ?> id="play_button" value=" > " onclick="startRequest('action=play');"/> + <input type="button" class=<?php echo ($pause ? "selected_button" : "unselected_button") ?> id="pause_button" value=" | | " onclick="startRequest('action=pause');"/> + <input type="button" class="unselected_button" value=" >|" onclick="startRequest('action=Next');"/> <?php - ${$myMpd->state} = "style=\"background-color: black;color:white;\""; +} +else { ?> <form action="<?php echo $web_path; ?>/amp-mpd.php" method="post" name="playcontrol" style="display:inline; white-space: nowrap"> - <input class="button" type="submit" title="<?php echo _("Prev"); ?>" name="action" value="|< " /> - <input class="button" type="submit" title="<?php echo _("Stop"); ?>" name="action" value=" X " <?php echo $stop; ?> /> - <input class="button" type="submit" title="<?php echo _("Play"); ?>" name="action" value=" > " <?php echo $play; ?> /> - <input class="button" type="submit" title="<?php echo _("Pause"); ?>" name="action" value=" | | " <?php echo $pause; ?> /> - <input class="button" type="submit" title="<?php echo _("Next"); ?>" name="action" value= " >|" /> + <!-- these used to have class="button" --> + <input type="submit" title="<?php echo _("Prev"); ?>" name="action" value="|< " /> + <input type="submit" title="<?php echo _("Stop"); ?>" name="action" value=" X " <?php echo $stop; ?> /> + <input type="submit" title="<?php echo _("Play"); ?>" name="action" value=" > " <?php echo $play; ?> /> + <input type="submit" title="<?php echo _("Pause"); ?>" name="action" value=" | | " <?php echo $pause; ?> /> + <input type="submit" title="<?php echo _("Next"); ?>" name="action" value= " >|" /> </form> - </td> -</tr> -<tr><td class="content"> - Volume: <b><?php echo $myMpd->volume ?>%</b> -</td></tr> - - <tr><td class="content" align="center"> +<?php } ?> + </td> + </tr> + <tr><td class="content"> Volume: <b><span name='volume' id='volume'><?php echo $myMpd->volume ?></span>%</b> + </td> + </tr> + + <tr><td class="content" align="center"> +<?php +if (true) /* rigged to do AJAX for now; change to conf('AJAX') later */ { +?> +<input type="button" value="0" onclick="startRequest('action=setvol¶m1=0');"/> +<input type="button" value="-25" onclick="startRequest('action=adjvol¶m1=-25');"/> +<input type="button" value="-10" onclick="startRequest('action=adjvol¶m1=-10');"/> +<input type="button" value="+10" onclick="startRequest('action=adjvol¶m1=10');"/> +<input type="button" value="+25" onclick="startRequest('action=adjvol¶m1=25');"/> +<?php +} +else { +?> [<a href="<?php echo $web_path; ?>/amp-mpd.php?action=setvol&val=0">mute</a> <a href="<?php echo $web_path; ?>/amp-mpd.php?action=adjvol&val=-25">-25</a> <a href="<?php echo $web_path; ?>/amp-mpd.php?action=adjvol&val=-10">-10</a> <a href="<?php echo $web_path; ?>/amp-mpd.php?action=adjvol&val=+10">+10</a> - <a href="<?php echo $web_path; ?>/amp-mpd.php?action=adjvol&val=+25">+25</a>] - </td></tr> -<tr><td> -</td></tr> -<tr> - <td> + <a href="<?php echo $web_path; ?>/amp-mpd.php?action=adjvol&val=+25">+25</a>] '; +<?php +} +?> + </td> + </tr> + <tr> + <td> <?php echo _("Loop"); ?>: <form action="<?php echo $web_path; ?>/amp-mpd.php?action=loop" method="post" name="repeatcontrol" style="display:inline;"> <?php @@ -78,35 +107,31 @@ global $condPL; <input class="button" type="submit" title="<?php echo _("On"); ?>" name="val" value="On" <?php echo $repeat_1; ?> /> <input class="button" type="submit" title="<?php echo _("Off"); ?>" name="val" value="Off" <?php echo $repeat_0; ?> /> </form> - </td> -</tr> -<tr> - <td> + </td> + </tr> + <tr> + <td> <?php echo _("Random"); ?>: - <form action="<?php echo $web_path; ?>/amp-mpd.php?action=random" method="post" name="randomcontrol" style="display:inline;"> + <form action="<?php echo $web_path; ?>/amp-mpd.php?action=random" method="post" name="randomcontrol" style="display:inline;"> <?php $random_name = "random_" . intval($myMpd->random); ${$random_name} = "style=\"background-color: black;color:white;\""; ?> <input class="button" type="submit" title="<?php echo _("On"); ?>" name="val" value="On" <?php echo $random_1; ?> /> <input class="button" type="submit" title="<?php echo _("Off"); ?>" name="val" value="Off" <?php echo $random_0; ?> /> - </form> - </td> -</tr> -<tr> - <td class="content"> - - </td> -</tr> -</table> -</td></tr> + </form> + </td> + </tr> + <tr><td class="content"> </td></tr> + </table> + </td></tr> -<?php if ( $myMpd->state == MPD_STATE_PLAYING or $myMpd->state == MPD_STATE_PAUSED ) { ?> - <tr><td> - <table border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr><td> + <table id="mpd_np" <?php if ( $myMpd->state == "stop" or $myMpd->state == "pause" ) {echo 'class="nodisplay"'; } ?> + border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> - <td class="npsong"><b><?php echo _("Now Playing :")?></b></td> + <td class="npsong"><b><?php echo _("Now Playing :")?></b></td> </tr> <tr> <td align="center" class="npsong"><?php @@ -117,17 +142,22 @@ global $condPL; $myMpd->playlist[($myMpd->current_track_id)]['Artist'] = $r->get_artist_name(); $myMpd->playlist[($myMpd->current_track_id)]['Album'] = $r->get_album_name(); } - + echo "<span id='mpd_npinfo'>"; echo ($myMpd->current_track_id+1). ". ".$myMpd->playlist[$myMpd->current_track_id]['Artist']. " - ".$myMpd->playlist[$myMpd->current_track_id]['Title']. " - ".$myMpd->playlist[$myMpd->current_track_id]['Album']. - " - ".fmt_time($myMpd->playlist[$myMpd->current_track_id]['Time']) - ?></td> + " - ".fmt_time($myMpd->playlist[$myMpd->current_track_id]['Time']); + echo "</span>"; + ?> + </td> </tr> - <tr> - <td align="center" class="npsong"><span id="mpd_cur_track_pos"><?php echo fmt_time($myMpd->current_track_position)?></span> (<?php echo (round(($myMpd->current_track_position/$myMpd->current_track_length),2)*100)."%) played" ?></td> - </tr> + <tr> + <td align="center" class="npsong"> + <span id="mpd_cur_track_pos"><?php echo fmt_time($myMpd->current_track_position)?></span> + (<span id="mpd_pctplayed"><?php echo (round(($myMpd->current_track_position/$myMpd->current_track_length),2)*100)."</span>%) played" ?> + </td> + </tr> <tr> <td><b><?php echo _("On Deck ")?><?php echo _("(in "). @@ -155,12 +185,12 @@ global $condPL; </tr> </table> </td></tr> -<?php } ?> </table> <?php -echo '<script language="JavaScript" type="text/javascript"> var mpd_elapsed = '. $myMpd->current_track_position.' </script>'; -echo '<script language="JavaScript" type="text/javascript"> var mpd_song_length = '. $myMpd->current_track_length .' </script>'; -echo '<script language="JavaScript" type="text/javascript"> var mpd_state = "'. $myMpd->state .'" </script>'; +echo '<script language="JavaScript" type="text/javascript"> var mpd_elapsed = '. $myMpd->current_track_position. + '; var mpd_song_length = '. $myMpd->current_track_length . + '; var mpd_songid = '.$myMpd->current_track_id. + '; var mpd_state = "'. $myMpd->state .'"; </script>'; ?> </div> |