/* * author: Logan Cai * Email: cailongqun [at] yahoo [dot] com [dot] cn * Website: www.phpletter.com * Created At: 21/April/2007 * Modified At: 1/June/2007 */ var dcTime=300; // doubleclick time var dcDelay=100; // no clicks after doubleclick var dcAt=0; // time of doubleclick var savEvent=null; // save Event for handling doClick(). var savEvtTime=0; // save time of click event. var savTO=null; // handle of click setTimeOut var linkElem = null; function hadDoubleClick() { var d = new Date(); var now = d.getTime(); if ((now - dcAt) < dcDelay) { return true; } return false; }; /** * add over class to the specific table */ function tableRuler(element) { var rows = $(element); $(rows).each(function(){ $(this).mouseover(function(){ $(this).addClass('over'); }); $(this).mouseout(function(){ $(this).removeClass('over'); }); }); }; function getIEVersion( ) { var ua = navigator.userAgent; var IEOffset = ua.indexOf("MSIE "); return parseFloat(ua.substring(IEOffset + 5, ua.indexOf(";", IEOffset))); }; /** *check all checkboxs and uncheck all checkbox */ function checkAll(selectAllText, unselectAllText) { var checkbox = $('#tickAll'); if($(checkbox).attr('class') == "check_all") { $(checkbox).attr('class', 'uncheck_all'); $(checkbox).attr('title', unselectAllText); $("#fileList tr[@id^=row] input[@type=checkbox]").each(function(i){ $(this).attr("checked", 'checked'); }) ; }else { $(checkbox).attr('class', 'check_all'); $(checkbox).attr('title', selectAllText); $("#fileList input[@type=checkbox][@checked]").each(function(i){ $(this).removeAttr("checked"); }) ; } }; /** * show up the selected document information */ function setDocInfo(type, rowNum) { $('#edit').hide(); var editableExtensions = editableExts.split(','); if(document.getElementById('check'+rowNum).checked) { if(type=="folder") { $('#folderPath').text($('#folderPath'+rowNum).val()); $('#folderFile').text($('#folderFile'+rowNum).val()); $('#folderSubdir').text($('#folderSubdir'+rowNum).val()); $('#folderCtime').text($('#folderCtime'+rowNum).val()); $('#folderMtime').text($('#folderMtime'+rowNum).val()); if($('#folderReadable' + rowNum).val() == '1') { $('#folderReadable').html(" "); }else { $('#folderReadable').html(" "); } if($('#folderWritable' + rowNum).val() == '1') { $('#folderWritable').html(" "); }else { $('#folderWritable').html(" "); } $('#folderFieldSet').css('display', ''); $('#fileFieldSet').css('display', 'none'); $('#preview').html(msgNotPreview); }else { $('#preview').html(msgNotPreview); var fileExt = getFileExtension($('#fileName'+rowNum).val()); $('#selectedFileRowNum').val(rowNum); $('#fileName').text($('#fileName'+rowNum).val()); $('#fileSize').text($('#fileSize'+rowNum).val()); $('#fileType').text($('#fileType'+rowNum).val()); $('#fileCtime').text($('#fileCtime'+rowNum).val()); $('#fileMtime').text($('#fileMtime'+rowNum).val()); if($('#fileReadable' + rowNum).val() == '1') { $('#fileReadable').html(" "); }else { $('#fileReadable').html(" "); } if($('#fileWritable' + rowNum).val() == '1') { $('#fileWritable').html(" "); }else { $('#fileWritable').html(" "); } $('#folderFieldSet').css('display', 'none'); $('#fileFieldSet').css('display', ''); if($('#filePreview' + rowNum).val() == '1') { $("#loading") .ajaxStart(function(){ $(this).show(); }) .ajaxComplete(function(){ $(this).hide(); }); for(var i in editableExtensions) { if(editableExtensions[i] == fileExt) { $('#edit').show(); break; } } switch($('#fileType'+rowNum).val()) { case "image": $('#edit').show(); $('#loading').show(); var preImage = new Image(); preImage.onload = function() { $('#preview').empty(); $(preImage).appendTo('#preview'); $('#loading').hide(); }; preImage.src = appendQueryString(urlImgPreview, "path=" + $('#filePath' + rowNum).val()) ; break; case "txt": $("#preview").load(appendQueryString(urlPreview, "path=" + $('#filePath' + rowNum).val()) , function() { } ); case "xml": case "html": break; case "video": case "movie": case "music": case "Flash": $('#preview').html('
 
'); break; default: //do nothing } }else { $('#preview').html(msgNotPreview); } } } }; function previewMedia(rowNum) { $('#preview' +rowNum).html(''); $('#preview' +rowNum).media({ width: 255, height: 210, autoplay: true }); return false; }; function generateDownloadIframe(url) { var frameId = 'ajaxDownloadIframe'; $('#' + frameId).remove(); if(window.ActiveXObject) { var io = document.createElement('