Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2011-11-17 18:15:49 -05:00
commit d639f7c5a6
16 changed files with 134 additions and 100 deletions

View file

@ -35,7 +35,7 @@ class DashboardController extends Zend_Controller_Action
public function aboutAction() public function aboutAction()
{ {
// action body $this->view->airtime_version = Application_Model_Preference::GetAirtimeVersion();
} }
} }

View file

@ -63,6 +63,7 @@ class UserController extends Zend_Controller_Action
public function getHostsAction() public function getHostsAction()
{ {
$search = $this->_getParam('term'); $search = $this->_getParam('term');
$res = Application_Model_User::getHosts($search);
$this->view->hosts = Application_Model_User::getHosts($search); $this->view->hosts = Application_Model_User::getHosts($search);
} }

View file

@ -16,7 +16,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
$hosts = Application_Model_User::getHosts(); $hosts = Application_Model_User::getHosts();
foreach ($hosts as $host) { foreach ($hosts as $host) {
$options[$host['value']] = $host['label']; $options[$host['index']] = $host['label'];
} }
//Add hosts selection //Add hosts selection

View file

@ -527,6 +527,24 @@ class Application_Model_Preference
} }
} }
public static function GetLatestLink(){
$link = self::GetValue("latest_link");
if($link == null || strlen($link) == 0) {
return "http://www.sourcefabric.org/en/airtime/download/";
} else {
return $link;
}
}
public static function SetLatestLink($link){
$pattern = "#^(http|https|ftp)://" .
"([a-zA-Z0-9]+\.)*[a-zA-Z0-9]+" .
"(/[a-zA-Z0-9\-\.\_\~\:\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=]+)*/?$#";
if(preg_match($pattern, $link)) {
self::SetValue("latest_link", $link);
}
}
public static function SetUploadToSoundcloudOption($upload) { public static function SetUploadToSoundcloudOption($upload) {
self::SetValue("soundcloud_upload_option", $upload); self::SetValue("soundcloud_upload_option", $upload);
} }
@ -559,19 +577,24 @@ class Application_Model_Preference
/* User specific preferences start */ /* User specific preferences start */
/** /**
* Sets the time scale preference (day/week/month) in Calendar. * Sets the time scale preference (agendaDay/agendaWeek/month) in Calendar.
* *
* @param $timeScale new time scale * @param $timeScale new time scale
*/ */
public static function SetCalendarTimeScale($timeScale) { public static function SetCalendarTimeScale($timeScale) {
return self::SetValue("calendar_time_scale", $timeScale, true /* user specific */); self::SetValue("calendar_time_scale", $timeScale, true /* user specific */);
} }
/** /**
* Retrieves the time scale preference for the current user. * Retrieves the time scale preference for the current user.
* Defaults to month if no entry exists
*/ */
public static function GetCalendarTimeScale() { public static function GetCalendarTimeScale() {
return self::GetValue("calendar_time_scale", true /* user specific */); $val = self::GetValue("calendar_time_scale", true /* user specific */);
if(strlen($val) == 0) {
$val = "month";
}
return $val;
} }
/** /**
@ -580,14 +603,19 @@ class Application_Model_Preference
* @param $numEntries new number of entries to show * @param $numEntries new number of entries to show
*/ */
public static function SetLibraryNumEntries($numEntries) { public static function SetLibraryNumEntries($numEntries) {
return self::SetValue("library_num_entries", $numEntries, true /* user specific */); self::SetValue("library_num_entries", $numEntries, true /* user specific */);
} }
/** /**
* Retrieves the number of entries to show preference in library under Playlist Builder. * Retrieves the number of entries to show preference in library under Playlist Builder.
* Defaults to 10 if no entry exists
*/ */
public static function GetLibraryNumEntries() { public static function GetLibraryNumEntries() {
return self::GetValue("library_num_entries", true /* user specific */); $val = self::GetValue("library_num_entries", true /* user specific */);
if(strlen($val) == 0) {
$val = "10";
}
return $val;
} }
/** /**
@ -596,14 +624,19 @@ class Application_Model_Preference
* @param $timeInterval new time interval * @param $timeInterval new time interval
*/ */
public static function SetCalendarTimeInterval($timeInterval) { public static function SetCalendarTimeInterval($timeInterval) {
return self::SetValue("calendar_time_interval", $timeInterval, true /* user specific */); self::SetValue("calendar_time_interval", $timeInterval, true /* user specific */);
} }
/** /**
* Retrieves the time interval preference for the current user. * Retrieves the time interval preference for the current user.
* Defaults to 30 min if no entry exists
*/ */
public static function GetCalendarTimeInterval() { public static function GetCalendarTimeInterval() {
return self::GetValue("calendar_time_interval", true /* user specific */); $val = self::GetValue("calendar_time_interval", true /* user specific */);
if(strlen($val) == 0) {
$val = "30";
}
return $val;
} }
/* User specific preferences end */ /* User specific preferences end */

