ref #8489: some issues in DistributionStatusPreferences
authorKatja Luther <k.luther@bgbm.org>
Fri, 20 Sep 2019 08:21:40 +0000 (10:21 +0200)
committerKatja Luther <k.luther@bgbm.org>
Fri, 20 Sep 2019 08:21:40 +0000 (10:21 +0200)
eu.etaxonomy.taxeditor.store/plugin.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/DistributionStatusPreferencePage.java

index 8c85146097484bcc66ab7a7c7efcaf115165d226..67dbc491d9d6e64a0148c387b66e78e5ccc6845e 100755 (executable)
             name="%page.name.22">
       </page>
     <page 
-         category="eu.etaxonomy.taxeditor.preferences.general"
+          category="eu.etaxonomy.taxeditor.store.UIAdminPreference"
          class="eu.etaxonomy.taxeditor.preference.DistributionGeneralPreference"
          id="eu.etaxonomy.taxeditor.store.Distribution"
          name="%page.name.104">
index eb05c16503b5c15bafaf50e022878d0b2ad72213..86b122ebcffd335c262c3e9e2d999da4e85a5b09 100644 (file)
@@ -591,6 +591,8 @@ public class Messages extends NLS {
     public static String Distribution_status_selection;
     public static String DistributionAdminPreferences_SELECT_STATUS;
     public static String DistributionAdminPreferences_PER_AREA_STATUS;
+    public static String DistributionAdminPreferences_DEFAULT_AREA_STATUS_NOT_ALLOWED;
+    public static String DistributionAdminPreferences_DEFAULT_AREA_STATUS;
 
     public static String DatabasePreferncesPage_Show_MediaView;
     public static String DatabasePreferncesPage_Show_ChecklistPerspective;
index c541b99881c33722b2886695cb3d1e76010724bd..006f19167f72ef285850a266ccb66e332038736a 100644 (file)
@@ -476,6 +476,8 @@ DatabasePreferncesPage_NamedAreaSearchField=Searchfield for named areas
 Distribution_status_selection=Status Selection
 DistributionAdminPreferences_SELECT_STATUS=List of available distribution status
 DistributionAdminPreferences_PER_AREA_STATUS=List of preferences defining available status per area.\nWith the mostright button you can edit the selected area specific status preference.\nFor defining new area specific status preference please use the button below the table
+DistributionAdminPreferences_DEFAULT_AREA_STATUS_NOT_ALLOWED=Actual status selection, the area specific selection is only available for serverside preferences.\nThe editing of the general status is not allowed in local preferences, if you need to edit them please contact an administrator.
+DistributionAdminPreferences_DEFAULT_AREA_STATUS=Actual status selection, the area specific selection is only available for serverside preferences.\nFor editing the general status selection use the button below
 
 MarkerTypeMenuPreferences_display=Choose available markers
 MeasurementUnitMenuPreferences_edit=Edit displayed measurement units
index 406941546bde5606077d855a278227fdeaed60de..b23481a5ca3655dbbb5642c7236ede0bb6d85287 100644 (file)
@@ -476,6 +476,8 @@ DatabasePreferncesPage_NamedAreaSearchField=Suchfeld f
 Distribution_status_selection=Status Auswahl
 DistributionAdminPreferences_SELECT_STATUS=Liste der verfügbaren Verbreitungs-Status
 DistributionAdminPreferences_PER_AREA_STATUS=Liste der pro Area definierten Status Preferenzen\nMit dem Button auf der rechten Seite können Sie die Präferenz für das Gebiet editieren.\nWenn Sie neue gebietsspezifische Statusangaben definieren wollen, müssen Sie den Button unter der Tabelle verwenden.
+DistributionAdminPreferences_DEFAULT_AREA_STATUS_NOT_ALLOWED=Liste der pro Area definierten Status Preferenzen. Die gebietsspezifische Statusauswahl ist aktuell nur serverseitig verfügbar.\nDie Bearbeitung der allgemeinen Statusauswahl ist durch die serverseitige Präferenz nicht erlaubt. Wenn Sie dennoch die Status ändern wollen, kontaktieren Sie bitte eine Administrator.
+DistributionAdminPreferences_DEFAULT_AREA_STATUS=Liste der pro Area definierten Status Preferenzen. Die gebietsspezifische Statusauswahl ist aktuell nur serverseitig verfügbar.\nUm die allgemeine Statusauswahl zu bearbeiten, nutzen Sie bitte den Button unterhalb der Tabelle
 
 MarkerTypeMenuPreferences_display=Auswahl der zur Verf\u00FCgung stehenden Marker
 MeasurementUnitMenuPreferences_edit=Angezeigte Maßeinheiten
index 78d975dfcf5e777ec154090be1ca7104536f5954..071265f8185069c77c62f65e6b75a9458241a15a 100755 (executable)
@@ -38,6 +38,7 @@ import org.eclipse.ui.handlers.IHandlerService;
 import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
 import eu.etaxonomy.cdm.model.location.NamedArea;
 import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
 import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
 import eu.etaxonomy.cdm.model.metadata.PreferenceResolver;
 import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
@@ -86,9 +87,12 @@ public class DistributionStatusPreferencePage extends AbstractVocabularySelectio
 
         }else{
             final CLabel labelPerAreaStatus = new CLabel(composite, SWT.NULL);
-            labelPerAreaStatus.setText("Actual status selection, the area specific selection is only available for serverside preferences.\n"
-                    + "For editing the general status selection use the button below");
-            labelPerAreaStatus.setLayoutData(textGrid);
+            if (pref != null && !pref.isAllowOverride()){
+                labelPerAreaStatus.setText(Messages.DistributionAdminPreferences_DEFAULT_AREA_STATUS_NOT_ALLOWED);
+            }else{
+                labelPerAreaStatus.setText(Messages.DistributionAdminPreferences_DEFAULT_AREA_STATUS);
+                labelPerAreaStatus.setLayoutData(textGrid);
+            }
 
         }
         createStatusTable();
