WAQT

out.AddDocument

Apr 11th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.18 KB | None | 0 0
  1. <?php
  2.  
  3. include("../inc/inc.Settings.php");
  4. include("../inc/inc.AccessUtils.php");
  5. include("../inc/inc.ClassAccess.php");
  6. include("../inc/inc.ClassDocument.php");
  7. include("../inc/inc.ClassFolder.php");
  8. include("../inc/inc.ClassGroup.php");
  9. include("../inc/inc.ClassUser.php");
  10. include("../inc/inc.DBAccess.php");
  11. include("../inc/inc.FileUtils.php");
  12. include("../inc/inc.Language.php");
  13. include("../inc/inc.ClassUI.php");
  14. include("../inc/inc.Authentication.php");
  15.  
  16. if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
  17. UI::htmlStartPage(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))));
  18. UI::globalNavigation();
  19. UI::pageNavigation(getMLText("invalid_folder_id"));
  20. UI::htmlEndPage();
  21. exit;
  22. }
  23. $folderid = $_GET["folderid"];
  24. $folder = getFolder($folderid);
  25. if (!is_object($folder)) {
  26. UI::htmlStartPage(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))));
  27. UI::globalNavigation();
  28. UI::pageNavigation(getMLText("invalid_folder_id"));
  29. UI::htmlEndPage();
  30. exit;
  31. }
  32.  
  33. $folderPathHTML = getFolderPathHTML($folder, true);
  34. UI::htmlStartPage(getMLText("folder_title", array("foldername" => $folder->getName())));
  35. UI::globalNavigation($folder);
  36. ?>
  37. <script language="javascript" src="../js/D2H_ctxt.js">
  38. </script>
  39. <script language="javascript">
  40. // Replace this with your NetHelp URL:
  41. helpURL = "../helpsystem/default.htm";
  42. helpID = 170;
  43. </script>
  44. <?php
  45. UI::pageNavigation($folderPathHTML, "view_folder", $folder);
  46.  
  47. if ($folder->getAccessMode($user) < M_READWRITE) {
  48. UI::contentContainer(getMLText("access_denied"));
  49. UI::htmlEndPage();
  50. exit;
  51. }
  52.  
  53. include("../out/out.javascript.php");
  54.  
  55. UI::contentHeading(getMLText("add_document"));
  56. UI::contentContainerStart();
  57.  
  58. // Retrieve a list of all users and groups that have review / approve
  59. // privileges.
  60. //if (isset ($_GET['pcmpath'])){
  61. $pcmpath = sanitizeString($_GET['pcmpath']);
  62. echo $pcmpath;
  63. //} else { $pcmpath = "";}
  64. $docAccess = $folder->getApproversList();
  65. ?>
  66. <form action="../op/op.AddDocument.php" enctype="multipart/form-data" method="post" name="form1" onsubmit="return checkForm();">
  67. <input type="Hidden" name="folderid" value="<?php print $folderid; ?>">
  68. <input type="hidden" name="MAX_FILE_SIZE" value="200000000">
  69. <table>
  70. <tr>
  71. <td><?php printMLText("local_file");?>:</td>
  72. <td><input type="File" name="userfile" ></td>
  73. </tr>
  74. <tr>
  75. <td><?php printMLText("docname");?>:</td>
  76. <td><input name="name"></td>
  77. </tr>
  78. <tr>
  79. <td><?php printMLText("comment");?>:</td>
  80. <td><textarea name="comment" rows="8" cols="50"></textarea></td>
  81. </tr>
  82. <tr>
  83. <td><?php printMLText("keywords");?>:</td>
  84. <td>
  85. <textarea name="keywords" rows="2" cols="50"></textarea><br>
  86. <? /* <a href="javascript:chooseKeywords();"><?php printMLText("use_default_keywords");?></a>
  87. <script language="JavaScript">
  88. var openDlg;
  89.  
  90. function chooseKeywords() {
  91. openDlg = open("out.KeywordChooser.php", "openDlg", "width=500,height=400,scrollbars=yes,resizable=yes");
  92. }
  93. </script>*/ ?>
  94. </td>
  95. </tr>
  96. <tr>
  97. <td><?php printMLText("expires");?>:</td>
  98. <td>
  99. <input type="radio" name="expires" value="false" checked><?php printMLText("does_not_expire");?><br>
  100. <input type="radio" name="expires" value="true"><?php UI::printDateChooser(-1, "exp");?>
  101. </td>
  102. </tr>
  103. <? /*
  104. <tr>
  105. <td><?php printMLText("sequence");?>:</td>
  106. <td><?php UI::printSequenceChooser($folder->getDocuments());?></td>
  107. </tr>
  108. */?>
  109. </table>
  110. <dl>
  111. <dt><label for="assignDocReviewers"><input onClick="showBlock('docReviewers')" id="assignDocReviewers" type="checkbox" name="assignDocReviewers" value="1">Assign Reviewers</label></dt>
  112. <dd id="docReviewers">
  113. <div class="cbSelectTitle">Groups:</div>
  114. <div class="cbSelectContainer">
  115. <ul class="cbSelectList">
  116. <?php
  117. $isFirst=true;
  118. foreach ($docAccess["groups"] as $group) {
  119. ?>
  120. <li class="cbSelectItem<?php print ($isFirst ? " first" : "");?>"><?php echo "<label for='revGrp".$group->getID()."'><input id='revGrp".$group->getID()."' type='checkbox' name='grpReviewers[]' value='". $group->getID() ."'>".$group->getName()."</label>"; ?></li>
  121. <?php
  122. $isFirst=true;
  123.  
  124. }
  125. ?>
  126. </ul>
  127. </div>
  128. <div class="cbSelectTitle cbSelectMargin">Individuals:</div>
  129. <div class="cbSelectContainer cbSelectMargin">
  130. <ul class="cbSelectList">
  131. <?php
  132. $isFirst=true;
  133. foreach ($docAccess["users"] as $user) {
  134. // $cid = $_COOKIE["mydms_compid"];
  135. // $uid = $user->getID();
  136. // $queryStr = "SELECT * FROM tblUsers WHERE id = ('".$user->getID()."')";
  137. // $resArr = $db->getResultArray($queryStr);
  138. // echo $resArr[9];
  139. // $check = $resArr[9];
  140.  
  141. if ($_COOKIE["mydms_compid"] == $user->getcompID()){
  142. // $uid = $user->getID();
  143. ?>
  144. <li class="cbSelectItem<?php print ($isFirst ? " first" : "");?>"><?php echo "<label for='revInd".$user->getID()."'><input id='revInd".$user->getID()."' type='checkbox' name='indReviewers[]' value='". $user->getID() ."'>". $user->getFullName()." &lt;".$user->getEmail().">"; ?></li>
  145. <?php
  146. }
  147. $isFirst=false;
  148. }
  149. ?>
  150. </ul>
  151. </div>
  152. <script language="JavaScript">if (!document.getElementById('assignDocReviewers').checked) hideBlock('docReviewers');</script>
  153. </dd>
  154. <?
  155. $folder2 = $_GET["folderid"];
  156. global $db;
  157. $queryStr = "SELECT * FROM tblFolders WHERE id = ".$folder2." LIMIT 0,1";
  158. $query = mysql_query($queryStr) or die ("error " . mysql_error());
  159. // $resArr = $db->getResult($queryStr);
  160. $result = mysql_fetch_assoc($query) or die ("error with array " . mysql_error());
  161. $defaultapprovers = $result["approvers"];
  162. if ($defaultapprovers == 'no'){
  163. ?>
  164. <dt><label for="assignDocApprovers"><input onClick="showBlock('docApprovers')" id="assignDocApprovers" type="checkbox" name="assignDocApprovers" value="1">Assign Approvers</label></dt>
  165. <dd id="docApprovers">
  166. <div class="cbSelectTitle">Groups:</div>
  167. <div class="cbSelectContainer">
  168. <ul class="cbSelectList">
  169. <?php
  170. $isFirst=true;
  171. foreach ($docAccess["groups"] as $group) {
  172. ?>
  173. <li class="cbSelectItem<?php print ($isFirst ? " first" : "");?>"><?php echo "<label for='appGrp".$group->getID()."'><input id='appGrp".$group->getID()."' type='checkbox' name='grpApprovers[]' value='". $group->getID() ."'>".$group->getName()."</label>"; ?></li>
  174. <?php
  175. $isFirst=false;
  176. }
  177. ?>
  178. </ul>
  179. </div>
  180. <div class="cbSelectTitle cbSelectMargin">Individuals:</div>
  181. <div class="cbSelectContainer cbSelectMargin">
  182. <ul class="cbSelectList">
  183. <?php
  184. $isFirst=true;
  185. foreach ($docAccess["users"] as $user) {
  186.  
  187. if ($_COOKIE["mydms_compid"] == $user->getcompID()){
  188. ?>
  189. <li class="cbSelectItem<?php print ($isFirst ? " first" : "");?>"><?php echo "<label for='appInd".$user->getID()."'><input id='appInd".$user->getID()."' type='checkbox' name='indApprovers[]' value='". $user->getID() ."'>". $user->getFullName()." &lt;".$user->getEmail().">"; ?></li>
  190. <?php
  191. }
  192. $isFirst=false;
  193. }
  194.  
  195. ?>
  196. </ul>
  197. </div>
  198. <script language="JavaScript">if (!document.getElementById('assignDocApprovers').checked) hideBlock('docApprovers');</script>
  199. </dd><?php } ?>
  200. </dl>
  201. <p><?php printMLText("add_doc_reviewer_approver_warning")?></p>
  202. <p><input type="Submit" value="<?php printMLText("add_document");?>"></p>
  203. </form>
  204. <?php
  205. UI::contentContainerEnd();
  206. UI::htmlEndPage();
  207. ?>
Add Comment
Please, Sign In to add comment