Changeset 1704 for sandbox/filemanager/inc/class.uifilemanager.inc.php
- Timestamp:
- 11/24/09 16:07:27 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/filemanager/inc/class.uifilemanager.inc.php
r1694 r1704 585 585 $vars[quotaSize]='<input type="hidden" id="quotaSize" value="'.($quota*1024*1024).'">'; 586 586 $vars[path]='<input type="hidden" id="currentPath" value="'.$this->path.'">'; 587 $vars[css]='<script>initDrawApi();</script> 588 <link rel="stylesheet" type="text/css" href="filemanager/templates/default/main.css">'; 589 $vars[toolbar0]=$this->toolbar('location'); 590 $vars[toolbar1]=$this->toolbar('list_nav'); 587 $vars[css]='<link rel="stylesheet" type="text/css" href="filemanager/templates/default/main.css">'; 588 $vars[script]='<script>initDrawApi();</script>'; 589 590 // create dir and file button 591 if($this->can_add) 592 { 593 //TODO : create folder with problems 594 //$toolbar3.=$this->toolButton('newdir','createdir',lang('Create Folder')); 595 $vars[new_button]=$this->toolButton('new','createfile',lang('New...')); 596 $vars[new_button].='<input type="hidden" id="newfile_or_dir" name="newfile_or_dir" value="" />'; 597 } 598 else 599 $vars[new_button]=''; 600 601 // go up icon when we're not at the top, dont allow to go outside /home = fakebase 602 if($this->path != '/' && $this->path != $this->bo->fakebase) 603 { 604 $vars[tools_button] = $this->toolButton('tools','tools',lang('tools')); 605 } 606 else 607 $vars[tools_button] = ""; 608 609 // go home icon when we're not home already 610 /*if($this->path != $this->bo->homedir) 611 { 612 $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->lesspath); 613 614 $vars[up_button]=$this->toolButton($link,'up',lang('go up')); 615 616 $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->bo->homedir); 617 $toolbar.=$this->toolButton($link,'home',lang('go home')); 618 }*/ 619 620 // reload button with this url 621 $vars[refresh_button]=$this->toolButton('reload','reload',lang('reload')); 622 623 // selectbox for change/move/and copy to 624 $dirs=$this->all_other_directories_options(); 625 foreach($dirs as $elem) 626 $vars[folders].='<br><span onclick="load(\''.$elem['directory'].$elem['name'].'\')" class="l">'.$elem['name'].'</span>'; 627 628 //$this->toolButton('goto','goto',lang('Quick jump to')); 629 // selectbox for change/move/and copy to 630 // submit buttons for 631 // if($this->path != '/' && $this->path != $this->bo->fakebase) 632 633 if($this->can_edit) 634 { 635 // edit text file button 636 $toolbar.=$this->toolButton('edit','edit',lang('edit')); 637 } 638 639 if($this->can_edit) 640 { 641 $toolbar.=$this->toolButton('rename','rename',lang('Rename')); 642 } 643 644 if($this->can_delete) 645 { 646 $toolbar.=$this->toolButton('delete','delete',lang('Delete')); 647 } 648 649 650 651 // copy and move buttons 652 //if($this->path != '/' && $this->path != $this->bo->fakebase){} 653 654 $dirs=$this->all_other_directories_options(); 655 foreach($dirs as $dir) 656 if((($dir['directory'] . $dir['name']) != $this->path) && $this->bo->vfs->file_exists(array('string' => $dir['directory'] . $dir['name'],'relatives' => array(RELATIVE_NONE)))) 657 { 658 //FIXME replace the html_form_option function 659 $dirs_options .= $this->html_form_option($dir['directory'] . $dir['name'], $dir['directory'] . $dir['name']); 660 } 661 662 if (strlen($dirs_options) > 0){ 663 if ($this->can_read) 664 $toolbar.=$this->toolButton('copy_to','copy_to',lang('Copy to')); 665 if ($this->can_delete) 666 $toolbar.=$this->toolButton('move_to','move_to',lang('Move to')); 667 } 668 $toolbar.='<select name="todir" style="visibility:hidden">'.$dirs_options.'</select>'; 669 670 671 672 $vars[toolbar1]=$toolbar; 591 673 592 674 if(count($this->messages)>0) … … 629 711 } 630 712 631 $this->t->set_var('row_tr_c olor','#dedede');713 $this->t->set_var('row_tr_class','message_header'); 632 714 633 715 $this->t->parse('rows','row'); … … 661 743 } 662 744 663 $this->t->set_var('row_tr_c olor',$tr_color);745 $this->t->set_var('row_tr_class',''); 664 746 $this->t->parse('rows','row'); 665 747 $this->t->pparse('out','row'); … … 983 1065 // end file count 984 1066 } 985 986 function toolbar($type)987 {988 switch($type)989 {990 case 'location':991 $toolbar='992 <div id="fmLocation">993 <table cellspacing="10" cellpadding="0" border="0">994 <tr>995 ';996 // $toolbar.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('phpgwapi','buttonseparator').'" height="27" width="8"></td>';997 // $toolbar.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('filemanager','spacer').'" height="27" width="1"></td>';998 999 // go up icon when we're not at the top, dont allow to go outside /home = fakebase1000 if($this->path != '/' && $this->path != $this->bo->fakebase)1001 {1002 $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->lesspath);1003 $toolbar.=$this->linkButton($link,'up',lang('go up'));1004 }1005 1006 // go home icon when we're not home already1007 if($this->path != $this->bo->homedir)1008 {1009 $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->bo->homedir);1010 $toolbar.=$this->linkButton($link,'home',lang('go home'));1011 }1012 1013 // reload button with this url1014 $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->path);1015 $toolbar.=$this->linkButton($link,'reload',lang('reload'));1016 1017 $toolbar.='<td>'.lang('Location').': ';1018 //$toolbar.='<input id="fmInputLocation" type="text" size="20" disabled="disabled" name="location" value="'.$this->disppath.'"/> ';1019 $current_option='<option>'.$this->disppath.'</option>';1020 // selectbox for change/move/and copy to1021 $dirs_options=$this->all_other_directories_options();1022 $toolbar.='<select id="cdtodir" name="cdtodir" onChange="document.formfm.changedir.value=\'true\';document.formfm.submit()">'.$current_option.$dirs_options.'</select>1023 <input type="hidden" name="changedir" value="false"></td>1024 ';1025 //$toolbar.=$this->inputImage('goto','goto',lang('Quick jump to'));1026 // upload button1027 /*if($this->path != '/' && $this->path != $this->bo->fakebase && $this->can_add)1028 {1029 // upload button1030 $toolbar.=$this->inputImage('upload','upload',lang('Upload'));1031 1032 1033 }*/1034 $toolbar.='</tr></table>';1035 $toolbar.='</div><br><br>';1036 break;1037 case 'list_nav':1038 $toolbar='1039 <table cellspacing="10" cellpadding="0" border="0">1040 <tr>';1041 // selectbox for change/move/and copy to1042 // submit buttons for1043 if($this->path != '/' && $this->path != $this->bo->fakebase)1044 {1045 // create dir and file button1046 if($this->can_add)1047 {1048 $toolbar.='<td><input type="hidden" id="newfile_or_dir" name="newfile_or_dir" value="" /></td>';1049 //TODO : create folder with problems1050 //$toolbar3.=$this->inputImage('newdir','createdir',lang('Create Folder'));1051 $toolbar.=$this->inputImage('new','createfile',lang('New...'));1052 }1053 1054 if($this->can_edit)1055 {1056 // edit text file button1057 $toolbar.=$this->inputImage('edit','edit',lang('edit'));1058 }1059 1060 if($this->can_edit)1061 {1062 $toolbar.=$this->inputImage('rename','rename',lang('Rename'));1063 }1064 1065 if($this->can_delete)1066 {1067 $toolbar.=$this->inputImage('delete','delete',lang('Delete'));1068 }1069 1070 }1071 1072 // copy and move buttons1073 if($this->path != '/' && $this->path != $this->bo->fakebase)1074 {1075 $dirs_options=$this->all_other_directories_options();1076 if (strlen($dirs_options) > 0){1077 $toolbar3.=$this->inputImage('copy_to','copy_to',lang('Copy to'));1078 if ($this->can_delete)1079 $toolbar3.=$this->inputImage('move_to','move_to',lang('Move to'));1080 }1081 $toolbar3.='<td><select name="todir" style="visibility:hidden">'.$dirs_options.'</select></td>';1082 1083 }1084 1085 if($toolbar3)1086 {1087 $toolbar.=$toolbar3;1088 /* $toolbar.='1089 <table cellspacing="1" cellpadding="0" border="0">1090 <tr>'.$toolbar3;*/1091 }1092 $toolbar.='</tr></table>';1093 1094 break;1095 default:$x='';1096 }1097 1098 if($toolbar)1099 {1100 return $toolbar;1101 }1102 }1103 1104 1067 1105 1068 # Handle Moving Files and Directories … … 1648 1611 } 1649 1612 } 1650 1651 1613 reset($dirs); 1652 1614 while(list($num, $dir) = each($dirs)) … … 1662 1624 $dir['directory'] .= '/'; 1663 1625 } 1664 1665 # No point in displaying the current directory, or a directory that doesn't exist 1666 if((($dir['directory'] . $dir['name']) != $this->path) && $this->bo->vfs->file_exists(array('string' => $dir['directory'] . $dir['name'],'relatives' => array(RELATIVE_NONE)))) 1667 { 1668 //FIXME replace the html_form_option function 1669 $options .= $this->html_form_option($dir['directory'] . $dir['name'], $dir['directory'] . $dir['name']); 1670 } 1671 } 1672 1673 return $options; 1626 $return[] = $dir; 1627 } 1628 return $return; 1674 1629 } 1675 1630 … … 1688 1643 } 1689 1644 1690 function linkButton($link,$img='',$description='')1645 function toolButton($link,$img='',$description='') 1691 1646 { 1692 1647 $image=$GLOBALS['phpgw']->common->image('filemanager','button_'.strtolower($img)); … … 1694 1649 if($img) 1695 1650 { 1696 return '<td class="" align="center" valign="middle" height="28" width="70"> 1697 <a href="'.$link.'" title="'.$description.'"><img src="'.$image.'" alt="'.$description.'"/></a><br><small>'.$description.'</small> 1698 </td>'; 1651 return '<span name="'.$link.'" class="toolButton" onclick="toolbar_control(\''.$link.'\');" title="'.$description.'"><img src="'.$image.'" alt="'.$description.'"/></a><small>'.$description.'</small></span>'; 1699 1652 } 1700 1653 } … … 1711 1664 } 1712 1665 } 1713 function inputImage($name,$img='',$description='')1714 {1715 $image=$GLOBALS['phpgw']->common->image('filemanager','button_'.strtolower($img));1716 1717 if($img)1718 {1719 return '<td class="" align="center" valign="middle" height="28" width="70">1720 <img onClick="toolbar_control(\''.$name.'\')" title="'.$description.'" name="'.$name.'" alt="'.$name.'" src="'.$image.'" /><br><small>'.$description.'</small>1721 </td>';1722 }1723 }1724 1725 1666 1726 1667
Note: See TracChangeset
for help on using the changeset viewer.