fixed bug with refreshing directory, from now current file would not be seeted up to first, after refresh

This commit is contained in:
coderaiser 2012-08-16 07:45:10 -04:00
parent 553ea9723c
commit ab962b9102
2 changed files with 23 additions and 4 deletions

View file

@ -42,6 +42,8 @@ current, file that was previously current must be unset automatically.
* Added function getRefreshButton.
* Fixed bug with refreshing directory, from now current file would not be seeted up to first, after refresh.
2012.08.06, Version 0.1.5

View file

@ -751,7 +751,7 @@ CloudClient._loadDir = (function(pLink,pNeedRefresh){
var lA = Util.getCurrentLink(this);
/* если нажали на ссылку на верхний каталог*/
//if(lA && lA.textContent==='..' && lHref!=='/'){
if(lA && lA.textContent==='..' && lHref!=='/'){
/* функция устанавливает курсор на каталог
* с которого мы пришли, если мы поднялись
@ -873,7 +873,6 @@ CloudClient._currentToParent = (function(pDirName){
/* опредиляем в какой мы панели:
* правой или левой
*/
var lCurrentFile = Util.getCurrentFile();
var lPanel = Util.getPanel();
/* убираем слэш с имени каталога*/
@ -1189,9 +1188,17 @@ CloudClient._ajaxLoad=function(path, pNeedRefresh)
* @pEleme - родительский элемент
* @pJSON - данные о файлах
*/
CloudClient._createFileTable = function(pElem,pJSON)
CloudClient._createFileTable = function(pElem, pJSON)
{
var lElem=getById(pElem);
var lElem = getById(pElem);
/* getting current element if was refresh */
var lPath = getByClass('path', lElem);
var lWasRefresh_b = lPath[0].textContent === pJSON[0].path;
var lCurrent;
if(lWasRefresh_b)
lCurrent = Util.getCurrentFile();
/* говорим построителю,
* что бы он в нужный момент
* выделил строку с первым файлом
@ -1205,6 +1212,16 @@ CloudClient._createFileTable = function(pElem,pJSON)
/* заполняем панель новыми элементами */
lElem.innerHTML = CloudFunc.buildFromJSON(pJSON,true);
/* searching current file */
if(lWasRefresh_b && lCurrent){
for(i = 0; i < lElem.childNodes.length; i++)
if(lElem.childNodes[i].textContent === lCurrent.textContent){
lCurrent = lElem.childNodes[i];
break;
}
Util.setCurrentFile(lCurrent);
}
};
/*