⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file_manager_general.js

📁 jquery+prototype+插件+源码+资料 非常的东西
💻 JS
📖 第 1 页 / 共 4 页
字号:
								$('#check' + num).val(files[num].path);								
								$('#a' + num).attr('href', files[num].path);							
								$('#tdnd' + num).text(files[num].name);
								$('#tdth' + num).text(files[num].name);								
						}
						
						tb_remove();											

					}
				} 
			}; 
			$('#formRename').ajaxSubmit(options); 	
						 				
				
	}	
}
/**
* reload the whole window 
*/
function windowRefresh()
{
	document.location.href = urls.present;
	//document.location.reload();
};
/**
*	show the system information
*/
function infoWin(linkElem)
{
	
	showThickBox(linkElem, appendQueryString('#TB_inline', 'height=100' + '&width=350'+ '&inlineId=winInfo&modal=true'));

}
/**
*check all checkboxs and uncheck all checkbox
*/
function checkAll(checkbox)
{

	if($(checkbox).attr('class') == "check_all")
	{
		$('#tickAll, #actionSelectAll').attr('class', 'uncheck_all');
		$('#tickAll, #actionSelectAll').attr('title', unselectAllText);
		$('#actionSelectAll span').html(unselectAllText);
		switch(getView())
		{
			case 'thumbnail':
				$('#rightCol dl.thumbnailListing input[@type=checkbox]').each(function(i){
														   			$(this).attr("checked", 'checked');												 
																	 })	;
				break;
			case 'detail':
			default:
$("#fileList tr[@id^=row] input[@type=checkbox]").each(function(i){
														   			$(this).attr("checked", 'checked');												 
																	 })	;			
		}
				

	}else
	{
		$('#tickAll, #actionSelectAll').attr('class', 'check_all');
		$('#tickAll, #actionSelectAll').attr('title', selectAllText);		
		$('#actionSelectAll span').html( selectAllText);	
		switch(getView())
		{
			case 'thumbnail':
				$('#rightCol dl.thumbnailListing input[@type=checkbox]').each(function(i){
														   			$(this).removeAttr("checked");											 
																	 })	;
				break;
			case 'detail':
			default:
$("#fileList tr[@id^=row] input[@type=checkbox]").each(function(i){
														   			$(this).removeAttr("checked");											 
																	 })	;			
		}		
	}

	return false;
		
};		

function cutDocuments(msgNoDocSelected)
{
	repositionDocuments(msgNoDocSelected, getUrl('cut'), 'cut');
	return false;
};

function copyDocuments(msgNoDocSelected)
{
	repositionDocuments(msgNoDocSelected, getUrl('copy'), 'copy');
	return false;
};

/**
* selecte documents and fire an ajax call to delete them
*/
function repositionDocuments(msgNoDocSelected, formActionUrl, actionVal)
{
	switch(getView())
	{
		case 'thumbnail':
			var selectedDoc = $('#rightCol dl.thumbnailListing input[@type=checkbox][@checked]');
			break;
		case 'detail':
			
		default:
			var selectedDoc = $('#fileList input[@type=checkbox][@checked]');
	}
	
	var hiddenSelectedDoc = document.getElementById('selectedDoc');
	var selectedOptions;
	var isSelected = false;
	
	//remove all options
	$(hiddenSelectedDoc).removeOption(/./);
	$(selectedDoc).each(function(i){
										
										$(hiddenSelectedDoc).addOption($(this).val(), getNum($(this).attr('id')), true);
										isSelected = true;
										 });		
	if(!isSelected)
	{
		alert(msgNoDocSelected);
	}
	else
	{
		
			var formAction =  document.formAction;
			var actionElem = $('#action_value');
			formAction.action = formActionUrl;

			$('#currentFolderPathVal').val(currentFolder.path);
			$(actionElem).val(actionVal);
			var options = 
			{ 
				dataType: 'json',
				error: function (data, status, e) 
				{
					alert(e);
				},				
				success:   function(data) 
				{ 
										if(typeof(data.error) == 'undefined')
										{
											alert('Unexpected Error');
										}
										else if(data.error != '')
										{
											alert(data.error);
										}else
										{			
											//set change flags
											numFiles = parseInt(data.num);
											var flag = (actionVal == 'copy'?'copyFlag':'cutFlag');		
											action = actionVal;
											//clear all flag
											for(var i = 1; i < numRows; i++)
											{
												$('#flag' + i).attr('class', 'noFlag');
											}											
											for(var i =0; i < hiddenSelectedDoc.options.length; i++)
											{
												$('#flag' + hiddenSelectedDoc.options[i].text).attr('class', flag);
											}

										}
										
					} 
			}; 
			$(formAction).ajaxSubmit(options); 	
						 				

	}
	
	return false;	
};

