issue 70 file management UI/UX modify

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8715 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2011-08-03 07:23:30 +00:00
parent 0cf931d098
commit 35d02e8d3e
9 changed files with 146 additions and 65 deletions

View file

@ -14,6 +14,8 @@
<action name="procFileAdminDeleteChecked" type="controller" standalone="true" ruleset="deleteChecked" />
<action name="procFileAdminInsertConfig" type="controller" standalone="true" ruleset="insertConfig" />
<action name="procFileAdminInsertModuleConfig" type="controller" standalone="true" ruleset="fileModuleConfig" />
<action name="procFileAdminAddCart" type="controller" standalone="true" />
<action name="procFileGetList" type="controller" standalone="true" />
</actions>
<menus>
<menu name="file">

View file

@ -145,6 +145,25 @@
}
}
/**
* @brief Add to SESSION file srl
**/
function procFileAdminAddCart()
{
$file_srl = (int)Context::get('file_srl');
//$fileSrlList = array(500, 502);
$oFileModel = &getModel('file');
$output = $oFileModel->getFile($file_srl);
//$output = $oFileModel->getFile($fileSrlList);
if($output->file_srl)
{
if($_SESSION['file_management'][$output->file_srl]) unset($_SESSION['file_management'][$output->file_srl]);
else $_SESSION['file_management'][$output->file_srl] = true;
}
}
/**
* @brief php.ini에서 가져온 값의 형식이 M과 같을경우 byte로 바꿔주기
**/

View file

@ -40,6 +40,9 @@
$oFileModel = &getModel('file');
foreach($output->data as $key => $file) {
if($_SESSION['file_management'][$file->file_srl]) $file->isCarted = true;
else $file->isCarted = false;
$file->download_url = $oFileModel->getDownloadUrl($file->file_srl, $file->sid);
$output->data[$key] = $file;
}

View file

@ -255,6 +255,44 @@
if($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl);
}
/**
* @brief get file list
**/
function procFileGetList()
{
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
// Taken from a list of selected sessions
$flagList = $_SESSION['file_management'];
if(count($flagList)) {
foreach($flagList as $key => $val) {
if(!is_bool($val)) continue;
$fileSrlList[] = $key;
}
}
global $lang;
if(count($fileSrlList) > 0) {
$oFileModel = &getModel('file');
$fileList = $oFileModel->getFile($fileSrlList);
if(is_array($fileList))
{
foreach($fileList AS $key=>$value)
{
$value->human_file_size = FileHandler::filesize($value->file_size);
if($value->isvalid=='Y') $value->validName = $lang->is_valid;
else $value->validName = $lang->is_stand_by;
}
}
}
else
{
$fileList = array();
$this->setMessage($lang->no_files);
}
$this->add('file_list', $fileList);
}
/**
* @brief A trigger to return numbers of attachments in the upload_target_srl (document_srl)
**/

View file

