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

This commit is contained in:
James 2012-07-31 11:01:34 -04:00
commit 1b0cd6b01b
20 changed files with 202 additions and 88 deletions

View File

@ -36,7 +36,7 @@
<actionMethod actionName="delete"/> <actionMethod actionName="delete"/>
<actionMethod actionName="contents"/> <actionMethod actionName="contents"/>
<actionMethod actionName="editFileMd"/> <actionMethod actionName="editFileMd"/>
<actionMethod actionName="getFileMetaData"/> <actionMethod actionName="getFileMetadata"/>
</controllerFile> </controllerFile>
<controllerFile controllerName="Plupload"> <controllerFile controllerName="Plupload">
<actionMethod actionName="index"/> <actionMethod actionName="index"/>
@ -304,7 +304,7 @@
<viewScriptFile forActionName="update"/> <viewScriptFile forActionName="update"/>
</viewControllerScriptsDirectory> </viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Library"> <viewControllerScriptsDirectory forControllerName="Library">
<viewScriptFile forActionName="getFileMetaData"/> <viewScriptFile forActionName="getFileMetadata"/>
</viewControllerScriptsDirectory> </viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Nowplaying"> <viewControllerScriptsDirectory forControllerName="Nowplaying">
<viewScriptFile forActionName="dayView"/> <viewScriptFile forActionName="dayView"/>

View File

@ -17,7 +17,7 @@ class LibraryController extends Zend_Controller_Action
->addActionContext('delete', 'json') ->addActionContext('delete', 'json')
->addActionContext('delete-group', 'json') ->addActionContext('delete-group', 'json')
->addActionContext('context-menu', 'json') ->addActionContext('context-menu', 'json')
->addActionContext('get-file-meta-data', 'html') ->addActionContext('get-file-metadata', 'html')
->addActionContext('upload-file-soundcloud', 'json') ->addActionContext('upload-file-soundcloud', 'json')
->addActionContext('get-upload-to-soundcloud-status', 'json') ->addActionContext('get-upload-to-soundcloud-status', 'json')
->addActionContext('set-num-entries', 'json') ->addActionContext('set-num-entries', 'json')
@ -91,6 +91,24 @@ class LibraryController extends Zend_Controller_Action
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete"); $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
} }
} else if ($type == "stream") {
$obj = new Application_Model_Webstream($id);
if (isset($this->obj_sess->id) && $screen == "playlist") {
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
if ($this->obj_sess->type === "playlist") {
$menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy");
} else {
$menu["pl_add"] = array("name"=> "Add to Smart Playlist", "icon" => "add-playlist", "icon" => "copy");
}
}
}
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}");
}
} }
//SOUNDCLOUD MENU OPTIONS //SOUNDCLOUD MENU OPTIONS
@ -132,6 +150,7 @@ class LibraryController extends Zend_Controller_Action
$files = array(); $files = array();
$playlists = array(); $playlists = array();
$blocks = array(); $blocks = array();
$streams = array();
$message = null; $message = null;
@ -143,20 +162,32 @@ class LibraryController extends Zend_Controller_Action
$playlists[] = intval($media["id"]); $playlists[] = intval($media["id"]);
} elseif ($media["type"] === "block") { } elseif ($media["type"] === "block") {
$blocks[] = intval($media["id"]); $blocks[] = intval($media["id"]);
} elseif ($media["type"] === "stream") {
$streams[] = intval($media["id"]);
} }
} }
try { try {
if ($media["type"] === "playlist") {
Application_Model_Playlist::deletePlaylists($playlists, $user->getId()); Application_Model_Playlist::deletePlaylists($playlists, $user->getId());
} elseif ($media["type"] === "block") {
Application_Model_Block::deleteBlocks($blocks, $user->getId());
}
} catch (PlaylistNoPermissionException $e) { } catch (PlaylistNoPermissionException $e) {
$this->view->message = "You don't have permission to delete selected items."; $this->view->message = "You don't have permission to delete selected items.";
return; return;
} }
try {
Application_Model_Block::deleteBlocks($blocks, $user->getId());
} catch (Exception $e) {
//TODO: warn user that not all blocks could be deleted.
}
try {
Application_Model_Webstream::deleteStreams($streams, $user->getId());
} catch (Exception $e) {
//TODO: warn user that not all streams could be deleted.
Logging::log($e);
}
foreach ($files as $id) { foreach ($files as $id) {
$file = Application_Model_StoredFile::Recall($id); $file = Application_Model_StoredFile::Recall($id);
@ -164,9 +195,8 @@ class LibraryController extends Zend_Controller_Action
if (isset($file)) { if (isset($file)) {
try { try {
$res = $file->delete(true); $res = $file->delete(true);
} } catch (Exception $e) {
//could throw a scheduled in future exception. //could throw a scheduled in future exception.
catch (Exception $e) {
$message = "Could not delete some scheduled files."; $message = "Could not delete some scheduled files.";
} }
} }
@ -241,7 +271,7 @@ class LibraryController extends Zend_Controller_Action
$this->view->form = $form; $this->view->form = $form;
} }
public function getFileMetaDataAction() public function getFileMetadataAction()
{ {
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$type = $this->_getParam('type'); $type = $this->_getParam('type');
@ -281,6 +311,13 @@ class LibraryController extends Zend_Controller_Action
$this->view->md = $md; $this->view->md = $md;
$this->view->contents = $file->getContents(); $this->view->contents = $file->getContents();
} else if ($type == "stream") {
$file = new Application_Model_Webstream($id);
$md = $file->getMetadata();
$this->view->md = $md;
$this->view->type = $type;
} }
} catch (Exception $e) { } catch (Exception $e) {
Logging::log($e->getMessage()); Logging::log($e->getMessage());

View File

@ -29,19 +29,12 @@ class WebstreamController extends Zend_Controller_Action
*/ */
} }
public function saveAction(){ public function saveAction()
{
$request = $this->getRequest(); $request = $this->getRequest();
Application_Model_Webstream::save($request); Application_Model_Webstream::save($request);
$this->view->x = "hi"; $this->view->x = "hi";
//http://localhost/Library/contents-feed
// 1) Create Propel object and save these parameters
// 2) Make these appear in the library
// 3) Make Web streams + playlists draggable.
// 4)
} }
} }

