* only set image size when view a doc.

This commit is contained in:
wangchunsheng
2012-04-30 08:34:28 +00:00
parent b3d76d795c
commit 751f5dc29b
3 changed files with 7 additions and 13 deletions

View File

@@ -369,7 +369,7 @@ class doc extends control
public function view($docID)
{
/* Get doc. */
$doc = $this->doc->getById($docID);
$doc = $this->doc->getById($docID, true);
if(!$doc) die(js::error($this->lang->notFound) . js::locate('back'));
if($doc->project != 0 and !$this->project->checkPriv($this->project->getById($doc->project)))
{

View File

@@ -138,17 +138,18 @@ class docModel extends model
* Get doc info by id.
*
* @param int $docID
* @param bool $setImgSize
* @access public
* @return void
*/
public function getById($docID)
public function getById($docID, $setImgSize = false)
{
$doc = $this->dao->select('*')
->from(TABLE_DOC)
->where('id')->eq((int)$docID)
->fetch();
if(!$doc) return false;
$doc->content = $this->loadModel('file')->setImgSize($doc->content);
if($setImgSize) $doc->content = $this->loadModel('file')->setImgSize($doc->content);
$doc->files = $this->loadModel('file')->getByObject('doc', $docID);
$doc->libName = '';

View File

@@ -11,13 +11,6 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<script language='javascript'>
var type = '<?php echo $doc->type;?>';
$(document).ready(function()
{
setType(type);
});
</script>
<table class='table-1'>
<caption><?php echo $doc->title . $lang->colon . $lang->doc->view;?></caption>
<tr>
@@ -43,11 +36,11 @@ $(document).ready(function()
<th class='rowhead'><?php echo $lang->doc->keywords;?></th>
<td><?php echo $doc->keywords;?></td>
</tr>
<tr id='urlBox' class='hidden'>
<tr id='urlBox' <?php if($doc->type != 'url') echo "class='hidden'";?>>
<th class='rowhead'><?php echo $lang->doc->url;?></th>
<td><?php echo html::a(urldecode($doc->url), '', '_blank');?></td>
</tr>
<tr id='contentBox' class='hidden'>
<tr id='contentBox' <?php if($doc->type != 'text') echo "class='hidden'";?>>
<th class='rowhead'><?php echo $lang->doc->content;?></th>
<td class='content'><?php echo $doc->content;?></td>
</tr>
@@ -55,7 +48,7 @@ $(document).ready(function()
<th class='rowhead'><?php echo $lang->doc->digest;?></th>
<td><?php echo nl2br($doc->digest);?></td>
</tr>
<tr id='fileBox' class='hidden'>
<tr id='fileBox' <?php if($doc->type != 'file') echo "class='hidden'";?>>
<th class='rowhead'><?php echo $lang->files;?></th>
<td><?php echo $this->fetch('file', 'printFiles', array('files' => $doc->files, 'fieldset' => 'false'));?></td>
</tr>