@ -125,13 +125,28 @@
**/
function getFile($file_srl, $columnList = array()) {
$args->file_srl = $file_srl;
$output = executeQuery('file.getFile', $args, $columnList);
$output = executeQueryArray('file.getFile', $args, $columnList);
if(!$output->toBool()) return $output;
$file = $output->data;
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
// old version compatibility
if(count($output->data) == 1)
{
$file = $output->data[0];
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
return $file;
return $file;
}
else
{
$fileList = array();
foreach($output->data AS $key=>$value)
{
$file = $value;
$file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid);
array_push($fileList, $file);
}
return $fileList;
}
}
/**

View file

@ -50,4 +50,5 @@
$lang->msg_not_allowed_outlink = '외부링크에서 다운로드 할 수 없습니다.';
$lang->msg_not_permitted_create = '파일 또는 디렉토리를 생성할 수 없습니다.';
$lang->msg_file_upload_error = '파일 업로드 중 에러가 발생하였습니다.';
$lang->no_files = '파일이 없습니다.';
?>

View file

@ -3,6 +3,6 @@
<table name="files" />
</tables>
<conditions>
<condition operation="equal" column="file_srl" var="file_srl" filter="number" notnull="notnull" />
<condition operation="in" column="file_srl" var="file_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,10 +1,9 @@
<!--%import("js/file_admin.js")-->
<div class="content" id="content">
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<form id="fo_list" action="./" method="post">
<input type="hidden" name="act" value="procFileAdminDeleteChecked" />
<input type="hidden" name="page" value="{$page}" />
<h1 class="h1">File</h1>
<div class="table">
<table width="100%" border="1" cellspacing="0">
@ -88,7 +87,7 @@
<td><a href="{getUrl('search_target','ipaddress','search_keyword',$val->ipaddress)}">{$val->ipaddress}</a></td>
<td><!--@if($val->isvalid=='Y')-->{$lang->is_valid}<!--@else-->{$lang->is_stand_by}<!--@end--></td>
<td>
<input type="checkbox" name="cart[]" value="{$val->file_srl}" />
<input type="checkbox" name="cart[]" value="{$val->file_srl}" onclick="addCart(this.value)" <!--@if($val->isCarted)-->checked="checked"<!--@end--> />
</td>
</tr>
<!--@endforeach-->
@ -96,76 +95,31 @@
</table>
</div>
<div class="btnArea">
<span class="btn"><a href="#listManager" class="modalAnchor">선택한 파일 관리...</a></span>
<span class="btn"><a href="#listManager" class="modalAnchor" onclick="getFileList();">선택한 파일 관리...</a></span>
</div>
</form>
<div class="modal" id="listManager">
<form action="" class="fg form">
<form ruleset="deleteChecked" action="./" method="post" class="fg form">
<input type="hidden" name="act" value="procFileAdminDeleteChecked" />
<input type="hidden" name="page" value="{$page}" />
<h2 class="h2">선택한 파일 관리</h2>
<div class="table">
<table width="100%" border="1" cellspacing="0">
<caption>선택한 파일 <strong>8</strong></caption>
<table width="100%" border="1" cellspacing="0" id="fileManageListTable">
<caption>선택한 파일 <strong id="selectedFileCount">8</strong></caption>
<thead>
<tr>
<th scope="col" class="text">Title/File</th>
<th scope="col">File Size</th>
<th scope="col">Author</th>
<th scope="col">Status</th>
<th scope="col">
<input type="checkbox" checked="checked" title="Check All" />
</th>
<th scope="col" class="text">{$lang->file}</th>
<th scope="col">{$lang->file_size}</th>
<th scope="col">{$lang->nick_name}</th>
<th scope="col">{$lang->status}</th>
</tr>
</thead>
<tbody>
<tr>
<th colspan="5" class="text" scope="col"> The quick brown fox jumps over the lazy dog.
</td>
</th>
</tr>
<tr>
<td class="text">489d9886e52ea5227a8edb74dcc8124e.jpg</td>
<td>123.4KB</td>
<td>정찬명</td>
<td>Valid</td>
<td>
<input type="checkbox" checked="checked" />
</td>
</tr>
<tr>
<th colspan="5" class="text" scope="col"> The quick brown fox jumps over the lazy dog.
</td>
</th>
</tr>
<tr>
<td class="text">attendance_1.5.19.tar.gz</td>
<td>456Byte</td>
<td>김태곤</td>
<td>Standby</td>
<td>
<input type="checkbox" checked="checked" />
</td>
</tr>
<tr>
<td class="text">attendance_1.5.19.tar.gz</td>
<td>456Byte</td>
<td>김태곤</td>
<td>Standby</td>
<td>
<input type="checkbox" checked="checked" />
</td>
</tr>
</tbody>
</table>
</div>
<p class="q">선택한 파일의 상태를 변경.</p>
<p>
<input type="radio" name="status" id="valid" /> <label for="valid">Valid</label>
<input type="radio" name="status" id="standby" /> <label for="standby">Standby</label>
</p>
<div class="btnArea">
<span class="btn"><input type="submit" value="Modify" /></span>
<span class="btn"><input type="submit" value="Trash" /></span>
<span class="btn"><input type="submit" value="Delete" class="delete" /></span>
<span class="btn"><input type="submit" value="{$lang->cmd_delete}" class="delete" /></span>
</div>
</form>
</div>
@ -183,7 +137,7 @@
</select>
<input type="text" name="search_keyword" value="{htmlspecialchars($search_keyword)}" />
<input type="submit" value="{$lang->cmd_search}" />
<a href="#">Cancel</a>
<a href="{getUrl('','module',$module,'act',$act)}"><span>{$lang->cmd_cancel}</span></a>
</form>
</div>
</div>

View file

@ -1,3 +1,52 @@
function insertSelectedModule(id, module_srl, mid, browser_title) {
location.href = current_url.setQuery('module_srl',module_srl);
}
function addCart(file_srl) {
var params = new Array();
var response_tags = ['error','message'];
params['file_srl'] = file_srl;
exec_xml('file','procFileAdminAddCart',params, completeAddCart, response_tags);
}
function completeAddCart(ret_obj, response_tags)
{
}
function getFileList() {
var params = new Array();
var response_tags = ['error','message', 'file_list'];
exec_xml('file','procFileGetList',params, completeGetFileList, response_tags);
}
function completeGetFileList(ret_obj, response_tags)
{
var htmlListBuffer = '';
if(ret_obj['file_list'] == null)
{
htmlListBuffer = '<tr>' +
'<td colspan="4" style="text-align:center;">'+ret_obj['message']+'</td>' +
'</tr>';
}
else
{
var file_list = ret_obj['file_list']['item'];
if(!jQuery.isArray(file_list)) file_list = [file_list];
for(var x in file_list)
{
var objFile = file_list[x];
console.log(objFile);
htmlListBuffer += '<tr>' +
'<td class="text">'+objFile.source_filename+'</td>' +
'<td>'+objFile.human_file_size+'</td>' +
'<td></td>' +
'<td>'+objFile.validName+'</td>' +
'</tr>' +
'<input type="hidden" name="cart[]" value="'+objFile.file_srl+'" />';
}
jQuery('#selectedFileCount').html(file_list.length);
}
jQuery('#fileManageListTable>tbody').html(htmlListBuffer);
}