diff --git a/dss/settings.py b/dss/settings.py index 39bccd8..38e84f7 100755 --- a/dss/settings.py +++ b/dss/settings.py @@ -100,7 +100,7 @@ TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + ( 'django.contrib.auth.context_processors.auth', "allauth.socialaccount.context_processors.socialaccount", "allauth.account.context_processors.account", - "spa.context_processors.debug" + "spa.context_processors.dss_context" ) AUTHENTICATION_BACKENDS = global_settings.AUTHENTICATION_BACKENDS + ( diff --git a/spa/context_processors.py b/spa/context_processors.py index d5c786c..c1892d9 100755 --- a/spa/context_processors.py +++ b/spa/context_processors.py @@ -1,5 +1,8 @@ from django.conf import settings -def debug(context): - return {'DEBUG': settings.DEBUG} +def dss_context(context): + return { + 'DEBUG': settings.DEBUG, + 'live_enabled': settings.LIVE_ENABLED + } diff --git a/static/js/app/lib/audioController.coffee b/static/js/app/lib/audioController.coffee index ff79d46..7cf8c68 100755 --- a/static/js/app/lib/audioController.coffee +++ b/static/js/app/lib/audioController.coffee @@ -15,10 +15,11 @@ define ['app', 'marionette', 'vent', 'utils', 'soundmanager2', 'peneloplay'], soundManager.setup url: com.podnoms.settings.staticUrl + '/swf/sm/' onready: -> - console.log "Sound manager ready sir!" + vent.trigger('peneloplay:ready') + console.log "Sound manager ready!" debugFlash: com.podnoms.smDebugMode - preferFlash: true + preferFlash: false defaultOptions: volume: com.podnoms.settings.volume diff --git a/static/js/app/lib/audioController.js b/static/js/app/lib/audioController.js index a3dade0..4c08260 100755 --- a/static/js/app/lib/audioController.js +++ b/static/js/app/lib/audioController.js @@ -27,10 +27,11 @@ return soundManager.setup({ url: com.podnoms.settings.staticUrl + '/swf/sm/', onready: function() { - return console.log("Sound manager ready sir!"); + vent.trigger('peneloplay:ready'); + return console.log("Sound manager ready!"); }, debugFlash: com.podnoms.smDebugMode, - preferFlash: true, + preferFlash: false, defaultOptions: { volume: com.podnoms.settings.volume } diff --git a/static/js/app/lib/social.coffee b/static/js/app/lib/social.coffee index 8d28f46..27438cc 100644 --- a/static/js/app/lib/social.coffee +++ b/static/js/app/lib/social.coffee @@ -3,7 +3,7 @@ define ['jquery', 'utils', 'facebook'], ($, utils) -> #first off, find if the current user has allowed facebook likes $.getJSON "social/like/" + mixId + "/", (data) -> - com.podnoms.utils.showAlert "Posted your like to facebook, you can stop this in your settings page.", "Cheers feen" + utils.showAlert "Posted your like to facebook, you can stop this in your settings page.", "Cheers feen" generateEmbedCode: (model) -> diff --git a/static/js/app/lib/social.js b/static/js/app/lib/social.js index 4b352f0..a63ec8a 100644 --- a/static/js/app/lib/social.js +++ b/static/js/app/lib/social.js @@ -5,7 +5,7 @@ return { postFacebookLike: function(mixId) { return $.getJSON("social/like/" + mixId + "/", function(data) { - return com.podnoms.utils.showAlert("Posted your like to facebook, you can stop this in your settings page.", "Cheers feen"); + return utils.showAlert("Posted your like to facebook, you can stop this in your settings page.", "Cheers feen"); }); }, generateEmbedCode: function(model) { diff --git a/static/js/app/lib/utils.coffee b/static/js/app/lib/utils.coffee index c86185f..71a6afb 100755 --- a/static/js/app/lib/utils.coffee +++ b/static/js/app/lib/utils.coffee @@ -41,7 +41,7 @@ define ['jquery', 'lib/jquery.filedownload', 'bootstrap', 'toastr'], checkPlayCount: -> if document.cookie.indexOf("sessionId") - $.getJSON "/ajax/session_play_count", (data) => + $.getJSON "/ajax/session_play_count/", (data) => console.log "utils: got playcount" if data.play_count isnt "0" and ((data.play_count % com.podnoms.settings.nag_count) == 0) @modal "/dlg/PlayCountLoginAlert" diff --git a/static/js/app/lib/utils.js b/static/js/app/lib/utils.js index 29255e2..2985590 100755 --- a/static/js/app/lib/utils.js +++ b/static/js/app/lib/utils.js @@ -55,7 +55,7 @@ checkPlayCount: function() { var _this = this; if (document.cookie.indexOf("sessionId")) { - $.getJSON("/ajax/session_play_count", function(data) { + $.getJSON("/ajax/session_play_count/", function(data) { console.log("utils: got playcount"); if (data.play_count !== "0" && ((data.play_count % com.podnoms.settings.nag_count) === 0)) { return _this.modal("/dlg/PlayCountLoginAlert"); diff --git a/static/js/app/views/show/scheduleShowMixListView.js b/static/js/app/views/show/scheduleShowMixListView.js new file mode 100644 index 0000000..d24c05e --- /dev/null +++ b/static/js/app/views/show/scheduleShowMixListView.js @@ -0,0 +1,54 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + define(['app', 'vent', 'marionette', 'fullcalendar', 'models/show/showCollection', 'models/mix/mixCollection', 'text!/tpl/ShowScheduleMixItem'], function(App, vent, Marionette, fullcalendar, ScheduleCollection, MixCollection, Template) { + var ScheduleShowMixItem, ScheduleShowMixList; + ScheduleShowMixItem = (function(_super) { + + __extends(ScheduleShowMixItem, _super); + + function ScheduleShowMixItem() { + return ScheduleShowMixItem.__super__.constructor.apply(this, arguments); + } + + ScheduleShowMixItem.prototype.template = _.template(Template); + + return ScheduleShowMixItem; + + })(Marionette.ItemView); + ScheduleShowMixList = (function(_super) { + + __extends(ScheduleShowMixList, _super); + + function ScheduleShowMixList() { + return ScheduleShowMixList.__super__.constructor.apply(this, arguments); + } + + ScheduleShowMixList.prototype.itemView = ScheduleShowMixItem; + + ScheduleShowMixList.prototype.initialize = function(options) { + console.log("ScheduleShowMixList: initialize"); + return true; + }; + + ScheduleShowMixList.prototype.onShow = function() { + return $("#external-events div.external-event").each(function() { + $(this).draggable({ + zIndex: 999, + revert: true, + revertDuration: 0 + }); + }); + }; + + true; + + return ScheduleShowMixList; + + })(Marionette.CollectionView); + return ScheduleShowMixList; + }); + +}).call(this); diff --git a/static/js/com.podnoms.player.js b/static/js/com.podnoms.player.js deleted file mode 100755 index a499981..0000000 --- a/static/js/com.podnoms.player.js +++ /dev/null @@ -1,268 +0,0 @@ -/** @license - - ---------------------------------------------- - - Copyright (c) 2012, Fergal Moran. All rights reserved. - Code provided under the BSD License: - - */ - -if (!com) var com = {}; -if (!com.podnoms) com.podnoms = {}; - -soundManager.url = com.podnoms.settings.staticUrl + '/swf/sm/'; -soundManager.bgColor = '#ffffff'; -soundManager.consoleOnly = true; -soundManager.debugMode = com.podnoms.settings.smDebugMode; -soundManager.debugFlash = com.podnoms.settings.smDebugMode; -soundManager.flashVersion = 9; -soundManager.flashPollingInterval = null; -soundManager.html5PollingInterval = null; -soundManager.html5Test = /^(probably|maybe)$/i; -soundManager.flashLoadTimeout = 1000; -soundManager.idPrefix = 'sound'; -soundManager.noSWFCache = false; -soundManager.preferFlash = false; -soundManager.useConsole = true; -soundManager.useFlashBlock = false; -soundManager.useHighPerformance = false; -soundManager.useHTML5Audio = true; -soundManager.waitForWindowLoad = false; -soundManager.wmode = null; - -com.podnoms.player = { - /*Members*/ - currentId: -1, - currentPath: '', - currentSound: null, - boundingEl: null, - timeDisplayLabel: null, - waveFormEl: null, - playHeadEl: null, - loadingEl: null, - seekHeadEl: null, - waveFormRect: [-1, -1, -1, -1], - trackLoaded: false, - waveFormTop: -1, - waveFormLeft: -1, - waveFormWidth: -1, - totalLength: -1, - currentPosition: -1, - soundDuration: 0, - - /*Privates */ - _secondsToHms: function (d) { - if (d) { - d = Number(d); - var h = Math.floor(d / 3600); - var m = Math.floor(d % 3600 / 60); - var s = Math.floor(d % 3600 % 60); - return ((h > 0 ? h + ":" : "") + (m > 0 ? (h > 0 && m < 10 ? "0" : "") + m + ":" : "00:") + (s < 10 ? "0" : "") + s); - } else { - return "00:00:00"; - } - }, - _getDurationEstimate: function (oSound) { - if (oSound.instanceOptions.isMovieStar) { - return (oSound.duration); - } else { - return oSound.durationEstimate; - } - }, - _whileLoading: function () { - var percentageFinished = (this.currentSound.bytesLoaded / this.currentSound.bytesTotal) * 100; - var percentageWidth = (this.waveFormWidth / 100) * percentageFinished; - this.loadingEl.css('width', percentageWidth); - }, - _whilePlaying: function () { - if (!this.trackLoaded) { - this.trackLoaded = true; - this.loadingEl.css('width', 100); - } - - //need to call this every time as the boundaries may have changed. - this._calculateBounds(); - this.currentPosition = this.currentSound.position; - var duration = this._getDurationEstimate(this.currentSound); - var percentageFinished = (this.currentSound.position / duration) * 100; - var percentageWidth = (this.waveFormWidth / 100) * percentageFinished; - this.playHeadEl.css('width', percentageWidth); - this.timeDisplayLabel.text(this._secondsToHms(this.currentSound.position / 1000)); - }, - _mouseDown: function (event) { - if (this.currentSound != null) { - this.currentSound.setPosition( - (this._getDurationEstimate(this.currentSound) / 100) * ((event.pageX - this.waveFormLeft) / this.waveFormWidth) * 100); - } - $(event.currentTarget).mouseup($.proxy(this._mouseDown, this)); - }, - _mouseMove: function (event) { - this.seekHeadEl.css('left', (event.pageX - this.waveFormLeft));//.fadeIn('fast'); - }, - _mouseLeave: function (event) { - this.seekHeadEl.hide(); - }, - _mouseEnter: function (event) { - this.seekHeadEl.show(); - }, - _destroyCurrent: function (success) { - if (this.currentSound != null) { - soundManager.destroySound(this.currentSound.sID); - } - this.trackLoaded = false; - this.currentId = null; - if (success != undefined) - success(); - }, - _parseOptions: function (options) { - this.currentId = options.id; - this.boundingEl = options.boundingEl; - this.waveFormEl = options.waveFormEl; - this.seekHeadEl = options.seekHeadEl; - this.playHeadEl = options.playHeadEl; - this.loadingEl = options.loadingEl; - this.currentPath = options.url; - }, - _calculateBounds: function () { - if (this.waveFormEl.position()) { - this.waveFormTop = this.waveFormEl.position().top; - this.waveFormLeft = this.waveFormEl.offset().left; - this.waveFormWidth = this.waveFormEl.width(); - this.playHeadEl.css('top', 0); - this.loadingEl.css('top', 0); - this.seekHeadEl.css('top', this.waveFormEl.position().top); - /*this.waveFormEl.mousedown($.proxy(this._mouseDown, this));*/ - this.waveFormEl.mouseup($.proxy(this._mouseDown, this)); - this.waveFormEl.mousemove($.proxy(this._mouseMove, this)); - this.waveFormEl.mouseout($.proxy(this._mouseLeave, this)); - this.waveFormEl.mouseenter($.proxy(this._mouseEnter, this)); - } else { - console.error("Error setting up player, waveFormEl is empty"); - } - }, - /*Methods*/ - isPlaying: function () { - if (this.currentSound != null) - return this.currentSound.playState == 1; - }, - isPlayingId: function (id) { - return this.isPlaying() && this.currentSound.sID == "com.podnoms.player-" + id; - }, - getStreamUrl: function () { - return this.currentPath; - }, - drawTimeline: function (el, boundingEl, duration) { - /* - Assume 10 markers - */ - var markerDuration = duration / 10; - var item = $(document.createElement("li")); - for (var i = 0; i < 10; i++) { - var sliceDuration = moment.duration(markerDuration * (i + 1), "seconds"); - var text = sliceDuration.hours() != 0 ? - moment(sliceDuration).format("HH:mm") : - moment(sliceDuration).format("mm:ss"); - el.append(item.clone().text(text).css('width', '10%')); - } - - }, - setupPlayer: function (options) { - this._parseOptions(options); - this._calculateBounds(); - this._createTimeDisplayLabel(); - }, - _createTimeDisplayLabel: function () { - this.timeDisplayLabel = $('