Merge branch '2.5.x' into 2.5.x-installer

This commit is contained in:
Albert Santoni 2015-01-22 17:36:12 -05:00
commit 6e43505379
27 changed files with 166 additions and 39 deletions

View file

@ -209,8 +209,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$interval = 'P21D';
} elseif ($formData["add_show_repeat_type"] == 5) {
$interval = 'P28D';
} elseif ($formData["add_show_repeat_type"] == 2) {
} elseif ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 2) {
$interval = 'P1M';
} elseif ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 3) {
list($weekNumberOfMonth, $dayOfWeek) =
Application_Service_ShowService::getMonthlyWeeklyRepeatInterval(
new DateTime($start_time, $showTimezone));
}
/* Check first show
@ -287,12 +291,26 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
break 1;
} else {
$repeatShowStart->setTimezone($showTimezone);
$repeatShowEnd->setTimezone($showTimezone);
$repeatShowStart->add(new DateInterval($interval));
$repeatShowEnd->add(new DateInterval($interval));
$repeatShowStart->setTimezone($utc);
$repeatShowEnd->setTimezone($utc);
if ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 3) {
$monthlyWeeklyStart = new DateTime($repeatShowStart->format("Y-m"),
new DateTimeZone("UTC"));
$monthlyWeeklyStart->add(new DateInterval("P1M"));
$repeatShowStart = clone Application_Service_ShowService::getNextMonthlyWeeklyRepeatDate(
$monthlyWeeklyStart,
$formData["add_show_timezone"],
$formData['add_show_start_time'],
$weekNumberOfMonth,
$dayOfWeek);
$repeatShowEnd = clone $repeatShowStart;
$repeatShowEnd->add(new DateInterval("PT".$hours."H".$minutes."M"));
} else {
$repeatShowStart->setTimezone($showTimezone);
$repeatShowEnd->setTimezone($showTimezone);
$repeatShowStart->add(new DateInterval($interval));
$repeatShowEnd->add(new DateInterval($interval));
$repeatShowStart->setTimezone($utc);
$repeatShowEnd->setTimezone($utc);
}
}
}
}

View file

@ -88,11 +88,19 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
public static function deleteStreams($p_ids, $p_userId)
{
$leftOver = self::streamsNotOwnedByUser($p_ids, $p_userId);
if (count($leftOver) == 0) {
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
if (!$isAdminOrPM) {
$leftOver = self::streamsNotOwnedByUser($p_ids, $p_userId);
if (count($leftOver) == 0) {
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
} else {
throw new WebstreamNoPermissionException;
}
} else {
throw new WebstreamNoPermissionException;
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
}
}

View file

@ -1109,7 +1109,7 @@ SQL;
$start = $this->getNextRepeatingPopulateStartDateTime($showDay);
if (is_null($repeatInterval)&& $repeatType == REPEAT_MONTHLY_WEEKLY) {
$repeatInterval = $this->getMonthlyWeeklyRepeatInterval($start, $timezone);
$repeatInterval = self::getMonthlyWeeklyRepeatInterval($start, $timezone);
}
//DatePeriod in user's local time
@ -1212,7 +1212,7 @@ SQL;
// We will only need this if the repeat type is MONTHLY_WEEKLY
list($weekNumberOfMonth, $dayOfWeek) =
$this->getMonthlyWeeklyRepeatInterval(
self::getMonthlyWeeklyRepeatInterval(
new DateTime($first_show, new DateTimeZone($timezone)));
$this->repeatType = $showDay->getDbRepeatType();
@ -1272,7 +1272,7 @@ SQL;
$monthlyWeeklyStart = new DateTime($utcStartDateTime->format("Y-m"),
new DateTimeZone("UTC"));
$monthlyWeeklyStart->add(new DateInterval("P1M"));
$start = $this->getNextMonthlyWeeklyRepeatDate(
$start = self::getNextMonthlyWeeklyRepeatDate(
$monthlyWeeklyStart,
$timezone,
$showDay->getDbStartTime(),
@ -1294,7 +1294,7 @@ SQL;
* @param string $showStart
* @param string $timezone user's local timezone
*/
private function getMonthlyWeeklyRepeatInterval($showStart)
public static function getMonthlyWeeklyRepeatInterval($showStart)
{
$start = clone $showStart;
$dayOfMonth = $start->format("j");
@ -1369,7 +1369,7 @@ SQL;
* @param string (i.e. 'first', 'second') $weekNumberOfMonth
* @param string (i.e. 'Monday') $dayOfWeek
*/
private function getNextMonthlyWeeklyRepeatDate(
public static function getNextMonthlyWeeklyRepeatDate(
$start,
$timezone,
$startTime,

View file

@ -1059,7 +1059,10 @@ var AIRTIME = (function(AIRTIME){
"<i class='icon-white icon-ban-circle'></i></button></div>");
}
$toolbar.append($menu);
if (localStorage.getItem('user-type') != 'G') {
$toolbar.append($menu);
}
$menu = undefined;
$('#timeline-sa').click(function(){mod.selectAll();});

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -338,4 +340,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value>1</value>
<value>1</value>
<value></value>
</row>
</table>
@ -134,4 +136,4 @@
<value>1</value>
</row>
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -104,4 +106,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value>1</value>
<value>1</value>
<value></value>
</row>
</table>
@ -134,4 +136,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -94,4 +96,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -94,4 +96,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -84,4 +86,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -248,4 +250,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -94,4 +96,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -94,4 +96,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -134,4 +136,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -270,4 +272,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -134,4 +136,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -260,4 +262,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -94,4 +96,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -157,4 +159,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value>1</value>
<value>1</value>
<value></value>
</row>
</table>
@ -134,4 +136,4 @@
<value>1</value>
</row>
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -134,4 +136,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value></value>
<value></value>
</row>
</table>
@ -134,4 +136,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -104,4 +106,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

View file

@ -14,6 +14,7 @@
<column>live_stream_pass</column>
<column>linked</column>
<column>is_linkable</column>
<column>image_path</column>
<row>
<value>1</value>
<value>test show</value>
@ -28,6 +29,7 @@
<null />
<value></value>
<value>1</value>
<value></value>
</row>
</table>
@ -84,4 +86,4 @@
<table name="cc_show_hosts">
</table>
</dataset>
</dataset>

54
utils/upgrade.py Executable file
View file

@ -0,0 +1,54 @@
#!/usr/bin/python
import ConfigParser
import argparse
import requests
from urlparse import urlparse
import sys
CONFIG_PATH='/etc/airtime/airtime.conf'
GENERAL_CONFIG_SECTION = "general"
def read_config_file(config_path):
"""Parse the application's config file located at config_path."""
config = ConfigParser.SafeConfigParser()
try:
config.readfp(open(config_path))
except IOError as e:
print "Failed to open config file at " + config_path + ": " + e.strerror
exit(-1)
except Exception:
print e.strerror
exit(-1)
return config
if __name__ == '__main__':
config = read_config_file(CONFIG_PATH)
api_key = config.get(GENERAL_CONFIG_SECTION, 'api_key')
base_url = config.get(GENERAL_CONFIG_SECTION, 'base_url')
base_dir = config.get(GENERAL_CONFIG_SECTION, 'base_dir')
action = "upgrade"
airtime_url = ""
parser = argparse.ArgumentParser()
parser.add_argument('--downgrade', help='Downgrade the station', action="store_true")
parser.add_argument('station_url', help='station URL', nargs='?', default='')
args = parser.parse_args()
if args.downgrade:
action = "downgrade"
if airtime_url == "":
airtime_url = "http://%s%s" % (base_url, base_dir)
# Add http:// if you were lazy and didn't pass a scheme to this script
url = urlparse(airtime_url)
if not url.scheme:
airtime_url = "http://%s" % airtime_url
print "Requesting %s..." % action
r = requests.get("%s/%s" % (airtime_url, action), auth=(api_key, ''))
print r.text
r.raise_for_status()