function pasteDocuments(msgNoDocSelected)
{
	if(numFiles)
	{

		var warningMsg = (action == 'copy'?warningCopyPaste:warningCutPaste);
		if(window.confirm(warningMsg))
		{
			$.getJSON(appendQueryString(getUrl('paste'), 'current_folder_path='+ currentFolder.path, ['current_folder_path']), 
				function(json)
				{
					if(typeof(json.error) == 'undefined')
					{
						alert('Unexpected Error.');
					}
					{
						
						if(json.error != '')
						{
							alert(json.error);
						}
						
						
						for(var j in json.files)
						{
							numRows++;
							files[numRows] = {};
							for(var i in json.files[j])
							{
								files[numRows][i] = json.files[j][i];
							}
							addDocumentHtml(numRows);						
							
						}
						numFiles = parseInt(json.unmoved_files);
						
						
						
						
					}
				}
			);
		
		}
	}else
	{
		alert(msgNoDocSelected);
	}
	return false;
	
};
/**
*	add document item html to the file listing body
*/
function addDocumentHtml(num)
{
		var strDisabled = "";
		if(!files[num].is_writable)
		{
			strDisabled = "disabled";
		}	
		switch(getView())
		{
			
			case 'thumbnail':
				$(
				'<dl class="thumbnailListing" id="dl' + num + '" ><dt id="dt' + num + '" class="' + files[num].cssClass + '"></dt><dd id="dd' + num + '" class="thumbnailListing_info"><span id="flag' + num + '" class="' + files[num].flag + '">&nbsp;</span><input id="cb' + num + '" type="checkbox"  class="radio" ' + strDisabled +' name="check[]" class="input" value="' + files[num].path + '" /><a href="' + files[num].path + '" title="' + files[num].name + '" id="a' + num + '">' + (typeof(files[num].short_name) != 'undefined'?files[num].short_name:files[num].name) + '</a></dd></dl>').appendTo('#content');
			

				if(files[num].type== 'folder')
				{//this is foder item
					
					enableFolderBrowsable(num);
				}else
				{//this is file item
					
					switch(files[num].cssClass)
					{
						case 'filePicture':
							$('<a id="thumbUrl' + num + '" rel="thumbPhotos" href="' + files[num].path + '"><img src="' + appendQueryString(getUrl('thumbnail', false, false), 'path=' + files[num].path, ['path']) + '" id="thumbImg' +  num + '"></a>').appendTo('#dt' + num);
							break;
						case 'fileFlash':
							break;
						case 'fileVideo':
							break;			
						case 'fileMusic':
							break;
						default:
						
							
					}
					enablePreview('#dl' + num + ' a', [num]);					
				
				}	
				enableContextMenu('#dl' + num);	
				enableShowDocInfo( num);									
				break;
			case 'detail':
			default:
				var cssRow = (num % 2?"even":"odd");
				$('<tr class="' + cssRow + '" id="row' + num + '"><td id="tdz' + num +'" align="center"><span id="flag' + num +'" class="' + files[num].flag +'">&nbsp;</span><input type="checkbox" class="radio" name="check[]" id="cb' + num +'" value="' + files[num].path +'" ' + strDisabled + ' /></td><td align="center" class="fileColumns"   id="tdst1">&nbsp;<a id="a' + num +'" href="' + files[num].path +'"><span class="' + files[num].cssClass + '">&nbsp;</span></a></td><td class="left docName" id="tdnd' + num +'">'  + (typeof(files[num].short_name) != 'undefined'?files[num].short_name:files[num].name) + '</td><td class="docInfo" id="tdrd' + num +'">' + files[num].size +'</td><td class="docInfo" id="tdth' + num +'">' + files[num].mtime +'</td></tr>').appendTo('#fileList');
		
				if(files[num].type== 'folder')
				{//this is foder item					
					enableFolderBrowsable(num);
				}else
				{//this is file item
					
					switch(files[num].cssClass)
					{
						case 'filePicture':							
							break;
						case 'fileFlash':
							break;
						case 'fileVideo':
							break;			
						case 'fileMusic':
							break;
						default:
						
							
					}
					enablePreview('#row' + num + ' td a', num);		
								
				}	
				enableContextMenu('#row' + num);
				enableShowDocInfo(num);										
				break;								
			
				
		}	
	
	
	
};

