* Task#40529,#40530.
This commit is contained in:
+108
-1
@@ -744,6 +744,112 @@ class doc extends control
|
||||
die($select);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show files.
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $objectID
|
||||
* @param string $viewType
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function showFiles($type, $objectID, $viewType = '', $orderBy = 't1.id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
$uri = $this->app->getURI(true);
|
||||
$this->app->session->set('taskList', $uri);
|
||||
$this->app->session->set('storyList', $uri);
|
||||
$this->app->session->set('docList', $uri);
|
||||
|
||||
if(empty($viewType)) $viewType = !empty($_COOKIE['docFilesViewType']) ? $this->cookie->docFilesViewType : 'card';
|
||||
setcookie('docFilesViewType', $viewType, $this->config->cookieLife, $this->config->webRoot, '', false, true);
|
||||
|
||||
$objects = $this->doc->getOrderedObjects($type);
|
||||
if($type == 'product')
|
||||
{
|
||||
$objectID = $this->product->saveState($objectID, $objects);
|
||||
$table = TABLE_PRODUCT;
|
||||
|
||||
$libs = $this->doc->getLibsByObject('product', $objectID);
|
||||
|
||||
$this->lang->modulePageNav = $this->doc->select($type, $objects, $objectID, $libs);
|
||||
|
||||
$this->app->rawMethod = 'product';
|
||||
}
|
||||
else if($type == 'project')
|
||||
{
|
||||
$objectID = $this->project->saveState($objectID, $objects);
|
||||
$table = TABLE_PROJECT;
|
||||
|
||||
$libs = $this->doc->getLibsByObject('project', $objectID);
|
||||
|
||||
$this->lang->modulePageNav = $this->doc->select($type, $objects, $objectID, $libs);
|
||||
|
||||
$this->app->rawMethod = 'project';
|
||||
}
|
||||
else if($type == 'execution')
|
||||
{
|
||||
$objectID = $this->execution->saveState($objectID, $objects);
|
||||
$table = TABLE_EXECUTION;
|
||||
$libs = $this->doc->getLibsByObject('execution', $objectID);
|
||||
|
||||
$this->lang->modulePageNav = $this->doc->select($type, $objects, $objectID, $libs);
|
||||
|
||||
$this->app->rawMethod = 'execution';
|
||||
}
|
||||
|
||||
$openApp = strpos('doc,product,project,execution', $this->app->openApp) !== false ? $this->app->openApp : 'doc';
|
||||
if($openApp != 'doc') $this->loadModel($openApp)->setMenu($objectID);
|
||||
|
||||
$table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT;
|
||||
$object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch();
|
||||
|
||||
$this->lang->TRActions = $this->doc->buildCollectButton4Doc();
|
||||
$this->lang->TRActions .= $this->doc->buildBrowseSwitch($type, $objectID, $viewType);
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$files = $this->doc->getLibFiles($type, $objectID, $orderBy, $pager);
|
||||
|
||||
$this->view->title = $object->name;
|
||||
$this->view->position[] = $object->name;
|
||||
|
||||
$this->view->type = $type;
|
||||
$this->view->object = $object;
|
||||
$this->view->files = $files;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->pager = $pager;
|
||||
$this->view->viewType = $viewType;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->canBeChanged = common::canModify($type, $object); // Determines whether an object is editable.
|
||||
$this->view->summary = $this->doc->summary($files);
|
||||
$this->view->sourcePairs = $this->doc->getFileSourcePairs($files);
|
||||
$this->view->fileIcon = $this->doc->getFileIcon($files);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch download.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchDownload()
|
||||
{
|
||||
$this->loadModel('file');
|
||||
$fileIDList = $this->post->fileIDList;
|
||||
foreach($fileIDList as $fileID)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all libs by type.
|
||||
*
|
||||
@@ -1050,7 +1156,8 @@ class doc extends control
|
||||
$openApp = strpos('doc,product,project,execution', $this->app->openApp) !== false ? $this->app->openApp : 'doc';
|
||||
if($openApp != 'doc') $this->loadModel($openApp)->setMenu($objectID);
|
||||
|
||||
$this->lang->TRActions = common::hasPriv('doc', 'create') ? $this->doc->buildCreateButton4Doc($type, $objectID, $libID) : '';
|
||||
$this->lang->TRActions = $this->doc->buildCollectButton4Doc();
|
||||
$this->lang->TRActions .= common::hasPriv('doc', 'create') ? $this->doc->buildCreateButton4Doc($type, $objectID, $libID) : '';
|
||||
|
||||
$moduleTree = $type == 'book' ? $this->doc->getBookStructure($libID) : $this->doc->getTreeMenu($type, $objectID, $libID);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
/* 字段列表。*/
|
||||
$lang->doc->common = '文档';
|
||||
$lang->doc->id = '文档编号';
|
||||
$lang->doc->id = '编号';
|
||||
$lang->doc->product = '所属' . $lang->productCommon;
|
||||
$lang->doc->project = '所属项目';
|
||||
$lang->doc->execution = '所属' . $lang->executionCommon;
|
||||
@@ -36,10 +36,11 @@ $lang->doc->fileObject = '所属对象';
|
||||
$lang->doc->whiteList = '白名单';
|
||||
$lang->doc->contentType = '文档格式';
|
||||
$lang->doc->separator = "<i class='icon-angle-right'></i>";
|
||||
$lang->doc->fileTitle = '附件名';
|
||||
$lang->doc->fileTitle = '附件名称';
|
||||
$lang->doc->filePath = '地址';
|
||||
$lang->doc->extension = '类型';
|
||||
$lang->doc->size = '附件大小';
|
||||
$lang->doc->source = '来源';
|
||||
$lang->doc->download = '下载';
|
||||
$lang->doc->acl = '权限';
|
||||
$lang->doc->fileName = '附件';
|
||||
@@ -217,6 +218,10 @@ $lang->doc->noticeAcl['doc']['private'] = '只有创建者自己可以访问。'
|
||||
$lang->doc->placeholder = new stdclass();
|
||||
$lang->doc->placeholder->url = '相应的链接地址';
|
||||
|
||||
$lang->doc->summary = "本页共 <strong>%s</strong> 个附件,共计 <strong>%s</strong>,其中<strong>%s</strong>。";
|
||||
$lang->doc->ge = '个';
|
||||
$lang->doc->point = '、';
|
||||
|
||||
$lang->doclib = new stdclass();
|
||||
$lang->doclib->name = '文档库名称';
|
||||
$lang->doclib->control = '访问控制';
|
||||
|
||||
+134
-3
@@ -1392,6 +1392,65 @@ class docModel extends model
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file source pairs.
|
||||
*
|
||||
* @param array $files
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getFileSourcePairs($files)
|
||||
{
|
||||
$sourceList = array();
|
||||
$sourcePairs = array();
|
||||
|
||||
foreach($files as $file)
|
||||
{
|
||||
if(!isset($sourceList[$file->objectType])) $sourceList[$file->objectType] = array();
|
||||
$sourceList[$file->objectType][$file->objectID] = $file->objectID;
|
||||
}
|
||||
|
||||
foreach($sourceList as $type => $idList)
|
||||
{
|
||||
$table = $this->config->objectTables[$type];
|
||||
$title = $type == 'task' ? 'name' : 'title';
|
||||
$name = $this->dao->select('id,' . $title)->from($table)->where('id')->in($idList)->fetchPairs('id');
|
||||
$sourcePairs[$type] = $name;
|
||||
}
|
||||
|
||||
return $sourcePairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file icon.
|
||||
*
|
||||
* @param array $files
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getFileIcon($files)
|
||||
{
|
||||
foreach($files as $file)
|
||||
{
|
||||
if(in_array($file->extension, $this->config->file->imageExtensions)) continue;
|
||||
|
||||
$iconClass = 'icon-file';
|
||||
if(strpos('zip,tar,gz,bz2,rar', $file->extension) !== false) $iconClass = 'icon-file-archive';
|
||||
else if(strpos('csv,xls,xlsx', $file->extension) !== false) $iconClass = 'icon-file-excel';
|
||||
else if(strpos('doc,docx', $file->extension) !== false) $iconClass = 'icon-file-word';
|
||||
else if(strpos('ppt,pptx', $file->extension) !== false) $iconClass = 'icon-file-powerpoint';
|
||||
else if(strpos('pdf', $file->extension) !== false) $iconClass = 'icon-file-pdf';
|
||||
else if(strpos('mp3,ogg,wav', $file->extension) !== false) $iconClass = 'icon-file-audio';
|
||||
else if(strpos('avi,mp4,mov', $file->extension) !== false) $iconClass = 'icon-file-video';
|
||||
else if(strpos('txt,md', $file->extension) !== false) $iconClass = 'icon-file-text';
|
||||
else if(strpos('html,htm', $file->extension) !== false) $iconClass = 'icon-globe';
|
||||
|
||||
$fileIcon[$file->id] = "<i class='file-icon icon $iconClass'></i>";
|
||||
}
|
||||
|
||||
return $fileIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get doc tree.
|
||||
*
|
||||
@@ -1774,6 +1833,25 @@ class docModel extends model
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build browse switch button.
|
||||
*
|
||||
* @param int $type
|
||||
* @param int $objectID
|
||||
* @param int $viewType
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function buildBrowseSwitch($type, $objectID, $viewType)
|
||||
{
|
||||
$html = "<div class='btn-group'>";
|
||||
$html .= html::a(inlink('showFiles', "type=$type&objectID=$objectID&viewType=card"), "<i class='icon icon-cards-view'></i>", '', "title={$this->lang->doc->browseTypeList['grid']} class='btn btn-icon" . ($viewType != 'list' ? ' text-primary' : '') . "'");
|
||||
$html .= html::a(inlink('showFiles', "type=$type&objectID=$objectID&viewType=list"), "<i class='icon icon-bars'></i>" , '', "title={$this->lang->doc->browseTypeList['list']} class='btn btn-icon" . ($viewType == 'list' ? ' text-primary' : '') . "'");
|
||||
$html .= "</div>";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set past menu.
|
||||
*
|
||||
@@ -1928,7 +2006,7 @@ class docModel extends model
|
||||
$class = ($type == 'project' and $this->app->openApp == 'doc') ? 'col-left' : '';
|
||||
|
||||
$currentMethod = $this->app->getMethodName();
|
||||
$methodName = $currentMethod == 'tablecontents' ? 'tablecontents' : 'objectLibs';
|
||||
$methodName = in_array($currentMethod, array('tablecontents', 'showfiles')) ? 'tablecontents' : 'objectLibs';
|
||||
|
||||
if($this->app->openApp == 'doc' and $type != 'custom' and $type != 'book')
|
||||
{
|
||||
@@ -1965,7 +2043,8 @@ class docModel extends model
|
||||
|
||||
if(!empty($libs))
|
||||
{
|
||||
$output .= "<div class='btn-group angle-btn'><div class='btn-group'><button id='currentBranch' data-toggle='dropdown' type='button' class='btn btn-limit'>{$libs[$libID]->name} <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList'>";
|
||||
$libName = empty($libID) ? $this->lang->doclib->files : $libs[$libID]->name;
|
||||
$output .= "<div class='btn-group angle-btn'><div class='btn-group'><button id='currentBranch' data-toggle='dropdown' type='button' class='btn btn-limit'>{$libName} <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList'>";
|
||||
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
|
||||
$output .= "<div class='table-col'><div class='list-group'>";
|
||||
foreach($libs as $key => $lib)
|
||||
@@ -1973,7 +2052,11 @@ class docModel extends model
|
||||
$selected = $key == $libID ? 'selected' : '';
|
||||
$output .= html::a(inlink($methodName, "type=$type&objectID=$objectID&libID=$key"), $lib->name, '', "class='$selected' data-app='{$this->app->openApp}'");
|
||||
}
|
||||
if($type != 'custom') $output .= html::a(inlink('showFiles', "type=$type&objectID=$objectID"), $this->lang->doclib->files, '', "data-app='{$this->app->openApp}'");
|
||||
if($type != 'custom')
|
||||
{
|
||||
$selected = empty($libID) ? 'selected' : '';
|
||||
$output .= html::a(inlink('showFiles', "type=$type&objectID=$objectID"), $this->lang->doclib->files, '', "class='$selected' data-app='{$this->app->openApp}'");
|
||||
}
|
||||
$output .= "</div></div></div></div></div>";
|
||||
}
|
||||
|
||||
@@ -2097,4 +2180,52 @@ class docModel extends model
|
||||
if(!isset($treeMenu[$module->parent])) $treeMenu[$module->parent] = '';
|
||||
$treeMenu[$module->parent] .= '<li' . ($treeMenu[$module->id] ? ' class="closed catalog"' : ' class="catalog"') . '>' . $li . '</li>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary.
|
||||
*
|
||||
* @param arary $files
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function summary($files)
|
||||
{
|
||||
$filesCount = 0;
|
||||
$sizeCount = 0;
|
||||
$extensionCount = array();
|
||||
$extensionSummary = '';
|
||||
|
||||
foreach($files as $file)
|
||||
{
|
||||
if(!isset($extensionCount[$file->extension])) $extensionCount[$file->extension] = 0;
|
||||
|
||||
$filesCount++;
|
||||
|
||||
$sizeCount += $file->size;
|
||||
|
||||
$extensionCount[$file->extension]++;
|
||||
}
|
||||
|
||||
/* Unit conversion. */
|
||||
$i = 0;
|
||||
while($sizeCount > 1024)
|
||||
{
|
||||
$sizeCount = $sizeCount / 1024;
|
||||
$i++;
|
||||
}
|
||||
$unitList = array('B', 'K', 'M', 'G');
|
||||
$sizeCount = round($sizeCount, 1) . $unitList[$i];
|
||||
|
||||
/* Summary of each type. */
|
||||
$extensionNum = count($extensionCount);
|
||||
foreach($extensionCount as $extension => $count)
|
||||
{
|
||||
$extensionSummary .= $extension . ' ' . $count . $this->lang->doc->ge;
|
||||
|
||||
$extensionNum--;
|
||||
if(!empty($extensionNum)) $extensionSummary .= $this->lang->doc->point;
|
||||
}
|
||||
|
||||
return sprintf($this->lang->doc->summary, $filesCount, $sizeCount, $extensionSummary);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/**
|
||||
* The showFiles view file of doc module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Yidong Wang <yidong@cnezsoft.com>
|
||||
* @package doc
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div class="main-row fade" id="mainRow">
|
||||
<div class="main-col" data-min-width="400">
|
||||
<div class="panel block-files block-sm no-margin">
|
||||
<?php if($viewType == 'list'):?>
|
||||
<form class='main-table' id='fileForm' method='post' action='<?php echo inLink('batchDownload');?>' data-ride='table'>
|
||||
<table class="table has-sort-head">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php $this->app->rawMethod = 'showfiles';?>
|
||||
<?php $vars = "type=$type&objectID=$objectID&viewType=$viewType&orderBy=%s&recTotal=$pager->recTotal&recPerPage=$pager->recPerPage&pageID=$pager->pageID";?>
|
||||
<th class="c-id">
|
||||
<div class="checkbox-primary check-all" title="<?php echo $lang->selectAll?>">
|
||||
<label></label>
|
||||
</div>
|
||||
<?php common::printOrderLink('id', $orderBy, $vars, $lang->doc->id);?>
|
||||
</th>
|
||||
<th class="c-name"><?php common::printOrderLink('title', $orderBy, $vars, $lang->doc->fileTitle);?></th>
|
||||
<th class="w-300px"><?php common::printOrderLink('objectID', $orderBy, $vars, $lang->doc->source);?></th>
|
||||
<th class="w-100px"><?php common::printOrderLink('extension', $orderBy, $vars, $lang->doc->extension);?></th>
|
||||
<th class="w-100px"><?php common::printOrderLink('size', $orderBy, $vars, $lang->doc->size);?></th>
|
||||
<th class="w-100px"><?php common::printOrderLink('addedBy', $orderBy, $vars, $lang->doc->addedBy);?></th>
|
||||
<th class="w-160px"><?php common::printOrderLink('addedDate', $orderBy, $vars, $lang->doc->addedDate);?></th>
|
||||
<th class="c-actions-1"><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($files as $file):?>
|
||||
<?php if(empty($file->pathname)) continue;?>
|
||||
<tr>
|
||||
<td class="c-id">
|
||||
<div class="checkbox-primary">
|
||||
<input type='checkbox' name='fileIDList[<?php echo $file->id;?>]' value='<?php echo $file->id;?>' autocomplete='off' />
|
||||
<label></label>
|
||||
</div>
|
||||
<?php echo sprintf('%03d', $file->id);?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if(in_array($file->extension, $config->file->imageExtensions))
|
||||
{
|
||||
echo "<div style='display: inline-block'><img width='19' height='19' src='$file->webPath'/></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $fileIcon[$file->id];
|
||||
}
|
||||
?>
|
||||
<?php echo str_replace('.' . $file->extension, '', $file->title);?>
|
||||
</td>
|
||||
<td class="c-url"><?php echo $lang->{$file->objectType}->common . ' : ';?><a href='<?php echo $this->createLink($file->objectType, 'view', "objectID=$file->objectID");?>'><?php echo $sourcePairs[$file->objectType][$file->objectID];?></a></td>
|
||||
<td><?php echo $file->extension;?></td>
|
||||
<td><?php echo number_format($file->size / 1024 , 1) . 'K';?></td>
|
||||
<td><?php echo isset($file->addedBy) ? zget($users, $file->addedBy) : '';?></td>
|
||||
<td><?php echo isset($file->addedDate) ? substr($file->addedDate, 0, 10) : '';?></td>
|
||||
<td class="c-actions"><?php common::printLink('file', 'download', "fileID=$file->id", '<i class="icon-import"></i>', "data-toggle='modal'", "class='btn' title={$lang->doc->download}", true, false, $file);?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class='table-footer'>
|
||||
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
|
||||
<div class="table-actions btn-toolbar"><?php echo html::submitButton($lang->doc->download, '', 'btn');?></div>
|
||||
<div class="table-statistic"><?php echo $summary;?></div>
|
||||
<?php $pager->show('right', 'pagerjs');?>
|
||||
</div>
|
||||
</form>
|
||||
<?php else:?>
|
||||
<div class="panel-body">
|
||||
<div class="row row-grid files-grid" data-size="300">
|
||||
<?php foreach($files as $file):?>
|
||||
<?php if(empty($file->pathname)) continue;?>
|
||||
<div class='col'>
|
||||
<div class='lib-file'>
|
||||
<?php
|
||||
$imageWidth = 0;
|
||||
if(stripos('jpg|jpeg|gif|png|bmp', $file->extension) !== false and file_exists($file->realPath))
|
||||
{
|
||||
$imageSize = getimagesize($file->realPath);
|
||||
$imageWidth = $imageSize ? $imageSize[0] : 0;
|
||||
}
|
||||
|
||||
$sessionString = $config->requestType == 'PATH_INFO' ? '?' : '&';
|
||||
$sessionString .= session_name() . '=' . session_id();
|
||||
$fileID = $file->id;
|
||||
$url = helper::createLink('file', 'download', 'fileID=' . $fileID) . $sessionString ;
|
||||
?>
|
||||
<div class='file'>
|
||||
<a href='<?php echo $url;?>' title='<?php echo $file->title;?>' target='_blank' onclick="return downloadFile(<?php echo $file->id?>, '<?php echo $file->extension?>', <?php echo $imageWidth?>)">
|
||||
<?php
|
||||
$downloadLink = $this->createLink('file', 'download', "fileID=$file->id&mouse=left");
|
||||
if(in_array($file->extension, $config->file->imageExtensions))
|
||||
{
|
||||
echo "<div class='img-holder' style='background-image: url($file->webPath)'><img src='$file->webPath'/></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $fileIcon[$file->id];
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
<div class='file-name'><?php echo $file->title;?></a></div>
|
||||
<div class='file-name text-muted'><?php echo $lang->{$file->objectType}->common . ' : ';?><a href='<?php echo $this->createLink($file->objectType, 'view', "objectID=$file->objectID");?>' title='<?php echo $sourcePairs[$file->objectType][$file->objectID];?>'><?php echo $sourcePairs[$file->objectType][$file->objectID];?></a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
<?php if(!empty($files)):?>
|
||||
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
|
||||
<?php else:?>
|
||||
<div class='table-empty-tip text-muted'><?php echo $lang->pager->noRecord;?></div>
|
||||
<?php endif?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php js::set('type', 'doc');?>
|
||||
<script>
|
||||
<?php
|
||||
$sessionString = $config->requestType == 'PATH_INFO' ? '?' : '&';
|
||||
$sessionString .= session_name() . '=' . session_id();
|
||||
?>
|
||||
function downloadFile(fileID, extension, imageWidth)
|
||||
{
|
||||
if(!fileID) return;
|
||||
var fileTypes = 'txt,jpg,jpeg,gif,png,bmp';
|
||||
var sessionString = '<?php echo $sessionString;?>';
|
||||
var windowWidth = $(window).width();
|
||||
var url = createLink('file', 'download', 'fileID=' + fileID + '&mouse=left') + sessionString;
|
||||
width = (windowWidth > imageWidth) ? ((imageWidth < windowWidth*0.5) ? windowWidth*0.5 : imageWidth) : windowWidth;
|
||||
if(fileTypes.indexOf(extension) >= 0)
|
||||
{
|
||||
$('<a>').modalTrigger({url: url, type: 'iframe', width: width}).trigger('click');
|
||||
}
|
||||
else
|
||||
{
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
Reference in New Issue
Block a user