fixes during test
This commit is contained in:
parent
b5a145b297
commit
fc1d6f4c3c
|
@ -15,35 +15,46 @@ class AdminSettingsController extends ApiController {
|
||||||
/**
|
/**
|
||||||
* @param string $theme
|
* @param string $theme
|
||||||
* @param string $template
|
* @param string $template
|
||||||
* @return type Description
|
|
||||||
* @return \OCA\Files_Sharing\Http\MailTemplateResponse
|
* @return \OCA\Files_Sharing\Http\MailTemplateResponse
|
||||||
*/
|
*/
|
||||||
public function render( $theme, $template ) {
|
public function render( $theme, $template ) {
|
||||||
$template = new \OCA\Files_Sharing\MailTemplate( $theme, $template );
|
try {
|
||||||
return $template->getResponse();
|
$template = new \OCA\Files_Sharing\MailTemplate( $theme, $template );
|
||||||
|
return $template->getResponse();
|
||||||
|
} catch (\Exception $ex) {
|
||||||
|
return new JSONResponse(array('message' => $ex->getMessage()), $ex->getCode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $theme
|
* @param string $theme
|
||||||
* @param string $template
|
* @param string $template
|
||||||
* @param string $content
|
* @param string $content
|
||||||
* @return array
|
* @return JSONResponse
|
||||||
*/
|
*/
|
||||||
public function update( $theme, $template, $content ) {
|
public function update( $theme, $template, $content ) {
|
||||||
$template = new \OCA\Files_Sharing\MailTemplate( $theme, $template );
|
try {
|
||||||
$template->setContent( $content );
|
$template = new \OCA\Files_Sharing\MailTemplate( $theme, $template );
|
||||||
return new JSONResponse();
|
$template->setContent( $content );
|
||||||
|
return new JSONResponse();
|
||||||
|
} catch (\Exception $ex) {
|
||||||
|
return new JSONResponse(array('message' => $ex->getMessage()), $ex->getCode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $theme
|
* @param string $theme
|
||||||
* @param string $template
|
* @param string $template
|
||||||
* @return array
|
* @return JSONResponse
|
||||||
*/
|
*/
|
||||||
public function reset( $theme, $template ) {
|
public function reset( $theme, $template ) {
|
||||||
$template = new \OCA\Files_Sharing\MailTemplate( $theme, $template );
|
try {
|
||||||
$template->reset();
|
$template = new \OCA\Files_Sharing\MailTemplate( $theme, $template );
|
||||||
return new JSONResponse();
|
$template->reset();
|
||||||
|
return new JSONResponse();
|
||||||
|
} catch (\Exception $ex) {
|
||||||
|
return new JSONResponse(array('message' => $ex->getMessage()), $ex->getCode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,9 @@ $(document).ready(function() {
|
||||||
).done(function( result ) {
|
).done(function( result ) {
|
||||||
$( '#mailTemplateSettings textarea' ).val(result);
|
$( '#mailTemplateSettings textarea' ).val(result);
|
||||||
}).fail(function( result ) {
|
}).fail(function( result ) {
|
||||||
alert(result);
|
OC.dialogs.alert(result.message, t('files_sharing', 'Could not load template'));
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// load default template
|
// load default template
|
||||||
var theme = $( '#mts-theme' ).val();
|
var theme = $( '#mts-theme' ).val();
|
||||||
|
@ -41,11 +41,11 @@ $(document).ready(function() {
|
||||||
$.post(
|
$.post(
|
||||||
OC.generateUrl('apps/files_sharing/settings/mailtemplate'),
|
OC.generateUrl('apps/files_sharing/settings/mailtemplate'),
|
||||||
{ theme: theme, template: template, content: content }
|
{ theme: theme, template: template, content: content }
|
||||||
).done(function( result ) {
|
).done(function() {
|
||||||
var data = { status:'success', data:{message:t('files_sharing', 'Saved')} };
|
var data = { status:'success', data:{message:t('files_sharing', 'Saved')} };
|
||||||
OC.msg.finishedSaving('#mts-msg', data);
|
OC.msg.finishedSaving('#mts-msg', data);
|
||||||
}).fail(function( result ) {
|
}).fail(function(result) {
|
||||||
var data = { status:'error', data:{message:t('files_sharing', 'Error')} };
|
var data = { status: 'error', data:{message:result.responseJSON.message} };
|
||||||
OC.msg.finishedSaving('#mts-msg', data);
|
OC.msg.finishedSaving('#mts-msg', data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -55,13 +55,12 @@ $(document).ready(function() {
|
||||||
function() {
|
function() {
|
||||||
var theme = $( '#mts-theme' ).val();
|
var theme = $( '#mts-theme' ).val();
|
||||||
var template = $( '#mts-template' ).val();
|
var template = $( '#mts-template' ).val();
|
||||||
var content = $( '#mailTemplateSettings textarea' ).val();
|
|
||||||
OC.msg.startSaving('#mts-msg');
|
OC.msg.startSaving('#mts-msg');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
url: OC.generateUrl('apps/files_sharing/settings/mailtemplate'),
|
url: OC.generateUrl('apps/files_sharing/settings/mailtemplate'),
|
||||||
data: { theme: theme, template: template }
|
data: { theme: theme, template: template }
|
||||||
}).done(function( result ) {
|
}).done(function() {
|
||||||
var data = { status:'success', data:{message:t('files_sharing', 'Reset')} };
|
var data = { status:'success', data:{message:t('files_sharing', 'Reset')} };
|
||||||
OC.msg.finishedSaving('#mts-msg', data);
|
OC.msg.finishedSaving('#mts-msg', data);
|
||||||
|
|
||||||
|
@ -69,8 +68,8 @@ $(document).ready(function() {
|
||||||
var theme = $( '#mts-theme' ).val();
|
var theme = $( '#mts-theme' ).val();
|
||||||
var template = $( '#mts-template' ).val();
|
var template = $( '#mts-template' ).val();
|
||||||
loadTemplate(theme, template);
|
loadTemplate(theme, template);
|
||||||
}).fail(function( result ) {
|
}).fail(function(result) {
|
||||||
var data = { status:'error', data:{message:t('files_sharing', 'Error')} };
|
var data = { status: 'error', data:{message:result.responseJSON.message} };
|
||||||
OC.msg.finishedSaving('#mts-msg', data);
|
OC.msg.finishedSaving('#mts-msg', data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ class MailTemplate extends \OC_Template {
|
||||||
|
|
||||||
//determine valid theme names
|
//determine valid theme names
|
||||||
$this->editableThemes = self::getEditableThemes();
|
$this->editableThemes = self::getEditableThemes();
|
||||||
//for now hardcode the valid mail template paths
|
//for now hard code the valid mail template paths
|
||||||
$this->editableTemplates = self::getEditableTemplates();
|
$this->editableTemplates = self::getEditableTemplates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ class MailTemplate extends \OC_Template {
|
||||||
list($path, $template) = $this->findTemplate($this->theme, $app, $name, '');
|
list($path, $template) = $this->findTemplate($this->theme, $app, $name, '');
|
||||||
return new MailTemplateResponse($template);
|
return new MailTemplateResponse($template);
|
||||||
}
|
}
|
||||||
|
throw new SecurityException('Template not editable.', 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderContent() {
|
public function renderContent() {
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
|
||||||
<tr><td>
|
|
||||||
<table cellspacing="0" cellpadding="0" border="0" width="600px">
|
|
||||||
<tr>
|
|
||||||
<td bgcolor="#1d2d44" width="20px"> </td>
|
|
||||||
<td bgcolor="#1d2d44">
|
|
||||||
<img src="<?php print_unescaped(OC_Helper::makeURLAbsolute(image_path('', 'logo-mail.gif'))); ?>" alt="{{theme.name}}"/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr><td bgcolor="#f8f8f8" colspan="2"> </td></tr>
|
|
||||||
<tr>
|
|
||||||
<td bgcolor="#f8f8f8" width="20px"> </td>
|
|
||||||
<td bgcolor="#f8f8f8" style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">
|
|
||||||
<?php
|
|
||||||
print_unescaped($l->t('Hey there,<br><br>just letting you know that %s shared <strong>%s</strong> with you.<br><a href="%s">View it!</a><br><br>', array($_['user_displayname'], $_['filename'], $_['link'])));
|
|
||||||
if ( isset($_['expiration']) ) {
|
|
||||||
p($l->t("The share will expire on %s.", array($_['expiration'])));
|
|
||||||
print_unescaped('<br><br>');
|
|
||||||
}
|
|
||||||
p($l->t('Cheers!'));
|
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr><td bgcolor="#f8f8f8" colspan="2"> </td></tr>
|
|
||||||
<tr>
|
|
||||||
<td bgcolor="#f8f8f8" width="20px"> </td>
|
|
||||||
<td bgcolor="#f8f8f8" style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">--<br>
|
|
||||||
{{theme.name}} -
|
|
||||||
{{theme.slogan}}
|
|
||||||
<br><a href="{{theme.baseurl}}">{{theme.baseurl}}</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td bgcolor="#f8f8f8" colspan="2"> </td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td></tr>
|
|
||||||
</table>
|
|
Loading…
Reference in New Issue