diff --git a/livesupport/modules/storageServer/var/GreenBox.php b/livesupport/modules/storageServer/var/GreenBox.php
index 20f85323a..e53e05823 100644
--- a/livesupport/modules/storageServer/var/GreenBox.php
+++ b/livesupport/modules/storageServer/var/GreenBox.php
@@ -23,7 +23,7 @@
Author : $Author: tomas $
- Version : $Revision: 1.26 $
+ Version : $Revision: 1.27 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/GreenBox.php,v $
------------------------------------------------------------------------------*/
@@ -35,7 +35,7 @@ require_once "BasicStor.php";
* LiveSupport file storage module
*
* @author $Author: tomas $
- * @version $Revision: 1.26 $
+ * @version $Revision: 1.27 $
* @see BasicStor
*/
class GreenBox extends BasicStor{
@@ -254,6 +254,8 @@ class GreenBox extends BasicStor{
* (may be empty or ommited only with less then 2 items in
* "conditions" field)
*
+ *
limit : int - limit for result arrays (0 means unlimited)
+ * offset : int - starting point (0 means without offset)
* conditions - array of hashes with structure:
*
* - cat - string, metadata category name
@@ -271,9 +273,31 @@ class GreenBox extends BasicStor{
*/
function localSearch($criteria, $sessid='')
{
- return $this->bsLocalSearch($criteria);
+ $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
+ $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
+ return $this->bsLocalSearch($criteria, $limit, $offset);
}
+ /**
+ * Return values of specified metadata category
+ *
+ * @param category string, metadata category name
+ * with or without namespace prefix (dc:title, author)
+ * @param criteria hash, see localSearch method
+ * @param sessid string
+ * @return hash, fields:
+ * results : array with gunid strings
+ * cnt : integer - number of matching values
+ * @see BasicStor::bsBrowseCategory
+ */
+ function browseCategory($category, $criteria, $sessid='')
+ {
+ $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
+ $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
+ $res = $this->bsBrowseCategory($category, $limit, $offset, $criteria);
+ return $res;
+ }
+
/* --------------------------------------------------------- info methods */
/**
diff --git a/livesupport/modules/storageServer/var/LocStor.php b/livesupport/modules/storageServer/var/LocStor.php
index fee10b5e6..58b78b855 100644
--- a/livesupport/modules/storageServer/var/LocStor.php
+++ b/livesupport/modules/storageServer/var/LocStor.php
@@ -23,7 +23,7 @@
Author : $Author: tomas $
- Version : $Revision: 1.24 $
+ Version : $Revision: 1.25 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/LocStor.php,v $
------------------------------------------------------------------------------*/
@@ -257,7 +257,7 @@ class LocStor extends BasicStor{
return $md;
}
- /* --------------------------------------------------------------- search */
+ /* ------------------------------------------------------- search, browse */
/**
* Search in metadata database
*
@@ -288,18 +288,22 @@ class LocStor extends BasicStor{
*
* - audioClipResults : array with gunid strings
* of audioClips have been found
+ * - audioClipCnt : int - number of audioClips matching
+ * the criteria
* - playlistResults : array with gunid strings
* of playlists have been found
+ * - playlistCnt : int - number of playlists matching
+ * the criteria
*
- * @see GreenBox::localSearch
- */
+ * @see BasicStor::localSearch
+ */
function searchMetadata($sessid, $criteria)
{
if(($res = $this->_authorize('read', $this->storId, $sessid)) !== TRUE)
return $res;
- $filetype = strtolower($criteria['filetype']);
- $limit = intval($criteria['limit']);
- $offset = intval($criteria['offset']);
+ $filetype = strtolower($criteria['filetype']);
+ $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
+ $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
if($filetype=='all'){
$criteriaAC = $criteria; $criteriaAC['filetype'] = 'audioclip';
$criteriaPL = $criteria; $criteriaPL['filetype'] = 'playlist';
@@ -332,6 +336,26 @@ class LocStor extends BasicStor{
return $res;
}
+ /**
+ * Return values of specified metadata category
+ *
+ * @param category string, metadata category name
+ * with or without namespace prefix (dc:title, author)
+ * @param criteria hash, see searchMetadata method
+ * @param sessid string
+ * @return hash, fields:
+ * results : array with gunid strings
+ * cnt : integer - number of matching values
+ * @see BasicStor::bsBrowseCategory
+ */
+ function browseCategory($category, $criteria=NULL, $sessid='')
+ {
+ $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
+ $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
+ $res = $this->bsBrowseCategory($category, $limit, $offset, $criteria);
+ return $res;
+ }
+
/* ----------------------------------------------------------------- etc. */
/**
* Check if audio clip exists
diff --git a/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php b/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php
index abb1b5f5a..da9103fd6 100644
--- a/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php
+++ b/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php
@@ -23,7 +23,7 @@
Author : $Author: tomas $
- Version : $Revision: 1.11 $
+ Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php,v $
------------------------------------------------------------------------------*/
@@ -159,7 +159,6 @@ class XR_LocStor extends LocStor{
*
* @param input XMLRPC struct
* @return XMLRPC struct
- * @see GreenBox::logout
*/
function xr_logout($input)
{
@@ -1188,7 +1187,7 @@ class XR_LocStor extends LocStor{
* @param input XMLRPC struct
* @return XMLRPC struct
* @see LocStor::searchMetadata
- * @see GreenBox::localSearch
+ * @see BasicStor::localSearch
*/
function xr_searchMetadata($input)
{
@@ -1215,7 +1214,66 @@ class XR_LocStor extends LocStor{
(count($res['playlistResults'])==0
? new XML_RPC_Value(array(), 'array')
: XML_RPC_encode($res['playlistResults'])
- ),
+ ),
+ ));
+ return new XML_RPC_Response($xv);
+ }
+
+ /**
+ * Return values of specified metadata category
+ *
+ * The XML-RPC name of this method is "locstor.browseCategory".
+ *
+ * The input parameters are an XML-RPC struct with the following
+ * fields:
+ *
+ * - sessid : string - session id
+ * - category : string - metadata category name
+ * with or without namespace prefix (dc:title, author)
+ * - criteria : hash - see searchMetadata method
+ *
+ *
+ * On success, returns a XML-RPC struct with the following fields:
+ *
+ * - results : array with values having been found
+ * - cnt : integer - number of matching values
+ *
+ *
+ * On errors, returns an XML-RPC error response.
+ * The possible error codes and error message are:
+ *
+ * - 3 - Incorrect parameters passed to method:
+ * Wanted ... , got ... at param
+ * - 801 - wrong 1st parameter, struct expected.
+ * - 805 - xr_browseCategory:
+ * <message from lower layer>
+ *
+ *
+ * @param input XMLRPC struct
+ * @return XMLRPC struct
+ * @see Pref::browseCategory
+ */
+ function xr_browseCategory($input)
+ {
+ list($ok, $r) = $this->_xr_getPars($input);
+ if(!$ok) return $r;
+ $res = $this->browseCategory(
+ $r['category'], $r['criteria'], $r['sessid']
+ );
+ if(PEAR::isError($res)){
+ return new XML_RPC_Response(0, 805,
+ "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
+
+ );
+ }
+ $xv = new XML_RPC_Value;
+ $xv->addStruct(array(
+ 'cnt' => XML_RPC_encode($res['cnt']),
+ 'results' =>
+ (count($res['results'])==0
+ ? new XML_RPC_Value(array(), 'array')
+ : XML_RPC_encode($res['results'])
+ ),
));
return new XML_RPC_Response($xv);
}
diff --git a/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php b/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php
index 98459f957..d2f34a638 100644
--- a/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php
+++ b/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php
@@ -23,7 +23,7 @@
Author : $Author: tomas $
- Version : $Revision: 1.19 $
+ Version : $Revision: 1.20 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php,v $
------------------------------------------------------------------------------*/
@@ -99,7 +99,8 @@ $methods = array(
'updateAudioClipMetadata' => 'Update the metadata of an Audio clip '.
'stored in Local storage.',
'searchMetadata' => 'Search through the metadata of stored '.
- 'AudioClips, return all matching clip ids.',
+ 'files, return all matching clip ids.',
+ 'browseCategory' =>'Return values of specified metadata category.',
'accessRawAudioData' => 'Get access to raw audio data.',
'releaseRawAudioData' => 'Release access to raw audio data.',
'getAudioClip' => 'Return the contents of an Audio clip.',