Skip to content
Snippets Groups Projects
Commit fc1d6f4c authored by Thomas Müller's avatar Thomas Müller
Browse files

fixes during test

parent b5a145b2
Branches
No related tags found
No related merge requests found
......@@ -15,35 +15,46 @@ class AdminSettingsController extends ApiController {
/**
* @param string $theme
* @param string $template
* @return type Description
* @return \OCA\Files_Sharing\Http\MailTemplateResponse
*/
public function render( $theme, $template ) {
try {
$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 $template
* @param string $content
* @return array
* @return JSONResponse
*/
public function update( $theme, $template, $content ) {
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());
}
}
/**
* @param string $theme
* @param string $template
* @return array
* @return JSONResponse
*/
public function reset( $theme, $template ) {
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());
}
}
}
......@@ -7,9 +7,9 @@ $(document).ready(function() {
).done(function( result ) {
$( '#mailTemplateSettings textarea' ).val(result);
}).fail(function( result ) {
alert(result);
OC.dialogs.alert(result.message, t('files_sharing', 'Could not load template'));
});
}
};
// load default template
var theme = $( '#mts-theme' ).val();
......@@ -41,11 +41,11 @@ $(document).ready(function() {
$.post(
OC.generateUrl('apps/files_sharing/settings/mailtemplate'),
{ theme: theme, template: template, content: content }
).done(function( result ) {
).done(function() {
var data = { status:'success', data:{message:t('files_sharing', 'Saved')} };
OC.msg.finishedSaving('#mts-msg', data);
}).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);
});
}
......@@ -55,13 +55,12 @@ $(document).ready(function() {
function() {
var theme = $( '#mts-theme' ).val();
var template = $( '#mts-template' ).val();
var content = $( '#mailTemplateSettings textarea' ).val();
OC.msg.startSaving('#mts-msg');
$.ajax({
type: "DELETE",
url: OC.generateUrl('apps/files_sharing/settings/mailtemplate'),
data: { theme: theme, template: template }
}).done(function( result ) {
}).done(function() {
var data = { status:'success', data:{message:t('files_sharing', 'Reset')} };
OC.msg.finishedSaving('#mts-msg', data);
......@@ -70,7 +69,7 @@ $(document).ready(function() {
var template = $( '#mts-template' ).val();
loadTemplate(theme, template);
}).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);
});
}
......
......@@ -34,6 +34,7 @@ class MailTemplate extends \OC_Template {
list($path, $template) = $this->findTemplate($this->theme, $app, $name, '');
return new MailTemplateResponse($template);
}
throw new SecurityException('Template not editable.', 403);
}
public function renderContent() {
......
<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">&nbsp;</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">&nbsp;</td></tr>
<tr>
<td bgcolor="#f8f8f8" width="20px">&nbsp;</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">&nbsp;</td></tr>
<tr>
<td bgcolor="#f8f8f8" width="20px">&nbsp;</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">&nbsp;</td>
</tr>
</table>
</td></tr>
</table>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment