You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.2 KiB
60 lines
2.2 KiB
$(function () {
|
|
'use strict';
|
|
|
|
var fnRenderList = function (handle, list) {
|
|
var sHtmlList = $('#temp_list').render(list);
|
|
handle.html(sHtmlList).find('.download-button').on('click', function () {
|
|
var sName = $(this).attr('filename'),
|
|
sPath = $(this).attr('filepath');
|
|
DownLoadFile(sPath, sName);
|
|
});
|
|
},
|
|
fnGetFileList = function (handle, parentid) {
|
|
return g_api.ConnectLite(Service.apiappcom, ComFn.GetFileList, {
|
|
ParentID: parentid
|
|
}, function (res) {
|
|
if (res.RESULT) {
|
|
var saRes = res.DATA.rel;
|
|
fnRenderList(handle, saRes);
|
|
}
|
|
});
|
|
},
|
|
init = function () {
|
|
var sLang = $('[http-equiv="content-language"]').attr('content') || 'zh-TW',
|
|
myHelpers = {
|
|
setFileName: function (val) {
|
|
return val.split('.')[0];
|
|
},
|
|
setDescription: function (val) {
|
|
return !val ? '-' : val;
|
|
},
|
|
setFilePath: function (val) {
|
|
return gServerUrl + '/' + val.replace(/\\/g, "\/");
|
|
},
|
|
checkSubFileName: function (val) {
|
|
return val.toLowerCase() === 'pdf';
|
|
}
|
|
},
|
|
oTempl = {
|
|
'zh-TW': ['FileList1', 'FileList2'],
|
|
'zh': ['FileList3', 'FileList4'],
|
|
'en': ['FileList5']
|
|
};
|
|
$.views.helpers(myHelpers);
|
|
|
|
$.each(oTempl[sLang], function (idx, item) {
|
|
return g_api.ConnectLite(Service.apiwebcom, ComFn.GetFileInfo, {
|
|
Id: item
|
|
}, function (res) {
|
|
if (res.RESULT) {
|
|
var oRes = res.DATA.rel;
|
|
if (oRes && oRes.FileID) {
|
|
fnGetFileList($('#' + item), oRes.FileID);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
};
|
|
|
|
init();
|
|
});
|