Better errors from podcast 'Add' dialog
This commit is contained in:
parent
de380369ed
commit
c5a5839eff
10 changed files with 44 additions and 14 deletions
|
@ -28,6 +28,7 @@ class LocaleController extends Zend_Controller_Action
|
|||
$translations = array (
|
||||
//common/common.js
|
||||
"Audio Player" => _("Audio Player"),
|
||||
"Something went wrong!" => _("Something went wrong!"),
|
||||
//dashboard/dashboard.js
|
||||
"Recording:" => _("Recording:"),
|
||||
"Master Stream" => _("Master Stream"),
|
||||
|
|
|
@ -217,7 +217,6 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$id = $this->_getParam('id', null);
|
||||
$type = $this->_getParam('type');
|
||||
$objInfo = Application_Model_Library::getObjInfo($type);
|
||||
Logging::info("editing {$type} {$id}");
|
||||
|
||||
// if (!is_null($id)) {
|
||||
Application_Model_Library::changePlaylist($id, $type);
|
||||
|
|
|
@ -188,8 +188,6 @@ class Application_Model_Block implements Application_Model_LibraryEditable
|
|||
*/
|
||||
public function getContents($filterFiles=false)
|
||||
{
|
||||
Logging::info("Getting contents for block {$this->id}");
|
||||
|
||||
$sql = <<<SQL
|
||||
SELECT pc.id AS id,
|
||||
pc.position,
|
||||
|
|
|
@ -80,7 +80,6 @@ class Rest_PodcastController extends Zend_Rest_Controller
|
|||
}
|
||||
|
||||
try {
|
||||
//$requestData = json_decode($this->getRequest()->getRawBody(), true);
|
||||
$requestData = $this->getRequest()->getPost();
|
||||
$podcast = Application_Service_PodcastService::createFromFeedUrl($requestData["url"]);
|
||||
|
||||
|
@ -94,17 +93,16 @@ class Rest_PodcastController extends Zend_Rest_Controller
|
|||
catch (PodcastLimitReachedException $e) {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(400)
|
||||
->appendBody("ERROR: Podcast limit reached.");
|
||||
->appendBody("Podcast limit reached.");
|
||||
}
|
||||
catch (InvalidPodcastException $e) {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(400)
|
||||
->appendBody("ERROR: Invalid Podcast.");
|
||||
->appendBody("Invalid podcast!");
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->unknownErrorResponse();
|
||||
Logging::error($e->getMessage());
|
||||
throw $e;
|
||||
$this->unknownErrorResponse();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,7 +213,7 @@ class Rest_PodcastController extends Zend_Rest_Controller
|
|||
private function unknownErrorResponse()
|
||||
{
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(400);
|
||||
$resp->setHttpResponseCode(500);
|
||||
$resp->appendBody("An unknown error occurred.");
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class Application_Service_PodcastService
|
|||
|
||||
//TODO: why is this so slow?
|
||||
$rss = self::getPodcastFeed($feedUrl);
|
||||
if (!$rss) {
|
||||
if (!$rss || !empty($rss->error())) {
|
||||
throw new InvalidPodcastException();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div id="podcast_url_dialog">
|
||||
<form name="podcast_url_form" style="margin-top: 10px;">
|
||||
<form id="podcast_url_form" name="podcast_url_form" style="margin-top: 10px;">
|
||||
<?php echo $this->csrf ?>
|
||||
<table style="padding: 0;">
|
||||
<tr>
|
||||
|
@ -9,13 +9,14 @@
|
|||
</label>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
<input type="text" name="podcast_url_field" name="url" size="40" style="margin-left: 10px; margin-bottom: 10px;" placeholder="http://example.com/podcast.xml"/>
|
||||
<input id="podcast_url_field" type="url" name="url" size="40" style="margin-left: 10px; margin-bottom: 10px;" placeholder="http://example.com/podcast.xml"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button class="btn btn-new right-floated" type="button" onclick="AIRTIME.podcast.addPodcast()">
|
||||
<button class="btn btn-new right-floated" type="submit">
|
||||
<?php echo _("Subscribe"); ?>
|
||||
</button>
|
||||
<span class="errors" style="display:none"></span>
|
||||
</form>
|
||||
<!-- <p style="clear: both; text-align: center; opacity: 0.7; margin-top: 20px;">Paste the URL of a podcast RSS feed above.</p> -->
|
||||
</div>
|
|
@ -4168,3 +4168,9 @@ li .ui-state-hover {
|
|||
#podcast_url_dialog table tr td {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
#podcast_url_dialog .errors {
|
||||
display: inline-block;
|
||||
float: right;
|
||||
width: 50%;
|
||||
}
|
|
@ -304,6 +304,20 @@ function getUsabilityHint() {
|
|||
});
|
||||
}
|
||||
|
||||
// TODO: build this out so we can use it as a fallback in fail cases
|
||||
function buildErrorDialog(message) {
|
||||
var el = $("<div id='error_dialog'></div>");
|
||||
el.text(message);
|
||||
$(document.body).append(el);
|
||||
$("#error_dialog").dialog({
|
||||
title: $.i18n._("Something went wrong!"),
|
||||
resizable: false,
|
||||
modal: true,
|
||||
width: "auto",
|
||||
height: "auto"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add title attributes (whose values are their inner text) to all elements in the calling parent matching selector
|
||||
*
|
||||
|
|
|
@ -524,6 +524,12 @@ var AIRTIME = (function (AIRTIME) {
|
|||
AIRTIME.library.podcastTableWidget.clearSelection();
|
||||
AIRTIME.library.setCurrentTable(AIRTIME.library.DataTableTypeEnum.PODCAST_EPISODES);
|
||||
$("#podcast_url_dialog").dialog("close");
|
||||
}).fail(function (e) {
|
||||
var errors = $("#podcast_url_dialog").find(".errors");
|
||||
errors.show(200).text(e.responseText);
|
||||
setTimeout(function () {
|
||||
errors.hide(200);
|
||||
}, 3000);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -679,3 +685,10 @@ var AIRTIME = (function (AIRTIME) {
|
|||
|
||||
return AIRTIME;
|
||||
}(AIRTIME || {}));
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).on("submit", "#podcast_url_form", function (e) {
|
||||
e.preventDefault();
|
||||
AIRTIME.podcast.addPodcast();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -303,7 +303,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
var foundAtIdx = $.inArray(aData, self._selectedRows);
|
||||
|
||||
console.log('checkbox mouse', iVisualRowIdx, foundAtIdx);
|
||||
//console.log('checkbox mouse', iVisualRowIdx, foundAtIdx);
|
||||
|
||||
//If the clicked row is already selected, deselect it.
|
||||
if (foundAtIdx >= 0 && self._selectedRows.length >= 1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue