Disable publish checkbox for disconnected sources
This commit is contained in:
parent
0951afcbb3
commit
ea887dd8f6
|
@ -78,11 +78,12 @@ class Application_Service_PublishService {
|
||||||
* @param int $fileId the ID of the file to check
|
* @param int $fileId the ID of the file to check
|
||||||
*
|
*
|
||||||
* @return int 1 if the file has been published to SoundCloud,
|
* @return int 1 if the file has been published to SoundCloud,
|
||||||
* 0 if the file has yet to be published, or -1 if the
|
* 0 if the file has yet to be published,
|
||||||
* file is in a pending state
|
* -1 if the file is in a pending state
|
||||||
*/
|
*/
|
||||||
private static function getSoundCloudPublishStatus($fileId) {
|
private static function getSoundCloudPublishStatus($fileId) {
|
||||||
$soundcloudService = new Application_Service_SoundcloudService();
|
$soundcloudService = new Application_Service_SoundcloudService();
|
||||||
|
if (!$soundcloudService->hasAccessToken()) { return 2; }
|
||||||
return ($soundcloudService->referenceExists($fileId));
|
return ($soundcloudService->referenceExists($fileId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,9 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><?php echo _("Publish to:"); ?></legend>
|
<legend><?php echo _("Publish to:"); ?></legend>
|
||||||
<div class="publish-sources" ng-repeat="source in sources.toPublish">
|
<div class="publish-sources" ng-repeat="source in sources.toPublish">
|
||||||
<input ng-model="publishData[source.source]" type="checkbox" name="publish_sources" id="{{source.source}}">
|
<input ng-disabled="{{source.status == 2}}" ng-model="publishData[source.source]" type="checkbox" name="publish_sources" id="{{source.source}}">
|
||||||
<label class="source-name" for="{{source.source}}">{{source.label}}</label><br/>
|
<label class="source-name" for="{{source.source}}">{{source.label}}</label>
|
||||||
|
<span ng-if="source.status == 2" style="margin: auto"><?php echo _("You aren't connected to this source.") ?></span>
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="sources.toPublish.length == 0">
|
<div ng-if="sources.toPublish.length == 0">
|
||||||
<?php echo _("You have already published this track to all available sources!") . "<br/>"
|
<?php echo _("You have already published this track to all available sources!") . "<br/>"
|
||||||
|
|
|
@ -16,7 +16,6 @@ var AIRTIME = (function (AIRTIME) {
|
||||||
//AngularJS app
|
//AngularJS app
|
||||||
var publishApp = angular.module(PUBLISH_APP_NAME, [])
|
var publishApp = angular.module(PUBLISH_APP_NAME, [])
|
||||||
.controller('Publish', function ($scope, $http, mediaId, tab) {
|
.controller('Publish', function ($scope, $http, mediaId, tab) {
|
||||||
$scope.publishSources = {};
|
|
||||||
$scope.publishData = {};
|
$scope.publishData = {};
|
||||||
var sourceInterval;
|
var sourceInterval;
|
||||||
|
|
||||||
|
@ -34,7 +33,7 @@ var AIRTIME = (function (AIRTIME) {
|
||||||
.success(function (json) {
|
.success(function (json) {
|
||||||
$scope.sources = { toPublish: [], published: []};
|
$scope.sources = { toPublish: [], published: []};
|
||||||
$.each(json, function () {
|
$.each(json, function () {
|
||||||
if (this.status != 0) {
|
if (Math.abs(this.status) == 1) {
|
||||||
$scope.sources.published.push(this);
|
$scope.sources.published.push(this);
|
||||||
} else {
|
} else {
|
||||||
$scope.sources.toPublish.push(this);
|
$scope.sources.toPublish.push(this);
|
||||||
|
|
Loading…
Reference in New Issue