mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Fix #1773 add function to delete temp saved document
This commit is contained in:
parent
1a23fc3a71
commit
53a7e4d90f
3 changed files with 60 additions and 2 deletions
|
|
@ -20,6 +20,7 @@
|
|||
<action name="procDocumentTempSave" type="controller" permission="member" />
|
||||
<action name="procDocumentDeclare" type="controller" permission="member" />
|
||||
<action name="procDocumentDeclareCancel" type="controller" permission="member" />
|
||||
<action name="procDocumentDeleteTempSaved" type="controller" permission="member" />
|
||||
<action name="procDocumentGetList" type="controller" permission="manager" check_type="document" check_var="document_srls" />
|
||||
<action name="procDocumentAddCart" type="controller" permission="manager" check_type="document" check_var="srls" />
|
||||
<action name="procDocumentManageCheckedDocument" type="controller" permission="manager" check_type="document" check_var="cart" />
|
||||
|
|
|
|||
|
|
@ -343,6 +343,34 @@ class documentController extends document
|
|||
return $this->declaredDocumentCancel($document_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete temporarily saved document
|
||||
*/
|
||||
public function procDocumentDeleteTempSaved()
|
||||
{
|
||||
$document_srl = Context::get('document_srl');
|
||||
if ($document_srl <= 0)
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
$oDocument = DocumentModel::getDocument($document_srl);
|
||||
if (!$oDocument || !$oDocument->isExists())
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||
}
|
||||
if ($oDocument->get('member_srl') !== $this->user->member_srl || $oDocument->getStatus() !== 'TEMP' || !$oDocument->isGranted())
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||
}
|
||||
|
||||
$output = $this->deleteDocument($document_srl);
|
||||
if ($output instanceof BaseObject && !$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete alias when module deleted
|
||||
* @param int $module_srl
|
||||
|
|
|
|||
|
|
@ -11,16 +11,19 @@
|
|||
<th class="title">{$lang->date}</th>
|
||||
<th class="title">{$lang->title}</th>
|
||||
<th class="title">{$lang->cmd_select}</th>
|
||||
<th class="title">{$lang->cmd_delete}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!--@foreach($document_list as $no => $val)-->
|
||||
<tr>
|
||||
<td>{$val->getRegdate("Y-m-d H:i:s")}</td>
|
||||
<td > <a href="#" onclick="jQuery('#saved_document_{$val->document_srl}').toggle(); setFixedPopupSize(); return false;">{$val->getTitle()}</a>
|
||||
<td>
|
||||
<a href="#" class="toggle_content">{$val->getTitle()}</a>
|
||||
<div id="saved_document_{$val->document_srl}" class="saved_content" style="display:none;">{$val->getContent(false)}</div>
|
||||
</td>
|
||||
<td><a href="#" onclick="doDocumentSelect('{$val->document_srl}', '{$val->getDocumentType()}'); return false;" class="buttonSet buttonActive"><span>{$lang->cmd_select}</span></a></td>
|
||||
<td><a href="#" class="btn btn_select_temp_saved" data-document-srl="{$val->document_srl}" data-document-type="{$val->getDocumentType()}">{$lang->cmd_select}</a></td>
|
||||
<td><a href="#" class="btn btn_delete_temp_saved" data-document-srl="{$val->document_srl}">{$lang->cmd_delete}</a></td>
|
||||
</tr>
|
||||
<!--@end-->
|
||||
</tbody>
|
||||
|
|
@ -38,3 +41,29 @@
|
|||
<a href="{getUrl('page',$page_navigation->last_page,'module_srl','')}" class="direction">{$lang->last_page} ›</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('.toggle_content').on('click', function(event) {
|
||||
event.preventDefault();
|
||||
$(this).next('.saved_content').toggle();
|
||||
setFixedPopupSize();
|
||||
});
|
||||
$('.btn_select_temp_saved').on('click', function(event) {
|
||||
event.preventDefault();
|
||||
var document_srl = $(this).data('documentSrl');
|
||||
var document_type = $(this).data('documentType');
|
||||
doDocumentSelect(document_srl, document_type);
|
||||
});
|
||||
$('.btn_delete_temp_saved').on('click', function(event) {
|
||||
event.preventDefault();
|
||||
var document_srl = $(this).data('documentSrl');
|
||||
var msg = '{$lang->confirm_delete|escapejs}';
|
||||
if (confirm(msg)) {
|
||||
exec_json('document.procDocumentDeleteTempSaved', { document_srl: document_srl }, function(data) {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue