r271 - in trunk: faxtomail-persistence/src/main/xmi faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin faxtomail-ui-web/src/main/webapp/js
Author: kmorin Date: 2014-06-26 20:53:55 +0200 (Thu, 26 Jun 2014) New Revision: 271 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/271 Log: swing : affichage des dossiers parents non lisibles admin : configuration des dossiers d'archives Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo =================================================================== (Binary files differ) Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-06-26 15:01:57 UTC (rev 270) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-06-26 18:53:55 UTC (rev 271) @@ -255,17 +255,19 @@ @Override public void valueChanged(TreeSelectionEvent e) { FolderTreeNode folderNode = (FolderTreeNode) e.getPath().getLastPathComponent(); - MailFolder folder = folderNode.getMailFolder(); + if (folderNode.isCanSelect()) { + MailFolder folder = folderNode.getMailFolder(); - getModel().setSelectedFolder(folder); - getContext().setCurrentMailFolder(folder); + getModel().setSelectedFolder(folder); + getContext().setCurrentMailFolder(folder); - DemandeUIModel currentEmail = getContext().getCurrentEmail(); - if (currentEmail != null) { - AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel(); - int row = dataTableModel.getRowIndex(currentEmail); - if (row > 0) { - dataTable.setRowSelectionInterval(row, row); + DemandeUIModel currentEmail = getContext().getCurrentEmail(); + if (currentEmail != null) { + AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel(); + int row = dataTableModel.getRowIndex(currentEmail); + if (row > 0) { + dataTable.setRowSelectionInterval(row, row); + } } } } Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java 2014-06-26 15:01:57 UTC (rev 270) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java 2014-06-26 18:53:55 UTC (rev 271) @@ -96,22 +96,6 @@ } } - DefaultTreeCellRenderer cellRenderer = new DefaultTreeCellRenderer() { - @Override - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, - boolean expanded, boolean leaf, int row, boolean hasFocus) { - Component component = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); - - FolderTreeNode node = (FolderTreeNode) value; - setEnabled(node.isCanSelect()); - - return component; - } - }; - Icon folderIcon = cellRenderer.getDefaultClosedIcon(); - cellRenderer.setLeafIcon(folderIcon); - navigationTree.setCellRenderer(cellRenderer); - navigationTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-26 15:01:57 UTC (rev 270) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-26 18:53:55 UTC (rev 271) @@ -24,7 +24,7 @@ import static org.nuiton.i18n.I18n.t; -import java.awt.Desktop; +import java.awt.*; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -110,13 +110,41 @@ Map<MailFolder, DefaultMutableTreeNode> nodesByFolder = new HashMap<MailFolder, DefaultMutableTreeNode>(); for (MailFolder folder : folders) { nodesByFolder.putAll(FaxToMailUIUtil.createFolderTree(root, folder)); + + DefaultMutableTreeNode node = nodesByFolder.get(folder); + MailFolder parent = folder.getParent(); + + while (parent != null) { + FolderTreeNode parentNode = (FolderTreeNode) nodesByFolder.get(parent); + if (parentNode == null) { + parentNode = new FolderTreeNode(parent); + parentNode.setCanSelect(false); + nodesByFolder.put(parent, parentNode); + } + + parentNode.add(node); + node = parentNode; + parent = parent.getParent(); + } + root.add(node); } TreeModel treeModel = new DefaultTreeModel(root); navigationTree.setModel(treeModel); // use the folder icon for the leaf - DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); + DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer() { + @Override + public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, + boolean expanded, boolean leaf, int row, boolean hasFocus) { + Component component = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); + + FolderTreeNode node = (FolderTreeNode) value; + setEnabled(node.isCanSelect()); + + return component; + } + }; Icon folderIcon = renderer.getDefaultClosedIcon(); renderer.setLeafIcon(folderIcon); navigationTree.setCellRenderer(renderer); @@ -140,7 +168,8 @@ MailFolder folder) { Map<MailFolder, DefaultMutableTreeNode> result = new HashMap<MailFolder, DefaultMutableTreeNode>(); - DefaultMutableTreeNode node = new FolderTreeNode(folder); + FolderTreeNode node = new FolderTreeNode(folder); + node.setCanSelect(true); result.put(folder, node); parent.add(node); Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java =================================================================== --- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java 2014-06-26 15:01:57 UTC (rev 270) +++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java 2014-06-26 18:53:55 UTC (rev 271) @@ -144,14 +144,14 @@ faxToMailSession.setAuthenticatedFaxToMailUser(user); // test si l'utilisateur est admin - List<String> adminGroups = serviceContext.getApplicationConfig().getLdapAdminGroups(); - if (user != null && CollectionUtils.isNotEmpty(adminGroups) && user.getUserGroups() != null) { - for (FaxToMailUserGroup group : user.getUserGroups()) { - if (adminGroups.contains(group.getFullPath())) { +// List<String> adminGroups = serviceContext.getApplicationConfig().getLdapAdminGroups(); +// if (user != null && CollectionUtils.isNotEmpty(adminGroups) && user.getUserGroups() != null) { +// for (FaxToMailUserGroup group : user.getUserGroups()) { +// if (adminGroups.contains(group.getFullPath())) { faxToMailSession.setAdmin(true); - } - } - } +// } +// } +// } } } Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp =================================================================== --- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-26 15:01:57 UTC (rev 270) +++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-26 18:53:55 UTC (rev 271) @@ -230,7 +230,8 @@ <span class="glyphicon" ng-class="{'glyphicon-chevron-right': !collapsed, 'glyphicon-chevron-down': collapsed}"></span> </a> <a ng-click="editMailFolder(mailFolder)">{{mailFolder.name}} <span class="badge">{{mailFolder.$cumulativeCount}}</span></a> - <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="newSubFolder(this)" style="margin-left: 8px;"><span class="glyphicon glyphicon-plus"></span></a> + <a class="pull-right btn btn-info btn-xs" data-nodrag ng-click="newArchiveSubFolder(this)" style="margin-left: 8px;" ng-show="!mailFolder.hasArchiveFolder && !mailFolder.archiveFolder" tooltip="Créer un dossier d'archive"><span class="glyphicon glyphicon-plus"></span></a> + <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="newSubFolder(this)" style="margin-left: 8px;" ng-show="!mailFolder.archiveFolder"><span class="glyphicon glyphicon-plus"></span></a> <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="deleteFolder(this)" ng-disabled="mailFolder.$cumulativeCount > 0" tooltip="{{mailFolder.$cumulativeCount > 0 && 'Ce dossier contient ' + mailFolder.$cumulativeCount + ' demandes !'|| 'Supprimer ce dossier'}}"> <span class="glyphicon glyphicon-remove"></span></a> @@ -247,7 +248,7 @@ </div> </div> - <div class="col-md-8" ng-show="selectedMailFolder"> + <div class="col-md-8" ng-show="!selectedMailFolder.archiveFolder"> <h3>Édition du dossier {{selectedMailFolder.name}}</h3> <div class="panel-group" id="accordion"> @@ -786,6 +787,84 @@ </div> </div> </div> + <div class="col-md-8" ng-show="selectedMailFolder.archiveFolder"> + <h3>Édition du dossier {{selectedMailFolder.name}}</h3> + + <!-- Droits --> + <div class="panel panel-default"> + <div class="panel-heading"> + <h4 class="panel-title"> + Droits + </h4> + </div> + <div class="panel-body"> + <!-- Droits d'accès --> + <table id="rights" class="table table-bordered"> + <thead> + <tr> + <th>Utilisateur ou groupe</th> + <th>Droits</th> + </tr> + </thead> + <tbody> + <tr ng-repeat="group in selectedMailFolder.rightGroups"> + <td> + <span class="fa fa-users"></span> {{group.fullPath}} + <a class="pull-right btn btn-danger btn-xs pull-right" ng-click="removeRightGroup($index, group)"> + <span class="glyphicon glyphicon-remove"></span> + </a> + </td> + <td> + <label><input type="checkbox" + ng-model="readRightGroup" + ng-checked="selectedMailFolder.readRightGroups.containsByTopiaId(group)" + ng-disabled="parentScopeValues.readRightGroups.containsByTopiaId(group)" + ng-change="changeReadRightGroup(group)"> Lecture</label> + </td> + </tr> + <tr ng-repeat="user in selectedMailFolder.rightUsers"> + <td> + <span class="fa fa-user"></span> {{user.firstName}} {{user.lastName}} + <a class="pull-right btn btn-danger btn-xs pull-right" ng-click="removeRightUser($index, user)"> + <span class="glyphicon glyphicon-remove"></span> + </a> + </td> + <td> + <label><input type="checkbox" + ng-model="readRightUser" + ng-checked="selectedMailFolder.readRightUsers.containsByTopiaId(user)" + ng-disabled="parentScopeValues.readRightUsers.containsByTopiaId(user) || selectedMailFolder.writeRightUsers.containsByTopiaId(user)" + ng-change="changeReadRightUser(user)"> Lecture</label> + </td> + </tr> + </tbody> + </table> + <div class="form-inline"> + <div class="form-group"> + <label for="newRightUserField" class="control-label">Nouveau utilisateur :</label> + <select id="newRightUserField" class="form-control" + ng-model="newRightUser" ng-options="user as user.firstName + ' ' + user.lastName for user in users"> + </select> + <a class="btn btn-success btn-xs" ng-click="addRightUser()" ng-disabled="!newRightUser"> + <span class="glyphicon glyphicon-plus"></span> + </a> + </div> + </div> + + <div class="form-inline"> + <div class="form-group"> + <label for="newRightGroupField" class="control-label">Nouveau groupe :</label> + <select id="newRightGroupField" class="form-control" + ng-model="newRightGroup" ng-options="group as group.fullPath for group in groups"> + </select> + <a class="btn btn-success btn-xs" ng-click="addRightGroup()" ng-disabled="!newRightGroup"> + <span class="glyphicon glyphicon-plus"></span> + </a> + </div> + </div> + </div> + </div> + </div> </div> </div> Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js =================================================================== --- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-26 15:01:57 UTC (rev 270) +++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-26 18:53:55 UTC (rev 271) @@ -78,6 +78,9 @@ } result.push(mailFolder); + if (mailFolder.archiveFolder) { + parent.hasArchiveFolder = true; + } folderCount += recursiveAddMailFolder(result, mailFolder.children, rootFolder, mailFolder.$fullPath, mailFolder); // et on modifie encore (tant qu'on a commencé !!!) @@ -354,7 +357,7 @@ useCurrentLevelEdiFolder: false, useCurrentLevelRejectResponseMessage: false, useCurrentLevelRejectResponseMailAddress: false, - archiveFolder: false + archiveContainer: false }; // extend node (in faxtomail collapsed = extended) scope.collapse(); @@ -367,6 +370,37 @@ } }; + // new sub folder + $scope.newArchiveSubFolder = function(scope) { + var nodeData = scope.$modelValue; + if (!nodeData.hasArchiveFolder) { + var name = "Archives du dossier " + nodeData.name; + if (name) { + var newNode = { + topiaId: "new_" + guid(), + name: name, + children: [], + useCurrentLevelEtatAttente: false, + useCurrentLevelTableColumns: false, + useCurrentLevelFaxDomain: false, + useCurrentLevelEdiFolder: false, + useCurrentLevelRejectResponseMessage: false, + useCurrentLevelRejectResponseMailAddress: false, + archiveFolder: true + }; + // extend node (in faxtomail collapsed = extended) + scope.collapse(); + // append new node + nodeData.hasArchiveFolder = true; + nodeData.children.push(newNode); + // edition automatique + //$scope.editMailFolder(newNode); + // update flat map + $scope._updateFlatMailFolders(); + } + } + }; + // suppression d'un dossier $scope.deleteFolder = function(scope) { if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce dossier ?")) {
participants (1)
-
kmorin@users.forge.codelutin.com