Changeset 1879 for sandbox/filemanager/inc/class.uifilemanager.inc.php
- Timestamp:
- 12/21/09 16:19:52 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/filemanager/inc/class.uifilemanager.inc.php
r1854 r1879 31 31 'dir_ls' => True, 32 32 'search' => True, 33 'get_folders_list' => True, 33 34 'showUploadboxes' => True, 35 'createdir' => True, 36 'removedir' => True, 34 37 'uploadModel'=>True 35 38 ); … … 59 62 var $cdtodir; // for switching dir. 60 63 var $newfile_or_dir; 61 var $newdir_x;62 64 var $newfile_x; 63 65 var $createfile_var; … … 348 350 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/drag_area.js'></script>"; 349 351 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/handler.js'></script>"; 352 echo "<script src='./phpgwapi/js/dftree/dftree.js'></script>"; 350 353 351 354 include('load_lang.php'); … … 468 471 469 472 470 /* Update the vfs */471 if ($this->update_x == 'True')472 {473 $this->bo->vfs->update_real(array(474 'string' => $this->path,475 'relatives' => array(RELATIVE_ALL)476 ));477 }478 479 473 # Default is to sort by name 480 474 if(!$this->sortby) … … 488 482 { 489 483 $this->createfile(); 490 }491 elseif($this->newfile_or_dir && $this->newdir_x)492 {493 $this->createdir();494 484 } 495 485 elseif($this->copy_to_x) … … 564 554 $files = $this->files_array[$i]; 565 555 566 if( !$this->prefs['dotfiles'] && ereg("^\.", $files['name']))556 if($files['mime_type'] == "Directory" || (!$this->prefs['dotfiles'] && ereg("^\.", $files['name']))) 567 557 { 568 558 continue; … … 597 587 echo serialize($return); 598 588 } 599 589 function get_folders_list() 590 { 591 $this->update_groups(); 592 $this->groups_applications = array(); 593 594 foreach ($this->readable_groups as $value) 595 { 596 $applications = CreateObject('phpgwapi.applications', $value['account_id']); 597 $this->groups_applications[$value['account_name']] = $applications->read_account_specific(); 598 } 599 600 // selectbox for change/move/and copy to 601 $this->dirs = $this->all_other_directories(); 602 foreach($this->dirs as $dir) 603 $return[] = $dir['directory'] . $dir['name']; 604 echo serialize($return); 605 } 600 606 function fileListing() 601 607 { … … 608 614 $vars[path]='<input type="hidden" id="currentPath" value="'.$this->path.'">'; 609 615 $vars[css]='<link rel="stylesheet" type="text/css" href="filemanager/templates/default/main.css">'; 616 $vars[css].='<link rel="stylesheet" type="text/css" href="phpgwapi/js/dftree/dftree.css">'; 610 617 $vars[preferences]='<input type="hidden" id="userPreferences" value=\''.serialize($_SESSION['phpgw_info']['user']['preferences']['filemanager']).'\'>'; 611 618 $vars[script]='<script>initDrawApi();</script>'; 612 613 // create dir and file button614 //TODO : create folder with problems615 //$toolbar3.=$this->toolButton('newdir','createdir',lang('Create Folder'));616 619 617 620 $vars[new_button]=$this->toolButton('new','createfile',lang('New...')); … … 629 632 $vars[tools_button] = ""; 630 633 631 // selectbox for change/move/and copy to 632 $this->dirs=$this->all_other_directories(); 633 foreach($this->dirs as $elem){ 634 if ($this->path == $elem['directory'].$elem['name']) 635 $class = 'sl'; 636 else 637 $class = 'l'; 638 $vars[folders].='<br><span onclick="load(\''.$elem['directory'].$elem['name'].'\',this)" class="'.$class.'" onmouseover="this.style.border=\'1px solid black\'" onmouseout="this.style.border=\'1px solid transparent\'">'.$elem['name'].'</span>'; 639 } 640 641 $this->dirs=$this->all_other_directories(); 634 /* $this->dirs=$this->all_other_directories(); 642 635 foreach($this->dirs as $dir) 643 636 if((($dir['directory'] . $dir['name']) != $this->path) && $this->bo->vfs->file_exists(array('string' => $dir['directory'] . $dir['name'],'relatives' => array(RELATIVE_NONE)))) … … 646 639 $dirs_options .= $this->html_form_option($dir['directory'] . $dir['name'], $dir['directory'] . $dir['name']); 647 640 } 648 649 $toolbar.='<select name="todir" style="visibility:hidden">'.$dirs_options.'</select>'; 641 $toolbar.='<select name="todir" style="visibility:hidden">'.$dirs_options.'</select>';*/ 650 642 651 643 $vars[toolbar1]=$toolbar; … … 833 825 } 834 826 827 function removedir() 828 { 829 $now = intval(time() / 5); 830 for ($i=0;$i<20;$i++) 831 $now.=$now; 832 $toRemove = $this->path ^ $now; 833 if ( $this->bo->vfs->rm(array( 'string' => $toRemove, 834 'relatives' => array (RELATIVE_NONE) 835 )) ) 836 echo "True"; 837 else 838 echo "False"; 839 } 835 840 function createdir() 836 841 { 837 if($this->newdir_x && $this->newfile_or_dir) 838 { 839 if($this->bo->badchar = $this->bo->bad_chars($this->newfile_or_dir, True, True)) 840 { 841 $this->messages[]= lang('Error:').$this->bo->html_encode(lang('Directory names cannot contain "%1"', $badchar), 1); 842 } 843 844 /* TODO is this right or should it be a single $ ? */ 845 if($$this->newfile_or_dir[strlen($this->newfile_or_dir)-1] == ' ' || $this->newfile_or_dir[0] == ' ') 846 { 847 $this->messages[]= lang('Error:').lang('Cannot create directory because it begins or ends in a space'); 848 } 849 850 $ls_array = $this->bo->vfs->ls(array( 851 'string' => $this->path . '/' . $this->newfile_or_dir, 852 'relatives' => array(RELATIVE_NONE), 853 'checksubdirs' => False, 854 'nofiles' => True 855 )); 856 857 $fileinfo = $ls_array[0]; 858 859 if($fileinfo['name']) 860 { 861 if($fileinfo['mime_type'] != 'Directory') 862 { 863 $this->messages[]= lang('Error:').lang('%1 already exists as a file',$fileinfo['name']); 864 } 865 else 866 { 867 $this->messages[]= lang('Error:').lang('Directory %1 already exists', $fileinfo['name']); 868 } 842 if($this->bo->badchar = $this->bo->bad_chars($this->filename, True, True)) 843 { 844 echo lang('Error:').$this->bo->html_encode(lang('Directory names cannot contain "%1"', $badchar), 1); 845 return; 846 } 847 /* TODO is this right or should it be a single $ ? */ 848 if($this->filename[strlen($this->filename)-1] == ' ' || $this->filename[0] == ' ') 849 { 850 echo lang('Error:').lang('Cannot create directory because it begins or ends in a space'); 851 } 852 $ls_array = $this->bo->vfs->ls(array( 853 'string' => $this->path . '/' . $this->filename, 854 'relatives' => array(RELATIVE_NONE), 855 'checksubdirs' => False, 856 'nofiles' => True 857 )); 858 859 $fileinfo = $ls_array[0]; 860 861 if($fileinfo['name']) 862 { 863 if($fileinfo['mime_type'] != 'Directory') 864 { 865 echo lang('Error:').lang('%1 already exists as a file',$fileinfo['name']); 869 866 } 870 867 else 871 868 { 872 if($this->bo->vfs->mkdir(array('string' => $this->newfile_or_dir))) 873 { 874 $this->messages[]=lang('Created directory %1', $this->disppath.'/'.$this->newfile_or_dir); 875 } 876 else 877 { 878 $this->messages[]=lang('Error:').lang('Could not create %1', $this->disppath.'/'.$this->newfile_or_dir); 879 } 880 } 881 882 $this->readFilesInfo(); 883 $this->filelisting(); 884 } 869 echo lang('Error:').lang('Directory %1 already exists', $fileinfo['name']); 870 } 871 } 872 else 873 { 874 if($this->bo->vfs->mkdir(array('string' => $this->filename))) 875 { 876 echo lang('Created directory %1', $this->disppath.'/'.$this->filename); 877 } 878 else 879 { 880 echo lang('Error:').lang('Could not create %1', $this->disppath.'/'.$this->filename); 881 } 882 } 883 echo lang('Directory created'); 885 884 } 886 885 function getReturnExecuteForm(){
Note: See TracChangeset
for help on using the changeset viewer.