Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 160.92 KB | None | 0 0
  1. <%--
  2. /*
  3. **
  4. ** myProcess, proprietary property of AMPLEXOR
  5. ** (c) Copyright, AMPLEXOR Adriatic d.o.o. 2002-2020
  6. ** All rights reserved.
  7. **
  8. ** May be used only in accordance with the terms and conditions of the
  9. ** license agreement governing use of AMPLEXOR software
  10. ** between you and AMPLEXOR or AMPLEXOR's authorized reseller.
  11. ** Not to be changed without prior written permission of AMPLEXOR.
  12. ** Any other use is strictly prohibited.
  13. **
  14. ** $Revision: 1.178 $
  15. ** $Date: 2020/03/29 15:37:25 $
  16. ** $Author: Amplexor\TotB $
  17. **
  18. */
  19. --%>
  20. <%@ page language="java" errorPage="/jsp/error/start.jsp" %>
  21.  
  22. <%@ page import="com.documentum.fc.client.*" %>
  23. <%@ page import="com.documentum.fc.common.*" %>
  24. <%@ page import="com.google.common.collect.Sets"%>
  25. <%@ page import="com.infotehna.myprocess.*" %>
  26. <%@ page import="com.infotehna.myprocess.manageusers.*" %>
  27. <%@ page import="com.infotehna.myprocess.profiling.*" %>
  28. <%@ page import="com.infotehna.myprocess.beans.*" %>
  29. <%@ page import="com.infotehna.utils.*" %>
  30. <%@ page import="com.infotehna.myprocess.documentum.*" %>
  31. <%@ page import="java.util.*" %>
  32. <%@ page import="com.infotehna.session.*"%>
  33. <%@ page import="org.apache.commons.lang.StringEscapeUtils" %>
  34. <%@ page import="com.google.gson.Gson" %>
  35. <%@ page import="com.infotehna.myprocess.jobs.PeriodicalReviewJob" %>
  36. <%@ page import="com.infotehna.myprocess.onedrive.OneDriveUtility" %>
  37. <%@ page import="com.google.common.collect.Lists" %>
  38.  
  39. <%@ include file="../../../include/context.jsp" %>
  40. <%@ include file="../../../include/auth.jsp" %>
  41.  
  42. <!DOCTYPE html>
  43. <html>
  44. <head>
  45. <title>myProcess</title>
  46. <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  47. <meta http-equiv="Expires" content="0">
  48. <meta http-equiv="pragma" content="no-cache">
  49. <link rel="stylesheet" type="text/css" href="<%= contextPath + cssPath %>body.css"/>
  50. <link rel="stylesheet" href="<%= contextPath + cssPath %>dialog.css" type="text/css"/>
  51. <link rel="stylesheet" href="<%= contextPath + cssPath %>mpc.css" type="text/css"/>
  52. <link rel="stylesheet" type="text/css" href="<%= contextPath + scriptsPath %>dojo/dijit/themes/claro/claro.css"/>
  53. <script>var contextPath = '<%= contextPath %>';</script>
  54. <script>var jspPath = '<%= jspPath %>';
  55.  
  56. var dojoConfig = {locale: "en-us"};
  57. </script>
  58. <script type="text/javascript" src="<%= contextPath + scriptsPath %>dojo/dojo/dojo.js" djConfig="aliases:[['utils/helpers', '<%= contextPath + scriptsPath %>utils/helpers.js']], paths:{'utils': '../../utils', 'modules': '../../modules' }, parseOnLoad: false, isDebug: false, locale: 'en-us'"></script>
  59. <script src="<%= contextPath + scriptsPath %>wizard.js" type="text/javascript"></script>
  60. <script src="<%= contextPath + scriptsPath %>dialog.js" type="text/javascript"></script>
  61. <script src="<%= contextPath + scriptsPath %>tabs.js" type="text/javascript"></script>
  62. <style>
  63. td {
  64. padding-bottom: 2px;
  65. }
  66. </style>
  67. <script>
  68. var localState = {},
  69. localCache = {},
  70. numberOfOptions = 26,
  71. isDataInitialized = false,
  72. isCurrentUserChecked = false;
  73.  
  74. function onDialogInit() {
  75. var roles = dojo.fromJson(listOfRoles);
  76.  
  77. dojo.forEach(roles, function(role) {
  78. localState[role] = {
  79. page: 1,
  80. pageSize: 50,
  81. activeConnection: null
  82. };
  83. });
  84. }
  85. </script>
  86.  
  87. <%!
  88. /**
  89. * Returns list of roles that current user can see.
  90. *
  91. * @param dfcSession Session
  92. * @param object Sysobject object
  93. * @param pb Profile
  94. * @param language Language
  95. * @return ArrayList of roles that current user can see.
  96. */
  97. private ArrayList<String> getRolesThatCurrentUserCanSee(IDfSession dfcSession, SysObject object, ProfileBean pb, String language) {
  98. ArrayList<String> canSeeRoles = new ArrayList<>();
  99. String username = "";
  100.  
  101. try {
  102. username = dfcSession.getLoginUserName();
  103. ProfileUtil pu = new ProfileUtil(language, dfcSession);
  104. ArrayList<String> currentUserRoles = pu.getUsersRolesForObjectFromDocbase(object);
  105. for (int i = 0; (currentUserRoles != null && i < currentUserRoles.size()); i++) {
  106. String roleId = currentUserRoles.get(i);
  107.  
  108. ArrayList<String> roleDependency = pb.getDependencyForRole(roleId);
  109. for (int j = 0; (roleDependency != null && j < roleDependency.size()); j++) {
  110. String rdId = roleDependency.get(j);
  111. if (!canSeeRoles.contains(rdId)) {
  112. canSeeRoles.add(rdId);
  113. }
  114. }
  115. }
  116. } catch(Exception e) {
  117. Logger.getLogger().error("Error while checking which roles current user can see/manage : " + e);
  118. }
  119.  
  120. return canSeeRoles;
  121. }
  122. %>
  123.  
  124. <%
  125. Logger.getLogger().trace("START");
  126.  
  127. // get language
  128. String language = (String) request.getParameter("language");
  129. if (language == null || language.equals("") || language.equals("null")) {
  130. language = (String) session.getAttribute("language");
  131. }
  132. if (language == null || language.equals("") || language.equals("null")) {
  133. language = "en_US";
  134. }
  135.  
  136. String skipProfileSelect = request.getParameter("skipProfileSelect");
  137. if (skipProfileSelect == null || skipProfileSelect.equals("") || skipProfileSelect.equals("false")) {
  138. skipProfileSelect = "false";
  139. } else {
  140. skipProfileSelect = "true";
  141. }
  142.  
  143. String lcsName = request.getParameter("lcsName");
  144. if (lcsName == null) {
  145. lcsName = "";
  146. }
  147.  
  148. // automation parameters
  149. boolean isAutomationWizard = Boolean.parseBoolean(request.getParameter("isAutomationWizard"));
  150. boolean isB2BMessageWizard = Boolean.parseBoolean(request.getParameter("isB2BMessageWizard"));
  151.  
  152. String automationPerformer = "";
  153. String automationLogLevel = "";
  154. String automationRule = "";
  155. String automationBlockingRule = "";
  156. String automationObjectIds = "";
  157. String automationDescription = "";
  158. String automationWorkspaceViewRefresh = "";
  159. String B2BEntityIds = "";
  160. String B2BExplicitEntityIds = "";
  161. String B2BconfigId = "";
  162. String B2BSendDirectly = "";
  163.  
  164. if (isAutomationWizard) {
  165. automationPerformer = request.getParameter("automationPerformer");
  166. if (automationPerformer == null) {
  167. automationPerformer = "";
  168. }
  169.  
  170. automationLogLevel = request.getParameter("automationLogLevel");
  171. if (automationLogLevel == null) {
  172. automationLogLevel = "";
  173. }
  174.  
  175. automationRule = request.getParameter("automationRule");
  176. if (automationRule == null) {
  177. automationRule = "";
  178. }
  179.  
  180. automationBlockingRule = request.getParameter("automationBlockingRule");
  181. if (automationBlockingRule == null) {
  182. automationBlockingRule = "";
  183. }
  184.  
  185. automationObjectIds = request.getParameter("automationObjectIds");
  186. if (automationObjectIds == null) {
  187. automationObjectIds = "";
  188. }
  189.  
  190. automationDescription = request.getParameter("automationDescription");
  191. if (automationDescription == null) {
  192. automationDescription = "";
  193. }
  194.  
  195. automationWorkspaceViewRefresh = request.getParameter("automationWorkspaceViewRefresh");
  196. if (automationWorkspaceViewRefresh == null) {
  197. automationWorkspaceViewRefresh = "";
  198. }
  199. }
  200.  
  201. if (isB2BMessageWizard) {
  202. B2BEntityIds = request.getParameter("B2BEntityIds");
  203. if (B2BEntityIds == null) {
  204. B2BEntityIds = "";
  205. }
  206.  
  207. B2BExplicitEntityIds = request.getParameter("B2BExplicitEntityIds");
  208. if (B2BExplicitEntityIds == null) {
  209. B2BExplicitEntityIds = "";
  210. }
  211.  
  212. B2BconfigId = request.getParameter("B2BconfigId");
  213. if (B2BconfigId == null) {
  214. B2BconfigId = "";
  215. }
  216.  
  217. B2BSendDirectly = request.getParameter("B2BSendDirectly");
  218. if (B2BSendDirectly == null) {
  219. B2BSendDirectly = "";
  220. }
  221. }
  222.  
  223. boolean controlNum = false;
  224.  
  225. String fromFinishTaskProxy = "";
  226. String minUsersText = uiStrings.getLocalizedString("STR_MIN_USERS");
  227. String maxUsersText = uiStrings.getLocalizedString("STR_MAX_USERS");
  228. final String STR_PREVIOUS_PAGE = uiStrings.getLocalizedString("STR_PREVIOUS_PAGE");
  229. final String STR_NEXT_PAGE = uiStrings.getLocalizedString("STR_NEXT_PAGE");
  230. final String STR_LOADING = uiStrings.getLocalizedString("STR_LOADING");
  231. Hashtable<String, String> finishTaskParams = new Hashtable<>();
  232. Hashtable<String, Integer> rolesLess = new Hashtable<>();
  233. Hashtable<String, Integer> rolesMore = new Hashtable<>();
  234. Hashtable<String, ArrayList<String>> minMaxUsersAll = new Hashtable<>();
  235. String wizardType = request.getParameter("wizardType");
  236. boolean forceHiddenRoleValidation = Boolean.valueOf(request.getParameter("forceHiddenRoleValidation"));
  237.  
  238. String objectId = request.getParameter("id");
  239. if (wizardType == null) {
  240. if (objectId == null || objectId.equals("")) {
  241. finishTaskParams = (Hashtable<String, String>)session.getAttribute("finishTaskParams");
  242. session.removeAttribute("finishTaskParams");
  243. if (finishTaskParams == null) {
  244. throw new Exception(uiStrings.getLocalizedString("STR_NO_OBJECT_SELECTED_MSG"));
  245. } else {
  246. fromFinishTaskProxy = "true";
  247. objectId = (String)finishTaskParams.get("objectId");
  248. rolesLess = (Hashtable<String, Integer>)session.getAttribute("rolesLess");
  249. rolesMore = (Hashtable<String, Integer>)session.getAttribute("rolesMore");
  250. minMaxUsersAll = (Hashtable<String, ArrayList<String>>)session.getAttribute("minMaxUsersAll");
  251. session.removeAttribute("rolesLess");
  252. session.removeAttribute("rolesMore");
  253. session.removeAttribute("minMaxUsersAll");
  254. minUsersText = uiStrings.getLocalizedString("STR_MIN_USERS_FOR_ACTIVITY");
  255. maxUsersText = uiStrings.getLocalizedString("STR_MAX_USERS_FOR_ACTIVITY");
  256. }
  257. }
  258.  
  259. StringTokenizer tokenizer = new StringTokenizer(objectId, "~");
  260. while (tokenizer.hasMoreTokens()) {
  261. String id = tokenizer.nextToken();
  262. SysObject selectedObject = new SysObject(id, dfcSession);
  263.  
  264. if (selectedObject.isCheckedOut() && !selectedObject.isCheckedOutBy(dfcSession.getLoginUserName())) {
  265.  
  266. String msg = uiStrings.getLocalizedString("STR_CANNOT_PERFORM_OPERATION") + ". " + uiStrings.getLocalizedString("STR_OBJECT_IS_CHECKED_OUT_BY_ANOTHER_USER") + ".";
  267. request.setAttribute("msgboxTitle", uiStrings.getLocalizedString("STR_MANAGE_USERS"));
  268. request.setAttribute("msgboxText", msg);
  269. request.setAttribute("msgboxWidth", "300");
  270. request.setAttribute("msgboxHeight", "135");
  271. request.setAttribute("msgboxIcon", "other/exclamation_32.gif");
  272. request.setAttribute("msgboxButtons", new Integer(MSGBOX_OK));
  273. request.setAttribute("msgboxActionUrl", "msgbox/refresh.jsp");
  274. request.setAttribute("msgboxTarget", "_self");
  275. RequestDispatcher rd = application.getRequestDispatcher(jspPath + "msgbox/start.jsp");
  276. rd.forward(request, response);
  277. return;
  278. }
  279. }
  280. }
  281.  
  282. //wizard specific paramaters
  283. String generateTOC = null;
  284. String tocParentId = null;
  285. String rootObjectId = null;
  286. String omitDocsIds = null;
  287. String firstWizard = null;
  288. String selectedObjectIds = null;
  289. String editVirtualDocument = null;
  290. String parentWndName = null;
  291. String showRelatedAction = null;
  292. String targetViewId = null;
  293. String frameId = null;
  294. String containmentId = null;
  295. String isSimple = null;
  296. String isOpenTasksReport = null;
  297. String fromDate = null;
  298. String toDate = null;
  299. String tasksSelect = null;
  300. String profs = null;
  301. String auths = null;
  302. String objName = null;
  303. String tmpId = null;
  304. String tmpType = null;
  305. String pdfPassword = null;
  306. String isSaveSearch = null;
  307. Properties saveSearch = null;
  308. String isBulkImportAtt = null;
  309. //TODO: provjeriti HashTable bulkImportAttributes
  310. String alreadyInWizard3ForCurrentFile = null;
  311. String applyAttributesToAllFilesInAllFolders = null;
  312. String validationFailedMsg = null;
  313. boolean fromWizard4 = false;
  314. String checkFolder = null;
  315. String chooseSourceWizardForSettings = null;
  316. String fromCloneAdvanced = null;
  317. String isCloneAction = null;
  318. String prepareForClone = null;
  319. String createSnapshot = null;
  320. String isFromInsert = null;
  321. String chosenWizard = null;
  322. String objectTypeId = null;
  323. String profileId = null;
  324. String templateId = null;
  325. String classifyAsNewRelease = null;
  326. String newContentObject = null;
  327. String isWithoutTemplate = null;
  328. String lcsId = null;
  329. String requestBlankPDFRendition = null;
  330. String isMSO = null;
  331. String importProps = null;
  332. String folderId = null;
  333. String filePath = null;
  334. String contentType = null;
  335. String superType = null;
  336. String shortWizard = null;
  337. String fileName = null;
  338. String defaultPdfPageSize = null;
  339. String firstObjectId = null;
  340. String relations = null;
  341. String chronicleId = null;
  342. String putDocumentAsChildInRelation = null;
  343. String firstTimeInWizardRelations = null;
  344. String newRelease = null;
  345. String forMRP = null;
  346. String keepCurrentLCStates = null;
  347. String keepCurrentObjectNames = null;
  348. String newDossier = null;
  349. String moduleIds = null;
  350. String previousStep = null;
  351. String copyBinders = null;
  352. String copyBindingText = null;
  353. String copyVDRoot = null;
  354. String createFolders = null;
  355. String applyToVD = null;
  356. String applyToAllBindingTexts = null;
  357. String applyPropsToVD = null;
  358. String issueChangeRequestRA = null;
  359. String cancelBtnAction = null;
  360. ArrayList<Object> forwardToUrls = null;
  361. String showPreview = null;
  362. String barcode = null;
  363. String barcodeValue = null;
  364. String mapCounterStartValue = null;
  365. String replaceObjectContent = null;
  366. String replacementTemplateId = null;
  367. String deleteObjectContent = null;
  368. String pasteEx = null;
  369. String pasteInVD = null;
  370. String importObjectId = null;
  371. String vdStructureReview = null;
  372. String vdStructureChange = null;
  373. String vdStructureStep = null;
  374. String vdStructureOptions = null;
  375. String documentSelectionAttribute = null;
  376. String frmAction = null;
  377. String wizardQuickFinishEnabled = null;
  378. boolean wizardQuickFinishEnabledBoolean = true;
  379. String wfPriority = request.getParameter("wfPriority");
  380. WizardBean wb = null;
  381. boolean validationFailed = false;
  382. String dialogInitStr = "";
  383. StringBuffer paramsBuff = new StringBuffer();
  384. OrgUnits ouManager = OrgUnits.getInstance(language);
  385. Persons perManager = Persons.getInstance(language);
  386. Profiles pManager = Profiles.getInstance(language);
  387. Roles rManager = Roles.getInstance(language);
  388. Hashtable<String, ArrayList<String>> rolesAndUsers = new Hashtable<>();
  389. boolean firstTimeInManageUsers = true;
  390. WizardUtility wu = new WizardUtility(language, dfcSession);
  391. Hashtable<Object, Object> paramsAndValues = new Hashtable<Object, Object>();
  392. StringBuffer rolesIds = new StringBuffer();
  393. boolean isTargetFolder = false;
  394. boolean isBulkImport = false;
  395. boolean bulkImportReadFromCSV = false;
  396. Hashtable<Object, Object> bulkImportAttributes = null;
  397. String previousProfileId = "";
  398. String initialLoad = "";
  399.  
  400. if (wizardType != null) {
  401. objectId = request.getParameter("objectId");
  402. if (objectId == null) {
  403. objectId = "";
  404. }
  405.  
  406. generateTOC = request.getParameter("generateTOC");
  407. if (generateTOC == null) {
  408. generateTOC = "";
  409. }
  410.  
  411. tocParentId = request.getParameter("tocParentId");
  412. if (tocParentId == null) {
  413. tocParentId = "";
  414. }
  415. Logger.getLogger().debug("tocParentId = " + tocParentId);
  416.  
  417. rootObjectId = request.getParameter("rootObjectId");
  418. if (rootObjectId == null) {
  419. rootObjectId = "";
  420. }
  421.  
  422. omitDocsIds = request.getParameter("omitDocsIds");
  423. if (omitDocsIds == null) {
  424. omitDocsIds = "";
  425. }
  426.  
  427. firstWizard = request.getParameter("firstWizard");
  428. if (firstWizard == null) {
  429. firstWizard = "";
  430. }
  431.  
  432. selectedObjectIds = request.getParameter("selectedObjectIds");
  433. if (selectedObjectIds == null) {
  434. selectedObjectIds = request.getParameter("id");
  435. if (selectedObjectIds == null) {
  436. selectedObjectIds = "";
  437. }
  438. }
  439.  
  440. editVirtualDocument = request.getParameter("editVirtualDocument");
  441. if (editVirtualDocument == null) {
  442. editVirtualDocument = "";
  443. }
  444. Logger.getLogger().trace("editVirtualDocument = " + editVirtualDocument);
  445.  
  446. parentWndName = request.getParameter("parentWndName");
  447. if (parentWndName == null) {
  448. parentWndName = "";
  449. }
  450. Logger.getLogger().trace("parentWndName = " + parentWndName);
  451.  
  452. showRelatedAction = request.getParameter("showRelatedAction");
  453. if (showRelatedAction == null) {
  454. showRelatedAction = "";
  455. }
  456. Logger.getLogger().trace("showRelatedAction = " + showRelatedAction);
  457.  
  458. targetViewId = request.getParameter("targetViewId");
  459. if (targetViewId == null) {
  460. targetViewId = "";
  461. }
  462. Logger.getLogger().trace("targetViewId = " + targetViewId);
  463.  
  464. frameId = request.getParameter("frameId");
  465. if (frameId == null) {
  466. frameId = "";
  467. }
  468. Logger.getLogger().trace("frameId = " + frameId);
  469.  
  470. containmentId = request.getParameter("containmentId");
  471. if (containmentId == null) {
  472. containmentId = "";
  473. }
  474.  
  475. isSimple = request.getParameter("isSimple");
  476. if (isSimple == null) {
  477. isSimple = "";
  478. }
  479. Logger.getLogger().trace("isSimple = " + isSimple);
  480.  
  481. isOpenTasksReport = request.getParameter("isOpenTasksReport");
  482. if (isOpenTasksReport == null) {
  483. isOpenTasksReport = "";
  484. }
  485.  
  486. fromDate = request.getParameter("fromDate");
  487. if (fromDate == null) {
  488. fromDate = "";
  489. }
  490.  
  491. toDate = request.getParameter("toDate");
  492. if (toDate == null) {
  493. toDate = "";
  494. }
  495.  
  496. tasksSelect = request.getParameter("tasksSelect");
  497. if (tasksSelect == null) {
  498. tasksSelect = "";
  499. }
  500.  
  501. profs = request.getParameter("profs");
  502. if (profs == null) {
  503. profs = "";
  504. }
  505.  
  506. auths = request.getParameter("auths");
  507. if (auths == null) {
  508. auths = "";
  509. }
  510.  
  511. objName = request.getParameter("objName");
  512. if (objName == null) {
  513. objName = "";
  514. }
  515.  
  516. tmpId = request.getParameter("tmpId");
  517. if (tmpId == null) {
  518. tmpId = "";
  519. }
  520.  
  521. tmpType = request.getParameter("tmpType");
  522. if (tmpType == null) {
  523. tmpType = "";
  524. }
  525.  
  526. //gvu begin elips 931 - import password protected pdf
  527. pdfPassword = request.getParameter("pdfPassword");
  528. if (pdfPassword == null) {
  529. pdfPassword = "";
  530. }
  531. //gvu end elips 931 - import password protected pdf
  532.  
  533. //save search
  534. isSaveSearch = request.getParameter("saveSearch");
  535. if (isSaveSearch == null) {
  536. isSaveSearch = "";
  537. }
  538.  
  539. saveSearch = new Properties();
  540. if (isSaveSearch.equals("true")) {
  541. Enumeration<String> paramNames = request.getParameterNames();
  542. while (paramNames.hasMoreElements()) {
  543. String paramName = paramNames.nextElement();
  544. String paramValue = request.getParameter(paramName);
  545. if (paramName.endsWith("~saveSearch")) {
  546. String tmpName = paramName.substring(0, paramName.indexOf("~"));
  547. saveSearch.setProperty(tmpName, paramValue);
  548. }
  549. }
  550. }
  551.  
  552. // Added for bulkimport purpose
  553. isBulkImportAtt = (String)session.getAttribute("isBulkImport");
  554.  
  555. if (isBulkImportAtt != null && isBulkImportAtt.equals("true")) {
  556. isBulkImport = true;
  557. }
  558.  
  559. FileUploadBean fileToUpload = (FileUploadBean) session.getAttribute("fileInUploadProcess");
  560.  
  561. if (fileToUpload != null) {
  562. bulkImportAttributes = fileToUpload.getAttributes();
  563. if (bulkImportAttributes != null) {
  564. bulkImportReadFromCSV = true;
  565. }
  566. }
  567.  
  568. alreadyInWizard3ForCurrentFile = (String)session.getAttribute("alreadyInWizard3ForCurrentFile");
  569. if(alreadyInWizard3ForCurrentFile == null) {
  570. alreadyInWizard3ForCurrentFile = "";
  571. }
  572.  
  573. applyAttributesToAllFilesInAllFolders = (String)session.getAttribute("applyAttributesToAllFilesInAllFolders");
  574. if(applyAttributesToAllFilesInAllFolders == null || applyAttributesToAllFilesInAllFolders.equals("")) {
  575. applyAttributesToAllFilesInAllFolders = "false";
  576. }
  577.  
  578. // validation failed?
  579. validationFailedMsg = request.getParameter("validationFailedMsg");
  580. if (validationFailedMsg == null || validationFailedMsg.equals("null") || validationFailedMsg.equals("")) {
  581. validationFailedMsg = (String)request.getAttribute("validationFailedMsg");
  582. }
  583. if (validationFailedMsg == null || validationFailedMsg.equals("null")) {
  584. validationFailedMsg = "";
  585. }
  586. request.removeAttribute("validationFailedMsg");
  587. validationFailed = !validationFailedMsg.equals("");
  588.  
  589. // from wizard4
  590. fromWizard4 = (request.getParameter("fromWizard4") != null && request.getParameter("fromWizard4").equals("true"));
  591.  
  592. checkFolder = request.getParameter("checkFolder");
  593.  
  594. chooseSourceWizardForSettings = request.getParameter("chooseSourceWizardForSettings");
  595. if (chooseSourceWizardForSettings == null) {
  596. chooseSourceWizardForSettings = "";
  597. }
  598.  
  599. fromCloneAdvanced = request.getParameter("fromCloneAdvanced");
  600. if (fromCloneAdvanced == null) {
  601. fromCloneAdvanced = "";
  602. }
  603.  
  604. isCloneAction = request.getParameter("isCloneAction");
  605. if (isCloneAction == null) {
  606. isCloneAction = "";
  607. }
  608.  
  609. prepareForClone = request.getParameter("prepareForClone");
  610. if (prepareForClone == null) {
  611. prepareForClone = "";
  612. }
  613.  
  614. createSnapshot = request.getParameter("createSnapshot");
  615. if (createSnapshot == null) {
  616. createSnapshot = "";
  617. }
  618.  
  619. isFromInsert = request.getParameter("isFromInsert");
  620. if (isFromInsert == null || isFromInsert.equals("")) {
  621. isFromInsert = "false";
  622. }
  623.  
  624. chosenWizard = request.getParameter("chosenWizard");
  625. if (chosenWizard == null) {
  626. chosenWizard = "";
  627. }
  628.  
  629. if (!chooseSourceWizardForSettings.equals("true") || chosenWizard.equals("") || chosenWizard.equals("null")) {
  630. chosenWizard = wizardType;
  631. }
  632.  
  633. objectTypeId = request.getParameter("objectTypeId");
  634. profileId = request.getParameter("profileId");
  635. templateId = request.getParameter("templateId");
  636.  
  637. //pmi, classify as new release
  638. classifyAsNewRelease = request.getParameter("classifyAsNewRelease");
  639. if (classifyAsNewRelease == null) {
  640. classifyAsNewRelease = "false";
  641. }
  642. newContentObject = request.getParameter("newContentObject");
  643. if (newContentObject == null) {
  644. newContentObject = "";
  645. }
  646. isWithoutTemplate = request.getParameter("isWithoutTemplate");
  647. if (isWithoutTemplate == null) {
  648. isWithoutTemplate = "false";
  649. }
  650.  
  651. Logger.getLogger().debug("profileId = " + profileId);
  652.  
  653. lcsId = request.getParameter("lcsId");
  654.  
  655. requestBlankPDFRendition = request.getParameter("requestBlankPDFRendition");
  656. if (requestBlankPDFRendition == null) {
  657. requestBlankPDFRendition = "false";
  658. }
  659.  
  660. isMSO = request.getParameter("isMSO");
  661. if (isMSO == null || isMSO.equals("")) {
  662. isMSO = "false";
  663. }
  664. importProps = request.getParameter("importProps");
  665. if (importProps == null || importProps.equals("")) {
  666. importProps = "false";
  667. }
  668.  
  669. folderId = request.getParameter("folderId");
  670. filePath = request.getParameter("filePath");
  671. contentType = request.getParameter("contentType");
  672. superType = request.getParameter("superType");
  673. shortWizard = request.getParameter("shortWizard");
  674. boolean isVD = false;
  675.  
  676. fileName = request.getParameter("fileName");
  677. if (fileName == null) {
  678. fileName = "";
  679. }
  680.  
  681. defaultPdfPageSize = request.getParameter("defaultPdfPageSize");
  682. if (defaultPdfPageSize == null) {
  683. defaultPdfPageSize = "";
  684. }
  685.  
  686. if (generateTOC.equals("1")) {
  687. objectId = tocParentId;
  688. }
  689.  
  690. firstObjectId = objectId;
  691. if (objectId != null && objectId.indexOf("~") != -1) {
  692. firstObjectId = objectId.substring(0, objectId.indexOf("~"));
  693. }
  694.  
  695. if (contentType == null) {
  696. contentType = "";
  697. }
  698.  
  699. relations = request.getParameter("relations");
  700. if (relations == null) {
  701. relations = "";
  702. }
  703.  
  704. chronicleId = request.getParameter("chronicleId");
  705. if (chronicleId == null) {
  706. chronicleId = "";
  707. }
  708.  
  709. putDocumentAsChildInRelation = request.getParameter("putDocumentAsChildInRelation");
  710. if (putDocumentAsChildInRelation == null || putDocumentAsChildInRelation.equals("") || putDocumentAsChildInRelation.equals("null")) {
  711. putDocumentAsChildInRelation = null;
  712. }
  713.  
  714. firstTimeInWizardRelations = request.getParameter("firstTimeInWizardRelations");
  715.  
  716. // Only for newRelease action
  717. newRelease = request.getParameter("newRelease");
  718. if (newRelease == null) {
  719. newRelease = "";
  720. }
  721.  
  722. forMRP = request.getParameter("forMRP");
  723. if (forMRP == null) {
  724. forMRP = "";
  725. }
  726.  
  727. keepCurrentLCStates = request.getParameter("keepCurrentLCStates");
  728. if (keepCurrentLCStates == null) {
  729. keepCurrentLCStates = "";
  730. }
  731.  
  732. keepCurrentObjectNames = request.getParameter("keepCurrentObjectNames");
  733. if (keepCurrentObjectNames == null) {
  734. keepCurrentObjectNames = "";
  735. }
  736.  
  737. // Only for "new dossier" action
  738. newDossier = request.getParameter("newDossier");
  739. if (newDossier == null) {
  740. newDossier = "";
  741. }
  742.  
  743. moduleIds = request.getParameter("moduleIds");
  744. if (moduleIds == null || moduleIds.equals("null")) {
  745. moduleIds = "";
  746. }
  747.  
  748. previousStep = request.getParameter("previousStep");
  749.  
  750. copyBinders = request.getParameter("copyBinders");
  751. if (copyBinders == null || copyBinders.equals("")) {
  752. copyBinders = "false";
  753. }
  754.  
  755. copyBindingText = request.getParameter("copyBindingText");
  756. if (copyBindingText == null || copyBindingText.equals("")) {
  757. copyBindingText = "false";
  758. }
  759.  
  760. copyVDRoot = request.getParameter("copyVDRoot");
  761. if (copyVDRoot == null || copyVDRoot.equals("")) {
  762. copyVDRoot = "false";
  763. }
  764.  
  765. createFolders = request.getParameter("createFolders");
  766. if (createFolders == null || createFolders.equals("")) {
  767. createFolders = "false";
  768. }
  769.  
  770. applyToVD = request.getParameter("applyToVD");
  771. if (applyToVD == null || applyToVD.equals("")) {
  772. applyToVD = String.valueOf(Profiles.getInstance(language).getProfileById(profileId).getApplyToAllVDDescendants());
  773. }
  774.  
  775. applyToAllBindingTexts = request.getParameter("applyToAllBindingTexts");
  776. if (applyToAllBindingTexts == null || applyToAllBindingTexts.equals("")) {
  777. applyToAllBindingTexts = String.valueOf(Profiles.getInstance(language).getProfileById(profileId).getApplyToAllBindingTexts());
  778. }
  779.  
  780. applyPropsToVD = request.getParameter("applyPropsToVD");
  781. if (applyPropsToVD == null) {
  782. applyPropsToVD = "";
  783. }
  784.  
  785. issueChangeRequestRA = request.getParameter("issueChangeRequestRA");
  786. if (issueChangeRequestRA == null) {
  787. issueChangeRequestRA = "";
  788. }
  789.  
  790. session.setAttribute("selectedObjectId", objectId);
  791.  
  792. // barcode classify
  793. cancelBtnAction = "closeDialog();";
  794. cancelBtnAction = "top.operationProgressStart(); document.location.href='" + contextPath + jspPath + "wizard/cancelWizard.jsp'";//hli
  795.  
  796. if (isBulkImport) {
  797. cancelBtnAction = "closePreview(); top.operationProgressStart(); document.location.href='" + contextPath + jspPath + "wizard/cancelWizard.jsp'";
  798. }
  799.  
  800. forwardToUrls = (ArrayList<Object>) session.getAttribute("forwardToUrls");
  801. if (forwardToUrls != null && !forwardToUrls.isEmpty()) {
  802. cancelBtnAction = "top.operationProgressStart(); document.location.href='" + contextPath + jspPath + "wizard/cancelWizard.jsp'";
  803. }
  804.  
  805. showPreview = "";
  806. showPreview = request.getParameter("showPreview");
  807. if (showPreview == null || showPreview.equals("null")) {
  808. showPreview = "";
  809. }
  810. if (showPreview.equals("true")) {
  811. cancelBtnAction = "closePreview(); closeDialog();";
  812. }
  813.  
  814. barcode = request.getParameter("barcode");
  815. barcodeValue = "";
  816.  
  817. if (wizardType.equals("classify") && !(barcode != null && barcode.equals("true"))) {
  818. cancelBtnAction = "closePreview();top.operationProgressStart(); document.location.href='" + contextPath + jspPath + "wizard/cancelWizard.jsp'";
  819. }
  820.  
  821. if (barcode != null && barcode.equals("true")) {
  822. cancelBtnAction = "closePreview(); top.operationProgressStart(); document.location.href='" + contextPath + jspPath + "wizard/cancelWizard.jsp'";
  823. barcodeValue = request.getParameter("barcodeValue");
  824. } else {
  825. barcode = "";
  826. }
  827.  
  828. mapCounterStartValue = request.getParameter("mapCounterStartValue");
  829. if (mapCounterStartValue == null || mapCounterStartValue.equals("null")) {
  830. mapCounterStartValue = "";
  831. }
  832.  
  833. replaceObjectContent = request.getParameter("replaceObjectContent");
  834. if (replaceObjectContent == null || replaceObjectContent.equals("null") || replaceObjectContent.equals("")) {
  835. replaceObjectContent = "";
  836. }
  837.  
  838. replacementTemplateId = request.getParameter("replacementTemplateId");
  839. if (replacementTemplateId == null || replacementTemplateId.equals("null")) {
  840. replacementTemplateId = "";
  841. }
  842.  
  843. deleteObjectContent = request.getParameter("deleteObjectContent");
  844. if (deleteObjectContent == null || deleteObjectContent.equals("null") || deleteObjectContent.equals("")) {
  845. deleteObjectContent = "";
  846. }
  847.  
  848. pasteEx = request.getParameter("pasteEx");
  849. if (pasteEx == null || pasteEx.equals("")) {
  850. pasteEx = "false";
  851. }
  852.  
  853. pasteInVD = request.getParameter("pasteInVD");
  854. if (pasteInVD == null || pasteInVD.equals("")) {
  855. pasteInVD = "false";
  856. }
  857.  
  858. importObjectId = (String) session.getAttribute("importObjectId");
  859. if (importObjectId == null || importObjectId.equals("null")) {
  860. importObjectId = "";
  861. }
  862.  
  863. // VD structure options for Clone Advanced / New Release Advanced
  864. vdStructureReview = request.getParameter("vdStructureReview");
  865. if (vdStructureReview == null) {
  866. vdStructureReview = "";
  867. }
  868.  
  869. vdStructureChange = request.getParameter("vdStructureChange");
  870. if (vdStructureChange == null) {
  871. vdStructureChange = "";
  872. }
  873.  
  874. vdStructureStep = request.getParameter("vdStructureStep");
  875. if (vdStructureStep == null) {
  876. vdStructureStep = "";
  877. }
  878.  
  879. vdStructureOptions = request.getParameter("vdStructureOptions");
  880. if (vdStructureOptions == null) {
  881. vdStructureOptions = "";
  882. }
  883.  
  884. documentSelectionAttribute = request.getParameter("documentSelectionAttribute");
  885. if (documentSelectionAttribute == null) {
  886. documentSelectionAttribute = "";
  887. }
  888.  
  889. frmAction = request.getParameter("frmAction");
  890. if (frmAction == null) {
  891. frmAction = "";
  892. }
  893.  
  894. previousProfileId = request.getParameter("previousProfileId");
  895. if (previousProfileId == null) {
  896. previousProfileId = "";
  897. }
  898.  
  899. initialLoad = request.getParameter("initialLoad");
  900. if (initialLoad == null) {
  901. initialLoad = "";
  902. }
  903.  
  904. wizardQuickFinishEnabled = request.getParameter("wizardQuickFinishEnabled");
  905. wizardQuickFinishEnabledBoolean = true;
  906. if (wizardQuickFinishEnabled != null && wizardQuickFinishEnabled.equalsIgnoreCase("false")) {
  907. wizardQuickFinishEnabledBoolean = false;
  908. }
  909.  
  910. rolesAndUsers = wu.getSelectedRolesAndUsers(request, chosenWizard, language, profileId, applyAttributesToAllFilesInAllFolders, alreadyInWizard3ForCurrentFile, isBulkImport, bulkImportReadFromCSV);
  911. paramsAndValues = wu.getWizardParametersValues(request);
  912.  
  913. firstTimeInManageUsers = wu.getFirstTimeInManageUsers();
  914.  
  915. if (isBulkImport && alreadyInWizard3ForCurrentFile.equals("0") && !applyAttributesToAllFilesInAllFolders.equalsIgnoreCase("true")){
  916. if (!bulkImportReadFromCSV) {
  917. firstTimeInManageUsers = true;
  918. }
  919. }
  920.  
  921. Enumeration<String> paramNames = request.getParameterNames();
  922.  
  923. while (paramNames.hasMoreElements()) {
  924. String paramName = paramNames.nextElement();
  925. if (paramName.endsWith("~attribute") || paramName.endsWith("~multiselect") || paramName.endsWith("~usersgroups") || paramName.endsWith("~filter") || paramName.endsWith("~importattribute")) {
  926. String paramValue = request.getParameter(paramName);
  927.  
  928. if (paramValue.contains("\"")) {
  929. paramValue = paramValue.replaceAll("\"","&quot;");
  930. }
  931.  
  932. if (paramValue != null && !paramValue.equals("")) {
  933. paramValue = paramValue.trim();
  934. }
  935.  
  936. paramsBuff.append("<input type=\"hidden\" name=\"" + paramName + "\" value=\"" + paramValue + "\">\n");
  937. }
  938. }
  939. }
  940.  
  941. int wizType = WizardUtility.getWizardTypeAsInt(wizardType);
  942. int chosenWizType = WizardUtility.getWizardTypeAsInt(chosenWizard);
  943.  
  944. // coming from finish_task_ex???
  945. boolean fromFTE = false;
  946. String fromFinishTaskEx = request.getParameter("fromFinishTaskEx");
  947. if (fromFinishTaskEx != null && fromFinishTaskEx.equals("true")) {
  948. fromFTE = true;
  949. }
  950.  
  951. String FTE_objectId = objectId;
  952. String FTE_taskId = request.getParameter("taskId");
  953. if (FTE_taskId == null) {
  954. FTE_taskId = "";
  955. }
  956. String FTE_roles = request.getParameter("roles");
  957. if (FTE_roles == null) {
  958. FTE_roles = "";
  959. }
  960.  
  961. boolean FTE_fromApprove = (request.getParameter("fromApprove") != null && request.getParameter("fromApprove").equals("true"));
  962. boolean FTE_fromReject = (request.getParameter("fromReject") != null && request.getParameter("fromReject").equals("true"));
  963.  
  964. boolean enabledProperties = (request.getParameter("properties") != null && request.getParameter("properties").equals("true"));
  965.  
  966. String isPreselected = "";
  967. isPreselected = request.getParameter("preselected");
  968. if (isPreselected == null || isPreselected.equals("")){
  969. isPreselected = "true";
  970. }
  971.  
  972. boolean FTE_fromFinishAndReject = (request.getParameter("fromFinishAndReject") != null && request.getParameter("fromFinishAndReject").equals("true"));
  973.  
  974. // coming from multiple manage users???
  975. boolean fromMultipleMU = (request.getParameter("fromMultipleMU") != null && request.getParameter("fromMultipleMU").equals("true"));
  976.  
  977. String commonRoles = request.getParameter("commonRoles");
  978. if (commonRoles == null) {
  979. commonRoles = "";
  980. }
  981.  
  982. boolean hasVD = (request.getParameter("hasVD") != null && request.getParameter("hasVD").equals("true"));
  983. boolean checkApplyToAllRelDoc = (request.getParameter("checkApplyToAllRelDoc") != null && request.getParameter("checkApplyToAllRelDoc").equals("true"));
  984. boolean displayApplyCheckboxesMU = (request.getParameter("displayApplyCheckboxes") != null && request.getParameter("displayApplyCheckboxes").equals("true"));
  985. boolean displayApplyCheckboxes = false;
  986. boolean displayApplyCheckboxesForRelatedVDs = Boolean.parseBoolean(request.getParameter("displayApplyCheckboxesForRelatedVDs"));
  987. boolean relatedCollaboration = false;
  988. boolean vdCollaboration = false;
  989. boolean relatedVdCollaboration = false;
  990. String applyToAllVDDescendantsOfRelatedDocumentsChecked = "";
  991. boolean allowApplyToAllVDDescendantsOfRelatedDocuments = false;
  992. boolean applyToAllVDDescendantsOfRelatedDocuments = false;
  993. boolean applyToAllBindingTextsOfRelatedDocuments = false;
  994. boolean displayVdDescendOptionsDropdown = true;
  995.  
  996. // coming from promote/demote and finish ex???
  997. String FT_fromFinishTask = request.getParameter("FT_fromFinishTask");
  998. if (FT_fromFinishTask == null) {
  999. FT_fromFinishTask = "";
  1000. }
  1001.  
  1002. String FT_extendedPromoteOrDemote = request.getParameter("FT_extendedPromoteOrDemote");
  1003. if (FT_extendedPromoteOrDemote == null) {
  1004. FT_extendedPromoteOrDemote = "";
  1005. }
  1006.  
  1007. boolean fromPromoteDemoteAndFinishEx = (FT_fromFinishTask.equals("true") && (FT_extendedPromoteOrDemote.equals("true") || FT_extendedPromoteOrDemote.equals("false")));
  1008.  
  1009. String FT_nextTask = request.getParameter("FT_nextTask");
  1010. if (FT_nextTask == null) {
  1011. FT_nextTask = "";
  1012. }
  1013. String FT_id = request.getParameter("FT_id");
  1014. if (FT_id == null) {
  1015. FT_id = "";
  1016. }
  1017. String FT_objectId = request.getParameter("FT_objectId");
  1018. if (FT_objectId == null) {
  1019. FT_objectId = "";
  1020. }
  1021. String FT_profileId = request.getParameter("FT_profileId");
  1022. if (FT_profileId == null) {
  1023. FT_profileId = "";
  1024. }
  1025. String FT_lcsId = request.getParameter("FT_lcsId");
  1026. if (FT_lcsId == null) {
  1027. FT_lcsId = "";
  1028. }
  1029. String FT_wfLCSId = request.getParameter("FT_wfLCSId");
  1030. if (FT_wfLCSId == null) {
  1031. FT_wfLCSId = "";
  1032. }
  1033. String FT_signoffUsername = request.getParameter("FT_signoffUsername");
  1034. if (FT_signoffUsername == null) {
  1035. FT_signoffUsername = "";
  1036. }
  1037. String FT_userFunction = request.getParameter("FT_userFunction");
  1038. if (FT_userFunction == null) {
  1039. FT_userFunction = "";
  1040. }
  1041. String FT_signoffPassword = request.getParameter("FT_signoffPassword");
  1042. if (FT_signoffPassword == null) {
  1043. FT_signoffPassword = "";
  1044. }
  1045. String FT_signoffReason = request.getParameter("FT_signoffReason");
  1046. if (FT_signoffReason == null) {
  1047. FT_signoffReason = "";
  1048. }
  1049. String FT_signoffRequired = request.getParameter("FT_signoffRequired");
  1050. if (FT_signoffRequired == null) {
  1051. FT_signoffRequired = "";
  1052. }
  1053. String promoteIsNextStateSelected = request.getParameter("promoteIsNextStateSelected");
  1054. if (promoteIsNextStateSelected == null) {
  1055. promoteIsNextStateSelected = request.getParameter("isNextStateSelected");
  1056. }
  1057. if (promoteIsNextStateSelected == null) {
  1058. promoteIsNextStateSelected = "";
  1059. }
  1060. String promoteDemoteId = request.getParameter("promoteDemoteId");
  1061. if (promoteDemoteId == null) {
  1062. promoteDemoteId = request.getParameter("id");
  1063. }
  1064. if (promoteDemoteId == null) {
  1065. promoteDemoteId = "";
  1066. }
  1067. String promoteToLCS = request.getParameter("promoteToLCS");
  1068. if (promoteToLCS == null) {
  1069. promoteToLCS = "";
  1070. }
  1071. String promoteOnDate = request.getParameter("promoteOnDate");
  1072. if (promoteOnDate == null) {
  1073. promoteOnDate = "";
  1074. }
  1075. String promoteDemoteWfPriority = request.getParameter("promoteDemoteWfPriority");
  1076. if (promoteDemoteWfPriority == null) {
  1077. promoteDemoteWfPriority = request.getParameter("workflow");
  1078. }
  1079. if (promoteDemoteWfPriority == null) {
  1080. promoteDemoteWfPriority = "";
  1081. }
  1082. String promoteRoles = request.getParameter("promoteRoles");
  1083. if (promoteRoles == null) {
  1084. promoteRoles = "";
  1085. }
  1086. boolean fromPromoteAndFinishEx = (!promoteRoles.equals(""));
  1087. String schedulePromote = request.getParameter("schedulePromote");
  1088. if (schedulePromote == null) {
  1089. schedulePromote = "";
  1090. }
  1091. String demoteToLCS = request.getParameter("demoteToLCS");
  1092. if (demoteToLCS == null) {
  1093. demoteToLCS = "";
  1094. }
  1095. String demoteRoles = request.getParameter("demoteRoles");
  1096. if (demoteRoles == null) {
  1097. demoteRoles = "";
  1098. }
  1099. boolean fromDemoteAndFinishEx = (!demoteRoles.equals(""));
  1100.  
  1101. if (!fromMultipleMU) {
  1102. ArrayList<String> selectedObjects = MyProcessUtils.trimString(objectId, "~");
  1103. objectId = selectedObjects.get(0);
  1104. }
  1105.  
  1106. String nextObjectId = request.getParameter("nextObjectId");
  1107. String forwardToUrl = request.getParameter("forwardToUrl");
  1108. String target = request.getParameter("target");
  1109. String refresh = request.getParameter("refresh");
  1110. String takeOver = request.getParameter("takeOver");
  1111. String notificationTakeOver = request.getParameter("notificationTakeOver");
  1112. String to = request.getParameter("to");
  1113.  
  1114. if (nextObjectId == null) {
  1115. nextObjectId = "";
  1116. }
  1117. if (forwardToUrl == null) {
  1118. forwardToUrl = "";
  1119. }
  1120. if (target == null) {
  1121. target = "";
  1122. }
  1123. if (refresh == null) {
  1124. refresh = "";
  1125. }
  1126. if (takeOver == null) {
  1127. takeOver = "";
  1128. }
  1129. if (notificationTakeOver == null) {
  1130. notificationTakeOver = "";
  1131. }
  1132. if (to == null) {
  1133. to = "";
  1134. }
  1135.  
  1136. ProfileBean pb = null;
  1137. LifeCycleStateBean lcsb = null;
  1138. SysObject object = null;
  1139. boolean isVD = false;
  1140. String applyToAllRelatedDocumentsChecked = "";
  1141. String applyToAllRelatedDocumentsDefaultValue = ProfileBean.APPLY_TO_ALL_RELATED_DOCUMENTS_DV_APPEND;
  1142. String applySettingsToVDDescendants = "false"; //dma-task 1545 sets if box will be shown when users are changed
  1143. Hashtable<String, String> allRolesAndUsers = new Hashtable<>();
  1144. ArrayList<RoleBean> roles = null;
  1145. Hashtable<String, String> hiddenRoles = new Hashtable<>();
  1146. Hashtable<String, ArrayList<String>> defaultAndPersistentRolesAndUsers = new Hashtable<>();
  1147.  
  1148. if (wizardType != null && ((wizType == WizardBean.CLASSIFY_WIZARD || newRelease.equals("true") || wizType == WizardBean.CREATE_WIZARD) && templateId != null && !templateId.equals(""))) {
  1149. try {
  1150. // getting object
  1151. IDfSysObject objectTemp = (IDfSysObject) dfcSession.getObject(new DfId(templateId));
  1152. if (objectTemp == null) {
  1153. throw new Exception ("Object with id '" + templateId + "' doesn't exist!");
  1154. }
  1155.  
  1156. // Checking if document is virtual document
  1157. if (objectTemp.isVirtualDocument() && objectTemp.getLinkCount()>0) {
  1158. isVD = true;
  1159. }
  1160. }
  1161. catch (Exception ex) {
  1162. Logger.getLogger().warning("Error while checking if document is virtual!\n" + ex);
  1163. }
  1164. }
  1165.  
  1166. boolean isCollaborativeEditStarted = false;
  1167.  
  1168. if (wizardType == null) {
  1169. if (!fromMultipleMU) {
  1170. try {
  1171. // getting object
  1172. object = new SysObject(objectId, dfcSession);
  1173. object.fetch("");
  1174.  
  1175. // Checking if document is virtual document
  1176. if (object.isVirtualDocument() && object.getLinkCount() > 0) {
  1177. isVD = true;
  1178. }
  1179.  
  1180. // getting object's profile
  1181. profileId = ProfileUtil.getProfileIdForObject(object);
  1182. if (profileId == null) {
  1183. MessageBox.warning(language, request, uiStrings.getLocalizedString("STR_NO_PROFILE_DEFINED") + ".", uiStrings.getLocalizedString("STR_MANAGE_USERS"));
  1184.  
  1185. RequestDispatcher rd = application.getRequestDispatcher(jspPath + "msgbox/start.jsp");
  1186. rd.forward(request, response);
  1187. return;
  1188. }
  1189.  
  1190. pb = pManager.getProfileById(profileId);
  1191. if (pb == null) {
  1192. throw new Exception("Profile " + profileId + " doesn't exist!");
  1193. }
  1194.  
  1195. if (pb.getApplySettingsToVDDescendants()) {
  1196. applySettingsToVDDescendants = "true";
  1197. }
  1198. applySettingsToVDDescendants += "";//dma variable won't initailize without this
  1199.  
  1200. lcsb = pb.getLcStateByName(object.getCurrentStateName());
  1201.  
  1202. if (pb.getApplyToAllRelatedDocuments()) {
  1203. applyToAllRelatedDocumentsChecked = "checked";
  1204. }
  1205. applyToAllRelatedDocumentsDefaultValue = pb.getApplyToAllRelatedDocumentsDefaultValue();
  1206.  
  1207. rolesAndUsers = ProfileUtil.getAllRolesAndUsersForObjectFromDocbase(object);
  1208. } catch (Exception ex) {
  1209. Logger.getLogger().error("Cannot edit roles for users!\n" + ex);
  1210. throw new Exception ("Cannot edit roles for users!<br>" + ex);
  1211. }
  1212. } else {
  1213. if (checkApplyToAllRelDoc) applyToAllRelatedDocumentsChecked = "checked";
  1214. }
  1215.  
  1216. OneDriveUtility oneDriveUtility = new OneDriveUtility(dfcSession);
  1217. isCollaborativeEditStarted = oneDriveUtility.isCollaborativeEditStarted(Sets.newHashSet(MyProcessUtils.trimString(objectId, "~")));
  1218. } else {
  1219. wb = pManager.getProfileById(profileId).getWizard();
  1220. pb = pManager.getProfileById(profileId);
  1221. roles = wb.getRoles(wizType);
  1222. defaultAndPersistentRolesAndUsers = wu.getDeaultAndPersistentUsers(profileId, pManager, roles, paramsAndValues);
  1223.  
  1224. allRolesAndUsers = wu.getUsersForRoles(profileId, wizType, language, rolesAndUsers, defaultAndPersistentRolesAndUsers, isTargetFolder, firstTimeInManageUsers, paramsAndValues);
  1225.  
  1226. PreselectedProfileSettingsBean preselectedSettingsBean = (PreselectedProfileSettingsBean)session.getAttribute("preselectedProfileSettings");
  1227. if (preselectedSettingsBean == null) {
  1228. preselectedSettingsBean = new PreselectedProfileSettingsBean();
  1229. }
  1230.  
  1231. if (allRolesAndUsers != null && !allRolesAndUsers.isEmpty()) {
  1232. Enumeration<String> allRoles = allRolesAndUsers.keys();
  1233. while (allRoles.hasMoreElements()) {
  1234. String roleId = allRoles.nextElement();
  1235. if (pb.isRoleHiddenInWizards(roleId)) {
  1236. hiddenRoles.put(roleId, allRolesAndUsers.get(roleId));
  1237. }
  1238. }
  1239. }
  1240.  
  1241. wu.addRolesAndUsers(preselectedSettingsBean, wizType, rolesAndUsers, wb, perManager, ouManager);
  1242.  
  1243. boolean isEmptyString = true;
  1244. for (int i = 0; (roles != null && i < roles.size()); i++) {
  1245. RoleBean rb = roles.get(i);
  1246. String roleId = rb.getId();
  1247.  
  1248. if (hiddenRoles.containsKey(roleId)) {
  1249. continue;
  1250. }
  1251.  
  1252. if (!isEmptyString) {
  1253. rolesIds.append(",");
  1254. }
  1255. rolesIds.append("'");
  1256. rolesIds.append(roleId);
  1257. rolesIds.append("'");
  1258. isEmptyString = false;
  1259. }
  1260.  
  1261. boolean foundRolesOnObject = false;
  1262. String sourceObjId = null;
  1263.  
  1264. if (wizType == WizardBean.IMPORT_WIZARD && (objectId == null || objectId.equals("")) && importObjectId != null && !importObjectId.equals("")) {
  1265. objectId = importObjectId;
  1266. }
  1267.  
  1268. if (!pasteInVD.equals("true")) {
  1269. if (newRelease.equals("true") || (wb.getCopyRolesStatus(chosenWizType) == WizardBean.COPY_OBJECT_ROLES || wb.getCopyRolesStatus(chosenWizType) == WizardBean.COPY_OTHER_ROLES) && !objectId.equals("") && firstTimeInManageUsers) {
  1270. ArrayList<String> selectedObjects = MyProcessUtils.trimString(objectId, "~");
  1271. objectId = selectedObjects.get(0);
  1272. sourceObjId = objectId;
  1273. } else if ((wb.getCopyRolesStatus(chosenWizType) == WizardBean.COPY_FOLDER_ROLES || wb.getCopyRolesStatus(chosenWizType) == WizardBean.COPY_OTHER_ROLES) && !folderId.equals("") && firstTimeInManageUsers) {
  1274. sourceObjId = folderId;
  1275. }
  1276. } else {
  1277. String tmpObjectId = (String) session.getAttribute("objectId");
  1278. if ((wb.getCopyRolesStatus(chosenWizType) == WizardBean.COPY_TARGET_VD_ROLES) && tmpObjectId != null && !tmpObjectId.equals("") && firstTimeInManageUsers) {
  1279. ArrayList<String> documentsIds = MyProcessUtils.trimString(tmpObjectId, "~");
  1280. objectId = documentsIds.get(0);
  1281. sourceObjId = objectId;
  1282. Logger.getLogger().debug("Using roles of target VD object ('" + objectId + "').");
  1283. } else if (newRelease.equals("true") || (wb.getCopyRolesStatus(chosenWizType) == WizardBean.COPY_OBJECT_ROLES || wb.getCopyRolesStatus(chosenWizType) == WizardBean.COPY_OTHER_ROLES) && !objectId.equals("") && firstTimeInManageUsers) {
  1284. ArrayList<String> selectedObjects = MyProcessUtils.trimString(objectId, "~");
  1285. objectId = selectedObjects.get(0);
  1286. sourceObjId = objectId;
  1287. Logger.getLogger().debug("Using roles of source object ('" + objectId + "').");
  1288. }
  1289. }
  1290.  
  1291. SysObject srcObject = null;
  1292.  
  1293. try {
  1294. if (sourceObjId != null) {
  1295.  
  1296. // getting object
  1297. srcObject = new SysObject(sourceObjId, dfcSession);
  1298.  
  1299. SysObject folderObj = null;
  1300. if (folderId != null && !folderId.equals("") && !folderId.equals(dfcSession.getDocbaseId()) && wb.getCopyRolesStatus(chosenWizType) == WizardBean.COPY_OTHER_ROLES && wb.getCopyOtherTargetFolderRoles(chosenWizType) != null) {
  1301. folderObj = new SysObject(folderId, dfcSession);
  1302. }
  1303.  
  1304. if (firstTimeInManageUsers) {
  1305. if (folderObj != null) {
  1306. isTargetFolder = true;
  1307. rolesAndUsers = ProfileUtil.getAllRolesAndUsersForObjectFromDocbase(folderObj);
  1308. foundRolesOnObject = true;
  1309. } else {
  1310. rolesAndUsers = ProfileUtil.getAllRolesAndUsersForObjectFromDocbase(srcObject);
  1311. foundRolesOnObject = true;
  1312. }
  1313. }
  1314. }
  1315. } catch (Exception ex) {
  1316. Logger.getLogger().warning("Cannot read roles for users!\n" + ex);
  1317. }
  1318.  
  1319. // bulk import
  1320. if (isBulkImport && bulkImportReadFromCSV && alreadyInWizard3ForCurrentFile.equals("0")) {
  1321. if (bulkImportAttributes.containsKey("roles_and_persons")) {
  1322. String rolesAndPersons = (String)bulkImportAttributes.get("roles_and_persons");
  1323.  
  1324. // check if string attribute roles_and_persons in csv file is valid
  1325. if (!WizardUtility.checkValidityOfRolesAndPersonsStrings(rolesAndPersons, "#", "@")) {
  1326. QueueCreateDocument.removeSessionParameters(session);//hli
  1327. request.setAttribute("msgboxTitle", uiStrings.getLocalizedString("STR_WIZARD3_ERROR"));
  1328. request.setAttribute("msgboxText", uiStrings.getLocalizedString("STR_ROLES_AND_PERSONS_INVALID"));
  1329. request.setAttribute("msgboxIcon", "other/exclamation_32.gif");
  1330. request.setAttribute("msgboxButtons", new Integer(MSGBOX_OK));
  1331. request.setAttribute("msgboxActionUrl", "msgbox/refresh.jsp");
  1332. request.setAttribute("msgboxTarget", "_self");
  1333. RequestDispatcher rd = application.getRequestDispatcher(jspPath + "msgbox/start.jsp");
  1334. rd.forward(request, response);
  1335. return;
  1336. }
  1337.  
  1338. Hashtable<String, ArrayList<String>> bulkImportRolePersons = new Hashtable<>();
  1339.  
  1340. StringTokenizer rolesAndPersonsTokenizer = new StringTokenizer(rolesAndPersons, "#");
  1341. while (rolesAndPersonsTokenizer.hasMoreTokens()) {
  1342. String roleAndPersons = rolesAndPersonsTokenizer.nextToken();
  1343.  
  1344. StringTokenizer roleAndPersonsTokenizer = new StringTokenizer(roleAndPersons, "@");
  1345. while (roleAndPersonsTokenizer.hasMoreTokens()) {
  1346. String roleName = roleAndPersonsTokenizer.nextToken();
  1347. String persons = roleAndPersonsTokenizer.nextToken();
  1348. ArrayList<String> bulkImportPersons = new ArrayList<>();
  1349.  
  1350. // check if string attribute roles_and_persons in csv file is valid
  1351. if (persons.endsWith("~") || persons.startsWith("~")) {
  1352. QueueCreateDocument.removeSessionParameters(session);
  1353. request.setAttribute("msgboxTitle", uiStrings.getLocalizedString("STR_WIZARD3_ERROR"));
  1354. request.setAttribute("msgboxText", uiStrings.getLocalizedString("STR_ROLES_AND_PERSONS_INVALID"));
  1355. request.setAttribute("msgboxIcon", "other/exclamation_32.gif");
  1356. request.setAttribute("msgboxButtons", new Integer(MSGBOX_OK));
  1357. request.setAttribute("msgboxActionUrl", "msgbox/refresh.jsp");
  1358. request.setAttribute("msgboxTarget", "_self");
  1359. RequestDispatcher rd = application.getRequestDispatcher(jspPath + "msgbox/start.jsp");
  1360. rd.forward(request, response);
  1361. return;
  1362. }
  1363.  
  1364. StringTokenizer personsTokenizer = new StringTokenizer(persons, "~");
  1365. while (personsTokenizer.hasMoreTokens()) {
  1366. String personName = personsTokenizer.nextToken();
  1367. bulkImportPersons.add(personName);
  1368. }
  1369.  
  1370. bulkImportRolePersons.put(roleName, bulkImportPersons);
  1371. }
  1372. }
  1373.  
  1374. ProfileBean prb = pManager.getProfileById(profileId);
  1375.  
  1376. for (int i = 0; (roles != null && i < roles.size()); i++) {
  1377. RoleBean rb = roles.get(i);
  1378. String roleId = rb.getId();
  1379. String roleName = rb.getNameInLanguage(language);
  1380.  
  1381. if (bulkImportRolePersons.containsKey(roleName)) {
  1382. ArrayList<String> personNames = new ArrayList<>();
  1383.  
  1384. Hashtable<String, String> allUsers = new Hashtable<>();
  1385. Hashtable<String, String> groups = new Hashtable<>();
  1386. Hashtable<String, String> groupUsers = new Hashtable<>();
  1387.  
  1388. boolean isAllAllowed = false;
  1389. List<String> allowed = Optional.ofNullable(prb.getAllRoleAllowed(roleId)).orElse(Lists.newArrayList());
  1390. if (allowed.contains("ALL_USERS") || allowed.contains("ALL_GROUPS")) {
  1391. isAllAllowed = true;
  1392. } else {
  1393. allUsers = WizardUtility.getAllUsersForRole(language, dfcSession, profileId, roleId);
  1394. groups = WizardUtility.getAllGroupsForRole(language, dfcSession, profileId, roleId);
  1395.  
  1396. Enumeration<String> en = groups.keys();
  1397. while (en.hasMoreElements()){
  1398. String groupName = en.nextElement();
  1399. String groupId = groups.get(groupName);
  1400. Hashtable<String, String> currentGroupUsers = WizardUtility.getAllUsersForRoleAndGroup(language, dfcSession, profileId, roleId, groupId);
  1401. groupUsers.putAll(currentGroupUsers);
  1402. }
  1403. }
  1404.  
  1405. ArrayList<String> bulkRolePersons = (ArrayList<String>)bulkImportRolePersons.get(roleName);
  1406. for (int index = 0; (bulkRolePersons != null && index < bulkRolePersons.size()); index++) {
  1407. String bulkPerson = bulkRolePersons.get(index);
  1408.  
  1409. if (!personNames.contains(bulkPerson)
  1410. && ((allUsers.containsKey(bulkPerson) || groupUsers.containsKey(bulkPerson) || groups.containsKey(bulkPerson))
  1411. || (isAllAllowed && (perManager.getByName(bulkPerson) != null || ouManager.getByName(bulkPerson) != null)))) {
  1412. // replace names in local language with groupnames
  1413. // groups have names in local languages while
  1414. // Documentum groupname consists of small letters only
  1415. if (groups.containsKey(bulkPerson) || isAllAllowed) {
  1416. // group
  1417. ArrayList<OrgUnitBean> orgs = ouManager.getAllOrgUnitsForDocbaseSortedByName(dfcSession.getDocbaseId());
  1418. for (int j = 0; (orgs != null && j < orgs.size()); j++) {
  1419. OrgUnitBean oub = orgs.get(j);
  1420. if (oub.getNameEx().equals(bulkPerson)){
  1421. bulkPerson = oub.getGroupName();
  1422. break;
  1423. }
  1424. }
  1425. }
  1426. personNames.add(bulkPerson);
  1427. }
  1428. }
  1429. rolesAndUsers.put(roleId, personNames);
  1430. }
  1431. }
  1432. }
  1433. }
  1434.  
  1435. // issue change request ra (pliva action):
  1436. // source approver ---> target approver
  1437. // source coordinator ---> target author
  1438. // current user ---> target coordinator
  1439. // other roles ---> either default+persistent users or copy users from source object (depending on profile configuration)
  1440. if (firstTimeInManageUsers && issueChangeRequestRA.equals("true")) {
  1441. SysObject crraSourceObj = new SysObject(firstObjectId, dfcSession);
  1442. String crraProfileId = ProfileUtil.getProfileIdForObjectEx(crraSourceObj, true);
  1443. if (crraProfileId != null && pManager.getProfileById(crraProfileId) != null) {
  1444. ProfileBean crraPB = pManager.getProfileById(crraProfileId);
  1445. Hashtable<String, ArrayList<String>> crraSourceObjRolesAndUsers = ProfileUtil.getAllRolesAndUsersForObjectFromDocbase(crraSourceObj);
  1446.  
  1447. RoleBean sourceApproverRB = ProfileUtil.getRoleApprower(crraPB, language);
  1448. RoleBean targetApproverRB = ProfileUtil.getRoleApprower(pManager.getProfileById(profileId), language);
  1449. if (sourceApproverRB != null && targetApproverRB != null) {
  1450. ArrayList<String> personNames = rolesAndUsers.get(targetApproverRB.getId());
  1451. if (personNames != null && crraSourceObjRolesAndUsers != null && crraSourceObjRolesAndUsers.containsKey(sourceApproverRB.getId())) {
  1452. personNames = crraSourceObjRolesAndUsers.get(sourceApproverRB.getId());
  1453. rolesAndUsers.put(targetApproverRB.getId(), personNames);
  1454. }
  1455. }
  1456.  
  1457. RoleBean sourceCoordinatorRB = ProfileUtil.getRoleCoordinator(crraPB, language);
  1458. RoleBean targetAuthorRB = ProfileUtil.getRoleAuthor(pManager.getProfileById(profileId), language);
  1459. if (sourceCoordinatorRB != null && targetAuthorRB != null) {
  1460. ArrayList<String> personNames = rolesAndUsers.get(targetAuthorRB.getId());
  1461. if (personNames != null && crraSourceObjRolesAndUsers != null && crraSourceObjRolesAndUsers.containsKey(sourceCoordinatorRB.getId())) {
  1462. personNames = crraSourceObjRolesAndUsers.get(sourceCoordinatorRB.getId());
  1463. rolesAndUsers.put(targetAuthorRB.getId(), personNames);
  1464. }
  1465. }
  1466.  
  1467. RoleBean targetCoordinatorRB = ProfileUtil.getRoleCoordinator(pManager.getProfileById(profileId), language);
  1468. if (targetCoordinatorRB != null) {
  1469. ArrayList<String> personNames = rolesAndUsers.get(targetCoordinatorRB.getId());
  1470. if (personNames != null) {
  1471. personNames.clear();
  1472. personNames.add(dfcSession.getLoginUserName());
  1473. }
  1474. }
  1475. }
  1476. }
  1477. }
  1478.  
  1479. allowApplyToAllVDDescendantsOfRelatedDocuments = (pb != null && pb.getAllowApplyToAllVDDescendantsOfRelatedDocuments()) ? true : false;
  1480. applyToAllVDDescendantsOfRelatedDocuments = (pb != null && pb.getApplyToAllVDDescendantsOfRelatedDocuments()) ? true : false;
  1481. applyToAllBindingTextsOfRelatedDocuments = (pb != null && pb.getApplyToAllBindingTextsOfRelatedDocuments()) ? true : false;
  1482.  
  1483.  
  1484. String currentDocbase = dfcSession.getDocbaseId();
  1485. IDfUser cUser = dfcSession.getUser("");
  1486. String currentUser = cUser.getUserName();
  1487. String currentUserGroup = cUser.getUserGroupName();
  1488. IDfGroup cGroup = null;
  1489. String currentUserGroupId = "";
  1490.  
  1491. String currUserId = cUser.getObjectId().getId();
  1492. String userNameEx = currentUser;
  1493. boolean showDescription = Boolean.valueOf(Configuration.instance.getProperty("showDescription", "false")).booleanValue();
  1494. if (showDescription) {
  1495. ArrayList<PersonBean> allPersons = perManager.getAllPersonsForDocbaseSortedByName(dfcSession.getDocbaseId());
  1496. for (int j = 0; (allPersons != null && j < allPersons.size()); j++) {
  1497. PersonBean curr = allPersons.get(j);
  1498. if (currUserId.equals(curr.getId())) {
  1499. userNameEx = curr.getNameEx();
  1500. break;
  1501. }
  1502. }
  1503. }
  1504.  
  1505. PersonalizationData pdManager = PersonalizationData.getInstance();
  1506. PersonalizationDataBean pdb = pdManager.getPersonalizationDataBeanById(dfcSession.getUser("").getUserName());
  1507.  
  1508. if (pdb.getSelectUserGroupByDefault() && currentUserGroup != null && !currentUserGroup.equals("")) {
  1509. cGroup = dfcSession.getGroup(currentUserGroup);
  1510. if (cGroup != null) {
  1511. currentUserGroupId = cGroup.getObjectId().toString();
  1512. }
  1513. }
  1514.  
  1515. ArrayList<String> absentPersons = perManager.getAbsentPersons(dfcSession);
  1516. Gson gson = new Gson();
  1517.  
  1518. if (wizardType == null) {
  1519. if (!fromFTE && !fromPromoteDemoteAndFinishEx && !fromFinishTaskProxy.equals("true")) {
  1520. if (fromMultipleMU) {
  1521. // hidden roles are extracted from common roles that are displayed here
  1522. } else {
  1523. // display all roles except hidden ones
  1524. ArrayList<String> canSeeRoles = getRolesThatCurrentUserCanSee(dfcSession, object, pb, language);
  1525.  
  1526. ArrayList<RoleBean> pbRoles = pb.getRolesSortedByName();
  1527. for (int i = 0; (pbRoles != null && i < pbRoles.size()); i++) {
  1528. RoleBean rb = pbRoles.get(i);
  1529. String roleId = rb.getId();
  1530.  
  1531. if (!canSeeRoles.contains(roleId)) {
  1532. String personsIds = "";
  1533.  
  1534. if (rolesAndUsers != null) {
  1535. ArrayList<String> rolePersons = rolesAndUsers.get(roleId);
  1536. for (int j = 0; (rolePersons != null && j < rolePersons.size()); j++) {
  1537. String personName = rolePersons.get(j);
  1538. String id = "";
  1539.  
  1540. PersonBean perb = perManager.getPersonByName(personName, dfcSession.getDocbaseId());
  1541. if (perb != null) {
  1542. id = perb.getId();
  1543. } else {
  1544. OrgUnitBean oub = ouManager.getOrgUnitByGroupName(personName, dfcSession.getDocbaseId());
  1545. if (oub != null) {
  1546. id = oub.getId();
  1547. }
  1548. }
  1549.  
  1550. if (!id.equals("")) {
  1551. if (j == 0) {
  1552. personsIds = id;
  1553. } else {
  1554. personsIds += "~" + id;
  1555. }
  1556. }
  1557. }
  1558. }
  1559.  
  1560. hiddenRoles.put(roleId, personsIds);
  1561. }
  1562. }
  1563. }
  1564. } else {
  1565. // display only roles performers (usually only one) (if current user can see/change them)
  1566. ArrayList<String> canSeeRoles = getRolesThatCurrentUserCanSee(dfcSession, object, pb, language);
  1567.  
  1568. ArrayList<String> rolesList = new ArrayList<>();
  1569. if (fromFTE && !FTE_roles.equals("")) {
  1570. rolesList = MyProcessUtils.trimString(FTE_roles, "~");
  1571. } else if (fromPromoteDemoteAndFinishEx) {
  1572. if (fromPromoteAndFinishEx) {
  1573. rolesList = MyProcessUtils.trimString(promoteRoles, "~");
  1574. } else if (fromDemoteAndFinishEx) {
  1575. rolesList = MyProcessUtils.trimString(demoteRoles, "~");
  1576. }
  1577. }
  1578.  
  1579. if (fromFinishTaskProxy.equals("true")) {
  1580. if (rolesLess != null && rolesLess.size() > 0) {
  1581. for (Enumeration<String> en = rolesLess.keys(); en.hasMoreElements(); ) {
  1582. String tmpRoleId = en.nextElement();
  1583. rolesList.add(tmpRoleId);
  1584. }
  1585. }
  1586. if (rolesMore != null && rolesMore.size() > 0) {
  1587. for (Enumeration<String> en = rolesMore.keys(); en.hasMoreElements(); ) {
  1588. String tmpRoleId = en.nextElement();
  1589. rolesList.add(tmpRoleId);
  1590. }
  1591. }
  1592. }
  1593.  
  1594. ArrayList<RoleBean> pbRoles = pb.getRolesSortedByName();
  1595. for (int i = 0; (pbRoles != null && i < pbRoles.size()); i++) {
  1596. RoleBean rb = pbRoles.get(i);
  1597. String roleId = rb.getId();
  1598.  
  1599. if (!rolesList.contains(roleId) || !canSeeRoles.contains(roleId)) {
  1600. String personsIds = "";
  1601.  
  1602. if (rolesAndUsers != null) {
  1603. ArrayList<String> rolePersons = rolesAndUsers.get(roleId);
  1604. for (int j = 0; (rolePersons != null && j < rolePersons.size()); j++) {
  1605. String personName = rolePersons.get(j);
  1606. String id = "";
  1607.  
  1608. PersonBean perb = perManager.getPersonByName(personName, dfcSession.getDocbaseId());
  1609. if (perb != null) {
  1610. id = perb.getId();
  1611. } else {
  1612. OrgUnitBean oub = ouManager.getOrgUnitByGroupName(personName, dfcSession.getDocbaseId());
  1613. if (oub != null) {
  1614. id = oub.getId();
  1615. }
  1616. }
  1617.  
  1618. if (!id.equals("")) {
  1619. if (j == 0) {
  1620. personsIds = id;
  1621. } else {
  1622. personsIds += "~" + id;
  1623. }
  1624. }
  1625. }
  1626. }
  1627.  
  1628. hiddenRoles.put(roleId, personsIds);
  1629. }
  1630. }
  1631.  
  1632. boolean noRolesToDisplay = true;
  1633.  
  1634. StringTokenizer rolesTokenizer = null;
  1635. if (fromFTE) {
  1636. rolesTokenizer = new StringTokenizer(FTE_roles, "~");
  1637. } else if (fromPromoteDemoteAndFinishEx) {
  1638. if (fromPromoteAndFinishEx) {
  1639. rolesTokenizer = new StringTokenizer(promoteRoles, "~");
  1640. } else if (fromDemoteAndFinishEx) {
  1641. rolesTokenizer = new StringTokenizer(demoteRoles, "~");
  1642. }
  1643. } else if (fromFinishTaskProxy.equals("true")) {
  1644. String tmpRolesStr = MyProcessUtils.arrayToString(rolesList, "~");
  1645. rolesTokenizer = new StringTokenizer(tmpRolesStr, "~");
  1646. }
  1647.  
  1648. while (rolesTokenizer != null && rolesTokenizer.hasMoreTokens()) {
  1649. String roleId = rolesTokenizer.nextToken();
  1650. if (!hiddenRoles.containsKey(roleId)) {
  1651. noRolesToDisplay = false;
  1652. break;
  1653. }
  1654. }
  1655.  
  1656. if (noRolesToDisplay) {
  1657. if (fromFTE) {
  1658. %>
  1659. <html>
  1660. <head>
  1661. </head>
  1662. <body onload="document.forms['forwardForm'].submit();">
  1663. <form name="forwardForm" action="<%= contextPath + jspPath %>info_center/actions/task_finish/start.jsp">
  1664. <input type="hidden" name="id" value="<%= FTE_taskId %>">
  1665. <input type="hidden" name="fromApprove" value="<%= FTE_fromApprove %>">
  1666. <input type="hidden" name="fromReject" value="<%= FTE_fromReject %>">
  1667. <input type="hidden" name="properties" value="<%= enabledProperties %>">
  1668. <input type="hidden" name="preselected" value="<%= isPreselected %>">
  1669. <input type="hidden" name="fromFinishAndReject" value="<%= FTE_fromFinishAndReject %>">
  1670. </form>
  1671. </body>
  1672. </html>
  1673. <%
  1674. } else if (fromPromoteDemoteAndFinishEx) {
  1675. String promoteDemoteUrl = contextPath + jspPath;
  1676. if (fromPromoteAndFinishEx) {
  1677. promoteDemoteUrl += "explorer/actions/promote/check.jsp";
  1678. } else if (fromDemoteAndFinishEx) {
  1679. promoteDemoteUrl += "msgbox/start.jsp";
  1680. }
  1681. %>
  1682. <html>
  1683. <head>
  1684. </head>
  1685. <body onload="document.forms['forwardForm'].submit();">
  1686. <form name="forwardForm" action="<%= promoteDemoteUrl %>">
  1687. <input type="hidden" name="FT_fromFinishTask" value="<%= FT_fromFinishTask %>">
  1688. <input type="hidden" name="FT_extendedPromoteOrDemote" value="<%= FT_extendedPromoteOrDemote %>">
  1689. <input type="hidden" name="FT_nextTask" value="<%= FT_nextTask %>">
  1690. <input type="hidden" name="FT_id" value="<%= FT_id %>">
  1691. <input type="hidden" name="FT_objectId" value="<%= FT_objectId %>">
  1692. <input type="hidden" name="FT_profileId" value="<%= FT_profileId %>">
  1693. <input type="hidden" name="FT_lcsId" value="<%= FT_lcsId %>">
  1694. <input type="hidden" name="FT_wfLCSId" value="<%= FT_wfLCSId %>">
  1695. <input type="hidden" name="FT_signoffUsername" value="<%= FT_signoffUsername %>">
  1696. <input type="hidden" name="FT_userFunction" value="<%= FT_userFunction %>">
  1697. <input type="hidden" name="FT_signoffPassword" value="<%= FT_signoffPassword %>">
  1698. <input type="hidden" name="FT_signoffReason" value="<%= FT_signoffReason %>">
  1699. <input type="hidden" name="FT_signoffRequired" value="<%= FT_signoffRequired %>">
  1700. <input type="hidden" name="id" value="<%= promoteDemoteId %>">
  1701. <input type="hidden" name="workflow" value="<%= promoteDemoteWfPriority %>">
  1702. <% if (fromPromoteAndFinishEx) { %>
  1703. <input type="hidden" name="isNextStateSelected" value="<%= promoteIsNextStateSelected %>">
  1704. <input type="hidden" name="promoteToLCS" value="<%= promoteToLCS %>">
  1705. <input type="hidden" name="promoteOnDate" value="<%= promoteOnDate %>">
  1706. <input type="hidden" name="schedulePromote" value="<%= schedulePromote %>">
  1707. <input type="hidden" name="todo" value="promote">
  1708. <% } else if (fromDemoteAndFinishEx) {%>
  1709. <input type="hidden" name="demoteToLCS" value="<%= demoteToLCS %>">
  1710. <input type="hidden" name="todo" value="demote">
  1711. <input type="hidden" name="msgboxTitle" value="<%= uiStrings.getLocalizedString("STR_DEMOTE") %>">
  1712. <input type="hidden" name="msgboxText" value="<%= uiStrings.getLocalizedString("STR_DEMOTE_MSG") + "?" %>">
  1713. <input type="hidden" name="msgboxIcon" value="other/question_32.gif">
  1714. <input type="hidden" name="msgboxButtons" value="<%= new Integer(MSGBOX_YES_NO_CLOSE) %>">
  1715. <input type="hidden" name="msgboxActionUrl" value="explorer/actions/demote/demote_finish.jsp">
  1716. <input type="hidden" name="msgboxTarget" value="_self">
  1717. <% } %>
  1718. </form>
  1719. </body>
  1720. </html>
  1721. <%
  1722. }
  1723. return;
  1724. }
  1725. }
  1726. }
  1727. ArrayList<OrgUnitBean> orgs = ouManager.getAllOrgUnitsForDocbaseSortedByName(dfcSession.getDocbaseId());
  1728. String personIdsJson = ManageUsers.getPersonIdsMappedAsJson(orgs);
  1729. %>
  1730.  
  1731. <script>
  1732. var STR_USER_IS_PERFORMER_WARNING = "<%= StringEscapeUtils.escapeJavaScript(uiStrings.getLocalizedString("STR_USER_IS_PERFORMER_WARNING")) %>";
  1733.  
  1734. <%
  1735. // generate arrays for checking users as task performers
  1736. boolean checkUserAsPerformer = false;
  1737. if (!fromFTE && !fromPromoteDemoteAndFinishEx && !fromMultipleMU && wizardType == null) {
  1738. if (pb != null && !object.getPolicyId().isNull() && !object.getPolicyId().getId().equals("0000000000000000")) {
  1739. Hashtable<String, ArrayList<String>> roleToPerformers = new Hashtable<>();
  1740.  
  1741. IDfCollection coll = null;
  1742. try {
  1743. DfQuery query = new MpDfQuery();
  1744. query.setDQL("select distinct dmi_workitem.r_object_id as workitem_id, dmi_workitem.r_performer_name as performer_name from dmi_workitem, dmi_package where dmi_workitem.r_runtime_state<>2 and dmi_workitem.r_workflow_id = dmi_package.r_workflow_id and any dmi_package.r_component_id in ('" + objectId + "')");
  1745. coll = query.execute(dfcSession, DfQuery.DF_EXECREAD_QUERY);
  1746. while (coll != null && coll.next()) {
  1747. checkUserAsPerformer = true;
  1748.  
  1749. String workitemId = coll.getString("workitem_id");
  1750. String performerName = coll.getString("performer_name");
  1751.  
  1752. IDfWorkitem workitem = null;
  1753. try {
  1754. workitem = (IDfWorkitem)dfcSession.getObject(new DfId(workitemId));
  1755. } catch (Exception ex) {
  1756. Logger.getLogger().trace("Cannot fetch workitem with id='" + workitemId + "' : " + ex);
  1757. continue;
  1758. }
  1759.  
  1760. IDfWorkflow workflow = null;
  1761. try {
  1762. workflow = (IDfWorkflow)dfcSession.getObject(workitem.getWorkflowId());
  1763. } catch (Exception ex) {
  1764. Logger.getLogger().trace("Cannot fetch workflow with id='" + workitem.getWorkflowId().getId() + "' : " + ex);
  1765. continue;
  1766. }
  1767.  
  1768. String processId = ((IDfProcess)dfcSession.getObject(workflow.getProcessId())).getObjectId().getId();
  1769. String activityId = workitem.getActDefId().getId();
  1770.  
  1771. String lcId = "";
  1772. if (workflow.getObjectName().contains(PeriodicalReviewJob.PERIODICAL_REVIEW_JOB_NAME)) {
  1773. wfPriority = LifeCycleStateBean.WF_PRIORITY_NORMAL;
  1774. lcId = LifeCycleStateBean.PERIODICAL_REVIEW_STATE_ID;
  1775. } else {
  1776. wfPriority = ProfileUtil.getWorkflowPriorityForObject(object);
  1777. lcId = lcsb.getId();
  1778. }
  1779.  
  1780. RoleBean rolePerformer = pb.getActivityRolePerformer(lcId, processId, wfPriority, activityId);
  1781. if (rolePerformer != null) {
  1782. String performerId = "";
  1783. if (perManager.getPersonByName(performerName, dfcSession.getDocbaseId()) != null) {
  1784. performerId = perManager.getPersonByName(performerName, dfcSession.getDocbaseId()).getId();
  1785. } else if (ouManager.getOrgUnitByGroupName(performerName, dfcSession.getDocbaseId()) != null) {
  1786. performerId = ouManager.getOrgUnitByGroupName(performerName, dfcSession.getDocbaseId()).getId();
  1787. }
  1788.  
  1789. if (!performerId.equals("")) {
  1790. ArrayList<String> collectedUsers = roleToPerformers.get(rolePerformer.getId());
  1791. if (collectedUsers == null) {
  1792. collectedUsers = new ArrayList<>();
  1793. }
  1794. if (!collectedUsers.contains(performerId)) {
  1795. collectedUsers.add(performerId);
  1796. roleToPerformers.put(rolePerformer.getId(), collectedUsers);
  1797. }
  1798. }
  1799. }
  1800. }
  1801. } catch(Exception e) {
  1802. Logger.getLogger().error("Error while generating arrays for checking users as task performers : " + e);
  1803. } finally {
  1804. if (coll != null) {
  1805. coll.close();
  1806. }
  1807. }
  1808.  
  1809. // construct JS arrays
  1810. Enumeration<String> rolesPerformerIds = roleToPerformers.keys();
  1811. while (rolesPerformerIds.hasMoreElements()) {
  1812. StringBuffer buff = new StringBuffer();
  1813.  
  1814. String roleId = (String)rolesPerformerIds.nextElement();
  1815. buff.append("var role_" + roleId + "_performers = new Array(");
  1816. ArrayList<String> performers = roleToPerformers.get(roleId);
  1817. for (int i = 0; (performers != null && i < performers.size()); i++) {
  1818. String performerId = performers.get(i);
  1819. if (i != 0) {
  1820. buff.append(",");
  1821. }
  1822. buff.append("'" + performerId + "'");
  1823. }
  1824. buff.append(");");
  1825. out.println(buff.toString());
  1826. }
  1827.  
  1828. if (!rolesPerformerIds.toString().equals("")) {
  1829. if ((isVD && (copyBinders != null && copyBinders.equals("true") || prepareForClone != null && prepareForClone.equalsIgnoreCase("true")))) {
  1830. dialogInitStr = "initTabsEx('wizardDialog', 'mpcWizard', 900, null, 44);";
  1831. } else {
  1832. dialogInitStr = "initTabsEx('wizardDialog', 'mpcWizard', 900, null, 44);";
  1833. }
  1834. }
  1835. }
  1836. }
  1837. %>
  1838.  
  1839. function checkUserAsPerformer(roleId) {
  1840. <% if (checkUserAsPerformer) { %>
  1841. var arrRef = null;
  1842. try {
  1843. arrRef = eval("role_" + roleId + "_performers");
  1844. } catch(e) {
  1845. arrRef = null;
  1846. }
  1847.  
  1848. if (arrRef) {
  1849. for (var i=0; i<document.forms[0].elements['persons_' + roleId].options.length; i++) {
  1850. if (document.forms[0].elements['persons_' + roleId].options[i].selected) {
  1851. var personId = document.forms[0].elements['persons_' + roleId].options[i].value;
  1852.  
  1853. var alertWarning = false;
  1854. for (var j=0; j < arrRef.length; j++) {
  1855. if (personId == arrRef[j]) {
  1856. alertWarning = true;
  1857. break;
  1858. }
  1859. }
  1860.  
  1861. if (alertWarning) {
  1862. var reply = confirm(STR_USER_IS_PERFORMER_WARNING);
  1863. return reply;
  1864. }
  1865. }
  1866. }
  1867. }
  1868.  
  1869. return true;
  1870.  
  1871. <% } else { %>
  1872. return true;
  1873. <% } %>
  1874. }
  1875.  
  1876. var numberOfUsersMsg = "<%= StringEscapeUtils.escapeJavaScript(uiStrings.getLocalizedString("STR_NUMBER_OF_USERS_MSG")) %>: ";
  1877.  
  1878. function toggleApplyToBindingText() {
  1879. var buttonDiv = document.getElementById('buttonDiv'),
  1880. mpcNameElement = document.getElementById('mpcWizard');
  1881.  
  1882. if (document.forms[0].elements['vdDescendOptions'] && document.forms[0].elements['vdDescendOptions'].value && document.forms[0].elements['vdDescendOptions'].value !== 'no_operation') {
  1883. document.getElementById('applyBindingTextTd').style.display = 'inline-block';
  1884. document.forms[0].elements['applyToAllBindingTexts'].checked = true;
  1885. } else if (document.forms[0].elements['applyToVD'] && document.forms[0].elements['applyToVD'].checked) {
  1886. document.getElementById('applyBindingTextTd').style.display = 'inline-block';
  1887. document.forms[0].elements['applyToAllBindingTexts'].checked = true;
  1888. } else {
  1889. document.forms[0].elements['applyToAllBindingTexts'].checked = false;
  1890. document.getElementById('applyBindingTextTd').style.display = 'none'; // using display instead of visibility because this node should not be included in buttonDiv height measurement
  1891. }
  1892.  
  1893. mpcNameElement.style.bottom = (buttonDiv.offsetHeight + 10) + 'px';
  1894. }
  1895.  
  1896. function toggleApplyToVDOfRelatedDocs(){
  1897. if(document.forms[0].elements['applyToAllRelatedDocuments'].checked) {
  1898. document.getElementById('applyToVDOfRelatedDocumentsTable').style.visibility = 'visible';
  1899. toggleApplyToBindingTextOfRelatedDocuments();
  1900. } else {
  1901. document.getElementById('applyToVDOfRelatedDocumentsTable').style.visibility = 'hidden';
  1902. document.getElementById('applyBindingTextOfRelatedDocumentsTd').style.visibility = 'hidden';
  1903. }
  1904. }
  1905.  
  1906. function toggleApplyToBindingTextOfRelatedDocuments() {
  1907. if(document.forms[0].elements['applyToVDOfRelatedDocuments'].checked) {
  1908. document.getElementById('applyBindingTextOfRelatedDocumentsTd').style.visibility = 'visible';
  1909. document.forms[0].elements['applyToAllBindingTextsOfRelatedDocuments'].checked = true;
  1910. } else {
  1911. document.forms[0].elements['applyToAllBindingTextsOfRelatedDocuments'].checked = false;
  1912. document.getElementById('applyBindingTextOfRelatedDocumentsTd').style.visibility = 'hidden';
  1913. }
  1914. }
  1915.  
  1916. function toggleAppendReplace() {
  1917. if(document.forms[0].elements['applyToAllRelatedDocuments'].checked) {
  1918. document.getElementById('appendReplaceSpan').style.visibility = 'visible';
  1919. } else {
  1920. document.getElementById('appendReplaceSpan').style.visibility = 'hidden';
  1921. }
  1922. }
  1923.  
  1924. function initCheckboxes() {
  1925. if (document.forms[0].elements['applyToAllRelatedDocuments']) {
  1926. toggleAppendReplace();
  1927. }
  1928. if (document.forms[0].elements['applyToVD'] || document.forms[0].elements['vdDescendOptions']) {
  1929. toggleApplyToBindingText();
  1930. }
  1931. if (document.forms[0].elements['applyToAllRelatedDocuments'] && document.getElementById('applyToVDOfRelatedDocumentsTable')) {
  1932. toggleApplyToVDOfRelatedDocs();
  1933. }
  1934. }
  1935.  
  1936. function checkIfChangeDescendants () {
  1937. var skipBox = document.forms[0].elements['applySettingsToVDDescendants'].value,
  1938. showBox = false,
  1939. replaceAbsentElement = document.forms['wizard3Form'].elements['replaceAbsentUsers'],
  1940. oldValues = document.forms['wizard3Form'].elements['oldValues'].value,
  1941. newValues = document.forms['wizard3Form'].elements['newValues'].value,
  1942. hasAbsentUser = document.forms['wizard3Form'].elements['hasAbsentUser'].value,
  1943. replaceAbsent;
  1944.  
  1945. if (replaceAbsentElement) {
  1946. replaceAbsent = replaceAbsentElement.checked;
  1947. }
  1948.  
  1949. if (checkVdDescendOption()) {
  1950. if (document.forms[0].elements['applyToVdDescendants'].value === 'true' || (document.forms[0].elements['applyToVD'] && document.forms[0].elements['applyToVD'].checked === true) || (document.forms[0].elements['applyToAllDocuments'] && document.forms[0].elements['applyToAllDocuments'].checked === true)) {
  1951. showBox = true;
  1952. }
  1953.  
  1954. if (showBox === true) {
  1955. if (skipBox === 'false') {
  1956. if (checkNumberOfUsers('<%= personIdsJson %>')) {
  1957. previousNesxtStep('<%= contextPath + jspPath %>explorer/actions/manageUsers/confirmChanges.jsp');
  1958. }
  1959. } else {
  1960. if (checkNumberOfUsers('<%= personIdsJson %>')) {
  1961. previousNesxtStep('<%= contextPath + jspPath %>explorer/actions/manageUsers/manageUsers_finish.jsp');
  1962. }
  1963. }
  1964. } else {
  1965. if (checkNumberOfUsers('<%= personIdsJson %>')) {
  1966. previousNesxtStep('<%= contextPath + jspPath %>explorer/actions/manageUsers/manageUsers_finish.jsp');
  1967. }
  1968. }
  1969. }
  1970. }
  1971.  
  1972. function disableDropDown() {
  1973. if (document.forms[0].elements['vdDescendOptions'] && document.forms[0].elements['vdDescendOptions'].options.length === 1) {
  1974. document.forms[0].elements['vdDescendOptions'].disabled = true;
  1975. }
  1976. }
  1977.  
  1978. function checkVdDescendOption() {
  1979. var flag = true;
  1980.  
  1981. if (document.forms[0].elements['vdDescendOptions']) {
  1982. if (!document.forms[0].elements['vdDescendOptions'].value) {
  1983. flag = false;
  1984. } else if (document.forms[0].elements['vdDescendOptions'].value && document.forms[0].elements['vdDescendOptions'].value !== 'no_operation') {
  1985. document.forms[0].elements['applyToVdDescendants'].value = 'true';
  1986. }
  1987. }
  1988.  
  1989. if (!flag) {
  1990. document.forms['msgboxForm'].elements['msgboxTitle'].value = '<%= uiStrings.getJavascriptEscapedLocalizedString("STR_MANAGE_USERS_WARNING_TITLE") %>';
  1991. document.forms['msgboxForm'].elements['msgboxText'].value = '<%= uiStrings.getJavascriptEscapedLocalizedString("STR_YOU_MUST_SELECT_VD_DESCEND_OPTION") %>';
  1992. top.stopWizardQuickFinish();
  1993. new top.ModalWindow('<%= contextPath + jspPath %>explorer/empty_frame.jsp');
  1994. document.forms['msgboxForm'].target = top.modalFrame.name;
  1995. document.forms['msgboxForm'].submit();
  1996. top.modalFrame.window.focus();
  1997. }
  1998.  
  1999. return flag;
  2000. }
  2001.  
  2002. function showCollaborationMessage(title, message) {
  2003. require(["modules/message_dialog"], function(messageDialog) {
  2004. var CONTEXT_PATH = '<%= contextPath %>',
  2005. MESSAGE_IMAGES_PATH = '<%= imagesPath %>',
  2006. STR_OK = '<%= uiStrings.getJavascriptEscapedLocalizedString("STR_OK") %>',
  2007. errorStingElement;
  2008.  
  2009. function onButtonClick(actionId) {
  2010. var browseButton;
  2011.  
  2012. if (actionId === null) {
  2013. return;
  2014. } else {
  2015. messageDialog.closeDialog();
  2016. }
  2017. }
  2018.  
  2019. actionButtons = [{actionId: 'ok', label: STR_OK}];
  2020.  
  2021. errorStingElement = document.createElement('div');
  2022. errorStingElement.innerHTML = message;
  2023. errorStingElement.className = 'message-dialog-content-element';
  2024.  
  2025. messageDialog.init({
  2026. imagesPath: MESSAGE_IMAGES_PATH,
  2027. contextPath: CONTEXT_PATH,
  2028. width: 400,
  2029. content: {element: errorStingElement},
  2030. title: title,
  2031. buttons: actionButtons,
  2032. onButtonClick: onButtonClick,
  2033. closeDisabled: false
  2034. });
  2035. });
  2036. }
  2037.  
  2038. function isCollaboration(isCollaborationRole, isCollaborationStarted) {
  2039. if (isCollaborationRole === true && isCollaborationStarted === true) {
  2040. showCollaborationMessage('<%= uiStrings.getJavascriptEscapedLocalizedString("STR_COLLABORATION_IN_PROGRESS") %>', '<%= uiStrings.getJavascriptEscapedLocalizedString("STR_COLLABORATION_IN_PROGRESS_CANNOT_CHANGE_ROLE") %>');
  2041. return true;
  2042. } else {
  2043. return false;
  2044. }
  2045. }
  2046.  
  2047. </script>
  2048. </head>
  2049.  
  2050. <%
  2051.  
  2052.  
  2053. ArrayList<String> listRoles = new ArrayList<>();
  2054. HashSet<String> ids = new HashSet<String>();
  2055. StringBuffer displayedRolesIds = new StringBuffer();
  2056. String title = "";
  2057. String helpId = "";
  2058.  
  2059. // collect all absent users (to avoid single query for each user - too slow)
  2060. ArrayList<String> allAbsentUsersIds = new ArrayList<>();
  2061. IDfCollection absentColl = null;
  2062. try {
  2063. DfQuery absentQuery = new MpDfQuery();
  2064. absentQuery.setDQL("select r_object_id from dm_user where r_is_group = false and workflow_disabled = true");
  2065. absentColl = absentQuery.execute(dfcSession, DfQuery.DF_EXECREAD_QUERY);
  2066. while (absentColl != null && absentColl.next()) {
  2067. allAbsentUsersIds.add(absentColl.getString("r_object_id"));
  2068. }
  2069. } catch(Exception ex) {
  2070. Logger.getLogger().error("Error while collecting absent users : " + ex);
  2071. } finally {
  2072. if (absentColl != null) {
  2073. absentColl.close();
  2074. }
  2075. }
  2076. if (wizardType == null) {
  2077. title = uiStrings.getLocalizedString("STR_MANAGE_USERS");
  2078. helpId = "1068";
  2079.  
  2080. if (!fromMultipleMU) {
  2081. roles = pb.getRolesSortedByName();
  2082. for (int i = 0; (roles != null && i < roles.size()); i++) {
  2083. RoleBean rb = roles.get(i);
  2084. String roleId = rb.getId();
  2085.  
  2086. if (hiddenRoles.containsKey(roleId)) {
  2087. continue;
  2088. }
  2089.  
  2090. if (rolesIds.length() > 0) {
  2091. rolesIds.append(",");
  2092. displayedRolesIds.append("~");
  2093. }
  2094. rolesIds.append("'" + roleId + "'");
  2095. displayedRolesIds.append(roleId);
  2096. }
  2097. } else {
  2098. roles = new ArrayList<>();
  2099. StringTokenizer rolesTok = new StringTokenizer(commonRoles, "~");
  2100. while (rolesTok.hasMoreTokens()) {
  2101. String roleId = rolesTok.nextToken();
  2102. roles.add(rManager.getRoleById(roleId));
  2103.  
  2104. // hidden roles are extracted from common roles
  2105. rolesIds.append("'" + roleId + "'");
  2106. displayedRolesIds.append(roleId);
  2107. if (rolesTok.hasMoreTokens()) {
  2108. rolesIds.append(",");
  2109. displayedRolesIds.append("~");
  2110. }
  2111. }
  2112. }
  2113. } else {
  2114. if (isAutomationWizard) {
  2115. title = "STR_START_AUTOMATION_JOB";
  2116. } else {
  2117. title = "STR_" + chosenWizard.toUpperCase() + "_DOCUMENT";
  2118. }
  2119.  
  2120. if (generateTOC.equals("1")){
  2121. title = "STR_GENERATE_TOC";
  2122. }
  2123.  
  2124. if (newRelease.equals("true")) {
  2125. if (wizType == WizardBean.CREATE_WIZARD) {
  2126. title = "STR_NEW_RELEASE";
  2127. } else if (wizType == WizardBean.IMPORT_WIZARD) {
  2128. title = "STR_IMPORT_AS_NEW_RELEASE";
  2129. }
  2130. } else if (newDossier.equals("true")) {
  2131. title = "STR_NEW_DOSSIER";
  2132. } else if (issueChangeRequestRA.equals("true")) {
  2133. title = "STR_ISSUE_CHANGE_REQUEST_BY_RA";
  2134. }
  2135.  
  2136. if (chosenWizard.equals("create")) {
  2137. helpId = "1037";
  2138. } else if (chosenWizard.equals("import")) {
  2139. helpId = "1038";
  2140. } else if (chosenWizard.equals("classify")) {
  2141. helpId = "1067";
  2142. }
  2143.  
  2144. title = uiStrings.getLocalizedString(title);
  2145.  
  2146. if (isAutomationWizard) {
  2147. title += " - " + automationDescription;
  2148. } else if (!(generateTOC.equals("1"))){
  2149. title += " - " + pb.getNameInLanguage(language);
  2150. } else {
  2151. helpId = "1184";
  2152. }
  2153.  
  2154. if (!firstTimeInManageUsers) {
  2155. ArrayList<String> rolePersons = new ArrayList<>();
  2156. if (rolesAndUsers != null && !rolesAndUsers.isEmpty()) {
  2157. Enumeration<String> allRoles = rolesAndUsers.keys();
  2158. while (allRoles.hasMoreElements()) {
  2159. String personsIds = "";
  2160. String roleId = allRoles.nextElement();
  2161. rolePersons = rolesAndUsers.get(roleId);
  2162. for (int j = 0; (rolePersons != null && j < rolePersons.size()); j++) {
  2163. String personName = rolePersons.get(j);
  2164. String id = "";
  2165.  
  2166. PersonBean perb = perManager.getPersonByName(personName, dfcSession.getDocbaseId());
  2167. if (perb != null) {
  2168. id = perb.getId();
  2169. } else {
  2170. OrgUnitBean oub = ouManager.getOrgUnitByGroupName(personName, dfcSession.getDocbaseId());
  2171. if (oub != null) {
  2172. id = oub.getId();
  2173. }
  2174. }
  2175.  
  2176. if (!id.equals("")) {
  2177. if (j == 0) {
  2178. personsIds = id;
  2179. } else {
  2180. personsIds += "~" + id;
  2181. }
  2182. }
  2183. }
  2184. allRolesAndUsers.put(roleId, personsIds);
  2185. }
  2186.  
  2187. }
  2188. } else {
  2189. if (firstTimeInManageUsers) {
  2190. allRolesAndUsers = wu.getUsersForRoles(profileId, wizType, language, rolesAndUsers, defaultAndPersistentRolesAndUsers, isTargetFolder, firstTimeInManageUsers, paramsAndValues);
  2191. }
  2192. }
  2193.  
  2194. if (allRolesAndUsers != null && !allRolesAndUsers.isEmpty()) {
  2195. Enumeration<String> allRoles = allRolesAndUsers.keys();
  2196. while (allRoles.hasMoreElements()) {
  2197. String roleId = allRoles.nextElement();
  2198. if (pb.isRoleHiddenInWizards(roleId)) {
  2199. hiddenRoles.put(roleId, allRolesAndUsers.get(roleId));
  2200. }
  2201. }
  2202. }
  2203. }
  2204.  
  2205.  
  2206. %>
  2207.  
  2208. <body class="dialog claro" onResize="initTabsEx('rolesDialog', 'mpcWizard', 980, null, 80, undefined, false, 29);" onMouseMove="bodyMouseMove();">
  2209. <form name="wizard3Form" method="post" action="<%= contextPath + jspPath %>explorer/actions/manageUsers/manageUsers_finish.jsp">
  2210. <%
  2211. boolean hasVisibleRoles = false;
  2212. for (int r = 0; (roles != null && r < roles.size()); r++) {
  2213. RoleBean rb = roles.get(r);
  2214. String roleId = rb.getId();
  2215.  
  2216. String value = "";
  2217. if (hiddenRoles.containsKey(roleId)) {
  2218. value = hiddenRoles.get(roleId);
  2219. } else {
  2220. hasVisibleRoles = true;
  2221. }
  2222.  
  2223. out.println("<input dir=\"auto\" type=\"hidden\" name=\"role_" + roleId + "\" value=\"" + value + "\">");
  2224. }
  2225. %>
  2226. <input type="hidden" name="isAutomationWizard" value="<%= isAutomationWizard %>">
  2227. <input type="hidden" name="isB2BMessageWizard" value="<%= isB2BMessageWizard %>">
  2228. <input type="hidden" name="automationPerformer" value="<%= automationPerformer %>">
  2229. <input type="hidden" name="automationLogLevel" value="<%= automationLogLevel %>">
  2230. <input type="hidden" name="automationRule" value="<%= automationRule %>">
  2231. <input type="hidden" name="automationBlockingRule" value="<%= automationBlockingRule %>">
  2232. <input type="hidden" name="automationObjectIds" value="<%= automationObjectIds %>">
  2233. <input type="hidden" name="automationDescription" value="<%= automationDescription %>">
  2234. <input type="hidden" name="automationWorkspaceViewRefresh" value="<%= automationWorkspaceViewRefresh %>">
  2235. <input type="hidden" name="B2BEntityIds" value="<%= B2BEntityIds %>">
  2236. <input type="hidden" name="B2BExplicitEntityIds" value="<%= B2BExplicitEntityIds %>">
  2237. <input type="hidden" name="B2BconfigId" value="<%= B2BconfigId %>">
  2238. <input type="hidden" name="B2BSendDirectly" value="<%= B2BSendDirectly %>">
  2239.  
  2240. <input type="hidden" name="oldValues" value="">
  2241. <input type="hidden" name="newValues" value="">
  2242. <input type="hidden" name="hasAbsentUser" value="">
  2243. <input type="hidden" name="previousProfileId" value="<%= previousProfileId %>">
  2244. <input type="hidden" name="initialLoad" value="<%= initialLoad %>">
  2245. <input type="hidden" name="applyToVdDescendants" value="">
  2246.  
  2247. <% if (wizardType == null) { %>
  2248. <input type="hidden" name="fromFinishTaskEx" value="<%= fromFTE %>">
  2249. <input type="hidden" name="FTE_taskId" value="<%= FTE_taskId %>">
  2250. <input type="hidden" name="FTE_fromApprove" value="<%= FTE_fromApprove %>">
  2251. <input type="hidden" name="FTE_fromReject" value="<%= FTE_fromReject %>">
  2252. <input type="hidden" name="properties" value="<%= enabledProperties %>">
  2253. <input type="hidden" name="preselected" value="<%= isPreselected %>">
  2254. <input type="hidden" name="fromFinishAndReject" value="<%= FTE_fromFinishAndReject %>">
  2255. <input type="hidden" name="objectId" value="<%= objectId %>">
  2256. <input type="hidden" name="fromMultipleMU" value="<%= fromMultipleMU %>">
  2257. <input type="hidden" name="displayedRoles" value="<%= displayedRolesIds %>">
  2258. <input type="hidden" name="commonRoles" value="<%= commonRoles %>">
  2259. <input type="hidden" name="actionId" value='<%= request.getParameter("actionId") %>'>
  2260. <input type="hidden" name="contextMenuType" value='<%= request.getParameter("contextMenuType") %>'>
  2261. <!-- promote/demote and finish ex -->
  2262. <input type="hidden" name="FT_fromFinishTask" value="<%= FT_fromFinishTask %>">
  2263. <input type="hidden" name="FT_extendedPromoteOrDemote" value="<%= FT_extendedPromoteOrDemote %>">
  2264. <input type="hidden" name="FT_nextTask" value="<%= FT_nextTask %>">
  2265. <input type="hidden" name="FT_id" value="<%= FT_id %>">
  2266. <input type="hidden" name="FT_objectId" value="<%= FT_objectId %>">
  2267. <input type="hidden" name="FT_profileId" value="<%= FT_profileId %>">
  2268. <input type="hidden" name="FT_lcsId" value="<%= FT_lcsId %>">
  2269. <input type="hidden" name="FT_wfLCSId" value="<%= FT_wfLCSId %>">
  2270. <input type="hidden" name="FT_signoffUsername" value="<%= FT_signoffUsername %>">
  2271. <input type="hidden" name="FT_userFunction" value="<%= FT_userFunction %>">
  2272. <input type="hidden" name="FT_signoffPassword" value="<%= FT_signoffPassword %>">
  2273. <input type="hidden" name="FT_signoffReason" value="<%= FT_signoffReason %>">
  2274. <input type="hidden" name="FT_signoffRequired" value="<%= FT_signoffRequired %>">
  2275. <input type="hidden" name="promoteDemoteId" value="<%= promoteDemoteId %>">
  2276. <input type="hidden" name="promoteIsNextStateSelected" value="<%= promoteIsNextStateSelected %>">
  2277. <input type="hidden" name="promoteToLCS" value="<%= promoteToLCS %>">
  2278. <input type="hidden" name="promoteOnDate" value="<%= promoteOnDate %>">
  2279. <input type="hidden" name="promoteDemoteWfPriority" value="<%= promoteDemoteWfPriority %>">
  2280. <input type="hidden" name="schedulePromote" value="<%= schedulePromote %>">
  2281. <input type="hidden" name="promoteRoles" value="<%= promoteRoles %>">
  2282. <input type="hidden" name="demoteToLCS" value="<%= demoteToLCS %>">
  2283. <input type="hidden" name="demoteRoles" value="<%= demoteRoles %>">
  2284.  
  2285. <!-- used for returning if user validation fails -->
  2286. <input type="hidden" name="id" value="<%= objectId %>">
  2287. <input type="hidden" name="fromFinishTaskEx" value="<%= fromFTE %>">
  2288. <input type="hidden" name="taskId" value="<%= FTE_taskId %>">
  2289. <input type="hidden" name="roles" value="<%= FTE_roles %>">
  2290. <input type="hidden" name="fromApprove" value="<%= FTE_fromApprove %>">
  2291. <input type="hidden" name="fromReject" value="<%= FTE_fromReject %>">
  2292.  
  2293. <input type="hidden" name="fromFinishAndReject" value="<%= FTE_fromFinishAndReject %>">
  2294.  
  2295. <input type="hidden" name="fromMultipleMU" value="<%= fromMultipleMU %>">
  2296. <input type="hidden" name="takeOver" value="<%= takeOver %>">
  2297. <input type="hidden" name="notificationTakeOver" value="<%= notificationTakeOver %>">
  2298. <input type="hidden" name="to" value="<%= to %>">
  2299. <input type="hidden" name="commonRoles" value="<%= commonRoles %>">
  2300. <input type="hidden" name="hasVD" value="<%= hasVD %>">
  2301. <input type="hidden" name="nextObjectId" value="<%= nextObjectId %>">
  2302. <input type="hidden" name="forwardToUrl" value="<%= forwardToUrl %>">
  2303. <input type="hidden" name="target" value="<%= target %>">
  2304. <input type="hidden" name="refresh" value="<%= refresh %>">
  2305. <input type="hidden" name="applySettingsToVDDescendants" value="<%= applySettingsToVDDescendants %>">
  2306. <input type="hidden" name="fromFinishTaskProxy" value="<%= fromFinishTaskProxy %>">
  2307. <%
  2308. if (fromFinishTaskProxy.equals("true")) {
  2309. for (Enumeration<String> en = finishTaskParams.keys(); en.hasMoreElements(); ) {
  2310. String paramName = en.nextElement();
  2311. String paramValue = finishTaskParams.get(paramName);
  2312. %>
  2313. <input type="hidden" name="FTP_<%= paramName %>" value="<%= paramValue %>">
  2314. <%
  2315. }
  2316. }
  2317.  
  2318. // Determine whether to display "apply" checkboxes.
  2319. if (!fromMultipleMU) {
  2320. ArrayList<String> rolesAllowed = null;
  2321. if (lcsb != null && !lcsb.getApplyCheckboxesOnUsersAndRolesAllowedCheckProfileSettings()) {
  2322. rolesAllowed = lcsb.getApplyCheckboxesOnUsersAndRolesAllowed();
  2323. } else {
  2324. rolesAllowed = pb.getApplyCheckboxesOnUsersAndRolesAllowed();
  2325. }
  2326.  
  2327. ProfileUtil pu = new ProfileUtil(language, dfcSession);
  2328. ArrayList<String> currentUserRoles = pu.getUsersRolesForObjectFromDocbase(object);
  2329. for (int i = 0; (currentUserRoles != null && i < currentUserRoles.size()); i++) {
  2330. String roleId = currentUserRoles.get(i);
  2331. if (rolesAllowed != null && rolesAllowed.contains(roleId)) {
  2332. displayApplyCheckboxes = true;
  2333. break;
  2334. }
  2335. }
  2336. } else {
  2337. displayApplyCheckboxes = displayApplyCheckboxesMU;
  2338. }
  2339.  
  2340. if (!hasVisibleRoles) {
  2341. displayApplyCheckboxes = false;
  2342. }
  2343.  
  2344. if (pb != null && pb.getAllowedVdDescendOptions() != null && pb.getAllowedVdDescendOptions().isEmpty()) {
  2345. displayVdDescendOptionsDropdown = false;
  2346. }
  2347.  
  2348. if (displayApplyCheckboxes) {
  2349. // check for collaboration in progress
  2350. IDfSession adminSession = DocbaseUtility.getAdminSession();
  2351.  
  2352. relatedCollaboration = OneDriveUtility.isCollaborativeEditStartedOnRelatedOrVirtualDocuments(adminSession, objectId, true, false, false);
  2353. if (relatedCollaboration) {
  2354. applyToAllRelatedDocumentsChecked = "disabled";
  2355. }
  2356.  
  2357. if (isVD && displayVdDescendOptionsDropdown || hasVD && fromMultipleMU) {
  2358. vdCollaboration = OneDriveUtility.isCollaborativeEditStartedOnRelatedOrVirtualDocuments(adminSession, objectId, false, true, false);
  2359. }
  2360.  
  2361. if (allowApplyToAllVDDescendantsOfRelatedDocuments || fromMultipleMU && displayApplyCheckboxesForRelatedVDs) {
  2362. relatedVdCollaboration = OneDriveUtility.isCollaborativeEditStartedOnRelatedOrVirtualDocuments(adminSession, objectId, false, false, true);
  2363. }
  2364. }
  2365.  
  2366. if (relatedVdCollaboration) {
  2367. applyToAllVDDescendantsOfRelatedDocumentsChecked = "disabled";
  2368. } else if (applyToAllVDDescendantsOfRelatedDocuments) {
  2369. applyToAllVDDescendantsOfRelatedDocumentsChecked = "checked";
  2370. }
  2371.  
  2372. %>
  2373. <input type="hidden" name="checkApplyToAllRelDoc" value="<%= checkApplyToAllRelDoc %>">
  2374. <input type="hidden" name="displayApplyCheckboxes" value="<%= displayApplyCheckboxes %>">
  2375. <input type="hidden" name="displayApplyCheckboxesForRelatedVDs" value="<%= displayApplyCheckboxesForRelatedVDs %>">
  2376. <% } else { %>
  2377. <input type="hidden" name="wizardType" value="<%= wizardType %>">
  2378. <input type="hidden" name="objectTypeId" value="<%= objectTypeId %>">
  2379. <input type="hidden" name="profileId" value="<%= profileId %>">
  2380. <input type="hidden" name="templateId" value="<%= templateId %>">
  2381. <input type="hidden" name="generateTOC" value="<%= generateTOC %>">
  2382. <input type="hidden" name="tocParentId" value="<%= tocParentId %>">
  2383. <input type="hidden" name="omitDocsIds" value="<%= omitDocsIds %>">
  2384. <input type="hidden" name="rootObjectId" value="<%= rootObjectId %>">
  2385. <input type="hidden" name="firstWizard" value="<%= firstWizard %>">
  2386. <input type="hidden" name="lcsId" value="<%= lcsId %>">
  2387. <input type="hidden" name="requestBlankPDFRendition" value="<%= requestBlankPDFRendition %>">
  2388. <input type="hidden" name="folderId" value="<%= folderId %>">
  2389. <input type="hidden" name="filePath" value="<%= filePath %>">
  2390. <input type="hidden" name="fileName" value="<%= fileName %>">
  2391. <input type="hidden" name="contentType" value="<%= contentType %>">
  2392. <input type="hidden" name="objectId" value="<%= objectId %>">
  2393. <input type="hidden" name="chronicleId" value="<%= chronicleId %>">
  2394. <input type="hidden" name="relations" value="<%= relations %>">
  2395. <input type="hidden" name="newRelease" value="<%= newRelease %>">
  2396. <input type="hidden" name="forMRP" value="<%= forMRP %>">
  2397. <input type="hidden" name="keepCurrentLCStates" value="<%= keepCurrentLCStates %>">
  2398. <input type="hidden" name="keepCurrentObjectNames" value="<%= keepCurrentObjectNames %>">
  2399. <input type="hidden" name="moduleIds" value="<%= moduleIds %>">
  2400. <input type="hidden" name="newDossier" value="<%= newDossier %>">
  2401. <input type="hidden" name="superType" value="<%= superType %>">
  2402. <input type="hidden" name="previousStep" value="3">
  2403. <input type="hidden" name="shortWizard" value="<%= shortWizard %>">
  2404. <input type="hidden" name="copyBinders" value="<%= copyBinders %>">
  2405. <input type="hidden" name="copyBindingText" value="<%= copyBindingText %>">
  2406. <input type="hidden" name="copyVDRoot" value="<%= copyVDRoot %>">
  2407. <input type="hidden" name="createFolders" value="<%= createFolders %>">
  2408. <input type="hidden" name="wfPriority" value="<%= request.getParameter("wfPriority") %>">
  2409. <input type="hidden" name="barcode" value="<%= barcode %>">
  2410. <input type="hidden" name="barcodeValue" value="<%= barcodeValue %>">
  2411. <input type="hidden" name="showPreview" value="<%= showPreview %>">
  2412. <input type="hidden" name="mapCounterStartValue" value="<%= mapCounterStartValue %>">
  2413. <input type="hidden" name="putDocumentAsChildInRelation" value="<%= putDocumentAsChildInRelation %>">
  2414. <input type="hidden" name="checkFolder" value="<%= checkFolder %>">
  2415. <input type="hidden" name="deleteObjectContent" value="<%= deleteObjectContent %>">
  2416. <input type="hidden" name="replaceObjectContent" value="<%= replaceObjectContent %>">
  2417. <input type="hidden" name="replacementTemplateId" value="<%= replacementTemplateId %>">
  2418. <input type="hidden" name="issueChangeRequestRA" value="<%= issueChangeRequestRA %>">
  2419. <input type="hidden" name="chooseSourceWizardForSettings" value="<%= chooseSourceWizardForSettings %>">
  2420. <input type="hidden" name="fromCloneAdvanced" value="<%= fromCloneAdvanced %>">
  2421. <input type="hidden" name="chosenWizard" value="<%= chosenWizard %>">
  2422. <input type="hidden" name="pasteEx" value="<%= pasteEx %>">
  2423. <input type="hidden" name="pasteInVD" value="<%= pasteInVD %>">
  2424. <input type="hidden" name="isCloneAction" value="<%= isCloneAction %>">
  2425. <input type="hidden" name="createSnapshot" value="<%= createSnapshot %>">
  2426. <input type="hidden" name="defaultPdfPageSize" value="<%= defaultPdfPageSize %>">
  2427. <input type="hidden" name="containmentId" value="<%= containmentId %>">
  2428. <input type="hidden" name="editVirtualDocument" value="<%= editVirtualDocument %>">
  2429. <input type="hidden" name="parentWndName" value="<%= parentWndName %>">
  2430. <input type="hidden" name="showRelatedAction" value="<%= showRelatedAction %>">
  2431. <input type="hidden" name="targetViewId" value="<%= targetViewId %>">
  2432. <input type="hidden" name="frameId" value="<%= frameId %>">
  2433. <input type="hidden" name="isFromInsert" value="<%= isFromInsert %>">
  2434. <input type="hidden" name="prepareForClone" value="<%= prepareForClone %>">
  2435. <input type="hidden" name="isSimple" value="<%= isSimple %>">
  2436. <input type="hidden" name="profs" value="<%= profs %>">
  2437. <input type="hidden" name="tasksSelect" value="<%= tasksSelect %>">
  2438. <input type="hidden" name="auths" value="<%= auths %>">
  2439. <input type="hidden" name="fromDate" value="<%= fromDate %>">
  2440. <input type="hidden" name="toDate" value="<%= toDate %>">
  2441. <input type="hidden" name="objName" value="<%= objName %>">
  2442. <input type="hidden" name="id" value="<%= tmpId %>">
  2443. <input type="hidden" name="tmpObjectTypeId" value="<%= tmpType %>">
  2444. <input type="hidden" name="isOpenTasksReport" value="<%= isOpenTasksReport %>">
  2445. <input type="hidden" name="pdfPassword" value="<%= pdfPassword %>">
  2446. <input type="hidden" name="applyPropsToVD" value="<%= applyPropsToVD %>">
  2447. <!-- pmi, classify as new release -->
  2448. <input type="hidden" name="classifyAsNewRelease" value="<%= classifyAsNewRelease %>">
  2449. <input type="hidden" name="newContentObject" value="<%= newContentObject %>">
  2450. <input type="hidden" name="isWithoutTemplate" value="<%= isWithoutTemplate %>">
  2451. <input type="hidden" name="isMSO" value="<%= isMSO %>">
  2452. <input type="hidden" name="importProps" value="<%= importProps %>">
  2453. <input type="hidden" name="vdStructureReview" value="<%= vdStructureReview %>">
  2454. <input type="hidden" name="vdStructureChange" value="<%= vdStructureChange %>">
  2455. <input type="hidden" name="vdStructureStep" value="<%= vdStructureStep%>">
  2456. <input type="hidden" name="vdStructureOptions" value='<%= vdStructureOptions %>'>
  2457. <input type="hidden" name="frmAction" value="<%= frmAction %>">
  2458. <input type="hidden" name="wizardQuickFinishEnabled" value="<%= wizardQuickFinishEnabled %>">
  2459. <input type="hidden" name="documentSelectionAttribute" value="<%= documentSelectionAttribute %>">
  2460. <input type="hidden" name="selectedObjectIds" value="<%= selectedObjectIds %>">
  2461. <input type="hidden" name="skipProfileSelect" value="<%= skipProfileSelect %>">
  2462. <input type="hidden" name="lcsName" value="<%= lcsName %>">
  2463. <%
  2464. if (firstTimeInWizardRelations != null && !firstTimeInWizardRelations.equals("")) {
  2465. %>
  2466. <input type="hidden" name="firstTimeInWizardRelations" value="<%= firstTimeInWizardRelations %>">
  2467. <%
  2468. }
  2469.  
  2470. if (isSaveSearch != null && isSaveSearch.equals("true")) {
  2471. %>
  2472. <input type="hidden" name="saveSearch" value="true">
  2473. <%
  2474. for (Enumeration<?> en = saveSearch.propertyNames(); en.hasMoreElements(); ) {
  2475. String name = (String)en.nextElement();
  2476. String value = saveSearch.getProperty(name);
  2477. %>
  2478. <input type="hidden" name="<%= name %>~saveSearch" value="<%= StringEscapeUtils.escapeHtml(value) %>">
  2479. <%
  2480. }
  2481. }
  2482.  
  2483. out.println(paramsBuff.toString());
  2484.  
  2485. if (alreadyInWizard3ForCurrentFile.equals("0") || alreadyInWizard3ForCurrentFile.equals("")) {
  2486. alreadyInWizard3ForCurrentFile = "1";
  2487. session.setAttribute("alreadyInWizard3ForCurrentFile", alreadyInWizard3ForCurrentFile);
  2488. }
  2489. } %>
  2490.  
  2491. <div id="rolesDialog" class="dialogForm dialog-custom">
  2492. <div id="titleBar" class="dialogTitleBar" onmousedown="startMoveDialog(this.parentElement);" onmouseup="stopMoveDialog(this.parentElement);" onmousemove="dialogMouseMove();">
  2493. <%= title %>
  2494. </div>
  2495. <div>
  2496. <div data-node-type="tab-container" data-manual-initialization="true" class="mp-tab-container" id="mpcWizard" style="visibility: hidden;">
  2497. <%
  2498. if (!hasVisibleRoles) {
  2499. if (!forceHiddenRoleValidation && wizardType != null) {
  2500. %>
  2501. <script>
  2502. var automationParameters = "<%= StringEscapeUtils.escapeJavaScript("&isAutomationWizard=" + isAutomationWizard + "&automationPerformer=" + automationPerformer +
  2503. "&automationLogLevel=" + automationLogLevel + "&automationRule=" + automationRule + "&automationBlockingRule=" + automationBlockingRule +
  2504. "&automationObjectIds=" + automationObjectIds + "&automationDescription=" + automationDescription + "&automationWorkspaceViewRefresh=" + automationWorkspaceViewRefresh +
  2505. "&B2BEntityIds=" + B2BEntityIds + "&B2BExplicitEntityIds=" + B2BExplicitEntityIds + "&B2BconfigId=" + B2BconfigId + "&B2BSendDirectly=" + B2BSendDirectly +
  2506. "&isB2BMessageWizard=" + isB2BMessageWizard) %>";
  2507. setSelectedTab(1);
  2508. previousNesxtStep("/myprocess/jsp/wizard/validateUsers.jsp?manageRelatedDocuments=<%= wb.hasRelations(chosenWizType) %>&skipManageUsers=true" + automationParameters);
  2509. </script>
  2510. <%
  2511. } else {
  2512. %>
  2513. <div data-node-type="page-container" class="mp-page-container" id="tabNoRoles" TABTITLE="NoRoles" TABTEXT="<%= uiStrings.getLocalizedString("STR_NO_ROLES") %>">
  2514. <table style="border:0px; width:100%">
  2515. <br>
  2516. <br>
  2517. <br>
  2518. <br>
  2519. <tr>
  2520. <td class="labelFieldCenter">
  2521. <%= uiStrings.getLocalizedString("STR_NOT_ALLOWED_TO_VIEW_MANAGE_ANY_ROLE") %>
  2522. </td>
  2523. </tr>
  2524. </table>
  2525. </div>
  2526. <%
  2527. }
  2528. } else {
  2529. int minUsers = 0;
  2530. int maxUsers = -1;
  2531.  
  2532. if (roles != null) {
  2533. roles = rManager.sortRolesByName(roles);
  2534. }
  2535.  
  2536. for (int i = 0; (roles != null && i < roles.size()); i++) {
  2537. RoleBean rb = (RoleBean)roles.get(i);
  2538. String roleId = rb.getId();
  2539. if (hiddenRoles.containsKey(roleId)) {
  2540. continue;
  2541. }
  2542.  
  2543. Logger.getLogger().trace("roleId = " + roleId);
  2544.  
  2545. String roleName = rb.getNameInLanguage(language);
  2546. String roleDescription = rb.getDescriptionInLanguage(language);
  2547.  
  2548. if (!fromMultipleMU) {
  2549. if (lcsb != null && lcsb.getMinUsersForRole(roleId) != LifeCycleStateBean.MIN_MAX_USERS_CHECK_PROFILE_SETTINGS) {
  2550. minUsers = lcsb.getMinUsersForRole(roleId);
  2551. } else {
  2552. minUsers = pb.getMinUsersForRole(roleId);
  2553. }
  2554.  
  2555. if (lcsb != null && lcsb.getMaxUsersForRole(roleId) != LifeCycleStateBean.MIN_MAX_USERS_CHECK_PROFILE_SETTINGS) {
  2556. maxUsers = lcsb.getMaxUsersForRole(roleId);
  2557. } else {
  2558. maxUsers = pb.getMaxUsersForRole(roleId);
  2559. }
  2560. }
  2561.  
  2562. if (fromFinishTaskProxy.equals("true")) {
  2563. ArrayList<String> minMaxUsers = minMaxUsersAll.get(roleId);
  2564. String minUsersStr = minMaxUsers.get(0);
  2565. if (minUsersStr == null) {
  2566. minUsersStr = "-1";
  2567. }
  2568.  
  2569. String maxUsersStr = minMaxUsers.get(1);
  2570. if (maxUsersStr == null) {
  2571. maxUsersStr = "-1";
  2572. }
  2573.  
  2574. Integer tmpMinUsers = new Integer(minUsersStr);
  2575. Integer tmpMaxUsers = new Integer(maxUsersStr);
  2576. minUsers = tmpMinUsers.intValue();
  2577. maxUsers = tmpMaxUsers.intValue();
  2578. }
  2579.  
  2580. listRoles.add(roleId);
  2581.  
  2582. boolean isCollaborationRole = false;
  2583. if (rb.isCoordinator() || rb.isAuthor()) {
  2584. isCollaborationRole = true;
  2585. }
  2586. %>
  2587. <div data-node-type="page-container" data-force-tab-visibility="true" class="mp-page-container" id="tab<%= roleId %>" roleId="<%= roleId %>" currUserId="<%= currUserId %>" TABTITLE="<%= roleDescription %>" TABTEXT="<%= roleName %>" onfocus="disableUserButt('wizard3Form', 'persons_<%= roleId %>', 'addCurrUser_<%= roleId %>', 'remCurrUser_<%= roleId %>', null, '<%= currUserId %>', checkIfCurrentUserIsAllowed('<%= roleId %>'));">
  2588. <table style="border:0px; width:100%; height:100%">
  2589. <tr style="height:100%">
  2590. <td nowrap>
  2591. <table style="border:0px; width:100%; height:10px; cellpadding:2px">
  2592. <tr style="height:10px">
  2593. <td colspan="3" class="labelFieldLeft"><%= uiStrings.getLocalizedString("STR_ORG_UNITS") %>:</td>
  2594. </tr>
  2595. <tr style="height:10px">
  2596. <td colspan="3" class="controlFieldLeft">
  2597. <!-- GROUPS -->
  2598. <select style="width: 100%;" id="orgUnits_<%= roleId %>" name="orgUnits_<%= roleId %>" class="controlLeft" onchange="refreshUsers('orgUnits_<%= roleId %>', 'personsValues_<%= roleId %>', '<%= roleId %>');"></select>
  2599. </td>
  2600. </tr>
  2601. <tr style="height:10px">
  2602. <td colspan="3" class="labelFieldLeft">
  2603. <%= uiStrings.getLocalizedString("STR_USERS_AND_GROUPS") %>:
  2604. </td>
  2605. </tr>
  2606. <tr style="height:10px">
  2607. <td colspan="3">
  2608. <table cellpadding="0" cellspacing="0" style="width:100%; height:100%">
  2609. <tr>
  2610. <%-- pmi, dma-task 3662 added filterButt --%>
  2611. <td nowrap style="width:45%;">
  2612. <table cellpadding="0" cellspacing="0" style="width:100%; height:100%">
  2613. <tbody>
  2614. <tr>
  2615. <td style="width: 100%;"><input dir="auto" type="text" name="filterByStr<%= roleId %>" value="" class="selectText" style="width: 100%;" onKeyPress="if (event.keyCode == 13) getUnselectedData('orgUnits_<%= roleId %>', 'personsValues_<%= roleId %>', '<%= roleId %>', 'filterButt');"/></td>
  2616. <td style="width: 80px;">&nbsp;<button class="button" style="width: 80px; margin-top: 0px;" name="filterButt" onmousedown="getUnselectedData('orgUnits_<%= roleId %>', 'personsValues_<%= roleId %>', '<%= roleId %>', 'filterButt'); return false;" onclick="return false;" onmouseup="return false;"><%= uiStrings.getLocalizedString("STR_FILTER") %></button></td>
  2617. </tr>
  2618. </tbody>
  2619. </table>
  2620. </td>
  2621. <td style="width: 100px;">&nbsp;</td>
  2622. <td nowrap align="right" style="width: 45%;">
  2623. <button class="button" style="width: 135px;" name="addCurrUser_<%= roleId %>" onClick="if (isCollaboration(<%= isCollaborationRole %>, <%= isCollaborativeEditStarted %>)) return false; addCurrUser('wizard3Form', 'persons_<%= roleId %>', 'addCurrUser_<%= roleId %>', 'remCurrUser_<%= roleId %>', '<%= currUserId %>', '<%= StringEscapeUtils.escapeJavaScript(userNameEx) %>', checkIfCurrentUserIsAllowed('<%= roleId %>')); return false;" onmouseup="return false;"><%= uiStrings.getLocalizedString("STR_ADD_CURR_USER") %></button>&nbsp;
  2624. <button class="button" style="width: 158px;" name="remCurrUser_<%= roleId %>" onClick="if (isCollaboration(<%= isCollaborationRole %>, <%= isCollaborativeEditStarted %>)) return false; if (checkUserAsPerformer('<%= roleId %>')) { remCurrUser('wizard3Form', 'persons_<%= roleId %>', 'personsValues_<%= roleId %>', 'addCurrUser_<%= roleId %>', 'remCurrUser_<%= roleId %>', null, '<%= currUserId %>', '<%= StringEscapeUtils.escapeJavaScript(userNameEx) %>', checkIfCurrentUserIsAllowed('<%= roleId %>'));} return false;" onmouseup="return false;"><%= uiStrings.getLocalizedString("STR_REM_CURR_USER") %></button>
  2625. </td>
  2626. </tr>
  2627. </table>
  2628. </td>
  2629. </tr>
  2630. </table>
  2631. <table style="border:0px; width:100%; height:82%">
  2632. <tr>
  2633. <td class="controlFieldRight" style="width: 50%; position: relative;" >
  2634. <div id="loading_<%= roleId %>" style="border: 0px solid #000; left: 0px; position: absolute; width: 100%; height: 99%; text-align: center;">
  2635. <table style="height: 100%; width: 100%;">
  2636. <tr>
  2637. <td class="loading-overlay-inline" style="vertical-align: middle; text-align: center; background-color: #ffffff;"><%= STR_LOADING %></td>
  2638. </tr>
  2639. </table>
  2640. </div>
  2641.  
  2642. <select style="height:100%; width:100%;" name="personsValues_<%= roleId %>" multiple removeNotAllowed="true" addNotAllowed="true" class="controlLeft" size="30" onchange="enableButts('wizard3Form', 'addPersonBtn_<%= roleId %>')" onDblClick="if (isCollaboration(<%= isCollaborationRole %>, <%= isCollaborativeEditStarted %>)) return false; onOptionAdd('wizard3Form', 'personsValues_<%= roleId %>', 'persons_<%= roleId %>', 'addPersonBtn_<%= roleId %>', null); disableUserButt('wizard3Form', 'persons_<%= roleId %>', 'addCurrUser_<%= roleId %>', 'remCurrUser_<%= roleId %>', null, '<%= currUserId %>', checkIfCurrentUserIsAllowed('<%= roleId %>'));" onClick="onOptionAdd('wizard3Form', 'personsValues_<%= roleId %>', 'persons_<%= roleId %>', 'addPersonBtn_<%= roleId %>', null, true);">
  2643.  
  2644. </select>
  2645. </td>
  2646. <td class="controlFieldCenter" style="width:100px; height: 400px">
  2647. <table>
  2648. <tr>
  2649. <td style="width:10px">
  2650. &nbsp;
  2651. </td>
  2652. <td valign="center">
  2653. <input type="button" disabled name="addPersonBtn_<%= roleId %>" value=">>" onClick="if (isCollaboration(<%= isCollaborationRole %>, <%= isCollaborativeEditStarted %>)) return false; addOption('wizard3Form', 'personsValues_<%= roleId %>', 'persons_<%= roleId %>', 'addPersonBtn_<%= roleId %>', null); disableUserButt('wizard3Form', 'persons_<%= roleId %>', 'addCurrUser_<%= roleId %>', 'remCurrUser_<%= roleId %>', null, '<%= currUserId %>', checkIfCurrentUserIsAllowed('<%= roleId %>')); return false;" onmouseup="return false;" class="button" style="width:60px; height:24px;">
  2654. </td>
  2655. <td style="width:10px">
  2656. &nbsp;
  2657. </td>
  2658. </tr>
  2659. </table>
  2660. <table>
  2661. <tr>
  2662. <td style="width:10px">
  2663. &nbsp;
  2664. </td>
  2665. <td valign="center">
  2666. <input type="button" disabled name="removePersonBtn_<%= roleId %>" value="<<" onClick="if (isCollaboration(<%= isCollaborationRole %>, <%= isCollaborativeEditStarted %>)) return false; if (checkUserAsPerformer('<%= roleId %>')) { addOption('wizard3Form', 'persons_<%= roleId %>', 'personsValues_<%= roleId %>', 'removePersonBtn_<%= roleId %>', null); disableUserButt('wizard3Form', 'persons_<%= roleId %>', 'addCurrUser_<%= roleId %>', 'remCurrUser_<%= roleId %>', null, '<%= currUserId %>', checkIfCurrentUserIsAllowed('<%= roleId %>'));} return false;" onmouseup="return false;" class="button" style="width:60px; height:24px;">
  2667. </td>
  2668. <td style="width:10px">
  2669. &nbsp;
  2670. </td>
  2671. </tr>
  2672. </table>
  2673. </td>
  2674. <td class="controlFieldLeft" style="width: 50%;" >
  2675. <select style="height:100%; width:100%;" name="persons_<%= roleId %>" checkForExisting="true" multiple class="controlLeft" size="30" <% if (fromMultipleMU) out.print("addWhere=\"end\""); %> onchange="enableButtsRespectiveToForbiddenOptions('wizard3Form', 'removePersonBtn_<%= roleId %>', 'persons_<%= roleId %>')" onDblClick="if (isCollaboration(<%= isCollaborationRole %>, <%= isCollaborativeEditStarted %>)) return false; if (checkUserAsPerformer('<%= roleId %>')) { addOption('wizard3Form', 'persons_<%= roleId %>', 'personsValues_<%= roleId %>', 'removePersonBtn_<%= roleId %>', null); disableUserButt('wizard3Form', 'persons_<%= roleId %>', 'addCurrUser_<%= roleId %>', 'remCurrUser_<%= roleId %>', null, '<%= currUserId %>', checkIfCurrentUserIsAllowed('<%= roleId %>'));}" roleName="<%= roleName %>" <% if (minUsers != 0) out.print(" minUsers=\"" + minUsers + "\" "); if (maxUsers != -1) out.print(" maxUsers=\"" + maxUsers + "\" "); %>>
  2676. <%
  2677. if (wizardType == null) {
  2678. if (!fromMultipleMU && rolesAndUsers != null && !rolesAndUsers.isEmpty()) {
  2679. ArrayList<String> rolePersons = rolesAndUsers.get(roleId);
  2680. if (rolePersons != null && !rolePersons.isEmpty()) {
  2681.  
  2682. ArrayList<String> personNames = new ArrayList<>();
  2683. Hashtable<String, String> personIds = new Hashtable<>();
  2684. Hashtable<String, String> counts = new Hashtable<>();
  2685.  
  2686. for (int p = 0; p < rolePersons.size(); p++) {
  2687. String personName = rolePersons.get(p);
  2688. String personId = "";
  2689. String count = "";
  2690.  
  2691. PersonBean pBean = perManager.getPersonByName(personName, dfcSession.getDocbaseId());
  2692. if (pBean != null) {
  2693. personName = pBean.getNameEx();
  2694. personId = pBean.getId();
  2695. count = "1";
  2696. } else {
  2697. OrgUnitBean ouBean = ouManager.getOrgUnitByGroupName(personName, dfcSession.getDocbaseId());
  2698. if (ouBean != null) {
  2699. personName = ouBean.getNameEx();
  2700. personId = ouBean.getId();
  2701. count = String.valueOf(ouBean.getNumberOfPersons());
  2702. }
  2703. }
  2704.  
  2705. if (!personId.equals("")) {
  2706. personNames.add(personName);
  2707. personIds.put(personName, personId);
  2708. counts.put(personName, count);
  2709. }
  2710. }
  2711.  
  2712. Collections.sort(personNames, String.CASE_INSENSITIVE_ORDER);
  2713. int counter = 0;
  2714. for (int p = 0; p < personNames.size(); p++) {
  2715. String personName = personNames.get(p);
  2716. String personId = personIds.get(personName);
  2717. String count = counts.get(personName);
  2718.  
  2719. String display = personName;
  2720. PersonBean perb = perManager.getPersonById(personId);
  2721. OrgUnitBean ouBean = ouManager.getOrgUnitById(personId);
  2722.  
  2723. if (perb != null && allAbsentUsersIds.contains(perb.getId())) {
  2724. String replacement = perb.getUserDelegation();
  2725. if (replacement == null) {
  2726. replacement = "";
  2727. }
  2728. PersonBean replacePB = perManager.getPersonByName(replacement, perb.getDocbaseId());
  2729.  
  2730. if (replacePB == null || allAbsentUsersIds.contains(replacePB.getId())) {
  2731. display += " (" + uiStrings.getLocalizedString("STR_ABSENT") + ", " + uiStrings.getLocalizedString("STR_NO_REPLACEMENT_DEFINED") + ")";
  2732. } else {
  2733. display += " (" + uiStrings.getLocalizedString("STR_ABSENT") + ", " + uiStrings.getLocalizedString("STR_REPLACED_BY") + " " + replacePB.getNameEx() + ")";
  2734. }
  2735. }
  2736.  
  2737. boolean allowed = true;
  2738. if (ouBean != null) {
  2739. allowed = ouBean.isAllowed(dfcSession);
  2740. }
  2741.  
  2742. %>
  2743. <option dir="auto" forbidden=<%=!allowed %> value="<%= personId %>" count="<%= count %>"><%= display %></option>
  2744. <%
  2745. }
  2746. }
  2747. }
  2748. } else {
  2749. ArrayList<String> rolePersons = new ArrayList<>();
  2750. if (allRolesAndUsers != null && !allRolesAndUsers.isEmpty()) {
  2751. String rolePersonsIds = allRolesAndUsers.get(roleId);
  2752. String[] allIds = rolePersonsIds.split("~");
  2753. for (int p = 0; p < allIds.length; p++) {
  2754. rolePersons.add(allIds[p]);
  2755. }
  2756. }
  2757.  
  2758. if ((rolesAndUsers != null && !rolesAndUsers.isEmpty()) || (defaultAndPersistentRolesAndUsers != null && !defaultAndPersistentRolesAndUsers.isEmpty())) {
  2759.  
  2760. Logger.getLogger().trace("1. roleId = " + roleId);
  2761. if (rolePersons != null && !rolePersons.isEmpty()) {
  2762.  
  2763. ArrayList<String> personNames = new ArrayList<>();
  2764. Hashtable<String, String> personIds = new Hashtable<>();
  2765. Hashtable<String, String> counts = new Hashtable<>();
  2766.  
  2767. for (int p = 0; p < rolePersons.size(); p++) {
  2768. String personId = rolePersons.get(p);
  2769. String personName = "";
  2770. String count = "";
  2771.  
  2772. PersonBean pBean = perManager.getPersonById(personId);
  2773. if (pBean != null) {
  2774. personName = pBean.getNameEx();
  2775. personId = pBean.getId();
  2776. count = "1";
  2777. } else {
  2778. OrgUnitBean ouBean = ouManager.getOrgUnitById(personId);
  2779. if (ouBean != null) {
  2780. personName = ouBean.getNameEx();
  2781. personId = ouBean.getId();
  2782. count = String.valueOf(ouBean.getNumberOfPersons());
  2783. }
  2784. }
  2785.  
  2786. if (!personId.equals("")) {
  2787. personNames.add(personName);
  2788. personIds.put(personName, personId);
  2789. counts.put(personName, count);
  2790. }
  2791. }
  2792.  
  2793. Collections.sort(personNames);
  2794.  
  2795. for (int p = 0; p < personNames.size(); p++) {
  2796. String personName = personNames.get(p);
  2797. String personId = personIds.get(personName);
  2798. String count = counts.get(personName);
  2799.  
  2800. String display = personName;
  2801. PersonBean perb = perManager.getPersonById(personId);
  2802. OrgUnitBean ouBean = ouManager.getOrgUnitByGroupName(personName, dfcSession.getDocbaseId());
  2803. if (perb != null && allAbsentUsersIds.contains(perb.getId())) {
  2804. String replacement = perb.getUserDelegation();
  2805. if (replacement == null) {
  2806. replacement = "";
  2807. }
  2808. PersonBean replacePB = perManager.getPersonByName(replacement, perb.getDocbaseId());
  2809.  
  2810. if (replacePB == null || allAbsentUsersIds.contains(replacePB.getId())) {
  2811. display += " (" + uiStrings.getLocalizedString("STR_ABSENT") + ", " + uiStrings.getLocalizedString("STR_NO_REPLACEMENT_DEFINED") + ")";
  2812. } else {
  2813. display += " (" + uiStrings.getLocalizedString("STR_ABSENT") + ", " + uiStrings.getLocalizedString("STR_REPLACED_BY") + " " + replacePB.getNameEx() + ")";
  2814. }
  2815. }
  2816.  
  2817. boolean allowed = true;
  2818. if (ouBean != null) {
  2819. allowed = ouBean.isAllowed(dfcSession);
  2820. }
  2821.  
  2822. %>
  2823. <option dir="auto" forbidden=<%=!allowed %> value="<%= personId %>" count="<%= count %>"><%= display %></option>
  2824. <%
  2825. }
  2826. }
  2827. }
  2828. }
  2829. %>
  2830. </select>
  2831. </td>
  2832. </tr>
  2833. </table>
  2834. </td>
  2835. </tr>
  2836. <% if (fromMultipleMU) { %>
  2837. <tr>
  2838. <td colspan="3" class="labelFieldLeft">
  2839. <input type="checkbox" name="append_<%= roleId %>" onclick="document.forms[0].elements['min_<%= roleId %>'].disabled = this.checked;" value="true"><%= uiStrings.getLocalizedString("STR_MANAGE_USERS_MULTIPLE_APPEND") %>
  2840. </td>
  2841. </tr>
  2842. <tr>
  2843. <td colspan="3">
  2844. <table class="controlRow">
  2845. <tr>
  2846. <td class="labelFieldLeft" style="width: 50%;">
  2847. <%= uiStrings.getLocalizedString("STR_MANAGE_USERS_MULTIPLE_MAX") %>:
  2848. </td>
  2849. <td class="controlFieldCenter" style="width:100px;">
  2850. </td>
  2851. <td class="labelFieldLeft" style="width: 50%;">
  2852. <%= uiStrings.getLocalizedString("STR_MANAGE_USERS_MULTIPLE_MIN") %>:
  2853. </td>
  2854. </tr>
  2855. </table>
  2856. </td>
  2857. </tr>
  2858. <tr>
  2859. <td colspan="3">
  2860. <table class="controlRow">
  2861. <tr>
  2862. <td class="controlFieldLeft" style="width: 50%;">
  2863. <select name="max_<%= roleId %>" class="controlLeft">
  2864. <option value="LEAVE"><%= uiStrings.getLocalizedString("STR_MAX_LEAVE") %></option>
  2865. <option value="TRIM"><%= uiStrings.getLocalizedString("STR_MAX_TRIM") %></option>
  2866. </select>
  2867. </td>
  2868. <td class="controlFieldCenter" style="width:100px;">
  2869. </td>
  2870. <td class="controlFieldLeft" style="width: 50%;">
  2871. <select name="min_<%= roleId %>" class="controlLeft">
  2872. <option value="LEAVE"><%= uiStrings.getLocalizedString("STR_MIN_LEAVE") %></option>
  2873. <option value="APPEND"><%= uiStrings.getLocalizedString("STR_MIN_APPEND") %></option>
  2874. </select>
  2875. </td>
  2876. </tr>
  2877. </table>
  2878. </td>
  2879. </tr>
  2880. <%
  2881. }
  2882. %>
  2883. <tr style="height:40px">
  2884. <td>
  2885. <table>
  2886. <%
  2887. String minUsersOutput = "&nbsp;";
  2888. String minUsersNoOutput = "";
  2889. if (minUsers != 0) {
  2890. minUsersNoOutput = String.valueOf(minUsers);
  2891. minUsersOutput = minUsersText + ": ";
  2892. }
  2893.  
  2894. String maxUsersOutput = "&nbsp;";
  2895. String maxUsersNoOutput = "";
  2896. if (maxUsers != -1) {
  2897. maxUsersNoOutput = String.valueOf(maxUsers);
  2898. maxUsersOutput = maxUsersText + ": ";
  2899. }
  2900.  
  2901. if (minUsers != 0) {
  2902. %>
  2903. <tr>
  2904. <td class="labelFieldLeft" nowrap><%= minUsersOutput %></td><td class="labelFieldRight"><%= minUsersNoOutput %></td>
  2905. </tr>
  2906. <tr>
  2907. <td class="labelFieldLeft" nowrap><%= maxUsersOutput %></td><td class="labelFieldRight"><%= maxUsersNoOutput %></td>
  2908. </tr>
  2909. <%
  2910. }
  2911. else {
  2912. %>
  2913. <tr>
  2914. <td class="labelFieldLeft" nowrap><%= maxUsersOutput %></td><td class="labelFieldRight"><%= maxUsersNoOutput %></td>
  2915. </tr>
  2916. <tr>
  2917. <td class="labelFieldLeft" nowrap><%= minUsersOutput %></td><td class="labelFieldRight"><%= minUsersNoOutput %></td>
  2918. </tr>
  2919. <%
  2920. }
  2921. %>
  2922. </table>
  2923. </td>
  2924. </tr>
  2925. </table>
  2926. </div>
  2927. <%
  2928. }
  2929. }
  2930.  
  2931. %>
  2932. </div>
  2933. </div>
  2934. <%
  2935.  
  2936. if (wizardType == null) { %>
  2937. <div id="buttonDiv" style="position:absolute; width:100%;">
  2938. <table class="controlRow" cellpadding="3">
  2939. <tr>
  2940. <%
  2941.  
  2942. String controlTitle = "";
  2943. if (fromMultipleMU) {
  2944. controlTitle = uiStrings.getLocalizedString("STR_APPLY_TO_ALL_RELATED_DOCUMENTS_MULTIPLE_MU");
  2945. } else {
  2946. controlTitle = uiStrings.getLocalizedString("STR_APPLY_TO_ALL_RELATED_DOCUMENTS");
  2947. }
  2948.  
  2949. if (relatedCollaboration) {
  2950. controlTitle = "<span class=\"span-disabled\">" + controlTitle + " (" + uiStrings.getLocalizedString("STR_COLLABORATION_IN_PROGRESS") + ")</span>";
  2951. }
  2952.  
  2953. String width = "25%";
  2954. if (!displayApplyCheckboxes) {
  2955. width = "100%";
  2956. } else if (!isVD && !(fromMultipleMU && hasVD)) {
  2957. width = "50%";
  2958. }
  2959.  
  2960. %>
  2961.  
  2962. <td style="width: 80%;">
  2963. <div class="scrollBars" style="width: 100%;">
  2964. <div>
  2965. <% if (isVD && displayVdDescendOptionsDropdown && displayApplyCheckboxes) { %>
  2966. <div class="labelFieldLeft" style="vertical-align: top; display: inline-block;">
  2967. <label>
  2968. <% if (vdCollaboration) { %>
  2969. <span class="span-disabled">&nbsp;<%= uiStrings.getLocalizedString("STR_CHOOSE_VD_DESCEND_OPTION") %> (<%= uiStrings.getLocalizedString("STR_COLLABORATION_IN_PROGRESS") %>)</span>
  2970. <select name="vdDescendOptions" class="controlFieldLeft" style="vertical-align: middle;" onChange="toggleApplyToBindingText();">
  2971. <option value="no_operation" selected="selected"><%= uiStrings.getLocalizedString(ProfileBean.allVdDescendOptions.get("no_operation")) %></option>
  2972. </select>
  2973. <% } else { %>
  2974. &nbsp;<%= uiStrings.getLocalizedString("STR_CHOOSE_VD_DESCEND_OPTION") %>
  2975. <select name="vdDescendOptions" class="controlFieldLeft" style="vertical-align: middle;" onChange="toggleApplyToBindingText();">
  2976. <% if (pb != null) {
  2977. if (pb.getAllowedVdDescendOptions() != null) {
  2978. if (pb.getAllowedVdDescendOptions().size() > 1 && pb.getDefaultVdDescendOption().equals("")) {
  2979. %>
  2980. <option value=""></option>
  2981. <%
  2982. }
  2983.  
  2984. for (int i = 0; i < pb.getAllowedVdDescendOptions().size(); i++) {
  2985. String key = pb.getAllowedVdDescendOptions().get(i);
  2986. %>
  2987. <option value="<%= key %>" <% if (key.equals(pb.getDefaultVdDescendOption())) { out.print("selected"); } %>><%= uiStrings.getLocalizedString(ProfileBean.allVdDescendOptions.get(key)) %></option>
  2988. <%
  2989. }
  2990. } else {
  2991. %>
  2992. <option value="no_operation" <% if (!pb.getApplyToAllVDDescendants()) { out.print("selected"); } %>><%= uiStrings.getLocalizedString(ProfileBean.allVdDescendOptions.get("no_operation")) %></option>
  2993. <option value="replace_all" <% if (pb.getApplyToAllVDDescendants()) { out.print("selected"); } %>><%= uiStrings.getLocalizedString(ProfileBean.allVdDescendOptions.get("replace_all")) %></option>
  2994. <%
  2995. }
  2996. } else {
  2997. %>
  2998. <option value="no_operation" selected><%= uiStrings.getLocalizedString(ProfileBean.allVdDescendOptions.get("no_operation")) %></option>
  2999. <option value="replace_all"><%= uiStrings.getLocalizedString(ProfileBean.allVdDescendOptions.get("replace_all")) %></option>
  3000. <%
  3001. }
  3002. %>
  3003. </select>
  3004. <% } %>
  3005. </label>
  3006. </div>
  3007. <% } else if (fromMultipleMU && hasVD && displayApplyCheckboxes) { %>
  3008. <div class="labelFieldLeft" style="vertical-align: top; white-space: nowrap; display: inline-block;">
  3009. <label>
  3010. <input type="checkbox" name="applyToVD" value="true" onClick="toggleApplyToBindingText();" style="vertical-align: middle;" <% if (vdCollaboration) { out.print("disabled"); } %>>
  3011. <%
  3012. if (vdCollaboration) {
  3013. out.print("<span class=\"span-disabled\">" + uiStrings.getLocalizedString("STR_APPLY_TO_ALL_VD_DESCENDANTS_MULTIPLE_MU") + " (" + uiStrings.getLocalizedString("STR_COLLABORATION_IN_PROGRESS") + ")</span>");
  3014. } else {
  3015. out.print(uiStrings.getLocalizedString("STR_APPLY_TO_ALL_VD_DESCENDANTS_MULTIPLE_MU"));
  3016. }
  3017. %>
  3018. </label>
  3019. </div>
  3020. <% } %>
  3021. <div class="labelFieldLeft" id="applyBindingTextTd" style="display: none; vertical-align: top; white-space: nowrap;">
  3022. <label>
  3023. <input type="checkbox" name="applyToAllBindingTexts" value="true" style="vertical-align: middle;" <% if (pb != null && pb.getApplyToAllBindingTexts()) out.print("checked"); %> >
  3024. <%= uiStrings.getLocalizedString("STR_APPLY_TO_ALL_BINDING_TEXTS") %>
  3025. </label>
  3026. </div>
  3027. </div>
  3028. <% if (displayApplyCheckboxes) { %>
  3029. <div class="labelFieldLeft" style="vertical-align: top; white-space: nowrap; width: <%= width %>;">
  3030. <label>
  3031. <input type="checkbox" name="replaceAbsentUsers" value="true" style="vertical-align: middle;" <% if (!hasVisibleRoles) out.print("disabled"); %> <% if (pb != null && pb.getReplaceAbsentInWizardsAndManageUsers()) out.print("checked"); %>>
  3032. <%= uiStrings.getLocalizedString("STR_REPLACE_ABSENT_USERS") %>
  3033. </label>
  3034. </div>
  3035. <% } %>
  3036. <%if (fromMultipleMU && hasVD && displayApplyCheckboxes && !vdCollaboration) { %>
  3037. <div class="labelFieldLeft" style="vertical-align: top; white-space: nowrap; width: <%= width %>;">
  3038. <label>
  3039. <input type="checkbox" name="applyToAllDocuments" value="true" style="vertical-align: middle;" <% if (pb != null && pb.getApplyToAllDocuments()) out.print("checked"); %>>
  3040. <%= uiStrings.getLocalizedString("STR_APPLY_TO_ALL_VD_DOCUMENTS_MULTIPLE_MU") %>
  3041. </label>
  3042. </div>
  3043. <%} else if (isVD && displayApplyCheckboxes && !vdCollaboration){%>
  3044. <div class="labelFieldLeft" style="vertical-align: top; white-space: nowrap; width: <%= width %>;">
  3045. <label>
  3046. <input type="checkbox" name="applyToAllDocuments" value="true" style="vertical-align: middle;" <% if (pb != null && pb.getApplyToAllDocuments()) out.print("checked"); %>>
  3047. <%= uiStrings.getLocalizedString("STR_APPLY_TO_ALL_VD_DOCUMENTS") %>
  3048. </label>
  3049. </div>
  3050. <%}%>
  3051. <% if (displayApplyCheckboxes) { %>
  3052. <div style="white-space: nowrap;">
  3053. <div class="labelFieldLeft" style="vertical-align: top; white-space: nowrap; display: inline-block;">
  3054. <label>
  3055. <input type="checkbox" name="applyToAllRelatedDocuments" value="true" style="vertical-align: middle;" <%= applyToAllRelatedDocumentsChecked %> <% if (allowApplyToAllVDDescendantsOfRelatedDocuments || (fromMultipleMU && displayApplyCheckboxesForRelatedVDs)) out.print("onclick=\"toggleApplyToVDOfRelatedDocs();toggleAppendReplace();\""); else out.print("onclick=\"toggleAppendReplace();\"");%>>
  3056. <%= controlTitle %>
  3057. </label>
  3058. </div>
  3059. <div style="padding-left: 5px; white-space: nowrap; display: inline-block;">
  3060. <div id="appendReplaceSpan" style="visibility: hidden;">
  3061. <div class="controlFieldLeft" style="display: inline-block;">
  3062. <label>
  3063. (
  3064. <input type="radio" name="applyToAllRelatedDocumentsMethod" style="vertical-align: middle; margin: 0px;" value="<%= WizardBean.APPLY_USERS_ROLES_TO_ALL_RELATED_APPEND %>" <% if (applyToAllRelatedDocumentsDefaultValue.equals(ProfileBean.APPLY_TO_ALL_RELATED_DOCUMENTS_DV_APPEND)) out.print("checked"); %>>
  3065. <%= uiStrings.getLocalizedString("STR_APPEND") %>
  3066. </label>
  3067. </div>
  3068. <div class="labelFieldRight" style="display: inline-block;">&nbsp;&nbsp;</div>
  3069. <div class="controlFieldLeft" style="display: inline-block;">
  3070. <label>
  3071. <input type="radio" name="applyToAllRelatedDocumentsMethod" style="vertical-align: middle; margin: 0px;" value="<%= WizardBean.APPLY_USERS_ROLES_TO_ALL_RELATED_REPLACE %>"<% if (applyToAllRelatedDocumentsDefaultValue.equals(ProfileBean.APPLY_TO_ALL_RELATED_DOCUMENTS_DV_REPLACE)) out.print("checked"); %>>
  3072. <%= uiStrings.getLocalizedString("STR_REPLACE") %>)
  3073. </label>
  3074. </div>
  3075. </div>
  3076. </div>
  3077. </div>
  3078. <% if (allowApplyToAllVDDescendantsOfRelatedDocuments || (fromMultipleMU && displayApplyCheckboxesForRelatedVDs)) { %>
  3079. <div id="applyToVDOfRelatedDocumentsTable" style="visibility: hidden;">
  3080. <div class="labelFieldLeft" style="vertical-align: top; white-space: nowrap; display: inline-block;">
  3081. <label>
  3082. <input type="checkbox" name="applyToVDOfRelatedDocuments" value="true" style="vertical-align: middle;" <%= applyToAllVDDescendantsOfRelatedDocumentsChecked %> onClick="toggleApplyToBindingTextOfRelatedDocuments();">
  3083. <%
  3084. if (relatedVdCollaboration) {
  3085. out.print("<span class=\"span-disabled\">" + uiStrings.getLocalizedString("STR_APPLY_TO_ALL_VD_DESCENDANTS_OF_RELATED_DOCUMENTS") + " (" + uiStrings.getLocalizedString("STR_COLLABORATION_IN_PROGRESS") + ")");
  3086. } else {
  3087. out.print(uiStrings.getLocalizedString("STR_APPLY_TO_ALL_VD_DESCENDANTS_OF_RELATED_DOCUMENTS"));
  3088. }
  3089. %>
  3090. </label>
  3091. </div>
  3092. <div class="labelFieldLeft" id="applyBindingTextOfRelatedDocumentsTd" style="visibility: hidden; vertical-align: top; white-space: nowrap; display: inline-block;">
  3093. <label>
  3094. <input type="checkbox" name="applyToAllBindingTextsOfRelatedDocuments" value="true" style="vertical-align: middle;" <% if (applyToAllBindingTextsOfRelatedDocuments) out.print("checked"); %> >
  3095. <%= uiStrings.getLocalizedString("STR_APPLY_TO_ALL_BINDING_TEXTS_OF_RELATED_DOCUMENTS") %>
  3096. </label>
  3097. </div>
  3098. </div>
  3099. <% } %>
  3100. <% } %>
  3101. </div>
  3102. </td>
  3103. <td style="width: 20%; text-align: right; vertical-align: bottom; white-space: nowrap;">
  3104. <input type="button" name="cancelButt" class="button secondary-button" value="<%=uiStrings.getLocalizedString("STR_CANCEL")%>" style="width:60px; height:24px" onclick="cancelActiveConnections(); closeDialog(); return false;">&nbsp;<input type="button" name="finishButt" <% if (!hasVisibleRoles) out.print("disabled"); %> class="button primary-button" value="<%=uiStrings.getLocalizedString("STR_OK")%>" style="width:60px; height:24px" onclick="checkIfHaveChanges();checkIfChangeDescendants(); return false;">
  3105. </td>
  3106. </tr>
  3107. </table>
  3108. </div>
  3109. <% } else { %>
  3110. <div id="buttonDiv" style="position:absolute; width:100%;">
  3111. <table class="controlRow" cellpadding="3">
  3112. <tr>
  3113. <td style="width: 65%;">
  3114. <div class="scrollBars" style="width: 100%;">
  3115. <div>
  3116. <%
  3117. if (isVD && displayVdDescendOptionsDropdown && (copyBinders.equals("true") || prepareForClone.equalsIgnoreCase("true"))) {
  3118. %>
  3119. <div class="hLabelFieldLeft" style="vertical-align: middle; display: inline-block;">
  3120. <label>
  3121. &nbsp;<%= uiStrings.getLocalizedString("STR_CHOOSE_VD_DESCEND_OPTION") %>
  3122. <select name="vdDescendOptions" class="controlFieldLeft" style="vertical-align: middle;" onChange="toggleApplyToBindingText();">
  3123. <% if (pb != null) {
  3124. if (pb.getAllowedVdDescendOptions() != null) {
  3125. if (pb.getAllowedVdDescendOptions().size() > 1 && pb.getDefaultVdDescendOption().equals("")) {
  3126. %>
  3127. <option value=""></option>
  3128. <%
  3129. }
  3130.  
  3131. for (int i = 0; i < pb.getAllowedVdDescendOptions().size(); i++) {
  3132. String key = pb.getAllowedVdDescendOptions().get(i);
  3133. %>
  3134. <option value="<%= key %>" <% if (key.equals(pb.getDefaultVdDescendOption())) { out.print("selected"); } %>><%= uiStrings.getLocalizedString(ProfileBean.allVdDescendOptions.get(key)) %></option>
  3135. <%
  3136. }
  3137. } else {
  3138. %>
  3139. <option value="no_operation" <% if (!pb.getApplyToAllVDDescendants()) { out.print("selected"); } %>><%= uiStrings.getLocalizedString(ProfileBean.allVdDescendOptions.get("no_operation")) %></option>
  3140. <option value="replace_all" <% if (pb.getApplyToAllVDDescendants()) { out.print("selected"); } %>><%= uiStrings.getLocalizedString(ProfileBean.allVdDescendOptions.get("replace_all")) %></option>
  3141. <%
  3142. }
  3143. } else {
  3144. %>
  3145. <option value="no_operation" selected><%= uiStrings.getLocalizedString(ProfileBean.allVdDescendOptions.get("no_operation")) %></option>
  3146. <option value="replace_all"><%= uiStrings.getLocalizedString(ProfileBean.allVdDescendOptions.get("replace_all")) %></option>
  3147. <%
  3148. }
  3149. %>
  3150. </select>
  3151. </label>
  3152. </div>
  3153. <div id="applyBindingTextTd" style="display: none;">
  3154. <div class="hLabelFieldLeft" style="width: 30px; white-space: nowrap; vertical-align: middle;">
  3155. <label>
  3156. <input type="checkbox" name="applyToAllBindingTexts" style="height: 18px; vertical-align: middle;" value="true" <% if (Profiles.getInstance(language).getProfileById(profileId).getApplyToAllBindingTexts()) out.print("checked"); %>>
  3157. <%= uiStrings.getLocalizedString("STR_APPLY_TO_ALL_BINDING_TEXTS") %>
  3158. </label>
  3159. </div>
  3160. </div>
  3161. <%
  3162. }
  3163. %>
  3164. <div class="hLabelFieldLeft" style="width: 30px; white-space: nowrap; vertical-align: middle;">
  3165. <label>
  3166. <input type="checkbox" name="replaceAbsentUsers" value="true" style="height: 18px; vertical-align: middle;" <% if (Profiles.getInstance(language).getProfileById(profileId).getReplaceAbsentInWizardsAndManageUsers()) out.print("checked"); %>>
  3167. <%= uiStrings.getLocalizedString("STR_REPLACE_ABSENT_USERS") %>
  3168. </label>
  3169. </div>
  3170. </div>
  3171. </div>
  3172. </td>
  3173. <td nowrap style="vertical-align: top; text-align: right; width: 35%;">
  3174.  
  3175. <script>
  3176. function wizardFinish(flag) {
  3177. disableSubmitButton();
  3178. if (checkNumberOfUsers('<%= personIdsJson %>') && checkVdDescendOption()) {
  3179. checkIfHaveChanges();
  3180. setSelectedTab(1);
  3181. previousNesxtStep('<%= contextPath + jspPath %>wizard/validateUsers.jsp?manageRelatedDocuments=' + flag);
  3182. } else {
  3183. enableSubmitButton();
  3184. }
  3185. }
  3186. </script>
  3187.  
  3188. <%
  3189. if (wb.hasRelations(chosenWizType)) {
  3190. %>
  3191. <input type="button" name="backButt" class="button" value="<%= uiStrings.getLocalizedString("STR_BACK_BUTTON") %>" style="min-width: 60px; height: 24px;" onclick="setSelectedTab(1); previousNesxtStep('<%= contextPath + jspPath %>actions/properties/objectPropertiesNew.jsp');">&nbsp;<input type="button" name="finishButt" class="button" value="<%= uiStrings.getLocalizedString("STR_FORWARD_BUTTON") %>" style="min-width: 60px; height: 24px;" onclick="wizardFinish(true)">&nbsp;<input type="button" name="cancelButt" class="button secondary-button" value="<%= uiStrings.getLocalizedString("STR_CANCEL") %>" style="min-width: 60px; height: 24px;" onclick="<%= cancelBtnAction %>"><% if (wizardQuickFinishEnabledBoolean) { %>&nbsp;<input type="button" name="quickFinishButt" class="button primary-button" value="<%= uiStrings.getLocalizedString("STR_FINISH") %>" style="min-width:60px; height: 24px;" onclick="startWizardQuickFinish();"/><% } %>
  3192. <%
  3193. } else {
  3194. %>
  3195. <input type="button" name="backButt" class="button" value="<%= uiStrings.getLocalizedString("STR_BACK_BUTTON") %>" style="min-width: 60px; height: 24px;" onclick="setSelectedTab(1); previousNesxtStep('<%= contextPath + jspPath %>actions/properties/objectPropertiesNew.jsp?rootObjectId=<%= rootObjectId %>');">&nbsp;<input type="button" name="cancelButt" class="button secondary-button" value="<%= uiStrings.getLocalizedString("STR_CANCEL") %>" style="min-width: 60px; height: 24px;" onclick="<%= cancelBtnAction %>">&nbsp;<input type="button" name="finishButt" class="button primary-button" value="<%= uiStrings.getLocalizedString("STR_FINISH") %>" style="min-width: 60px; height: 24px;" onclick="wizardFinish(false)">
  3196. <%
  3197. }
  3198. %>
  3199. </td>
  3200. </tr>
  3201. </table>
  3202. </div>
  3203. <% } %>
  3204. </div>
  3205. </form>
  3206. <form id="usersForm" name="usersForm" method="post" action="<%= contextPath + jspPath %>wizard/users.jsp" target="backgroundActivitiesFrame">
  3207. <input type="hidden" name="isAutomationWizard" value="<%= isAutomationWizard %>">
  3208. <input type="hidden" name="isB2BMessageWizard" value="<%= isB2BMessageWizard %>">
  3209. <input type="hidden" name="automationPerformer" value="<%= automationPerformer %>">
  3210. <input type="hidden" name="automationLogLevel" value="<%= automationLogLevel %>">
  3211. <input type="hidden" name="automationRule" value="<%= automationRule %>">
  3212. <input type="hidden" name="automationBlockingRule" value="<%= automationBlockingRule %>">
  3213. <input type="hidden" name="automationObjectIds" value="<%= automationObjectIds %>">
  3214. <input type="hidden" name="automationDescription" value="<%= automationDescription %>">
  3215. <input type="hidden" name="automationWorkspaceViewRefresh" value="<%= automationWorkspaceViewRefresh %>">
  3216. <input type="hidden" name="B2BEntityIds" value="<%= B2BEntityIds %>">
  3217. <input type="hidden" name="B2BExplicitEntityIds" value="<%= B2BExplicitEntityIds %>">
  3218. <input type="hidden" name="B2BconfigId" value="<%= B2BconfigId %>">
  3219. <input type="hidden" name="B2BSendDirectly" value="<%= B2BSendDirectly %>">
  3220. <input type="hidden" name="isPagingActive" value="true">
  3221. <input type="hidden" name="start" value="0">
  3222. <input type="hidden" name="count" value="50">
  3223. <input type="hidden" name="currentUserId" value="<%= currUserId%>">
  3224. <input type="hidden" name="groupId" value="<%= currentUserGroupId%>">
  3225. <input type="hidden" name="formName" value="wizard3Form">
  3226. <input type="hidden" name="elemName" value="">
  3227. <input type="hidden" name="hidePrivateGroups" value="true">
  3228. <input type="hidden" name="filterBy" value="">
  3229. <input type="hidden" name="showReplacementForAbsent" value="true">
  3230. <input type="hidden" name="hideInactiveUsers" value="true">
  3231. <input type="hidden" name="profileId" value="<%= profileId %>">
  3232. <input type="hidden" name="roleId" value="">
  3233. <input type="hidden" name="objectId" value="<%= objectId %>">
  3234. <% if (wizardType != null) {
  3235. Enumeration<Object> enumer = paramsAndValues.keys();
  3236. while (enumer.hasMoreElements()) {
  3237. String paramName = (String)enumer.nextElement();
  3238. String paramValue = (String)paramsAndValues.get(paramName);
  3239. %>
  3240. <input type="hidden" name="attr_<%= paramName %>" value="<%= paramValue %>">
  3241. <%
  3242. }
  3243. }
  3244. %>
  3245. </form>
  3246. <form name="msgboxForm" method="post" action="<%= contextPath + jspPath %>msgbox/start.jsp">
  3247. <input type="hidden" name="msgboxTitle" value="">
  3248. <input type="hidden" name="msgboxText" value="">
  3249. <input type="hidden" name="msgboxWidth" value="400">
  3250. <input type="hidden" name="msgboxHeight" value="200">
  3251. <input type="hidden" name="msgboxIcon" value="other/exclamation_32.gif">
  3252. <input type="hidden" name="msgboxButtons" value="<%= new Integer(MSGBOX_OK) %>">
  3253. </form>
  3254. <%
  3255. // pmi
  3256. int counter = 0;
  3257. if (listRoles.size() > 0) {
  3258. String listOfRoles = "";
  3259. for(counter=0; counter<listRoles.size(); counter++) {
  3260. listOfRoles = listOfRoles + "~" + listRoles.get(counter);
  3261. }
  3262. %>
  3263. <script>
  3264. function checkIfHaveChanges() {
  3265. var allRoles = "<%= listRoles%>",
  3266. newValues = "",
  3267. absentUsers = <%= gson.toJson(absentPersons) %>,
  3268. hasAbsentInput = document.forms['wizard3Form'].elements['hasAbsentUser'],
  3269. roleValue, hasAbsent;
  3270.  
  3271. allRoles = allRoles.slice(1, allRoles.length -1);
  3272. var listRoles = allRoles.split(", ");
  3273. for (var i = 0; i < listRoles.length; i++) {
  3274. var role = "persons_" + listRoles[i];
  3275. var tempUser = "";
  3276. for (var j = 0; j < document.forms['wizard3Form'].elements[role].options.length; j++) {
  3277. roleValue = document.forms['wizard3Form'].elements[role].options[j].value;
  3278. tempUser = tempUser + ", " + roleValue;
  3279.  
  3280. if (absentUsers.indexOf(roleValue) > -1 && !hasAbsent) {
  3281. hasAbsent = true;
  3282. hasAbsentInput.value = 'true';
  3283. }
  3284. }
  3285. tempUser = tempUser.slice(2, tempUser.length);
  3286. newValues = newValues + "~~" + listRoles[i] + "~" + tempUser;
  3287. }
  3288. newValues = newValues.slice(2, newValues.length);
  3289. document.forms['wizard3Form'].elements['newValues'].value = newValues;
  3290. }
  3291. </script>
  3292. <%
  3293. }
  3294. %>
  3295. <script>
  3296. var listOfRoles = "[<%= rolesIds.toString() %>]",
  3297. currentUserGroupId = "<%= currentUserGroupId %>",
  3298. objectId = "<%= objectId %>",
  3299. profileId = "<%= profileId %>",
  3300. language = "<%= language %>",
  3301. currUserId = "<%= currUserId %>",
  3302. paramsAndValues = '<%= StringEscapeUtils.escapeJavaScript(gson.toJson(paramsAndValues)) %>';
  3303.  
  3304. function copyOldValues() {
  3305. <%
  3306. if (listRoles.size() > 0) {
  3307. %>
  3308. var allRoles = "<%= listRoles %>";
  3309. var oldValues = "";
  3310. allRoles = allRoles.slice(1, allRoles.length -1);
  3311. var listRoles = allRoles.split(", ");
  3312. for (var i = 0; i < listRoles.length; i++) {
  3313. var role = "persons_" + listRoles[i];
  3314. var tempUser = "";
  3315. for (var j = 0; j < document.forms['wizard3Form'].elements[role].options.length; j++) {
  3316. tempUser = tempUser + ", " + document.forms['wizard3Form'].elements[role].options[j].value;
  3317. }
  3318. tempUser = tempUser.slice(2, tempUser.length);
  3319. oldValues = oldValues + "~~" + listRoles[i] + "~" + tempUser;
  3320. }
  3321. oldValues = oldValues.slice(2, oldValues.length);
  3322. document.forms['wizard3Form'].elements['oldValues'].value = oldValues;
  3323. <%
  3324. }
  3325. %>
  3326. }
  3327.  
  3328. dojo.require("dijit.form.ComboBox");
  3329. dojo.require("dojo.data.ItemFileWriteStore");
  3330. dojo.registerModulePath("scripts", "../..");
  3331. dojo.require("scripts.ManageUsersDataStore");
  3332.  
  3333. // retrieves data for unselected list (left side) of multiselect from server
  3334. function getUnselectedData(selectName, elemName, flagId, filter) {
  3335. var usersForm = document.forms['usersForm'];
  3336.  
  3337. if (flagId != null) {
  3338. usersForm.filterBy.value = document.forms[0].elements['filterByStr' + flagId].value;
  3339. } else {
  3340. usersForm.filterBy.value = document.forms[0].elements['filterByStr'].value;
  3341. }
  3342.  
  3343. usersForm.elemName.value = elemName;
  3344.  
  3345. if (usersForm.elements['roleId']) {
  3346. usersForm.elements['roleId'].value = flagId;
  3347. }
  3348.  
  3349. if (filter) {
  3350. usersForm.start.value = '0';
  3351. localState[flagId].page = 1;
  3352. } else {
  3353. if (localState[flagId].page < 3) {
  3354. usersForm.start.value = ((localState[flagId].page - 1) * localState[flagId].pageSize) + '';
  3355. } else {
  3356. usersForm.start.value = ((localState[flagId].page - 1) * localState[flagId].pageSize) - (localState[flagId].page - 2) + '';
  3357. }
  3358. }
  3359.  
  3360. if (dijit.byId('orgUnits_' + flagId).item === null && dijit.byId('orgUnits_' + flagId)._selectedItem) {
  3361. document.forms['usersForm'].groupId.value = dijit.byId('orgUnits_' + flagId)._selectedItem.value;
  3362. } else if (dijit.byId('orgUnits_' + flagId).item) {
  3363. document.forms['usersForm'].groupId.value = dijit.byId('orgUnits_' + flagId).item.i.value;
  3364. }
  3365.  
  3366. var loadingNode = dojo.byId('loading_' + flagId);
  3367.  
  3368. var xhrArgs = {
  3369. form: dojo.byId("usersForm"),
  3370. handleAs: "text",
  3371. load: function(data) {
  3372. var d = dojo.fromJson(data);
  3373.  
  3374. localState[flagId].activeConnection = null;
  3375.  
  3376. localState[flagId].isCurrentUserAllowed = d.isCurrentUserAllowed;
  3377.  
  3378. if (!isCurrentUserChecked) {
  3379. dojo.byId('tab' + flagId).onfocus();
  3380. isCurrentUserChecked = true;
  3381. }
  3382.  
  3383. buildOptions(flagId, elemName, d.items);
  3384.  
  3385. disableUserButt('wizard3Form', 'persons_' + flagId, 'addCurrUser_' + flagId, 'remCurrUser_' + flagId, null, currUserId, checkIfCurrentUserIsAllowed(flagId));
  3386.  
  3387. dojo.fadeOut({
  3388. node: loadingNode,
  3389. onEnd: function() {
  3390. dojo.style(loadingNode, "display", "none");
  3391. },
  3392. duration: 500
  3393. }).play();
  3394. },
  3395. error: function(error) {
  3396.  
  3397. }
  3398. };
  3399.  
  3400. dojo.style(loadingNode, "display", "block");
  3401.  
  3402. dojo.fadeIn({
  3403. node: loadingNode,
  3404. duration: 10
  3405. }).play();
  3406.  
  3407. // if we have a connection active, it should be closed before creating a new one
  3408. if (localState[flagId].activeConnection !== null) {
  3409. localState[flagId].activeConnection.cancel();
  3410. }
  3411.  
  3412. var deferred = dojo.xhrPost(xhrArgs);
  3413. localState[flagId].activeConnection = deferred;
  3414. };
  3415.  
  3416. // creates option elements for unselected list (called after successfull data retrieval from server)
  3417. function buildOptions(roleId, elemName, inputArr) {
  3418. var html = '',
  3419. page = localState[roleId].page,
  3420. pageSize = localState[roleId].pageSize,
  3421. form = document.forms['wizard3Form'],
  3422. selectNode = form.elements[elemName];
  3423.  
  3424. selectNode.innerHTML = "";
  3425.  
  3426. setTimeout(function() {
  3427. var counter = 0;
  3428.  
  3429. if (page > 1) {
  3430. // PREVIOUS PAGE OPTION
  3431. selectNode.options[counter] = new Option();
  3432. selectNode.options[counter].value = "--";
  3433. selectNode.options[counter].text = '<%= STR_PREVIOUS_PAGE %>';
  3434.  
  3435. counter++;
  3436. }
  3437.  
  3438. for (var i = 0; i < inputArr.length; i = i + 3) {
  3439. if (pageSize > counter) {
  3440.  
  3441. var id = inputArr[i];
  3442. var name = inputArr[i+1];
  3443. var count = inputArr[i+2];
  3444.  
  3445. selectNode.options[counter] = new Option();
  3446. selectNode.options[counter].value = id;
  3447. selectNode.options[counter].text = name;
  3448. selectNode.options[counter].setAttribute('count', count);
  3449. selectNode.options[counter].setAttribute('dir', 'auto');
  3450.  
  3451. counter++;
  3452. } else {
  3453. // NEXT PAGE OPTION
  3454. selectNode.options[counter] = new Option();
  3455. selectNode.options[counter].value = "++";
  3456. selectNode.options[counter].text = '<%= STR_NEXT_PAGE %>';
  3457.  
  3458. break;
  3459. }
  3460. }
  3461. }, 50);
  3462. }
  3463.  
  3464. dojo.addOnLoad(function() {
  3465. var roles = dojo.fromJson(listOfRoles),
  3466. personsValuesNode, personsNode;
  3467.  
  3468. if (roles.length) {
  3469. dojo.byId('tab' + roles[0]).onfocus();
  3470.  
  3471. for (var i = 0; i < roles.length; i++) {
  3472. personsValuesNode = document.getElementsByName('personsValues_' + roles[i])[0];
  3473. personsValuesNode.style.height = personsValuesNode.offsetHeight + 'px';
  3474.  
  3475. personsNode = document.getElementsByName('persons_' + roles[i])[0];
  3476. personsNode.style.height = personsNode.offsetHeight + 'px';
  3477. }
  3478. }
  3479.  
  3480. // create store and combobox for each role
  3481. dojo.forEach(roles, function(role) {
  3482. var jsonStore = new custom.ManageUsersDataStore({
  3483. url: contextPath + "/jsp/explorer/actions/manageusers",
  3484. profileId: profileId,
  3485. objectId: objectId,
  3486. currentUserGroupId: currentUserGroupId,
  3487. roleId: role,
  3488. language: language,
  3489. paramsAndValues: paramsAndValues
  3490. });
  3491.  
  3492. var cb = new dijit.form.ComboBox({
  3493. style: "width: 100%;",
  3494. store: jsonStore,
  3495. pageSize: 20,
  3496. activePage: 1,
  3497. autoComplete: false,
  3498. searchDelay: 500,
  3499. isDefaultInitialized: false,
  3500. isLocalizationInitialized: false,
  3501. onChange: function(newValue) {
  3502. localState[role].page = 1;
  3503. var val = newValue,
  3504. id = "",
  3505. matcher = new RegExp("^" + val + "$");
  3506.  
  3507. dojo.forEach(this.store._items, function(item) {
  3508. if (item.i.name === val) {
  3509. id = item.i.value;
  3510. }
  3511. });
  3512.  
  3513. if (this._selectedItem.name === val) {
  3514. id = this._selectedItem.value;
  3515. }
  3516.  
  3517. if (id === '') {
  3518. this._selectedItem.value = '';
  3519. }
  3520. document.forms['usersForm'].groupId.value = id;
  3521.  
  3522. getUnselectedData('orgUnits_' + role, 'personsValues_' + role, role);
  3523. },
  3524.  
  3525. isLoaded: function() {
  3526. return true;
  3527. },
  3528.  
  3529. _openResultList: function() {
  3530. if (!this.isLocalizationInitialized) {
  3531. // handle previous and next button localization
  3532. this.dropDown.previousButton.innerHTML = '<%= STR_PREVIOUS_PAGE %>';
  3533. this.dropDown.nextButton.innerHTML = '<%= STR_NEXT_PAGE %>';
  3534.  
  3535. this.isLocalizationInitialized = true;
  3536. }
  3537.  
  3538. this.inherited("_openResultList", arguments);
  3539. },
  3540.  
  3541. _showResultList: function() {
  3542. var self = this;
  3543.  
  3544. if (this.isInitialized) { // check to see if we can open dropdown or not
  3545. this.inherited("_showResultList", arguments);
  3546. } else {
  3547. this._resolveData();
  3548. }
  3549. },
  3550.  
  3551. postCreate: function() {
  3552. var self = this;
  3553.  
  3554. this.isInitialized = false;
  3555.  
  3556. dojo.connect(this.store, "_filterResponse", function(data) {
  3557. if (!self.isDefaultInitialized) {
  3558. if (data.selectedItem) {
  3559. self._selectedItem = data.selectedItem;
  3560. self.set('displayedValue', data.selectedItem.name);
  3561. } else {
  3562. if (data.items.length) {
  3563. var firstItem = data.items[0];
  3564. self._selectedItem = firstItem;
  3565. self.set('displayedValue', firstItem.name);
  3566. }
  3567. }
  3568.  
  3569. self.isDefaultInitialized = true;
  3570. }
  3571. });
  3572.  
  3573. this.loadingNode = dojo.place("<div style='position: absolute; top: 0px; bottom: 0px; left: 0px; width: 100%; background-color: #fff; text-align: center;'><%= STR_LOADING %></div>", this.domNode, "last");
  3574.  
  3575. this.inherited("postCreate", arguments);
  3576. },
  3577. _resolveData: function() {
  3578. var self = this;
  3579.  
  3580. // hide loading indicator
  3581. dojo.fadeOut({
  3582. node: self.loadingNode,
  3583. onEnd: function() {
  3584. dojo.style(self.loadingNode, "display", "none");
  3585. },
  3586. duration: 500
  3587. }).play();
  3588.  
  3589. self.isInitialized = true;
  3590. }
  3591. }, 'orgUnits_' + role);
  3592.  
  3593. // trigger combobox data load
  3594. cb.loadDropDown();
  3595. cb.focusNode.setAttribute('dir', 'auto')
  3596.  
  3597. });
  3598.  
  3599. });
  3600.  
  3601. function getItemOnLoad(element) {
  3602. var id = "";
  3603.  
  3604. dojo.forEach(element.store._items, function(item) {
  3605. if (item.i.name === element.displayedValue) {
  3606. id = item.i.value;
  3607. }
  3608. });
  3609.  
  3610. return id;
  3611. }
  3612.  
  3613. function onOptionAdd(formName, srcName, destName, addNameButt, srcPropName, isSingleClick) {
  3614. var srcFormRef = document.forms[formName].elements[srcName],
  3615. roleId = srcName.split('_')[1];
  3616. for (i = srcFormRef.length - 1; i >= 0; i--) {
  3617. if (srcFormRef.options[i].selected && srcFormRef.options[i].value === '++') {
  3618. localState[roleId].page = localState[roleId].page + 1;
  3619. getUnselectedData('', srcName, roleId);
  3620. break;
  3621. } else if (srcFormRef.options[i].selected && srcFormRef.options[i].value === '--') {
  3622. localState[roleId].page = localState[roleId].page - 1;
  3623. getUnselectedData('', srcName, roleId);
  3624. break;
  3625. }
  3626. }
  3627. if (isSingleClick === undefined) {
  3628. addOption(formName, srcName, destName, addNameButt, srcPropName);
  3629. }
  3630. }
  3631.  
  3632. // check if current user is allowed in passed role
  3633. // returning specific format required by 'disableUserButt' function defined in dialog.js
  3634. function checkIfCurrentUserIsAllowed(roleId) {
  3635. if (localState && localState[roleId]) {
  3636. var isAllowed = localState[roleId].isCurrentUserAllowed,
  3637. currentUserId = '<%= currUserId %>';
  3638.  
  3639. if (isAllowed) {
  3640. return '[' + currentUserId + ']';
  3641. } else {
  3642. return '[]';
  3643. }
  3644. } else {
  3645. return '[]';
  3646. }
  3647. }
  3648.  
  3649. function cancelActiveConnections() {
  3650. for (var key in localState) {
  3651. if (localState.hasOwnProperty(key)) {
  3652. if (localState[key].activeConnection !== null) {
  3653. localState[key].activeConnection.cancel();
  3654. }
  3655. }
  3656. }
  3657. }
  3658.  
  3659. <% if (wizardType == null) { %>
  3660. document.addEventListener("DOMContentLoaded", function() {
  3661. initDoc3(<%= rolesIds.toString() %>);
  3662.  
  3663. if (window.name === 'backgroundActivitiesFrame') {
  3664. var backDiv = top.document.getElementById('backgroundActivitiesDiv'),
  3665. backFrame;
  3666.  
  3667. if (backDiv) {
  3668. backDiv.style.visibility = 'visible';
  3669. backDiv.style.display = 'block';
  3670. backDiv.style.zIndex = 99999999999999;
  3671.  
  3672. backFrame = backDiv.firstElementChild;
  3673. }
  3674.  
  3675. if (backFrame) {
  3676. backFrame.style.visibility = 'visible';
  3677. }
  3678. }
  3679.  
  3680. initTabsEx('rolesDialog', 'mpcWizard', 980, null, 80, onDialogInit, false, 29);
  3681.  
  3682. document.getElementById('mpcWizard').initializeTabs();
  3683.  
  3684. initCheckboxes();
  3685. copyOldValues();
  3686. disableDropDown();
  3687.  
  3688. top.operationProgressEnd();
  3689. }, false);
  3690. <% } else { %>
  3691. var validationFailedMsg = "<%= StringEscapeUtils.escapeJavaScript(validationFailedMsg) %>";
  3692. var numberOfUsersMsg = "<%= StringEscapeUtils.escapeJavaScript(uiStrings.getLocalizedString("STR_NUMBER_OF_USERS_MSG")) %>: ";
  3693.  
  3694. function toggleApplyToBindingText() {
  3695. var t = 1;
  3696. }
  3697.  
  3698. function initApplyToVD() {
  3699. if (document.forms[0].elements['vdDescendOptions']) {
  3700. document.all['applyBindingTextTd'].style.visibility = 'visible';
  3701. document.all['applyBindingTextTd'].style.display = 'table-row';
  3702. }
  3703. }
  3704.  
  3705. function closePreview() {
  3706. var tmpPreviewWindow = getPreviewWindow();
  3707. if (tmpPreviewWindow != null) {
  3708. tmpPreviewWindow.close();
  3709. try {
  3710. for(var i = 0; i < top.previewWindows.length; i++) {
  3711. if (top.previewWindows[i] == tmpPreviewWindow) {
  3712. top.previewWindows.splice(i, 1);
  3713. }
  3714. }
  3715. } catch (e) {}
  3716.  
  3717. var scrW = window.screen.availWidth;
  3718. var scrH = window.screen.availHeight;
  3719. top.resizeTo(scrW, scrH);
  3720. top.moveTo(0, 0);
  3721. }
  3722. }
  3723.  
  3724. function getPreviewWindow() {
  3725. try {
  3726. for (var i = 0; top.previewWindows != undefined && i < top.previewWindows.length; i++) {
  3727. if (top.previewWindows[i].name == "previewWindowName") {
  3728. return top.previewWindows[i];
  3729. }
  3730. }
  3731. } catch (e) {
  3732. return null;
  3733. }
  3734.  
  3735. return null;
  3736. }
  3737.  
  3738. function disableSubmitButton() {
  3739. var buttonOk = document.forms['wizard3Form'].elements['finishButt'];
  3740. buttonOk.disabled = true;
  3741. return true;
  3742. }
  3743.  
  3744. function enableSubmitButton() {
  3745. var buttonOk = document.forms['wizard3Form'].elements['finishButt'];
  3746. buttonOk.disabled = false;
  3747. return true;
  3748. }
  3749.  
  3750. function startWizardQuickFinish() {
  3751. top.startWizardQuickFinish();
  3752. tryAutoSubmit();
  3753. }
  3754.  
  3755. function tryAutoSubmit() {
  3756. if (top && (top.isQuickFinishActive)) {
  3757. document.getElementsByName('finishButt')[0].onclick();
  3758. }
  3759. }
  3760.  
  3761. document.addEventListener("DOMContentLoaded", function() {
  3762. var isBulkImport = <%= isBulkImport %>,
  3763. fileName = '<%= StringEscapeUtils.escapeJavaScript(fileName) %>';
  3764.  
  3765. initDoc3(<%= rolesIds.toString() %>);
  3766. <%= dialogInitStr %>initApplyToVD();
  3767.  
  3768. initTabsEx('rolesDialog', 'mpcWizard', 980, null, 80, onDialogInit, false, 29);
  3769. document.getElementById('mpcWizard').initializeTabs();
  3770.  
  3771. copyOldValues();
  3772. disableDropDown();
  3773.  
  3774. top.operationProgressEnd();
  3775.  
  3776. if (isBulkImport && fileName) {
  3777. document.getElementById('titleBar').innerHTML += ' - ' + fileName;
  3778. }
  3779.  
  3780. <% if (validationFailed) {
  3781. out.print("top.stopWizardQuickFinish(); alert(validationFailedMsg);");
  3782. } else { %> tryAutoSubmit(); <% } %>
  3783.  
  3784. }, false);
  3785. <% } %>
  3786.  
  3787. </script>
  3788. </body>
  3789. </html>
  3790. <%
  3791. Logger.getLogger().trace("END");
  3792. %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement