2014-06-03 18:50:05 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace OCA\Files_Sharing\Controller;
|
|
|
|
|
|
|
|
use \OCP\AppFramework\ApiController;
|
|
|
|
use \OCP\IRequest;
|
|
|
|
use \OCP\AppFramework\Http\JSONResponse;
|
|
|
|
|
|
|
|
class AdminSettingsController extends ApiController {
|
|
|
|
|
|
|
|
public function __construct($appName, IRequest $request) {
|
|
|
|
parent::__construct($appName, $request);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $theme
|
|
|
|
* @param string $template
|
|
|
|
* @return \OCA\Files_Sharing\Http\MailTemplateResponse
|
|
|
|
*/
|
|
|
|
public function render( $theme, $template ) {
|
2014-06-04 17:01:36 +04:00
|
|
|
try {
|
|
|
|
$template = new \OCA\Files_Sharing\MailTemplate( $theme, $template );
|
|
|
|
return $template->getResponse();
|
|
|
|
} catch (\Exception $ex) {
|
|
|
|
return new JSONResponse(array('message' => $ex->getMessage()), $ex->getCode());
|
|
|
|
}
|
2014-06-03 18:50:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $theme
|
|
|
|
* @param string $template
|
|
|
|
* @param string $content
|
2014-06-04 17:01:36 +04:00
|
|
|
* @return JSONResponse
|
2014-06-03 18:50:05 +04:00
|
|
|
*/
|
|
|
|
public function update( $theme, $template, $content ) {
|
2014-06-04 17:01:36 +04:00
|
|
|
try {
|
|
|
|
$template = new \OCA\Files_Sharing\MailTemplate( $theme, $template );
|
|
|
|
$template->setContent( $content );
|
|
|
|
return new JSONResponse();
|
|
|
|
} catch (\Exception $ex) {
|
|
|
|
return new JSONResponse(array('message' => $ex->getMessage()), $ex->getCode());
|
|
|
|
}
|
2014-06-03 18:50:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $theme
|
|
|
|
* @param string $template
|
2014-06-04 17:01:36 +04:00
|
|
|
* @return JSONResponse
|
2014-06-03 18:50:05 +04:00
|
|
|
*/
|
|
|
|
public function reset( $theme, $template ) {
|
2014-06-04 17:01:36 +04:00
|
|
|
try {
|
|
|
|
$template = new \OCA\Files_Sharing\MailTemplate( $theme, $template );
|
|
|
|
$template->reset();
|
|
|
|
return new JSONResponse();
|
|
|
|
} catch (\Exception $ex) {
|
|
|
|
return new JSONResponse(array('message' => $ex->getMessage()), $ex->getCode());
|
|
|
|
}
|
2014-06-03 18:50:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|