This is an automated email from the git hooks/post-receive script. New commit to branch feature/7424 in repository faxtomail. See http://git.codelutin.com/faxtomail.git commit fd1d1085e3e53745a2eab50ceec04e19ba2d6291 Author: Kevin Morin <morin@codelutin.com> Date: Wed Aug 12 14:55:38 2015 +0200 début de l'interface d'admin (possibilité de créer des tampons texte seulement) (refs #7424) --- faxtomail-persistence/src/main/xmi/faxtomail.zargo | Bin 31814 -> 32024 bytes .../services/service/ConfigurationService.java | 11 +- .../services/service/ConfigurationServiceImpl.java | 72 +++++---- .../services/service/MailFolderServiceImpl.java | 2 +- .../services/service/ReferentielService.java | 4 + .../services/service/ReferentielServiceImpl.java | 8 + .../h2/V1_4_0_150811__add_pdf_editor_stamps.sql | 6 +- .../V1_4_0_150811__add_pdf_editor_stamps.sql | 6 +- .../web/action/admin/ConfigurationAction.java | 22 ++- .../WEB-INF/content/admin/configuration-input.jsp | 175 ++++++++++++++++----- .../src/main/webapp/js/configuration.js | 85 +++++++++- 11 files changed, 306 insertions(+), 85 deletions(-) diff --git a/faxtomail-persistence/src/main/xmi/faxtomail.zargo b/faxtomail-persistence/src/main/xmi/faxtomail.zargo index e216944..0ab28c0 100644 Binary files a/faxtomail-persistence/src/main/xmi/faxtomail.zargo and b/faxtomail-persistence/src/main/xmi/faxtomail.zargo differ diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java index a27ee6d..f897299 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java @@ -33,6 +33,7 @@ import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.MailField; import com.franciaflex.faxtomail.persistence.entities.MailFilter; import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.persistence.entities.WaitingState; import com.franciaflex.faxtomail.services.FaxToMailService; @@ -49,8 +50,14 @@ public interface ConfigurationService extends FaxToMailService { List<MailFilter> getMailFilters(); - void save(Configuration configuration, List<DemandType> demandTypes, List<WaitingState> waitingStates, List<MailFolder> mailFolders, - List<MailFilter> mailFilters, List<EmailAccount> emailAccounts, List<BrandsForDomain> brandsForDomains); + void save(Configuration configuration, + List<DemandType> demandTypes, + List<Stamp> stamps, + List<WaitingState> waitingStates, + List<MailFolder> mailFolders, + List<MailFilter> mailFilters, + List<EmailAccount> emailAccounts, + List<BrandsForDomain> brandsForDomains); List<EmailAccount> getEmailAccountsWithoutPasswords(); diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java index 4cdf20a..78b5ab3 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java @@ -24,35 +24,7 @@ package com.franciaflex.faxtomail.services.service; * #L% */ -import com.franciaflex.faxtomail.persistence.entities.BrandsForDomain; -import com.franciaflex.faxtomail.persistence.entities.BrandsForDomainImpl; -import com.franciaflex.faxtomail.persistence.entities.BrandsForDomainTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.Configuration; -import com.franciaflex.faxtomail.persistence.entities.ConfigurationImpl; -import com.franciaflex.faxtomail.persistence.entities.ConfigurationTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.DemandType; -import com.franciaflex.faxtomail.persistence.entities.DemandTypeImpl; -import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.EmailAccount; -import com.franciaflex.faxtomail.persistence.entities.EmailAccountImpl; -import com.franciaflex.faxtomail.persistence.entities.EmailAccountTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.EmailProtocol; -import com.franciaflex.faxtomail.persistence.entities.ExtensionCommand; -import com.franciaflex.faxtomail.persistence.entities.ExtensionCommandTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup; -import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.GroupChef; -import com.franciaflex.faxtomail.persistence.entities.GroupChefTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.MailField; -import com.franciaflex.faxtomail.persistence.entities.MailFilter; -import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.persistence.entities.MailFolderImpl; -import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.WaitingState; -import com.franciaflex.faxtomail.persistence.entities.WaitingStateImpl; -import com.franciaflex.faxtomail.persistence.entities.WaitingStateTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.*; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; import com.google.common.base.Function; import com.google.common.collect.Lists; @@ -138,20 +110,28 @@ public class ConfigurationServiceImpl extends FaxToMailServiceSupport implements * * @param configuration configuration * @param demandTypes types de demande + * @param stamps tampons * @param waitingStates etat d'attentes * @param mailFolders mail folder * @param mailFilters mail filters * @param emailAccounts mail accounts */ @Override - public void save(Configuration configuration, List<DemandType> demandTypes, List<WaitingState> waitingStates, List<MailFolder> mailFolders, - List<MailFilter> mailFilters, List<EmailAccount> emailAccounts, List<BrandsForDomain> brandsForDomains) { + public void save(Configuration configuration, + List<DemandType> demandTypes, + List<Stamp> stamps, + List<WaitingState> waitingStates, + List<MailFolder> mailFolders, + List<MailFilter> mailFilters, + List<EmailAccount> emailAccounts, + List<BrandsForDomain> brandsForDomains) { Collection<MailFolder> toDeleteMailFolder = new ArrayList<>(); // sauvegarde saveConfiguration(configuration); saveDemandTypes(demandTypes); + saveStamps(stamps); Map<String, WaitingState> waitingStateCache = saveWaitingStates(waitingStates); Map<String, MailFolder> mailFolderCache = saveMailFolders(waitingStateCache, mailFolders, toDeleteMailFolder); saveMailFilters(mailFolderCache, mailFilters); @@ -196,6 +176,36 @@ public class ConfigurationServiceImpl extends FaxToMailServiceSupport implements } } + protected void saveStamps(List<Stamp> stamps) { + Binder<Stamp, Stamp> binderStamp = BinderFactory.newBinder(Stamp.class); + StampTopiaDao stampDao = getPersistenceContext().getStampDao(); + + List<Stamp> allStamps = stampDao.findAll(); + Map<String, Stamp> allStampsIndex = new HashMap<>(Maps.uniqueIndex(allStamps, TopiaEntities.getTopiaIdFunction())); + for (Stamp stamp : stamps) { + // get current etat attente + Stamp currentStamp; + if (StringUtils.isBlank(stamp.getTopiaId()) || stamp.getTopiaId().startsWith("new_")) { + currentStamp = new StampImpl(); + } else { + currentStamp = allStampsIndex.remove(stamp.getTopiaId()); + } + + // copy + binderStamp.copyExcluding(stamp, currentStamp, + Stamp.PROPERTY_TOPIA_ID, + Stamp.PROPERTY_TOPIA_CREATE_DATE, + Stamp.PROPERTY_TOPIA_VERSION); + + // persist + if (currentStamp.isPersisted()) { + stampDao.update(currentStamp); + } else { + stampDao.create(currentStamp); + } + } + } + /** * * @param waitingStates diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java index c00ed91..847dc31 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java @@ -88,7 +88,7 @@ public class MailFolderServiceImpl extends FaxToMailServiceSupport implements Ma @Override public List<MailFolder> getAllMailFolders() { MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); - return new ArrayList<MailFolder>(dao.findAll()); + return new ArrayList<>(dao.findAll()); } @Override diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java index ce166c5..72d58e3 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java @@ -31,6 +31,7 @@ import com.franciaflex.faxtomail.persistence.entities.MailFilter; import com.franciaflex.faxtomail.persistence.entities.MailFolder; import com.franciaflex.faxtomail.persistence.entities.Priority; import com.franciaflex.faxtomail.persistence.entities.Range; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.persistence.entities.WaitingState; import com.franciaflex.faxtomail.services.FaxToMailService; @@ -48,6 +49,8 @@ public interface ReferentielService extends FaxToMailService { List<Range> getAllRange(); + List<Stamp> getAllStamps(); + List<WaitingState> getAllWaitingState(); Map<String, Long> getWaitingStatesUsage(); @@ -65,4 +68,5 @@ public interface ReferentielService extends FaxToMailService { List<Range> importRanges(InputStream inputStream); List<DemandType> importDemandTypes(InputStream inputStream); + } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java index 4058df3..f0bae47 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java @@ -38,6 +38,8 @@ import com.franciaflex.faxtomail.persistence.entities.Priority; import com.franciaflex.faxtomail.persistence.entities.PriorityTopiaDao; import com.franciaflex.faxtomail.persistence.entities.Range; import com.franciaflex.faxtomail.persistence.entities.RangeTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.Stamp; +import com.franciaflex.faxtomail.persistence.entities.StampTopiaDao; import com.franciaflex.faxtomail.persistence.entities.WaitingState; import com.franciaflex.faxtomail.persistence.entities.WaitingStateTopiaDao; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; @@ -89,6 +91,12 @@ public class ReferentielServiceImpl extends FaxToMailServiceSupport implements R } @Override + public List<Stamp> getAllStamps() { + StampTopiaDao dao = getPersistenceContext().getStampDao(); + return dao.forAll().setOrderByArguments(Stamp.PROPERTY_LABEL).findAll(); + } + + @Override public List<WaitingState> getAllWaitingState() { WaitingStateTopiaDao dao = getPersistenceContext().getWaitingStateDao(); return dao.forAll().setOrderByArguments(WaitingState.PROPERTY_LABEL).findAll(); diff --git a/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql b/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql index 991d174..1fafc64 100644 --- a/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql +++ b/faxtomail-service/src/main/resources/db/migration/h2/V1_4_0_150811__add_pdf_editor_stamps.sql @@ -4,10 +4,10 @@ create table STAMP ( topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate timestamp, - name longvarchar, + label longvarchar, description longvarchar, - image binary(9999999) not null, - text longvarchar not null, + image binary(9999999), + text longvarchar, primary key (topiaId) ); diff --git a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql index 0ab48bd..fe74f52 100644 --- a/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql +++ b/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_4_0_150811__add_pdf_editor_stamps.sql @@ -4,10 +4,10 @@ create table STAMP ( topiaId varchar(255) not null, topiaVersion bigint not null, topiaCreateDate datetime2, - name varchar(MAX), + label varchar(MAX), description varchar(MAX), - image varbinary(MAX) not null, - text varchar(MAX) not null, + image varbinary(MAX), + text varchar(MAX), primary key (topiaId) ); diff --git a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java index 2f6ce52..317d64e 100644 --- a/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java +++ b/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java @@ -36,6 +36,7 @@ import com.franciaflex.faxtomail.persistence.entities.MailField; import com.franciaflex.faxtomail.persistence.entities.MailFilter; import com.franciaflex.faxtomail.persistence.entities.MailFolder; import com.franciaflex.faxtomail.persistence.entities.Range; +import com.franciaflex.faxtomail.persistence.entities.Stamp; import com.franciaflex.faxtomail.persistence.entities.WaitingState; import com.franciaflex.faxtomail.services.service.ConfigurationService; import com.franciaflex.faxtomail.services.service.MailFolderService; @@ -81,6 +82,8 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa protected List<DemandType> demandTypes; + protected List<Stamp> stamps; + protected List<Range> ranges; protected List<MailFolder> mailFolders; @@ -111,6 +114,7 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa waitingStates = referentielService.getAllWaitingState(); waitingStatesUsage = referentielService.getWaitingStatesUsage(); demandTypes = referentielService.getAllDemandType(); + stamps = referentielService.getAllStamps(); ranges = referentielService.getAllRange(); mailFolders = mailFolderService.getRootMailFolders(); mailFoldersUsage = mailFolderService.getMailFoldersUsage(); @@ -128,7 +132,14 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa public String execute() throws Exception { String result = super.execute(); - configurationService.save(configuration, demandTypes, waitingStates, mailFolders, mailFilters, emailAccounts, brandsForDomains); + configurationService.save(configuration, + demandTypes, + stamps, + waitingStates, + mailFolders, + mailFilters, + emailAccounts, + brandsForDomains); return result; } @@ -179,6 +190,15 @@ public class ConfigurationAction extends FaxToMailActionSupport implements Prepa this.demandTypes = getGson().fromJson(json, type); } + public List<Stamp> getStamps() { + return stamps; + } + + public void setStampsJson(String json) { + Type type = new TypeToken<List<Stamp>>() {}.getType(); + this.stamps = getGson().fromJson(json, type); + } + public List<Range> getRanges() { return ranges; } diff --git a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp index f880720..541426b 100644 --- a/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp +++ b/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp @@ -44,6 +44,7 @@ 'waitingStates': <s:property value="toJson(waitingStates)" escapeHtml="false"/>, 'waitingStatesUsage': <s:property value="toJson(waitingStatesUsage)" escapeHtml="false"/>, 'demandTypes': <s:property value="toJson(demandTypes)" escapeHtml="false"/>, + 'stamps': <s:property value="toJson(stamps)" escapeHtml="false"/>, 'ranges': <s:property value="toJson(ranges)" escapeHtml="false"/>, 'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>, 'mailFoldersUsage': <s:property value="toJson(mailFoldersUsage)" escapeHtml="false"/>, @@ -75,6 +76,7 @@ <li class="active"><a href="#tabs-general" data-toggle="tab">Général</a></li> <li><a href="#tabs-waitingState" data-toggle="tab">États d'attente</a></li> <li><a href="#tabs-demandType" data-toggle="tab">Types de demandes</a></li> + <li><a href="#tabs-stamps" data-toggle="tab">Tampons</a></li> <li><a href="#tabs-tree" data-toggle="tab">Arborescence</a></li> <li><a href="#tabs-filters" data-toggle="tab">Filtres de mail</a></li> <li><a href="#tabs-search" data-toggle="tab">Recherche</a></li> @@ -230,6 +232,41 @@ </div> </div> + + <div id="tabs-stamps" class="tab-pane" ng-controller="ConfigurationStampsController"> + <input type="hidden" name="stampsJson" value="{{stamps}}" /> + + <div class="row"> + <div class="col-md-4"> + <h3>Tampon <input type="button" class="btn btn-success btn-xs pull-right" value="Nouveau" ng-click="newStamp()" /></h3> + <table class="table table-hover"> + <tbody> + <tr ng-repeat="stamp in stamps" + ng-class="{'info' : stamp == selectedStamp}" + ng-click="editStamp(stamp)"> + <td>{{stamp.label}}</td> + </tr> + </tbody> + </table> + </div> + + <div class="col-md-8" ng-if="selectedStamp"> + <h3>Édition du tampon {{selectedStamp.label}}</h3> + <div class="form-group"> + <label>Description :</label> + <textarea name="description" class="form-control" ng-model="selectedStamp.description"></textarea> + </div> + <div class="form-group"> + <label>Texte :</label> + <textarea name="text" class="form-control" ng-model="selectedStamp.text"></textarea> + </div> + </div> + <div class="col-md-8" ng-if="!selectedStamp"> + <em>Sélectionnez un tampon.</em> + </div> + </div> + + </div> <div id="tabs-tree" class="tab-pane" ng-controller="ConfigurationTreeController"> <input type="hidden" name="mailFoldersJson" value="{{mailFolders}}" /> @@ -601,27 +638,31 @@ </div> <div id="collapse3" class="panel-collapse collapse"> <div class="panel-body"> - <label ng-if="selectedMailFolder.$parent"> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelWaitingState" - ng-value="false" ng-change="initFolderWaitingState()" /> - Hériter des états d'attente déclarés sur les dossiers parent : - </label> - <div class="checkbox" ng-repeat="waitingState in waitingStates" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelWaitingState"> - <label> - <input type="checkbox" ng-checked="parentScopeValues.waitingStates.containsByTopiaId(waitingState)" - disabled> {{waitingState.label}} + <div> + <label ng-if="selectedMailFolder.$parent"> + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelWaitingState" + ng-value="false" ng-change="initFolderWaitingState()" /> + Hériter des états d'attente déclarés sur les dossiers parent : </label> + <div class="checkbox" ng-repeat="waitingState in waitingStates" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelWaitingState"> + <label> + <input type="checkbox" ng-checked="parentScopeValues.waitingStates.containsByTopiaId(waitingState)" + disabled> {{waitingState.label}} + </label> + </div> </div> - <label> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelWaitingState" ng-value="true" - ng-change="initFolderWaitingState()" ng-if="selectedMailFolder.$parent" /> - Définir les états d'attente pour ce dossier : - </label> - <div class="checkbox" ng-repeat="waitingState in waitingStates" ng-if="selectedMailFolder.useCurrentLevelWaitingState || !selectedMailFolder.$parent"> + <div> <label> - <input type="checkbox" ng-checked="selectedMailFolder.waitingStates.containsByTopiaId(waitingState)" - ng-click="changeFolderWaitingState(waitingState)"> {{waitingState.label}} + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelWaitingState" ng-value="true" + ng-change="initFolderWaitingState()" ng-if="selectedMailFolder.$parent" /> + Définir les états d'attente pour ce dossier : </label> + <div class="checkbox" ng-repeat="waitingState in waitingStates" ng-if="selectedMailFolder.useCurrentLevelWaitingState || !selectedMailFolder.$parent"> + <label> + <input type="checkbox" ng-checked="selectedMailFolder.waitingStates.containsByTopiaId(waitingState)" + ng-click="changeFolderWaitingState(waitingState)"> {{waitingState.label}} + </label> + </div> </div> </div> </div> @@ -638,32 +679,78 @@ </div> <div id="collapse4" class="panel-collapse collapse"> <div class="panel-body"> - <label ng-if="selectedMailFolder.$parent"> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelDemandType" - ng-value="false" ng-change="initFolderDemandTypes()" /> - Hériter des types de demande déclarés sur les dossiers parent : - </label> - <div class="checkbox" ng-repeat="demandType in demandTypes" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelDemandType"> + <div> + <label ng-if="selectedMailFolder.$parent"> + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelDemandType" + ng-value="false" ng-change="initFolderDemandTypes()" /> + Hériter des types de demande déclarés sur les dossiers parent : + </label> + <div class="checkbox" ng-repeat="demandType in demandTypes" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelDemandType"> + <label> + <input type="checkbox" ng-checked="parentScopeValues.demandTypes.containsByTopiaId(demandType)" + disabled> {{demandType.label}} + </label> + </div> + </div> + <div> <label> - <input type="checkbox" ng-checked="parentScopeValues.demandTypes.containsByTopiaId(demandType)" - disabled> {{demandType.label}} + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelDemandType" ng-value="true" + ng-change="initFolderDemandTypes()" ng-if="selectedMailFolder.$parent" /> + Définir les types de demande pour ce dossier : </label> + <div class="checkbox" ng-repeat="demandType in demandTypes" ng-if="selectedMailFolder.useCurrentLevelDemandType || !selectedMailFolder.$parent"> + <label> + <input type="checkbox" ng-checked="selectedMailFolder.demandTypes.containsByTopiaId(demandType)" + ng-click="changeFolderDemandType(demandType)"> {{demandType.label}} + </label> + </div> </div> - <label> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelDemandType" ng-value="true" - ng-change="initFolderDemandTypes()" ng-if="selectedMailFolder.$parent" /> - Définir les types de demande pour ce dossier : - </label> - <div class="checkbox" ng-repeat="demandType in demandTypes" ng-if="selectedMailFolder.useCurrentLevelDemandType || !selectedMailFolder.$parent"> + </div> + </div> + </div> + + <!-- Sélection des tampons possibles pour ce dossier --> + <div class="panel panel-default"> + <div class="panel-heading"> + <h4 class="panel-title"> + <a data-toggle="collapse" data-parent="#accordion" href="#collapseStamps"> + Sélection des tampons possibles pour ce dossier + </a> + </h4> + </div> + <div id="collapseStamps" class="panel-collapse collapse"> + <div class="panel-body"> + <div> + <label ng-if="selectedMailFolder.$parent"> + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelPdfEditorStamps" + ng-value="false" ng-change="initFolderPdfEditorStamps()" /> + Hériter des tampons déclarés sur les dossiers parent : + </label> + <div class="checkbox" ng-repeat="stamp in stamps" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelPdfEditorStamps"> + <label> + <input type="checkbox" ng-checked="parentScopeValues.pdfEditorStamps.containsByTopiaId(stamp)" + disabled> {{stamp.label}} + </label> + </div> + </div> + <div> <label> - <input type="checkbox" ng-checked="selectedMailFolder.demandTypes.containsByTopiaId(demandType)" - ng-click="changeFolderDemandType(demandType)"> {{demandType.label}} + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelPdfEditorStamps" ng-value="true" + ng-change="initPdfEditorStamps()" ng-if="selectedMailFolder.$parent" /> + Définir les tampons pour ce dossier : </label> + <div class="checkbox" ng-repeat="stamp in stamps" ng-if="selectedMailFolder.useCurrentLevelPdfEditorStamps || !selectedMailFolder.$parent"> + <label> + <input type="checkbox" ng-checked="selectedMailFolder.pdfEditorStamps.containsByTopiaId(stamp)" + ng-click="changeFolderPdfEditorStamp(stamp)"> {{stamp.label}} + </label> + </div> </div> </div> </div> </div> - + + <!-- Sélection des gammes possibles pour ce dossier --> <div class="panel panel-default"> <div class="panel-heading"> @@ -675,16 +762,18 @@ </div> <div id="collapse5" class="panel-collapse collapse"> <div class="panel-body"> - <label ng-if="selectedMailFolder.$parent"> - <input type="radio" ng-model="selectedMailFolder.useCurrentLevelRange" - ng-value="false" ng-change="initFolderRanges()" /> - Hériter des gammes déclarées sur les dossiers parent : - </label> - <div class="checkbox" ng-repeat="range in ranges" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelRange"> - <label> - <input type="checkbox" ng-checked="parentScopeValues.ranges.containsByTopiaId(range)" - disabled> {{range.label}} + <div> + <label ng-if="selectedMailFolder.$parent"> + <input type="radio" ng-model="selectedMailFolder.useCurrentLevelRange" + ng-value="false" ng-change="initFolderRanges()" /> + Hériter des gammes déclarées sur les dossiers parent : </label> + <div class="checkbox" ng-repeat="range in ranges" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelRange"> + <label> + <input type="checkbox" ng-checked="parentScopeValues.ranges.containsByTopiaId(range)" + disabled> {{range.label}} + </label> + </div> </div> <div> <label> diff --git a/faxtomail-ui-web/src/main/webapp/js/configuration.js b/faxtomail-ui-web/src/main/webapp/js/configuration.js index a51a010..db22c09 100644 --- a/faxtomail-ui-web/src/main/webapp/js/configuration.js +++ b/faxtomail-ui-web/src/main/webapp/js/configuration.js @@ -43,6 +43,8 @@ ConfigurationModule.controller('ConfigurationController', ['$scope', 'Configurat $scope.ranges = ConfigurationData.ranges; //{Array} les types de documents $scope.demandTypes = ConfigurationData.demandTypes; + //{Array} les tampons + $scope.stamps = ConfigurationData.stamps; //{Array} mail folders $scope.mailFolders = ConfigurationData.mailFolders; // {Map} Mail folder usage @@ -306,7 +308,7 @@ ConfigurationModule.controller('ConfigurationDemandTypeController', ['$scope', ' } }; - // ajout d'un nouvel etat d'attente + // ajout d'un nouveau type de demande $scope.newDemandType = function() { var label = $window.prompt("Nom du nouveau type de document ?"); if (label) { @@ -340,6 +342,58 @@ ConfigurationModule.controller('ConfigurationDemandTypeController', ['$scope', ' }; }]); +/** + * Stamps tab controller. + */ +ConfigurationModule.controller('ConfigurationStampsController', ['$scope', '$window', 'ConfigurationData', + function($scope, $window, ConfigurationData) { + //{Object} tampon selectionné + $scope.selectedStamp; + + // edition d'un tampon + $scope.editStamp = function(stamp) { + $scope.selectedStamp = stamp; + +// // initialize le tableau d'action si vide +// if (!$scope.selectedStamp.requiredFields) { +// $scope.selectedDemandType.requiredFields = []; +// } + }; + + // ajout d'un nouveau tampon + $scope.newStamp = function() { + var label = $window.prompt("Nom du nouveau tampon ?"); + if (label) { + // auto select new etat + var newStamp = { + topiaId : "new_" + guid(), + label: label + }; + + // check if already exists + if ($scope.stamps.indexOfBy('label', newStamp) != -1) { + $window.alert("Ce tampon existe déjà !"); + } else { + $scope.stamps.push(newStamp); + + // auto select + $scope.editStamp(newStamp); + } + } + }; + +// // selection/deselection d'un champ +// $scope.changeDemandTypeField = function(mailField) { +// +// var index = $scope.selectedDemandType.requiredFields.indexOf(mailField); +// if (index != -1) { +// $scope.selectedDemandType.requiredFields.splice(index, 1); +// } else { +// $scope.selectedDemandType.requiredFields.push(mailField); +// } +// }; +}]); + /** * Mail folder tab controller. @@ -525,6 +579,9 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo if (!$scope.selectedMailFolder.demandTypes) { $scope.selectedMailFolder.demandTypes = []; } + if (!$scope.selectedMailFolder.pdfEditorStamps) { + $scope.selectedMailFolder.pdfEditorStamps = []; + } if (!$scope.selectedMailFolder.ranges) { $scope.selectedMailFolder.ranges = []; } @@ -613,6 +670,8 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo folderTableColumns: [], waitingStates: [], demandTypes: [], + stamps: [], + pdfEditorStamps: [], ranges: [], //rigths readRightUsers: [], @@ -716,6 +775,9 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo if ((!$scope.parentScopeValues.demandTypes || $scope.parentScopeValues.demandTypes.length == 0) && folder.demandTypes) { $scope.parentScopeValues.demandTypes = folder.demandTypes; } + if ((!$scope.parentScopeValues.pdfEditorStamps || $scope.parentScopeValues.pdfEditorStamps.length == 0) && folder.pdfEditorStamps) { + $scope.parentScopeValues.pdfEditorStamps = folder.pdfEditorStamps; + } if ((!$scope.parentScopeValues.ranges || $scope.parentScopeValues.ranges.length == 0) && folder.ranges) { $scope.parentScopeValues.ranges = folder.ranges; } @@ -923,6 +985,27 @@ ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$windo } }; + // initialise la liste des tampons avec celle des niveaux supérieurs + $scope.initFolderPdfEditorStamps = function() { + if ($scope.selectedMailFolder.useCurrentLevelPdfEditorStamps) { + if ($scope.parentScopeValues.pdfEditorStamps) { + $scope.selectedMailFolder.pdfEditorStamps = $scope.parentScopeValues.pdfEditorStamps.slice(); // soft copy + } + } else { + delete $scope.selectedMailFolder.pdfEditorStamps; + } + }; + + // selection/deselection d'un tampon possible pour ce dossier + $scope.changeFolderPdfEditorStamp = function(pdfEditorStamp) { + var index = $scope.selectedMailFolder.pdfEditorStamps.indexOfByTopiaId(pdfEditorStamp); + if (index != -1) { + $scope.selectedMailFolder.pdfEditorStamps.splice(index, 1); + } else { + $scope.selectedMailFolder.pdfEditorStamps.push(pdfEditorStamp); + } + }; + // initialise la liste des gammes avec celle des niveaux supérieurs $scope.initFolderRanges = function() { if ($scope.selectedMailFolder.useCurrentLevelRange) { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.