ticket:456 Vote/Blame 구분

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4140 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
haneul 2008-04-23 15:34:26 +00:00
parent 8574cd797f
commit 0958542826
7 changed files with 50 additions and 4 deletions

View file

@ -31,6 +31,7 @@
$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
$oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
$oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
$oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count"));
// 2007. 10. 17 모듈이 삭제될때 등록된 글도 모두 삭제하는 트리거 추가
$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
@ -93,6 +94,10 @@
**/
if(!$oDB->isColumnExists("documents","extra_vars")) return true;
// 2008. 04. 23 blamed count 컬럼 추가
if(!$oDB->isColumnExists("documents", "blamed_count")) return true;
if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true;
if(!$oDB->isColumnExists("document_voted_log", "point")) return true;
return false;
}
@ -177,6 +182,21 @@
**/
if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
// 2008. 04. 23 blamed count 컬럼 추가
if(!$oDB->isColumnExists("documents", "blamed_count"))
{
$oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true);
$oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count'));
}
if(!$oDB->isIndexExists("documents","idx_module_blamed_count"))
{
$oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count'));
}
if(!$oDB->isColumnExists("document_voted_log", "point"))
$oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true);
return new Object(0,'success_updated');
}

View file

@ -402,17 +402,29 @@
}
// 추천수 업데이트
$args->voted_count = $oDocument->get('voted_count') + $point;
$output = executeQuery('document.updateVotedCount', $args);
if($point < 0)
{
$args->blamed_count = $oDocument->get('blamed_count') + $point;
$output = executeQuery('document.updateBlamedCount', $args);
}
else
{
$args->voted_count = $oDocument->get('voted_count') + $point;
$output = executeQuery('document.updateVotedCount', $args);
}
// 로그 남기기
$args->point = $point;
$output = executeQuery('document.insertDocumentVotedLog', $args);
// 세션 정보에 남김
$_SESSION['voted_document'][$document_srl] = true;
// 결과 리턴
return new Object(0, 'success_voted');
if($point > 0)
return new Object(0, 'success_voted');
else
return new Object(0, 'success_blamed');
}
/**

View file

@ -7,5 +7,6 @@
<column name="member_srl" var="member_srl" filter="number" default="0" />
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
<column name="regdate" var="regdate" default="curdate()" />
<column name="point" var="point" filter="number" default="0"/>
</columns>
</query>

View file

@ -0,0 +1,11 @@
<query id="updateBlamedCount" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="blamed_count" var="blamed_count" notnull="notnull" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -3,4 +3,5 @@
<column name="member_srl" type="number" size="11" notnull="notnull" index="idx_member_srl" />
<column name="ipaddress" type="varchar" size="128" notnull="notnull" index="idx_ipaddress"/>
<column name="regdate" type="date" index="idx_regdate" />
<column name="point" type="number" size="11" notnull="notnull" />
</table>

View file

@ -10,6 +10,7 @@
<column name="content" type="bigtext" notnull="notnull" />
<column name="readed_count" type="number" size="11" default="0" notnull="notnull" index="idx_readed_count" />
<column name="voted_count" type="number" size="11" default="0" notnull="notnull" index="idx_voted_count" />
<column name="blamed_count" type="number" size="11" default="0" notnull="notnull" index="idx_blamed_count" />
<column name="comment_count" type="number" size="11" default="0" notnull="notnull" index="idx_comment_count" />
<column name="trackback_count" type="number" size="11" default="0" notnull="notnull" index="idx_trackback_count" />
<column name="uploaded_count" type="number" size="11" default="0" notnull="notnull" index="idx_uploaded_count" />

View file

@ -58,7 +58,7 @@
<td class="left"><!--@if($oDocument->get('module_srl')!=$oDocument->get('member_srl'))--><a href="{getUrl('','mid',$module_list[$oDocument->get('module_srl')]->mid)}" class="blue" onclick="window.open(this.href);return false">{htmlspecialchars($module_list[$oDocument->get('module_srl')]->browser_title)}</a><!--@else-->-<!--@end--></td>
<td class="left"><div class="member_{$oDocument->get('member_srl')}">{$oDocument->getNickName()}</div></td>
<td class="tahoma">{$oDocument->get('readed_count')}</td>
<td class="tahoma">{$oDocument->get('voted_count')}</td>
<td class="tahoma">{$oDocument->get('voted_count')} / {$oDocument->get('blamed_count')}</td>
<td class="tahoma">{$oDocument->getRegdate("Y-m-d")} {$oDocument->getRegdate("H:i:s")}</td>
</tr>
<tr>