merge from 1.5.2

git-svn-id: http://xe-core.googlecode.com/svn/trunk@10446 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
devjin 2012-03-20 08:03:02 +00:00
parent 6c23751ef8
commit c727926d9e
382 changed files with 6855 additions and 3603 deletions

View file

@ -14,6 +14,7 @@
var $columnList = array();
var $allowscriptaccessList = array();
var $allowscriptaccessKey = 0;
var $uploadedFiles = array();
function documentItem($document_srl = 0, $load_extra_vars = true, $columnList = array()) {
$this->document_srl = $document_srl;
@ -338,13 +339,18 @@
}
// If additional content information is set
if($add_content_info) {
$memberSrl = $this->get('member_srl');
if($memberSrl < 0)
{
$memberSrl = 0;
}
$content = sprintf(
'<!--BeforeDocument(%d,%d)--><div class="document_%d_%d xe_content">%s</div><!--AfterDocument(%d,%d)-->',
$this->document_srl, $this->get('member_srl'),
$this->document_srl, $this->get('member_srl'),
$this->document_srl, $memberSrl,
$this->document_srl, $memberSrl,
$content,
$this->document_srl, $this->get('member_srl'),
$this->document_srl, $this->get('member_srl')
$this->document_srl, $memberSrl,
$this->document_srl, $memberSrl
);
// Add xe_content class although accessing content is not required
} else {
@ -474,7 +480,7 @@
function getExtraValueHTML($idx) {
$extra_vars = $this->getExtraVars();
if(array_key_exists($idx,$extra_vars)){
if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)){
return $extra_vars[$idx]->getValueHTML();
}else{
return '';
@ -518,7 +524,14 @@
if(!$this->getCommentCount()) return;
if(!$this->isGranted() && $this->isSecret()) return;
// cpage is a number of comment pages
$cpage = Context::get('cpage');
$cpageStr = sprintf('%d_cpage', $this->document_srl);
$cpage = Context::get($cpageStr);
if(!$cpage)
{
$cpage = Context::get('cpage');
}
// Get a list of comments
$oCommentModel = &getModel('comment');
$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
@ -526,6 +539,7 @@
// Create commentItem object from a comment list
// If admin priviledge is granted on parent posts, you can read its child posts.
$accessible = array();
$comment_list = array();
foreach($output->data as $key => $val) {
$oCommentItem = new commentItem();
$oCommentItem->setAttribute($val);
@ -538,6 +552,7 @@
$comment_list[$val->comment_srl] = $oCommentItem;
}
// Variable setting to be displayed on the skin
Context::set($cpageStr, $output->page_navigation->cur_page);
Context::set('cpage', $output->page_navigation->cur_page);
if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
@ -725,16 +740,21 @@
return $this->get('uploaded_count')? true : false;
}
function getUploadedFiles() {
if(!$this->document_srl) return;
function getUploadedFiles($sortIndex = 'file_srl')
{
if(!$this->document_srl) return;
if($this->isSecret() && !$this->isGranted()) return;
if(!$this->get('uploaded_count')) return;
if($this->isSecret() && !$this->isGranted()) return;
if(!$this->get('uploaded_count')) return;
$oFileModel = &getModel('file');
$file_list = $oFileModel->getFiles($this->document_srl, $is_admin);
return $file_list;
}
if(!$this->uploadedFiles[$sortIndex])
{
$oFileModel = &getModel('file');
$this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex);
}
return $this->uploadedFiles[$sortIndex];
}
/**
* @brief Return Editor html
@ -831,5 +851,23 @@
}
return false;
}
function getTranslationLangCodes()
{
$obj->document_srl = $this->document_srl;
// -2 is an index for content. We are interested if content has other translations.
$obj->var_idx = -2;
$output = executeQueryArray('document.getDocumentTranslationLangCodes', $obj);
if (!$output->data)
{
$output->data = array();
}
// add original page's lang code as well
$origLangCode->lang_code = $this->getLangCode();
$output->data[] = $origLangCode;
return $output->data;
}
}
?>