Changeset 3924 for branches/2.2/filemanager/js/draw_api.js
- Timestamp:
- 03/28/11 16:18:49 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/filemanager/js/draw_api.js
r3913 r3924 550 550 var _parent = ( arguments[1] ) ? arguments[1] : null ; 551 551 552 if( _arg == 'archive' ) 553 { 554 var filesUrl = this.getCheckedFiles(); 555 var password = prompt(get_lang('Please, type a strong password (suggestion: at least 8 characters, letters and numbers) or leave it empty to archive only')); 556 557 if ( password == null) 558 return; 559 560 if ( password.length > 0 ) 561 { 562 var password2 = prompt(get_lang('Please, retype your password')); 563 564 if ( password != password2 ) 565 { 566 alert(get_lang('Error:')+get_lang('passwords are differents')); 567 return; 568 } 569 } 570 571 var pswd = crypt.encode( password ); 572 573 cExecute_('./index.php?menuaction=filemanager.vfs_functions.archive&pswd=' 574 + base64_encode(pswd.toString())+'&path='+base64_encode(currentPath)+filesUrl,handler.archive); 575 } 576 577 if( _arg == 'delete' ) 578 { 579 var filesUrl = this.getCheckedFiles(); 580 cExecute_('./index.php?menuaction=filemanager.vfs_functions.delete&path='+base64_encode(currentPath)+filesUrl,handler.del); 581 } 582 583 if( _arg == 'edit' ) 584 { 585 var files = document.getElementsByName('fileman'); 586 var one_checked = false; 587 588 for (i = 0; i < files.length; i++) 589 { 590 if ( files[i].checked ) 591 { 592 one_checked = true; 593 var filename=files[i].value; 594 } 595 } 596 597 if (one_checked) 598 { 599 var address = (document.location.toString() ).split("&"); 600 ; 601 document.location = address[0]+"&"+_arg+".x=1&filename="+base64_encode(filename)+".&path="+base64_encode(currentPath); 602 } 603 else 604 { 605 write_msg( get_lang('Please select a file') ); 606 } 607 } 608 552 609 if( _arg == 'new' ) 553 610 { … … 555 612 556 613 var itens = [ 557 [ get_lang('empty file'),'javascript:newEmptyFile()',templatePath+'images/group_close.gif', '' ], 558 [ get_lang('File from model'), _address[0]+"?menuaction=filemanager.uifilemanager.fileModels", templatePath+'images/group_close.gif', '' ], 559 [ get_lang('Upload'), 'javascript:newUpload()', templatePath+'images/group_close.gif', '' ], 560 [ get_lang('Advanced Upload'), 'javascript:newAdvancedUpload()', templatePath+'images/group_close.gif', '' ] 614 [ get_lang('empty file'),'javascript:newEmptyFile()',templatePath+'images/group_close.gif', '' ], 615 [ get_lang('File from model'), _address[0]+"?menuaction=filemanager.uifilemanager.fileModels", templatePath+'images/group_close.gif', '' ], 616 [ get_lang('Upload'), 'javascript:newUpload()', templatePath+'images/group_close.gif', '' ], 617 [ get_lang('Advanced Upload'), 'javascript:newAdvancedUpload()', templatePath+'images/group_close.gif', '' ] 618 ]; 619 620 draw_menu( itens, _parent ); 621 } 622 623 if( _arg == 'reload') 624 { 625 last_folder = last_folder ? last_folder : currentPath; 626 current_folder = ( current_folder != "" ) ? current_folder : currentPath; 627 cExecute_('./index.php?menuaction=filemanager.uifilemanager.dir_ls&path='+base64_encode(currentPath)+'&criteria='+criteria+'&otype='+order_type+'&limit='+preferences.files_per_page+'&offset='+offset,folderList.drawFiles); 628 } 629 630 if( _arg == 'tools' ) 631 { 632 var itens = [ 633 [ get_lang('Preferences'), 'preferences/preferences.php?appname=filemanager', templatePath+'images/preferences.png', 'width="16px" height="16px"' ], 634 [ get_lang('Edit Folders'), 'javascript:editFolders()', templatePath+'images/button_createdir.png', 'width="16px" height="16px"'], 635 [ get_lang('Share Folders'), './index.php?menuaction=preferences.uiaclprefs.index&acl_app=filemanager', templatePath+'images/mime16_directory.png', 'width="16px" height="16px"'], 636 [ get_lang('View'), 'javascript:EditColumns()', templatePath+'images/editpaste.png', 'width="16px" height="16px"' ], 637 [ get_lang('Archive'), 'javascript:toolbar.control("archive")', templatePath+'images/button_zip.png', 'width="16px" height="16px"' ] 561 638 ]; 562 639 … … 573 650 if( files[i].checked ) 574 651 { 575 files[i].checked = false;652 files[i].checked = false; 576 653 var _span = document.getElementById( 'name_' + files[i].value ); 577 654 var _parentNode = _span.parentNode; 578 655 _parentNode.style.height = (parseInt(_parentNode.style.height) + 4 ); 579 656 580 var _input 581 _input.id 582 _input.size 583 _input.zIndex 657 var _input = document.createElement("input"); 658 _input.id = 'input_'+files[i].value; 659 _input.size = "35"; 660 _input.zIndex = "99999"; 584 661 _input.value = _span.innerHTML; 585 _input.type 662 _input.type = 'text'; 586 663 587 664 // OnkeyUp … … 595 672 } 596 673 }); 597 598 // Onblur 599 //configEvents( _input, "onblur", function() 600 //{ 601 //handler.rename( _input, _span ); 602 //}); 603 674 675 //OnBlur 676 configEvents( _input, "onblur", function(e) 677 { 678 _parentNode.style.height = (parseInt(_parentNode.style.height) - 4 ); 679 handler.rename( _input, _span ); 680 }); 681 604 682 if( _parentNode != null ) 605 683 { … … 617 695 } 618 696 } 619 620 switch ( _arg ) 621 { 622 623 case 'edit': 624 var one_checked = false; 625 files=document.getElementsByName('fileman'); 626 for (i = 0; i < files.length; i++) 627 if (files[i].checked){ 628 one_checked = true; 629 var filename=files[i].value; 630 } 631 if (one_checked){ 632 address = document.location.toString(); 633 address = address.split("&"); 634 document.location = address[0]+"&"+_arg+".x=1&filename="+base64_encode(filename)+".&path="+base64_encode(currentPath); 635 } 636 else 637 { 638 write_msg(get_lang('Please select a file')); 639 return; 640 } 641 break; 642 case 'delete': 643 var filesUrl = this.getCheckedFiles(); 644 cExecute_('./index.php?menuaction=filemanager.vfs_functions.delete&path='+ 645 base64_encode(currentPath)+filesUrl,handler.del); 646 break; 647 case 'archive': 648 var filesUrl = this.getCheckedFiles(); 649 password = prompt(get_lang('Please, type a strong password (suggestion: at least 8 characters, letters and numbers) or leave it empty to archive only')); 650 if (password == null) 651 return; 652 if (password.length > 0) 653 { 654 password2 = prompt(get_lang('Please, retype your password')); 655 if (password != password2) 656 { 657 alert(get_lang('Error:')+get_lang('passwords are differents')); 658 return; 659 } 660 } 661 var pswd = crypt.encode(password); 662 cExecute_('./index.php?menuaction=filemanager.vfs_functions.archive&pswd=' 663 + base64_encode(pswd.toString())+'&path='+base64_encode(currentPath)+filesUrl,handler.archive); 664 break; 665 case 'move_to': 666 case 'copy_to': 667 668 var filesUrl = this.getCheckedFiles(); 669 670 if ( filesUrl != undefined) 671 { 672 DocY -= ( folders.length * 30 ); 673 674 var action = ( ( _arg == 'move_to') ? get_lang('move to:') : get_lang('copy to:') ); 675 676 loadXtools(); 677 678 var _xml = Xtools.xml('files'); 679 var _files = _xml.documentElement; 680 var _links = _xml.createElement('links'); 681 682 for( var i = 0 ; i < folders.length ; i++ ) 683 { 684 var _lk = _xml.createElement('lk'); 697 698 if ( ( _arg == 'move_to' ) || ( _arg == 'copy_to' ) ) 699 { 700 var filesUrl = this.getCheckedFiles(); 701 702 if ( filesUrl != undefined ) 703 { 704 DocY -= ( folders.length * 30 ); 705 706 var action = ( ( _arg == 'move_to') ? get_lang('move to:') : get_lang('copy to:') ); 707 708 loadXtools(); 709 710 var _xml = Xtools.xml('files'); 711 var _files = _xml.documentElement; 712 var _links = _xml.createElement('links'); 713 714 for( var i = 0 ; i < folders.length ; i++ ) 715 { 716 var _lk = _xml.createElement('lk'); 685 717 _lk.setAttribute('function', "javascript:"+escape(_arg)+"('"+folders[i]+"','"+filesUrl+"'); close_window();" ); 686 718 _lk.appendChild( _xml.createTextNode( folders[i].replace( my_home_filemanager , get_lang("My folder") ) ) ); 687 _links.appendChild( _lk );688 }689 719 690 _files.appendChild( _links ); 691 692 var img_1 = path_filemanager + "templates/default/images/button_copy_to.png"; 693 var img_2 = path_filemanager + "templates/default/images/button_move_to.png"; 694 var img_3 = templatePath+"images/group_close.gif"; 695 696 var pArgs = 697 { 698 'action' : action, 699 'img' : ( ( _arg == 'move_to') ? img_2 : img_1 ), 700 'img_1' : img_3, 701 'width' : 380, 702 'height' : 200 703 }; 704 705 var code = Xtools.parse( _files, "copy_move_files.xsl", pArgs ); 706 707 draw_window( code , 380, 200 ); 720 _links.appendChild( _lk ); 708 721 } 709 722 710 break; 711 712 case 'reload': 713 714 last_folder = last_folder ? last_folder : currentPath; 715 current_folder = ( current_folder != "" ) ? current_folder : currentPath; 716 cExecute_('./index.php?menuaction=filemanager.uifilemanager.dir_ls&path='+base64_encode(currentPath)+'&criteria='+criteria+'&otype='+order_type+'&limit='+preferences.files_per_page+'&offset='+offset,folderList.drawFiles); 717 return; 718 719 case 'tools': 720 721 var itens = [ 722 [ get_lang('Preferences'), 'preferences/preferences.php?appname=filemanager', templatePath+'images/preferences.png', 'width="16px" height="16px"' ], 723 [ get_lang('Edit Folders'), 'javascript:editFolders()', templatePath+'images/button_createdir.png', 'width="16px" height="16px"'], 724 [ get_lang('Share Folders'), './index.php?menuaction=preferences.uiaclprefs.index&acl_app=filemanager', templatePath+'images/mime16_directory.png', 'width="16px" height="16px"'], 725 [ get_lang('View'), 'javascript:EditColumns()', templatePath+'images/editpaste.png', 'width="16px" height="16px"' ], 726 [ get_lang('Archive'), 'javascript:toolbar.control("archive")', templatePath+'images/button_zip.png', 'width="16px" height="16px"' ] 727 ]; 728 729 draw_menu( itens, _parent ); 730 731 break; 732 default: 733 return; 723 _files.appendChild( _links ); 724 725 var img_1 = path_filemanager + "templates/default/images/button_copy_to.png"; 726 var img_2 = path_filemanager + "templates/default/images/button_move_to.png"; 727 var img_3 = templatePath + "images/group_close.gif"; 728 729 var pArgs = 730 { 731 'action' : action, 732 'img' : ( ( _arg == 'move_to') ? img_2 : img_1 ), 733 'img_1' : img_3, 734 'width' : 380, 735 'height' : 200 736 }; 737 738 var code = Xtools.parse( _files, "copy_move_files.xsl", pArgs ); 739 740 draw_window( code , 380, 200 ); 741 } 734 742 } 735 743 }
Note: See TracChangeset
for help on using the changeset viewer.