[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /***************************************************************************\ 3 * eGroupWare - mydms * 4 * http://www.linux-at-work.de * 5 * http://www.phpgw.de * 6 * http://www.egroupware.org * 7 * Written by : Lars Kneschke [lkneschke@linux-at-work.de] * 8 * ------------------------------------------------- * 9 * This program is free software; you can redistribute it and/or modify it * 10 * under the terms of the GNU General Public License as published by the * 11 * Free Software Foundation; version 2 of the License. * 12 \***************************************************************************/ 13 14 /* $Id: class.uimydms.inc.php 22772 2006-10-29 16:57:56Z lkneschke $ */ 15 16 require_once (EGW_SERVER_ROOT.'/mydms/inc/inc.Settings.php'); 17 require_once (EGW_SERVER_ROOT.'/mydms/inc/inc.DBAccess.php'); 18 require_once (EGW_SERVER_ROOT.'/mydms/inc/inc.AccessUtils.php'); 19 require_once (EGW_SERVER_ROOT.'/mydms/inc/inc.ClassAccess.php'); 20 require_once (EGW_SERVER_ROOT.'/mydms/inc/inc.ClassUser.php'); 21 require_once (EGW_SERVER_ROOT.'/mydms/inc/inc.ClassGroup.php'); 22 require_once (EGW_SERVER_ROOT.'/mydms/inc/inc.ClassFolder.php'); 23 require_once (EGW_SERVER_ROOT.'/mydms/inc/inc.ClassDocument.php'); 24 25 class uimydms 26 { 27 var $icons = array( 28 'txt' => 'txt.png', 29 'doc' => 'word.png', 30 'rtf' => 'document.png', 31 'xls' => 'excel.png', 32 'ppt' => 'powerpoint.png', 33 'exe' => 'binary.png', 34 'html' => 'html.png', 35 'htm' => 'html.png', 36 'gif' => 'image.png', 37 'jpg' => 'image.png', 38 'bmp' => 'image.png', 39 'png' => 'image.png', 40 'log' => 'log.png', 41 'midi' => 'midi.png', 42 'pdf' => 'pdf.png', 43 'wav' => 'sound.png', 44 'mp3' => 'sound.png', 45 'c' => 'source_c.png', 46 'cpp' => 'source_cpp.png', 47 'h' => 'source_h.png', 48 'java' => 'source_java.png', 49 'py' => 'source_py.png', 50 'tar' => 'tar.png', 51 'gz' => 'gz.png', 52 'zip' => 'gz.png', 53 'mpg' => 'video.png', 54 'avi' => 'video.png', 55 'tex' => 'tex.png', 56 'default' => 'default.png', 57 ); 58 59 var $public_functions = array 60 ( 61 'addACL' => 'true', 62 'addNotification' => 'true', 63 'deleteACL' => 'true', 64 'deleteDocument' => 'true', 65 'deleteFile' => 'true', 66 'deleteNotification' => 'true', 67 'folderChooser' => 'true', 68 'inheritACL' => 'true', 69 'setDefaultAccess' => 'true', 70 'updateACL' => 'true', 71 'updateDocument' => 'true', 72 'updateFile' => 'true', 73 'setOwner' => 'true', 74 'viewDocument' => 'true', 75 ); 76 77 function uimydms() 78 { 79 $this->t =& CreateObject('phpgwapi.Template',EGW_APP_TPL); 80 $this->bomydms =& CreateObject('mydms.bomydms'); 81 82 if (!is_object($GLOBALS['egw']->jscalendar)) 83 { 84 $GLOBALS['egw']->jscalendar = CreateObject('phpgwapi.jscalendar'); 85 } 86 } 87 88 function addACL() 89 { 90 $userID = (int)$_POST['userid']; 91 $groupID = (int)$_POST['groupid']; 92 $access = (int)$_POST['access']; 93 94 $documentID = (int)$_GET['documentid']; 95 96 if($documentID) 97 { 98 $this->bomydms->addACL($documentID, ($userID == 'unselected' ? false : (int)$userID), ($groupID == 'unselected' ? false : (int)$groupID), $access); 99 $this->viewDocument($documentID); 100 } 101 } 102 103 function addNotification() 104 { 105 $userID = $_POST['userid']; 106 $groupID = $_POST['groupid']; 107 108 $documentID = (int)$_GET['documentid']; 109 110 if($documentID) 111 { 112 $this->bomydms->addNotification($documentID, ($userID == 'unselected' ? false : (int)$userID), ($groupID == 'unselected' ? false : (int)$groupID)); 113 $this->viewDocument($documentID); 114 } 115 } 116 117 function folderChooser($_folderID=false) 118 { 119 $folderID = ($_folderID === false ? (int)$_GET['folderid'] : $_folderID); 120 $formName = $_GET['form']; 121 122 $folder = getFolder($folderID); 123 124 $this->display_app_header(); 125 126 $this->t->set_file(array("folderChooser" => "folderChooser.tpl")); 127 $this->t->set_block('folderChooser', 'main', 'main'); 128 129 $this->t->set_var('folderTree',$this->getFolderTree($folder->getPathNew(), 0, $folder, true)); 130 $this->t->set_var('formName',$formName); 131 132 $this->t->parse("out","main"); 133 134 print $this->t->get('out','main'); 135 } 136 137 /** 138 * create a folder tree 139 * 140 * this function will create a foldertree based on javascript 141 * on click the sorounding form gets submitted 142 * 143 * @param _folders array containing the list of folders 144 * @param _selected string containing the selected folder 145 * @param _topFolderName string containing the top folder name 146 * @param _topFolderDescription string containing the description for the top folder 147 * @param _formName string name of the sorounding form 148 * @param _hiddenVar string hidden form value, transports the selected folder 149 * 150 * @return string the html code, to be added into the template 151 */ 152 function createHTMLFolder($_folders, $_selected, $_divName, $_displayCheckBox=false) 153 { 154 $allFolders = $_folders; 155 156 $folderImageDir = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/templates/default/images/'; 157 158 $folder_tree_new = '<link rel="STYLESHEET" type="text/css" href="'.$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/dhtmlxtree/css/dhtmlXTree.css">'; 159 $folder_tree_new .= "<script type='text/javascript'>"; 160 $folder_tree_new .= "tree=new dhtmlXTreeObject('$_divName','100%','100%',0);\n"; 161 $folder_tree_new .= "tree.setImagePath('$folderImageDir/dhtmlxtree/');\n"; 162 $folder_tree_new .= "tree.setOnClickHandler('onNodeSelect');\n"; 163 $folder_tree_new .= "tree.setOnRightClickHandler('onNodeSelectRight');\n"; 164 165 $linkData = array 166 ( 167 'menuaction' => 'mydms.uifolder.getSubFolder', 168 ); 169 $xmlAutoLoadURL = $GLOBALS['egw']->link('/index.php',$linkData); 170 171 $folder_tree_new .= "tree.setXMLAutoLoading('$xmlAutoLoadURL');\n"; 172 173 if($_displayCheckBox) 174 { 175 $folder_tree_new .= "tree.enableCheckBoxes(1);"; 176 $folder_tree_new .= "tree.setOnCheckHandler('onCheckHandler');"; 177 } 178 179 // generate object for main folder 180 $folderObject = array_shift($allFolders); 181 $image1 = "'folderClosed.gif'"; 182 $image2 = "0"; 183 $image3 = "0"; 184 185 $entryOptions = 'CHILD,CHECKED'; 186 $folderID = $folderObject->getID(); 187 $folderName = $folderObject->getName(); 188 189 $selectedFolderID = $_selected->getID(); 190 191 $folder_tree_new .= "tree.insertNewItem('0','$folderID','$folderName',onNodeSelect,$image1,$image2,$image3,'$entryOptions');\n"; 192 193 194 //get the data about the last object 195 $lastFolderID = 1; 196 if($folderObject = array_pop($allFolders)) 197 { 198 $lastFolderID = $folderObject->getID(); 199 } 200 201 $linkData = array 202 ( 203 'menuaction' => 'mydms.uifolder.getInitialFolderView', 204 'id' => $lastFolderID, 205 ); 206 $xmlInitialLoadURL = $GLOBALS['egw']->link('/index.php',$linkData); 207 208 if($selectedFolderID == 1) 209 $folder_tree_new .= "tree.selectItem('$folderID',false);"; 210 211 $folder_tree_new .= "tree.loadXML('$xmlInitialLoadURL');"; 212 213 214 $folder_tree_new.= '</script>'; 215 216 return $folder_tree_new; 217 } 218 219 /* function createHTMLFolder_old($_folders, $_selected, $_divName, $_displayCheckBox=false) 220 { 221 $allFolders = $_folders; 222 223 $folderImageDir = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/templates/default/images/'; 224 225 $folder_tree_new = '<link rel="STYLESHEET" type="text/css" href="'.$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/dhtmlxtree/css/dhtmlXTree.css">'; 226 $folder_tree_new .= "<script type='text/javascript'>"; 227 $folder_tree_new .= "tree=new dhtmlXTreeObject('$_divName','100%','100%',0);"; 228 $folder_tree_new .= "tree.setImagePath('$folderImageDir/dhtmlxtree/');"; 229 $folder_tree_new .= "tree.setOnClickHandler('onNodeSelect');"; 230 231 $linkData = array 232 ( 233 'menuaction' => 'mydms.uifolder.getSubFolder', 234 ); 235 $xmlAutoLoadURL = $GLOBALS['egw']->link('/index.php',$linkData); 236 237 $folder_tree_new .= "tree.setXMLAutoLoading('$xmlAutoLoadURL');"; 238 if($_displayCheckBox) 239 { 240 $folder_tree_new .= "tree.enableCheckBoxes(1);"; 241 $folder_tree_new .= "tree.setOnCheckHandler('onCheckHandler');"; 242 } 243 244 #foreach($allFolders as $folderID => $folderObject) 245 #{ 246 $folderObject = array_shift($allFolders); 247 $image1 = "'folderClosed.gif'"; 248 $image2 = "0"; 249 $image3 = "0"; 250 251 $linkData = array 252 ( 253 'menuaction' => 'mydms.uifolder.getInitialFolderView', 254 'id' => $folderObject->getID(), 255 ); 256 $xmlAutoLoadURL = $GLOBALS['egw']->link('/index.php',$linkData); 257 258 if(empty($parentName)) $parentName = '--topfolder--'; 259 260 $entryOptions = 'CHILD,CHECKED'; 261 262 // highlight currently selected mailbox 263 if ($folderObject->getID() == $_selected->getID()) 264 { 265 $entryOptions .= ',SELECT'; 266 } 267 268 $folderID = $folderObject->getID(); 269 $folderName = $folderObject->getName(); 270 $parentID = ($folderObject->_parentID ? $folderObject->_parentID : 0); 271 272 $folder_tree_new .= "tree.insertNewItem('$parentID','$folderID','$folderName',onNodeSelect,$image1,$image2,$image3,'$entryOptions');\n"; 273 $folder_tree_new .= "tree.openItem('$folderID');"; 274 $folder_tree_new .= "tree.loadXML('$xmlAutoLoadURL&id=1');"; 275 $folder_tree_new .= "tree.openItem(1);"; 276 #$folder_tree_new .= "tree.loadXML('$xmlAutoLoadURL&id=6');"; 277 #if($_displayCheckBox) 278 # $folder_tree_new .= "tree.setCheck('$longName','".(int)$obj->subscribed."');"; 279 #} 280 281 282 # foreach($allFolders as $folderID => $folderObject) 283 # { 284 # $folder_tree_new .= "tree.loadXML('$xmlAutoLoadURL&id=".$folderObject->getID()."');"; 285 # $folder_tree_new .= "tree.openItem('".$folderObject->getID()."');"; 286 # } 287 288 289 #$selectedID = $_selected->getID(); 290 #$folder_tree_new.= "tree.closeAllItems(0);tree.openItem('$selectedID');" 291 $folder_tree_new.= '</script><a href="#" onclick="javascript:tree.openItem(1); return false;">test</a><a href="#" onclick="javascript:tree.closeItem(1); return false;">test b</a>'; 292 293 return $folder_tree_new; 294 } 295 */ 296 function deleteACL() 297 { 298 $userID = (int)$_GET['userid']; 299 $groupID = (int)$_GET['groupid']; 300 301 $documentID = (int)$_GET['documentid']; 302 303 if($documentID) 304 { 305 $this->bomydms->deleteACL($documentID, ($userID == 'unselected' ? false : (int)$userID), ($groupID == 'unselected' ? false : (int)$groupID)); 306 $this->viewDocument($documentID); 307 } 308 } 309 310 function deleteDocument() 311 { 312 $documentID = (int)$_GET['documentid']; 313 314 if($documentID) 315 { 316 $this->bomydms->deleteDocument($documentID); 317 } 318 print '<script language="JavaScript">window.close();</script>'; 319 } 320 321 function deleteFile() 322 { 323 $documentID = (int)$_GET['documentid']; 324 $version = (int)$_GET['version']; 325 326 if($documentID && $version) 327 { 328 $this->bomydms->deleteFile($documentID, $version); 329 $this->viewDocument($documentID); 330 } 331 } 332 333 function deleteNotification() 334 { 335 $documentID = (int)$_GET['documentid']; 336 $userID = (int)$_GET['userid']; 337 $groupID = (int)$_GET['groupid']; 338 339 if($documentID && ($userID || $groupID)) 340 { 341 $this->bomydms->deleteNotification($documentID, (!$userID ? false : $userID), (!$groupID ? false : $groupID)); 342 $this->viewDocument($documentID); 343 } 344 } 345 346 function display_app_header() 347 { 348 if(!@is_object($GLOBALS['egw']->js)) 349 { 350 $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); 351 } 352 if (!is_object($GLOBALS['egw']->jscalendar)) 353 { 354 $GLOBALS['egw']->jscalendar = CreateObject('phpgwapi.jscalendar'); 355 } 356 $GLOBALS['egw']->js->validate_file('dhtmlxtree','js/dhtmlXCommon'); 357 $GLOBALS['egw']->js->validate_file('dhtmlxtree','js/dhtmlXTree'); 358 switch($_GET['menuaction']) 359 { 360 case 'mydms.uimydms.addACL': 361 case 'mydms.uimydms.addNotification': 362 case 'mydms.uimydms.deleteACL': 363 case 'mydms.uimydms.deleteFile': 364 case 'mydms.uimydms.deleteNotification': 365 case 'mydms.uimydms.setDefaultAccess': 366 case 'mydms.uimydms.setOwner': 367 case 'mydms.uimydms.updateACL': 368 case 'mydms.uimydms.updateFile': 369 case 'mydms.uimydms.viewDocument': 370 case 'mydms.uimydms.inheritACL': 371 $GLOBALS['egw']->js->validate_file('tabs','tabs'); 372 $GLOBALS['egw']->js->validate_file('jscode','viewDocument','mydms'); 373 $GLOBALS['egw']->js->validate_file('jscode','mydms','mydms'); 374 375 $GLOBALS['egw']->js->set_onload('javascript:initTabs();'); 376 break; 377 case 'mydms.uimydms.folderChooser': 378 $GLOBALS['egw']->js->validate_file('jscode','mydms','mydms'); 379 $GLOBALS['egw']->js->validate_file('jscode','folderChooser','mydms'); 380 break; 381 } 382 383 $GLOBALS['egw_info']['flags']['include_xajax'] = True; 384 385 $GLOBALS['egw']->common->egw_header(); 386 #if(!$this->mailPreferences['messageNewWindow']) 387 # echo parse_navbar(); 388 } 389 390 function getFolderTree($path, $level = 0, $_activeObj, $isFolder) 391 { 392 return $this->createHTMLFolder($path, $_activeObj, 'mydmstreebox'); 393 } 394 395 function inheritACL() 396 { 397 $documentID = (int)$_GET['documentid']; 398 $action = $_GET['action']; 399 $mode = $_GET['mode']; 400 401 if($documentID && $action) 402 { 403 $this->bomydms->inheritACL($documentID, $action, $mode); 404 $this->viewDocument($documentID); 405 } 406 } 407 408 function setDefaultAccess() 409 { 410 $documentID = (int)$_GET['documentid']; 411 $mode = $_POST['defaultAccess']; 412 413 if($documentID && $mode) 414 { 415 $this->bomydms->setDefaultAccess($documentID, $mode); 416 $this->viewDocument($documentID); 417 } 418 } 419 420 function setOwner() 421 { 422 $documentID = (int)$_GET['documentid']; 423 $owner = (int)$_POST['owner']; 424 425 if($documentID && $owner) 426 { 427 $this->bomydms->setOwner($documentID, $owner); 428 $this->viewDocument($documentID); 429 } 430 } 431 432 function translate() 433 { 434 $this->t->set_var('lang_informations',lang('informations')); 435 $this->t->set_var('lang_all_versions',lang('all versions')); 436 $this->t->set_var('lang_linked_documents',lang('linked documents')); 437 $this->t->set_var('lang_owner',lang('owner')); 438 $this->t->set_var('lang_comment',lang('comment')); 439 $this->t->set_var('lang_keywords',lang('keywords')); 440 $this->t->set_var('lang_download',lang('download')); 441 $this->t->set_var('lang_last_update',lang('last update')); 442 $this->t->set_var('lang_current_version',lang('current version')); 443 $this->t->set_var('lang_uploaded_by',lang('uploaded by')); 444 $this->t->set_var('lang_file_size',lang('file size')); 445 $this->t->set_var('lang_filename',lang('filename')); 446 $this->t->set_var('lang_mime_type',lang('mime type')); 447 $this->t->set_var('lang_comment_for_current_version',lang('comment for current version')); 448 $this->t->set_var('lang_creation_date',lang('creation date')); 449 $this->t->set_var('lang_lock_status',lang('lock status')); 450 $this->t->set_var('lang_expires',lang('expires')); 451 $this->t->set_var('lang_version',lang('version')); 452 $this->t->set_var('lang_upload_date',lang('upload date')); 453 $this->t->set_var('lang_save',lang('save')); 454 $this->t->set_var('lang_cancel',lang('cancel')); 455 $this->t->set_var('lang_delete',lang('delete')); 456 $this->t->set_var('lang_view_online',lang('view online')); 457 $this->t->set_var('lang_confirm_delete',lang('Do you really want to delete this document?')); 458 $this->t->set_var('lang_update_document',lang('update document')); 459 $this->t->set_var('lang_update',lang('update')); 460 $this->t->set_var('lang_acl',lang('acl')); 461 $this->t->set_var('lang_name',lang('name')); 462 $this->t->set_var('lang_move_document',lang('move document')); 463 $this->t->set_var('lang_folder',lang('folder')); 464 $this->t->set_var('lang_user',lang('user')); 465 $this->t->set_var('lang_group',lang('group')); 466 $this->t->set_var('lang_acl',lang('acl')); 467 $this->t->set_var('lang_acl_get_inherited',lang('acl get inherited')); 468 $this->t->set_var('lang_notifications',lang('notifications')); 469 $this->t->set_var('lang_file_gets_unlocked',lang('this document gets unlocked by you.')); 470 $this->t->set_var('lang_file_gets_locked',lang('this document gets locked by you!')); 471 $this->t->set_var('lang_delete_this_notification',lang('delete this notification')); 472 $this->t->set_var('lang_add_notification',lang('add notification')); 473 $this->t->set_var('lang_information_about_last_update',lang('information about last update')); 474 $this->t->set_var('lang_general_information',lang('general information')); 475 $this->t->set_var('lang_copy_acl',lang('copy acl')); 476 $this->t->set_var('lang_create_empty_acl',lang('create empty acl')); 477 $this->t->set_var('lang_inherit_acl_again',lang('inherit acl again')); 478 $this->t->set_var('lang_default_access',lang('default access')); 479 $this->t->set_var('lang_permission',lang('permission')); 480 $this->t->set_var('lang_add_acl',lang('add acl')); 481 $this->t->set_var('lang_current_acl',lang('current acl')); 482 $this->t->set_var('lang_access_mode',lang('access mode')); 483 $this->t->set_var('lang_confirm_acl_delete',lang('Do you really want to delete this acl?')); 484 } 485 486 function updateACL() 487 { 488 $userID = (int)$_GET['userid']; 489 $groupID = (int)$_GET['groupid']; 490 $access = (int)$_POST['mode']; 491 492 $documentID = (int)$_GET['documentid']; 493 494 if($documentID) 495 { 496 $this->bomydms->updateACL($documentID, ($userID == 'unselected' ? false : (int)$userID), ($groupID == 'unselected' ? false : (int)$groupID), $access); 497 $this->viewDocument($documentID); 498 } 499 } 500 501 function updateDocument() 502 { 503 $fileName = $_POST['fname']; 504 $comment = $_POST['comment']; 505 $keywords = $_POST['keywords']; 506 $expire = $_POST['expire']; 507 $expire_date = $GLOBALS['egw']->jscalendar->input2date($_POST['expire_date']); 508 $lockStatus = $_POST['lockStatus']; 509 $targetID = $_POST['targetid']; 510 511 $documentID = (int)$_GET['documentid']; 512 513 if($documentID) 514 { 515 $this->bomydms->updateDocument($documentID,$fileName,$comment,$keywords,($expire ? $expire_date['raw'] : 0)); 516 if($lockStatus != 'unchanged') 517 { 518 $this->bomydms->updateLockStatus($documentID, $lockStatus); 519 } 520 if($targetID != 'unchanged') 521 { 522 $this->bomydms->moveDocument($documentID, (int)$targetID); 523 } 524 } 525 print '<script language="JavaScript">window.close();</script>'; 526 } 527 528 function updateFile() 529 { 530 $comment = $_POST['comment']; 531 $expire = $_POST['expire']; 532 $expire_date = $GLOBALS['egw']->jscalendar->input2date($_POST['expire_date_update']); 533 $documentID = (int)$_GET['documentid']; 534 $userfile = $_FILES['userfile']; 535 536 if($documentID && is_uploaded_file($userfile['tmp_name'])) 537 { 538 $this->bomydms->updateFile($documentID, $userfile, $comment, ($expire ? $expire_date['raw'] : 0)); 539 $this->viewDocument($documentID); 540 } 541 } 542 543 function viewDocument($_documentID=false) 544 { 545 $documentID = ($_documentID === false ? (int)$_GET['documentid'] : $_documentID); 546 547 if(!$document = getDocument($documentID)) 548 { 549 print "Access denied!"; exit; 550 } 551 $user = getUser($GLOBALS['egw_info']['user']['account_id']); 552 $accessMode = $document->getAccessMode($user); 553 $owner = $document->getOwner(); 554 $folder = $document->getFolder(); 555 $latestContent = $document->getLatestContent(); 556 $versions = $document->getContent(); 557 $notifyList = $document->getNotifyList(); 558 $accessList = $document->getAccessList(); 559 $updatingUser = $latestContent->getUser(); 560 561 #_debug_array($document); 562 563 $this->display_app_header(); 564 565 $this->t->set_file(array("viewDocument" => "viewDocument.tpl")); 566 $this->t->set_block('viewDocument', 'main', 'main'); 567 $this->t->set_block('viewDocument', 'acl_row', 'acl_row'); 568 $this->t->set_block('viewDocument', 'lock_row', 'lock_row'); 569 $this->t->set_block('viewDocument', 'version_row', 'version_row'); 570 $this->t->set_block('viewDocument', 'notification_row', 'notification_row'); 571 $this->t->set_block('viewDocument', 'information_ro', 'information_ro'); 572 $this->t->set_block('viewDocument', 'information_rw', 'information_rw'); 573 $this->t->set_block('viewDocument', 'block_download', 'block_download'); 574 $this->t->set_block('viewDocument', 'block_view_online', 'block_view_online'); 575 $this->t->set_block('viewDocument', 'block_delete', 'block_delete'); 576 $this->t->set_block('viewDocument', 'block_change_owner', 'block_change_owner'); 577 $this->t->set_block('viewDocument', 'block_acl_inherite', 'block_acl_inherite'); 578 $this->t->set_block('viewDocument', 'block_acl_notinherite', 'block_acl_notinherite'); 579 580 $downloadImage = $GLOBALS['egw']->common->image('mydms','download'); 581 $viewImage = $GLOBALS['egw']->common->image('mydms','view'); 582 $deleteImage = $GLOBALS['egw']->common->image('mydms','del'); 583 $groupImage = $GLOBALS['egw']->common->image('mydms','groupicon'); 584 $userImage = $GLOBALS['egw']->common->image('mydms','usericon'); 585 $saveImage = $GLOBALS['egw']->common->image('mydms','save'); 586 $this->t->set_var('download_image',$downloadImage); 587 $this->t->set_var('view_image',$viewImage); 588 $this->t->set_var('delete_image',$deleteImage); 589 $this->t->set_var('save_image',$saveImage); 590 591 592 $this->translate(); 593 594 $linkData = array 595 ( 596 'menuaction' => 'mydms.uimydms.folderChooser', 597 ); 598 $this->t->set_var('folderChooserURL', $GLOBALS['egw']->link('/index.php',$linkData)); 599 600 $linkData = array 601 ( 602 'menuaction' => 'mydms.uimydms.updateDocument', 603 'documentid' => $documentID, 604 ); 605 $this->t->set_var('action_informations', $GLOBALS['egw']->link('/index.php',$linkData)); 606 607 // download link 608 $linkData = array 609 ( 610 'documentid' => $documentID, 611 'version' => $latestContent->getVersion(), 612 ); 613 $this->t->set_var('download_link', $GLOBALS['egw']->link('/mydms/op/op.Download.php',$linkData)); 614 $this->t->parse('download','block_download',True); 615 616 // view Online 617 if ($latestContent->viewOnline()) 618 { 619 $linkData = array 620 ( 621 'documentid' => $documentID, 622 'version' => $latestContent->getVersion() 623 ); 624 $this->t->set_var('view_link', $GLOBALS['egw']->link('/mydms/op/op.ViewOnline.php',$linkData)); 625 $this->t->parse('view_online','block_view_online',True); 626 } 627 628 // delete link 629 if ($accessMode == M_ALL) 630 { 631 $linkData = array 632 ( 633 'menuaction' => 'mydms.uimydms.deleteDocument', 634 'documentid' => $documentID, 635 ); 636 $this->t->set_var('delete_link', $GLOBALS['egw']->link('/index.php',$linkData)); 637 $this->t->parse('delete','block_delete',True); 638 } 639 640 $this->t->set_var('owner_fullname', $owner->getFullName()); 641 $this->t->set_var('owner_email', $owner->getEmail()); 642 643 $this->t->set_var('updater_fullname', $updatingUser->getFullName()); 644 $this->t->set_var('updater_email', $updatingUser->getEmail()); 645 646 $this->t->set_var('filename', $document->getName()); 647 $this->t->set_var('comment', $document->getComment()); 648 $this->t->set_var('keywords', $document->getKeywords()); 649 $this->t->set_var('creation_date', date("d.m.Y - H:i:s",$document->getDate())); 650 651 $this->t->set_var('foldername', $folder->getName()); 652 $this->t->set_var('current_folder_id', $folder->getID()); 653 654 // lock status 655 // lock select box 656 657 if ($document->isLocked()) 658 { 659 $lockingUser = $document->getLockingUser(); 660 661 $this->t->set_var('lang_current_status', lang('this document is locked by <a href="mailto:%1">%2</a>.',$lockingUser->getEmail(),$lockingUser->getFullName())); 662 $this->t->set_var('checked_lock_status', 'checked'); 663 $this->t->parse('locking','lock_row',True); 664 } 665 else 666 { 667 $this->t->set_var('lang_current_status', lang('this document is currently not locked.')); 668 669 $this->t->parse('locking','lock_row', True); 670 } 671 672 // expire select box 673 $selectOptions = array('0' => lang('does not expire'), '1' => lang('expires after')); 674 $this->t->set_var('select_expire',$GLOBALS['egw']->html->select('expire',(!$document->getExpires() ? 0 : 1),$selectOptions,true,"onchange=\"toggleJSCal(this);\"")); 675 #$this->t->set_var('select_expire',$GLOBALS['egw']->html->select('expire',(!$document->getExpires() ? 0 : 1),$selectOptions,true,"onchange=\"alert('test')\"")); 676 677 if (!$document->getExpires()) 678 { 679 $this->t->set_var('expire_date_ro',lang('does not expire')); 680 $this->t->set_var('expire_date',$GLOBALS['egw']->jscalendar->input('expire_date','')); 681 $this->t->set_var('expire_class', 'inactive'); 682 } 683 else 684 { 685 $this->t->set_var('expire_date_ro',lang('expires after').' '.date("d.m.Y",$document->getExpires())); 686 $this->t->set_var('expire_date',$GLOBALS['egw']->jscalendar->input('expire_date',$document->getExpires())); 687 $this->t->set_var('expire_class', 'active'); 688 } 689 690 $this->t->set_var('current_version', $latestContent->getVersion()); 691 $this->t->set_var('current_comment', $latestContent->getComment()); 692 $this->t->set_var('mime_type', $latestContent->getMimeType()); 693 $this->t->set_var('file_size', filesize($GLOBALS['phpgw_info']['server']['files_dir'] . '/mydms/' . $latestContent->getPath())); 694 $this->t->set_var('last_update', date("d.m.Y - H:i:s",$latestContent->getDate())); 695 696 $this->t->set_var('rownum', count($versions)+1); 697 698 if (($accessMode >= M_READWRITE)) 699 { 700 $this->t->parse('informations','information_rw',True); 701 } 702 else 703 { 704 $this->t->parse('informations','information_ro',True); 705 } 706 707 for ($i = count($versions)-1; $i >= 0; $i--) 708 { 709 $version = $versions[$i]; 710 $uploadingUser = $version->getUser(); 711 $comment = $version->getComment(); 712 //if (strlen($comment) > 25) $comment = substr($comment, 0, 22) . "..."; 713 714 $this->t->set_var('version_version', $version->getVersion()); 715 $this->t->set_var('version_comment', $version->getComment()); 716 $this->t->set_var('version_uploadingUser', $uploadingUser->getFullName()); 717 $this->t->set_var('version_date', date("d.m.Y - H:i:s",$version->getDate())); 718 if ($version->viewOnline()) 719 $this->t->set_var('url_view_online', "<a target=\"_blank\" href=\"../op/viewonline" . $version->getURL()."\"><img src=\"images/view.gif\" width=18 height=18 border=0 title=\"".lang('view online')."\"></a>"); 720 else 721 $this->t->set_var('url_view_online', ''); 722 723 $linkData = array 724 ( 725 'documentid' => $documentID, 726 'version' => $version->getVersion() 727 ); 728 $this->t->set_var('url_download_file', $GLOBALS['egw']->link('/mydms/op/op.Download.php',$linkData)); 729 730 if (($accessMode == M_ALL) && (count($versions) > 1)) 731 { 732 $linkData = array 733 ( 734 'menuaction' => 'mydms.uimydms.deleteFile', 735 'documentid' => $documentID, 736 'version' => $version->getVersion(), 737 'tabpage' => 2, 738 ); 739 $this->t->set_var('url_delete_file', 740 "<a href=\"".$GLOBALS['egw']->link('/index.php',$linkData). 741 "\" onClick=\"return confirm('".lang('do you really want to delete this version of the document?'). 742 "');\"><img src=\"$deleteImage\" width=15 height=15 border=0 title=\"". 743 lang("delete")."\"></a>"); 744 } 745 746 $this->t->parse('versions','version_row',True); 747 } 748 749 // div 4 notifications 750 $linkData = array 751 ( 752 'menuaction' => 'mydms.uimydms.addNotification', 753 'documentid' => $documentID, 754 'tabpage' => 4, 755 ); 756 $this->t->set_var('notify_form_action', $GLOBALS['egw']->link('/index.php',$linkData)); 757 758 foreach ((array)$notifyList["users"] as $userNotify) 759 { 760 $this->t->set_var('notify_username',$userNotify->getFullName()); 761 $this->t->set_var('notify_image',$userImage); 762 763 $linkData = array 764 ( 765 'menuaction' => 'mydms.uimydms.deleteNotification', 766 'documentid' => $documentID, 767 'userid' => $userNotify->getID(), 768 'tabpage' => 4, 769 ); 770 $this->t->set_var('link_notify_delete', $GLOBALS['egw']->link('/index.php',$linkData)); 771 772 $this->t->parse('notifications','notification_row',True); 773 } 774 775 foreach ((array)$notifyList["groups"] as $groupNotify) 776 { 777 $this->t->set_var('notify_username',$groupNotify->getName()); 778 $this->t->set_var('notify_image',$groupImage); 779 780 $linkData = array 781 ( 782 'menuaction' => 'mydms.uimydms.deleteNotification', 783 'documentid' => $documentID, 784 'groupid' => $groupNotify->getID(), 785 'tabpage' => 4, 786 ); 787 $this->t->set_var('link_notify_delete', $GLOBALS['egw']->link('/index.php',$linkData)); 788 789 $this->t->parse('notifications','notification_row',True); 790 } 791 792 $allUsers = getAllUsers(); 793 $allUsersOptions = array('unselected' => lang('please select').'...'); 794 foreach ($allUsers as $userObj) 795 { 796 $allUsersOptions[$userObj->getID()] = $userObj->getFullName(); 797 } 798 $this->t->set_var('select_userid',$GLOBALS['egw']->html->select('userid',0,$allUsersOptions,true,"style=\"width: 300px;\" onchange=\"javascript:document.notify_form.submit();\"")); 799 800 $allGroups = getAllGroups(); 801 $allGroupsOptions = array('unselected' => lang('please select').'...'); 802 foreach ($allGroups as $groupObj) 803 { 804 $allGroupsOptions[$groupObj->getID()] = $groupObj->getName(); 805 } 806 $this->t->set_var('select_groupid',$GLOBALS['egw']->html->select('groupid',0,$allGroupsOptions,true,"style=\"width: 300px;\" onchange=\"javascript:document.notify_form.submit();\"")); 807 808 // div 5 ACL 809 if ($accessMode == M_ALL) 810 { 811 if ($user->isAdmin()) 812 { 813 $linkData = array 814 ( 815 'menuaction' => 'mydms.uimydms.setOwner', 816 'documentid' => $documentID, 817 'tabpage' => 5, 818 ); 819 $this->t->set_var('action_change_owner', $GLOBALS['egw']->link('/index.php',$linkData)); 820 821 $allUsers = getAllUsers(); 822 $allUsersOptions = array(); 823 foreach ($allUsers as $userObj) 824 { 825 $allUsersOptions[$userObj->getID()] = $userObj->getFullName(); 826 } 827 $this->t->set_var('select_ownerid',$GLOBALS['egw']->html->select('owner',$owner->getID(),$allUsersOptions,true,"style=\"width: 300px;\" onchange=\"javascript:document.change_owner.submit();\"")); 828 829 $this->t->parse('change_owner','block_change_owner',True); 830 } 831 832 if ($document->inheritsAccess()) 833 { 834 $linkData = array 835 ( 836 'menuaction' => 'mydms.uimydms.inheritACL', 837 'documentid' => $documentID, 838 'action' => 'notinherit', 839 'mode' => 'copy', 840 'tabpage' => 5, 841 ); 842 $this->t->set_var('link_acl_copy', $GLOBALS['egw']->link('/index.php',$linkData)); 843 844 $linkData = array 845 ( 846 'menuaction' => 'mydms.uimydms.inheritACL', 847 'documentid' => $documentID, 848 'action' => 'notinherit', 849 'mode' => 'empty', 850 'tabpage' => 5, 851 ); 852 $this->t->set_var('link_acl_empty', $GLOBALS['egw']->link('/index.php',$linkData)); 853 854 $this->t->parse('display_acl','block_acl_inherite',True); 855 } 856 else 857 { 858 $linkData = array 859 ( 860 'menuaction' => 'mydms.uimydms.inheritACL', 861 'documentid' => $documentID, 862 'action' => 'inherit', 863 'tabpage' => 5, 864 ); 865 $this->t->set_var('link_acl_inherit_again', $GLOBALS['egw']->link('/index.php',$linkData)); 866 867 $linkData = array 868 ( 869 'menuaction' => 'mydms.uimydms.setDefaultAccess', 870 'documentid' => $documentID, 871 'tabpage' => 5, 872 ); 873 $this->t->set_var('action_change_default_access', $GLOBALS['egw']->link('/index.php',$linkData)); 874 875 $linkData = array 876 ( 877 'menuaction' => 'mydms.uimydms.addACL', 878 'documentid' => $documentID, 879 'tabpage' => 5, 880 ); 881 $this->t->set_var('action_add_acl', $GLOBALS['egw']->link('/index.php',$linkData)); 882 883 884 $defaultACL = array 885 ( 886 M_NONE => 'access_mode_none', 887 M_READ => 'access_mode_read', 888 M_READWRITE => 'access_mode_readwrite', 889 M_ALL => 'access_mode_all', 890 ); 891 $this->t->set_var('select_default_access',$GLOBALS['egw']->html->select('defaultAccess',$document->getDefaultAccess(),$defaultACL,false,"style=\"width: 300px;\" onchange=\"javascript:document.change_default_access.submit();\"")); 892 893 foreach ((array)$accessList["users"] as $userAccess) 894 { 895 $userObj = $userAccess->getUser(); 896 $userMode = $userAccess->getMode(); 897 898 $this->t->set_var('acl_username',$userObj->getFullName()); 899 $this->t->set_var('acl_image',$userImage); 900 901 $linkData = array 902 ( 903 'menuaction' => 'mydms.uimydms.updateACL', 904 'documentid' => $documentID, 905 'userid' => $userObj->getID(), 906 'tabpage' => 5, 907 ); 908 $this->t->set_var('action_acl_row', $GLOBALS['egw']->link('/index.php',$linkData)); 909 910 $linkData = array 911 ( 912 'menuaction' => 'mydms.uimydms.deleteACL', 913 'documentid' => $documentID, 914 'userid' => $userObj->getID(), 915 'tabpage' => 5, 916 ); 917 $this->t->set_var('link_acl_delete', $GLOBALS['egw']->link('/index.php',$linkData)); 918 919 $this->t->set_var('acl_selectbox',$GLOBALS['egw']->html->select('mode',$userAccess->getMode(),$defaultACL,false,"style=\"width: 300px;\"")); 920 921 $this->t->parse('acls','acl_row',True); 922 } 923 924 foreach ((array)$accessList["groups"] as $groupAccess) 925 { 926 $groupObj = $groupAccess->getGroup(); 927 $groupMode = $groupAccess->getMode(); 928 929 $this->t->set_var('acl_username',$groupObj->getName()); 930 $this->t->set_var('acl_image',$groupImage); 931 932 $linkData = array 933 ( 934 'menuaction' => 'mydms.uimydms.updateACL', 935 'documentid' => $documentID, 936 'groupid' => $groupObj->getID(), 937 'tabpage' => 5, 938 ); 939 $this->t->set_var('action_acl_row', $GLOBALS['egw']->link('/index.php',$linkData)); 940 941 $linkData = array 942 ( 943 'menuaction' => 'mydms.uimydms.deleteACL', 944 'documentid' => $documentID, 945 'groupid' => $groupObj->getID(), 946 'tabpage' => 5, 947 ); 948 $this->t->set_var('link_acl_delete', $GLOBALS['egw']->link('/index.php',$linkData)); 949 950 $this->t->set_var('acl_selectbox',$GLOBALS['egw']->html->select('mode',$groupAccess->getMode(),$defaultACL,false,"style=\"width: 300px;\"")); 951 952 $this->t->parse('acls','acl_row',True); 953 } 954 955 956 $allUsers = getAllUsers(); 957 $allUsersOptions = array('unselected' => lang('please select').'...'); 958 foreach ($allUsers as $userObj) 959 { 960 $allUsersOptions[$userObj->getID()] = $userObj->getFullName(); 961 } 962 $this->t->set_var('select_add_acl_userid',$GLOBALS['egw']->html->select('userid',0,$allUsersOptions,true,"style=\"width: 300px;\" oonchange=\"javascript:document.notify_form.submit();\"")); 963 964 $allGroups = getAllGroups(); 965 $allGroupsOptions = array('unselected' => lang('please select').'...'); 966 foreach ($allGroups as $groupObj) 967 { 968 $allGroupsOptions[$groupObj->getID()] = $groupObj->getName(); 969 } 970 $this->t->set_var('select_add_acl_groupid',$GLOBALS['egw']->html->select('groupid',0,$allGroupsOptions,true,"style=\"width: 300px;\" oonchange=\"javascript:document.notify_form.submit();\"")); 971 972 $this->t->set_var('select_add_acl_permission',$GLOBALS['egw']->html->select('access',M_READ,$defaultACL,false,"style=\"width: 300px;\" oonchange=\"javascript:document.change_default_access.submit();\"")); 973 974 $this->t->parse('display_acl','block_acl_notinherite',True); 975 } 976 } 977 978 // div 6 update file 979 980 $linkData = array 981 ( 982 'menuaction' => 'mydms.uimydms.updateFile', 983 'documentid' => $documentID, 984 ); 985 $this->t->set_var('action_update_file', $GLOBALS['egw']->link('/index.php',$linkData)); 986 987 // expire select box 988 $this->t->set_var('select_expire_update',$GLOBALS['egw']->html->select('expire',0,$selectOptions,true,"onchange=\"toggleJSCalUpdate(this);\"")); 989 990 $this->t->set_var('expire_date_update',$GLOBALS['egw']->jscalendar->input('expire_date_update','')); 991 $this->t->set_var('expire_class_update', 'inactive'); 992 993 994 $this->t->parse("out","main"); 995 996 print $this->t->get('out','main'); 997 } 998 999 } 1000 1001 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |