Fixes for function renaming (public/private stuff). Renamed getMdataValue() to getMetadataValue(), renamed setMdataValue() to setMetadataValue(). Fixed calls to BasicStor::getMetadataValue() to use the new return value properly.

This commit is contained in:
paul 2006-11-21 16:19:19 +00:00
parent f3a8175815
commit d9f5ba0335

View file

@ -1,5 +1,7 @@
<?php <?php
require_once("BasicStor.php"); require_once("BasicStor.php");
require_once("LocStor.php");
require_once('Prefs.php');
/** /**
* GreenBox class * GreenBox class
@ -129,7 +131,7 @@ class GreenBox extends BasicStor {
// if (($res = $this->_authorize('read', $id, $sessid)) !== TRUE) { // if (($res = $this->_authorize('read', $id, $sessid)) !== TRUE) {
// return $res; // return $res;
// } // }
// $gunid = $this->_gunidFromId($id); // $gunid = $this->gunidFromId($id);
// $r = $this->bsAccess(NULL, '', $gunid, 'access'); // $r = $this->bsAccess(NULL, '', $gunid, 'access');
// if (PEAR::isError($r)) { // if (PEAR::isError($r)) {
// return $r; // return $r;
@ -393,16 +395,15 @@ class GreenBox extends BasicStor {
* <li>attrs hasharray of element's attributes indexed by * <li>attrs hasharray of element's attributes indexed by
* qualified name (e.g. xml:lang)</li> * qualified name (e.g. xml:lang)</li>
* </ul> * </ul>
* @todo rename this function to "getMetadataValue"
*/ */
public function getMdataValue($id, $category, $sessid='', public function getMetadataValue($id, $category, $sessid='',
$lang=NULL, $deflang=NULL) $lang=NULL, $deflang=NULL)
{ {
if (($res = $this->_authorize('read', $id, $sessid)) !== TRUE) { if (($res = $this->_authorize('read', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }
return $this->bsGetMetadataValue($id, $category, $lang, $deflang); return $this->bsGetMetadataValue($id, $category);
} // fn getMdataValue } // fn getMetadataValue
/** /**
@ -421,15 +422,14 @@ class GreenBox extends BasicStor {
* @param int $mid * @param int $mid
* (optional on unique elements) Metadata record id * (optional on unique elements) Metadata record id
* @return boolean * @return boolean
* @todo rename this function to "setMetadataValue"
*/ */
public function setMdataValue($id, $category, $sessid, $value, $lang=NULL, $mid=NULL) public function setMetadataValue($id, $category, $sessid, $value, $lang=NULL, $mid=NULL)
{ {
if (($res = $this->_authorize('write', $id, $sessid)) !== TRUE) { if (($res = $this->_authorize('write', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }
return $this->bsSetMetadataValue($id, $category, $value, $lang, $mid); return $this->bsSetMetadataValue($id, $category, $value, $lang, $mid);
} // fn setMdataValue } // fn setMetadataValue
/** /**
@ -536,14 +536,13 @@ class GreenBox extends BasicStor {
public function createPlaylist($parid, $fname, $sessid='') public function createPlaylist($parid, $fname, $sessid='')
{ {
$gunid = StoredFile::_createGunid(); $gunid = StoredFile::_createGunid();
require_once"LocStor.php";
$lc = new LocStor($this->dbc, $this->config); $lc = new LocStor($this->dbc, $this->config);
$gunid2 = $lc->createPlaylist($sessid, $gunid, $fname); $gunid2 = $lc->createPlaylist($sessid, $gunid, $fname);
if (PEAR::isError($gunid2)) { if (PEAR::isError($gunid2)) {
return $gunid2; return $gunid2;
} }
// get local id: // get local id:
$id = $this->_idFromGunid($gunid2); $id = $this->idFromGunid($gunid2);
if (PEAR::isError($id)) { if (PEAR::isError($id)) {
return $id; return $id;
} }
@ -590,7 +589,7 @@ class GreenBox extends BasicStor {
*/ */
public function getPlaylistArray($id, $sessid) public function getPlaylistArray($id, $sessid)
{ {
$gunid = $this->_gunidFromId($id); $gunid = $this->gunidFromId($id);
$pl = StoredFile::recall($this, $id); $pl = StoredFile::recall($this, $id);
if (PEAR::isError($pl)) { if (PEAR::isError($pl)) {
return $pl; return $pl;
@ -612,8 +611,7 @@ class GreenBox extends BasicStor {
*/ */
public function lockPlaylistForEdit($id, $sessid) public function lockPlaylistForEdit($id, $sessid)
{ {
$gunid = $this->_gunidFromId($id); $gunid = $this->gunidFromId($id);
require_once("LocStor.php");
$lc = new LocStor($this->dbc, $this->config); $lc = new LocStor($this->dbc, $this->config);
$res = $lc->editPlaylist($sessid, $gunid); $res = $lc->editPlaylist($sessid, $gunid);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
@ -679,7 +677,7 @@ class GreenBox extends BasicStor {
if (PEAR::isError($pl)) { if (PEAR::isError($pl)) {
return $pl; return $pl;
} }
$acGunid = $this->_gunidFromId($acId); $acGunid = $this->gunidFromId($acId);
if ($pl->_cyclicRecursion($acGunid)){ if ($pl->_cyclicRecursion($acGunid)){
return PEAR::raiseError( return PEAR::raiseError(
"GreenBox::addAudioClipToPlaylist: cyclic-recursion detected". "GreenBox::addAudioClipToPlaylist: cyclic-recursion detected".
@ -816,7 +814,6 @@ class GreenBox extends BasicStor {
*/ */
public function revertEditedPlaylist($token, $sessid='') public function revertEditedPlaylist($token, $sessid='')
{ {
require_once("LocStor.php");
$lc = new LocStor($this->dbc, $this->config); $lc = new LocStor($this->dbc, $this->config);
return $lc->revertEditedPlaylist($token, $sessid); return $lc->revertEditedPlaylist($token, $sessid);
} // fn revertEditedPlaylist } // fn revertEditedPlaylist
@ -833,8 +830,7 @@ class GreenBox extends BasicStor {
*/ */
public function deletePlaylist($id, $sessid) public function deletePlaylist($id, $sessid)
{ {
$gunid = $this->_gunidFromId($id); $gunid = $this->gunidFromId($id);
require_once("LocStor.php");
$lc = new LocStor($this->dbc, $this->config); $lc = new LocStor($this->dbc, $this->config);
return $lc->deletePlaylist($sessid, $gunid); return $lc->deletePlaylist($sessid, $gunid);
} // fn deletePlaylist } // fn deletePlaylist
@ -876,18 +872,12 @@ class GreenBox extends BasicStor {
return $res; return $res;
} }
$res['title'] = NULL; $res['title'] = NULL;
$id = $this->_idFromGunid($res['gunid']); $id = $this->idFromGunid($res['gunid']);
if (PEAR::isError($id)) { if (PEAR::isError($id)) {
return $id; return $id;
} }
if (!is_null($id)) { if (!is_null($id)) {
$md = $this->bsGetMetadataValue($id, "dc:title", $lang, $deflang); $res['title'] = $this->bsGetMetadataValue($id, "dc:title");
if (PEAR::isError($md)) {
return $md;
}
if (isset($md[0]['value'])) {
$res['title'] = $md[0]['value'];
}
} }
return $res; return $res;
} // fn displayPlaylistClipAtOffset } // fn displayPlaylistClipAtOffset
@ -998,8 +988,7 @@ class GreenBox extends BasicStor {
*/ */
public function existsPlaylist($id, $sessid) public function existsPlaylist($id, $sessid)
{ {
$gunid = $this->_gunidFromId($id); $gunid = $this->gunidFromId($id);
require_once("LocStor.php");
$lc = new LocStor($this->dbc, $this->config); $lc = new LocStor($this->dbc, $this->config);
return $lc->existsPlaylist($sessid, $gunid); return $lc->existsPlaylist($sessid, $gunid);
} // fn existsPlaylist } // fn existsPlaylist
@ -1019,8 +1008,7 @@ class GreenBox extends BasicStor {
*/ */
public function playlistIsAvailable($id, $sessid) public function playlistIsAvailable($id, $sessid)
{ {
$gunid = $this->_gunidFromId($id); $gunid = $this->gunidFromId($id);
require_once("LocStor.php");
$lc = new LocStor($this->dbc, $this->config); $lc = new LocStor($this->dbc, $this->config);
return $lc->playlistIsAvailable($sessid, $gunid, TRUE); return $lc->playlistIsAvailable($sessid, $gunid, TRUE);
} // fn playlistIsAvailable } // fn playlistIsAvailable
@ -1425,7 +1413,6 @@ class GreenBox extends BasicStor {
*/ */
public function loadPref($sessid, $key) public function loadPref($sessid, $key)
{ {
require_once('Prefs.php');
$pr = new Prefs($this); $pr = new Prefs($this);
$res = $pr->loadPref($sessid, $key); $res = $pr->loadPref($sessid, $key);
return $res; return $res;
@ -1445,7 +1432,6 @@ class GreenBox extends BasicStor {
*/ */
public function savePref($sessid, $key, $value) public function savePref($sessid, $key, $value)
{ {
require_once('Prefs.php');
$pr = new Prefs($this); $pr = new Prefs($this);
$res = $pr->savePref($sessid, $key, $value); $res = $pr->savePref($sessid, $key, $value);
return $res; return $res;
@ -1463,7 +1449,6 @@ class GreenBox extends BasicStor {
*/ */
public function delPref($sessid, $key) public function delPref($sessid, $key)
{ {
require_once('Prefs.php');
$pr = new Prefs($this); $pr = new Prefs($this);
$res = $pr->delPref($sessid, $key); $res = $pr->delPref($sessid, $key);
return $res; return $res;
@ -1484,7 +1469,6 @@ class GreenBox extends BasicStor {
*/ */
public function loadGroupPref($sessid, $group, $key) public function loadGroupPref($sessid, $group, $key)
{ {
require_once('Prefs.php');
$pr = new Prefs($this); $pr = new Prefs($this);
$res = $pr->loadGroupPref($sessid, $group, $key); $res = $pr->loadGroupPref($sessid, $group, $key);
return $res; return $res;
@ -1506,7 +1490,6 @@ class GreenBox extends BasicStor {
*/ */
public function saveGroupPref($sessid, $group, $key, $value) public function saveGroupPref($sessid, $group, $key, $value)
{ {
require_once('Prefs.php');
$pr = new Prefs($this); $pr = new Prefs($this);
$res = $pr->saveGroupPref($sessid, $group, $key, $value); $res = $pr->saveGroupPref($sessid, $group, $key, $value);
return $res; return $res;
@ -1526,7 +1509,6 @@ class GreenBox extends BasicStor {
*/ */
public function delGroupPref($sessid, $group, $key) public function delGroupPref($sessid, $group, $key)
{ {
require_once('Prefs.php');
$pr = new Prefs($this); $pr = new Prefs($this);
$res = $pr->delGroupPref($sessid, $group, $key); $res = $pr->delGroupPref($sessid, $group, $key);
return $res; return $res;
@ -1753,7 +1735,7 @@ class GreenBox extends BasicStor {
*/ */
public function getFileType($id) public function getFileType($id)
{ {
// $id = $this->_idFromGunid($gunid); // $id = $this->idFromGunid($gunid);
$type = $this->getObjType($id); $type = $this->getObjType($id);
return $type; return $type;
} // fn getFileType } // fn getFileType
@ -1772,7 +1754,7 @@ class GreenBox extends BasicStor {
*/ */
public function existsFile($sessid, $gunid, $ftype=NULL) public function existsFile($sessid, $gunid, $ftype=NULL)
{ {
$id = $this->_idFromGunid($gunid); $id = $this->idFromGunid($gunid);
$ex = $this->bsExistsFile($id, $ftype); $ex = $this->bsExistsFile($id, $ftype);
if (($res = $this->_authorize('read', $id, $sessid)) !== TRUE) { if (($res = $this->_authorize('read', $id, $sessid)) !== TRUE) {
return $res; return $res;