View file

@ -163,7 +163,7 @@ class Application_Model_User {
$sql; $sql;
$sql_gen = "SELECT id AS value, login AS label FROM cc_subjs "; $sql_gen = "SELECT login AS value, login AS label, id as index FROM cc_subjs ";
$sql = $sql_gen; $sql = $sql_gen;
if(is_array($type)) { if(is_array($type)) {

View file

@ -19,6 +19,7 @@ class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{
// retrieve and validate current and latest versions, // retrieve and validate current and latest versions,
$current = Application_Model_Preference::GetAirtimeVersion(); $current = Application_Model_Preference::GetAirtimeVersion();
$latest = Application_Model_Preference::GetLatestVersion(); $latest = Application_Model_Preference::GetLatestVersion();
$link = Application_Model_Preference::GetLatestLink();
$pattern = "/^([0-9]+)\.([0-9]+)\.[0-9]+/"; $pattern = "/^([0-9]+)\.([0-9]+)\.[0-9]+/";
preg_match($pattern, $current, $curMatch); preg_match($pattern, $current, $curMatch);
preg_match($pattern, $latest, $latestMatch); preg_match($pattern, $latest, $latestMatch);
@ -50,6 +51,7 @@ class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{
$result = "<div id='version-diff' style='display:none'>" . $diff . "</div>" $result = "<div id='version-diff' style='display:none'>" . $diff . "</div>"
. "<div id='version-current' style='display:none'>" . $current . "</div>" . "<div id='version-current' style='display:none'>" . $current . "</div>"
. "<div id='version-latest' style='display:none'>" . $latest . "</div>" . "<div id='version-latest' style='display:none'>" . $latest . "</div>"
. "<div id='version-link' style='display:none'>" . $link . "</div>"
. "<div id='version-icon' class='" . $class . "'></div>"; . "<div id='version-icon' class='" . $class . "'></div>";
return $result; return $result;
} }

View file

@ -1,7 +1,7 @@
<div class="text-content"> <div class="text-content">
<h2>About</h2> <h2>About</h2>
<p> <p>
<a href="http://airtime.sourcefabric.org">Airtime</a> <?php echo AIRTIME_VERSION ?>, the open radio software for scheduling and remote station management.<br> <a href="http://airtime.sourcefabric.org">Airtime</a> <?php echo $this->airtime_version ?>, the open radio software for scheduling and remote station management.<br>
© 2011 <a href="http://www.sourcefabric.org">Sourcefabric</a> o.p.s 2011. Airtime is distributed under the <a href="http://www.gnu.org/licenses/gpl-3.0-standalone.html">GNU GPL v.3</a> © 2011 <a href="http://www.sourcefabric.org">Sourcefabric</a> o.p.s 2011. Airtime is distributed under the <a href="http://www.gnu.org/licenses/gpl-3.0-standalone.html">GNU GPL v.3</a>
</p> </p>
</div> </div>

View file

@ -1,7 +1,7 @@
<?php <?php
$s_name = "s".$this->stream_number; $s_name = "s".$this->stream_number;
?> ?>
<h3 class="collapsible-header"><span class="arrow-icon"></span>Stream <?php echo $this->stream_number?></h3> <h3 class="collapsible-header <?php echo $this->stream_number != '1'?"close":""?>"><span class="arrow-icon"></span>Stream <?php echo $this->stream_number?></h3>
<div class="stream-setting-content" <?php echo $this->stream_number != '1'?'style="display: none;':''?> id="<?=$s_name?>-config"> <div class="stream-setting-content" <?php echo $this->stream_number != '1'?'style="display: none;':''?> id="<?=$s_name?>-config">
<fieldset class="padded"> <fieldset class="padded">
<dl class="zend_form clearfix"> <dl class="zend_form clearfix">

View file

@ -264,7 +264,7 @@ function init() {
$('.listen-control-button').click(function() { $('.listen-control-button').click(function() {
if (stream_window == null || stream_window.closed) if (stream_window == null || stream_window.closed)
stream_window=window.open(baseUrl+"Dashboard/stream-player", 'name', 'width=400,height=216'); stream_window=window.open(baseUrl+"Dashboard/stream-player", 'name', 'width=400,height=178');
stream_window.focus(); stream_window.focus();
return false; return false;
}); });

View file

@ -40,6 +40,13 @@ function getLatestVersion() {
return $("#version-latest").html(); return $("#version-latest").html();
} }
/**
* Returns the download link to latest release in HTML
*/
function getLatestLink() {
return "<a href='" + $("#version-link").html() + "'>" + getLatestVersion() + "</a>";
}
/** /**
* Returns true if current version is up to date * Returns true if current version is up to date
*/ */
@ -51,13 +58,6 @@ function isUpToDate() {
return (diff == 0 && current == latest) || diff < 0; return (diff == 0 && current == latest) || diff < 0;
} }
/**
* Returns the download link to latest release in HTML
*/
function getLatestLink() {
return "<a href='http://apt.sourcefabric.org/misc/'>" + getLatestVersion() + "</a>";
}
/** /**
* Sets up the tooltip for version notification * Sets up the tooltip for version notification
*/ */

View file

@ -122,6 +122,7 @@ function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
function dtDrawCallback() { function dtDrawCallback() {
addLibraryItemEvents(); addLibraryItemEvents();
addMetadataQtip(); addMetadataQtip();
saveNumEntriesSetting();
} }
function addProgressIcon(id) { function addProgressIcon(id) {
@ -280,15 +281,20 @@ function addMetadataQtip(){
} }
/** /**
* Use user preference for number of entries to show; * Updates pref db when user changes the # of entries to show
* defaults to 10 if preference was never set */
function saveNumEntriesSetting() {
$('select[name=library_display_length]').change(function() {
var url = '/Library/set-num-entries/format/json';
$.post(url, {numEntries: $(this).val()});
});
}
/**
* Use user preference for number of entries to show
*/ */
function getNumEntriesPreference(data) { function getNumEntriesPreference(data) {
var numEntries = data.libraryInit.numEntries; return parseInt(data.libraryInit.numEntries);
if(numEntries == '') {
numEntries = '10';
}
return parseInt(numEntries);
} }
function createDataTable(data) { function createDataTable(data) {
@ -327,24 +333,13 @@ function createDataTable(data) {
"bStateSave": true "bStateSave": true
}); });
dTable.fnSetFilteringDelay(350); dTable.fnSetFilteringDelay(350);
// Updates pref db when user changes the # of entries to show
$('select[name=library_display_length]').change(function() {
var url = '/Library/set-num-entries/format/json';
$.post(url, {numEntries: $(this).val()},
function(json){
if(json.error) {
alert(json.error);
}
});
});
} }
$(document).ready(function() { $(document).ready(function() {
$('.tabs').tabs(); $('.tabs').tabs();
$.ajax({ url: "/Api/library-init/format/json", dataType:"json", success:createDataTable $.ajax({ url: "/Api/library-init/format/json", dataType:"json", success:createDataTable,
, error:function(jqXHR, textStatus, errorThrown){}}); error:function(jqXHR, textStatus, errorThrown){}});
checkImportStatus() checkImportStatus()
setInterval( "checkImportStatus()", 5000 ); setInterval( "checkImportStatus()", 5000 );

View file

@ -2,9 +2,12 @@ function showErrorSections() {
$(".errors").each(function(i){ $(".errors").each(function(i){
if($(this).length > 0){ if($(this).length > 0){
$(window).scrollTop($(this).closest("div").position().top); var div = $(this).closest("div")
if(div.attr('class') == "stream-setting-content"){
$(this).closest("div").show();
$(this).closest("fieldset").removeClass('closed'); $(this).closest("fieldset").removeClass('closed');
return false; $(window).scrollTop($(this).closest("div").position().top);
}
} }
}); });
} }

View file

@ -40,7 +40,7 @@ function createDateInput(el, onSelect) {
function autoSelect(event, ui) { function autoSelect(event, ui) {
$("#add_show_hosts-"+ui.item.value).attr("checked", "checked"); $("#add_show_hosts-"+ui.item.index).attr("checked", "checked");
event.preventDefault(); event.preventDefault();
} }
@ -50,11 +50,21 @@ function findHosts(request, callback) {
url = "/User/get-hosts"; url = "/User/get-hosts";
search = request.term; search = request.term;
var noResult = new Array();
noResult[0] = new Array();
noResult[0]['value'] = $("#add_show_hosts_autocomplete").val();
noResult[0]['label'] = "No result found";
noResult[0]['index'] = null;
$.post(url, $.post(url,
{format: "json", term: search}, {format: "json", term: search},
function(json) { function(json) {
if(json.hosts.length<1){
callback(noResult);
}else{
callback(json.hosts); callback(json.hosts);
}
}); });
} }
@ -233,6 +243,12 @@ function setAddShowEvents() {
delay: 200 delay: 200
}); });
form.find("#add_show_hosts_autocomplete").keypress(function(e){
if( e.which == 13 ){
return false;
}
})
form.find("#schedule-show-style input").ColorPicker({ form.find("#schedule-show-style input").ColorPicker({
onChange: function (hsb, hex, rgb, el) { onChange: function (hsb, hex, rgb, el) {
$(el).val(hex); $(el).val(hex);

View file

@ -197,6 +197,10 @@ function viewDisplay( view ) {
.fullCalendar('destroy') .fullCalendar('destroy')
.fullCalendar(opt) .fullCalendar(opt)
.fullCalendar( 'gotoDate', date ); .fullCalendar( 'gotoDate', date );
//save slotMin value to db
var url = '/Schedule/set-time-interval/format/json';
$.post(url, {timeInterval: slotMin});
}); });
var topLeft = $(view.element).find("table.fc-agenda-days > thead th:first"); var topLeft = $(view.element).find("table.fc-agenda-days > thead th:first");
@ -214,6 +218,10 @@ function viewDisplay( view ) {
if(($("#add-show-form").length == 1) && ($("#add-show-form").css('display')=='none') && ($('.fc-header-left > span').length == 5)) { if(($("#add-show-form").length == 1) && ($("#add-show-form").css('display')=='none') && ($('.fc-header-left > span').length == 5)) {
makeAddShowButton(); makeAddShowButton();
} }
//save view name to db
var url = '/Schedule/set-time-scale/format/json';
$.post(url, {timeScale: view.name});
} }
function eventRender(event, element, view) { function eventRender(event, element, view) {

View file

@ -306,26 +306,14 @@ function buildScheduleDialog(json){
* Use user preference for time scale; defaults to month if preference was never set * Use user preference for time scale; defaults to month if preference was never set
*/ */
function getTimeScalePreference(data) { function getTimeScalePreference(data) {
var timeScale = data.calendarInit.timeScale; return data.calendarInit.timeScale;
if(timeScale == 'day') {
timeScale = 'agendaDay';
} else if(timeScale == 'week') {
timeScale = 'agendaWeek';
} else {
timeScale = 'month';
}
return timeScale;
} }
/** /**
* Use user preference for time interval; defaults to 30m if preference was never set * Use user preference for time interval; defaults to 30m if preference was never set
*/ */
function getTimeIntervalPreference(data) { function getTimeIntervalPreference(data) {
var timeInterval = data.calendarInit.timeInterval; return parseInt(data.calendarInit.timeInterval);
if(timeInterval == '') {
timeInterval = '30';
}
return parseInt(timeInterval);
} }
function createFullCalendar(data){ function createFullCalendar(data){
@ -366,28 +354,6 @@ function createFullCalendar(data){
eventDrop: eventDrop, eventDrop: eventDrop,
eventResize: eventResize eventResize: eventResize
}); });
//Update time scale preference when day/week/month button is clicked
$(".fc-button-content").click(function() {
var url = '/Schedule/set-time-scale/format/json';
$.post(url, {timeScale: $(this).text()},
function(json){
if(json.error) {
alert(json.error);
}
});
});
//Update time interval preference when dropdown is updated
$(".schedule_change_slots.input_select").change(function() {
var url = '/Schedule/set-time-interval/format/json';
$.post(url, {timeInterval: $(this).val()},
function(json){
if(json.error) {
alert(json.error);
}
});
});
} }
//Alert the error and reload the page //Alert the error and reload the page

View file

@ -72,6 +72,8 @@ if(Application_Model_Preference::GetSupportFeedback() == '1'){
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataArray); curl_setopt($ch, CURLOPT_POSTFIELDS, $dataArray);
$result = curl_exec($ch); $result = curl_exec($ch);
curl_close($ch);
} }
// Get latest version from stat server and store to db // Get latest version from stat server and store to db
@ -83,7 +85,15 @@ if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch); $result = curl_exec($ch);
Application_Model_Preference::SetLatestVersion($result); if(curl_errno($ch)) {
echo "curl error: " . curl_error($ch) . "\n";
} else {
$resultArray = explode("\n", $result);
Application_Model_Preference::SetLatestVersion($resultArray[0]);
Application_Model_Preference::SetLatestLink($resultArray[1]);
}
curl_close($ch);
} }
/** /**