@@ -125,7 +129,9 @@ public class DistributionStatusPreferencePage extends AbstractVocabularySelectio
 
         });
         button_openStatusWizard.setText(Messages.Distribution_status_selection);
-
+        if (!isAdminPreference && pref != null && !pref.isAllowOverride()){
+            button_openStatusWizard.setEnabled(false);
+        }
 
 
         return composite;
@@ -202,16 +208,21 @@ public class DistributionStatusPreferencePage extends AbstractVocabularySelectio
 
 
             }else if (col == 2){
+               List<UUID> uuidList = null;
+               if ((isAdminPreference || !override)&& pref.getValue() == null){
+                   item.setText(col, "All status");
+               }else{
 
-                   if ((isAdminPreference || !override)&& pref.getValue() == null){
-                       item.setText(col, "All status");
+                   if (!isAdminPreference && override && ((pref != null && pref.isAllowOverride()) || pref == null)){
+                       uuidList = PreferencesUtil.createUUIDListFromStringPref(PreferencePredicate.AvailableDistributionStatus.getKey(), true);
                    }else{
-                       List<UUID> uuidList;
-                       if (isAdminPreference || (!override || (!(pref.getSubject().equals(PreferenceSubject.ROOT) || pref.getSubject().equals(PreferenceSubject.TAX_EDITOR))))){
+                       if (pref != null && pref.getValue() != null){
                            uuidList = PreferencesUtil.createUuidList(pref.getValue());
                        }else{
-                           uuidList = PreferencesUtil.createUUIDListFromStringPref(PreferencePredicate.AvailableDistributionStatus.getKey(), true);
+                           item.setText(col, "All status");
                        }
+                   }
+                   if (uuidList != null){
                        List<PresenceAbsenceTerm> terms = CdmStore.getTermManager().getTerms(uuidList, PresenceAbsenceTerm.class);
                        String status = "";
                        int index = 1;
@@ -224,8 +235,8 @@ public class DistributionStatusPreferencePage extends AbstractVocabularySelectio
 
                        }
                        item.setText(col, status);
-
                    }
+               }
 
 
              }else if (col == 3 && isAdminPreference){
@@ -327,7 +338,8 @@ public class DistributionStatusPreferencePage extends AbstractVocabularySelectio
         type = TermType.NamedArea;
         CdmPreferenceCache cache = CdmPreferenceCache.instance();
         cache.getAllTaxEditorDBPreferences();
-
+        PrefKey defaultPref = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AvailableDistributionStatus);
+        this.pref = cache.get(defaultPref);
         prefStatus = cache.getAllForPredicate(PreferencePredicate.AvailableDistributionStatus.getKey());
         if (prefStatus == null){
             prefStatus = new ArrayList();