Merge branch '2.2.x' into devel

Conflicts:
	airtime_mvc/application/controllers/LibraryController.php
	airtime_mvc/application/views/scripts/library/library.phtml
	airtime_mvc/public/js/airtime/showbuilder/builder.js
	airtime_mvc/public/js/airtime/showbuilder/main_builder.js
This commit is contained in:
denise 2012-11-02 12:28:21 -04:00
commit 135aadf16b
56 changed files with 5240 additions and 4806 deletions

View file

@ -183,7 +183,8 @@ class LibraryController extends Zend_Controller_Action
}
}
}
if ($isAdminOrPM) {
if ($isAdminOrPM || $file->getFileOwnerId() == $user->getId()) {
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $baseUrl."/library/delete");
$menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => $baseUrl."/library/edit-file-md/id/{$id}");
}
@ -279,6 +280,7 @@ class LibraryController extends Zend_Controller_Action
$streams = array();
$message = null;
$noPermissionMsg = "You don't have permission to delete selected items.";
foreach ($mediaItems as $media) {
@ -296,19 +298,21 @@ class LibraryController extends Zend_Controller_Action
try {
Application_Model_Playlist::deletePlaylists($playlists, $user->getId());
} catch (PlaylistNoPermissionException $e) {
$this->view->message = "You don't have permission to delete selected items.";
return;
$message = $noPermissionMsg;
}
try {
Application_Model_Block::deleteBlocks($blocks, $user->getId());
} catch (BlockNoPermissionException $e) {
$message = $noPermissionMsg;
} catch (Exception $e) {
//TODO: warn user that not all blocks could be deleted.
}
try {
Application_Model_Webstream::deleteStreams($streams, $user->getId());
} catch (WebstreamNoPermissionException $e) {
$message = $noPermissionMsg;
} catch (Exception $e) {
//TODO: warn user that not all streams could be deleted.
Logging::info($e);
@ -321,6 +325,8 @@ class LibraryController extends Zend_Controller_Action
if (isset($file)) {
try {
$res = $file->delete(true);
} catch (FileNoPermissionException $e) {
$message = $noPermissionMsg;
} catch (Exception $e) {
//could throw a scheduled in future exception.
$message = "Could not delete some scheduled files.";
@ -367,15 +373,17 @@ class LibraryController extends Zend_Controller_Action
{
$user = Application_Model_User::getCurrentUser();
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
if (!$isAdminOrPM) {
return;
}
$request = $this->getRequest();
$form = new Application_Form_EditAudioMD();
$file_id = $this->_getParam('id', null);
$file = Application_Model_StoredFile::Recall($file_id);
if (!$isAdminOrPM && $file->getFileOwnerId() != $user->getId()) {
return;
}
$form = new Application_Form_EditAudioMD();
$form->populate($file->getDbColMetadata());
if ($request->isPost()) {

View file

@ -513,6 +513,7 @@ class PlaylistController extends Zend_Controller_Action
} catch (BlockNotFoundException $e) {
$this->playlistNotFound('block', true);
} catch (Exception $e) {
//Logging::info($e);
$this->playlistUnknownError($e);
}
}

View file

@ -212,6 +212,14 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
}//for
$repeatTracks = new Zend_Form_Element_Checkbox('sp_repeat_tracks');
$repeatTracks->setDecorators(array('viewHelper'))
->setLabel('Allow Repeat Tracks:');
if (isset($storedCrit["repeat_tracks"])) {
$repeatTracks->setChecked($storedCrit["repeat_tracks"]["value"] == 1?true:false);
}
$this->addElement($repeatTracks);
$limit = new Zend_Form_Element_Select('sp_limit_options');
$limit->setAttrib('class', 'sp_input_select')
->setDecorators(array('viewHelper'))
@ -220,7 +228,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$limit->setValue($storedCrit["limit"]["modifier"]);
}
$this->addElement($limit);
$limitValue = new Zend_Form_Element_Text('sp_limit_value');
$limitValue->setAttrib('class', 'sp_input_text_limit')
->setLabel('Limit to')

View file

@ -308,10 +308,11 @@ SQL;
$length = $value." ".$modifier;
} else {
$hour = "00";
$mins = "00";
if ($modifier == "minutes") {
if ($value >59) {
$hour = intval($value/60);
$value = $value%60;
$mins = $value%60;
}
} elseif ($modifier == "hours") {
@ -1092,6 +1093,14 @@ SQL;
->setDbValue($p_criteriaData['etc']['sp_limit_value'])
->setDbBlockId($this->id)
->save();
// insert repeate track option
$qry = new CcBlockcriteria();
$qry->setDbCriteria("repeat_tracks")
->setDbModifier("N/A")
->setDbValue($p_criteriaData['etc']['sp_repeat_tracks'])
->setDbBlockId($this->id)
->save();
}
/**
@ -1104,7 +1113,12 @@ SQL;
$this->saveSmartBlockCriteria($p_criteria);
$insertList = $this->getListOfFilesUnderLimit();
$this->deleteAllFilesFromBlock();
$this->addAudioClips(array_keys($insertList));
// constrcut id array
$ids = array();
foreach ($insertList as $ele) {
$ids[] = $ele['id'];
}
$this->addAudioClips(array_values($ids));
// update length in playlist contents.
$this->updateBlockLengthInAllPlaylist();
@ -1133,6 +1147,7 @@ SQL;
$info = $this->getListofFilesMeetCriteria();
$files = $info['files'];
$limit = $info['limit'];
$repeat = $info['repeat_tracks'];
$insertList = array();
$totalTime = 0;
@ -1141,19 +1156,37 @@ SQL;
// this moves the pointer to the first element in the collection
$files->getFirst();
$iterator = $files->getIterator();
while ($iterator->valid() && $totalTime < $limit['time']) {
$isBlockFull = false;
while ($iterator->valid()) {
$id = $iterator->current()->getDbId();
$length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength());
$insertList[$id] = $length;
$insertList[] = array('id'=>$id, 'length'=>$length);
$totalTime += $length;
$totalItems++;
if ((!is_null($limit['items']) && $limit['items'] == count($insertList)) || $totalItems > 500) {
if ((!is_null($limit['items']) && $limit['items'] == count($insertList)) || $totalItems > 500 || $totalTime > $limit['time']) {
$isBlockFull = true;
break;
}
$iterator->next();
}
$sizeOfInsert = count($insertList);
// if block is not full and reapeat_track is check, fill up more
while (!$isBlockFull && $repeat == 1) {
$randomEleKey = array_rand(array_slice($insertList, 0, $sizeOfInsert));
$insertList[] = $insertList[$randomEleKey];
$totalTime += $insertList[$randomEleKey]['length'];
$totalItems++;
if ((!is_null($limit['items']) && $limit['items'] == count($insertList)) || $totalItems > 500 || $totalTime > $limit['time']) {
break;
}
}
return $insertList;
}
@ -1201,6 +1234,8 @@ SQL;
if ($criteria == "limit") {
$storedCrit["limit"] = array("value"=>$value, "modifier"=>$modifier);
} else if($criteria == "repeat_tracks") {
$storedCrit["repeat_tracks"] = array("value"=>$value);
} else {
$storedCrit["crit"][$criteria][] = array("criteria"=>$criteria, "value"=>$value, "modifier"=>$modifier, "extra"=>$extra, "display_name"=>$criteriaOptions[$criteria]);
}
@ -1316,6 +1351,7 @@ SQL;
}
// construct limit restriction
$limits = array();
if (isset($storedCrit['limit'])) {
if ($storedCrit['limit']['modifier'] == "items") {
$limits['time'] = 1440 * 60;
@ -1327,10 +1363,16 @@ SQL;
$limits['items'] = null;
}
}
$repeatTracks = 0;
if (isset($storedCrit['repeat_tracks'])) {
$repeatTracks = $storedCrit['repeat_tracks']['value'];
}
try {
$out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();
return array("files"=>$out, "limit"=>$limits, "count"=>$out->count());
return array("files"=>$out, "limit"=>$limits, "repeat_tracks"=> $repeatTracks, "count"=>$out->count());
} catch (Exception $e) {
Logging::info($e);
}
@ -1376,7 +1418,7 @@ SQL;
$output['etc'][$ele['name']] = $ele['value'];
}
}
return $output;
}
// smart block functions end

View file

@ -13,9 +13,9 @@ class Application_Model_Datatables
if ($dbname == 'utime' || $dbname == 'mtime') {
$input1 = isset($info[0])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[0]):null;
$input2 = isset($info[1])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[1]):null;
} else if($dbname == 'bit_rate') {
$input1 = isset($info[0])?intval($info[0]) * 1000:null;
$input2 = isset($info[1])?intval($info[1]) * 1000:null;
} else if($dbname == 'bit_rate' || $dbname == 'sample_rate') {
$input1 = isset($info[0])?doubleval($info[0]) * 1000:null;
$input2 = isset($info[1])?doubleval($info[1]) * 1000:null;
} else {
$input1 = isset($info[0])?$info[0]:null;
$input2 = isset($info[1])?$info[1]:null;

View file

@ -268,7 +268,7 @@ SQL;
//We need to search 24 hours before and after the show times so that that we
//capture all of the show's contents.
//capture all of the show's contents.
$p_track_start= $p_start->sub(new DateInterval("PT24H"))->format("Y-m-d H:i:s");
$p_track_end = $p_end->add(new DateInterval("PT24H"))->format("Y-m-d H:i:s");
@ -292,7 +292,8 @@ SQL;
ft.artist_name AS file_artist_name,
ft.album_title AS file_album_title,
ft.length AS file_length,
ft.file_exists AS file_exists
ft.file_exists AS file_exists,
ft.mime AS file_mime
SQL;
$filesJoin = <<<SQL
cc_schedule AS sched
@ -319,7 +320,8 @@ SQL;
sub.login AS file_artist_name,
ws.description AS file_album_title,
ws.length AS file_length,
't'::BOOL AS file_exists
't'::BOOL AS file_exists,
NULL as file_mime
SQL;
$streamJoin = <<<SQL
cc_schedule AS sched
@ -661,6 +663,7 @@ SQL;
$data["media"][$switch_start]['start'] = $switch_start;
$data["media"][$switch_start]['end'] = $switch_start;
$data["media"][$switch_start]['event_type'] = "switch_off";
$data["media"][$switch_start]['type'] = "event";
$data["media"][$switch_start]['independent_event'] = true;
}
}

View file

@ -270,6 +270,13 @@ SQL;
try {
//update the status flag in cc_schedule.
/* Since we didn't use a propel object when updating
* cc_show_instances table we need to clear the instances
* so the correct information is retrieved from the db
*/
CcShowInstancesPeer::clearInstancePool();
$instances = CcShowInstancesQuery::create()
->filterByDbEnds($current_timestamp, Criteria::GREATER_THAN)
->filterByDbShowId($this->_showId)
@ -1253,6 +1260,7 @@ SQL;
if ($data['add_show_id'] != -1) {
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
$con->beginTransaction();
//current timesamp in UTC.
$current_timestamp = gmdate("Y-m-d H:i:s");

View file

@ -41,6 +41,7 @@ class Application_Model_ShowBuilder
"fadein" => "",
"fadeout" => "",
"image" => false,
"mime" => null,
"color" => "", //in hex without the '#' sign.
"backgroundColor" => "", //in hex without the '#' sign.
);
@ -277,6 +278,7 @@ class Application_Model_ShowBuilder
$row["cueout"] = $p_item["cue_out"];
$row["fadein"] = round(substr($p_item["fade_in"], 6), 6);
$row["fadeout"] = round(substr($p_item["fade_out"], 6), 6);
$row["mime"] = $p_item["file_mime"];
$row["pos"] = $this->pos++;
@ -471,7 +473,7 @@ class Application_Model_ShowBuilder
$display_items[] = $this->makeFooterRow($scheduled_items[
count($scheduled_items)-1]);
}
return array(
"schedule" => $display_items,
"showInstances" => $this->showInstances);

View file

@ -344,6 +344,13 @@ SQL;
throw new DeleteScheduledFileException();
}
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
if (!$isAdminOrPM && $this->getFileOwnerId() != $user->getId()) {
throw new FileNoPermissionException();
}
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
$type = $music_dir->getType();
@ -1163,6 +1170,10 @@ SQL;
return $this->_file->getDbFileExists();
}
public function getFileOwnerId()
{
return $this->_file->getDbOwnerId();
}
// note: never call this method from controllers because it does a sleep
public function uploadToSoundCloud()
@ -1211,3 +1222,4 @@ SQL;
class DeleteScheduledFileException extends Exception {}
class FileDoesNotExistException extends Exception {}
class FileNoPermissionException extends Exception {}

