partial('playlist/set-cue.phtml', array(
- 'pos' => $i,
+ 'id' => $item["id"],
'cueIn' => $item['cuein'],
'cueOut' => $item['cueout'],
'origLength' => $item["CcFiles"]['length'])); ?>
diff --git a/airtime_mvc/public/css/contextmenu/images/cut.png b/airtime_mvc/public/css/contextmenu/images/cut.png
new file mode 100755
index 000000000..f215d6f6b
Binary files /dev/null and b/airtime_mvc/public/css/contextmenu/images/cut.png differ
diff --git a/airtime_mvc/public/css/contextmenu/images/door.png b/airtime_mvc/public/css/contextmenu/images/door.png
new file mode 100755
index 000000000..369fc46ed
Binary files /dev/null and b/airtime_mvc/public/css/contextmenu/images/door.png differ
diff --git a/airtime_mvc/public/css/contextmenu/images/page_white_copy.png b/airtime_mvc/public/css/contextmenu/images/page_white_copy.png
new file mode 100755
index 000000000..a9f31a278
Binary files /dev/null and b/airtime_mvc/public/css/contextmenu/images/page_white_copy.png differ
diff --git a/airtime_mvc/public/css/contextmenu/images/page_white_delete.png b/airtime_mvc/public/css/contextmenu/images/page_white_delete.png
new file mode 100755
index 000000000..af1ecaf29
Binary files /dev/null and b/airtime_mvc/public/css/contextmenu/images/page_white_delete.png differ
diff --git a/airtime_mvc/public/css/contextmenu/images/page_white_edit.png b/airtime_mvc/public/css/contextmenu/images/page_white_edit.png
new file mode 100755
index 000000000..b93e77600
Binary files /dev/null and b/airtime_mvc/public/css/contextmenu/images/page_white_edit.png differ
diff --git a/airtime_mvc/public/css/contextmenu/images/page_white_paste.png b/airtime_mvc/public/css/contextmenu/images/page_white_paste.png
new file mode 100755
index 000000000..5b2cbb3fd
Binary files /dev/null and b/airtime_mvc/public/css/contextmenu/images/page_white_paste.png differ
diff --git a/airtime_mvc/public/css/contextmenu/jquery.contextMenu.css b/airtime_mvc/public/css/contextmenu/jquery.contextMenu.css
new file mode 100755
index 000000000..fc8d709f3
--- /dev/null
+++ b/airtime_mvc/public/css/contextmenu/jquery.contextMenu.css
@@ -0,0 +1,134 @@
+/*
+ * jQuery contextMenu - Plugin for simple contextMenu handling
+ *
+ * Version: 1.5.2
+ *
+ * Authors: Rodney Rehm, Addy Osmani (patches for FF)
+ * Web: http://medialize.github.com/jQuery-contextMenu/
+ *
+ * Licensed under
+ * MIT License http://www.opensource.org/licenses/mit-license
+ * GPL v3 http://opensource.org/licenses/GPL-3.0
+ *
+ */
+
+.context-menu-list {
+ margin:0;
+ padding:0;
+
+ min-width: 120px;
+ max-width: 250px;
+ display: inline-block;
+ position: absolute;
+ list-style-type: none;
+
+ border: 1px solid #DDD;
+ background: #EEE;
+
+ -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
+ -moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
+ -ms-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
+ -o-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
+
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 11px;
+}
+
+.context-menu-item {
+ padding: 2px 2px 2px 24px;
+ background-color: #EEE;
+ position: relative;
+ -moz-user-select: -moz-none;
+}
+
+.context-menu-separator {
+ padding-bottom:0;
+ border-bottom: 1px solid #DDD;
+}
+
+.context-menu-item > label {
+ -moz-user-select: text;
+}
+
+.context-menu-item.hover {
+ cursor: pointer;
+ background-color: #39F;
+}
+
+.context-menu-item.disabled {
+ color: #666;
+}
+
+.context-menu-input.hover,
+.context-menu-item.disabled.hover {
+ cursor: default;
+ background-color: #EEE;
+}
+
+.context-menu-submenu:after {
+ content: ">";
+ color: #666;
+ position: absolute;
+ top: 0;
+ right: 3px;
+ z-index: 1;
+}
+
+/* icons
+ #protip:
+ In case you want to use sprites for icons (which I would suggest you do) have a look at
+ http://css-tricks.com/13224-pseudo-spriting/ to get an idea of how to implement
+ .context-menu-item.icon:before {}
+ */
+.context-menu-item.icon { min-height: 18px; background-repeat: no-repeat; background-position: 4px 2px; }
+.context-menu-item.icon-edit { background-image: url(images/page_white_edit.png); }
+.context-menu-item.icon-cut { background-image: url(images/cut.png); }
+.context-menu-item.icon-copy { background-image: url(images/page_white_copy.png); }
+.context-menu-item.icon-paste { background-image: url(images/page_white_paste.png); }
+.context-menu-item.icon-delete { background-image: url(images/page_white_delete.png); }
+.context-menu-item.icon-quit { background-image: url(images/door.png); }
+
+/* vertically align inside labels */
+.context-menu-input > label > * { vertical-align: top; }
+
+/* position checkboxes and radios as icons */
+.context-menu-input > label > input[type="checkbox"],
+.context-menu-input > label > input[type="radio"] {
+ margin-left: -17px;
+}
+.context-menu-input > label > span {
+ margin-left: 5px;
+}
+
+.context-menu-input > label,
+.context-menu-input > label > input[type="text"],
+.context-menu-input > label > textarea,
+.context-menu-input > label > select {
+ display: block;
+ width: 100%;
+
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -ms-box-sizing: border-box;
+ -o-box-sizing: border-box;
+ box-sizing: border-box;
+}
+
+.context-menu-input > label > textarea {
+ height: 100px;
+}
+.context-menu-item > .context-menu-list {
+ display: none;
+ /* re-positioned by js */
+ right: -5px;
+ top: 5px;
+}
+
+.context-menu-item.hover > .context-menu-list {
+ display: block;
+}
+
+.context-menu-accesskey {
+ text-decoration: underline;
+}
diff --git a/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js
index 6ddcbb19d..a2aed00bc 100644
--- a/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js
+++ b/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js
@@ -27,7 +27,7 @@ function fnLibraryTableDrawCallback() {
},
*/
cursor: 'pointer',
- connectToSortable: '#side_playlist'
+ connectToSortable: '#spl_sortable'
});
}
diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js
index 9a63325a4..a7469073d 100644
--- a/airtime_mvc/public/js/airtime/library/spl.js
+++ b/airtime_mvc/public/js/airtime/library/spl.js
@@ -1,8 +1,9 @@
//--------------------------------------------------------------------------------------------------------------------------------
-//Side Playlist Functions
+// Playlist Functions
//--------------------------------------------------------------------------------------------------------------------------------
var AIRTIME = (function(AIRTIME){
+
AIRTIME.playlist = {};
var mod = AIRTIME.playlist;
@@ -20,6 +21,228 @@ var AIRTIME = (function(AIRTIME){
$(el).removeClass("ui-state-active");
}
+
+ function isTimeValid(time) {
+ var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$");
+
+ if (!regExpr.test(time)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ function showError(el, error) {
+ $(el).parent().next()
+ .empty()
+ .append(error)
+ .show();
+ }
+
+ function hideError(el) {
+ $(el).parent().next()
+ .empty()
+ .hide();
+ }
+
+ function changeCueIn(event) {
+ event.stopPropagation();
+
+ var id, url, cueIn, li, unqid;
+
+ span = $(this);
+ id = span.parent().attr("id").split("_").pop();
+ url = "/Playlist/set-cue";
+ cueIn = $.trim(span.text());
+ li = span.parent().parent().parent().parent();
+ unqid = li.attr("unqid");
+
+ if(!isTimeValid(cueIn)){
+ showError(span, "please put in a time '00:00:00 (.000000)'");
+ return;
+ }
+
+ $.post(url, {format: "json", cueIn: cueIn, id: id, type: event.type}, function(json){
+
+ if(json.response !== undefined && json.response.error) {
+ showError(span, json.response.error);
+ return;
+ }
+
+ setPlaylistContent(json);
+
+ li = $('#side_playlist li[unqid='+unqid+']');
+ li.find(".cue-edit").toggle();
+ highlightActive(li);
+ highlightActive(li.find('.spl_cue'));
+ });
+ }
+
+ function changeCueOut(event) {
+ event.stopPropagation();
+
+ var id, url, cueOut, li, unqid;
+
+ span = $(this);
+ id = span.parent().attr("id").split("_").pop();
+ url = "/Playlist/set-cue";
+ cueOut = $.trim(span.text());
+ li = span.parent().parent().parent().parent();
+ unqid = li.attr("unqid");
+
+ if(!isTimeValid(cueOut)){
+ showError(span, "please put in a time '00:00:00 (.000000)'");
+ return;
+ }
+
+ $.post(url, {format: "json", cueOut: cueOut, id: id}, function(json){
+
+ if(json.response !== undefined && json.response.error) {
+ showError(span, json.response.error);
+ return;
+ }
+
+ setPlaylistContent(json);
+
+ li = $('#side_playlist li[unqid='+unqid+']');
+ li.find(".cue-edit").toggle();
+ highlightActive(li);
+ highlightActive(li.find('.spl_cue'));
+ });
+ }
+
+ function changeFadeIn(event) {
+ event.stopPropagation();
+
+ var pos, url, fadeIn, li, unqid;
+
+ span = $(this);
+ pos = span.parent().attr("id").split("_").pop();
+ url = "/Playlist/set-fade";
+ fadeIn = $.trim(span.text());
+ li = span.parent().parent().parent().parent();
+ unqid = li.attr("unqid");
+
+ if(!isTimeValid(fadeIn)){
+ showError(span, "please put in a time '00:00:00 (.000000)'");
+ return;
+ }
+
+ $.post(url, {format: "json", fadeIn: fadeIn, pos: pos}, function(json){
+
+ if(json.response !== undefined && json.response.error) {
+ showError(span, json.response.error);
+ return;
+ }
+
+ setPlaylistContent(json);
+
+ li = $('#side_playlist li[unqid='+unqid+']');
+ li.find('.crossfade').toggle();
+ highlightActive(li.find('.spl_fade_control'));
+ });
+ }
+
+ function changeFadeOut(event) {
+ event.stopPropagation();
+
+ var pos, url, fadeOut, li, unqid;
+
+ span = $(this);
+ pos = span.parent().attr("id").split("_").pop();
+ url = "/Playlist/set-fade";
+ fadeOut = $.trim(span.text());
+ li = span.parent().parent().parent().parent();
+ unqid = li.attr("unqid");
+
+ if(!isTimeValid(fadeOut)){
+ showError(span, "please put in a time '00:00:00 (.000000)'");
+ return;
+ }
+
+ $.post(url, {format: "json", fadeOut: fadeOut, pos: pos}, function(json){
+ if(json.response !== undefined && json.response.error) {
+ showError(span, json.response.error);
+ return;
+ }
+
+ setPlaylistContent(json);
+
+ li = $('#side_playlist li[unqid='+unqid+']');
+ li.find('.crossfade').toggle();
+ highlightActive(li.find('.spl_fade_control'));
+ });
+ }
+
+ function submitOnEnter(event) {
+ //enter was pressed
+ if(event.keyCode === 13) {
+ event.preventDefault();
+ $(this).blur();
+ }
+ }
+
+ function openFadeEditor(event) {
+ var pos, url, li;
+
+ event.stopPropagation();
+
+ li = $(this).parent().parent();
+ li.find(".crossfade").toggle();
+
+ if($(this).hasClass("ui-state-active")) {
+ unHighlightActive(this);
+ }
+ else {
+ highlightActive(this);
+ }
+ }
+
+ function openCueEditor(event) {
+ var pos, url, li, icon;
+
+ event.stopPropagation();
+
+ icon = $(this);
+ li = $(this).parent().parent().parent();
+ li.find(".cue-edit").toggle();
+
+ if (li.hasClass("ui-state-active")) {
+ unHighlightActive(li);
+ unHighlightActive(icon);
+ }
+ else {
+ highlightActive(li);
+ highlightActive(icon);
+ }
+ }
+
+ function editName() {
+ var nameElement = $(this);
+ var playlistName = nameElement.text();
+
+ $("#playlist_name_input")
+ .removeClass('element_hidden')
+ .val(playlistName)
+ .keydown(function(event){
+ if(event.keyCode === 13) {
+ event.preventDefault();
+ var input = $(this);
+ var url;
+ url = '/Playlist/set-playlist-name';
+
+ $.post(url, {format: "json", name: input.val()}, function(json){
+ if(json.playlist_error == true){
+ alertPlaylistErrorAndReload();
+ }
+ input.addClass('element_hidden');
+ nameElement.text(json.playlistName);
+ redrawLib();
+ });
+ }
+ })
+ .focus();
+ }
function redrawLib() {
var dt;
@@ -58,6 +281,264 @@ var AIRTIME = (function(AIRTIME){
$("#side_playlist")
.empty()
.append(json.html);
+
+ mod.setUpPlaylist();
+ }
+
+ function setPlaylistButtonEvents(el) {
+
+ $(el).delegate("#spl_new",
+ {"click": AIRTIME.playlist.fnNew});
+
+ $(el).delegate("#spl_delete",
+ {"click": AIRTIME.playlist.fnDelete});
+ }
+
+ //sets events dynamically for playlist entries (each row in the playlist)
+ function setPlaylistEntryEvents(el) {
+
+ $(el).delegate("#spl_sortable .ui-icon-closethick",
+ {"click": function(ev){
+ var id;
+ id = parseInt($(this).attr("id").split("_").pop(), 10);
+ AIRTIME.playlist.fnDeleteItems([id]);
+ }});
+
+ $(el).delegate(".spl_fade_control",
+ {"click": openFadeEditor});
+
+ $(el).delegate(".spl_cue",
+ {"click": openCueEditor});
+
+ }
+
+ //sets events dynamically for the cue editor.
+ function setCueEvents(el) {
+
+ $(el).delegate(".spl_cue_in span",
+ {"focusout": changeCueIn,
+ "keydown": submitOnEnter});
+
+ $(el).delegate(".spl_cue_out span",
+ {"focusout": changeCueOut,
+ "keydown": submitOnEnter});
+ }
+
+ //sets events dynamically for the fade editor.
+ function setFadeEvents(el) {
+
+ $(el).delegate(".spl_fade_in span",
+ {"focusout": changeFadeIn,
+ "keydown": submitOnEnter});
+
+ $(el).delegate(".spl_fade_out span",
+ {"focusout": changeFadeOut,
+ "keydown": submitOnEnter});
+ }
+
+ mod.setUpPlaylist = function() {
+
+ var playlist = $("#side_playlist"),
+ sortableConf;
+
+ playlist.find("#spl_crossfade").on("click", function(){
+
+ if ($(this).hasClass("ui-state-active")) {
+ $(this).removeClass("ui-state-active");
+ playlist.find("#crossfade_main").hide();
+ }
+ else {
+ $(this).addClass("ui-state-active");
+
+ var url = '/Playlist/set-playlist-fades';
+
+ $.get(url, {format: "json"}, function(json){
+ if(json.playlist_error == true){
+ alertPlaylistErrorAndReload();
+ }
+ playlist.find("#spl_fade_in_main").find("span")
+ .empty()
+ .append(json.fadeIn);
+ playlist.find("#spl_fade_out_main").find("span")
+ .empty()
+ .append(json.fadeOut);
+
+ playlist.find("#crossfade_main").show();
+ });
+ }
+ });
+
+ playlist.find("#playlist_name_display").on("click", editName);
+
+ playlist.find("#fieldset-metadate_change > legend").on("click", function(){
+ var descriptionElement = $(this).parent();
+
+ if(descriptionElement.hasClass("closed")) {
+ descriptionElement.removeClass("closed");
+ }
+ else {
+ descriptionElement.addClass("closed");
+ }
+ });
+
+ playlist.find("#description_save").on("click", function(){
+ var textarea = playlist.find("#fieldset-metadate_change textarea"),
+ description = textarea.val(),
+ url;
+
+ url = '/Playlist/set-playlist-description';
+
+ $.post(url, {format: "json", description: description}, function(json){
+ if(json.playlist_error == true){
+ alertPlaylistErrorAndReload();
+ }
+ else{
+ textarea.val(json.playlistDescription);
+ }
+
+ playlist.find("#fieldset-metadate_change").addClass("closed");
+ redrawLib();
+ });
+ });
+
+ playlist.find("#description_cancel").on("click", function(){
+ var textarea = playlist.find("#fieldset-metadate_change textarea"),
+ url;
+
+ url = '/Playlist/set-playlist-description';
+
+ $.post(url, {format: "json"}, function(json){
+ if(json.playlist_error == true){
+ alertPlaylistErrorAndReload();
+ }
+ else{
+ textarea.val(json.playlistDescription);
+ }
+
+ playlist.find("#fieldset-metadate_change").addClass("closed");
+ });
+ });
+
+ playlist.find("#spl_fade_in_main span:first").on("blur", function(event){
+ event.stopPropagation();
+
+ var url, fadeIn, span;
+
+ span = $(this);
+ url = "/Playlist/set-playlist-fades";
+ fadeIn = $.trim(span.text());
+
+ if (!isTimeValid(fadeIn)){
+ showError(span, "please put in a time '00:00:00 (.000000)'");
+ return;
+ }
+
+ $.post(url, {format: "json", fadeIn: fadeIn}, function(json){
+ if(json.playlist_error == true){
+ alertPlaylistErrorAndReload();
+ }
+ if(json.response.error) {
+ return;
+ }
+
+ hideError(span);
+ });
+ });
+
+ playlist.find("#spl_fade_out_main span:first").on("blur", function(event){
+ event.stopPropagation();
+
+ var url, fadeIn, span;
+
+ span = $(this);
+ url = "/Playlist/set-playlist-fades";
+ fadeOut = $.trim(span.text());
+
+ if(!isTimeValid(fadeOut)){
+ showError(span, "please put in a time '00:00:00 (.000000)'");
+ return;
+ }
+
+ $.post(url, {format: "json", fadeOut: fadeOut}, function(json){
+ if(json.playlist_error == true){
+ alertPlaylistErrorAndReload();
+ }
+ if(json.response.error) {
+ return;
+ }
+
+ hideError(span);
+ });
+ });
+
+ playlist.find("#spl_fade_in_main span:first, #spl_fade_out_main span:first")
+ .on("keydown", submitOnEnter);
+
+ playlist.find("#crossfade_main > .ui-icon-closethick").on("click", function(){
+ playlist.find("#spl_crossfade").removeClass("ui-state-active");
+ playlist.find("#crossfade_main").hide();
+ });
+
+ setPlaylistButtonEvents(playlist);
+ setPlaylistEntryEvents(playlist);
+ setCueEvents(playlist);
+ setFadeEvents(playlist);
+
+ sortableConf = (function(){
+ var origRow,
+ fnReceive,
+ fnUpdate;
+
+ fnReceive = function(event, ui) {
+ origRow = ui.item;
+ };
+
+ fnUpdate = function(event, ui) {
+ var prev,
+ aItem = [],
+ iAfter,
+ sAddType;
+
+ prev = ui.item.prev();
+ if (prev.hasClass("spl_empty") || prev.length === 0) {
+ iAfter = undefined;
+ sAddType = 'before';
+ }
+ else {
+ iAfter = parseInt(prev.attr("id").split("_").pop(), 10);
+ sAddType = 'after';
+ }
+
+ //item was dragged in from library datatable
+ if (origRow !== undefined) {
+ aItem.push(origRow.data("aData").id);
+ origRow = undefined;
+ AIRTIME.playlist.fnAddItems(aItem, iAfter, sAddType);
+ }
+ //item was reordered.
+ else {
+ aItem.push(parseInt(ui.item.attr("id").split("_").pop(), 10));
+ AIRTIME.playlist.fnMoveItems(aItem, iAfter);
+ }
+ };
+
+ return {
+ items: 'li',
+ placeholder: "placeholder lib-placeholder ui-state-highlight",
+ forcePlaceholderSize: true,
+ handle: 'div.list-item-container',
+ start: function(event, ui) {
+ ui.placeholder.html("PLACE HOLDER")
+ .width("99.5%")
+ .height(56)
+ .append('
');
+ },
+ receive: fnReceive,
+ update: fnUpdate
+ };
+ }());
+
+ playlist.find("#spl_sortable").sortable(sortableConf);
}
mod.fnNew = function() {
@@ -72,6 +553,10 @@ var AIRTIME = (function(AIRTIME){
});
}
+ mod.fnEdit = function() {
+
+ }
+
mod.fnDelete = function() {
var url, id, lastMod;
@@ -88,10 +573,10 @@ var AIRTIME = (function(AIRTIME){
});
}
- mod.fnAddItems = function(aItem, iAfter) {
+ mod.fnAddItems = function(aItems, iAfter, sAddType) {
$.post("/playlist/add-items",
- {format: "json", "ids": aItem, "afterItem": iAfter},
+ {format: "json", "ids": aItems, "afterItem": iAfter, "type": sAddType},
function(json){
setPlaylistContent(json);
});
@@ -120,489 +605,7 @@ var AIRTIME = (function(AIRTIME){
}(AIRTIME || {}));
-function isTimeValid(time) {
- var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$");
-
- if (!regExpr.test(time)) {
- return false;
- }
-
- return true;
-}
-
-function showError(el, error) {
- $(el).parent().next()
- .empty()
- .append(error)
- .show();
-}
-
-function hideError(el) {
- $(el).parent().next()
- .empty()
- .hide();
-}
-
-function changeCueIn(event) {
- event.stopPropagation();
-
- var pos, url, cueIn, li, unqid;
-
- span = $(this);
- pos = span.parent().attr("id").split("_").pop();
- url = "/Playlist/set-cue";
- cueIn = $.trim(span.text());
- li = span.parent().parent().parent().parent();
- unqid = li.attr("unqid");
-
- if(!isTimeValid(cueIn)){
- showError(span, "please put in a time '00:00:00 (.000000)'");
- return;
- }
-
- $.post(url, {format: "json", cueIn: cueIn, pos: pos, type: event.type}, function(json){
-
- if(json.response !== undefined && json.response.error) {
- showError(span, json.response.error);
- return;
- }
-
- setSPLContent(json);
-
- li = $('#side_playlist li[unqid='+unqid+']');
- li.find(".cue-edit").toggle();
- highlightActive(li);
- highlightActive(li.find('.spl_cue'));
- });
-}
-
-function changeCueOut(event) {
- event.stopPropagation();
-
- var pos, url, cueOut, li, unqid;
-
- span = $(this);
- pos = span.parent().attr("id").split("_").pop();
- url = "/Playlist/set-cue";
- cueOut = $.trim(span.text());
- li = span.parent().parent().parent().parent();
- unqid = li.attr("unqid");
-
- if(!isTimeValid(cueOut)){
- showError(span, "please put in a time '00:00:00 (.000000)'");
- return;
- }
-
- $.post(url, {format: "json", cueOut: cueOut, pos: pos}, function(json){
-
- if(json.response !== undefined && json.response.error) {
- showError(span, json.response.error);
- return;
- }
-
- setSPLContent(json);
-
- li = $('#side_playlist li[unqid='+unqid+']');
- li.find(".cue-edit").toggle();
- highlightActive(li);
- highlightActive(li.find('.spl_cue'));
- });
-}
-
-function changeFadeIn(event) {
- event.stopPropagation();
-
- var pos, url, fadeIn, li, unqid;
-
- span = $(this);
- pos = span.parent().attr("id").split("_").pop();
- url = "/Playlist/set-fade";
- fadeIn = $.trim(span.text());
- li = span.parent().parent().parent().parent();
- unqid = li.attr("unqid");
-
- if(!isTimeValid(fadeIn)){
- showError(span, "please put in a time '00:00:00 (.000000)'");
- return;
- }
-
- $.post(url, {format: "json", fadeIn: fadeIn, pos: pos}, function(json){
-
- if(json.response !== undefined && json.response.error) {
- showError(span, json.response.error);
- return;
- }
-
- setSPLContent(json);
-
- li = $('#side_playlist li[unqid='+unqid+']');
- li.find('.crossfade').toggle();
- highlightActive(li.find('.spl_fade_control'));
- });
-}
-
-function changeFadeOut(event) {
- event.stopPropagation();
-
- var pos, url, fadeOut, li, unqid;
-
- span = $(this);
- pos = span.parent().attr("id").split("_").pop();
- url = "/Playlist/set-fade";
- fadeOut = $.trim(span.text());
- li = span.parent().parent().parent().parent();
- unqid = li.attr("unqid");
-
- if(!isTimeValid(fadeOut)){
- showError(span, "please put in a time '00:00:00 (.000000)'");
- return;
- }
-
- $.post(url, {format: "json", fadeOut: fadeOut, pos: pos}, function(json){
- if(json.response !== undefined && json.response.error) {
- showError(span, json.response.error);
- return;
- }
-
- setSPLContent(json);
-
- li = $('#side_playlist li[unqid='+unqid+']');
- li.find('.crossfade').toggle();
- highlightActive(li.find('.spl_fade_control'));
- });
-}
-
-function submitOnEnter(event) {
- //enter was pressed
- if(event.keyCode === 13) {
- event.preventDefault();
- $(this).blur();
- }
-}
-
-function openFadeEditor(event) {
- var pos, url, li;
-
- event.stopPropagation();
-
- li = $(this).parent().parent();
- li.find(".crossfade").toggle();
-
- if($(this).hasClass("ui-state-active")) {
- unHighlightActive(this);
- }
- else {
- highlightActive(this);
- }
-}
-
-function openCueEditor(event) {
- var pos, url, li, icon;
-
- event.stopPropagation();
-
- icon = $(this);
- li = $(this).parent().parent().parent();
- li.find(".cue-edit").toggle();
-
- if (li.hasClass("ui-state-active")) {
- unHighlightActive(li);
- unHighlightActive(icon);
- }
- else {
- highlightActive(li);
- highlightActive(icon);
- }
-}
-
-function editName() {
- var nameElement = $(this);
- var playlistName = nameElement.text();
-
- $("#playlist_name_input")
- .removeClass('element_hidden')
- .val(playlistName)
- .keydown(function(event){
- if(event.keyCode === 13) {
- event.preventDefault();
- var input = $(this);
- var url;
- url = '/Playlist/set-playlist-name';
-
- $.post(url, {format: "json", name: input.val()}, function(json){
- if(json.playlist_error == true){
- alertPlaylistErrorAndReload();
- }
- input.addClass('element_hidden');
- nameElement.text(json.playlistName);
- redrawDataTablePage();
- });
- }
- })
- .focus();
-}
-
-
-
$(document).ready(function() {
- var playlist = $("#side_playlist"),
- sortableConf;
- function setUpSPL() {
-
- /*
- $("#spl_crossfade").on("click", function(){
-
- if ($(this).hasClass("ui-state-active")) {
- $(this).removeClass("ui-state-active");
- $("#crossfade_main").hide();
- }
- else {
- $(this).addClass("ui-state-active");
-
- var url = '/Playlist/set-playlist-fades';
-
- $.get(url, {format: "json"}, function(json){
- if(json.playlist_error == true){
- alertPlaylistErrorAndReload();
- }
- $("#spl_fade_in_main").find("span")
- .empty()
- .append(json.fadeIn);
- $("#spl_fade_out_main").find("span")
- .empty()
- .append(json.fadeOut);
-
- $("#crossfade_main").show();
- });
- }
- });
-
- $("#playlist_name_display").on("click", editName);
-
- $("#fieldset-metadate_change > legend").on("click", function(){
- var descriptionElement = $(this).parent();
-
- if(descriptionElement.hasClass("closed")) {
- descriptionElement.removeClass("closed");
- }
- else {
- descriptionElement.addClass("closed");
- }
- });
-
- $("#description_save").on("click", function(){
- var textarea = $("#fieldset-metadate_change textarea"),
- description = textarea.val(),
- url;
-
- url = '/Playlist/set-playlist-description';
-
- $.post(url, {format: "json", description: description}, function(json){
- if(json.playlist_error == true){
- alertPlaylistErrorAndReload();
- }
- else{
- textarea.val(json.playlistDescription);
- }
-
- $("#fieldset-metadate_change").addClass("closed");
-
- // update the "Last Modified" time for this playlist
- redrawDataTablePage();
- });
- });
-
- $("#description_cancel").on("click", function(){
- var textarea = $("#fieldset-metadate_change textarea"),
- url;
-
- url = '/Playlist/set-playlist-description';
-
- $.post(url, {format: "json"}, function(json){
- if(json.playlist_error == true){
- alertPlaylistErrorAndReload();
- }
- else{
- textarea.val(json.playlistDescription);
- }
-
- $("#fieldset-metadate_change").addClass("closed");
- });
- });
-
- $("#spl_fade_in_main span:first").on("blur", function(event){
- event.stopPropagation();
-
- var url, fadeIn, span;
-
- span = $(this);
- url = "/Playlist/set-playlist-fades";
- fadeIn = $.trim(span.text());
-
- if (!isTimeValid(fadeIn)){
- showError(span, "please put in a time '00:00:00 (.000000)'");
- return;
- }
-
- $.post(url, {format: "json", fadeIn: fadeIn}, function(json){
- if(json.playlist_error == true){
- alertPlaylistErrorAndReload();
- }
- if(json.response.error) {
- return;
- }
-
- hideError(span);
- });
- });
-
- $("#spl_fade_out_main span:first").on("blur", function(event){
- event.stopPropagation();
-
- var url, fadeIn, span;
-
- span = $(this);
- url = "/Playlist/set-playlist-fades";
- fadeOut = $.trim(span.text());
-
- if(!isTimeValid(fadeOut)){
- showError(span, "please put in a time '00:00:00 (.000000)'");
- return;
- }
-
- $.post(url, {format: "json", fadeOut: fadeOut}, function(json){
- if(json.playlist_error == true){
- alertPlaylistErrorAndReload();
- }
- if(json.response.error) {
- return;
- }
-
- hideError(span);
- });
- });
-
- $("#spl_fade_in_main span:first, #spl_fade_out_main span:first")
- .on("keydown", submitOnEnter);
-
- $("#crossfade_main > .ui-icon-closethick").on("click", function(){
- $("#spl_crossfade").removeClass("ui-state-active");
- $("#crossfade_main").hide();
- });
- */
-
- }
-
- function setPlaylistButtonEvents(el) {
-
- $(el).delegate("#spl_new",
- {"click": AIRTIME.playlist.fnNew});
-
- $(el).delegate("#spl_delete",
- {"click": AIRTIME.playlist.fnDelete});
- }
-
- //sets events dynamically for playlist entries (each row in the playlist)
- function setPlaylistEntryEvents(el) {
-
- $(el).delegate("#spl_sortable .ui-icon-closethick",
- {"click": function(ev){
- var id;
- id = parseInt($(this).attr("id").split("_").pop(), 10);
- AIRTIME.playlist.fnDeleteItems([id]);
- }});
-
- /*
- $(el).delegate(".spl_fade_control",
- {"click": openFadeEditor});
-
- $(el).delegate(".spl_cue",
- {"click": openCueEditor});
- */
- }
-
- //sets events dynamically for the cue editor.
- function setCueEvents(el) {
-
- $(el).delegate(".spl_cue_in span",
- {"focusout": changeCueIn,
- "keydown": submitOnEnter});
-
- $(el).delegate(".spl_cue_out span",
- {"focusout": changeCueOut,
- "keydown": submitOnEnter});
- }
-
- //sets events dynamically for the fade editor.
- function setFadeEvents(el) {
-
- $(el).delegate(".spl_fade_in span",
- {"focusout": changeFadeIn,
- "keydown": submitOnEnter});
-
- $(el).delegate(".spl_fade_out span",
- {"focusout": changeFadeOut,
- "keydown": submitOnEnter});
- }
-
-
-
- setPlaylistButtonEvents(playlist);
- setPlaylistEntryEvents(playlist);
- //setCueEvents(playlist);
- //setFadeEvents(playlist);
-
- sortableConf = (function(){
- var origRow,
- fnReceive,
- fnUpdate;
-
- fnReceive = function(event, ui) {
- origRow = ui.item;
- };
-
- fnUpdate = function(event, ui) {
- var prev,
- aItem = [],
- iAfter;
-
- prev = ui.item.prev();
- if (prev.hasClass("spl_empty") || prev.length === 0) {
- iAfter = undefined;
- }
- else {
- iAfter = parseInt(prev.attr("id").split("_").pop(), 10);
- }
-
- //item was dragged in from library datatable
- if (origRow !== undefined) {
- aItem.push(origRow.data("aData").id);
- origRow = undefined;
- AIRTIME.playlist.fnAddItems(aItem, iAfter);
- }
- //item was reordered.
- else {
- aItem.push(parseInt(ui.item.attr("id").split("_").pop(), 10));
- AIRTIME.playlist.fnMoveItems(aItem, iAfter);
- }
- };
-
- return {
- items: 'li',
- placeholder: "placeholder lib-placeholder ui-state-highlight",
- forcePlaceholderSize: true,
- handle: 'div.list-item-container',
- start: function(event, ui) {
- ui.placeholder.html("PLACE HOLDER")
- .width("99.5%")
- .height(56)
- .append('
');
- },
- receive: fnReceive,
- update: fnUpdate
- };
- }());
-
- playlist.sortable(sortableConf);
+ AIRTIME.playlist.setUpPlaylist();
});
diff --git a/airtime_mvc/public/js/contextmenu/jquery.contextMenu.js b/airtime_mvc/public/js/contextmenu/jquery.contextMenu.js
new file mode 100755
index 000000000..92153b0ca
--- /dev/null
+++ b/airtime_mvc/public/js/contextmenu/jquery.contextMenu.js
@@ -0,0 +1,1449 @@
+/*
+ * jQuery contextMenu - Plugin for simple contextMenu handling
+ *
+ * Version: 1.5.8
+ *
+ * Authors: Rodney Rehm, Addy Osmani (patches for FF)
+ * Web: http://medialize.github.com/jQuery-contextMenu/
+ *
+ * Licensed under
+ * MIT License http://www.opensource.org/licenses/mit-license
+ * GPL v3 http://opensource.org/licenses/GPL-3.0
+ *
+ */
+
+(function($, undefined){
+
+ // TODO: -
+ // ARIA stuff: menuitem, menuitemcheckbox und menuitemradio
+ // create