private ModelMap browse(String dir) { ModelMap model = new ModelMap(); String decodedDir = pathEncodingUtils.decodeDir(dir); JsTreeFile resource = this.serverAccess.get(decodedDir, userParameters, false, false); pathEncodingUtils.encodeDir(resource); model = new ModelMap("resource", resource); List<JsTreeFile> files = this.serverAccess.getChildren(decodedDir, userParameters); Collections.sort(files); pathEncodingUtils.encodeDir(files); model.put("files", files); model.put("currentDir", dir); ListOrderedMap parentsEncPathes = pathEncodingUtils.getParentsEncPathes(resource); model.put("parentsEncPathes", parentsEncPathes); return model; }
@RequestMapping( value = {"VIEW"}, params = {"action=browseWai"}) public ModelAndView browseWai( RenderRequest request, RenderResponse response, @RequestParam(required = false) String dir, @RequestParam(required = false) String msg) { this.init(request); String decodedDir = pathEncodingUtils.decodeDir(dir); if (!serverAccess.isInitialized(userParameters)) { serverAccess.initializeServices(userParameters); } ModelMap model; if (!(dir == null || dir.length() == 0 || decodedDir.equals(JsTreeFile.ROOT_DRIVE))) { if (this.serverAccess.formAuthenticationRequired(decodedDir, userParameters)) { ListOrderedMap parentPathes = pathEncodingUtils.getParentsEncPathes(decodedDir, null, null); // we want to get the (last-1) key of sortedmap "parentPathes" String parentDir = (String) parentPathes.get(parentPathes.size() - 2); model = new ModelMap("currentDir", dir); model.put("parentDir", parentDir); model.put( "username", this.serverAccess.getUserPassword(decodedDir, userParameters).getUsername()); model.put( "password", this.serverAccess.getUserPassword(decodedDir, userParameters).getPassword()); if (msg != null) model.put("msg", msg); return new ModelAndView("authenticationForm-portlet-wai", model); } } model = browse(dir); FormCommand command = new FormCommand(); model.put("command", command); if (msg != null) model.put("msg", msg); return new ModelAndView("view-portlet-wai", model); }
@RequestMapping( value = {"VIEW"}, params = {"action=browseMobile"}) public ModelAndView browseMobile( RenderRequest request, RenderResponse response, @RequestParam String dir) { this.init(request); final PortletPreferences prefs = request.getPreferences(); boolean forceMaximized4Mobile = "true".equals(prefs.getValue(PREF_FORCE_MAXIMIZED_4_MOBILE, "true")); String forceWindowState4Mobile = forceMaximized4Mobile ? WindowState.MAXIMIZED.toString() : request.getWindowState().toString(); String decodedDir = pathEncodingUtils.decodeDir(dir); ModelMap model; if (!(dir == null || dir.length() == 0 || decodedDir.equals(JsTreeFile.ROOT_DRIVE))) { if (this.serverAccess.formAuthenticationRequired(decodedDir, userParameters)) { ListOrderedMap parentPathes = pathEncodingUtils.getParentsEncPathes(decodedDir, null, null); // we want to get the (last-1) key of sortedmap "parentPathes" String parentDir = (String) parentPathes.get(parentPathes.size() - 2); model = new ModelMap("currentDir", dir); model.put("parentDir", parentDir); model.put( "username", this.serverAccess.getUserPassword(decodedDir, userParameters).getUsername()); model.put( "password", this.serverAccess.getUserPassword(decodedDir, userParameters).getPassword()); model.put("forceWindowState4Mobile", forceWindowState4Mobile); return new ModelAndView("authenticationForm-portlet-mobile", model); } } model = browse(dir); model.put("forceWindowState4Mobile", forceWindowState4Mobile); return new ModelAndView("view-portlet-mobile", model); }