[3526] | 1 | <?php |
---|
| 2 | include("../inc/inc.Settings.php"); |
---|
| 3 | include("../inc/inc.AccessUtils.php"); |
---|
| 4 | include("../inc/inc.ClassAccess.php"); |
---|
| 5 | include("../inc/inc.ClassDocument.php"); |
---|
| 6 | include("../inc/inc.ClassFolder.php"); |
---|
| 7 | include("../inc/inc.ClassGroup.php"); |
---|
| 8 | include("../inc/inc.ClassUser.php"); |
---|
| 9 | include("../inc/inc.DBAccess.php"); |
---|
| 10 | include("../inc/inc.FileUtils.php"); |
---|
| 11 | include("../inc/inc.Language.php"); |
---|
| 12 | include("../inc/inc.OutUtils.php"); |
---|
| 13 | |
---|
| 14 | include("../inc/inc.Authentication.php"); |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | function printTree($path, $level = 0) |
---|
| 18 | { |
---|
| 19 | GLOBAL $user, $form; |
---|
| 20 | |
---|
| 21 | $folder = $path[$level]; |
---|
| 22 | $subFolders = filterAccess($folder->getSubFolders(), $user, M_READ); |
---|
| 23 | $documents = filterAccess($folder->getDocuments(), $user, M_READ); |
---|
| 24 | |
---|
| 25 | if ($level+1 < count($path)) |
---|
| 26 | $nextFolderID = $path[$level+1]->getID(); |
---|
| 27 | else |
---|
| 28 | $nextFolderID = -1; |
---|
| 29 | |
---|
| 30 | print "<table cellpadding=0 cellspacing=0>\n"; |
---|
| 31 | print " <tr>\n"; |
---|
| 32 | print " <td valign=\"top\""; |
---|
| 33 | if (count($subFolders) + count($documents) > 0) |
---|
| 34 | print " background=\"".getImgPath("down.gif")."\""; |
---|
| 35 | print "><img src=\""; |
---|
| 36 | if ($level == 0) printImgPath("to_down.gif"); |
---|
| 37 | else if (count($subFolders) + count($documents) > 0) printImgPath("right_in_to_down.gif"); |
---|
| 38 | else printImgPath("right_in.gif"); |
---|
| 39 | print "\" border=0></td>\n"; |
---|
| 40 | print " <td class=\"foldertree\">"; |
---|
| 41 | print "<img src=\"".getImgPath("folder_opened.gif")."\" width=18 height=18 border=0>".$folder->getName()."</td>\n"; |
---|
| 42 | print " </tr>\n"; |
---|
| 43 | |
---|
| 44 | for ($i = 0; $i < count($subFolders); $i++) { |
---|
| 45 | print "<tr>"; |
---|
| 46 | if ($i +1 < count($subFolders) + count($documents)) |
---|
| 47 | print "<td background=\"".getImgPath("down.gif")."\" valign=\"top\"><img src=\"".getImgPath("right.gif")."\" border=0></td>"; |
---|
| 48 | else |
---|
| 49 | print "<td valign=\"top\"><img src=\"".getImgPath("right_last.gif")."\" border=0></td>"; |
---|
| 50 | print "<td>"; |
---|
| 51 | if ($subFolders[$i]->getID() == $nextFolderID) |
---|
| 52 | printTree($path, $level+1); |
---|
| 53 | else { |
---|
| 54 | $subFolders_ = filterAccess($subFolders[$i]->getSubFolders(), $user, M_READ); |
---|
| 55 | $documents_ = filterAccess($subFolders[$i]->getDocuments(), $user, M_READ); |
---|
| 56 | |
---|
| 57 | print "<table cellpadding=0 cellspacing=0><tr>"; |
---|
| 58 | if (count($subFolders_) + count($documents_) > 0) |
---|
| 59 | print " <td valign=\"top\"><a href=\"out.DocumentChooser.php?form=$form&folderid=".$subFolders[$i]->getID()."\"><img src=\"".getImgPath("right_in_plus.gif")."\" border=0></a></td>"; |
---|
| 60 | else |
---|
| 61 | print " <td valign=\"top\"><img src=\"".getImgPath("right_in.gif")."\"></td>"; |
---|
| 62 | print " <td class=\"foldertree\" valign=\"top\">"; |
---|
| 63 | print "<img src=\"".getImgPath("folder_closed.gif")."\" border=0>".$subFolders[$i]->getName()."</td>"; |
---|
| 64 | print "</tr></table>"; |
---|
| 65 | } |
---|
| 66 | print "</td>"; |
---|
| 67 | print "</tr>"; |
---|
| 68 | } |
---|
| 69 | for ($i = 0; $i < count($documents); $i++) |
---|
| 70 | { |
---|
| 71 | print "<tr>"; |
---|
| 72 | if ($i +1 < count($documents)) |
---|
| 73 | print "<td background=\"images/down.gif\" valign=\"top\"><img src=\"images/right.gif\" border=0></td>"; |
---|
| 74 | else |
---|
| 75 | print "<td valign=\"top\"><img src=\"images/right_last.gif\" border=0></td>"; |
---|
| 76 | print "<td>"; |
---|
| 77 | print " <table cellpadding=0 cellspacing=0><tr>"; |
---|
| 78 | print " <td valign=\"top\"><img src=\"images/right_in.gif\"></td>"; |
---|
| 79 | print " <td><a class=\"foldertree_selectable\" href=\"javascript:documentSelected(".$documents[$i]->getID().",'".addslashes($documents[$i]->getName())."');\"><img src=\"images/file.gif\" border=0>".$documents[$i]->getName()."</a></td>"; |
---|
| 80 | print " </tr></table>"; |
---|
| 81 | print "</td>"; |
---|
| 82 | print "</tr>"; |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | print "</table>\n"; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | ?> |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | <html> |
---|
| 94 | <head> |
---|
| 95 | <link rel="STYLESHEET" type="text/css" href="styles.css"> |
---|
| 96 | <title><?php echo getMLText("choose_target_document")?></title> |
---|
| 97 | |
---|
| 98 | <script language="JavaScript"> |
---|
| 99 | var targetName; |
---|
| 100 | var targetID; |
---|
| 101 | |
---|
| 102 | function documentSelected(id, name) { |
---|
| 103 | targetName.value = name; |
---|
| 104 | targetID.value = id; |
---|
| 105 | window.close(); |
---|
| 106 | return true; |
---|
| 107 | } |
---|
| 108 | </script> |
---|
| 109 | |
---|
| 110 | </head> |
---|
| 111 | <body> |
---|
| 112 | |
---|
| 113 | <?php |
---|
| 114 | $folder = getFolder($folderid); |
---|
| 115 | printTree($folder->getPath()); |
---|
| 116 | ?> |
---|
| 117 | |
---|
| 118 | <script language="JavaScript"> |
---|
| 119 | targetName = opener.document.<?php echo $form?>.docname; |
---|
| 120 | targetID = opener.document.<?php echo $form?>.docid; |
---|
| 121 | </script> |
---|
| 122 | |
---|
| 123 | </body> |
---|
| 124 | </html> |
---|