Changeset 3924 for branches/2.2/filemanager
- Timestamp:
- 03/28/11 16:18:49 (13 years ago)
- Location:
- branches/2.2/filemanager
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/filemanager/inc/class.vfs_functions.inc.php
r3913 r3924 164 164 } 165 165 166 function setRestricted(){ 166 function setRestricted() 167 { 167 168 $GLOBALS['phpgw_info']['flags'] = array 168 169 ( 169 'currentapp' 170 'noheader' 171 'nonavbar' 172 'nofooter' 173 'noappheader' 170 'currentapp' => 'filemanager', 171 'noheader' => True, 172 'nonavbar' => True, 173 'nofooter' => True, 174 'noappheader' => True, 174 175 'enable_browser_class' => True 175 176 ); … … 432 433 { 433 434 $_return[] = array( "true" => lang('renamed %1 to %2', $this->file ,$this->to ) ); 435 436 // Get Type Mime Type 437 $mimeType = $this->bo->vfs->get_ext_mime_type(array ('string' => $this->to )); 438 439 $this->bo->vfs->set_attributes( array( 440 'string' => $this->to, 441 'relatives' => array(RELATIVE_ALL), 442 'attributes' => array('mime_type' => $mimeType) 443 )); 434 444 } 435 445 else 436 446 { 437 $_return[] = array( "error" => $this->file . " " . $this->to );447 $_return[] = array( "error" => $this->file . " " . $this->to ); 438 448 } 439 449 } 440 450 else 451 { 441 452 $_return[] = array("error" => "whitout file "); 453 } 442 454 443 455 echo serialize( $_return ); -
branches/2.2/filemanager/js/connector.js
r3879 r3924 122 122 } 123 123 124 function cExecute_(requestURL, handler, params){ 125 if (connector.isVisibleBar == true){ 124 function cExecute_( requestURL, handler, params) 125 { 126 if (connector.isVisibleBar == true) 127 { 126 128 setTimeout('cExecute_("'+requestURL+'",'+handler+')',150); 127 129 return; 128 130 } 131 129 132 connector.showProgressBar(); 130 var AjaxRequest = function () { 133 134 var AjaxRequest = function () 135 { 131 136 Ajax = false; 132 137 if (window.XMLHttpRequest) //Gecko -
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 } -
branches/2.2/filemanager/js/handler.js
r3913 r3924 146 146 function refreshDir(data) 147 147 { 148 cExecute_('./index.php?menuaction=filemanager.uifilemanager.get_folders_list', handler.draw_folders_list);148 cExecute_('./index.php?menuaction=filemanager.uifilemanager.get_folders_list', handler.draw_folders_list); 149 149 } 150 150 151 151 function rename() 152 152 { 153 var _handlerRename = function(data)154 {155 var _data = unserialize( data );156 157 for( var i = 0 ; i < _data.length; i++ )158 {159 if( _data[i]['error'] )160 write_msg(_data[i]['error'] );161 162 if( _data[i]['true'] )163 write_msg(_data[i]['true'] );164 }165 }166 167 153 if( arguments.length > 1 ) 168 154 { … … 176 162 _span.innerHTML = _input.value; 177 163 164 var _handlerRename = function(data) 165 { 166 var _data = unserialize( data ); 167 168 for( var i = 0 ; i < _data.length; i++ ) 169 { 170 if( _data[i]['error'] ) 171 { 172 // Remove Input 173 if( _input != null ) 174 _parent.removeChild( _input ); 175 176 // Add Span 177 if( _span != null ) 178 { 179 _parent.appendChild( _span ); 180 } 181 182 write_msg("ERROR : " + _data[i]['error'] ); 183 } 184 185 if( _data[i]['true'] ) 186 { 187 write_msg( _data[i]['true'] ); 188 toolbar.control('reload'); 189 } 190 } 191 } 192 178 193 if( _parent != null ) 179 194 { 180 // Remove Input181 if( _input != null )182 _parent.removeChild( _input );183 184 // Add Span185 if( _span != null )186 _parent.appendChild( _span );187 188 195 var url = './index.php?menuaction=filemanager.vfs_functions.rename'; 189 196 var params = 'file='+base64_encode(_input.id.substr(6))+'&to='+base64_encode(_input.value)+'&path='+base64_encode(currentPath);
Note: See TracChangeset
for help on using the changeset viewer.