* Finish task #41245.
This commit is contained in:
@@ -1 +1,2 @@
|
||||
ALTER TABLE `zt_testtask` ADD `realFinishedDate` datetime NOT NULL AFTER `end`;
|
||||
ALTER TABLE `zt_doc` ADD `tempContent` longtext NOT NULL AFTER `views`;
|
||||
|
||||
@@ -310,6 +310,7 @@ CREATE TABLE IF NOT EXISTS `zt_doc` (
|
||||
`keywords` varchar(255) NOT NULL,
|
||||
`type` varchar(30) NOT NULL,
|
||||
`views` smallint(5) unsigned NOT NULL,
|
||||
`tempContent` longtext NOT NULL,
|
||||
`collector` text NOT NULL,
|
||||
`addedBy` varchar(30) NOT NULL,
|
||||
`addedDate` datetime NOT NULL,
|
||||
|
||||
@@ -752,6 +752,18 @@ class doc extends control
|
||||
die($select);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax save temporary content of doc.
|
||||
*
|
||||
* @param int $docID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxSaveContent($docID)
|
||||
{
|
||||
$this->doc->saveTempContent($docID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show files.
|
||||
*
|
||||
|
||||
+59
-27
@@ -1,5 +1,15 @@
|
||||
$(function()
|
||||
{
|
||||
if(needUpdateContent)
|
||||
{
|
||||
if(confirm(confirmUpdateContent))
|
||||
{
|
||||
$('#content').html(tempContent);
|
||||
editor = KindEditor.instances[0];
|
||||
editor.html(tempContent);
|
||||
}
|
||||
}
|
||||
|
||||
$('#top-submit').click(function()
|
||||
{
|
||||
$(this).addClass('disabled');
|
||||
@@ -23,42 +33,64 @@ $(function()
|
||||
|
||||
$('#subNavbar li[data-id="doc"]').addClass('active');
|
||||
|
||||
/* Automatically save document contents. */
|
||||
setInterval("saveTempContent()", 60 * 1000);
|
||||
|
||||
$(document).on("mousedown", 'span[data-name="fullscreen"]', function()
|
||||
{
|
||||
if($(this).hasClass('ke-selected'))
|
||||
if(config.onlybody == 'no')
|
||||
{
|
||||
$('#submit').removeClass('fullscreen-save')
|
||||
$('#submit').addClass('btn-wide')
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#submit').addClass('fullscreen-save')
|
||||
$('#submit').removeClass('btn-wide')
|
||||
if($(this).hasClass('ke-selected'))
|
||||
{
|
||||
$('#submit').removeClass('fullscreen-save')
|
||||
$('#submit').addClass('btn-wide')
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#submit').addClass('fullscreen-save')
|
||||
$('#submit').removeClass('btn-wide')
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("mousedown", 'a[title="Fullscreen"],.icon-columns', function()
|
||||
{
|
||||
setTimeout(function()
|
||||
if(config.onlybody == 'no')
|
||||
{
|
||||
if($('a[title="Fullscreen"]').hasClass('active'))
|
||||
setTimeout(function()
|
||||
{
|
||||
$('#submit').addClass('markdown-fullscreen-save')
|
||||
$('#submit').removeClass('btn-wide')
|
||||
$('.fullscreen').css('height', '50px');
|
||||
$('.fullscreen').css('padding-top', '15px');
|
||||
$('.CodeMirror-fullscreen').css('top', '50px');
|
||||
$('.editor-preview-side').css('top', '50px');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#submit').removeClass('markdown-fullscreen-save')
|
||||
$('#submit').addClass('btn-wide')
|
||||
$('.editor-toolbar').css('height', '30px');
|
||||
$('.editor-toolbar').css('padding-top', '1px');
|
||||
$('.CodeMirror').css('top', '0');
|
||||
$('.editor-preview-side').css('top', '30px');
|
||||
}
|
||||
}, 200);
|
||||
if($('a[title="Fullscreen"]').hasClass('active'))
|
||||
{
|
||||
$('#submit').addClass('markdown-fullscreen-save')
|
||||
$('#submit').removeClass('btn-wide')
|
||||
$('.fullscreen').css('height', '50px');
|
||||
$('.fullscreen').css('padding-top', '15px');
|
||||
$('.CodeMirror-fullscreen').css('top', '50px');
|
||||
$('.editor-preview-side').css('top', '50px');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#submit').removeClass('markdown-fullscreen-save')
|
||||
$('#submit').addClass('btn-wide')
|
||||
$('.editor-toolbar').css('height', '30px');
|
||||
$('.editor-toolbar').css('padding-top', '1px');
|
||||
$('.CodeMirror').css('top', '0');
|
||||
$('.editor-preview-side').css('top', '30px');
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
/**
|
||||
* Save temporary doc content.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function saveTempContent()
|
||||
{
|
||||
var content = $('#content').val();
|
||||
var link = createLink('doc', 'ajaxSaveContent', 'docID=' + docID);
|
||||
$.post(link, {content: content});
|
||||
}
|
||||
|
||||
@@ -189,6 +189,7 @@ $lang->doc->noEditedDoc = 'Sie haben kein Dokument bearbeitet.';
|
||||
$lang->doc->noOpenedDoc = 'Sie haben kein Dokument erstellt.';
|
||||
$lang->doc->noCollectedDoc = 'Sie haben kein Dokument gesammelt.';
|
||||
$lang->doc->errorEmptyLib = 'No data in document library.';
|
||||
$lang->doc->confirmUpdateContent = 'You have a document that is not saved from last time. Do you want to continue editing it?';
|
||||
|
||||
$lang->doc->noticeAcl['lib']['product']['default'] = 'Users who can access the selected product can access it.';
|
||||
$lang->doc->noticeAcl['lib']['product']['custom'] = 'Users who can access the selected product or users in the whiltelist can access it.';
|
||||
|
||||
@@ -194,6 +194,7 @@ $lang->doc->noEditedDoc = 'You have not edited any documents.';
|
||||
$lang->doc->noOpenedDoc = 'You have not created any documents.';
|
||||
$lang->doc->noCollectedDoc = 'You have not favorited any documents.';
|
||||
$lang->doc->errorEmptyLib = 'No data in document library.';
|
||||
$lang->doc->confirmUpdateContent = 'You have a document that is not saved from last time. Do you want to continue editing it?';
|
||||
|
||||
$lang->doc->noticeAcl['lib']['product']['default'] = 'Users who can access the selected product can access it.';
|
||||
$lang->doc->noticeAcl['lib']['product']['custom'] = 'Users who can access the selected product or users in the whiltelist can access it.';
|
||||
|
||||
@@ -189,6 +189,7 @@ $lang->doc->noEditedDoc = "Vous n'avez pas mis à jour de documents.";
|
||||
$lang->doc->noOpenedDoc = "Vous n'avez pas ajouté de documents.";
|
||||
$lang->doc->noCollectedDoc = "Vous avez aucun document dans vos favoris.";
|
||||
$lang->doc->errorEmptyLib = 'No data in document library.';
|
||||
$lang->doc->confirmUpdateContent = 'You have a document that is not saved from last time. Do you want to continue editing it?';
|
||||
|
||||
$lang->doc->noticeAcl['lib']['product']['default'] = 'Les utilisateurs qui ont accès au Product peuvent y accéder.';
|
||||
$lang->doc->noticeAcl['lib']['product']['custom'] = 'Les utilisateurs qui ont accès au Product ou les utilisateurs de la Liste Blanche peuvent y accéder.';
|
||||
|
||||
@@ -189,6 +189,7 @@ $lang->doc->noEditedDoc = 'Bạn có not edited any documents.';
|
||||
$lang->doc->noOpenedDoc = 'Bạn chưa tạo any documents.';
|
||||
$lang->doc->noCollectedDoc = 'Bạn có not favorited any documents.';
|
||||
$lang->doc->errorEmptyLib = 'No data in document library.';
|
||||
$lang->doc->confirmUpdateContent = 'You have a document that is not saved from last time. Do you want to continue editing it?';
|
||||
|
||||
$lang->doc->noticeAcl['lib']['product']['default'] = 'Users who can access the selected product có thể truy cập nó.';
|
||||
$lang->doc->noticeAcl['lib']['product']['custom'] = 'Users who can access the selected product or users in the whiltelist có thể truy cập nó.';
|
||||
|
||||
@@ -194,6 +194,7 @@ $lang->doc->noEditedDoc = '您还没有编辑任何文档。';
|
||||
$lang->doc->noOpenedDoc = '您还没有创建任何文档。';
|
||||
$lang->doc->noCollectedDoc = '您还没有收藏任何文档。';
|
||||
$lang->doc->errorEmptyLib = '文档库暂无数据。';
|
||||
$lang->doc->confirmUpdateContent = '检查到您有未保存的文档内容,是否继续编辑?';
|
||||
|
||||
$lang->doc->noticeAcl['lib']['product']['default'] = '有所选产品访问权限的用户可以访问。';
|
||||
$lang->doc->noticeAcl['lib']['product']['custom'] = '有所选产品访问权限或白名单里的用户可以访问。';
|
||||
|
||||
+24
-1
@@ -421,7 +421,7 @@ class docModel extends model
|
||||
$doc->content = isset($docContent->content) ? $docContent->content : '';
|
||||
$doc->contentType = isset($docContent->type) ? $docContent->type : '';
|
||||
|
||||
if($doc->type != 'url' and $doc->contentType != 'markdown') $doc = $this->loadModel('file')->replaceImgURL($doc, 'content');
|
||||
if($doc->type != 'url' and $doc->contentType != 'markdown') $doc = $this->loadModel('file')->replaceImgURL($doc, 'content,tempContent');
|
||||
if($setImgSize) $doc->content = $this->file->setImgSize($doc->content);
|
||||
$doc->files = $docFiles;
|
||||
|
||||
@@ -622,6 +622,7 @@ class docModel extends model
|
||||
}
|
||||
unset($doc->contentType);
|
||||
|
||||
$doc->tempContent = $doc->content;
|
||||
$this->dao->update(TABLE_DOC)->data($doc, 'content')
|
||||
->autoCheck()
|
||||
->batchCheck($requiredFields, 'notempty')
|
||||
@@ -629,11 +630,33 @@ class docModel extends model
|
||||
->exec();
|
||||
if(!dao::isError())
|
||||
{
|
||||
unset($doc->tempContent);
|
||||
$this->file->updateObjectID($this->post->uid, $docID, 'doc');
|
||||
return array('changes' => $changes, 'files' => $files);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save temporary doc content.
|
||||
*
|
||||
* @param int $docID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function saveTempContent($docID)
|
||||
{
|
||||
$data = fixer::input('post')
|
||||
->stripTags($this->config->doc->editor->edit['id'], $this->config->allowedTags)
|
||||
->get();
|
||||
$doc = new stdclass();
|
||||
$doc->tempContent = $data->content;
|
||||
|
||||
$docType = $this->dao->select('type')->from(TABLE_DOCCONTENT)->where('doc')->eq((int)$docID)->orderBy('version_desc')->fetch();
|
||||
if($docType == 'markdown') $doc->tempContent = $this->post->content;
|
||||
|
||||
$this->dao->update(TABLE_DOC)->data($doc)->where('id')->eq($docID)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build search form.
|
||||
*
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php if($doc->contentType == 'html') include '../../common/view/kindeditor.html.php';?>
|
||||
<?php if($doc->contentType == 'markdown') include '../../common/view/markdown.html.php';?>
|
||||
<?php js::set('needUpdateContent', $doc->content != $doc->tempContent);?>
|
||||
<?php js::set('confirmUpdateContent', $lang->doc->confirmUpdateContent);?>
|
||||
<?php js::set('docID', $doc->id);?>
|
||||
<?php js::set('tempContent', $doc->tempContent);?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
|
||||
Reference in New Issue
Block a user