function enableShowDocInfo(num)
{

	$('#cb' + num).click(
		function()
		{

			setDocInfo('doc', num);
		}
	);	
}
/**
*	show up the selected document information
* @param   type root or doc
*/
function setDocInfo(type, num)
{
	

	var info = {};
	if(type == 'root')
	{
		info = currentFolder;
	}else
	{
		info = files[num];
	}
	

		if(info.type=="folder")
		{
			$('#folderPath').text(info.name);
			$('#folderFile').text(info.file);
			$('#folderSubdir').text(info.subdir);
			$('#folderCtime').text(info.ctime);
			$('#folderMtime').text(info.mtime);
			if(info.is_readable == '1')
			{
				$('#folderReadable').html("<span class=\"flagYes\">&nbsp;</span>");	
			}else
			{
				$('#folderReadable').html("<span class=\"flagNo\">&nbsp;</span>");
			}
			if(info.is_writable == '1')
			{
				$('#folderWritable').html("<span class=\"flagYes\">&nbsp;</span>");	
			}else
			{
				$('#folderWritable').html("<span class=\"flagNo\">&nbsp;</span>");
			}	
			$('#folderFieldSet').css('display', '');
			$('#fileFieldSet').css('display', 'none');
		}else
		{
	

			$('#fileName').text(info.name);
			$('#fileSize').text(info.size);
			$('#fileType').text(info.fileType);
			$('#fileCtime').text(info.ctime);
			$('#fileMtime').text(info.mtime);
			if(info.is_readable == '1')
			{
				$('#fileReadable').html("<span class=\"flagYes\">&nbsp;</span>");	
			}else
			{
				$('#fileReadable').html("<span class=\"flagNo\">&nbsp;</span>");
			}
			if(info.is_writable == '1')
			{
				$('#fileWritable').html("<span class=\"flagYes\">&nbsp;</span>");	
			}else
			{
				$('#fileWritable').html("<span class=\"flagNo\">&nbsp;</span>");
			}	
			$('#folderFieldSet').css('display', 'none');
			$('#fileFieldSet').css('display', '');
		   if(typeof(selectFile) != 'undefined')
		   {
		   	$('#selectCurrentUrl').unbind('click').click( 
		   		function()
		   		{
		   			
		   			selectFile(info.url);
		   		}
		   	);
		   	$('#returnCurrentUrl').show();
		   	 
		   }else
		   {
		   	$('#returnCurrentUrl').hide();
		   }
		   	
			
		}
		

		
	
	
};
		function search()
		{
			searchRequired = true;			
			var url = getUrl('view', true, true, true);		

		$('#rightCol').empty();
		ajaxStart('#rightCol');		
		
		$('#rightCol').load(url, 
					{},
					function(){
							ajaxStop('#rightCol img.ajaxLoadingImg');
							initAfterListingLoaded();
						});			
			return false;
		}
		
		function closeWinPlay()
		{
			tb_remove();
			$('#playGround').empty();
		}
		
		function closeWindow(msg)
		{
			
			if(window.confirm(msg))
			{
				window.close();
			}else
			{
				return false;
			}

			
		}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -