Changeset 1627
- Timestamp:
- 11/12/09 09:06:56 (14 years ago)
- Files:
-
- 829 added
- 2 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/filemanager/inc/class.uifilemanager.inc.php
r1592 r1627 27 27 'history' => True, 28 28 'edit' => True, 29 'download'=>True 29 'fileModels'=>True, 30 'uploadModel'=>True 30 31 ); 31 32 32 33 //keep 33 34 var $bo; 35 var $vfs_functions; 34 36 var $t; //template object 35 37 var $dispath; … … 51 53 var $current_config; 52 54 var $goto_x; 53 var $download_x;54 55 var $todir; 55 56 var $changedir; // for switching dir. … … 64 65 var $rename_x; 65 66 var $move_to_x; 66 67 // var $copy_to; 67 68 var $copy_to_x; 68 69 var $edit_x; … … 98 99 $this->bo = CreateObject('filemanager.bofilemanager'); 99 100 101 $this->vfs_functions = CreateObject('filemanager.vfs_functions'); 102 100 103 $this->t = $GLOBALS['phpgw']->template; 101 104 $c = CreateObject('phpgwapi.config','filemanager'); … … 115 118 { 116 119 $$name = $GLOBALS['HTTP_GET_VARS'][$name]; 120 $this->$name = $GLOBALS['HTTP_GET_VARS'][$name]; 121 117 122 } 118 123 … … 221 226 else 222 227 { 223 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array( 224 lang('Fake Base Dir did not exist, eGroupWare created a new one.') 225 )); 228 $this->messages[]= lang('Fake Base Dir did not exist, eGroupWare created a new one.'); 226 229 } 227 230 } … … 237 240 'relatives' => array(RELATIVE_NONE) 238 241 )); 239 242 $this->bo->vfs->set_quota(array( 243 'string' => $this->bo->homedir, 244 'relatives' => array(RELATIVE_NONE), 245 'new_quota' => $this->current_config['filemanager_quota_size'] 246 )); 247 240 248 $this->bo->vfs->override_acl = 0; 241 249 … … 249 257 else 250 258 { 251 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array( 252 lang('Your Home Dir did not exist, eGroupWare created a new one.') 253 )); 259 $this->messages[]= lang('Your Home Dir did not exist, eGroupWare created a new one.'); 254 260 // FIXME we just created a fresh home dir so we know there nothing in it so we have to remove all existing content 255 261 } … … 258 264 259 265 } 260 266 function fileModels() 267 { 268 $GLOBALS['phpgw_info']['flags'] = array 269 ( 270 'currentapp' => 'filemanager', 271 'noheader' => False, 272 'nonavbar' => False, 273 'nofooter' => False, 274 'noappheader' => False, 275 'enable_browser_class' => True 276 ); 277 278 $GLOBALS['phpgw']->common->phpgw_header(); 279 $this->t->set_file(array('models' => 'fileModels.tpl')); 280 $this->t->set_block('models','header','header'); 281 $this->t->set_block('models','body','body'); 282 $this->t->set_block('models','footer','footer'); 283 $this->t->set_var('url_1', './index.php?menuaction=filemanager.uifilemanager.uploadModel&model=article'); 284 $this->t->set_var('model_1','article'); 285 $this->t->set_var('lang_1',lang('article')); 286 287 $this->t->set_var('url_2','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=calendar'); 288 $this->t->set_var('model_2','calendar'); 289 $this->t->set_var('lang_2',lang('calendar')); 290 291 $this->t->set_var('url_3','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=todo'); 292 $this->t->set_var('model_3','todo'); 293 $this->t->set_var('lang_3',lang('todo')); 294 295 $this->t->set_var('url_4','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=slide'); 296 $this->t->set_var('model_4','slide'); 297 $this->t->set_var('lang_4',lang('slide')); 298 299 $this->t->set_var('url_5','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=cards'); 300 $this->t->set_var('model_5','cards'); 301 $this->t->set_var('lang_5',lang('cards')); 302 303 $this->t->set_var('url_6','./index.php?menuaction=filemanager.uifilemanager.uploadModel&model=resume'); 304 $this->t->set_var('model_6','resume'); 305 $this->t->set_var('lang_6',lang('resume')); 306 307 308 $this->t->pparse('out','models'); 309 310 311 } 312 function uploadModel(){ 313 $GLOBALS['phpgw_info']['flags'] = array 314 ( 315 'currentapp' => 'filemanager', 316 'noheader' => False, 317 'nonavbar' => False, 318 'nofooter' => False, 319 'noappheader' => False, 320 'enable_browser_class' => True 321 ); 322 323 $GLOBALS['phpgw']->common->phpgw_header(); 324 325 $filename = lang('new')."_".lang($this->model).rand(0,1000).".html"; 326 $this->bo->vfs->cp(array( 327 'from'=> PHPGW_SERVER_ROOT . '/filemanager/templates/default/'.$this->model.'.html', 328 'to'=> $filename, 329 'relatives' => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) 330 )); 331 332 $this->bo->vfs->set_attributes(array( 333 'string'=> $filename, 334 'relatives' => array(RELATIVE_ALL), 335 'attributes'=> array( 336 'mime_type' => "text/html", 337 'comment' => "" 338 ) 339 )); 340 $this->fileman[0] = $filename; 341 $this->edit(); 342 343 } 261 344 function index() 262 345 { 263 if($noheader || $nofooter || ( $this->download_x && (count($this->fileman) > 0)))346 if($noheader || $nofooter || (count($this->fileman) > 0)) 264 347 { 265 348 $noheader = True; … … 400 483 if($this->path != $this->bo->homedir && $this->path != $this->bo->fakebase && $this->path != '/' && !$this->bo->vfs->acl_check(array('string' => $this->path, 'relatives' => array(RELATIVE_NONE),'operation' => PHPGW_ACL_READ))) 401 484 { 402 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array(lang('You do not have access to %1', $this->path)));485 $this->messages[]= lang('Error:').lang('You do not have access to %1', $this->path); 403 486 $this->html_link('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->homedir, lang('Go to your home directory')); 404 487 … … 445 528 ))) 446 529 { 447 $this->messages[] = $GLOBALS['phpgw']->common->error_list(array(lang('Directory %1 does not exist', $this->path)));530 $this->messages[] = lang('Error:').lang('Directory %1 does not exist', $this->path); 448 531 $this->html_link('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->bo->homedir, lang('Go to your home directory')); 449 532 … … 527 610 $this->moveTo(); 528 611 } 529 elseif($this->download_x)530 {531 $this->download();532 }533 612 elseif($this->renamefiles) 534 613 { … … 557 636 $this->fileListing(); 558 637 } 559 }560 // String format is YYYY-MM-DD HH:MM561 function dateString2timeStamp($string){562 return mktime($string[11].$string[12],563 $string[14].$string[15],564 $string[17].$string[18],565 $string[5].$string[6],566 $string[8].$string[9],567 $string[0].$string[1].568 $string[2].$string[3]);569 638 } 570 639 function fileListing() … … 587 656 } 588 657 $columns++; 589 $vars[usedSpace]='<input type="hidden" id="usedSpace" value="'.round(($this->usedSpace()/1024)/1024).'">'; 590 $vars[quotaSize]='<input type="hidden" id="quotaSize" value="'.$this->current_config['filemanager_quota_size'].'">'; 591 $vars[javascript]='<script src="filemanager/js/draw_api.js"></script>'; 658 $usedSpace = $this->bo->vfs->get_size(array( 659 'string' => $this->path, 660 'relatives' => array(RELATIVE_NONE) 661 )); 662 $quota = $this->bo->vfs->get_quota(array( 663 'string' => $this->path 664 )); 665 666 $vars[usedSpace]='<input type="hidden" id="usedSpace" value="'.$usedSpace.'">'; 667 $vars[quotaSize]='<input type="hidden" id="quotaSize" value="'.($quota*1024*1024).'">'; 668 $vars[javascript]='<script src="filemanager/js/draw_api.js"></script> 669 <link rel="stylesheet" type="text/css" href="filemanager/templates/default/main.css">'; 592 670 $vars[toolbar0]=$this->toolbar('location'); 593 671 $vars[toolbar1]=$this->toolbar('list_nav'); … … 611 689 ### 612 690 $this->t->set_var('actions',lang('select')); 691 $this->t->set_var('mini_bar',' '); 692 613 693 614 694 reset($this->bo->file_attributes); … … 717 797 $this->t->set_var('actions',''); 718 798 } 799 $minibar_data=""; 800 if($this->path == $this->bo->homedir) 801 { 802 if ($files['type'] == "1") 803 { 804 $image = $GLOBALS['phpgw']->common->image('filemanager','button_lock'); 805 } 806 else 807 { 808 $image = $GLOBALS['phpgw']->common->image('filemanager','button_unlock'); 809 } 810 $link=$this->encode_href('/index.php','menuaction=filemanager.vfs_functions.setRestricted','file='.$files['name'].'&path='.$this->path); 811 $minibar_data = '<img id="restrict_'.$files['name'].'" onclick="javascript:cExecute(\''.$link.'\',setRestricted)" alt="'.lang("mark as restricted").'" title="'.lang("mark as restricted").'" src="'.$image.'">'; 812 } 813 814 815 if ($files['mime_type'] == "text/html") 816 { 817 $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.export','file='.$files['name'].'&path='.$this->path); 818 $image=$GLOBALS['phpgw']->common->image('filemanager','button_export'); 819 $minibar_data.='<a href="'.$link.'"><img alt="'.lang("export").'" title="'.lang("export").'" src="'.$image.'"></a>'; 820 } 821 else 822 $minibar_data.= "<a> </a>"; 823 $this->t->set_var('mini_bar',$minibar_data); 824 719 825 720 826 # File name and icon … … 755 861 756 862 $col_data='<a href="'.$link.'" target="'.$this->target.'">'.$icon.'</a> <a href="'.$link.'" target="'.$this->target.'">'.$files['name'].'</a>'; 757 if ($files['mime_type'] == "text/html")758 {759 $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.export','file='.$files['name'].'&path='.$this->path);760 $image=$GLOBALS['phpgw']->common->image('filemanager','button_export');761 $col_data.='<a href="'.$link.'"><img alt="'.lang("export").'" title="'.lang("export").'" src="'.$image.'"></a>';762 }763 863 } 764 864 } … … 796 896 if($this->prefs['created']) 797 897 { 798 $timestamp = $this-> dateString2timeStamp($files['created']);898 $timestamp = $this->vfs_functions->dateString2timeStamp($files['created']); 799 899 if (time() - $timestamp > 86400) // Older than yesterday 800 900 $col_data=date("Y-m-d",$timestamp); … … 809 909 { 810 910 if ($files['modified'] != ''){ 811 $timestamp = $this-> dateString2timeStamp($files['modified']);911 $timestamp = $this->vfs_functions->dateString2timeStamp($files['modified']); 812 912 if (time() - $timestamp > 86400) // Older than yesterday 813 913 $col_data=date("Y-m-d",$timestamp); … … 957 1057 'nofiles' => True 958 1058 )); 1059 959 1060 $this->files_array[] = $ls_array[0]; 960 1061 $this->numoffiles++; … … 1063 1164 // selectbox for change/move/and copy to 1064 1165 $dirs_options=$this->all_other_directories_options(); 1065 $toolbar.='<select name="cdtodir" onChange="document.formfm.changedir.value=\'true\';document.formfm.submit()">'.$current_option.$dirs_options.'</select>1166 $toolbar.='<select id="cdtodir" name="cdtodir" onChange="document.formfm.changedir.value=\'true\';document.formfm.submit()">'.$current_option.$dirs_options.'</select> 1066 1167 <input type="hidden" name="changedir" value="false"></td> 1067 1168 '; 1068 1169 //$toolbar.=$this->inputImage('goto','goto',lang('Quick jump to')); 1069 1170 // upload button 1070 if($this->path != '/' && $this->path != $this->bo->fakebase && $this->can_add)1171 /*if($this->path != '/' && $this->path != $this->bo->fakebase && $this->can_add) 1071 1172 { 1072 1173 // upload button 1073 $total = ($this->current_config['filemanager_quota_size'])*1024*1024; 1074 $usedSpace = $this->usedSpace(); 1075 if ($usedSpace < $total) 1076 $toolbar.=$this->inputImage('upload','upload',lang('Upload')); 1174 $toolbar.=$this->inputImage('upload','upload',lang('Upload')); 1077 1175 1078 1176 1079 } 1177 }*/ 1080 1178 $toolbar.='</tr></table>'; 1081 1179 $toolbar.='</div><br><br>'; … … 1091 1189 //$toolbar.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('phpgwapi','buttonseparator').'" height="27" width="8"></td>'; 1092 1190 //$toolbar.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('filemanager','spacer').'" height="27" width="1"></td>'; 1191 // create dir and file button 1192 if($this->can_add) 1193 { 1194 //$toolbar3.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('phpgwapi','buttonseparator').'" height="27" width="8"></td>'; 1195 //$toolbar3.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('filemanager','spacer').'" height="27" width="1"></td>'; 1196 1197 $toolbar.='<td><input type="hidden" id="newfile_or_dir" name="newfile_or_dir" value="" /></td>'; 1198 $toolbar.='<div onclick="alert(\'asdf\')">'; 1199 //TODO : create folder with problems 1200 //$toolbar3.=$this->inputImage('newdir','createdir',lang('Create Folder')); 1201 $toolbar.=$this->inputImage('new','createfile',lang('New...')); 1202 $toolbar.='</div>'; 1203 } 1093 1204 1094 1205 if(!$this->rename_x && !$this->edit_comments_x && $this->can_edit) … … 1113 1224 $toolbar.=$this->inputImage('edit_comments','edit_comments',lang('Edit comments')); 1114 1225 } 1115 $toolbar.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('filemanager','spacer').'" height="27" width="1"></td>'; 1226 1116 1227 } 1117 1228 … … 1122 1233 if($this->path != '/' && $this->path != $this->bo->fakebase) 1123 1234 { 1124 //$toolbar3.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('phpgwapi','buttonseparator').'" height="27" width="8"></td>';1125 //$toolbar3.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('filemanager','spacer').'" height="27" width="1"></td>';1126 1127 1235 $dirs_options=$this->all_other_directories_options(); 1128 1129 $toolbar3.=$this->inputImage('copy_to','copy_to',lang('Copy to')); 1130 if ($this->can_delete) 1131 $toolbar3.=$this->inputImage('move_to','move_to',lang('Move to')); 1132 $toolbar3.='<td><select name="todir"><option value="">'.lang('select a folder').'</option>'.$dirs_options.'</select></td>'; 1133 1134 $toolbar3.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('filemanager','spacer').'" height="27" width="1"></td>'; 1135 1136 } 1137 1138 // create dir and file button 1139 if($this->path != '/' && $this->path != $this->bo->fakebase && $this->can_add) 1140 { 1141 //$toolbar3.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('phpgwapi','buttonseparator').'" height="27" width="8"></td>'; 1142 //$toolbar3.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('filemanager','spacer').'" height="27" width="1"></td>'; 1143 1144 $toolbar3.='<td><input type="hidden" id="newfile_or_dir" name="newfile_or_dir" value="" /></td>'; 1145 $toolbar3.='<div onclick="alert(\'asdf\')">'; 1146 //TODO : create folder with problems 1147 //$toolbar3.=$this->inputImage('newdir','createdir',lang('Create Folder')); 1148 $toolbar3.=$this->inputImage('newfile','createfile',lang('Create File')); 1149 $toolbar3.='</div>'; 1236 if (strlen($dirs_options) > 0){ 1237 $toolbar3.=$this->inputImage('copy_to','copy_to',lang('Copy to')); 1238 if ($this->can_delete) 1239 $toolbar3.=$this->inputImage('move_to','move_to',lang('Move to')); 1240 } 1241 $toolbar3.='<td><select name="todir" style="visibility:hidden">'.$dirs_options.'</select></td>'; 1242 1150 1243 } 1151 1244 … … 1171 1264 1172 1265 1173 function usedSpace(){1174 for($i = 0; $i != $this->numoffiles; $i++)1175 $usedspace += $this->files_array[$i]['size'];1176 return $usedspace;1177 }1178 1179 1266 // move to bo 1180 1267 # Handle File Uploads 1181 1268 function fileUpload() 1182 1269 { 1183 if ($this->usedSpace() > ($this->current_config['filemanager_quota_size'])*1024*1024)1184 echo lang('You exceded the quota');1185 else1186 1270 if($this->path != '/' && $this->path != $this->bo->fakebase) 1187 1271 { … … 1190 1274 if($badchar = $this->bo->bad_chars($_FILES['upload_file']['name'][$i], True, True)) 1191 1275 { 1192 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array($this->bo->html_encode(lang('File names cannot contain "%1"', $badchar), 1)));1276 $this->messages[]=lang('Error:').lang('File names cannot contain "%1"', $badchar); 1193 1277 1194 1278 continue; … … 1209 1293 if($fileinfo['mime_type'] == 'Directory') 1210 1294 { 1211 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array(lang('Cannot replace %1 because it is a directory', $fileinfo['name'])));1295 $this->messages[]= lang('Error:').lang('Cannot replace %1 because it is a directory', $fileinfo['name']); 1212 1296 continue; 1213 1297 } … … 1247 1331 $tmp_arr=array( 1248 1332 'from' => $_FILES['upload_file']['tmp_name'][$i], 1249 'to' => $_FILES['upload_file']['name'][$i],1333 'to' => lang('new')."_".$_FILES['upload_file']['name'][$i], 1250 1334 'relatives' => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) 1251 1335 ); 1252 1336 $this->bo->vfs->cp($tmp_arr); 1253 1337 1254 $this->messages[]=lang(' Replaced%1', $this->disppath.'/'.$_FILES['upload_file']['name'][$i]);1338 $this->messages[]=lang('Created new %1', $this->disppath.'/'.$_FILES['upload_file']['name'][$i]); 1255 1339 } 1256 1340 else … … 1299 1383 } 1300 1384 } 1301 1302 1385 # Handle Editing comments 1303 1386 function editComment() … … 1307 1390 if($badchar = $this->bo->bad_chars($this->comment_files[$file], False, True)) 1308 1391 { 1309 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array($file . $this->bo->html_encode(': ' . lang('Comments cannot contain "%1"', $badchar), 1)));1392 $this->messages[]=lang('Error:').$this->bo->html_encode(': ' . lang('Comments cannot contain "%1"', $badchar), 1); 1310 1393 continue; 1311 1394 } … … 1333 1416 if($badchar = $this->bo->bad_chars($to, True, True)) 1334 1417 { 1335 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array($this->bo->html_encode(lang('File names cannot contain "%1"', $badchar), 1)));1418 $this->messages[]=lang('Error:').$this->bo->html_encode(lang('File names cannot contain "%1"', $badchar), 1); 1336 1419 continue; 1337 1420 } … … 1339 1422 if(ereg("/", $to) || ereg("\\\\", $to)) 1340 1423 { 1341 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array(lang("File names cannot contain \\ or /")));1342 } 1343 elseif($this->v erifyLock($from,RELATIVE_ALL) && $this->bo->vfs->mv(array(1424 $this->messages[]=lang('Error:').lang("File names cannot contain \\ or /"); 1425 } 1426 elseif($this->vfs_functions->verifyLock($from,RELATIVE_ALL) && $this->bo->vfs->mv(array( 1344 1427 'from' => $from, 1345 1428 'to' => $to … … 1350 1433 else 1351 1434 { 1352 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array(lang('Could not rename %1 to %2', $this->disppath.'/'.$from, $this->disppath.'/'.$to)));1435 $this->messages[]= lang('Error:').lang('Could not rename %1 to %2', $this->disppath.'/'.$from, $this->disppath.'/'.$to); 1353 1436 } 1354 1437 } … … 1362 1445 if(!$this->todir) 1363 1446 { 1364 $this->messages[] = $GLOBALS['phpgw']->common->error_list(array(lang('Could not move file because no destination directory is given ', $this->disppath.'/'.$file)));1447 $this->messages[] = lang('Error:').lang('Could not move file because no destination directory is given ', $this->disppath.'/'.$file); 1365 1448 1366 1449 } … … 1381 1464 else 1382 1465 { 1383 $this->messages[] = $GLOBALS['phpgw']->common->error_list(array(lang('Could not move %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file)));1466 $this->messages[] = lang('Error:').lang('Could not move %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file); 1384 1467 } 1385 1468 } … … 1400 1483 if(!$this->todir) 1401 1484 { 1402 $this->messages[] = $GLOBALS['phpgw']->common->error_list(array(lang('Could not copy file because no destination directory is given ', $this->disppath.'/'.$file)));1485 $this->messages[] = lang('Error:').lang('Could not copy file because no destination directory is given ', $this->disppath.'/'.$file); 1403 1486 1404 1487 } … … 1437 1520 if($this->bo->badchar = $this->bo->bad_chars($this->newfile_or_dir, True, True)) 1438 1521 { 1439 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array($this->bo->html_encode(lang('Directory names cannot contain "%1"', $badchar), 1)));1522 $this->messages[]= lang('Error:').$this->bo->html_encode(lang('Directory names cannot contain "%1"', $badchar), 1); 1440 1523 } 1441 1524 … … 1443 1526 if($$this->newfile_or_dir[strlen($this->newfile_or_dir)-1] == ' ' || $this->newfile_or_dir[0] == ' ') 1444 1527 { 1445 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array(lang('Cannot create directory because it begins or ends in a space')));1528 $this->messages[]= lang('Error:').lang('Cannot create directory because it begins or ends in a space'); 1446 1529 } 1447 1530 … … 1459 1542 if($fileinfo['mime_type'] != 'Directory') 1460 1543 { 1461 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array( 1462 lang('%1 already exists as a file', 1463 $fileinfo['name']) 1464 )); 1544 $this->messages[]= lang('Error:').lang('%1 already exists as a file',$fileinfo['name']); 1465 1545 } 1466 1546 else 1467 1547 { 1468 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array(lang('Directory %1 already exists', $fileinfo['name'])));1548 $this->messages[]= lang('Error:').lang('Directory %1 already exists', $fileinfo['name']); 1469 1549 } 1470 1550 } … … 1477 1557 else 1478 1558 { 1479 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array(lang('Could not create %1', $this->disppath.'/'.$this->newfile_or_dir)));1559 $this->messages[]=lang('Error:').lang('Could not create %1', $this->disppath.'/'.$this->newfile_or_dir); 1480 1560 } 1481 1561 } … … 1485 1565 } 1486 1566 } 1487 function verifyLock($file,$relative){ 1488 $ls_array = $this->bo->vfs->ls(array( 1489 'string' => $file, 1490 'relatives' => array($relative), 1491 'checksubdirs' => False, 1492 'nofiles' => True 1493 )); 1494 $timestamp = $this->dateString2timeStamp($ls_array[0]['modified']); 1495 if (time() - $timestamp < 60 && $ls_array[0]['modifiedby_id'] != $GLOBALS['phpgw_info']['user']['account_id']) // recently than last minute: someone is editing 1496 { 1497 $this->messages[]=$GLOBALS['phpgw']->common->error_list(array(lang('This file is being edited right now by:').$GLOBALS['phpgw']->accounts->id2name($ls_array[0]['modifiedby_id']))); 1498 return False; 1499 1567 function delete() 1568 { 1569 if( is_array($this->fileman) && count($this->fileman) >= 1) 1570 { 1571 foreach($this->fileman as $filename) 1572 { 1573 if($this->vfs_functions->verifyLock($filename,RELATIVE_ALL) && $this->bo->vfs->delete(array('string' => $filename))) 1574 { 1575 $this->messages[]= lang('Deleted %1', $this->disppath.'/'.$filename).'<br/>'; 1576 } 1577 else 1578 { 1579 $this->messages[]=lang('Error:').lang('Could not delete %1', $this->disppath.'/'.$filename); 1580 } 1581 } 1500 1582 } 1501 1583 else 1502 return True;1503 }1504 function delete()1505 {1506 if( is_array($this->fileman) && count($this->fileman) >= 1)1507 {1508 foreach($this->fileman as $filename)1509 {1510 if($this->verifyLock($filename,RELATIVE_ALL) && $this->bo->vfs->delete(array('string' => $filename)))1511 {1512 $this->messages[]= lang('Deleted %1', $this->disppath.'/'.$filename).'<br/>';1513 }1514 else1515 {1516 $this->messages[]=$GLOBALS['phpgw']->common->error_list(array(lang('Could not delete %1', $this->disppath.'/'.$filename)));1517 }1518 }1519 }1520 else1521 1584 { 1522 1585 // make this a javascript func for quicker respons 1523 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array(lang('Please select a file to delete.')));1586 $this->messages[]=lang('Error:').lang('Please select a file to delete.'); 1524 1587 } 1525 1588 $this->readFilesInfo(); … … 1554 1617 $this->t->set_block('upload','upload_footer','upload_footer'); 1555 1618 1556 # Decide how many upload boxes to show1557 if(!$this->show_upload_boxes || $this->show_upload_boxes <= 0)1558 {1559 if(!$this->show_upload_boxes = $this->prefs['show_upload_boxes'])1560 {1561 $this->show_upload_boxes = 1;1562 }1563 }1564 1565 # Show file upload boxes. Note the last argument to html(). Repeats $this->show_upload_boxes times1566 1619 if($this->path != '/' && $this->path != $this->bo->fakebase && $this->can_add) 1567 1620 { … … 1570 1623 $vars[lang_file]=lang('File'); 1571 1624 $vars[lang_comment]=lang('Comment'); 1572 $vars[num_upload_boxes]= $this->show_upload_boxes;1625 $vars[num_upload_boxes]=1; 1573 1626 $this->t->set_var($vars); 1574 1627 $this->t->pparse('out','upload_header'); 1575 1628 1576 for($i=0;$i<$this->show_upload_boxes;$i++) 1577 { 1578 $this->t->set_var('row_tr_color',$tr_color); 1579 $this->t->parse('rows','row'); 1580 $this->t->pparse('out','row'); 1581 } 1629 $this->t->set_var('row_tr_color',$tr_color); 1630 $this->t->parse('rows','row'); 1631 $this->t->pparse('out','row'); 1582 1632 1583 1633 $vars[lang_upload]=lang('Upload files'); 1584 1634 $vars[change_upload_boxes].=lang('Show') . ' '; 1585 $links.= $this->html_link('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=5', '5');1586 $links.=' ';1587 $links.= $this->html_link('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=10', '10');1588 $links.=' ';1589 $links.= $this->html_link('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=20', '20');1590 $links.=' ';1591 $links.= $this->html_link('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=50', '50');1592 $links.=' ';1593 $links.= lang('upload fields');1594 $vars[change_upload_boxes].=$links;1595 1635 $this->t->set_var($vars); 1596 1636 $this->t->pparse('out','upload_footer'); … … 1606 1646 if($badchar = $this->bo->bad_chars($this->createfile_var, True, True)) 1607 1647 { 1608 $this->messages[] = $GLOBALS['phpgw']->common->error_list(array( 1609 lang('File names cannot contain "%1"',$badchar), 1610 1) 1611 ); 1648 $this->messages[] = lang('Error:').lang('File names cannot contain "%1"',$badchar); 1612 1649 1613 1650 $this->fileListing(); … … 1619 1656 ))) 1620 1657 { 1621 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array(lang('File %1 already exists. Please edit it or delete it first.', $this->createfile_var)));1658 $this->messages[]= lang('Error:').lang('File %1 already exists. Please edit it or delete it first.', $this->createfile_var); 1622 1659 $this->fileListing(); 1623 1660 } … … 1636 1673 else 1637 1674 { 1638 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array(lang('File %1 could not be created.', $this->createfile_var)));1675 $this->messages[]= lang('Error:').lang('File %1 could not be created.', $this->createfile_var); 1639 1676 $this->fileListing(); 1640 1677 } … … 1649 1686 if($this->file) 1650 1687 { 1651 if (! $this->v erifyLock($this->path.'/'.$this->file,RELATIVE_NONE)){1688 if (! $this->vfs_functions->verifyLock($this->path.'/'.$this->file,RELATIVE_NONE)){ 1652 1689 echo $this->messages['0']; 1653 1690 $GLOBALS['phpgw']->redirect('/index.php'); … … 1661 1698 'nofiles' => True 1662 1699 )); 1663 1664 1700 $this->bo->vfs->touch(array( 1665 1701 'string'=> $this->path.'/'.$this->file, … … 1667 1703 )); 1668 1704 1705 1669 1706 if($ls_array[0]['mime_type']) 1670 1707 { … … 1686 1723 1687 1724 if ($mime_type == 'text/html') 1688 {1689 1725 $this->t->set_file(array('filemanager_edit' => 'edit_html.tpl')); 1690 $this->t->set_block('filemanager_edit','row','row'); 1691 include_once("fckeditor.php"); 1692 $oFCKeditor = new FCKeditor('edit_file_content') ; 1693 $oFCKeditor->BasePath = 'filemanager/tp/fckeditor/'; 1694 $oFCKeditor->ToolbarSet = 'Default'; 1695 1696 } 1697 else{ 1726 else 1698 1727 $this->t->set_file(array('filemanager_edit' => 'edit_file.tpl')); 1699 $this->t->set_block('filemanager_edit','row','row'); 1700 1701 } 1728 1729 $this->t->set_block('filemanager_edit','row','row'); 1730 1702 1731 1703 1732 $vars[refresh_script] = "<script src='filemanager/js/refresh.js'></script>"; … … 1786 1815 1787 1816 if ($mime_type == 'text/html'){ 1788 $oFCKeditor->Value = $content; 1789 $vars[fck_edit] = $oFCKeditor->Create(); 1817 $vars[fck_edit] = '<script type="text/javascript" src="filemanager/tp/ckeditor/ckeditor.js"></script> 1818 <textarea cols="80" id="edit_file_content" name="edit_file_content" rows="10">'.$content.'</textarea> 1819 <script type="text/javascript"> CKEDITOR.replace( \'edit_file_content\',{ 1820 removePlugins : \'elementspath\', 1821 skin : \'office2003\', 1822 toolbar : [["Source","Preview","-","Cut","Copy","Paste","-","Print", 1823 "Undo","Redo","-","Find","Replace","-","SelectAll" ], 1824 ["Table","HorizontalRule","Smiley","SpecialChar","PageBreak","-","Bold", 1825 "Italic","Underline","Strike","-","Subscript","Superscript", 1826 "NumberedList","BulletedList","-","Outdent","Indent","Blockquote", 1827 "JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock", 1828 "Link", "TextColor","BGColor","Maximize"], 1829 ["Styles","Format","Font","FontSize"]] 1830 });</script>'; 1790 1831 1791 1832 } … … 1854 1895 } 1855 1896 } 1856 function touch(){1857 if($this->file)1858 if ($this->bo->vfs->touch(array('string'=> $this->file,'relatives' => array(RELATIVE_ALL))))1859 {1860 echo "True";1861 return True;1862 }1863 else1864 return False;1865 1866 }1867 1897 function view() 1868 1898 { 1899 if (!$this->bo->vfs->acl_check(array( 1900 'string' => $this->path, 1901 'relatives' => array(RELATIVE_NONE), 1902 'operation' => PHPGW_ACL_READ 1903 ))) 1904 { 1905 echo lang("You have no permission to access this file"); 1906 return false; 1907 } 1869 1908 if($this->file) //FIXME 1870 1909 { … … 1886 1925 $viewable = array('','text/plain','text/csv','text/html','text/text'); 1887 1926 1888 if(in_array($mime_type,$viewable) && !$_GET['download'])1927 if(in_array($mime_type,$viewable)) 1889 1928 { 1890 1929 1891 1930 header('Content-type: ' . $mime_type); 1892 1931 header('Content-disposition: filename="' . $this->file . '"');//FIXME 1893 1932 Header("Pragma: public"); … … 1914 1953 'nofiles' => True 1915 1954 )); 1916 $timestamp = $this->dateString2timeStamp($ls_array[0]['modified']);1955 /*$timestamp = $this->vfs_functions->dateString2timeStamp($ls_array[0]['modified']); 1917 1956 if (time() - $timestamp < 60 && $ls_array[0]['modifiedby_id'] != $GLOBALS['phpgw_info']['user']['account_id']); 1918 1957 { 1919 1920 } 1958 // recently than last minute: someone is editing 1959 }*/ 1921 1960 $mime_type = $ls_array[0]['mime_type']; 1922 1961 $formats = array('text/html'); … … 1939 1978 } 1940 1979 } 1941 function download()1942 {1943 for($i = 0; $i != $this->numoffiles; $i++)1944 {1945 if(!$this->fileman[$i])1946 {1947 continue;1948 }1949 1950 $download_browser = CreateObject('phpgwapi.browser');1951 $download_browser->content_header($this->fileman[$i]);1952 echo $this->bo->vfs->read(array('string' => $this->fileman[$i]));1953 $GLOBALS['phpgw']->common->phpgw_exit();1954 }1955 }1956 1980 1957 1981 //give back an array with all directories except current and dirs that are not accessable -
sandbox/filemanager/inc/hook_settings.inc.php
r1592 r1627 55 55 } 56 56 57 $upload_boxes=array(58 "1"=>"1",59 "5"=>"5",60 "10"=>"10",61 "20"=>"20",62 "30"=>"30"63 );64 65 create_select_box('Default number of upload fields to show','show_upload_boxes',$upload_boxes);66 57 $type=array( 67 58 "portrait"=>lang("portrait"), -
sandbox/filemanager/js/common_functions.js
r1575 r1627 1 var menuTimeout; 2 /* draw_menu(id of menu, left position, top position, menu elements) */ 3 function draw_menu(id,left_pos,top_pos,elements){ 4 var menu = document.getElementById('menu_newFile'+id); 5 if (menu == null){ 6 menu = document.createElement('DIV'); 7 menu.id = "menu_newFile"+id; 8 menu.style.left = left_pos+"px"; 9 menu.style.top = top_pos+"px"; 10 for(j in elements) 11 menu.innerHTML += "<a href="+elements[j]['url']+">"+elements[j]['text']+"</a><br>"; 12 13 menu.onmouseout = function () { menuTimeout = setTimeout("document.getElementById('menu_newFile"+id+"').style.visibility = 'hidden'",50);} 14 menu.onmouseover = function () { clearTimeout(menuTimeout); }; 15 menu.className = "menu_box"; 16 document.getElementById('tableDivAppbox').appendChild(menu); 17 } 18 menu.style.visibility = ''; 19 20 } 1 21 function formfmValidate(arg) 2 22 { 23 var button = document.getElementsByName(arg); 24 button = button[0]; 3 25 switch (arg) { 4 26 case 'newdir': 5 case 'newfile': 6 var name = prompt(get_lang('Enter with the name of new file/directory'), ''); 7 var input_text = document.getElementById('newfile_or_dir'); 8 if (name == null || ! validateFileExtension(name)) 9 { 10 return false; 11 } 12 else 13 { 14 var fileExtension = name.split("."); 15 fileExtension = fileExtension[1]; 16 if (typeof(fileExtension) == 'undefined') 17 input_text.value = name+".html"; 18 else 19 input_text.value = name; 20 return true; 21 } 22 break 27 break; 28 case 'new': 29 elements = new Array(); 30 elements[0] = new Array(); 31 elements[0]['text'] = get_lang('empty file'); 32 elements[0]['url'] = 'javascript:newEmptyFile();'; 33 elements[1] = new Array(); 34 elements[1]['text'] = get_lang('File from model'); 35 address = document.location.toString(); 36 address = address.split("?"); 37 elements[1]['url'] = address[0]+"?menuaction=filemanager.uifilemanager.fileModels"; 38 elements[2] = new Array(); 39 elements[2]['text'] = get_lang('Upload'); 40 address = document.location.toString(); 41 address = address.split("?"); 42 elements[2]['url'] = address[0]+"?menuaction=filemanager.uifilemanager.index&upload=clicked&upload.x=1&path="+base64_encode(document.getElementById('cdtodir').value); 43 44 draw_menu(arg,button.parentNode.offsetLeft+50,190,elements); 45 return false; 46 break; 23 47 case 'edit_comments': 24 48 case 'rename': … … 34 58 else 35 59 { 36 alert(get_lang('Please select a file'));60 write_msg(get_lang('Please select a file')); 37 61 return false; 38 62 } 63 break; 64 case 'move_to': 65 case 'copy_to': 66 filesUrl = ""; 67 var one_checked = false; 68 files=document.getElementsByClassName('checkbox'); 69 for (i = 0; i < files.length; i++) 70 if (files[i].checked){ 71 one_checked = true; 72 filesUrl += "&"+files[i].name+"="+files[i].value; 73 } 74 if (!one_checked) 75 { 76 write_msg(get_lang('Please select a file')); 77 return false; 78 } 79 var elements = new Array(); 80 inputEl = document.getElementsByName('todir'); 81 for(i=0; i< inputEl[0].childNodes.length; i++) 82 { 83 elements[i] = new Array(); 84 elements[i]['text'] =inputEl[0].childNodes[i].innerHTML; 85 address = document.location.toString(); 86 address = address.split("&"); 87 elements[i]['url'] = address[0]+ 88 "&todir="+inputEl[0].childNodes[i].innerHTML+ 89 "&"+arg+".x=10"+filesUrl; 90 } 91 draw_menu(arg,button.parentNode.offsetLeft+50,190,elements); 92 return false; 93 break; 39 94 default: 40 95 return true; … … 62 117 if ( error_flag == true ) 63 118 { 64 alert(get_lang('File extension forbidden or invalid file') + '.');119 write_error(get_lang('File extension forbidden or invalid file') + '.'); 65 120 return false; 66 121 } … … 81 136 82 137 } 138 139 140 function newEmptyFile(){ 141 var name = prompt(get_lang('Enter with the name of new file/directory'), ''); 142 var input_text = document.getElementById('newfile_or_dir'); 143 if (name != null && name != '' && validateFileExtension(name)) 144 { 145 var fileExtension = name.split("."); 146 fileExtension = fileExtension[1]; 147 if (typeof(fileExtension) == 'undefined') 148 input_text.value = name+".html"; 149 else 150 input_text.value = name; 151 address = document.location.toString(); 152 address = address.split("&"); 153 document.location = address[0]+"&newfile.x=clicked&newfile_or_dir="+input_text.value; 154 155 } 156 157 } 158 159 160 /* 161 * base64.js - Base64 encoding and decoding functions 162 * 163 * Copyright (c) 2007, David Lindquist <david.lindquist@gmail.com> 164 * Released under the MIT license 165 */ 166 167 function base64_encode(str) { 168 var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 169 var encoded = []; 170 var c = 0; 171 while (c < str.length) { 172 var b0 = str.charCodeAt(c++); 173 var b1 = str.charCodeAt(c++); 174 var b2 = str.charCodeAt(c++); 175 var buf = (b0 << 16) + ((b1 || 0) << 8) + (b2 || 0); 176 var i0 = (buf & (63 << 18)) >> 18; 177 var i1 = (buf & (63 << 12)) >> 12; 178 var i2 = isNaN(b1) ? 64 : (buf & (63 << 6)) >> 6; 179 var i3 = isNaN(b2) ? 64 : (buf & 63); 180 encoded[encoded.length] = chars.charAt(i0); 181 encoded[encoded.length] = chars.charAt(i1); 182 encoded[encoded.length] = chars.charAt(i2); 183 encoded[encoded.length] = chars.charAt(i3); 184 } 185 return encoded.join(''); 186 } 187 188 function base64_decode(str) { 189 var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 190 var invalid = { 191 strlen: (str.length % 4 != 0), 192 chars: new RegExp('[^' + chars + ']').test(str), 193 equals: (/=/.test(str) && (/=[^=]/.test(str) || /={3}/.test(str))) 194 }; 195 if (invalid.strlen || invalid.chars || invalid.equals) 196 throw new Error('Invalid base64 data'); 197 var decoded = []; 198 var c = 0; 199 while (c < str.length) { 200 var i0 = chars.indexOf(str.charAt(c++)); 201 var i1 = chars.indexOf(str.charAt(c++)); 202 var i2 = chars.indexOf(str.charAt(c++)); 203 var i3 = chars.indexOf(str.charAt(c++)); 204 var buf = (i0 << 18) + (i1 << 12) + ((i2 & 63) << 6) + (i3 & 63); 205 var b0 = (buf & (255 << 16)) >> 16; 206 var b1 = (i2 == 64) ? -1 : (buf & (255 << 8)) >> 8; 207 var b2 = (i3 == 64) ? -1 : (buf & 255); 208 decoded[decoded.length] = String.fromCharCode(b0); 209 if (b1 >= 0) decoded[decoded.length] = String.fromCharCode(b1); 210 if (b2 >= 0) decoded[decoded.length] = String.fromCharCode(b2); 211 } 212 return decoded.join(''); 213 } 214 215 216 function setRestricted(data){ 217 if (data.indexOf("True") == 0){ 218 returnVal = data.split(':'); 219 var img_lock = document.getElementById('restrict_'+returnVal[1]); 220 if (img_lock.src.indexOf('button_unlock') > 0) 221 { 222 img_lock.src = img_lock.src.replace(/button_unlock/g,'button_lock'); 223 write_msg(get_lang('%1 marked as restricted',returnVal[1])); 224 } 225 else 226 { 227 img_lock.src = img_lock.src.replace(/button_lock/g,'button_unlock'); 228 write_msg(get_lang('%1 unmarked as restricted',returnVal[1])); 229 } 230 } 231 else 232 write_error("Could not mark as restricted"); 233 } -
sandbox/filemanager/js/draw_api.js
r1564 r1627 4 4 var usedSpace = document.getElementById('usedSpace').value; 5 5 6 document.getElementById('content_quota').innerHTML = '<table width="102" cellspacing="0" cellpadding="0" border="0" id="table_quota"><tbody><tr><td width="102" nowrap="true" height="15" background="../phpgwapi/templates/default/images/dsunused.gif"><table cellspacing="0" cellpadding="0" border="0" style="width: '+parseInt((usedSpace/quotaSize)*100)+'%;"><tbody><tr><td height="15" class="dsused"/></tr></tbody></table></td><td nowrap="true" align="center"><span class="boxHeaderText">'+parseInt(usedSpace/quotaSize*100)+'% ('+usedSpace+'M/'+quotaSize+'M)</span></td></tr></tbody></table></td></tr></table>' 6 document.getElementById('content_quota').innerHTML = '<table width="102" cellspacing="0" cellpadding="0" border="0" id="table_quota"><tbody><tr><td width="102" nowrap="true" height="15" background="../phpgwapi/templates/default/images/dsunused.gif"><table cellspacing="0" cellpadding="0" border="0" style="width: '+parseInt((usedSpace/quotaSize)*100)+'%;"><tbody><tr><td height="15" class="dsused"/></tr></tbody></table></td><td nowrap="true" align="center"><span class="boxHeaderText">'+parseInt(usedSpace/quotaSize*100)+'% ('+(usedSpace/1024/1024).toFixed(1)+'M/'+(quotaSize/1024/1024)+'M)</span></td></tr></tbody></table></td></tr></table>' 7 8 var headerMsgLock = false; 9 var labelBefore = ""; 10 function write_msg (message){ 11 if (headerMsgLock){ 12 setTimeout('write_msg("'+message+'");', 300); 13 return; 14 } 15 headerMsgLock = true; 16 headerDiv = document.getElementById("divAppboxHeader"); 17 labelBefore = headerDiv.innerHTML; 18 headerDiv.innerHTML = '<table width=100% cellspacing="0" cellpadding="0" border="0"><tbody><tr><th width="40%"></th><th noWrap class="action_info_th">'+message+'</th><th width="40%"></th></tr></tbody></table>'; 19 setTimeout('headerMsgLock = false; document.getElementById("divAppboxHeader").innerHTML = labelBefore;', 3000); 20 } 21 22 function write_error (message){ 23 if (headerMsgLock){ 24 setTimeout('write_error("'+message+'");', 300); 25 return; 26 } 27 headerMsgLock = true; 28 headerDiv = document.getElementById("divAppboxHeader"); 29 labelBefore = headerDiv.innerHTML; 30 headerDiv.innerHTML = '<table width=100% cellspacing="0" cellpadding="0" border="0"><tbody><tr><th width="40%"></th><th noWrap class="action_error_th">'+message+'</th><th width="40%"></th></tr></tbody></table>'; 31 setTimeout('headerMsgLock = false; document.getElementById("divAppboxHeader").innerHTML = labelBefore;', 3000); 32 } 33 34 function displayMessages(){ 35 var messages = document.getElementById("allMessages"); 36 for (i=0; i < messages.childNodes.length; i++){ 37 if (messages.childNodes[i].innerHTML.indexOf(get_lang('Error:')) == 0) 38 write_error(messages.childNodes[i].innerHTML); 39 else 40 write_msg(messages.childNodes[i].innerHTML); 41 } 42 } 43 setTimeout('displayMessages();',500); -
sandbox/filemanager/js/global.js
r1556 r1627 1 1 var title_app = '<table height="16px" border=0 width=100% cellspacing=0 cellpadding=2>'+ 2 '<tr >'+2 '<tr class="divAppboxHeader">'+ 3 3 '<td style="padding-left:17px" width=33% id="content_quota" align=left></td>'+ 4 '<td class="divAppboxHeader"width=33% id="main_title">Expresso FileManager</td>'+4 '<td width=33% id="main_title">Expresso FileManager</td>'+ 5 5 '<td width=33% id="div_menu_c3" align=right></td>'+ 6 6 '</tr></table>'; -
sandbox/filemanager/js/refresh.js
r1575 r1627 2 2 3 3 setTimeout("pooling_refresh();",refresh_time); 4 5 6 /*7 * base64.js - Base64 encoding and decoding functions8 *9 * Copyright (c) 2007, David Lindquist <david.lindquist@gmail.com>10 * Released under the MIT license11 */12 13 function base64_encode(str) {14 var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';15 var encoded = [];16 var c = 0;17 while (c < str.length) {18 var b0 = str.charCodeAt(c++);19 var b1 = str.charCodeAt(c++);20 var b2 = str.charCodeAt(c++);21 var buf = (b0 << 16) + ((b1 || 0) << 8) + (b2 || 0);22 var i0 = (buf & (63 << 18)) >> 18;23 var i1 = (buf & (63 << 12)) >> 12;24 var i2 = isNaN(b1) ? 64 : (buf & (63 << 6)) >> 6;25 var i3 = isNaN(b2) ? 64 : (buf & 63);26 encoded[encoded.length] = chars.charAt(i0);27 encoded[encoded.length] = chars.charAt(i1);28 encoded[encoded.length] = chars.charAt(i2);29 encoded[encoded.length] = chars.charAt(i3);30 }31 return encoded.join('');32 }33 34 function base64_decode(str) {35 var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';36 var invalid = {37 strlen: (str.length % 4 != 0),38 chars: new RegExp('[^' + chars + ']').test(str),39 equals: (/=/.test(str) && (/=[^=]/.test(str) || /={3}/.test(str)))40 };41 if (invalid.strlen || invalid.chars || invalid.equals)42 throw new Error('Invalid base64 data');43 var decoded = [];44 var c = 0;45 while (c < str.length) {46 var i0 = chars.indexOf(str.charAt(c++));47 var i1 = chars.indexOf(str.charAt(c++));48 var i2 = chars.indexOf(str.charAt(c++));49 var i3 = chars.indexOf(str.charAt(c++));50 var buf = (i0 << 18) + (i1 << 12) + ((i2 & 63) << 6) + (i3 & 63);51 var b0 = (buf & (255 << 16)) >> 16;52 var b1 = (i2 == 64) ? -1 : (buf & (255 << 8)) >> 8;53 var b2 = (i3 == 64) ? -1 : (buf & 255);54 decoded[decoded.length] = String.fromCharCode(b0);55 if (b1 >= 0) decoded[decoded.length] = String.fromCharCode(b1);56 if (b2 >= 0) decoded[decoded.length] = String.fromCharCode(b2);57 }58 return decoded.join('');59 }60 61 62 4 63 5 … … 66 8 } 67 9 var filename=document.getElementsByName('edit_file'); 68 cExecute("/index.php?menuaction=filemanager. uifilemanager.touch&file="+base64_encode(filename[0].value),handler);10 cExecute("/index.php?menuaction=filemanager.vfs_functions.touch&file="+base64_encode(filename[0].value),handler); 69 11 setTimeout("pooling_refresh();",refresh_time); 70 12 } -
sandbox/filemanager/setup/phpgw_pt-br.lang
r1592 r1627 23 23 create file filemanager pt-br Criar Arquivo 24 24 create folder filemanager pt-br Criar Pasta 25 new filemanager pt-br novo 25 26 created filemanager pt-br Criado 26 27 created %1 filemanager pt-br Criado %1 28 You have no permission to access this file filemanager pt-br Você não tem permissão para acessar este arquivo 27 29 created %1,%2 filemanager pt-br Criado %1, %2 28 30 created by filemanager pt-br Criado por 31 Error: filemanager pt-br Erro: 29 32 created directory %1 filemanager pt-br Criada pasta %1 30 33 date filemanager pt-br Data … … 32 35 This file is being edited right now by: filemanager pt-br Este arquivo está sendo editado por: 33 36 portrait filemanager pt-br retrato 37 Could not mark as restricted filemanager pt-br Não foi possível marcar como restrito 38 %1 marked as restricted filemanager pt-br %1 foi marcado como restrito 39 %1 unmarked as restricted filemanager pt-br %1 foi desmarcado como restrito 40 Mark as restricted filemanager pt-br Marcar como restrito 41 Unmark as restricted filemanager pt-br Desmarcar como restrito 34 42 landscape filemanager pt-br paisagem 35 43 letter filemanager pt-br carta … … 91 99 rename filemanager pt-br Renomear 92 100 renamed %1 to %2 filemanager pt-br Renomeado %1 para %2 93 replaced %1 filemanager pt-br Substituído %1101 created new %1 filemanager pt-br Criado novo arquivo %1 94 102 save %1 filemanager pt-br Salvar %1 95 103 save %1, and go back to file listing filemanager pt-br Salvar %1, e voltar para listagem dos arquivos … … 118 126 users filemanager pt-br Usuários 119 127 version filemanager pt-br Versão 128 New... filemanager pt-br Novo... 129 Empty file filemanager pt-br Arquivo vazio 130 File from model filemanager pt-br Arquivo de modelo 131 Article filemanager pt-br Artigo 132 Todo filemanager pt-br Tarefas 133 Slide filemanager pt-br Apresentação 134 Cards filemanager pt-br Cartões 135 Resume filemanager pt-br Currículo 120 136 Impossbile to edit this file filemanager pt-br Impossível editar o arquivo selecionado 121 137 Enter with the name of new file/directory filemanager pt-br Insira o nome do novo arquivo/diretório -
sandbox/filemanager/templates/default/edit_file.tpl
r1575 r1627 12 12 <input type="hidden" name="edit_file" value="{edit_file}" /> 13 13 {filemans_hidden} 14 <textarea name="edit_file_content" rows="1 0" cols="50">{file_content}</textarea>14 <textarea name="edit_file_content" rows="15" cols="80">{file_content}</textarea> 15 15 <!-- </td> 16 16 </tr> -
sandbox/filemanager/templates/default/filelisting.tpl
r1556 r1627 3 3 {quotaSize} 4 4 {javascript} 5 <form name="formfm" method="post" action="{form_action}">5 <form id="formfm" name="formfm" method="post" action="{form_action}"> 6 6 {toolbar0} 7 7 <div id="fmMenu"> … … 9 9 </div> 10 10 <div id="fmFileWindow"> 11 {messages}<table cellspacing="0" cellpadding="2">12 11 <table cellspacing="0" cellpadding="2"> 12 <tbody> 13 13 <!-- END filemanager_header --> 14 14 … … 19 19 <!-- BEGIN row --> 20 20 <tr bgcolor="{row_tr_color}"> 21 <td valign="middle" style="padding-left:2px;padding-right:2px;">{actions} </td>21 <td valign="middle" style="padding-left:2px;padding-right:2px;">{actions}{mini_bar}</td> 22 22 {columns} 23 23 </tr> … … 30 30 <div id="fmStatusBar"><b>{lang_files_in_this_dir}:</b> {files_in_this_dir} <b>{lang_used_space}: </b> {used_space}</div> 31 31 </form> 32 <div style="visibility: hidden;" id="allMessages">{messages}</div> 32 33 <!-- END filemanager_footer --> 33 -
sandbox/filemanager/templates/default/upload.tpl
r1506 r1627 1 1 <!-- BEGIN upload_header --> 2 <script src="filemanager/js/uploadForm.js" type="text/javascript"></script> 2 3 <form method="post" action="{form_action}" enctype="multipart/form-data"> 3 4 <div> … … 11 12 12 13 <!-- BEGIN row --> 13 <tr >14 <td><input maxlength="255" name="upload_file[]" type="file"></td>14 <tr id="uploadOption"> 15 <td><input onchange="javascript:addNewInput();" maxlength="255" name="upload_file[]" type="file"></td> 15 16 <td><input name="upload_comment[]" type="text"></td> 16 17 </tr> … … 22 23 <input value="true" name="uploadprocess" type="hidden"> 23 24 <input value="{path}" name="path" type="hidden"> 24 <input value="{num_upload_boxes}" name="show_upload_boxes" type="hidden">25 <input value="{num_upload_boxes}" name="show_upload_boxes" id="show_upload_boxes" type="hidden"> 25 26 <input value="{lang_upload}" name="upload_files" type="submit"> 26 <br/>27 {change_upload_boxes}28 27 </div> 29 28 </form> -
trunk/phpgwapi/inc/class.vfs_sql.inc.php
r1575 r1627 38 38 var $working_id; 39 39 var $working_lid; 40 var $my_home; 40 41 var $meta_types; 41 42 var $now; … … 52 53 $this->working_id = $GLOBALS['phpgw_info']['user']['account_id']; 53 54 $this->working_lid = $GLOBALS['phpgw']->accounts->id2name($this->working_id); 55 $this->my_home = $this->fakebase.'/'.$this->working_lid; 54 56 $this->now = date ('Y-m-d H:i:s'); 55 57 … … 64 66 $this->attributes[] = 'deleteable'; 65 67 $this->attributes[] = 'content'; 68 $this->attributes[] = 'type'; 66 69 67 70 /* … … 612 615 function acl_check ($data) 613 616 { 617 614 618 if (!is_array ($data)) 615 619 { 616 620 $data = array (); 617 621 } 622 623 /* ExpressoLivre principle: In your home you do what you want*/ 624 if (strpos($data['string'],$this->my_home) === 0) 625 return True; 618 626 619 627 $default_values = array … … 845 853 $data = array (); 846 854 } 855 856 $path = explode('/',$data['string']); 857 $quota = $this->get_quota(array('string' => '/'.$path[1].'/'.$path[2])); 858 if ($quota > 0 && $this->get_size($data) >= $quota * 1024 * 1024) 859 return false; 860 847 861 848 862 $default_values = array … … 1082 1096 $data = array (); 1083 1097 } 1098 $path = explode('/',$data['to']); 1099 $quota = $this->get_quota(array('string' => '/'.$path[1].'/'.$path[2])); 1100 $size = $this->get_size(array('string' => $data['to'], 'relatives' => $data['relatives'][1])); 1101 if ($quota > 0 && $size >= $quota * 1024 * 1024) 1102 return false; 1084 1103 1085 1104 $default_values = array … … 1344 1363 $data = array (); 1345 1364 } 1365 1366 $path = explode('/',$data['to']); 1367 $quota = $this->get_quota(array('string' => '/'.$path[1].'/'.$path[2])); 1368 $size = $this->get_size(array('string' => $data['to'], 'relatives' => $data['relatives'][1])); 1369 if ($quota > 0 && $size >= $quota * 1024 * 1024) 1370 return false; 1371 1346 1372 1347 1373 $default_values = array … … 2325 2351 return $size; 2326 2352 } 2353 /* 2354 * get the quota defined for the path in sql table 2355 */ 2356 function get_quota($data){ 2357 if (!is_array ($data)) 2358 { 2359 $data = array (); 2360 } 2361 2362 $default_values = array 2363 ( 2364 'relatives' => array (RELATIVE_CURRENT) 2365 ); 2366 2367 $data = array_merge ($this->default_values ($data, $default_values), $data); 2368 2369 $p = $this->path_parts (array( 2370 'string' => $data['string'], 2371 'relatives' => RELATIVE_NONE 2372 ) 2373 ); 2374 2375 if (!$this->acl_check (array( 2376 'string' => $p->fake_full_path, 2377 'relatives' => $p->mask, 2378 'operation' => PHPGW_ACL_READ 2379 )) 2380 ) 2381 { 2382 return False; 2383 } 2384 $query = $GLOBALS['phpgw']->db->query ("SELECT quota_size FROM phpgw_vfs_quota WHERE directory = '".$data['string']."' LIMIT 1;", __LINE__,__FILE__); 2385 2386 $GLOBALS['phpgw']->db->next_record (); 2387 $record = $GLOBALS['phpgw']->db->Record; 2388 return $record['quota_size']; 2389 } 2390 function set_quota($data){ 2391 if (!is_array ($data)) 2392 { 2393 $data = array (); 2394 } 2395 2396 $default_values = array 2397 ( 2398 'relatives' => array (RELATIVE_CURRENT) 2399 ); 2400 2401 $data = array_merge ($this->default_values ($data, $default_values), $data); 2402 2403 $p = $this->path_parts (array( 2404 'string' => $data['string'], 2405 'relatives' => array ($data['relatives'][0]) 2406 ) 2407 ); 2408 2409 if (!$this->acl_check (array( 2410 'string' => $p->fake_full_path, 2411 'relatives' => array ($p->mask), 2412 'operation' => PHPGW_ACL_READ 2413 )) 2414 ) 2415 { 2416 return False; 2417 } 2418 // INSERT INTO phpgw_vfs_quota values('/home/amuller',200); 2419 // 2420 return $GLOBALS['phpgw']->db->query("INSERT INTO phpgw_vfs_quota VALUES ('".$data['string']."',".$data['new_quota'].");", __LINE__,__FILE__); 2421 } 2422 2327 2423 2328 2424 /*! … … 2399 2495 $dir = $p->fake_full_path; 2400 2496 2497 2401 2498 /* If they pass us a file or 'nofiles' is set, return the info for $dir only */ 2402 2499 if (@$data['file_id'] … … 2428 2525 else 2429 2526 { 2430 $sql .= " directory='".$GLOBALS['phpgw']->db->db_addslashes($p->fake_leading_dirs_clean).2431 " ' ANDname='".$GLOBALS['phpgw']->db->db_addslashes($p->fake_name_clean)."'".2527 $sql .= " directory='".$GLOBALS['phpgw']->db->db_addslashes($p->fake_leading_dirs_clean)."' AND". 2528 " name='".$GLOBALS['phpgw']->db->db_addslashes($p->fake_name_clean)."'". 2432 2529 $this->extra_sql (array ('query_type' => VFS_SQL_SELECT)); 2433 2530 } … … 2508 2605 /* SELECT all, the, attributes FROM phpgw_vfs WHERE file=$dir */ 2509 2606 $sql = 'SELECT '; 2607 if (!$this->acl_check (array ( 2608 'string' => $p->fake_full_path, 2609 'relatives' => array ($p->mask), 2610 'operation' => PHPGW_ACL_PRIVATE) 2611 )) 2612 $query_type = " type != 1 AND"; 2613 else 2614 $query_type = ""; 2510 2615 2511 2616 foreach($this->attributes as $num => $attribute) … … 2520 2625 2521 2626 $dir_clean = $this->clean_string (array ('string' => $dir)); 2522 $sql .= " FROM phpgw_vfs WHERE directory LIKE '".$GLOBALS['phpgw']->db->db_addslashes($dir_clean)."%'";2627 $sql .= " FROM phpgw_vfs WHERE ".$query_type." directory LIKE '".$GLOBALS['phpgw']->db->db_addslashes($dir_clean)."%'"; 2523 2628 $sql .= $this->extra_sql (array ('query_type' => VFS_SQL_SELECT)); 2524 2629 … … 2527 2632 $sql .= " AND mime_type='".$data['mime_type']."'"; 2528 2633 } 2529 2530 $sql .= ' ORDER BY '.$data['orderby']; 2531 2634 if (strlen($data['orderby']) > 0) 2635 $sql .= ' ORDER BY '.$data['orderby']; 2532 2636 $query = $GLOBALS['phpgw']->db->query ($sql, __LINE__, __FILE__); 2533 2637
Note: See TracChangeset
for help on using the changeset viewer.