View File

@ -178,7 +178,7 @@ class Application_Model_Playlist
JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = {$this->id} AND type = 0) JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = {$this->id} AND type = 0)
UNION ALL UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, (SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
ws.id as item_id, (ws.name || ': ' || ws.url) as title, ws.login as creator, 't'::boolean as exists, ws.url as path FROM cc_playlistcontents AS pc ws.id as item_id, (ws.name || ': ' || ws.url) as title, ws.creator_id as creator, 't'::boolean as exists, ws.url as path FROM cc_playlistcontents AS pc
JOIN cc_webstream AS ws on pc.stream_id=ws.id WHERE pc.playlist_id = {$this->id} AND type = 1) JOIN cc_webstream AS ws on pc.stream_id=ws.id WHERE pc.playlist_id = {$this->id} AND type = 1)
UNION ALL UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, (SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,

View File

@ -80,7 +80,7 @@ class Application_Model_Schedule
WHERE "; WHERE ";
$fileColumns = "ft.artist_name, ft.track_title, "; $fileColumns = "ft.artist_name, ft.track_title, ";
$streamColumns = "ws.login as artist_name, ws.name as track_title, "; $streamColumns = "ws.creator_id as artist_name, ws.name as track_title, ";
$fileJoin = "cc_files ft ON st.file_id = ft.id"; $fileJoin = "cc_files ft ON st.file_id = ft.id";
$streamJoin = "cc_webstream ws ON st.stream_id = ws.id"; $streamJoin = "cc_webstream ws ON st.stream_id = ws.id";
@ -299,7 +299,7 @@ class Application_Model_Schedule
$filesSql); $filesSql);
$streamSql = str_replace("%%columns%%", $streamSql = str_replace("%%columns%%",
"ws.name AS file_track_title, ws.login AS file_artist_name, "ws.name AS file_track_title, ws.creator_id AS file_artist_name,
ws.description AS file_album_title, ws.length AS file_length, 't'::BOOL AS file_exists", ws.description AS file_album_title, ws.length AS file_length, 't'::BOOL AS file_exists",
$templateSql); $templateSql);
$streamSql = str_replace("%%join%%", $streamSql = str_replace("%%join%%",

View File

@ -621,7 +621,7 @@ class Application_Model_StoredFile
$plSelect[] = "login AS ".$key; $plSelect[] = "login AS ".$key;
$blSelect[] = "login AS ".$key; $blSelect[] = "login AS ".$key;
$fileSelect[] = $key; $fileSelect[] = $key;
$streamSelect[] = "login AS ".$key; $streamSelect[] = "creator_id AS ".$key;
} }
//same columns in each table. //same columns in each table.
else if (in_array($key, array("length", "utime", "mtime"))) { else if (in_array($key, array("length", "utime", "mtime"))) {

View File

@ -2,6 +2,13 @@
class Application_Model_Webstream{ class Application_Model_Webstream{
private $id;
public function __construct($id)
{
$this->id = $id;
}
public static function getName() public static function getName()
{ {
return "Default"; return "Default";
@ -27,6 +34,48 @@ class Application_Model_Webstream{
return "desc"; return "desc";
} }
public function getMetadata()
{
$webstream = CcWebstreamQuery::create()->findPK($this->id);
$subjs = CcSubjsQuery::create()->findPK($webstream->getDbCreatorId());
$username = $subjs->getDbLogin();
return array(
"name" => $webstream->getDbName(),
"length" => $webstream->getDbLength(),
"description" => $webstream->getDbDescription(),
"login"=> $username,
"url" => $webstream->getDbUrl(),
);
}
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();
} else {
throw new Exception("Invalid user permissions");
}
}
// This function returns that are not owen by $p_user_id among $p_ids
private static function streamsNotOwnedByUser($p_ids, $p_userId)
{
$ownedByUser = CcWebstreamQuery::create()->filterByDbCreatorId($p_userId)->find()->getData();
$ownedStreams = array();
foreach ($ownedByUser as $pl) {
if (in_array($pl->getDbId(), $p_ids)) {
$ownedStreams[] = $pl->getDbId();
}
}
$leftOvers = array_diff($p_ids, $ownedStreams);
return $leftOvers;
}
public static function save($request) public static function save($request)
{ {
Logging::log($request->getParams()); Logging::log($request->getParams());
@ -47,7 +96,7 @@ class Application_Model_Webstream{
$webstream->setDbUrl($request->getParam("url")); $webstream->setDbUrl($request->getParam("url"));
$webstream->setDbLength($dblength); $webstream->setDbLength($dblength);
$webstream->setDbLogin($userInfo->id); $webstream->setDbCreatorId($userInfo->id);
$webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC'))); $webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC')));
$webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC'))); $webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC')));
$webstream->save(); $webstream->save();

