Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
7fed4ea979
|
@ -53,7 +53,7 @@
|
||||||
<img src="img/{$i.type}.png" border="0" alt="{$i.ftype|capitalize}" {* include file="sub/alttext.tpl" *} />
|
<img src="img/{$i.type}.png" border="0" alt="{$i.ftype|capitalize}" {* include file="sub/alttext.tpl" *} />
|
||||||
</td>
|
</td>
|
||||||
<td style="border: 0">
|
<td style="border: 0">
|
||||||
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=PL.moveItem&id=&oldPos={$pos}&newPos={$pos-1}')"><img src="img/bt_top_xsm.png" alt="##move up##" vspace=1 hspace=1/></a>
|
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=PL.moveItem&oldPos={$pos}&newPos={$pos-1}')"><img src="img/bt_top_xsm.png" alt="##move up##" vspace=1 hspace=1/></a>
|
||||||
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=PL.moveItem&oldPos={$pos}&newPos={$pos+1}')"><img src="img/bt_bottom_xsm.png" alt="##move down##" vspace=1 hspace=1/></a>
|
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=PL.moveItem&oldPos={$pos}&newPos={$pos+1}')"><img src="img/bt_bottom_xsm.png" alt="##move down##" vspace=1 hspace=1/></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="draglist_container">
|
<div id="draglist_container">
|
||||||
|
|
||||||
{foreach from=$PL->getFlat($PL->activeId) key='pos' item='i'}
|
{foreach from=$PL->getActiveArr($PL->activeId) key='pos' item='i'}
|
||||||
<!-- start item -->
|
<!-- start item -->
|
||||||
<div style="position: relative; left: 0px; top: 0px;">
|
<div style="position: relative; left: 0px; top: 0px;">
|
||||||
<!-- {$n++} -->
|
<!-- {$n++} -->
|
||||||
|
@ -34,15 +34,15 @@
|
||||||
<!-- clip information -->
|
<!-- clip information -->
|
||||||
<tr><td style="border:0" colspan="5"></tr>
|
<tr><td style="border:0" colspan="5"></tr>
|
||||||
<tr class="blue1" style="cursor: move;">
|
<tr class="blue1" style="cursor: move;">
|
||||||
<td>{$i.title}</td>
|
<td>{$i.track_title}</td>
|
||||||
<td style="width: 50px;">{assign var="_duration" value=$i.duration}{niceTime in=$_duration}</td>
|
<td style="width: 50px;">{assign var="_duration" value=$i.cliplength}{niceTime in=$_duration}</td>
|
||||||
<td style="width: 150px">{$i.creator}</td>
|
<td style="width: 150px">{$i.artist_name}</td>
|
||||||
<td style="width: 35px; border:0"><img src="img/{$i.type}.png" border="0" alt="{$i.type|capitalize}" {include file="sub/alttext.tpl"} /></td>
|
<td style="width: 35px; border:0"><img src="img/{$i.ftype}.png" border="0" alt="{$i.ftype|capitalize}" {include file="sub/alttext.tpl"} /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- end clip information -->
|
<!-- end clip information -->
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<input type="hidden" name="pl_items[{$i.attrs.id}]">
|
<input type="hidden" name="pl_items[{$i.id}]">
|
||||||
</div>
|
</div>
|
||||||
<!-- end item -->
|
<!-- end item -->
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|
|
@ -485,7 +485,7 @@ class GreenBox extends BasicStor {
|
||||||
if($pl === FALSE)
|
if($pl === FALSE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$res = $pl->setMetaData($category, $value, $lang);
|
$res = $pl->setPLMetaData($category, $value, $lang);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,7 +323,7 @@ class Playlist {
|
||||||
* @param int $p_subjid
|
* @param int $p_subjid
|
||||||
* Subject id (if sessid is not specified)
|
* Subject id (if sessid is not specified)
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* previous state
|
* TRUE on success.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function setEditFlag($p_val=TRUE, $p_sessid=NULL, $p_subjid=NULL) {
|
public function setEditFlag($p_val=TRUE, $p_sessid=NULL, $p_subjid=NULL) {
|
||||||
|
@ -344,7 +344,7 @@ class Playlist {
|
||||||
if (PEAR::isError($r)) {
|
if (PEAR::isError($r)) {
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
return ($state == 'edited');
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -584,7 +584,7 @@ class Playlist {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$res = $this->addAudioClip($ac['file_id'], $newPos, $ac['fadein'], $ac['fadeOut'], $ac['cliplength'], $ac['cuein'], $ac['cueout']);
|
$res = $this->addAudioClip($ac['file_id'], $newPos, $ac['fadein'], $ac['fadeOut'], $ac['cliplength'], $ac['cuein'], $ac['cueout']);
|
||||||
if($res !== TRUE)
|
if($res !== TRUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -701,7 +701,7 @@ class Playlist {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMetaData($category, $value)
|
public function setPLMetaData($category, $value)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once(dirname(__FILE__).'/../conf.php');
|
||||||
|
require_once('PHPUnit.php');
|
||||||
|
require_once('DB.php');
|
||||||
|
require_once(dirname(__FILE__).'/../GreenBox.php');
|
||||||
|
require_once(dirname(__FILE__).'/../Playlist.php');
|
||||||
|
|
||||||
|
$dsn = $CC_CONFIG['dsn'];
|
||||||
|
$CC_DBC = DB::connect($dsn, TRUE);
|
||||||
|
if (PEAR::isError($CC_DBC)) {
|
||||||
|
echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
class PlayListTests extends PHPUnit_TestCase {
|
||||||
|
|
||||||
|
private $greenbox;
|
||||||
|
|
||||||
|
function __construct($name) {
|
||||||
|
parent::__construct($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup() {
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$this->greenbox = new GreenBox();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function testGBCreatePlaylist() {
|
||||||
|
|
||||||
|
$pl = new Playlist();
|
||||||
|
$pl_id = $pl->create("create");
|
||||||
|
|
||||||
|
if (PEAR::isError($pl_id)) {
|
||||||
|
$this->fail("problems creating playlist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function testGBLock() {
|
||||||
|
$pl = new Playlist();
|
||||||
|
$pl_id = $pl->create("lock test");
|
||||||
|
|
||||||
|
$sessid = Alib::Login('root', 'q');
|
||||||
|
|
||||||
|
$res = $this->greenbox->lockPlaylistForEdit($pl_id, $sessid);
|
||||||
|
|
||||||
|
if($res !== TRUE) {
|
||||||
|
$this->fail("problems locking playlist for editing.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function testGBUnLock() {
|
||||||
|
$pl = new Playlist();
|
||||||
|
$pl_id = $pl->create("unlock test");
|
||||||
|
|
||||||
|
$sessid = Alib::Login('root', 'q');
|
||||||
|
|
||||||
|
$this->greenbox->lockPlaylistForEdit($pl_id, $sessid);
|
||||||
|
$res = $this->greenbox->releaseLockedPlaylist($pl_id, $sessid);
|
||||||
|
|
||||||
|
if($res !== TRUE) {
|
||||||
|
$this->fail("problems unlocking playlist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function testGBSetPLMetaData() {
|
||||||
|
$pl = new Playlist();
|
||||||
|
$pl_id = $pl->create("set meta data test");
|
||||||
|
|
||||||
|
$res = $this->greenbox->setPLMetadataValue($pl_id, "dc:title", "A Title");
|
||||||
|
|
||||||
|
if($res !== TRUE) {
|
||||||
|
$this->fail("problems setting playlist metadata.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function testGBGetPLMetaData() {
|
||||||
|
$pl = new Playlist();
|
||||||
|
$name = "Testing";
|
||||||
|
$pl_id = $pl->create($name);
|
||||||
|
|
||||||
|
$res = $this->greenbox->getPLMetadataValue($pl_id, "dc:title");
|
||||||
|
|
||||||
|
if($res !== $name) {
|
||||||
|
$this->fail("problems getting playlist metadata.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function testAddAudioClip() {
|
||||||
|
$pl = new Playlist();
|
||||||
|
$pl_id = $pl->create("Add");
|
||||||
|
|
||||||
|
$res = $this->greenbox->addAudioClipToPlaylist($pl_id, '1');
|
||||||
|
|
||||||
|
if($res !== TRUE) {
|
||||||
|
$this->fail("problems adding audioclip to playlist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function testMoveAudioClip() {
|
||||||
|
$pl = new Playlist();
|
||||||
|
$pl_id = $pl->create("Move");
|
||||||
|
|
||||||
|
$this->greenbox->addAudioClipToPlaylist($pl_id, '1');
|
||||||
|
$this->greenbox->addAudioClipToPlaylist($pl_id, '2');
|
||||||
|
|
||||||
|
$res = $this->greenbox->moveAudioClipInPlaylist($pl_id, 0, 1);
|
||||||
|
|
||||||
|
if($res !== TRUE) {
|
||||||
|
$this->fail("problems moving audioclip in playlist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function testDeleteAudioClip() {
|
||||||
|
$pl = new Playlist();
|
||||||
|
$pl_id = $pl->create("Delete");
|
||||||
|
|
||||||
|
$this->greenbox->addAudioClipToPlaylist($pl_id, '1');
|
||||||
|
$res = $this->greenbox->delAudioClipFromPlaylist($pl_id, 0);
|
||||||
|
|
||||||
|
if($res !== TRUE) {
|
||||||
|
$this->fail("problems deleting audioclip from playlist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue