* @NoCSRFRequired
*
* @param string $fileName css filename with extension
+ * @param string $appName css folder name
* @return text/css
*/
- public function getCss($fileName) {
+ public function getCss($fileName, $appName) {
try {
- $cssFile = $this->cssManager->getCss($fileName);
+ $cssFile = $this->cssManager->getCss($fileName, $appName);
} catch(NotFoundException $e) {
return new NotFoundResponse();
}
['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'],
['name' => 'Preview#getPreview', 'url' => '/core/preview', 'verb' => 'GET'],
['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'],
- ['name' => 'Css#getCss', 'url' => '/css/{fileName}', 'verb' => 'GET'],
+ ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'],
],
'ocs' => [
['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
* Get the css file and return ISimpleFile
*
* @param string $fileName css filename with extension
+ * @param string $appName css app name
* @return ISimpleFile
*/
- public function getCss($fileName) {
+ public function getCss($fileName, $appName) {
try {
- $folder = $this->appData->getFolder('css');
+ $folder = $this->appData->getFolder($appName);
} catch(NotFoundException $e) {
throw new NotFoundException();
}
});
$this->registerService('CssManager', function (Server $c) {
return new CssManager(
- $c->getAppDataDir('server')
+ $c->getAppDataDir('css')
);
});
$this->registerService('Logger', function (Server $c) {
class CSSResourceLocator extends ResourceLocator {
- /** @var IAppData */
+ /** @var \OCP\Files\IAppData */
protected $appData;
/** @var \OCP\IURLGenerator */
protected $urlGenerator;
- /** @var \OCP\Files\IConfig */
+ /** @var \OC\SystemConfig */
protected $systemConfig;
/**
* @param string $theme
* @param array $core_map
* @param array $party_map
- * @param IAppData $appData
+ * @param \OCP\Files\IAppData $appData
+ * @param \OCP\IURLGenerator $urlGenerator
+ * @param \OC\SystemConfig $systemConfig
*/
- public function __construct(\OCP\ILogger $logger, $theme, $core_map, $party_map, \OCP\Files\IAppData $appData, \OCP\IURLGenerator $urlGenerator, $systemConfig) {
+ public function __construct(\OCP\ILogger $logger, $theme, $core_map, $party_map, \OCP\Files\IAppData $appData, \OCP\IURLGenerator $urlGenerator, \OC\SystemConfig $systemConfig) {
$this->appData = $appData;
$this->urlGenerator = $urlGenerator;
$this->systemConfig = $systemConfig;
*
* @param string $root path to check
* @param string $file the filename
- * @param IAppData $appData the appData folder
+ * @param \OCP\Files\IAppData $appData
+ * @param \OCP\IURLGenerator $urlGenerator
+ * @param \OC\SystemConfig $systemConfig
* @param string|null $webRoot base for path, default map $root to $webRoot
* @return bool True if the resource was found and cached, false otherwise
*/
$systemConfig);
if($scssCache->process()) {
- $this->append($root, $scssCache->getCachedSCSS(), $webRoot, false);
+ $this->append($root, $scssCache->getCachedSCSS('core'), $webRoot, false);
return true;
} else {
$this->logger->error('Failed to compile and/or save '.$root.'/'.$file, ['app' => 'core']);
protected $appData;
/** @var \OCP\IURLGenerator */
protected $urlGenerator;
- /** @var \OCP\Files\IConfig */
+ /** @var \OC\SystemConfig */
protected $systemConfig;
/**
* @param string $root
* @param string $file
* @param \OCP\Files\IAppData $appData
+ * @param \OCP\IURLGenerator $urlGenerator
+ * @param \OC\SystemConfig $systemConfig
*/
- public function __construct(\OCP\ILogger $logger, $root, $file, \OCP\Files\IAppData $appData, \OCP\IURLGenerator $urlGenerator, $systemConfig) {
+ public function __construct(\OCP\ILogger $logger, $root, $file, \OCP\Files\IAppData $appData, \OCP\IURLGenerator $urlGenerator, \OC\SystemConfig $systemConfig) {
$this->logger = $logger;
$this->appData = $appData;
$this->urlGenerator = $urlGenerator;
} else {
return $this->cache();
}
- return false;
}
/**
} catch(NotFoundException $e) {
return false;
}
- return false;
+ return false;
}
/**
/**
* Return the cached css file uri
+ * @param string $appName the app name
* @return string
*/
- public function getCachedSCSS() {
- return substr($this->urlGenerator->linkToRoute('core.Css.getCss', array('fileName' => $this->fileNameCSS)), 1);
+ public function getCachedSCSS($appName) {
+ return substr($this->urlGenerator->linkToRoute('core.Css.getCss', array('fileName' => $this->fileNameCSS, 'appName' => $appName)), 1);
}
}
* Get the css file and return ISimpleFile
*
* @param string $fileName css filename with extension
+ * @param string $appName css app name
* @return ISimpleFile
*/
- public function getCss($fileName);
+ public function getCss($fileName, $appName);
}