+
pl)) { echo $this->pl->getName(); } ?>
+
pl)) { echo $this->pl->getLength(); } ?>
+
+ pl)) {
+
+ echo '
';
+ echo '';
+ echo 'Title';
+ echo 'Creator';
+ echo 'Playlength';
+ echo '
';
+
+ echo '
';
+
+ if (count($this->pl->getContents())) {
+ echo $this->partialLoop('sideplaylist/sidebarcontent.phtml', $this->pl->getContents());
+ }
+ else {
+ echo '- Empty playlist
';
+ }
+
+ echo '
';
+ }
+ else {
+ echo '
No open playlist
';
+ }
+ ?>
+
+
diff --git a/application/views/scripts/sideplaylist/sidebarcontent.phtml b/application/views/scripts/sideplaylist/sidebarcontent.phtml
new file mode 100644
index 000000000..b9c57eac4
--- /dev/null
+++ b/application/views/scripts/sideplaylist/sidebarcontent.phtml
@@ -0,0 +1,14 @@
+
+
+
+
+
+ CcFiles['track_title'] ?>
+
+
+ CcFiles['artist_name'] ?>
+
+
+ cliplength ?>
+
+
diff --git a/application/views/scripts/sideplaylist/update.phtml b/application/views/scripts/sideplaylist/update.phtml
new file mode 100644
index 000000000..46231963f
--- /dev/null
+++ b/application/views/scripts/sideplaylist/update.phtml
@@ -0,0 +1,7 @@
+pl->getContents())) {
+ echo $this->partialLoop('sideplaylist/sidebarcontent.phtml', $this->pl->getContents());
+}
+else {
+ echo '
Empty playlist';
+}
diff --git a/public/js/campcaster/library/library.js b/public/js/campcaster/library/library.js
index 41ea59630..addd11204 100644
--- a/public/js/campcaster/library/library.js
+++ b/public/js/campcaster/library/library.js
@@ -15,11 +15,10 @@ function contextMenu(action, el, pos) {
}
function deleteItem(json){
- var j = jQuery.parseJSON(json),
- id;
+ var id;
- if(j.error !== undefined) {
- alert(j.error.message);
+ if(json.message) {
+ alert(j.message);
return;
}
@@ -28,12 +27,18 @@ function deleteItem(json){
}
function addToPlaylist(json){
- var j = jQuery.parseJSON(json);
-
- if(j.error !== undefined) {
- alert(j.error.message);
+
+ if(json.message) {
+ alert(json.message);
return;
- }
+ }
+
+ $('#spl_name').empty()
+ .append(json.name);
+ $('#spl_length').empty()
+ .append(json.length);
+ $('#spl_sortable').empty()
+ .append(json.html);
}
function setLibraryContents(data){
@@ -45,6 +50,53 @@ function setLibraryContents(data){
);
}
+//--------------------------------------------------------------------------------------------------------------------------------
+//Side Playlist Functions
+//--------------------------------------------------------------------------------------------------------------------------------
+
+function setSPLContent(json) {
+
+ $('#spl_name').empty()
+ .append(json.name);
+ $('#spl_length').empty()
+ .append(json.length);
+ $('#spl_sortable').empty()
+ .append(json.html);
+}
+
+function deleteSPLItem(){
+
+ var url, pos;
+
+ url = '/Playlist/delete-item/format/json/view/spl';
+
+ pos = $('form[name="SPL"]').find(':checked').not('input[name="all"]').map(function() {
+ return "/pos/" + $(this).attr('name');
+ }).get().join("");
+
+ url = url + pos;
+
+ $.post(url, setSPLContent);
+}
+
+function moveSPLItem(event, ui) {
+ var li, newPos, oldPos, url;
+
+ li = ui.item;
+
+ newPos = li.index();
+ oldPos = li.attr('id').split("_").pop();
+
+ url = '/Playlist/move-item'
+ url = url + '/format/json';
+ url = url + '/view/spl';
+ url = url + '/oldPos/' + oldPos;
+ url = url + '/newPos/' + newPos;
+
+ $.post(url, setSPLContent);
+}
+
+
$(document).ready(function() {
$("#library_display tr:first-child span.title").data({'ob': 'dc:title', 'order' : 'asc'});
@@ -78,4 +130,12 @@ $(document).ready(function() {
{menu: 'myMenu'}, contextMenu
);
+ $("#spl_sortable").sortable();
+ $("#spl_sortable" ).bind( "sortstop", moveSPLItem);
+ $("#spl_remove_selected").click(deleteSPLItem);
+
+ $('input[name="all"]').click(function(){
+ $('form[name="SPL"]').find('input').attr("checked", $(this).attr("checked"));
+ });
+
});
diff --git a/public/js/campcaster/playlist/playlist.js b/public/js/campcaster/playlist/playlist.js
index 113e400c0..901b25a97 100644
--- a/public/js/campcaster/playlist/playlist.js
+++ b/public/js/campcaster/playlist/playlist.js
@@ -192,11 +192,14 @@ function addTextInput(){
}
-function setPLContent(html) {
- var ul = $("#pl_sortable");
-
- ul.empty();
- ul.append(html);
+function setPLContent(json) {
+
+ $('#pl_name').empty()
+ .append(json.name);
+ $('#pl_length').empty()
+ .append(json.length);
+ $('#pl_sortable').empty()
+ .append(json.html);
$(".pl_time").click(addTextInput);
}
@@ -205,7 +208,7 @@ function deletePLItem(){
var url, pos;
- url = '/Playlist/delete-item/format/html';
+ url = '/Playlist/delete-item/format/json/view/pl';
pos = $('form[name="PL"]').find(':checked').not('input[name="all"]').map(function() {
return "/pos/" + $(this).attr('name');
@@ -225,7 +228,8 @@ function movePLItem(event, ui) {
oldPos = li.attr('id').split("_").pop();
url = '/Playlist/move-item'
- url = url + '/format/html';
+ url = url + '/format/json';
+ url = url + '/view/pl';
url = url + '/oldPos/' + oldPos;
url = url + '/newPos/' + newPos;
diff --git a/tests/application/controllers/SidePlaylistControllerTest.php b/tests/application/controllers/SidePlaylistControllerTest.php
new file mode 100644
index 000000000..c9f3c9040
--- /dev/null
+++ b/tests/application/controllers/SidePlaylistControllerTest.php
@@ -0,0 +1,20 @@
+