View file

@ -92,7 +92,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
if (count($leftOver) == 0) {
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
} else {
throw new Exception("Invalid user permissions");
throw new WebstreamNoPermissionException;
}
}
@ -185,7 +185,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
}
$mediaUrl = self::getMediaUrl($url, $mime, $content_length_found);
if (preg_match("/(x-mpegurl)|(xspf\+xml)|(pls\+xml)/", $mime)) {
if (preg_match("/(x-mpegurl)|(xspf\+xml)|(pls\+xml)|(x-scpls)/", $mime)) {
list($mime, $content_length_found) = self::discoverStreamMime($mediaUrl);
}
} catch (Exception $e) {
@ -307,7 +307,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
$media_url = self::getM3uUrl($url);
} elseif (preg_match("/xspf\+xml/", $mime)) {
$media_url = self::getXspfUrl($url);
} elseif (preg_match("/pls\+xml/", $mime)) {
} elseif (preg_match("/pls\+xml/", $mime) || preg_match("/x-scpls/", $mime)) {
$media_url = self::getPlsUrl($url);
} elseif (preg_match("/(mpeg|ogg)/", $mime)) {
if ($content_length_found) {
@ -370,3 +370,6 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
return $webstream->getDbId();
}
}
class WebstreamNoPermissionException extends Exception {}

View file

@ -54,7 +54,7 @@ class CcBlockTableMap extends TableMap {
*/
public function buildRelations()
{
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), null, null);
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
$this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
$this->addRelation('CcBlockcriteria', 'CcBlockcriteria', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);

View file

@ -64,7 +64,7 @@ class CcSubjsTableMap extends TableMap {
$this->addRelation('CcPerms', 'CcPerms', RelationMap::ONE_TO_MANY, array('id' => 'subj', ), 'CASCADE', null);
$this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'subjs_id', ), 'CASCADE', null);
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null);
$this->addRelation('CcBlock', 'CcBlock', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), null, null);
$this->addRelation('CcBlock', 'CcBlock', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null);
$this->addRelation('CcPref', 'CcPref', RelationMap::ONE_TO_MANY, array('id' => 'subjid', ), 'CASCADE', null);
$this->addRelation('CcSess', 'CcSess', RelationMap::ONE_TO_MANY, array('id' => 'userid', ), 'CASCADE', null);
$this->addRelation('CcSubjsToken', 'CcSubjsToken', RelationMap::ONE_TO_MANY, array('id' => 'user_id', ), 'CASCADE', null);

View file

@ -407,6 +407,9 @@ abstract class BaseCcSubjsPeer {
// Invalidate objects in CcPlaylistPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcPlaylistPeer::clearInstancePool();
// Invalidate objects in CcBlockPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcBlockPeer::clearInstancePool();
// Invalidate objects in CcPrefPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcPrefPeer::clearInstancePool();

View file

@ -1,3 +1,3 @@
<?php
<?php
echo $status;

View file

@ -1,182 +1,182 @@
<div id="register_popup" class="dialogPopup register-dialog" title="Register Airtime" style="display: none;">
<form id="register-form" method="<?php echo $this->element->getMethod() ?>" action="<?php echo $this->element->getAction() ?>" enctype="multipart/form-data">
<fieldset>
<dl class="zend_form">
<dt class="block-display info-text">
Help Airtime improve by letting us know how you are using it. This info
will be collected regularly in order to enhance your user experience.
<br /><br />
Click "Yes, help Airtime" and we'll make sure the features you use are
constantly improving.
</dt>
<dd id="SupportFeedback-element" class="block-display">
<label class="optional" for="SupportFeedback">
<?php echo $this->element->getElement('SupportFeedback') ?>
<strong><?php echo $this->element->getElement('SupportFeedback')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('SupportFeedback')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('SupportFeedback')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt class="block-display info-text">
Click the box below to advertise your station on
<a id="link_to_whos_using" href="http://sourcefabric.org/en/airtime/whosusing" onclick="window.open(this.href); return false">Sourcefabric.org</a>.
In order to promote your station, "Send support feedback" must be enabled. This data will be collected in addition to the support feedback.
</dt>
<dd id="publicize-element" class="block-display">
<label class="optional" for="Publicise">
<?php echo $this->element->getElement('Publicise') ?>
<strong><?php echo $this->element->getElement('Publicise')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('Publicise')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Publicise')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl>
<dl id="public-info" style="display:none;">
<dt id="stnName-label">
<label class="optional" for="stnName"><?php echo $this->element->getElement('stnName')->getLabel() ?>
<span class="info-text-small">(Required)</span> :
</label>
</dt>
<dd id="stnName-element">
<?php echo $this->element->getElement('stnName') ?>
<?php if($this->element->getElement('stnName')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('stnName')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Phone-label">
<label class="optional" for="Phone"><?php echo $this->element->getElement('Phone')->getLabel() ?></label>
</dt>
<dd id="Phone-element">
<?php echo $this->element->getElement('Phone') ?>
<span class="info-text-small">(for verification purposes only, will not be published)</span>
<?php if($this->element->getElement('Phone')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Phone')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Email-label">
<label class="optional" for="Email"><?php echo $this->element->getElement('Email')->getLabel() ?></label>
</dt>
<dd id="Email-element">
<?php echo $this->element->getElement('Email') ?>
<span class="info-text-small">(for verification purposes only, will not be published)</span>
<?php if($this->element->getElement('Email')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Email')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="StationWebSite-label">
<label class="optional" for="StationWebSite"><?php echo $this->element->getElement('StationWebSite')->getLabel() ?></label>
</dt>
<dd id="StationWebSite-element">
<?php echo $this->element->getElement('StationWebSite') ?>
<?php if($this->element->getElement('StationWebSite')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('StationWebSite')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Country-label">
<label class="optional" for="Country"><?php echo $this->element->getElement('Country')->getLabel() ?></label>
</dt>
<dd id="Country-element">
<?php echo $this->element->getElement('Country') ?>
<?php if($this->element->getElement('Country')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Country')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="City-label">
<label class="optional" for="City"><?php echo $this->element->getElement('City')->getLabel() ?></label>
</dt>
<dd id="City-element">
<?php echo $this->element->getElement('City') ?>
<?php if($this->element->getElement('City')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('City')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Description-label">
<label class="optional" for="Description"><?php echo $this->element->getElement('Description')->getLabel() ?></label>
</dt>
<dd id="Description-element">
<?php echo $this->element->getElement('Description') ?>
<?php if($this->element->getElement('Description')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Description')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Logo-label" class="block-display">
<label class="optional" for="Description"><?php echo $this->element->getElement('Logo')->getLabel() ?></label>
</dt>
<dd id="Logo-element">
<?php if($this->element->getView()->logoImg){?>
<div id="Logo-img-container"><img id="logo-img" onload='resizeImg(this, 450, 450);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" /></div>
<?php }?>
<?php echo $this->element->getElement('Logo') ?>
<p class="info-text">Note: Anything larger than 600x600 will be resized.</p>
<?php if($this->element->getElement('Logo')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Logo')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl>
</fieldset>
<div id="show_what_sending" style="display: block;">
<fieldset class="display_field toggle closed">
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>Show me what I am sending </legend>
<dl>
<?php echo $this->element->getElement('SendInfo') ?>
</dl>
</fieldset>
</div>
<div>
<br>
<?php if(!$this->privacyChecked){?>
<label class="optional" for="Privacy">
<?php echo $this->element->getElement('Privacy') ?>
<?php echo $this->element->getElement('Privacy')->getLabel() ?>
</label>
<?php }else{?>
<a id="link_to_terms_and_condition" href="http://www.sourcefabric.org/en/about/policy/" onclick="window.open(this.href); return false;">Terms and Conditions</a>
<?php }?>
</div>
</form>
</div>
<div id="register_popup" class="dialogPopup register-dialog" title="Register Airtime" style="display: none;">
<form id="register-form" method="<?php echo $this->element->getMethod() ?>" action="<?php echo $this->element->getAction() ?>" enctype="multipart/form-data">
<fieldset>
<dl class="zend_form">
<dt class="block-display info-text">
Help Airtime improve by letting us know how you are using it. This info
will be collected regularly in order to enhance your user experience.
<br /><br />
Click "Yes, help Airtime" and we'll make sure the features you use are
constantly improving.
</dt>
<dd id="SupportFeedback-element" class="block-display">
<label class="optional" for="SupportFeedback">
<?php echo $this->element->getElement('SupportFeedback') ?>
<strong><?php echo $this->element->getElement('SupportFeedback')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('SupportFeedback')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('SupportFeedback')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt class="block-display info-text">
Click the box below to advertise your station on
<a id="link_to_whos_using" href="http://sourcefabric.org/en/airtime/whosusing" onclick="window.open(this.href); return false">Sourcefabric.org</a>.
In order to promote your station, "Send support feedback" must be enabled. This data will be collected in addition to the support feedback.
</dt>
<dd id="publicize-element" class="block-display">
<label class="optional" for="Publicise">
<?php echo $this->element->getElement('Publicise') ?>
<strong><?php echo $this->element->getElement('Publicise')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('Publicise')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Publicise')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl>
<dl id="public-info" style="display:none;">
<dt id="stnName-label">
<label class="optional" for="stnName"><?php echo $this->element->getElement('stnName')->getLabel() ?>
<span class="info-text-small">(Required)</span> :
</label>
</dt>
<dd id="stnName-element">
<?php echo $this->element->getElement('stnName') ?>
<?php if($this->element->getElement('stnName')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('stnName')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Phone-label">
<label class="optional" for="Phone"><?php echo $this->element->getElement('Phone')->getLabel() ?></label>
</dt>
<dd id="Phone-element">
<?php echo $this->element->getElement('Phone') ?>
<span class="info-text-small">(for verification purposes only, will not be published)</span>
<?php if($this->element->getElement('Phone')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Phone')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Email-label">
<label class="optional" for="Email"><?php echo $this->element->getElement('Email')->getLabel() ?></label>
</dt>
<dd id="Email-element">
<?php echo $this->element->getElement('Email') ?>
<span class="info-text-small">(for verification purposes only, will not be published)</span>
<?php if($this->element->getElement('Email')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Email')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="StationWebSite-label">
<label class="optional" for="StationWebSite"><?php echo $this->element->getElement('StationWebSite')->getLabel() ?></label>
</dt>
<dd id="StationWebSite-element">
<?php echo $this->element->getElement('StationWebSite') ?>
<?php if($this->element->getElement('StationWebSite')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('StationWebSite')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Country-label">
<label class="optional" for="Country"><?php echo $this->element->getElement('Country')->getLabel() ?></label>
</dt>
<dd id="Country-element">
<?php echo $this->element->getElement('Country') ?>
<?php if($this->element->getElement('Country')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Country')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="City-label">
<label class="optional" for="City"><?php echo $this->element->getElement('City')->getLabel() ?></label>
</dt>
<dd id="City-element">
<?php echo $this->element->getElement('City') ?>
<?php if($this->element->getElement('City')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('City')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Description-label">
<label class="optional" for="Description"><?php echo $this->element->getElement('Description')->getLabel() ?></label>
</dt>
<dd id="Description-element">
<?php echo $this->element->getElement('Description') ?>
<?php if($this->element->getElement('Description')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Description')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Logo-label" class="block-display">
<label class="optional" for="Description"><?php echo $this->element->getElement('Logo')->getLabel() ?></label>
</dt>
<dd id="Logo-element">
<?php if($this->element->getView()->logoImg){?>
<div id="Logo-img-container"><img id="logo-img" onload='resizeImg(this, 450, 450);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" /></div>
<?php }?>
<?php echo $this->element->getElement('Logo') ?>
<p class="info-text">Note: Anything larger than 600x600 will be resized.</p>
<?php if($this->element->getElement('Logo')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Logo')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl>
</fieldset>
<div id="show_what_sending" style="display: block;">
<fieldset class="display_field toggle closed">
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>Show me what I am sending </legend>
<dl>
<?php echo $this->element->getElement('SendInfo') ?>
</dl>
</fieldset>
</div>
<div>
<br>
<?php if(!$this->privacyChecked){?>
<label class="optional" for="Privacy">
<?php echo $this->element->getElement('Privacy') ?>
<?php echo $this->element->getElement('Privacy')->getLabel() ?>
</label>
<?php }else{?>
<a id="link_to_terms_and_condition" href="http://www.sourcefabric.org/en/about/policy/" onclick="window.open(this.href); return false;">Terms and Conditions</a>
<?php }?>
</div>
</form>
</div>

View file

@ -30,8 +30,22 @@
<dd id='sp_criteria-element' class='criteria-element'>
<?php for ($i = 0; $i < $this->criteriasLength; $i++) {?>
<?php for ($j = 0; $j < $this->modRowMap[$i]; $j++) {?>
<div <?php if (($i > 0) && ($this->element->getElement("sp_criteria_field_".$i."_".$j)->getAttrib('disabled') == 'disabled')) {
<?php for ($j = 0; $j < $this->modRowMap[$i]; $j++) {
if ($this->modRowMap[$i] > 1 && $j != $this->modRowMap[$i]-1) $logicLabel = 'or';
else $logicLabel = 'and';
$disabled = $this->element->getElement("sp_criteria_field_".$i."_".$j)->getAttrib('disabled') == 'disabled'?true:false;
// determine if the next row is disabled and only display the logic label if it isn't
if ($j == $this->modRowMap[$i]-1 && $i < 25) {
$n = $i+1;
$nextIndex = $n."_0";
} elseif ($j+1 < $this->modRowMap[$i]-1) {
$n = $j+1;
$nextIndex = $i."_".$n;
}
$nextDisabled = $this->element->getElement("sp_criteria_field_".$nextIndex)->getAttrib('disabled') == 'disabled'?true:false;
?>
<div <?php if (($i > 0) && $disabled) {
echo 'style=display:none';
} ?>>
<?php echo $this->element->getElement("sp_criteria_field_".$i."_".$j) ?>
@ -45,6 +59,9 @@
<a style='margin-right:3px' class='btn btn-small btn-danger' id='criteria_remove_<?php echo $i ?>'>
<i class='icon-white icon-remove'></i>
</a>
<span class='db-logic-label' <?php if ($nextDisabled) echo "style='display:none'"?>>
<?php echo $logicLabel;?>
</span>
<?php if($this->element->getElement("sp_criteria_field_".$i."_".$j)->hasErrors()) : ?>
<?php foreach($this->element->getElement("sp_criteria_field_".$i."_".$j)->getMessages() as $error): ?>
<span class='errors sp-errors'>
@ -59,6 +76,20 @@
<br />
</dd>
<dd id='sp_repeate_tracks-element'>
<span class='sp_text_font'><?php echo $this->element->getElement('sp_repeat_tracks')->getLabel() ?></span>
<span class='repeat_tracks_help_icon'></span>
<?php echo $this->element->getElement('sp_repeat_tracks')?>
<?php if($this->element->getElement("sp_repeat_tracks")->hasErrors()) : ?>
<?php foreach($this->element->getElement("sp_repeat_tracks")->getMessages() as $error): ?>
<span class='errors sp-errors'>
<?php echo $error; ?>
</span>
<?php endforeach; ?>
<?php endif; ?>
<br />
</dd>
<dd id='sp_limit-element'>
<span class='sp_text_font'><?php echo $this->element->getElement('sp_limit_value')->getLabel() ?></span>
<?php echo $this->element->getElement('sp_limit_value')?>

View file

@ -1,6 +1,6 @@
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong">
<h2>Edit Metadata</h2>
<?php $this->form->setAction($this->url());
<?php //$this->form->setAction($this->url());
echo $this->form; ?>
</div>

View file

@ -92,5 +92,13 @@ if ($item['type'] == 2) {
<?php endforeach; ?>
<?php else : ?>
<li class="spl_empty">Empty playlist</li>
<li class="spl_empty">
<?php
if ($this->obj instanceof Application_Model_Block) {
echo 'Empty smart block';
} else {
echo 'Empty playlist';
}
?>
</li>
<?php endif; ?>

View file

@ -1,2 +1,2 @@
<div id='json-string'></div>
<div id='json-string'></div>
<div id='demo'></div>

View file

@ -1,7 +1,7 @@
<div class="wrapper">
<div id="library_content" class="lib-content tabs ui-widget ui-widget-content block-shadow alpha-block padded">
<div id="import_status" style="display:none">File import in progress...</div>
<fieldset class="toggle" id="filter_options">
<fieldset class="toggle closed" id="filter_options">
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>Advanced Search Options</legend>
<div id="advanced_search" class="advanced_search form-horizontal"></div>
</fieldset>

View file

@ -9,6 +9,10 @@
<li id='lib-new-ws'><a href="#">New Webstream</a></li>
</ul>
</div>
<div class="btn-group pull-right">
<button class="btn btn-inverse" type="submit" id="webstream_save" name="submit">Save</button>
</div>
<?php if (isset($this->obj)) : ?>
<div class="btn-group pull-right">
<button id="ws_delete" class="btn" <?php if ($this->action == "new"): ?>style="display:none;"<?php endif; ?>aria-disabled="false">Delete</button>
@ -37,24 +41,23 @@
<dd id="description-element">
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->obj->getDescription(); ?></textarea>
</dd>
<dt id="submit-label" style="display: none;">&nbsp;</dt>
<div id="url-error" class="errors" style="display:none;"></div>
<dt id="streamurl-label"><label for="streamurl">Stream URL:</label></dt>
<dd id="streamurl-element">
<input type="text" value="<?php echo $this->obj->getUrl(); ?>" size="40"/>
</dd>
<div id="length-error" class="errors" style="display:none;"></div>
<dt id="streamlength-label"><label for="streamlength">Default Length:</label></dt>
<dd id="streamlength-element">
<input type="text" value="<?php echo $this->obj->getDefaultLength() ?>"/>
</dd>
<dd id="submit-element" class="buttons">
<input class="btn btn-inverse" type="submit" value="Save" id="webstream_save" name="submit">
</dd>
</dl>
</fieldset>
<dl class="zend_form">
<dt id="submit-label" style="display: none;">&nbsp;</dt>
<div id="url-error" class="errors" style="display:none;"></div>
<dt id="streamurl-label"><label for="streamurl">Stream URL:</label></dt>
<dd id="streamurl-element">
<input type="text" value="<?php echo $this->obj->getUrl(); ?>" size="40"/>
</dd>
<div id="length-error" class="errors" style="display:none;"></div>
<dt id="streamlength-label"><label for="streamlength">Default Length:</label></dt>
<dd id="streamlength-element">
<input type="text" value="<?php echo $this->obj->getDefaultLength() ?>"/>
</dd>
</dl>
<?php else : ?>
<div>No webstream</div>