View File

@ -43,7 +43,7 @@ class CcWebstreamTableMap extends TableMap {
$this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', true, 255, null); $this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', true, 255, null);
$this->addColumn('URL', 'DbUrl', 'VARCHAR', true, 255, null); $this->addColumn('URL', 'DbUrl', 'VARCHAR', true, 255, null);
$this->addColumn('LENGTH', 'DbLength', 'VARCHAR', true, null, '00:00:00'); $this->addColumn('LENGTH', 'DbLength', 'VARCHAR', true, null, '00:00:00');
$this->addColumn('LOGIN', 'DbLogin', 'VARCHAR', true, 255, null); $this->addColumn('CREATOR_ID', 'DbCreatorId', 'VARCHAR', true, 255, null);
$this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', true, 6, null); $this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', true, 6, null);
$this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', true, 6, null); $this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', true, 6, null);
// validators // validators

View File

@ -56,10 +56,10 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
protected $length; protected $length;
/** /**
* The value for the login field. * The value for the creator_id field.
* @var string * @var string
*/ */
protected $login; protected $creator_id;
/** /**
* The value for the mtime field. * The value for the mtime field.
@ -164,13 +164,13 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
} }
/** /**
* Get the [login] column value. * Get the [creator_id] column value.
* *
* @return string * @return string
*/ */
public function getDbLogin() public function getDbCreatorId()
{ {
return $this->login; return $this->creator_id;
} }
/** /**
@ -340,24 +340,24 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
} // setDbLength() } // setDbLength()
/** /**
* Set the value of [login] column. * Set the value of [creator_id] column.
* *
* @param string $v new value * @param string $v new value
* @return CcWebstream The current object (for fluent API support) * @return CcWebstream The current object (for fluent API support)
*/ */
public function setDbLogin($v) public function setDbCreatorId($v)
{ {
if ($v !== null) { if ($v !== null) {
$v = (string) $v; $v = (string) $v;
} }
if ($this->login !== $v) { if ($this->creator_id !== $v) {
$this->login = $v; $this->creator_id = $v;
$this->modifiedColumns[] = CcWebstreamPeer::LOGIN; $this->modifiedColumns[] = CcWebstreamPeer::CREATOR_ID;
} }
return $this; return $this;
} // setDbLogin() } // setDbCreatorId()
/** /**
* Sets the value of [mtime] column to a normalized version of the date/time value specified. * Sets the value of [mtime] column to a normalized version of the date/time value specified.
@ -498,7 +498,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; $this->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->url = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; $this->url = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->length = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; $this->length = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
$this->login = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; $this->creator_id = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
$this->mtime = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; $this->mtime = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
$this->utime = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; $this->utime = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
$this->resetModified(); $this->resetModified();
@ -842,7 +842,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
return $this->getDbLength(); return $this->getDbLength();
break; break;
case 5: case 5:
return $this->getDbLogin(); return $this->getDbCreatorId();
break; break;
case 6: case 6:
return $this->getDbMtime(); return $this->getDbMtime();
@ -878,7 +878,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$keys[2] => $this->getDbDescription(), $keys[2] => $this->getDbDescription(),
$keys[3] => $this->getDbUrl(), $keys[3] => $this->getDbUrl(),
$keys[4] => $this->getDbLength(), $keys[4] => $this->getDbLength(),
$keys[5] => $this->getDbLogin(), $keys[5] => $this->getDbCreatorId(),
$keys[6] => $this->getDbMtime(), $keys[6] => $this->getDbMtime(),
$keys[7] => $this->getDbUtime(), $keys[7] => $this->getDbUtime(),
); );
@ -928,7 +928,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->setDbLength($value); $this->setDbLength($value);
break; break;
case 5: case 5:
$this->setDbLogin($value); $this->setDbCreatorId($value);
break; break;
case 6: case 6:
$this->setDbMtime($value); $this->setDbMtime($value);
@ -965,7 +965,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
if (array_key_exists($keys[2], $arr)) $this->setDbDescription($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setDbDescription($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbUrl($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setDbUrl($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbLength($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setDbLength($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setDbLogin($arr[$keys[5]]); if (array_key_exists($keys[5], $arr)) $this->setDbCreatorId($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setDbMtime($arr[$keys[6]]); if (array_key_exists($keys[6], $arr)) $this->setDbMtime($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setDbUtime($arr[$keys[7]]); if (array_key_exists($keys[7], $arr)) $this->setDbUtime($arr[$keys[7]]);
} }
@ -984,7 +984,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
if ($this->isColumnModified(CcWebstreamPeer::DESCRIPTION)) $criteria->add(CcWebstreamPeer::DESCRIPTION, $this->description); if ($this->isColumnModified(CcWebstreamPeer::DESCRIPTION)) $criteria->add(CcWebstreamPeer::DESCRIPTION, $this->description);
if ($this->isColumnModified(CcWebstreamPeer::URL)) $criteria->add(CcWebstreamPeer::URL, $this->url); if ($this->isColumnModified(CcWebstreamPeer::URL)) $criteria->add(CcWebstreamPeer::URL, $this->url);
if ($this->isColumnModified(CcWebstreamPeer::LENGTH)) $criteria->add(CcWebstreamPeer::LENGTH, $this->length); if ($this->isColumnModified(CcWebstreamPeer::LENGTH)) $criteria->add(CcWebstreamPeer::LENGTH, $this->length);
if ($this->isColumnModified(CcWebstreamPeer::LOGIN)) $criteria->add(CcWebstreamPeer::LOGIN, $this->login); if ($this->isColumnModified(CcWebstreamPeer::CREATOR_ID)) $criteria->add(CcWebstreamPeer::CREATOR_ID, $this->creator_id);
if ($this->isColumnModified(CcWebstreamPeer::MTIME)) $criteria->add(CcWebstreamPeer::MTIME, $this->mtime); if ($this->isColumnModified(CcWebstreamPeer::MTIME)) $criteria->add(CcWebstreamPeer::MTIME, $this->mtime);
if ($this->isColumnModified(CcWebstreamPeer::UTIME)) $criteria->add(CcWebstreamPeer::UTIME, $this->utime); if ($this->isColumnModified(CcWebstreamPeer::UTIME)) $criteria->add(CcWebstreamPeer::UTIME, $this->utime);
@ -1052,7 +1052,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$copyObj->setDbDescription($this->description); $copyObj->setDbDescription($this->description);
$copyObj->setDbUrl($this->url); $copyObj->setDbUrl($this->url);
$copyObj->setDbLength($this->length); $copyObj->setDbLength($this->length);
$copyObj->setDbLogin($this->login); $copyObj->setDbCreatorId($this->creator_id);
$copyObj->setDbMtime($this->mtime); $copyObj->setDbMtime($this->mtime);
$copyObj->setDbUtime($this->utime); $copyObj->setDbUtime($this->utime);
@ -1281,7 +1281,7 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->description = null; $this->description = null;
$this->url = null; $this->url = null;
$this->length = null; $this->length = null;
$this->login = null; $this->creator_id = null;
$this->mtime = null; $this->mtime = null;
$this->utime = null; $this->utime = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;

View File

@ -46,8 +46,8 @@ abstract class BaseCcWebstreamPeer {
/** the column name for the LENGTH field */ /** the column name for the LENGTH field */
const LENGTH = 'cc_webstream.LENGTH'; const LENGTH = 'cc_webstream.LENGTH';
/** the column name for the LOGIN field */ /** the column name for the CREATOR_ID field */
const LOGIN = 'cc_webstream.LOGIN'; const CREATOR_ID = 'cc_webstream.CREATOR_ID';
/** the column name for the MTIME field */ /** the column name for the MTIME field */
const MTIME = 'cc_webstream.MTIME'; const MTIME = 'cc_webstream.MTIME';
@ -71,11 +71,11 @@ abstract class BaseCcWebstreamPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
private static $fieldNames = array ( private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbDescription', 'DbUrl', 'DbLength', 'DbLogin', 'DbMtime', 'DbUtime', ), BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbDescription', 'DbUrl', 'DbLength', 'DbCreatorId', 'DbMtime', 'DbUtime', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbDescription', 'dbUrl', 'dbLength', 'dbLogin', 'dbMtime', 'dbUtime', ), BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbDescription', 'dbUrl', 'dbLength', 'dbCreatorId', 'dbMtime', 'dbUtime', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::DESCRIPTION, self::URL, self::LENGTH, self::LOGIN, self::MTIME, self::UTIME, ), BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::DESCRIPTION, self::URL, self::LENGTH, self::CREATOR_ID, self::MTIME, self::UTIME, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'DESCRIPTION', 'URL', 'LENGTH', 'LOGIN', 'MTIME', 'UTIME', ), BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'DESCRIPTION', 'URL', 'LENGTH', 'CREATOR_ID', 'MTIME', 'UTIME', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'url', 'length', 'login', 'mtime', 'utime', ), BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'url', 'length', 'creator_id', 'mtime', 'utime', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
); );
@ -86,11 +86,11 @@ abstract class BaseCcWebstreamPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
private static $fieldKeys = array ( private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbDescription' => 2, 'DbUrl' => 3, 'DbLength' => 4, 'DbLogin' => 5, 'DbMtime' => 6, 'DbUtime' => 7, ), BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbDescription' => 2, 'DbUrl' => 3, 'DbLength' => 4, 'DbCreatorId' => 5, 'DbMtime' => 6, 'DbUtime' => 7, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbDescription' => 2, 'dbUrl' => 3, 'dbLength' => 4, 'dbLogin' => 5, 'dbMtime' => 6, 'dbUtime' => 7, ), BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbDescription' => 2, 'dbUrl' => 3, 'dbLength' => 4, 'dbCreatorId' => 5, 'dbMtime' => 6, 'dbUtime' => 7, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::DESCRIPTION => 2, self::URL => 3, self::LENGTH => 4, self::LOGIN => 5, self::MTIME => 6, self::UTIME => 7, ), BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::DESCRIPTION => 2, self::URL => 3, self::LENGTH => 4, self::CREATOR_ID => 5, self::MTIME => 6, self::UTIME => 7, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'DESCRIPTION' => 2, 'URL' => 3, 'LENGTH' => 4, 'LOGIN' => 5, 'MTIME' => 6, 'UTIME' => 7, ), BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'DESCRIPTION' => 2, 'URL' => 3, 'LENGTH' => 4, 'CREATOR_ID' => 5, 'MTIME' => 6, 'UTIME' => 7, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'url' => 3, 'length' => 4, 'login' => 5, 'mtime' => 6, 'utime' => 7, ), BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'url' => 3, 'length' => 4, 'creator_id' => 5, 'mtime' => 6, 'utime' => 7, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
); );
@ -168,7 +168,7 @@ abstract class BaseCcWebstreamPeer {
$criteria->addSelectColumn(CcWebstreamPeer::DESCRIPTION); $criteria->addSelectColumn(CcWebstreamPeer::DESCRIPTION);
$criteria->addSelectColumn(CcWebstreamPeer::URL); $criteria->addSelectColumn(CcWebstreamPeer::URL);
$criteria->addSelectColumn(CcWebstreamPeer::LENGTH); $criteria->addSelectColumn(CcWebstreamPeer::LENGTH);
$criteria->addSelectColumn(CcWebstreamPeer::LOGIN); $criteria->addSelectColumn(CcWebstreamPeer::CREATOR_ID);
$criteria->addSelectColumn(CcWebstreamPeer::MTIME); $criteria->addSelectColumn(CcWebstreamPeer::MTIME);
$criteria->addSelectColumn(CcWebstreamPeer::UTIME); $criteria->addSelectColumn(CcWebstreamPeer::UTIME);
} else { } else {
@ -177,7 +177,7 @@ abstract class BaseCcWebstreamPeer {
$criteria->addSelectColumn($alias . '.DESCRIPTION'); $criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.URL'); $criteria->addSelectColumn($alias . '.URL');
$criteria->addSelectColumn($alias . '.LENGTH'); $criteria->addSelectColumn($alias . '.LENGTH');
$criteria->addSelectColumn($alias . '.LOGIN'); $criteria->addSelectColumn($alias . '.CREATOR_ID');
$criteria->addSelectColumn($alias . '.MTIME'); $criteria->addSelectColumn($alias . '.MTIME');
$criteria->addSelectColumn($alias . '.UTIME'); $criteria->addSelectColumn($alias . '.UTIME');
} }

