Skip to content

Commit

Permalink
Merge branch 'release-2.8.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
bugalot committed Jul 27, 2018
2 parents 63ec8cf + dd3b91f commit 4e0fbf3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"minimum-stability" : "dev",
"require": {
"oat-sa/oatbox-extension-installer": "dev-master"
"oat-sa/oatbox-extension-installer": "~1.1||dev-master"
},
"autoload" : {
"psr-4" : {
Expand Down
2 changes: 1 addition & 1 deletion manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
'label' => 'extension-tao-mediamanager',
'description' => 'TAO media manager extension',
'license' => 'GPL-2.0',
'version' => '2.8.1',
'version' => '2.8.2',
'author' => 'Open Assessment Technologies SA',
'requires' => array(
'tao' => '>=17.2.0',
Expand Down
4 changes: 2 additions & 2 deletions model/MediaService.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class MediaService extends \tao_models_classes_ClassService

/**
* (non-PHPdoc)
* @see tao_models_classes_ClassService::getRootClass()
* @see \tao_models_classes_ClassService::getRootClass()
*/
public function getRootClass()
{
Expand Down Expand Up @@ -133,7 +133,7 @@ public function editMediaInstance($fileTmp, $instanceUri, $language)

/**
* (non-PHPdoc)
* @see tao_models_classes_ClassService::deleteResource()
* @see \tao_models_classes_ClassService::deleteResource()
*/
public function deleteResource(\core_kernel_classes_Resource $resource)
{
Expand Down
36 changes: 20 additions & 16 deletions model/MediaSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,38 @@
use oat\tao\model\media\MediaManagement;
use oat\taoMediaManager\model\fileManagement\FileManager;
use oat\oatbox\log\LoggerAwareTrait;
use oat\generis\model\OntologyAwareTrait;

class MediaSource extends Configurable implements MediaManagement
{

use LoggerAwareTrait;
use OntologyAwareTrait;

const SCHEME_NAME = 'taomedia://mediamanager/';

private $lang;

private $rootClassUri;

/**
* get the lang of the class in case we want to filter the media on language
*
* @param array $options
* Returns the lanuage URI to be used
* @return string
*/
public function __construct($options = array())
protected function getLanguage()
{
parent::__construct($options);
\common_ext_ExtensionsManager::singleton()->getExtensionById('taoMediaManager');
$this->lang = (isset($options['lang'])) ? $options['lang'] : '';
$this->rootClassUri = (isset($options['rootClass'])) ? $options['rootClass'] : MediaService::singleton()->getRootClass();
return $this->hasOption('lang')
? $this->getOption('lang')
: ''
;
}


/**
* Return the root class of the mediasource
* @return \core_kernel_classes_Class
*/
public function getRootClass()
{
return new \core_kernel_classes_Class($this->rootClassUri);
return $this->getClass($this->hasOption('rootClass')
? $this->getOption('rootClass')
: MediaService::ROOT_CLASS_URI
);
}

/**
Expand All @@ -68,7 +72,7 @@ public function add($source, $fileName, $parent, $mimetype = null)
$clazz = $this->getOrCreatePath($parent);

$service = MediaService::singleton();
$instanceUri = $service->createMediaInstance($source, $clazz->getUri(), $this->lang, $fileName, $mimetype);
$instanceUri = $service->createMediaInstance($source, $clazz->getUri(), $this->getLanguage(), $fileName, $mimetype);

return $this->getFileInfo($instanceUri);
}
Expand All @@ -91,7 +95,7 @@ public function delete($link)
public function getDirectory($parentLink = '', $acceptableMime = array(), $depth = 1)
{
if ($parentLink == '') {
$class = new \core_kernel_classes_Class($this->rootClassUri);
$class = $this->getRootClass();
} else {
$class = new \core_kernel_classes_Class(\tao_helpers_Uri::decode($parentLink));
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/update/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public function update($initialVersion)
throw new \common_exception_NotImplemented('Updates from versions prior to Tao 3.1 are not longer supported, please update to Tao 3.1 first');
}

$this->skip('0.3.0', '2.8.1');
$this->skip('0.3.0', '2.8.2');
}
}

0 comments on commit 4e0fbf3

Please sign in to comment.