Commit ba5606eb authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files
parents 3cc65def 112c77d7
......@@ -124,28 +124,29 @@ $getstring = quotestrings(array(
'myfiles',
),
'artefact.blog' => array(
'baseline',
'top',
'middle',
'bottom',
'texttop',
'absolutemiddle',
'absolutebottom',
'left',
'right',
'alignment',
'attach',
'baseline',
'blogpost',
'border',
'bottom',
'browsemyfiles',
'cancel',
'dimensions',
'horizontalspace',
'insert',
'insertimage',
'left',
'middle',
'name',
'nofilesattachedtothispost',
'remove',
'right',
'texttop',
'top',
'update',
'verticalspace',
'noimageshavebeenattachedtothispost',
)));
......@@ -550,7 +551,8 @@ function blogpostExecCommandHandler(editor_id, elm, command, user_interface, val
INPUT({'type':'hidden', 'name':'imgid', 'value':a.alt}),
TABLE(null,tbody));
appendChildNodes(tbody, TR(null,TD({'colSpan':2},
INPUT({'type':'button', 'class':'button', 'value':{$getstring['insert']},
INPUT({'type':'button', 'class':'button',
'value':(a.src == '' ? {$getstring['insert']} : {$getstring['update']}),
'onclick':function () { insertImage(); }}),
INPUT({'type':'button', 'class':'button', 'value':{$getstring['cancel']},
'onclick':function () { replaceChildNodes('insertimage', null); }}))));
......
......@@ -93,6 +93,7 @@ $string['settings'] = 'Settings';
$string['thisisdraft'] = 'This post is a draft';
$string['thisisdraftdesc'] = 'When your post is a draft, no one except you can see it.';
$string['title'] = 'Title';
$string['update'] = 'Update';
$string['verticalspace'] = 'Vertical space';
$string['viewblog'] = 'View Blog';
$string['youarenottheownerofthisblogpost'] = 'You are not the owner of this blog post';
......
......@@ -109,6 +109,7 @@ if (!empty($uploads)) {
// we need to go through the body of the post and change the 'src' and
// 'alt' attributes of all images that refer to uploaded files.
if (!empty($uploadartefact)) {
$originalbody = $body;
foreach ($uploadartefact as $k => $v) {
$regexps = array('/\/artefact\/blog\/downloadtemp.php\?uploadnumber=' . $k .'&createid=\d+/',
'/alt="uploaded:' . $k . '"/');
......@@ -116,8 +117,11 @@ if (!empty($uploadartefact)) {
'alt="artefact:' . $v . '"');
$body = preg_replace($regexps, $subs, $body);
}
$postobj->set('description', $body);
$postobj->commit();
if ($body != $originalbody) {
$postobj = new ArtefactTypeBlogPost($blogpost, null);
$postobj->set('description', $body);
$postobj->commit();
}
}
json_reply(false, get_string('blogpostsaved', 'artefact.blog'));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment