| [ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 3 function getThemes() 4 { 5 GLOBAL $settings; 6 7 $themes = array(); 8 9 $path = $settings->_rootDir . "themes/"; 10 $handle = opendir($path); 11 12 while ($entry = readdir($handle) ) 13 { 14 if ($entry == ".." || $entry == ".") 15 continue; 16 else if (is_dir($path . $entry)) 17 array_push($themes, $entry); 18 } 19 closedir($handle); 20 21 return $themes; 22 } 23 24 $theme = $settings->_theme; 25 26 function printHTMLHead($title) 27 { 28 global $theme; 29 30 $GLOBALS['egw_info']['flags'] = array( 31 'currentapp' => 'mydms', 32 'noheader' => True, 33 'nonavbar' => True 34 ); 35 include_once('../../header.inc.php'); 36 37 if(!@is_object($GLOBALS['egw']->js)) 38 { 39 $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); 40 } 41 $GLOBALS['egw']->js->validate_file('dhtmlxtree','js/dhtmlXCommon'); 42 $GLOBALS['egw']->js->validate_file('dhtmlxtree','js/dhtmlXTree'); 43 44 $GLOBALS['egw']->js->validate_file('jscode','mydms','mydms'); 45 46 $GLOBALS['egw']->common->phpgw_header(); 47 echo parse_navbar(); 48 49 if ( is_file("../themes/$theme/styles.css") ) 50 $stylesheet="../themes/$theme/styles.css"; 51 else 52 $stylesheet="../themes/default/styles.css"; 53 54 if ( is_file("../themes/$theme/HTMLHead.html" ) ) 55 include("../themes/$theme/HTMLHead.html"); 56 else 57 include ("../themes/default/HTMLHead.html"); 58 } 59 60 function printHTMLFoot() 61 { 62 global $theme; 63 64 $GLOBALS['egw']->common->phpgw_footer(); 65 if ( is_file("../themes/$theme/HTMLFoot.html" ) ) 66 { 67 include("../themes/$theme/HTMLFoot.html"); 68 } else { 69 include ("../themes/default/HTMLFoot.html"); 70 } 71 } 72 73 function printStartBox($header) 74 { 75 global $theme; 76 77 if ( is_file("../themes/$theme/StartBox.html" ) ) 78 { 79 include("../themes/$theme/StartBox.html"); 80 } else { 81 include ("../themes/default/StartBox.html"); 82 } 83 } 84 85 function printNextBox($header) 86 { 87 global $theme; 88 89 if ( is_file("../themes/$theme/NextBox.html" ) ) 90 { 91 include("../themes/$theme/NextBox.html"); 92 } else { 93 include ("../themes/default/NextBox.html"); 94 } 95 } 96 97 function printEndBox() 98 { 99 global $theme; 100 101 if ( is_file("../themes/$theme/EndBox.html" ) ) 102 { 103 include("../themes/$theme/EndBox.html"); 104 } else { 105 include ("../themes/default/EndBox.html"); 106 } 107 } 108 109 function printCenterStart() 110 { 111 print "<table width=\"100%\" height=\"60%\"><tr><td align=\"center\" valign=\"middle\">"; 112 } 113 114 function printCenterEnd() 115 { 116 print "</td></tr></table>"; 117 } 118 119 function printGoBack() 120 { 121 print "<p><a href=\"javascript:history.back()\">".getMLText("back")."</a>"; 122 } 123 124 function printGoto($targets) 125 { 126 print "<p>".getMLText("goto").": "; 127 for ($i = 0; $i < count($targets); $i++) 128 { 129 print "<a href=\"".$targets[$i][1]."\">".$targets[$i][0]."</a>"; 130 if ($i+1 < count($targets)) 131 print " | "; 132 } 133 } 134 135 136 function printTitleBar($folder) 137 { 138 return; 139 140 global $user, $settings, $theme; 141 142 $options=array(); 143 $options[getMLText("content")]=$settings->_httpRoot . "out/out.ViewFolder.php?folderid=" . $folder->getID(); 144 $options[getMLText("search")]=$settings->_httpRoot . "out/out.SearchForm.php?folderid=" . $folder->getID(); 145 146 if ($user->getID() != $settings->_guestID) 147 //$options[getMLText("my_account")]=$settings->_httpRoot . "out/out.EditUserData.php"; 148 149 if ($user->isAdmin()) 150 { 151 $options[getMLText("admin_tools")] = $settings->_httpRoot . "out/out.AdminTools.php"; 152 // $options[getMLText("user_management")]=$settings->_httpRoot . "out/out.UsrMgr.php"; 153 // $options[getMLText("group_management")]=$settings->_httpRoot . "out/out.GroupMgr.php"; 154 } else 155 $options[getMLText("user_list")]=$settings->_httpRoot . "out/out.UserList.php"; 156 157 //$options[getMLText("logout")]=$settings->_httpRoot . "op/op.Logout.php"; 158 159 $title=getMLText("logged_in_as")." ".$user->getFullName(); 160 $menu = buildMenu( $options, "titlebar" ); 161 162 if ( is_file("../themes/$theme/TitleBar.html" ) ) 163 { 164 include("../themes/$theme/TitleBar.html"); 165 } else { 166 include ("../themes/default/TitleBar.html"); 167 } 168 } 169 170 171 function printFolderTree($path, $level = 0, $activeObj, $isFolder) 172 { 173 GLOBAL $user; 174 175 #$folder = $path[$level]; 176 #$subFolders = $folder->getSubFolders(); 177 #$subFolders = filterAccess($subFolders, $user, M_READ); 178 179 $allSubFolders = array(); 180 foreach($path as $folderObject) 181 { 182 $allSubFolders['_id'.$folderObject->getID()] = $folderObject; 183 $subFoldersL1 = $folderObject->getSubFolders(); 184 foreach((array)$subFoldersL1 as $subFolderL1Object) 185 { 186 $allSubFolders['_id'.$subFolderL1Object->getID()] = $subFolderL1Object; 187 $subFoldersL2 = $subFolderL1Object->getSubFolders(); 188 foreach((array)$subFoldersL2 as $subFolderL2Object) 189 { 190 $allSubFolders['_id'.$subFolderL2Object->getID()] = $subFolderL2Object; 191 } 192 } 193 } 194 195 $uimydms =& CreateObject('mydms.uimydms'); 196 print $uimydms->folderChooser($allSubFolders, $activeObj); 197 198 return; 199 } 200 201 202 function printFolderPageStart($folder) 203 { 204 global $theme; 205 206 $uimydms =& CreateObject('mydms.uimydms'); 207 208 $title1 = getMLText("foldertree"); 209 $title2 = "<img src='".getImgPath("folder_opened.gif")."' ". 210 "width='18' height='18' alt='' border='0' align='absmiddle'> ". 211 getMLText("selected_folder") . ": " . $folder->getName(); 212 $path = $folder->getPathNew(); 213 214 $txtpath = ''; 215 foreach($path as $folderObject) 216 { 217 if(!empty($txtpath)) $txtpath .= " / "; 218 $txtpath .= "<a class=\"path\" href=\"out.ViewFolder.php?folderid=".$folderObject->getID()."\">". 219 $folderObject->getName()."</a>"; 220 } 221 222 $txtpath = getMLText("folder_path") . ": " . $txtpath; 223 224 if ( is_file("../themes/$theme/FolderPageStart.html" ) ) 225 { 226 include("../themes/$theme/FolderPageStart.html"); 227 } else { 228 include ("../themes/default/FolderPageStart.html"); 229 } 230 231 } 232 233 function printFolderPageEnd($folder) 234 { 235 GLOBAL $user, $theme; 236 237 $title = getMLText("edit_folder"); 238 $options=array(); 239 $accessMode = $folder->getAccessMode($user); 240 if ($accessMode >= M_READWRITE) 241 { 242 $options[getMLText("add_subfolder")] = "out.AddSubFolder.php?folderid=" . $folder->getID(); 243 $options[getMLText("add_document")] = "out.AddDocument.php?folderid=" . $folder->getID(); 244 $options[getMLText("edit_folder_props")] = "out.EditFolder.php?folderid=" . $folder->getID(); 245 $options[getMLText("edit_folder_notify")] = "out.FolderNotify.php?folderid=" . $folder->getID(); 246 $options[getMLText("move_folder")] = "out.MoveFolder.php?folderid=" . $folder->getID(); 247 } 248 249 if ($accessMode == M_ALL) 250 { 251 $options[getMLText("rm_folder")] = "out.RemoveFolder.php?folderid=" . $folder->getID(); 252 $options[getMLText("edit_folder_access")] = "out.FolderAccess.php?folderid=" . $folder->getID(); 253 } 254 255 $menu=buildMenu( $options, "editfolder" ); 256 257 if ( is_file("../themes/$theme/FolderPageEnd.html" ) ) 258 { 259 include("../themes/$theme/FolderPageEnd.html"); 260 } else { 261 include ("../themes/default/FolderPageEnd.html"); 262 } 263 } 264 265 function printPageHeader($header) 266 { 267 print "<p><div class=\"pageHeader\">".$header."</div></p>\n"; 268 } 269 270 function printDocumentPageStart($document) 271 { 272 global $theme; 273 274 $uimydms =& CreateObject('mydms.uimydms'); 275 276 $folder = $document->getFolder(); 277 $title1 = getMLText("foldertree"); 278 $title2 = "<img src='".getImgPath("file.gif")."' ". 279 "width='18' height='18' alt='' border='0' align='absmiddle'> ". 280 getMLText("selected_document") . ": " . $document->getName(); 281 282 $path = $folder->getPathNew(); 283 284 $txtpath = ''; 285 foreach($path as $folderObject) 286 { 287 if(!empty($txtpath)) $txtpath .= " / "; 288 $txtpath .= "<a class=\"path\" href=\"out.ViewFolder.php?folderid=".$folderObject->getID()."\">". 289 $folderObject->getName()."</a>"; 290 } 291 292 $txtpath = getMLText("folder_path") . ": " . $txtpath; 293 294 if ( is_file("../themes/$theme/DocumentPageStart.html" ) ) 295 { 296 include("../themes/$theme/DocumentPageStart.html"); 297 } else { 298 include ("../themes/default/DocumentPageStart.html"); 299 } 300 } 301 302 function printDocumentPageEnd($document) 303 { 304 GLOBAL $user, $theme; 305 306 $docid=".php?documentid=" . $document->getID(); 307 $title = getMLText("edit_document"); 308 $options=array(); 309 $accessMode = $document->getAccessMode($user); 310 if ($accessMode >= M_READWRITE) 311 { 312 if (!$document->isLocked()) 313 { 314 $options[getMLText("update_document")] = "out.UpdateDocument" . $docid; 315 $options[getMLText("lock_document")] = "../op/op.LockDocument" . $docid; 316 $options[getMLText("edit_document_props")] = "out.EditDocument" . $docid; 317 $options[getMLText("expires")] = "out.SetExpires" . $docid; 318 $options[getMLText("edit_document_notify")] = "out.DocumentNotify" . $docid; 319 $options[getMLText("move_document")] = "out.MoveDocument" . $docid; 320 } else { 321 $lockingUser = $document->getLockingUser(); 322 if (($lockingUser->getID() == $user->getID()) || ($document->getAccessMode($user) == M_ALL)) 323 { 324 $options[getMLText("update_document")] = "out.UpdateDocument" . $docid; 325 $options[getMLText("unlock_document")] = "../op/op.UnlockDocument" . $docid; 326 $options[getMLText("edit_document_props")]= "out.EditDocument" . $docid; 327 $options[getMLText("expires")] = "out.SetExpires" . $docid; 328 $options[getMLText("edit_document_notify")]= "out.DocumentNotify" . $docid; 329 $options[getMLText("move_document")] = "out.MoveDocument" . $docid; 330 } 331 } 332 } 333 334 if ($accessMode == M_ALL) 335 { 336 $options[getMLText("rm_document")] = "out.RemoveDocument" . $docid; 337 $options[getMLText("edit_document_access")] = "out.DocumentAccess" . $docid; 338 } 339 340 $menu=buildMenu( $options, "editfolder" ); 341 342 if ( is_file("../themes/$theme/DocumentPageEnd.html" ) ) 343 { 344 include("../themes/$theme/DocumentPageEnd.html"); 345 } else { 346 include ("../themes/default/DocumentPageEnd.html"); 347 } 348 } 349 350 function printDateChooser($defDate = -1, $varName) 351 { 352 if ($defDate == -1) 353 $defDate = mktime(); 354 $day = date("d", $defDate); 355 $month = date("m", $defDate); 356 $year = date("Y", $defDate); 357 358 print "<select name=\"" . $varName . "day\">\n"; 359 for ($i = 1; $i <= 31; $i++) 360 { 361 print "<option value=\"" . $i . "\""; 362 if (intval($day) == $i) 363 print " selected"; 364 print ">" . $i . "</option>\n"; 365 } 366 print "</select>.\n"; 367 print "<select name=\"" . $varName . "month\">\n"; 368 for ($i = 1; $i <= 12; $i++) 369 { 370 print "<option value=\"" . $i . "\""; 371 if (intval($month) == $i) 372 print " selected"; 373 print ">" . $i . "</option>\n"; 374 } 375 print "</select>.\n"; 376 print "<select name=\"" . $varName . "year\">\n"; 377 for ($i = 2004; $i <= 2010; $i++) 378 { 379 print "<option value=\"" . $i . "\""; 380 if (intval($year) == $i) 381 print " selected"; 382 print ">" . $i . "</option>\n"; 383 } 384 print "</select>"; 385 } 386 387 388 function printSequenceChooser($objArr, $keepID = -1) 389 { 390 if (count($objArr) > 0) 391 { 392 $max = $objArr[count($objArr)-1]->getSequence() + 1; 393 $min = $objArr[0]->getSequence() - 1; 394 } 395 else 396 $max = 1.0; 397 398 print "<select name=\"sequence\">\n"; 399 if ($keepID != -1) 400 print " <option value=\"keep\">" . getMLText("seq_keep"); 401 print " <option value=\"".$max."\">" . getMLText("seq_end"); 402 if (count($objArr) > 0) 403 print " <option value=\"".$min."\">" . getMLText("seq_start"); 404 405 for ($i = 0; $i < count($objArr) - 1; $i++) 406 { 407 if (($objArr[$i]->getID() == $keepID) || (($i + 1 < count($objArr)) && ($objArr[$i+1]->getID() == $keepID))) 408 continue; 409 $index = ($objArr[$i]->getSequence() + $objArr[$i+1]->getSequence()) / 2; 410 print " <option value=\"".$index."\">" . getMLText("seq_after", array("prevname" => $objArr[$i]->getName() ) ); 411 } 412 413 print "</select>"; 414 } 415 416 function printDocumentChooser($formName) { 417 GLOBAL $settings; 418 ?> 419 <script language="JavaScript"> 420 var openDlg; 421 function chooseDoc() { 422 openDlg = open("out.DocumentChooser.php?folderid=<?php echo $settings->_rootFolderID?>&form=<?php echo urlencode($formName)?>", "openDlg", "width=300,height=450,scrollbars=yes,resizable=yes,status=yes"); 423 } 424 </script> 425 <?php 426 print "<input type=\"Hidden\" name=\"docid\">"; 427 print "<input disabled name=\"docname\">"; 428 print " <input type=\"Button\" value=\"Open...\" onclick=\"chooseDoc();\">"; 429 } 430 431 432 function printFolderChooser($formName, $accessMode, $exclude = -1, $default = false) { 433 GLOBAL $settings; 434 435 $linkData = array 436 ( 437 'menuaction' => 'mydms.uimydms.folderChooser', 438 'form' => $formName, 439 'mode' => $accessMode, 440 'exlcude' => $exclude, 441 'folderid' => $settings->_rootFolderID 442 ); 443 $link = $GLOBALS['egw']->link('/index.php',$linkData); 444 445 ?> 446 <script language="JavaScript"> 447 var openDlg; 448 function chooseDoc() { 449 //openDlg = open("out.FolderChooser.php?form=<?php echo $formName?>&mode=<?php echo $accessMode?>&exclude=<?php echo $exclude?>&folderid=<?php echo $settings->_rootFolderID?>", "openDlg", "width=300,height=450,scrollbars=yes,resizable=yes,status=yes"); 450 openDlg = open("<?php echo $link?>", "openDlg", "width=300,height=450,scrollbars=yes,resizable=yes,status=yes"); 451 } 452 </script> 453 <?php 454 print "<input type=\"Hidden\" name=\"targetid\" value=\"". (($default) ? $default->getID() : "") ."\">"; 455 print "<input disabled name=\"targetname\" value=\"". (($default) ? $default->getName() : "") ."\">"; 456 print " <input type=\"Button\" value=\"Open...\" onclick=\"chooseDoc();\">"; 457 } 458 459 /* ---------------------------------------- ICONS --------------------------------------------- */ 460 461 $icons = array(); 462 $icons["txt"] = "txt.png"; 463 $icons["doc"] = "word.png"; 464 $icons["rtf"] = "document.png"; 465 $icons["xls"] = "excel.png"; 466 $icons["ppt"] = "powerpoint.png"; 467 $icons["exe"] = "binary.png"; 468 $icons["html"] = "html.png"; 469 $icons["htm"] = "html.png"; 470 $icons["gif"] = "image.png"; 471 $icons["jpg"] = "image.png"; 472 $icons["bmp"] = "image.png"; 473 $icons["png"] = "image.png"; 474 $icons["log"] = "log.png"; 475 $icons["midi"] = "midi.png"; 476 $icons["pdf"] = "pdf.png"; 477 $icons["wav"] = "sound.png"; 478 $icons["mp3"] = "sound.png"; 479 $icons["c"] = "source_c.png"; 480 $icons["cpp"] = "source_cpp.png"; 481 $icons["h"] = "source_h.png"; 482 $icons["java"] = "source_java.png"; 483 $icons["py"] = "source_py.png"; 484 $icons["tar"] = "tar.png"; 485 $icons["gz"] = "gz.png"; 486 $icons["zip"] = "gz.png"; 487 $icons["mpg"] = "video.png"; 488 $icons["avi"] = "video.png"; 489 $icons["tex"] = "tex.png"; 490 $icons["default"] = "default.png"; 491 492 function getImgPath($img) { 493 global $theme; 494 495 if ( is_file("../themes/$theme/images/$img") ) 496 { 497 return "../themes/$theme/images/$img"; 498 } 499 return "../out/images/$img"; 500 } 501 502 function printImgPath($img) 503 { 504 print getImgPath($img); 505 } 506 507 function buildMenu( $options , $class="titlebar" ) 508 { 509 $sep = ""; 510 $menu = ""; 511 reset($options); 512 while ( list($desc,$url) = each($options) ) 513 { 514 $menu.=$sep; 515 $menu.="<nobr><a href='$url' class='$class'>$desc</a></nobr>\n"; 516 $sep=" | \n"; 517 } 518 return $menu; 519 } 520 521 function getMimeIcon($fileType) 522 { 523 GLOBAL $icons; 524 525 $ext = substr($fileType, 1); 526 if (isset($icons[$ext])) 527 return $icons[$ext]; 528 else 529 return $icons["default"]; 530 } 531 ?>
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 |