Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
d639f7c5a6
|
@ -35,7 +35,7 @@ class DashboardController extends Zend_Controller_Action
|
|||
|
||||
public function aboutAction()
|
||||
{
|
||||
// action body
|
||||
$this->view->airtime_version = Application_Model_Preference::GetAirtimeVersion();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ class UserController extends Zend_Controller_Action
|
|||
public function getHostsAction()
|
||||
{
|
||||
$search = $this->_getParam('term');
|
||||
$res = Application_Model_User::getHosts($search);
|
||||
$this->view->hosts = Application_Model_User::getHosts($search);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
|
|||
$hosts = Application_Model_User::getHosts();
|
||||
|
||||
foreach ($hosts as $host) {
|
||||
$options[$host['value']] = $host['label'];
|
||||
$options[$host['index']] = $host['label'];
|
||||
}
|
||||
|
||||
//Add hosts selection
|
||||
|
|
|
@ -526,6 +526,24 @@ class Application_Model_Preference
|
|||
self::SetValue("latest_version", $version);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
self::SetValue("soundcloud_upload_option", $upload);
|
||||
|
@ -559,19 +577,24 @@ class Application_Model_Preference
|
|||
/* 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
|
||||
*/
|
||||
public static function SetCalendarTimeScale($timeScale) {
|
||||
return self::SetValue("calendar_time_scale", $timeScale, true /* user specific */);
|
||||
public static function SetCalendarTimeScale($timeScale) {
|
||||
self::SetValue("calendar_time_scale", $timeScale, true /* user specific */);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the time scale preference for the current user.
|
||||
* Defaults to month if no entry exists
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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.
|
||||
* Defaults to 10 if no entry exists
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -595,15 +623,20 @@ class Application_Model_Preference
|
|||
*
|
||||
* @param $timeInterval new time interval
|
||||
*/
|
||||
public static function SetCalendarTimeInterval($timeInterval) {
|
||||
return self::SetValue("calendar_time_interval", $timeInterval, true /* user specific */);
|
||||
public static function SetCalendarTimeInterval($timeInterval) {
|
||||
self::SetValue("calendar_time_interval", $timeInterval, true /* user specific */);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the time interval preference for the current user.
|
||||
* Defaults to 30 min if no entry exists
|
||||
*/
|
||||
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 */
|
||||
|
|
|
@ -163,7 +163,7 @@ class Application_Model_User {
|
|||
|
||||
$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;
|
||||
|
||||
if(is_array($type)) {
|
||||
|
|
|
@ -19,6 +19,7 @@ class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{
|
|||
// retrieve and validate current and latest versions,
|
||||
$current = Application_Model_Preference::GetAirtimeVersion();
|
||||
$latest = Application_Model_Preference::GetLatestVersion();
|
||||
$link = Application_Model_Preference::GetLatestLink();
|
||||
$pattern = "/^([0-9]+)\.([0-9]+)\.[0-9]+/";
|
||||
preg_match($pattern, $current, $curMatch);
|
||||
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>"
|
||||
. "<div id='version-current' style='display:none'>" . $current . "</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>";
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="text-content">
|
||||
<h2>About</h2>
|
||||
<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>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
$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">
|
||||
<fieldset class="padded">
|
||||
<dl class="zend_form clearfix">
|
||||
|
|
|
@ -264,7 +264,7 @@ function init() {
|
|||
|
||||
$('.listen-control-button').click(function() {
|
||||
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();
|
||||
return false;
|
||||
});
|
||||
|
|
|
@ -40,6 +40,13 @@ function getLatestVersion() {
|
|||
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
|
||||
*/
|
||||
|
@ -51,13 +58,6 @@ function isUpToDate() {
|
|||
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
|
||||
*/
|
||||
|
|
|
@ -122,6 +122,7 @@ function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
|||
function dtDrawCallback() {
|
||||
addLibraryItemEvents();
|
||||
addMetadataQtip();
|
||||
saveNumEntriesSetting();
|
||||
}
|
||||
|
||||
function addProgressIcon(id) {
|
||||
|
@ -280,19 +281,24 @@ function addMetadataQtip(){
|
|||
}
|
||||
|
||||
/**
|
||||
* Use user preference for number of entries to show;
|
||||
* defaults to 10 if preference was never set
|
||||
* Updates pref db when user changes the # of entries to show
|
||||
*/
|
||||
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) {
|
||||
var numEntries = data.libraryInit.numEntries;
|
||||
if(numEntries == '') {
|
||||
numEntries = '10';
|
||||
}
|
||||
return parseInt(numEntries);
|
||||
return parseInt(data.libraryInit.numEntries);
|
||||
}
|
||||
|
||||
function createDataTable(data) {
|
||||
var dTable = $('#library_display').dataTable( {
|
||||
var dTable = $('#library_display').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "/Library/contents/format/json",
|
||||
|
@ -320,35 +326,24 @@ function createDataTable(data) {
|
|||
"sPaginationType": "full_numbers",
|
||||
"bJQueryUI": true,
|
||||
"bAutoWidth": false,
|
||||
"oLanguage": {
|
||||
"sSearch": ""
|
||||
},
|
||||
"iDisplayLength": getNumEntriesPreference(data),
|
||||
"bStateSave": true
|
||||
});
|
||||
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);
|
||||
}
|
||||
});
|
||||
});
|
||||
"oLanguage": {
|
||||
"sSearch": ""
|
||||
},
|
||||
"iDisplayLength": getNumEntriesPreference(data),
|
||||
"bStateSave": true
|
||||
});
|
||||
dTable.fnSetFilteringDelay(350);
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.tabs').tabs();
|
||||
|
||||
$.ajax({ url: "/Api/library-init/format/json", dataType:"json", success:createDataTable
|
||||
, error:function(jqXHR, textStatus, errorThrown){}});
|
||||
|
||||
checkImportStatus()
|
||||
setInterval( "checkImportStatus()", 5000 );
|
||||
setInterval( "checkSCUploadStatus()", 5000 );
|
||||
|
||||
addQtipToSCIcons()
|
||||
$('.tabs').tabs();
|
||||
|
||||
$.ajax({ url: "/Api/library-init/format/json", dataType:"json", success:createDataTable,
|
||||
error:function(jqXHR, textStatus, errorThrown){}});
|
||||
|
||||
checkImportStatus()
|
||||
setInterval( "checkImportStatus()", 5000 );
|
||||
setInterval( "checkSCUploadStatus()", 5000 );
|
||||
|
||||
addQtipToSCIcons()
|
||||
});
|
||||
|
|
|
@ -2,9 +2,12 @@ function showErrorSections() {
|
|||
|
||||
$(".errors").each(function(i){
|
||||
if($(this).length > 0){
|
||||
$(window).scrollTop($(this).closest("div").position().top);
|
||||
$(this).closest("fieldset").removeClass('closed');
|
||||
return false;
|
||||
var div = $(this).closest("div")
|
||||
if(div.attr('class') == "stream-setting-content"){
|
||||
$(this).closest("div").show();
|
||||
$(this).closest("fieldset").removeClass('closed');
|
||||
$(window).scrollTop($(this).closest("div").position().top);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ function createDateInput(el, onSelect) {
|
|||
|
||||
function autoSelect(event, ui) {
|
||||
|
||||
$("#add_show_hosts-"+ui.item.value).attr("checked", "checked");
|
||||
$("#add_show_hosts-"+ui.item.index).attr("checked", "checked");
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
|
@ -50,11 +50,21 @@ function findHosts(request, callback) {
|
|||
url = "/User/get-hosts";
|
||||
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,
|
||||
{format: "json", term: search},
|
||||
|
||||
function(json) {
|
||||
callback(json.hosts);
|
||||
if(json.hosts.length<1){
|
||||
callback(noResult);
|
||||
}else{
|
||||
callback(json.hosts);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -232,6 +242,12 @@ function setAddShowEvents() {
|
|||
select: autoSelect,
|
||||
delay: 200
|
||||
});
|
||||
|
||||
form.find("#add_show_hosts_autocomplete").keypress(function(e){
|
||||
if( e.which == 13 ){
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
form.find("#schedule-show-style input").ColorPicker({
|
||||
onChange: function (hsb, hex, rgb, el) {
|
||||
|
|
|
@ -197,6 +197,10 @@ function viewDisplay( view ) {
|
|||
.fullCalendar('destroy')
|
||||
.fullCalendar(opt)
|
||||
.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");
|
||||
|
@ -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)) {
|
||||
makeAddShowButton();
|
||||
}
|
||||
|
||||
//save view name to db
|
||||
var url = '/Schedule/set-time-scale/format/json';
|
||||
$.post(url, {timeScale: view.name});
|
||||
}
|
||||
|
||||
function eventRender(event, element, view) {
|
||||
|
|
|
@ -306,26 +306,14 @@ function buildScheduleDialog(json){
|
|||
* Use user preference for time scale; defaults to month if preference was never set
|
||||
*/
|
||||
function getTimeScalePreference(data) {
|
||||
var timeScale = data.calendarInit.timeScale;
|
||||
if(timeScale == 'day') {
|
||||
timeScale = 'agendaDay';
|
||||
} else if(timeScale == 'week') {
|
||||
timeScale = 'agendaWeek';
|
||||
} else {
|
||||
timeScale = 'month';
|
||||
}
|
||||
return timeScale;
|
||||
return data.calendarInit.timeScale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use user preference for time interval; defaults to 30m if preference was never set
|
||||
*/
|
||||
function getTimeIntervalPreference(data) {
|
||||
var timeInterval = data.calendarInit.timeInterval;
|
||||
if(timeInterval == '') {
|
||||
timeInterval = '30';
|
||||
}
|
||||
return parseInt(timeInterval);
|
||||
return parseInt(data.calendarInit.timeInterval);
|
||||
}
|
||||
|
||||
function createFullCalendar(data){
|
||||
|
@ -366,28 +354,6 @@ function createFullCalendar(data){
|
|||
eventDrop: eventDrop,
|
||||
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
|
||||
|
|
|
@ -72,6 +72,8 @@ if(Application_Model_Preference::GetSupportFeedback() == '1'){
|
|||
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataArray);
|
||||
$result = curl_exec($ch);
|
||||
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
// 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);
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue