Beispiel #1
0
        public GeospatialAreaMapLayerGridSpec(bool userCanManage)
        {
            var areGeospatialAreasExternallySourced = MultiTenantHelpers.AreGeospatialAreasExternallySourced();

            if (userCanManage)
            {
                if (areGeospatialAreasExternallySourced)
                {
                    var cssClasses = new List <string> {
                        "btn", "btn-xs", "btn-firma"
                    };
                    Add(string.Empty,
                        x => DhtmlxGridHtmlHelpers.MakeModalDialogLink("Sync", x.GetSyncUrl(), 400, "Sync Data",
                                                                       true, "Sync", "Cancel", cssClasses, null, null),
                        60, DhtmlxGridColumnFilterType.None);
                }
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeEditIconAsModalDialogLinkBootstrap(x.GetEditMapLayerUrl(), "Edit Geospatial Area Map Layer"), 30, DhtmlxGridColumnFilterType.None);
            }
            Add("Display Name", x => x.GeospatialAreaTypeNamePluralized, 250);
            Add(FieldDefinitionEnum.GeospatialAreaMapLayerDisplayAsReferenceLayer.ToType().ToGridHeaderString(), x => x.DisplayOnAllProjectMaps ? "Yes" : "No", 175);
            Add(FieldDefinitionEnum.GeospatialAreaTypeOnByDefaultOnProjectMap.ToType().ToGridHeaderString(), x => x.OnByDefaultOnProjectMap ? "Yes" : "No", 175);
            if (areGeospatialAreasExternallySourced)
            {
                Add("Service Url", x => x.ServiceUrl, 450);
            }
        }
Beispiel #2
0
        public IndexViewData(FirmaSession currentFirmaSession,
                             ProjectFirmaModels.Models.FirmaPage externalMapLayersFirmaPage, string externalMapLayerGridDataUrl,
                             ProjectFirmaModels.Models.FirmaPage internalMapLayersFirmaPage, string geospatialAreaMapLayerGridDataUrl,
                             ProjectFirmaModels.Models.FirmaPage externallySourcedGeospatialAreasInstructionsFirmaPage, bool userCanManage)
            : base(currentFirmaSession, externalMapLayersFirmaPage)
        {
            PageTitle = $"{FieldDefinitionEnum.GeospatialArea.ToType().GetFieldDefinitionLabelPluralized()}";
            ExternalMapLayerGridSpec = new ExternalMapLayerGridSpec(userCanManage)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.ExternalReferenceLayer.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.ExternalReferenceLayer.ToType().GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };
            ExternalMapLayerGridName    = "externalMapLayersGrid";
            ExternalMapLayerGridDataUrl = externalMapLayerGridDataUrl;
            NewUrl = SitkaRoute <MapLayerController> .BuildUrlFromExpression(x => x.New());

            var currentPersonCanManage = new FirmaPageManageFeature().HasPermission(currentFirmaSession, internalMapLayersFirmaPage).HasPermission;

            InternalMapLayersViewPageContentViewData = new ViewPageContentViewData(internalMapLayersFirmaPage, currentPersonCanManage);

            AreGeospatialAreasExternallySourced = MultiTenantHelpers.AreGeospatialAreasExternallySourced();
            ExternallySourcedGeospatialAreasInstructionsViewPageContentViewData = new ViewPageContentViewData(externallySourcedGeospatialAreasInstructionsFirmaPage, currentPersonCanManage);

            GeospatialAreaMapLayerGridSpec = new GeospatialAreaMapLayerGridSpec(userCanManage)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.GeospatialArea.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.GeospatialArea.ToType().GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };
            GeospatialAreaMapLayerGridName    = "geospatialAreaMapLayersGrid";
            GeospatialAreaMapLayerGridDataUrl = geospatialAreaMapLayerGridDataUrl;

            UserCanManage = userCanManage;
        }
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            var errors = new List <ValidationResult>();

            if (MultiTenantHelpers.AreGeospatialAreasExternallySourced() && string.IsNullOrWhiteSpace(ServiceUrl))
            {
                errors.Add(new SitkaValidationResult <EditGeospatialAreaMapLayerViewModel, string>(
                               "Service Url is required when externally-sourced geospatial areas is enabled",
                               x => x.ServiceUrl));
            }

            return(errors);
        }
Beispiel #4
0
 public EditGeospatialAreaMapLayerViewData(GeospatialAreaType geospatialAreaType)
 {
     GeospatialAreaType = geospatialAreaType;
     AreGeospatialAreasExternallySourced = MultiTenantHelpers.AreGeospatialAreasExternallySourced();
 }