View File

@ -11,7 +11,7 @@
* @method CcWebstreamQuery orderByDbDescription($order = Criteria::ASC) Order by the description column * @method CcWebstreamQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
* @method CcWebstreamQuery orderByDbUrl($order = Criteria::ASC) Order by the url column * @method CcWebstreamQuery orderByDbUrl($order = Criteria::ASC) Order by the url column
* @method CcWebstreamQuery orderByDbLength($order = Criteria::ASC) Order by the length column * @method CcWebstreamQuery orderByDbLength($order = Criteria::ASC) Order by the length column
* @method CcWebstreamQuery orderByDbLogin($order = Criteria::ASC) Order by the login column * @method CcWebstreamQuery orderByDbCreatorId($order = Criteria::ASC) Order by the creator_id column
* @method CcWebstreamQuery orderByDbMtime($order = Criteria::ASC) Order by the mtime column * @method CcWebstreamQuery orderByDbMtime($order = Criteria::ASC) Order by the mtime column
* @method CcWebstreamQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column * @method CcWebstreamQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column
* *
@ -20,7 +20,7 @@
* @method CcWebstreamQuery groupByDbDescription() Group by the description column * @method CcWebstreamQuery groupByDbDescription() Group by the description column
* @method CcWebstreamQuery groupByDbUrl() Group by the url column * @method CcWebstreamQuery groupByDbUrl() Group by the url column
* @method CcWebstreamQuery groupByDbLength() Group by the length column * @method CcWebstreamQuery groupByDbLength() Group by the length column
* @method CcWebstreamQuery groupByDbLogin() Group by the login column * @method CcWebstreamQuery groupByDbCreatorId() Group by the creator_id column
* @method CcWebstreamQuery groupByDbMtime() Group by the mtime column * @method CcWebstreamQuery groupByDbMtime() Group by the mtime column
* @method CcWebstreamQuery groupByDbUtime() Group by the utime column * @method CcWebstreamQuery groupByDbUtime() Group by the utime column
* *
@ -40,7 +40,7 @@
* @method CcWebstream findOneByDbDescription(string $description) Return the first CcWebstream filtered by the description column * @method CcWebstream findOneByDbDescription(string $description) Return the first CcWebstream filtered by the description column
* @method CcWebstream findOneByDbUrl(string $url) Return the first CcWebstream filtered by the url column * @method CcWebstream findOneByDbUrl(string $url) Return the first CcWebstream filtered by the url column
* @method CcWebstream findOneByDbLength(string $length) Return the first CcWebstream filtered by the length column * @method CcWebstream findOneByDbLength(string $length) Return the first CcWebstream filtered by the length column
* @method CcWebstream findOneByDbLogin(string $login) Return the first CcWebstream filtered by the login column * @method CcWebstream findOneByDbCreatorId(string $creator_id) Return the first CcWebstream filtered by the creator_id column
* @method CcWebstream findOneByDbMtime(string $mtime) Return the first CcWebstream filtered by the mtime column * @method CcWebstream findOneByDbMtime(string $mtime) Return the first CcWebstream filtered by the mtime column
* @method CcWebstream findOneByDbUtime(string $utime) Return the first CcWebstream filtered by the utime column * @method CcWebstream findOneByDbUtime(string $utime) Return the first CcWebstream filtered by the utime column
* *
@ -49,7 +49,7 @@
* @method array findByDbDescription(string $description) Return CcWebstream objects filtered by the description column * @method array findByDbDescription(string $description) Return CcWebstream objects filtered by the description column
* @method array findByDbUrl(string $url) Return CcWebstream objects filtered by the url column * @method array findByDbUrl(string $url) Return CcWebstream objects filtered by the url column
* @method array findByDbLength(string $length) Return CcWebstream objects filtered by the length column * @method array findByDbLength(string $length) Return CcWebstream objects filtered by the length column
* @method array findByDbLogin(string $login) Return CcWebstream objects filtered by the login column * @method array findByDbCreatorId(string $creator_id) Return CcWebstream objects filtered by the creator_id column
* @method array findByDbMtime(string $mtime) Return CcWebstream objects filtered by the mtime column * @method array findByDbMtime(string $mtime) Return CcWebstream objects filtered by the mtime column
* @method array findByDbUtime(string $utime) Return CcWebstream objects filtered by the utime column * @method array findByDbUtime(string $utime) Return CcWebstream objects filtered by the utime column
* *
@ -267,25 +267,25 @@ abstract class BaseCcWebstreamQuery extends ModelCriteria
} }
/** /**
* Filter the query on the login column * Filter the query on the creator_id column
* *
* @param string $dbLogin The value to use as filter. * @param string $dbCreatorId The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE) * Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return CcWebstreamQuery The current query, for fluid interface * @return CcWebstreamQuery The current query, for fluid interface
*/ */
public function filterByDbLogin($dbLogin = null, $comparison = null) public function filterByDbCreatorId($dbCreatorId = null, $comparison = null)
{ {
if (null === $comparison) { if (null === $comparison) {
if (is_array($dbLogin)) { if (is_array($dbCreatorId)) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbLogin)) { } elseif (preg_match('/[\%\*]/', $dbCreatorId)) {
$dbLogin = str_replace('*', '%', $dbLogin); $dbCreatorId = str_replace('*', '%', $dbCreatorId);
$comparison = Criteria::LIKE; $comparison = Criteria::LIKE;
} }
} }
return $this->addUsingAlias(CcWebstreamPeer::LOGIN, $dbLogin, $comparison); return $this->addUsingAlias(CcWebstreamPeer::CREATOR_ID, $dbCreatorId, $comparison);
} }
/** /**

View File

@ -29,7 +29,7 @@
echo 'style=display:none'; echo 'style=display:none';
} ?>> } ?>>
<?php echo $this->element->getElement("sp_criteria_field_".$i) ?> <?php echo $this->element->getElement("sp_criteria_field_".$i) ?>
<a class='ui-button sp-ui-button-icon-only' id='modifier_add_<?php echo $i ?>'> <a class='ui-button sp-ui-button-icon-only sp_no_margins' id='modifier_add_<?php echo $i ?>'>
<span class='ui-icon ui-icon-plusthick'></span> <span class='ui-icon ui-icon-plusthick'></span>
</a> </a>
<?php echo $this->element->getElement("sp_criteria_modifier_".$i) ?> <?php echo $this->element->getElement("sp_criteria_modifier_".$i) ?>
@ -44,7 +44,7 @@
<?php for ($j = 0; $j < $this->modRowMap[$i]; $j++) {?> <?php for ($j = 0; $j < $this->modRowMap[$i]; $j++) {?>
<div> <div>
<?php echo $this->element->getElement("sp_criteria_field_".$i."_".$j) ?> <?php echo $this->element->getElement("sp_criteria_field_".$i."_".$j) ?>
<a class='ui-button sp-ui-button-icon-only' id='modifier_add_<?php echo $i ?>'> <a class='ui-button sp-ui-button-icon-only sp_no_margins' id='modifier_add_<?php echo $i ?>'>
<span class='ui-icon ui-icon-plusthick'></span> <span class='ui-icon ui-icon-plusthick'></span>
</a> </a>
<?php echo $this->element->getElement("sp_criteria_modifier_".$i."_".$j) ?> <?php echo $this->element->getElement("sp_criteria_modifier_".$i."_".$j) ?>

View File

@ -37,3 +37,14 @@
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if ($this->type == "stream") : ?>
<div><span>Name:</span><span><?php echo ($this->md["name"]);?></span></div>
<div><span>Length:</span><span><?php echo ($this->md["length"]);?></span></div>
<div><span>Creator:</span><span><?php echo ($this->md["login"]);?></span></div>
<div><span>Description:</span><span><?php echo ($this->md["description"]);?></span></div>
<div><span>URL:</span><span><?php echo ($this->md["url"]);?></span></div>
<?php endif; ?>

View File

@ -419,7 +419,7 @@
<column name="description" phpName="DbDescription" type="VARCHAR" size="255" required="true" /> <column name="description" phpName="DbDescription" type="VARCHAR" size="255" required="true" />
<column name="url" phpName="DbUrl" type="VARCHAR" size="255" required="true" /> <column name="url" phpName="DbUrl" type="VARCHAR" size="255" required="true" />
<column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" required="true" defaultValue="00:00:00"/> <column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" required="true" defaultValue="00:00:00"/>
<column name="login" phpName="DbLogin" type="VARCHAR" size="255" required="true" /> <column name="creator_id" phpName="DbCreatorId" type="VARCHAR" size="255" required="true" />
<column name="mtime" phpName="DbMtime" type="TIMESTAMP" size="6" required="true" /> <column name="mtime" phpName="DbMtime" type="TIMESTAMP" size="6" required="true" />
<column name="utime" phpName="DbUtime" type="TIMESTAMP" size="6" required="true" /> <column name="utime" phpName="DbUtime" type="TIMESTAMP" size="6" required="true" />
</table> </table>

View File

@ -635,7 +635,7 @@ CREATE TABLE "cc_webstream"
"description" VARCHAR(255) NOT NULL, "description" VARCHAR(255) NOT NULL,
"url" VARCHAR(255) NOT NULL, "url" VARCHAR(255) NOT NULL,
"length" interval default '00:00:00' NOT NULL, "length" interval default '00:00:00' NOT NULL,
"login" VARCHAR(255) NOT NULL, "creator_id" VARCHAR(255) NOT NULL,
"mtime" TIMESTAMP(6) NOT NULL, "mtime" TIMESTAMP(6) NOT NULL,
"utime" TIMESTAMP(6) NOT NULL, "utime" TIMESTAMP(6) NOT NULL,
PRIMARY KEY ("id") PRIMARY KEY ("id")

View File

@ -430,6 +430,11 @@ input[type="text"]:focus, input[type="password"]:focus, textarea:focus, .input_t
width: 75px !important; width: 75px !important;
} }
.sp_no_margins{
margin-left: 0px !important;
margin-right: 0px !important;
}
input.input_text.sp_input_text{ input.input_text.sp_input_text{
width: 200px !important; width: 200px !important;
} }

View File

@ -464,7 +464,7 @@ var AIRTIME = (function(AIRTIME) {
text: aData.track_title text: aData.track_title
}, },
ajax: { ajax: {
url: "/Library/get-file-meta-data", url: "/Library/get-file-metadata",
type: "get", type: "get",
data: ({format: "html", id : aData.id, type: aData.ftype}), data: ({format: "html", id : aData.id, type: aData.ftype}),
success: function(data, status) { success: function(data, status) {
@ -542,7 +542,7 @@ var AIRTIME = (function(AIRTIME) {
.append('<option value="0">All</option>') .append('<option value="0">All</option>')
.append('<option value="1">Files</option>') .append('<option value="1">Files</option>')
.append('<option value="2">Playlists</option>') .append('<option value="2">Playlists</option>')
.append('<option value="3">Smart Blocks</option>') .append('<option value="3">Smart Playlists</option>')
.end() .end()
.change(function(ev){ .change(function(ev){
oTable.fnDraw(); oTable.fnDraw();
@ -614,6 +614,7 @@ var AIRTIME = (function(AIRTIME) {
} }
else { else {
callback = function() { callback = function() {
//TODO
AIRTIME.playlist.fnEdit(data.id, data.ftype); AIRTIME.playlist.fnEdit(data.id, data.ftype);
}; };
} }

View File

@ -521,6 +521,13 @@ var AIRTIME = (function(AIRTIME){
$fs.addClass("closed"); $fs.addClass("closed");
} }
}); });
$pl.on("click", "#webstream_cancel", function(){
$("#side_playlist")
.empty()
.append("WHAT SHOULD I PUT HERE??!?!! :)");
})
$pl.on("click", "#webstream_save", function(){ $pl.on("click", "#webstream_save", function(){
//get all fields and POST to server //get all fields and POST to server
//description //description
@ -536,7 +543,9 @@ var AIRTIME = (function(AIRTIME){
$.post(url, $.post(url,
{format: "json", description: description, url:streamurl, length: length, name: name}, {format: "json", description: description, url:streamurl, length: length, name: name},
function(json){ function(json){
console.log(json); $("#side_playlist")
.empty()
.append("WHAT SHOULD I PUT HERE??!?!! :)");
/* /*
if (json.error !== undefined){ if (json.error !== undefined){

View File

@ -108,8 +108,12 @@ function setSmartPlaylistEvents() {
var criteria_value = next.find('[name^="sp_criteria_value"]').val(); var criteria_value = next.find('[name^="sp_criteria_value"]').val();
curr.find('[name^="sp_criteria_value"]').val(criteria_value); curr.find('[name^="sp_criteria_value"]').val(criteria_value);
var id = curr.find('[name^="sp_criteria"]').attr('id'); var id = curr.find('[name^="sp_criteria"]').attr('id'),
var index = id.charAt(id.length-1); delimiter = '_',
start = 3,
tokens = id.split(delimiter).slice(start),
index = tokens.join(delimiter);
/* if current and next row have the extra criteria value /* if current and next row have the extra criteria value
* (for 'is in the range' modifier), then assign the next * (for 'is in the range' modifier), then assign the next
* extra value to current and remove that element from * extra value to current and remove that element from
@ -162,6 +166,7 @@ function setSmartPlaylistEvents() {
// always put '+' button on the last enabled row // always put '+' button on the last enabled row
appendAddButton(); appendAddButton();
// always put '+' button on the last modifier row
appendModAddButton(); appendModAddButton();
// remove the 'x' button if only one row is enabled // remove the 'x' button if only one row is enabled
removeButtonCheck(); removeButtonCheck();
@ -219,7 +224,10 @@ function setSmartPlaylistEvents() {
form.find('select[id^="sp_criteria_modifier"]').live("change", function(){ form.find('select[id^="sp_criteria_modifier"]').live("change", function(){
var criteria_value = $(this).next(), var criteria_value = $(this).next(),
index_name = criteria_value.attr('id'), index_name = criteria_value.attr('id'),
index_num = index_name.charAt(index_name.length-1); delimiter = '_',
start = 3,
tokens = index_name.split(delimiter).slice(start),
index_num = tokens.join(delimiter);
if ($(this).val() == 'is in the range') { if ($(this).val() == 'is in the range') {
enableAndShowExtraField(criteria_value, index_num); enableAndShowExtraField(criteria_value, index_num);
@ -254,13 +262,14 @@ function appendModAddButton() {
if ($(div).find('select[name^="sp_criteria_field"]').val() == $(div).prev().find('select[name^="sp_criteria_field"]').val()) { if ($(div).find('select[name^="sp_criteria_field"]').val() == $(div).prev().find('select[name^="sp_criteria_field"]').val()) {
$(div).prev().find('a[id^="modifier_add"]').addClass('sp-invisible'); $(div).prev().find('a[id^="modifier_add"]').addClass('sp-invisible');
if (i+1 == divs.length) {
$(div).find('a[id^="modifier_add"]').removeClass('sp-invisible');
}
} else { } else {
$(div).prev().find('a[id^="modifier_add"]').removeClass('sp-invisible'); $(div).prev().find('a[id^="modifier_add"]').removeClass('sp-invisible');
} }
} }
if (i+1 == divs.length) {
$(div).find('a[id^="modifier_add"]').removeClass('sp-invisible');
}
}); });
} }

View File

@ -25,9 +25,9 @@ echo "----------------------------------------------------"
dist=`lsb_release -is` dist=`lsb_release -is`
if [ "$dist" = "Debian" ]; then if [ "$dist" = "Debian" ]; then
grep "deb http://www.debian-multimedia.org squeeze main non-free" /etc/apt/sources.list grep "deb http://www.deb-multimedia.org squeeze main non-free" /etc/apt/sources.list
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
echo "deb http://www.debian-multimedia.org squeeze main non-free" >> /etc/apt/sources.list echo "deb http://www.deb-multimedia.org squeeze main non-free" >> /etc/apt/sources.list
fi fi
fi fi