Merge branch 'master' of dev.sourcefabric.org:campcaster

This commit is contained in:
paul.baranowski 2010-09-14 10:19:10 -04:00
commit 8bd8f7c7a4
5 changed files with 94 additions and 15 deletions

View File

@ -74,7 +74,8 @@ $ui_fmask = array(
'isPref' => TRUE, 'isPref' => TRUE,
'type' => 'text', 'type' => 'text',
'label' => 'Archive server location URL', 'label' => 'Archive server location URL',
'required' => false, 'default' => "http://" . $CC_CONFIG['archiveUrlHost'] . ":" . $CC_CONFIG['archiveUrlPort'] . $CC_CONFIG['archiveUrlPath']."/".$CC_CONFIG['archiveXMLRPC'],
'required' => TRUE,
), ),
array( array(
'rule' => 'regex', 'rule' => 'regex',

View File

@ -86,14 +86,16 @@
duration = duration.split("."); duration = duration.split(".");
duration = duration[0].split(":"); duration = duration[0].split(":");
if(parseInt(duration[0] !== 0)) { if(duration[0] == ''){
duration = "00:00";
}
else if(parseInt(duration[0]) !== 0) {
duration = duration[0] +":"+duration[1]+":"+duration[2]; duration = duration[0] +":"+duration[1]+":"+duration[2];
} }
else{ else{
duration = duration[1]+":"+duration[2]; duration = duration[1]+":"+duration[2];
} }
tool_tip_content.append("<tr><td>Duration: </td><td>"+duration+"</td></tr>"); tool_tip_content.append("<tr><td>Duration: </td><td>"+duration+"</td></tr>");
if(type === "playlist") { if(type === "playlist") {

View File

@ -175,7 +175,7 @@ class uiSearch
$this->criteria['counter'] = UI_SIMPLESEARCH_ROWS; $this->criteria['counter'] = UI_SIMPLESEARCH_ROWS;
// $criteria['form'] is used for retransfer to form // $criteria['form'] is used for retransfer to form
$this->criteria['form']['operator'] = 'OR'; $this->criteria['form']['operator'] = 'or';
$this->criteria['form']['filetype'] = UI_SIMPLESEARCH_FILETYPE; $this->criteria['form']['filetype'] = UI_SIMPLESEARCH_FILETYPE;
$this->criteria['form']['limit'] = UI_SIMPLESEARCH_LIMIT; $this->criteria['form']['limit'] = UI_SIMPLESEARCH_LIMIT;

View File

@ -175,23 +175,55 @@ class BasicStor {
$res = BasicStor::RemoveObj($id, $forced); $res = BasicStor::RemoveObj($id, $forced);
return $res; return $res;
} }
$storedFile = StoredFile::Recall($id);
if (is_null($storedFile) || PEAR::isError($storedFile)) {
return $storedFile;
}
if ($storedFile->isAccessed()) {
return PEAR::raiseError(
'Cannot delete an object that is currently accessed.'
);
}
// move to trash: // move to trash:
switch (BasicStor::GetObjType($id)) { switch (BasicStor::GetObjType($id)) {
case "audioclip": case "audioclip":
$playLists = $storedFile->getPlaylists();
$item_gunid = $storedFile->getGunid();
if( $playLists != NULL) {
foreach($playLists as $key=>$val) {
$playList_id = BasicStor::IdFromGunidBigInt($val["gunid"]);
$playList_titles[] = BasicStor::bsGetMetadataValue($playList_id, "dc:title");
}
return PEAR::raiseError(
'Please remove this song from all playlists: ' . join(",", $playList_titles)
);
}
break;
case "playlist": case "playlist":
if($storedFile->isScheduled()) {
return PEAR::raiseError(
'Cannot delete an object that is scheduled to play.'
);
}
break;
case "webstream": case "webstream":
$storedFile = StoredFile::Recall($id);
if (is_null($storedFile) || PEAR::isError($storedFile)) {
return $storedFile;
}
$res = $storedFile->setState('deleted');
if (PEAR::isError($res)) {
return $res;
}
break; break;
default: default:
} }
return TRUE;
$res = $storedFile->setState('deleted');
if (PEAR::isError($res)) {
return $res;
}
return TRUE;
} }
@ -1540,7 +1572,7 @@ class BasicStor {
/** /**
* Get local id from global id. * Get local id from global id (in hex).
* *
* @param string $p_gunid * @param string $p_gunid
* Global id * Global id
@ -1553,6 +1585,21 @@ class BasicStor {
global $CC_CONFIG; global $CC_CONFIG;
return $CC_DBC->getOne("SELECT id FROM ".$CC_CONFIG['filesTable']." WHERE gunid=x'$p_gunid'::bigint"); return $CC_DBC->getOne("SELECT id FROM ".$CC_CONFIG['filesTable']." WHERE gunid=x'$p_gunid'::bigint");
} }
/**
* Get local id from global id (big int).
*
* @param string $p_gunid
* Global id
* @return int
* Local id
*/
public static function IdFromGunidBigInt($p_gunid)
{
global $CC_DBC;
global $CC_CONFIG;
return $CC_DBC->getOne("SELECT id FROM ".$CC_CONFIG['filesTable']." WHERE gunid='$p_gunid'");
}
/** /**

View File

@ -331,7 +331,7 @@ class StoredFile {
* @var int * @var int
*/ */
private $currentlyaccessing; private $currentlyaccessing;
/** /**
* @var int * @var int
*/ */
@ -1153,6 +1153,35 @@ class StoredFile {
} }
return TRUE; return TRUE;
} }
/**
* Returns gunIds of the playlists the stored file is in.
*/
public function getPlaylists() {
global $CC_CONFIG, $CC_DBC;
$_SESSION['delete'] = "gunid: " . $this->gunid;
$sql = "SELECT gunid "
." FROM ".$CC_CONFIG['mdataTable']
." WHERE object='{$this->gunid}'";
$_SESSION['delete'] = $sql;
$playlists = $CC_DBC->getAll($sql);
return $playlists;
}
public function isScheduled() {
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT * "
." FROM ".$CC_CONFIG['scheduleTable']
." WHERE ends > now() and playlist=x'{$this->gunid}'::bigint";
$scheduled = $CC_DBC->getAll($sql);
return $scheduled;
}
/** /**