Provide a correction by selection the update logs.

This commit is contained in:
BJRambo 2016-03-10 18:02:52 +09:00
parent 76adbde9ce
commit effee305a6
8 changed files with 76 additions and 2 deletions

View file

@ -211,6 +211,58 @@ class boardController extends board
$this->setMessage($msg_code);
}
function procBoardUpdateDocument()
{
$update_id = Context::get('update_id');
$logged_info = Context::get('logged_info');
if(!$update_id)
{
return new Object(-1, 'msg_no_update_id');
}
$oDocumentModel = getModel('document');
$oDocumentController = getController('document');
$update_log = $oDocumentModel->getUpdateLog($update_id);
$isadminDocument = false;
if($logged_info->is_admin != 'Y')
{
$update_log_list = $oDocumentModel->getDocumentUpdateLog($update_log->document_srl);
foreach($update_log_list->data as $val)
{
$oMemberModel = getModel('member');
$member_info = $oMemberModel->getMemberInfoByMemberSrl($val->update_member_srl);
debugPrint($val);
if($member_info->is_admin === 'Y')
{
$isadminDocument = true;
break;
}
}
if($isadminDocument === true)
{
return new Object(-1, 'msg_admin_update_log');
}
}
if(!$update_log)
{
return new Object(-1, 'msg_no_update_log');
}
$oDocument = $oDocumentModel->getDocument($update_log->document_srl);
$obj = new stdClass();
$obj->title = $update_log->title;
$obj->document_srl = $update_log->document_srl;
$obj->title_bold = $update_log->title_bold;
$obj->title_color = $update_log->title_color;
$obj->content = $update_log->content;
$output = $oDocumentController->updateDocument($oDocument, $obj);
$this->setRedirectUrl(getNotEncodedUrl('', 'mid', Context::get('mid'),'act', '', 'document_srl', $update_log->document_srl));
$this->add('mid', Context::get('mid'));
$this->add('document_srl', $update_log->document_srl);
}
/**
* @brief delete the document
**/

View file

@ -1174,6 +1174,8 @@ class boardView extends board
$update_log = $oDocumentModel->getUpdateLog($update_id);
$extra_vars = unserialize($update_log->extra_vars);
Context::addJsFilter($this->module_path.'tpl/filter', 'update.xml');
Context::set('extra_vars', $extra_vars);
Context::set('update_log', $update_log);

View file

@ -80,6 +80,7 @@
<action name="dispBoardUpdateLogView" type="view" />
<action name="procBoardInsertDocument" type="controller" ruleset="insertDocument" standalone="false" />
<action name="procBoardUpdateDocument" type="controller" />
<action name="procBoardDeleteDocument" type="controller" standalone="false" />
<action name="procBoardVoteDocument" type="controller" standalone="false" />
<action name="procBoardInsertComment" type="controller" standalone="false" />

View file

@ -60,3 +60,7 @@ $lang->msg_dont_have_update_log = '업데이트 로그가 기록되어 있지
$lang->original_letter = '원본글';
$lang->msg_warning_update_log = '<span class="x_label x_label-important">주의!</span> 사용시 디비가 많이 늘어날 수 있습니다.';
$lang->reason_update = '수정한 이유';
$lang->msg_no_update_id = '업데이트 고유 번호는 필수입니다.';
$lang->msg_no_update_log = '업데이트 로그가 존재하지 않습니다.';
$lang->cmd_modify_by_update_log = '이 로그로 게시물을 수정하기';
$lang->msg_admin_update_log = '관리자가 수정한 적이 있는 게시물입니다. 관리자에게 문의하세요.';

View file

@ -15,10 +15,10 @@
<a href="{getUrl('', 'mid', $mid, 'act', 'dispBoardUpdateLogView', 'update_id', $val->update_id)}">{$val->title}</a>
</td>
<td class="author">
{$val->update_nick_name}
{$val->nick_name}
</td>
<td class="author">
{$val->nick_name}
{$val->update_nick_name}
</td>
<td class="time">
{zdate($val->regdate, 'Y.m.d H:i:s')}

View file

@ -26,4 +26,11 @@
</p>
<!-- /READ BODY -->
</div>
<form action="./" method="post" onsubmit="return procFilter(this, window.update)" >
<input type="hidden" name="module" value="board" />
<input type="hidden" name="act" value="procBoardUpdateDocument" />
<input type="hidden" name="update_id" value="{$update_log->update_id}" />
<button type="submit">{$lang->cmd_modify_by_update_log}</button>
</form>
</div>

View file

@ -0,0 +1,7 @@
<filter name="update" module="board" act="procBoardUpdateDocument">
<form>
<node target="nick_name" required="true" maxlength="20"/>
<node target="title" required="true" minlength="1" maxlength="250" />
<node target="content" required="true" />
</form>
</filter>

View file

@ -9,6 +9,7 @@
<column name="title" />
<column name="module_srl" />
<column name="update_id" />
<column name="update_member_srl" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />