check if user creating the version is currently editing

This commit is contained in:
Uwe Steinmann 2021-01-27 09:54:46 +01:00
parent 8a2224b669
commit 072b1d2eb9

View File

@ -40,8 +40,37 @@ class SeedDMS_View_EditOnline extends SeedDMS_Bootstrap_Style {
$document = $this->params['document'];
header('Content-Type: application/javascript; charset=UTF-8');
?>
mySeedSettings = {
nameSpace: 'markdown', // Useful to prevent multi-instances CSS conflict
previewParserPath: '~/sets/markdown/preview.php',
onShiftEnter: {keepDefault:false, openWith:'\n\n'},
markupSet: [
{name:'First Level Heading', key:"1", placeHolder:'Your title here...', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '=') } },
{name:'Second Level Heading', key:"2", placeHolder:'Your title here...', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '-') } },
{name:'Heading 3', key:"3", openWith:'### ', placeHolder:'Your title here...' },
{name:'Heading 4', key:"4", openWith:'#### ', placeHolder:'Your title here...' },
{name:'Heading 5', key:"5", openWith:'##### ', placeHolder:'Your title here...' },
{name:'Heading 6', key:"6", openWith:'###### ', placeHolder:'Your title here...' },
{separator:'---------------' },
{name:'Bold', key:"B", openWith:'**', closeWith:'**'},
{name:'Italic', key:"I", openWith:'_', closeWith:'_'},
{separator:'---------------' },
{name:'Bulleted List', openWith:'- ' },
{name:'Numeric List', openWith:function(markItUp) {
return markItUp.line+'. ';
}},
{separator:'---------------' },
{name:'Picture', key:"P", replaceWith:'![[![Alternative text]!]]([![Url:!:http://]!] "[![Title]!]")'},
{name:'Link', key:"L", openWith:'[', closeWith:']([![Url:!:http://]!] "[![Title]!]")', placeHolder:'Your text to link here...' },
{separator:'---------------'},
{name:'Quotes', openWith:'> '},
{name:'Code Block / Code', openWith:'(!(\t|!|`)!)', closeWith:'(!(`)!)'},
// {separator:'---------------'},
// {name:'Preview', call:'preview', className:"preview"}
]
}
$(document).ready(function() {
$('#markdown').markItUp(mySettings);
$('#markdown').markItUp(mySeedSettings);
$('#update').click(function(event) {
event.preventDefault();
@ -116,13 +145,20 @@ $(document).ready(function() {
<input type="hidden" name="documentid" value="<?php echo $document->getId(); ?>" />
<textarea id="markdown" name="data" width="100%" rows="20">
<?php
$luser = $document->getLatestContent()->getUser();
echo htmlspecialchars(file_get_contents($dms->contentDir . $version->getPath()), ENT_SUBSTITUTE);
?>
</textarea>
<?php
echo $this->warningMsg(getMLText('edit_online_warning'));
if($user->getId() == $luser->getId()) {
echo $this->warningMsg(getMLText('edit_online_warning'));
?>
<button id="update" type="submit" class="btn btn-primary"><i class="fa fa-save"></i> <?php printMLText("save"); ?></button>
<?php
} else {
echo $this->errorMsg(getMLText('edit_online_not_allowed'));
}
?>
</form>
<?php
$this->columnEnd();