Add sharing token/download key to station podcast URL when set to private; tab middle click fix

This commit is contained in:
Duncan Sommerville 2015-11-04 10:52:23 -05:00
parent 69da2fa07e
commit b4ec3eeb3f
6 changed files with 41 additions and 22 deletions

View file

@ -55,8 +55,16 @@ class PreferenceController extends Zend_Controller_Action
// Refresh the download key when enabling privacy
Application_Model_Preference::setStationPodcastDownloadKey();
}
// Append sharing token (download key) to Station podcast URL
$stationPodcast = PodcastQuery::create()->findOneByDbId(Application_Model_Preference::getStationPodcastId());
$key = Application_Model_Preference::getStationPodcastDownloadKey();
$url = Application_Common_HTTPHelper::getStationUrl() .
(((int) $values["stationPodcastPrivacy"]) ? "feeds/station-rss?sharing_token=$key" : "feeds/station-rss");
$stationPodcast->setDbUrl($url)->save();
Application_Model_Preference::setStationPodcastPrivacy($values["stationPodcastPrivacy"]);
$logoUploadElement = $form->getSubForm('preferences_general')->getElement('stationLogo');
$logoUploadElement->receive();
$imagePath = $logoUploadElement->getFileName();

View file

@ -17,8 +17,8 @@ class Application_Form_PodcastPreferences extends Zend_Form_SubForm {
$stationPodcastPrivacy->setValue($isPrivate);
$this->addElement($stationPodcastPrivacy);
$key = Application_Model_Preference::getStationPodcastDownloadKey();
$url = Application_Common_HTTPHelper::getStationUrl()."feeds/station-rss".($isPrivate ? "?sharing_token=$key" : "");
$stationPodcast = PodcastQuery::create()->findOneByDbId(Application_Model_Preference::getStationPodcastId());
$url = $stationPodcast->getDbUrl();
$feedUrl = new Zend_Form_Element_Text("stationPodcastFeedUrl:");
$feedUrl->setAttrib('class', 'input_text')
->setAttrib('disabled', 'disabled')

View file

@ -14,7 +14,6 @@
}
.edit-md-dialog dd input.input_text {
/*width: auto;*/
width: 100%;
}
@ -46,8 +45,9 @@
.playlist_editor input, .playlist_editor textarea {
width: 200px;
height: 70px;
box-sizing: border-box;
}
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;}
.side_playlist textarea {
/*height: 70px;*/

View file

@ -1180,8 +1180,11 @@ input[type="checkbox"] {
width: 100%;
}
#pref_form textarea {
width: 98.5%;
width: 100%;
padding-left: 5px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#pref_form select {
width: 100%;
@ -1703,12 +1706,13 @@ h2#scheduled_playlist_name span {
}
.simple-formblock dd .input_text {
/*width: 97.8%;*/
width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.simple-formblock dd textarea {
box-sizing: border-box;
height: 70px;
}

View file

@ -12,9 +12,11 @@ var AIRTIME = (function (AIRTIME) {
/**
* PodcastController constructor.
*
* @param {{}} $scope angular scope service object
* @param {{}} $http angular http service object
* @param {{}} podcast podcast metadata object
* @param {Object} $scope angular scope service object
* @param {Object} $http angular http service object
* @param {Object} podcast podcast metadata object
* @param {int} podcast.id podcast unique identifier
* @param {string} podcast.title podcast metadata title
* @param {Tab} tab Tab object the controller is being bootstrapped in
*
* @constructor
@ -57,7 +59,6 @@ var AIRTIME = (function (AIRTIME) {
self._updatePodcast = function () {
$http.put(endpoint + $scope.podcast.id, {csrf_token: $scope.csrf, podcast: $scope.podcast})
.success(function () {
// episodeTable.reload($scope.podcast.id);
self.episodeTable.getDatatable().fnDraw();
AIRTIME.library.podcastDataTable.fnDraw();
tab.setName($scope.podcast.title);
@ -440,10 +441,10 @@ var AIRTIME = (function (AIRTIME) {
*
* Selection for the internal table represents episodes marked for ingest and is disabled for ingested episodes.
*
* @param podcast the podcast data JSON object.
* @param tab Tab object the podcast will be opened in
* @param params JSON object containing datatables parameters to override
* @param buttons JSON object containing datatables button parameters
* @param {Object} podcast the podcast data JSON object.
* @param {Tab} tab Tab object the podcast will be opened in
* @param {Object} params JSON object containing datatables parameters to override
* @param {Object} buttons JSON object containing datatables button parameters
*
* @returns {*} the created Table object
*/

View file

@ -111,10 +111,6 @@ var AIRTIME = (function(AIRTIME){
Tab.prototype._init = function() {
var self = this;
self.assignTabClickHandler(function(e) {
if (e.which == 2) { // Middle mouse
self.close();
return;
}
if (!$(this).hasClass('active')) {
self.switchTo();
}
@ -146,7 +142,17 @@ var AIRTIME = (function(AIRTIME){
* @param {function} f the function to call when the tab is clicked
*/
Tab.prototype.assignTabClickHandler = function(f) {
this.tab.unbind("click").on("click", f);
var self = this;
self.tab.unbind("click").on("click", function (e) {
// Always close on middle mouse press
if (e.which == 2) {
// Simulate a click on the close tab button so any
// additional on-close behaviour is executed
self.tab.find(".lib_pl_close").click();
return;
}
f();
});
};
/**