feature(cloudfunc) buildFromJSON: change params

This commit is contained in:
coderaiser 2014-05-24 12:06:13 -04:00
parent 1cbd959a46
commit 913fc2f7ce
3 changed files with 32 additions and 12 deletions

View file

@ -363,15 +363,18 @@ var Util;
/**
* Функция строит таблицу файлв из JSON-информации о файлах
* @param json - информация о файлах
* @param params - информация о файлах
*
* {name:'имя',size:'размер',mode:'права доступа'}]
*/
this.buildFromJSON = function(json, template, pathTemplate, linkTemplate) {
this.buildFromJSON = function(params) {
var file, i, n, type, attribute, size, owner, mode,
/* ссылка на верхний каталог*/
dotDot, link,
linkResult,
template = params.template,
templateFile = template.file,
templateLink = template.link,
json = params.data,
files = json.files,
/* сохраняем путь каталога в котором мы сейчас находимся*/
path = json.path,
@ -388,13 +391,13 @@ var Util;
*/
refreshPath = CloudFunc.rmLastSlash(path),
fileTable = Util.render(pathTemplate, {
fileTable = Util.render(template.path, {
link : FS + refreshPath,
fullPath : path,
path : htmlPath
}),
header = Util.render(template, {
header = Util.render(templateFile, {
tag : 'div',
attribute : '',
className : 'fm-header',
@ -422,13 +425,13 @@ var Util;
link = FS + dotDot;
linkResult = Util.render(linkTemplate, {
linkResult = Util.render(template.link, {
link : link,
name : '..'
});
/* Сохраняем путь к каталогу верхнего уровня*/
fileTable += Util.render(template, {
fileTable += Util.render(template.file, {
tag : 'li',
attribute : 'draggable="true" ',
className : '',
@ -458,14 +461,13 @@ var Util;
owner = file.owner || 'root';
mode = CloudFunc.getSymbolicPermissions(file.mode);
linkResult = Util.render(linkTemplate, {
linkResult = Util.render(templateLink, {
link : link,
name : file.name,
attribute : attribute
});
fileTable += Util.render(template,{
fileTable += Util.render(templateFile, {
tag : 'li',
attribute : 'draggable="true" ',
className : '',