Example #1
0
            public MvcHtmlString ToHtml(HtmlHelper helper)
            {
                HtmlStringBuilder sb = new HtmlStringBuilder();

                using (sb.SurroundLine("li"))
                {
                    sb.Add(helper.ScriptCss("~/Help/Content/helpWidget.css"));

                    var id = TypeContextUtilities.Compose(Prefix, "helpButton");

                    sb.Add(new HtmlTag("button").Id(id)
                           .Class("btn btn-xs btn-help btn-help-widget")
                           .Class(HelpLogic.GetEntityHelp(RootType).HasEntity ? "hasItems" : null)
                           .Attr("type", "button")
                           .SetInnerText("?"));

                    var type = HelpLogic.GetEntityHelpService(this.RootType);

                    var jsType = new
                    {
                        Type       = TypeLogic.GetCleanName(type.Type),
                        Info       = type.Info,
                        Operations = type.Operations.ToDictionary(a => a.Key.Key, a => a.Value),
                        Properties = type.Properties.ToDictionary(a => a.Key.ToString(), a => a.Value),
                    };

                    sb.Add(MvcHtmlString.Create("<script>$('#" + id + "').on('mouseup', function(event){ if(event.which == 3) return; " +
                                                HelpClient.WidgetModule["entityClick"](JsFunction.This, this.Prefix, jsType, helper.UrlHelper().Action((HelpController c) => c.PropertyRoutes())).ToString() +
                                                " })</script>"));
                }

                return(sb.ToHtml());
            }
        public PartialViewResult PartialView(string entityType, string id, string prefix, string partialViewName, bool?readOnly)
        {
            Type type = Navigator.ResolveType(entityType);

            Entity entity = null;

            if (id.HasText())
            {
                Lite <Entity> lite = Lite.Create(type, PrimaryKey.Parse(id, type));
                using (Navigator.Manager.OnRetrievingForView(lite))
                {
                    entity = Database.Retrieve(lite);
                }
            }
            else
            {
                entity = (Entity) new ConstructorContext(this, this.TryGetOperationInfo(type)).ConstructUntyped(type);
            }

            TypeContext tc = TypeContextUtilities.UntypedNew((Entity)entity, prefix);

            if (readOnly == true)
            {
                tc.ReadOnly = true;
            }

            return(Navigator.PartialView(this, tc, partialViewName));
        }
Example #3
0
        public static HttpPostedFileBase GetHttpRequestFile(MappingContext ctx)
        {
            string             fileKey = TypeContextUtilities.Compose(ctx.Prefix, FileLineKeys.File);
            HttpPostedFileBase hpf     = ctx.Controller.ControllerContext.HttpContext.Request.Files[fileKey] as HttpPostedFileBase;

            return(hpf);
        }
Example #4
0
            MvcHtmlString IWidget.ToHtml(HtmlHelper helper)
            {
                if (Isolation == null)
                {
                    return(MvcHtmlString.Empty);
                }

                HtmlStringBuilder sb = new HtmlStringBuilder();

                sb.Add(helper.HiddenLite(TypeContextUtilities.Compose(Prefix, "Isolation"), Isolation));
                sb.Add(new HtmlTag("span").Class("sf-quicklinks badge").SetInnerText(Isolation.ToString()));
                //sb.Add(new MvcHtmlString("<script>" + IsolationClient.Module["addIsolationPrefilter"](Isolation.Key()) + "</script>"));
                return(sb.ToHtml());
            }
Example #5
0
        public ActionResult SaveProperties(FormCollection form, string prefix)
        {
            Lite <RoleEntity> role = this.ExtractLite <RoleEntity>(TypeContextUtilities.Compose(prefix, "Role"));
            TypeEntity        type = this.ExtractEntity <TypeEntity>(TypeContextUtilities.Compose(prefix, "Type"));

            var prp = PropertyAuthLogic.GetPropertyRules(role, type).ApplyChanges(this, prefix);

            PropertyAuthLogic.SetPropertyRules(prp.Value);

            if (prp.HasErrors())
            {
                return(prp.ToJsonModelState());
            }

            return(null);
        }
Example #6
0
        public JsonNetResult SaveQueries(FormCollection form, string prefix)
        {
            Lite <RoleEntity> role = this.ExtractLite <RoleEntity>(TypeContextUtilities.Compose(prefix, "Role"));
            TypeEntity        type = this.ExtractEntity <TypeEntity>(TypeContextUtilities.Compose(prefix, "Type"));

            var querys = QueryAuthLogic.GetQueryRules(role, type).ApplyChanges(this, prefix);

            if (querys.HasErrors())
            {
                return(querys.ToJsonModelState());
            }

            QueryAuthLogic.SetQueryRules(querys.Value);

            return(null);
        }
        public static void RegisterAvoidValidate()
        {
            ValidateInputAttribute doNotValidateInputAttribute = new ValidateInputAttribute(false);

            Controller <ValidatorController>()
            .Action(c => c.Validate(null, null))
            .AddFilters(ctx =>
            {
                var form   = ctx.ControllerContext.HttpContext.Request.Form;
                var prefix = form["prefix"];

                RuntimeInfo ri = RuntimeInfo.FromFormValue(form[TypeContextUtilities.Compose(prefix, EntityBaseKeys.RuntimeInfo)]);

                if (AvoidValidate(ri.EntityType))
                {
                    return(doNotValidateInputAttribute);
                }

                if (form.AllKeys.Contains(EntityBaseKeys.RuntimeInfo))
                {
                    RuntimeInfo riBase = RuntimeInfo.FromFormValue(form[EntityBaseKeys.RuntimeInfo]);
                    if (AvoidValidate(riBase.EntityType))
                    {
                        return(doNotValidateInputAttribute);
                    }
                }

                return(null);
            });

            Controller <OperationController>()
            .Action(c => c.Execute())
            .AddFilters(ctx =>
            {
                var form   = ctx.ControllerContext.HttpContext.Request;
                var prefix = form["prefix"];

                RuntimeInfo ri = RuntimeInfo.FromFormValue(form[TypeContextUtilities.Compose(prefix, EntityBaseKeys.RuntimeInfo)]);
                if (AvoidValidate(ri.EntityType))
                {
                    return(doNotValidateInputAttribute);
                }
                return(null);
            });
        }
Example #8
0
        public static Widget CreateWidget(WidgetContext ctx)
        {
            var ident = (Entity)ctx.Entity;

            var findOptions = new FindOptions(typeof(NoteEntity), "Target", ident.ToLite())
            {
                Create           = false,
                ShowFilterButton = false,
            }.ToJS(ctx.Prefix, "New");


            var url = RouteHelper.New().Action((NoteController ac) => ac.NotesCount());

            List <IMenuItem> items = new List <IMenuItem>()
            {
                new MenuItem(ctx.Prefix, "sfNoteView")
                {
                    CssClass = "sf-note-view",
                    OnClick  = NoteClient.Module["explore"](ctx.Prefix, findOptions, url),
                    Text     = NoteMessage.ViewNotes.NiceToString(),
                },

                new MenuItem(ctx.Prefix, "sfNoteCreate")
                {
                    CssClass = "sf-note-create",
                    OnClick  = NoteClient.Module["createNote"](JsFunction.Event, ctx.Prefix, NoteOperation.CreateNoteFromEntity.Symbol.Key, url),
                    Text     = NoteMessage.CreateNote.NiceToString()
                },
            };

            int count = CountNotes(ident.ToLite());

            return(new Widget
            {
                Id = TypeContextUtilities.Compose(ctx.Prefix, "notesWidget"),
                Title = NoteMessage.Notes.NiceToString(),
                IconClass = "glyphicon glyphicon-comment",
                Active = count > 0,
                Class = "sf-notes-toggler",
                Html = new HtmlTag("span").Class("sf-widget-count").SetInnerText(count.ToString()),
                Items = items
            });
        }
Example #9
0
        public ActionResult Upload()
        {
            string singleFile = Request.Files.Cast <string>().Single();

            string prefix = singleFile.Substring(0, singleFile.IndexOf(FileLineKeys.File) - 1);

            RuntimeInfo info = RuntimeInfo.FromFormValue((string)Request.Form[TypeContextUtilities.Compose(prefix, EntityBaseKeys.RuntimeInfo)]);

            HttpPostedFileBase hpf = Request.Files[singleFile] as HttpPostedFileBase;

            string fileName = Path.GetFileName(hpf.FileName);

            byte[] bytes     = hpf.InputStream.ReadAllBytes();
            string fileType  = (string)Request.Form[TypeContextUtilities.Compose(prefix, FileLineKeys.FileType)];
            string extraData = (string)Request.Form[TypeContextUtilities.Compose(prefix, FileLineKeys.CalculatedDirectory)];

            IFile file = FilesClient.ConstructFile(info.EntityType, new UploadedFileData
            {
                FileName            = fileName,
                Content             = bytes,
                FileType            = fileType,
                CalculatedDirectory = extraData
            });

            StringBuilder sb = new StringBuilder();

            //Use plain javascript not to have to add also the reference to jquery in the result iframe
            sb.AppendLine("<html><head><title>-</title></head><body>");
            sb.AppendLine("<script type='text/javascript'>");
            RuntimeInfo ri = file is EmbeddedEntity ? new RuntimeInfo((EmbeddedEntity)file) : new RuntimeInfo((IEntity)file);

            sb.AppendLine("window.parent.$.data(window.parent.document.getElementById('{0}'), 'SF-control').onUploaded('{1}', '{2}', '{3}', '{4}')".FormatWith(
                              prefix,
                              file.FileName,
                              FilesClient.GetDownloadUrl(file),
                              ri.ToString(),
                              info.EntityType.IsEmbeddedEntity() ? Navigator.Manager.SerializeEntity((EmbeddedEntity)file) : null));
            sb.AppendLine("</script>");
            sb.AppendLine("</body></html>");

            return(Content(sb.ToString()));
        }
Example #10
0
        public override void Execute()
        {
            #line 6 "..\..\Dashboard\Views\DashboardNavbarPartView.cshtml"

            string prefix = "r{0}c{1}".FormatWith(Model.Row, Model.StartColumn);
            DashboardClient.PartViews config = DashboardClient.PanelPartViews[Model.Content.GetType()];


            #line default
            #line hidden
            WriteLiteral("\n\n");


            #line 11 "..\..\Dashboard\Views\DashboardNavbarPartView.cshtml"
            Write(Html.Partial(config.FrontEndView, TypeContextUtilities.UntypedNew(Model.Content, prefix)));


            #line default
            #line hidden
            WriteLiteral("\n");
        }
Example #11
0
        public static void Start(bool smtpConfig, bool newsletter, bool pop3Config, bool emailReport, Type[] quickLinkFrom)
        {
            if (Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                CultureInfoClient.Start();

                Navigator.RegisterArea(typeof(MailingClient));
                Navigator.AddSettings(new List <EntitySettings>
                {
                    new EmbeddedEntitySettings <EmailAttachmentEmbedded> {
                        PartialViewName = e => ViewPrefix.FormatWith("EmailAttachment")
                    },
                    new EntitySettings <EmailPackageEntity> {
                        PartialViewName = e => ViewPrefix.FormatWith("EmailPackage")
                    },

                    new EntitySettings <EmailMessageEntity> {
                        PartialViewName = e => ViewPrefix.FormatWith("EmailMessage"), AvoidValidateRequest = true
                    },

                    new EmbeddedEntitySettings <EmailAddressEmbedded> {
                        PartialViewName = e => ViewPrefix.FormatWith("EmailAddress")
                    },
                    new EmbeddedEntitySettings <EmailRecipientEntity> {
                        PartialViewName = e => ViewPrefix.FormatWith("EmailRecipient")
                    },

                    new EmbeddedEntitySettings <EmailConfigurationEmbedded> {
                        PartialViewName = e => ViewPrefix.FormatWith("EmailConfiguration")
                    },
                    new EntitySettings <SystemEmailEntity> {
                    },

                    new EntitySettings <EmailMasterTemplateEntity> {
                        PartialViewName = e => ViewPrefix.FormatWith("EmailMasterTemplate"), AvoidValidateRequest = true
                    },
                    new EmbeddedEntitySettings <EmailMasterTemplateMessageEmbedded>
                    {
                        PartialViewName = e => ViewPrefix.FormatWith("EmailMasterTemplateMessage"),
                        MappingDefault  = new EntityMapping <EmailMasterTemplateMessageEmbedded>(true)
                                          .SetProperty(emtm => emtm.MasterTemplate, ctx =>
                        {
                            return((EmailMasterTemplateEntity)ctx.Parent.Parent.Parent.Parent.UntypedValue);
                        })
                    },

                    new EntitySettings <EmailTemplateEntity> {
                        PartialViewName = e => ViewPrefix.FormatWith("EmailTemplate"), AvoidValidateRequest = true
                    },
                    new EmbeddedEntitySettings <EmailTemplateMessageEmbedded>()
                    {
                        PartialViewName = e => ViewPrefix.FormatWith("EmailTemplateMessage")
                    },

                    new EmbeddedEntitySettings <EmailTemplateContactEmbedded>()
                    {
                        PartialViewName = e => ViewPrefix.FormatWith("EmailTemplateContact"),
                        MappingDefault  = new EntityMapping <EmailTemplateContactEmbedded>(true)
                                          .SetProperty(ec => ec.Token, ctx =>
                        {
                            string tokenStr = UserAssetsHelper.GetTokenString(ctx);
                            return(ParseQueryToken(tokenStr, ctx.Parent.Parent.Parent.Inputs[TypeContextUtilities.Compose("Query", EntityBaseKeys.RuntimeInfo)]));
                        }),
                    },

                    new EmbeddedEntitySettings <EmailTemplateRecipientEntity>()
                    {
                        PartialViewName = e => ViewPrefix.FormatWith("EmailTemplateRecipient"),
                        MappingDefault  = new EntityMapping <EmailTemplateRecipientEntity>(true)
                                          .SetProperty(ec => ec.Token, ctx =>
                        {
                            string tokenStr = UserAssetsHelper.GetTokenString(ctx);

                            return(ParseQueryToken(tokenStr, ctx.Parent.Parent.Parent.Parent.Inputs[TypeContextUtilities.Compose("Query", EntityBaseKeys.RuntimeInfo)]));
                        })
                    },
                });

                OperationClient.AddSettings(new List <OperationSettings>
                {
                    new EntityOperationSettings <EmailTemplateEntity>(EmailMessageOperation.CreateEmailFromTemplate)
                    {
                        Group = EntityOperationGroup.None,
                        Click = ctx => Module["createMailFromTemplate"](ctx.Options(), JsFunction.Event,
                                                                        new FindOptions(((EmailTemplateEntity)ctx.Entity).Query.ToQueryName()).ToJS(ctx.Prefix, "New"),
                                                                        ctx.Url.Action((MailingController mc) => mc.CreateMailFromTemplateAndEntity()))
                    }
                });

                if (smtpConfig)
                {
                    Navigator.AddSettings(new List <EntitySettings>
                    {
                        new EntitySettings <SmtpConfigurationEntity> {
                            PartialViewName = e => ViewPrefix.FormatWith("SmtpConfiguration")
                        },
                        new EmbeddedEntitySettings <SmtpNetworkDeliveryEmbedded> {
                            PartialViewName = e => ViewPrefix.FormatWith("SmtpNetworkDelivery")
                        },
                        new EmbeddedEntitySettings <ClientCertificationFileEmbedded> {
                            PartialViewName = e => ViewPrefix.FormatWith("ClientCertificationFile")
                        },
                    });
                }

                if (newsletter)
                {
                    Navigator.AddSettings(new List <EntitySettings>
                    {
                        new EntitySettings <NewsletterEntity> {
                            PartialViewName = e => ViewPrefix.FormatWith("Newsletter"), AvoidValidateRequest = true
                        },
                        new EntitySettings <NewsletterDeliveryEntity> {
                            PartialViewName = e => ViewPrefix.FormatWith("NewsletterDelivery")
                        },
                    });

                    OperationClient.AddSettings(new List <OperationSettings>
                    {
                        new EntityOperationSettings <NewsletterEntity>(NewsletterOperation.RemoveRecipients)
                        {
                            Click = ctx => Module["removeRecipients"](ctx.Options(),
                                                                      new FindOptions(typeof(NewsletterDeliveryEntity), "Newsletter", ctx.Entity).ToJS(ctx.Prefix, "New"),
                                                                      ctx.Url.Action((MailingController mc) => mc.RemoveRecipientsExecute()))
                        },

                        new EntityOperationSettings <NewsletterEntity>(NewsletterOperation.Send)
                        {
                            Group = EntityOperationGroup.None,
                        }
                    });
                }

                if (emailReport)
                {
                    Navigator.AddSettings(new List <EntitySettings>
                    {
                        new EntitySettings <SendEmailTaskEntity> {
                            PartialViewName = e => ViewPrefix.FormatWith("SendEmailTask")
                        }
                    });
                }

                if (pop3Config)
                {
                    Navigator.AddSettings(new List <EntitySettings>
                    {
                        new EntitySettings <Pop3ConfigurationEntity> {
                            PartialViewName = e => ViewPrefix.FormatWith("Pop3Configuration")
                        },
                        new EntitySettings <Pop3ReceptionEntity> {
                            PartialViewName = e => ViewPrefix.FormatWith("Pop3Reception")
                        },
                    });
                }

                if (quickLinkFrom != null)
                {
                    LinksClient.RegisterEntityLinks <Entity>((lite, ctx) =>
                    {
                        if (!quickLinkFrom.Contains(lite.EntityType))
                        {
                            return(null);
                        }

                        return(new[] { new QuickLinkExplore(typeof(EmailMessageEntity), "Target", lite) });
                    });
                }


                TasksGetWebMailBody += WebMailProcessor.ReplaceUntrusted;
                TasksGetWebMailBody += WebMailProcessor.CidToFilePath;

                TasksSetWebMailBody += WebMailProcessor.AssertNoUntrusted;
                TasksSetWebMailBody += WebMailProcessor.FilePathToCid;

                Navigator.EntitySettings <EmailMessageEntity>().MappingMain.AsEntityMapping()
                .RemoveProperty(a => a.Body)
                .SetProperty(a => a.Body, ctx =>
                {
                    if (!ctx.HasInput)
                    {
                        return(ctx.None());
                    }

                    var email = ((EmailMessageEntity)ctx.Parent.UntypedValue);

                    return(SetWebMailBody(ctx.Input, new WebMailOptions
                    {
                        Attachments = email.Attachments,
                        UntrustedImage = null,
                        Url = RouteHelper.New(),
                    }));
                });

                SpecialOmniboxProvider.Register(new SpecialOmniboxAction("AsyncEmailPanel",
                                                                         () => AsyncEmailSenderPermission.ViewAsyncEmailSenderPanel.IsAuthorized(),
                                                                         uh => uh.Action((AsyncEmailSenderController pc) => pc.View())));
            }
        }
Example #12
0
        public static void Start()
        {
            if (Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                QueryClient.Start();

                UserAssetsClient.Start();
                UserAssetsClient.RegisterExportAssertLink <UserChartEntity>();

                LinksClient.RegisterEntityLinks <UserChartEntity>((lite, ctx) => new[]
                {
                    new QuickLinkAction(ChartMessage.Preview, RouteHelper.New().Action <ChartController>(cc => cc.ViewUserChart(lite, null)))
                    {
                        IsVisible = ChartPermission.ViewCharting.IsAuthorized()
                    }
                });

                Func <SubTokensOptions, Mapping <QueryTokenEmbedded> > qtMapping = ops => ctx =>
                {
                    string tokenStr = UserAssetsHelper.GetTokenString(ctx);

                    string queryKey  = ctx.Parent.Parent.Parent.Inputs[TypeContextUtilities.Compose("Query", "Key")];
                    object queryName = QueryLogic.ToQueryName(queryKey);

                    var chart = ((UserChartEntity)ctx.Parent.Parent.Parent.UntypedValue);

                    QueryDescription qd = DynamicQueryManager.Current.QueryDescription(queryName);
                    return(new QueryTokenEmbedded(QueryUtils.Parse(tokenStr, qd, ops | (chart.GroupResults ? SubTokensOptions.CanAggregate : 0))));
                };

                Navigator.AddSettings(new List <EntitySettings>
                {
                    new EntitySettings <UserChartEntity> {
                        PartialViewName = _ => ChartClient.ViewPrefix.FormatWith("UserChart"), IsCreable = EntityWhen.Never
                    }
                });

                Navigator.EntitySettings <UserChartEntity>().MappingMain = Navigator.EntitySettings <UserChartEntity>().MappingLine =
                    new EntityMapping <UserChartEntity>(true)
                    .SetProperty(cb => cb.Columns, new ChartClient.MListCorrelatedOrDefaultMapping <ChartColumnEmbedded>(ChartClient.MappingChartColumn))
                    .SetProperty(cr => cr.Filters, new MListMapping <QueryFilterEmbedded>
                {
                    ElementMapping = new EntityMapping <QueryFilterEmbedded>(false)
                                     .CreateProperty(a => a.Operation)
                                     .CreateProperty(a => a.ValueString)
                                     .SetProperty(a => a.Token, qtMapping(SubTokensOptions.CanAnyAll | SubTokensOptions.CanElement))
                })
                    .SetProperty(cr => cr.Orders, new MListMapping <QueryOrderEmbedded>
                {
                    ElementMapping = new EntityMapping <QueryOrderEmbedded>(false)
                                     .CreateProperty(a => a.OrderType)
                                     .SetProperty(a => a.Token, qtMapping(SubTokensOptions.CanAnyAll | SubTokensOptions.CanElement))
                })
                    .SetProperty(cb => cb.Parameters, new MListDictionaryMapping <ChartParameterEmbedded, string>(p => p.Name)
                {
                    OnlyIfPossible = true
                });

                RouteTable.Routes.MapRoute(null, "UC/{webQueryName}/{lite}",
                                           new { controller = "Chart", action = "ViewUserChart" });

                UserChartEntity.SetConverters(query => QueryLogic.ToQueryName(query.Key), queryName =>
                                              QueryLogic.GetQueryEntity(queryName));

                OperationClient.AddSetting(new EntityOperationSettings <UserChartEntity>(UserChartOperation.Delete)
                {
                    Click = ctx => ChartClient.Module["deleteUserChart"](ctx.Options(), Finder.FindRoute(((UserChartEntity)ctx.Entity).Query.ToQueryName())),
                });

                LinksClient.RegisterEntityLinks <Entity>((entity, ctrl) =>
                {
                    if (!ChartPermission.ViewCharting.IsAuthorized())
                    {
                        return(null);
                    }

                    return(UserChartLogic.GetUserChartsEntity(entity.EntityType)
                           .Select(cp => new UserChartQuickLink(cp, entity)).ToArray());
                });
            }
        }
Example #13
0
        public static Widget CreateWidget(WidgetContext ctx)
        {
            var ident = (Entity)ctx.Entity;

            var url = RouteHelper.New().Action((AlertController ac) => ac.AlertsCount());

            var alertList = new[]
            {
                new { Count = CountAlerts(ident.ToLite(), "Attended"), Property = "Attended", AlertClass = "sf-alert-attended", Title = AlertMessage.Alerts_Attended.NiceToString() },
                new { Count = CountAlerts(ident.ToLite(), "Alerted"), Property = "Alerted", AlertClass = "sf-alert-alerted", Title = AlertMessage.Alerts_NotAttended.NiceToString() },
                new { Count = CountAlerts(ident.ToLite(), "Future"), Property = "Future", AlertClass = "sf-alert-future", Title = AlertMessage.Alerts_Future.NiceToString() },
            };

            var items = alertList.Select(a => new MenuItem(ctx.Prefix, "sfAlertExplore_" + a.Property)
            {
                OnClick  = AlertClient.Module["exploreAlerts"](ctx.Prefix, GetFindOptions(ident, a.Property).ToJS(ctx.Prefix, "alerts"), url),
                CssClass = "sf-alert-view",
                Html     =
                    new HtmlTag("span").Class("sf-alert-count-label").Class(a.AlertClass).Class(a.Count > 0 ? "sf-alert-active" : null).InnerHtml((a.Title + ": ").EncodeHtml()).ToHtml().Concat(
                        new HtmlTag("span").Class(a.AlertClass).Class(a.Count > 0 ? "sf-alert-active" : null).SetInnerText(a.Count.ToString()))
            }).Cast <IMenuItem>().ToList();

            items.Add(new MenuItemSeparator());

            items.Add(new MenuItem(ctx.Prefix, "sfAlertCreate")
            {
                CssClass = "sf-alert-create",
                OnClick  = AlertClient.Module["createAlert"](JsFunction.Event, ctx.Prefix, AlertOperation.CreateAlertFromEntity.Symbol.Key, url),
                Text     = AlertMessage.CreateAlert.NiceToString(),
            });

            HtmlStringBuilder label = new HtmlStringBuilder();
            int count = alertList.Length;

            for (int i = 0; i < count; i++)
            {
                var a = alertList[i];

                label.Add(new HtmlTag("span")
                          .Class("sf-widget-count")
                          .Class(a.AlertClass)
                          .Class(a.Count > 0 ? "sf-alert-active" : null)
                          .SetInnerText(a.Count.ToString())
                          .Attr("title", a.Title)
                          .ToHtml());

                if (i < count - 1)
                {
                    label.Add(new HtmlTag("span")
                              .Class("sf-alerts-count-separator")
                              .SetInnerText(" - ")
                              .ToHtml());
                }
            }

            return(new Widget
            {
                Title = AlertMessage.Alerts.NiceToString(),
                IconClass = "glyphicon glyphicon-bell",
                Class = "sf-alerts-toggler",
                Id = TypeContextUtilities.Compose(ctx.Prefix, "alertsWidget"),
                Active = alertList.Any(a => a.Count > 0),
                Html = label.ToHtml(),
                Items = items,
            });
        }
Example #14
0
 public string ComposePrefix(string prefixPart)
 {
     return(TypeContextUtilities.Compose(this.Prefix, prefixPart));
 }
Example #15
0
        public override void Execute()
        {
            #line 4 "..\..\AuthAdmin\Views\Types.cshtml"
            Write(Html.ScriptCss("~/authAdmin/Content/AuthAdmin.css"));


            #line default
            #line hidden
            WriteLiteral("\r\n<script");

            WriteLiteral(" type=\"text/javascript\"");

            WriteLiteral(">\r\n    $(function () {\r\n        require([\"");


            #line 7 "..\..\AuthAdmin\Views\Types.cshtml"
            Write(AuthAdminClient.Module);


            #line default
            #line hidden
            WriteLiteral(@"""], function (AuthAdmin) {
            AuthAdmin.multiSelRadios($(document));
            AuthAdmin.treeView();
            $("".sf-auth-rules .sf-submodule-trigger"").click(AuthAdmin.openDialog);
            $(document).on(""click"", "".sf-auth-rules .sf-remove"", AuthAdmin.removeCondition);
            $(document).on(""click"", "".sf-auth-rules .sf-create"", function (e) {
                e.preventDefault();
                AuthAdmin.chooseConditionToAdd($(this), '");


            #line 14 "..\..\AuthAdmin\Views\Types.cshtml"
            Write(AuthMessage.AuthAdmin_ChooseACondition.NiceToString());


            #line default
            #line hidden
            WriteLiteral("\');\r\n            });\r\n        });\r\n    });\r\n</script>\r\n");


            #line 19 "..\..\AuthAdmin\Views\Types.cshtml"

            bool propertyRules  = Navigator.Manager.EntitySettings.ContainsKey(typeof(PropertyRulePack));
            bool operationRules = Navigator.Manager.EntitySettings.ContainsKey(typeof(OperationRulePack));
            bool queryRules     = Navigator.Manager.EntitySettings.ContainsKey(typeof(QueryRulePack));


            #line default
            #line hidden
            WriteLiteral("\r\n");


            #line 24 "..\..\AuthAdmin\Views\Types.cshtml"
            using (var tc = Html.TypeContext <TypeRulePack>())
            {
            #line default
            #line hidden
                WriteLiteral("    <div");

                WriteLiteral(" class=\"form-compact\"");

                WriteLiteral(">\r\n");

                WriteLiteral("        ");


            #line 27 "..\..\AuthAdmin\Views\Types.cshtml"
                Write(Html.EntityLine(tc, f => f.Role));


            #line default
            #line hidden
                WriteLiteral("\r\n");

                WriteLiteral("        ");


            #line 28 "..\..\AuthAdmin\Views\Types.cshtml"
                Write(Html.ValueLine(tc, f => f.Strategy));


            #line default
            #line hidden
                WriteLiteral("\r\n    </div>\r\n");

                WriteLiteral("    <table");

                WriteLiteral(" class=\"sf-auth-rules\"");

                WriteLiteral(">\r\n        <thead>\r\n            <tr>\r\n                <th>");


            #line 33 "..\..\AuthAdmin\Views\Types.cshtml"
                Write(typeof(TypeEntity).NiceName());


            #line default
            #line hidden
                WriteLiteral("\r\n                </th>\r\n                <th>");


            #line 35 "..\..\AuthAdmin\Views\Types.cshtml"
                Write(TypeAllowed.Create.NiceToString());


            #line default
            #line hidden
                WriteLiteral("\r\n                </th>\r\n                <th>");


            #line 37 "..\..\AuthAdmin\Views\Types.cshtml"
                Write(TypeAllowed.Modify.NiceToString());


            #line default
            #line hidden
                WriteLiteral("\r\n                </th>\r\n                <th>");


            #line 39 "..\..\AuthAdmin\Views\Types.cshtml"
                Write(TypeAllowed.Read.NiceToString());


            #line default
            #line hidden
                WriteLiteral("\r\n                </th>\r\n                <th>");


            #line 41 "..\..\AuthAdmin\Views\Types.cshtml"
                Write(TypeAllowed.None.NiceToString());


            #line default
            #line hidden
                WriteLiteral("\r\n                </th>\r\n                <th>");


            #line 43 "..\..\AuthAdmin\Views\Types.cshtml"
                Write(AuthAdminMessage.Overriden.NiceToString());


            #line default
            #line hidden
                WriteLiteral("\r\n                </th>\r\n");


            #line 45 "..\..\AuthAdmin\Views\Types.cshtml"


            #line default
            #line hidden

            #line 45 "..\..\AuthAdmin\Views\Types.cshtml"
                if (propertyRules)
                {
            #line default
            #line hidden
                    WriteLiteral("                    <th>");


            #line 47 "..\..\AuthAdmin\Views\Types.cshtml"
                    Write(typeof(PropertyRouteEntity).NiceName());


            #line default
            #line hidden
                    WriteLiteral("\r\n                    </th>\r\n");


            #line 49 "..\..\AuthAdmin\Views\Types.cshtml"
                }


            #line default
            #line hidden
                WriteLiteral("                ");


            #line 50 "..\..\AuthAdmin\Views\Types.cshtml"
                if (operationRules)
                {
            #line default
            #line hidden
                    WriteLiteral("                    <th>");


            #line 52 "..\..\AuthAdmin\Views\Types.cshtml"
                    Write(typeof(OperationSymbol).NiceName());


            #line default
            #line hidden
                    WriteLiteral("\r\n                    </th>\r\n");


            #line 54 "..\..\AuthAdmin\Views\Types.cshtml"
                }


            #line default
            #line hidden
                WriteLiteral("                ");


            #line 55 "..\..\AuthAdmin\Views\Types.cshtml"
                if (queryRules)
                {
            #line default
            #line hidden
                    WriteLiteral("                    <th>");


            #line 57 "..\..\AuthAdmin\Views\Types.cshtml"
                    Write(typeof(QueryEntity).NiceName());


            #line default
            #line hidden
                    WriteLiteral("\r\n                    </th>\r\n");


            #line 59 "..\..\AuthAdmin\Views\Types.cshtml"
                }


            #line default
            #line hidden
                WriteLiteral("            </tr>\r\n        </thead>\r\n");


            #line 62 "..\..\AuthAdmin\Views\Types.cshtml"


            #line default
            #line hidden

            #line 62 "..\..\AuthAdmin\Views\Types.cshtml"
                foreach (var iter in tc.TypeElementContext(p => p.Rules).GroupBy(a => a.Value.Resource.Namespace).OrderBy(a => a.Key).Iterate())
                {
            #line default
            #line hidden
                    WriteLiteral("            <tr>\r\n                <td");

                    WriteLiteral(" colspan=\"6\"");

                    WriteLiteral(">\r\n                    <a");

                    WriteLiteral(" class=\"sf-auth-namespace\"");

                    WriteLiteral("><span");

                    WriteAttribute("class", Tuple.Create(" class=\"", 2624), Tuple.Create("\"", 2706)
                                   , Tuple.Create(Tuple.Create("", 2632), Tuple.Create("sf-auth-tree", 2632), true)

            #line 66 "..\..\AuthAdmin\Views\Types.cshtml"
                                   , Tuple.Create(Tuple.Create(" ", 2644), Tuple.Create <System.Object, System.Int32>(iter.IsLast ? "sf-auth-expanded-last" : "sf-auth-expanded"

            #line default
            #line hidden
                                                                                                                      , 2645), false)
                                   );

                    WriteLiteral("></span>\r\n                        <img");

                    WriteAttribute("src", Tuple.Create(" src=\"", 2745), Tuple.Create("\"", 2799)

            #line 67 "..\..\AuthAdmin\Views\Types.cshtml"
                                   , Tuple.Create(Tuple.Create("", 2751), Tuple.Create <System.Object, System.Int32>(Url.Content("~/authAdmin/Images/namespace.png")

            #line default
            #line hidden
                                                                                                                     , 2751), false)
                                   );

                    WriteLiteral(" />\r\n                        <span");

                    WriteLiteral(" class=\"sf-auth-namespace-name\"");

                    WriteLiteral(">");


            #line 68 "..\..\AuthAdmin\Views\Types.cshtml"
                    Write(iter.Value.Key);


            #line default
            #line hidden
                    WriteLiteral("</span> </a>\r\n                </td>\r\n            </tr>\r\n");


            #line 71 "..\..\AuthAdmin\Views\Types.cshtml"
                    foreach (var iter2 in iter.Value.OrderBy(a => a.Value.Resource.CleanName).Iterate())
                    {
                        var item = iter2.Value;
                        var type = item.Value.Resource.ToType();
                        var attr = EntityKindCache.GetAttribute(type);


            #line default
            #line hidden
                        WriteLiteral("            <tr");

                        WriteLiteral(" class=\"sf-auth-type\"");

                        WriteLiteral(" data-ns=\"");


            #line 76 "..\..\AuthAdmin\Views\Types.cshtml"
                        Write(iter.Value.Key);


            #line default
            #line hidden
                        WriteLiteral("\"");

                        WriteLiteral(" ");


            #line 76 "..\..\AuthAdmin\Views\Types.cshtml"
                        Write(Html.Raw(item.Value.AvailableConditions.Any() ? ("data-type=\"" + item.Value.Resource.ClassName + "\"") : ""));


            #line default
            #line hidden
                        WriteLiteral(">\r\n                <td>\r\n                    <div");

                        WriteAttribute("class", Tuple.Create(" class=\"", 3438), Tuple.Create("\"", 3508)
                                       , Tuple.Create(Tuple.Create("", 3446), Tuple.Create("sf-auth-tree", 3446), true)

            #line 78 "..\..\AuthAdmin\Views\Types.cshtml"
                                       , Tuple.Create(Tuple.Create(" ", 3458), Tuple.Create <System.Object, System.Int32>(iter.IsLast ? "sf-auth-blank" : "sf-auth-line"

            #line default
            #line hidden
                                                                                                                          , 3459), false)
                                       );

                        WriteLiteral(">\r\n                    </div>\r\n                    <div");

                        WriteAttribute("class", Tuple.Create(" class=\"", 3564), Tuple.Create("\"", 3639)
                                       , Tuple.Create(Tuple.Create("", 3572), Tuple.Create("sf-auth-tree", 3572), true)

            #line 80 "..\..\AuthAdmin\Views\Types.cshtml"
                                       , Tuple.Create(Tuple.Create(" ", 3584), Tuple.Create <System.Object, System.Int32>(iter2.IsLast ? "sf-auth-leaf-last" : "sf-auth-leaf"

            #line default
            #line hidden
                                                                                                                          , 3585), false)
                                       );

                        WriteLiteral(">\r\n                    </div>\r\n");


            #line 82 "..\..\AuthAdmin\Views\Types.cshtml"


            #line default
            #line hidden

            #line 82 "..\..\AuthAdmin\Views\Types.cshtml"
                        if (!item.Value.AvailableConditions.IsNullOrEmpty())
                        {
            #line default
            #line hidden
                            WriteLiteral("                        <a");

                            WriteAttribute("title", Tuple.Create(" title=\"", 3821), Tuple.Create("\"", 3879)

            #line 85 "..\..\AuthAdmin\Views\Types.cshtml"
                                           , Tuple.Create(Tuple.Create("", 3829), Tuple.Create <System.Object, System.Int32>(AuthMessage.AuthAdmin_AddCondition.NiceToString()

            #line default
            #line hidden
                                                                                                                             , 3829), false)
                                           );

                            WriteLiteral(" class=\"sf-line-button sf-create sf-auth-condition-button\"");

                            WriteAttribute("style", Tuple.Create(" \r\n                            style=\"", 3938), Tuple.Create("\"", 4076)

            #line 86 "..\..\AuthAdmin\Views\Types.cshtml"
                                           , Tuple.Create(Tuple.Create("", 3976), Tuple.Create <System.Object, System.Int32>(item.Value.Allowed.Conditions.Count == item.Value.AvailableConditions.Count ? "display:none" : ""

            #line default
            #line hidden
                                                                                                                             , 3976), false)
                                           );

                            WriteLiteral(">\r\n                            <span");

                            WriteLiteral(" class=\"glyphicon glyphicon-plus\"");

                            WriteLiteral("></span></a>\r\n");


            #line 88 "..\..\AuthAdmin\Views\Types.cshtml"



            #line default
            #line hidden
                            WriteLiteral("                        <input");

                            WriteLiteral(" type=\"hidden\"");

                            WriteLiteral(" disabled=\"disabled\"");

                            WriteLiteral(" class=\"sf-auth-available-conditions\"");

                            WriteAttribute("value", Tuple.Create(" value=\"", 4287), Tuple.Create("\"", 4395)

            #line 89 "..\..\AuthAdmin\Views\Types.cshtml"
                                           , Tuple.Create(Tuple.Create("", 4295), Tuple.Create <System.Object, System.Int32>(item.Value.AvailableConditions.ToString(ac => "{0}|{1}".FormatWith(ac.Key, ac.NiceToString()), ",")

            #line default
            #line hidden
                                                                                                                             , 4295), false)
                                           );

                            WriteLiteral(" />\r\n");


            #line 90 "..\..\AuthAdmin\Views\Types.cshtml"
                        }


            #line default
            #line hidden
                        WriteLiteral("                    <span");

                        WriteLiteral(" class=\"sf-auth-label\"");

                        WriteLiteral(">");


            #line 91 "..\..\AuthAdmin\Views\Types.cshtml"
                        Write(type.NiceName());


            #line default
            #line hidden
                        WriteLiteral("</span> <small>");


            #line 91 "..\..\AuthAdmin\Views\Types.cshtml"
                        Write(attr.EntityKind);


            #line default
            #line hidden
                        WriteLiteral("/");


            #line 91 "..\..\AuthAdmin\Views\Types.cshtml"
                        Write(attr.EntityData);


            #line default
            #line hidden
                        WriteLiteral("</small>\r\n");

                        WriteLiteral("                    ");


            #line 92 "..\..\AuthAdmin\Views\Types.cshtml"
                        Write(Html.HiddenRuntimeInfo(item, i => i.Resource));


            #line default
            #line hidden
                        WriteLiteral("\r\n");

                        WriteLiteral("                    ");


            #line 93 "..\..\AuthAdmin\Views\Types.cshtml"
                        Write(Html.Hidden(item.Compose("AllowedBase"), (item.Value.AllowedBase.Fallback?.ToStringParts() ?? "Error") + (item.Value.AllowedBase.Conditions.IsEmpty() ? "" : (";" + item.Value.AllowedBase.Conditions.ToString(a => "{0}-{1}".FormatWith(a.TypeCondition.Key, a.Allowed.ToStringParts()), ";")))));


            #line default
            #line hidden
                        WriteLiteral("\r\n                </td>\r\n");


            #line 95 "..\..\AuthAdmin\Views\Types.cshtml"


            #line default
            #line hidden

            #line 95 "..\..\AuthAdmin\Views\Types.cshtml"
                        using (var fallback = item.SubContext(a => a.Allowed.Fallback))
                        {
            #line default
            #line hidden
                            WriteLiteral("                    <td>\r\n                        <a");

                            WriteLiteral(" class=\"sf-auth-chooser sf-auth-create\"");

                            WriteLiteral(">\r\n");

                            WriteLiteral("                            ");


            #line 99 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(Html.CheckBox(fallback.Compose("Create"), fallback.Value.HasValue && fallback.Value.Value.IsActive(TypeAllowedBasic.Create), new Dictionary <string, object> {
                                { "data-tag", "Create" }
                            }));


            #line default
            #line hidden
                            WriteLiteral("\r\n                        </a>\r\n                    </td>\r\n");

                            WriteLiteral("                    <td>\r\n                        <a");

                            WriteLiteral(" class=\"sf-auth-chooser sf-auth-modify\"");

                            WriteLiteral(">\r\n");

                            WriteLiteral("                            ");


            #line 104 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(Html.CheckBox(fallback.Compose("Modify"), fallback.Value.HasValue && fallback.Value.Value.IsActive(TypeAllowedBasic.Modify), new Dictionary <string, object> {
                                { "data-tag", "Modify" }
                            }));


            #line default
            #line hidden
                            WriteLiteral("\r\n                        </a>\r\n                    </td>\r\n");

                            WriteLiteral("                    <td>\r\n                        <a");

                            WriteLiteral(" class=\"sf-auth-chooser sf-auth-read\"");

                            WriteLiteral(">\r\n");

                            WriteLiteral("                            ");


            #line 109 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(Html.CheckBox(fallback.Compose("Read"), fallback.Value.HasValue && fallback.Value.Value.IsActive(TypeAllowedBasic.Read), new Dictionary <string, object> {
                                { "data-tag", "Read" }
                            }));


            #line default
            #line hidden
                            WriteLiteral("\r\n                        </a>\r\n                    </td>\r\n");

                            WriteLiteral("                    <td>\r\n                        <a");

                            WriteLiteral(" class=\"sf-auth-chooser sf-auth-none\"");

                            WriteLiteral(">\r\n");

                            WriteLiteral("                            ");


            #line 114 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(Html.CheckBox(fallback.Compose("None"), fallback.Value.HasValue && fallback.Value.Value.IsActive(TypeAllowedBasic.None), new Dictionary <string, object> {
                                { "data-tag", "None" }
                            }));


            #line default
            #line hidden
                            WriteLiteral("\r\n                        </a>\r\n                    </td>\r\n");


            #line 117 "..\..\AuthAdmin\Views\Types.cshtml"
                        }


            #line default
            #line hidden
                        WriteLiteral("                <td");

                        WriteLiteral(" class=\"sf-auth-type-only\"");

                        WriteLiteral(">\r\n");

                        WriteLiteral("                    ");


            #line 119 "..\..\AuthAdmin\Views\Types.cshtml"
                        Write(Html.CheckBox(item.Compose("Overriden"), item.Value.Overriden, new { disabled = "disabled", @class = "sf-auth-overriden" }));


            #line default
            #line hidden
                        WriteLiteral("\r\n                </td>\r\n");


            #line 121 "..\..\AuthAdmin\Views\Types.cshtml"


            #line default
            #line hidden

            #line 121 "..\..\AuthAdmin\Views\Types.cshtml"
                        if (propertyRules)
                        {
            #line default
            #line hidden
                            WriteLiteral("                    <td");

                            WriteLiteral(" class=\"sf-auth-type-only\"");

                            WriteLiteral(">\r\n");


            #line 124 "..\..\AuthAdmin\Views\Types.cshtml"


            #line default
            #line hidden

            #line 124 "..\..\AuthAdmin\Views\Types.cshtml"
                            if (item.Value.Properties.HasValue)
                            {
            #line default
            #line hidden
                                WriteLiteral("                            <div");

                                WriteLiteral(" class=\"sf-auth-property\"");

                                WriteLiteral(">\r\n                                <a");

                                WriteLiteral(" class=\"sf-submodule-trigger\"");

                                WriteAttribute("href", Tuple.Create(" href=\"", 7058), Tuple.Create("\"", 7162)

            #line 127 "..\..\AuthAdmin\Views\Types.cshtml"
                                               , Tuple.Create(Tuple.Create("", 7065), Tuple.Create <System.Object, System.Int32>(Url.Action((AuthAdminController a) => a.Properties(tc.Value.Role, item.Value.Resource.ToLite()))

            #line default
            #line hidden
                                                                                                                                 , 7065), false)
                                               );

                                WriteLiteral(">\r\n                                    <span");

                                WriteAttribute("class", Tuple.Create(" class=\"", 7207), Tuple.Create("\"", 7280)
                                               , Tuple.Create(Tuple.Create("", 7215), Tuple.Create("sf-auth-thumb", 7215), true)
                                               , Tuple.Create(Tuple.Create(" ", 7228), Tuple.Create("sf-auth-", 7229), true)

            #line 128 "..\..\AuthAdmin\Views\Types.cshtml"
                                               , Tuple.Create(Tuple.Create("", 7237), Tuple.Create <System.Object, System.Int32>(item.Value.Properties.ToString().ToLower()

            #line default
            #line hidden
                                                                                                                                 , 7237), false)
                                               );

                                WriteLiteral("></span></a>\r\n                            </div>\r\n");


            #line 130 "..\..\AuthAdmin\Views\Types.cshtml"
                            }


            #line default
            #line hidden
                            WriteLiteral("                    </td>\r\n");


            #line 132 "..\..\AuthAdmin\Views\Types.cshtml"
                        }


            #line default
            #line hidden
                        WriteLiteral("                ");


            #line 133 "..\..\AuthAdmin\Views\Types.cshtml"
                        if (operationRules)
                        {
            #line default
            #line hidden
                            WriteLiteral("                    <td");

                            WriteLiteral(" class=\"sf-auth-type-only\"");

                            WriteLiteral(">\r\n");


            #line 136 "..\..\AuthAdmin\Views\Types.cshtml"


            #line default
            #line hidden

            #line 136 "..\..\AuthAdmin\Views\Types.cshtml"
                            if (item.Value.Operations.HasValue)
                            {
            #line default
            #line hidden
                                WriteLiteral("                            <div");

                                WriteLiteral(" class=\"sf-auth-operation\"");

                                WriteLiteral(">\r\n                                <a");

                                WriteLiteral(" class=\"sf-submodule-trigger\"");

                                WriteAttribute("href", Tuple.Create(" href=\"", 7726), Tuple.Create("\"", 7830)

            #line 139 "..\..\AuthAdmin\Views\Types.cshtml"
                                               , Tuple.Create(Tuple.Create("", 7733), Tuple.Create <System.Object, System.Int32>(Url.Action((AuthAdminController a) => a.Operations(tc.Value.Role, item.Value.Resource.ToLite()))

            #line default
            #line hidden
                                                                                                                                 , 7733), false)
                                               );

                                WriteLiteral(">\r\n                                    <span");

                                WriteAttribute("class", Tuple.Create(" class=\"", 7875), Tuple.Create("\"", 7948)
                                               , Tuple.Create(Tuple.Create("", 7883), Tuple.Create("sf-auth-thumb", 7883), true)
                                               , Tuple.Create(Tuple.Create(" ", 7896), Tuple.Create("sf-auth-", 7897), true)

            #line 140 "..\..\AuthAdmin\Views\Types.cshtml"
                                               , Tuple.Create(Tuple.Create("", 7905), Tuple.Create <System.Object, System.Int32>(item.Value.Operations.ToString().ToLower()

            #line default
            #line hidden
                                                                                                                                 , 7905), false)
                                               );

                                WriteLiteral("></span></a>\r\n                            </div>\r\n");


            #line 142 "..\..\AuthAdmin\Views\Types.cshtml"
                            }


            #line default
            #line hidden
                            WriteLiteral("                    </td>\r\n");


            #line 144 "..\..\AuthAdmin\Views\Types.cshtml"
                        }


            #line default
            #line hidden
                        WriteLiteral("                ");


            #line 145 "..\..\AuthAdmin\Views\Types.cshtml"
                        if (queryRules)
                        {
            #line default
            #line hidden
                            WriteLiteral("                    <td");

                            WriteLiteral(" class=\"sf-auth-type-only\"");

                            WriteLiteral(">\r\n");


            #line 148 "..\..\AuthAdmin\Views\Types.cshtml"


            #line default
            #line hidden

            #line 148 "..\..\AuthAdmin\Views\Types.cshtml"
                            if (item.Value.Queries.HasValue)
                            {
            #line default
            #line hidden
                                WriteLiteral("                            <div");

                                WriteLiteral(" class=\"sf-auth-query\"");

                                WriteLiteral(">\r\n                                <a");

                                WriteLiteral(" class=\"sf-submodule-trigger\"");

                                WriteAttribute("href", Tuple.Create(" href=\"", 8383), Tuple.Create("\"", 8484)

            #line 151 "..\..\AuthAdmin\Views\Types.cshtml"
                                               , Tuple.Create(Tuple.Create("", 8390), Tuple.Create <System.Object, System.Int32>(Url.Action((AuthAdminController a) => a.Queries(tc.Value.Role, item.Value.Resource.ToLite()))

            #line default
            #line hidden
                                                                                                                                 , 8390), false)
                                               );

                                WriteLiteral(">\r\n                                    <span");

                                WriteAttribute("class", Tuple.Create(" class=\"", 8529), Tuple.Create("\"", 8599)
                                               , Tuple.Create(Tuple.Create("", 8537), Tuple.Create("sf-auth-thumb", 8537), true)
                                               , Tuple.Create(Tuple.Create(" ", 8550), Tuple.Create("sf-auth-", 8551), true)

            #line 152 "..\..\AuthAdmin\Views\Types.cshtml"
                                               , Tuple.Create(Tuple.Create("", 8559), Tuple.Create <System.Object, System.Int32>(item.Value.Queries.ToString().ToLower()

            #line default
            #line hidden
                                                                                                                                 , 8559), false)
                                               );

                                WriteLiteral("></span>\r\n                                </a>\r\n                            </div" +
                                             ">\r\n");


            #line 155 "..\..\AuthAdmin\Views\Types.cshtml"
                            }


            #line default
            #line hidden
                            WriteLiteral("                    </td>\r\n");


            #line 157 "..\..\AuthAdmin\Views\Types.cshtml"
                        }


            #line default
            #line hidden
                        WriteLiteral("            </tr>\r\n");


            #line 159 "..\..\AuthAdmin\Views\Types.cshtml"
                        var conditions = item.Compose("Allowed", "Conditions");

                        foreach (var conditionIter in item.Value.Allowed.Conditions.Select((c, i) => new { Condition = c, Index = i, Prefix = TypeContextUtilities.Compose(conditions, i.ToString()) }).Iterate())
                        {
                            var condition = conditionIter.Value.Condition;
                            var prefix    = conditionIter.Value.Prefix;



            #line default
            #line hidden
                            WriteLiteral("            <tr");

                            WriteLiteral(" class=\"sf-auth-condition\"");

                            WriteLiteral(" data-ns=\"");


            #line 166 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(iter.Value.Key);


            #line default
            #line hidden
                            WriteLiteral("\"");

                            WriteLiteral(" data-type=\"");


            #line 166 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(item.Value.Resource.ClassName);


            #line default
            #line hidden
                            WriteLiteral("\"");

                            WriteLiteral(" data-condition=\"");


            #line 166 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(condition.TypeCondition.Key);


            #line default
            #line hidden
                            WriteLiteral("\"");

                            WriteLiteral(" data-index=\"");


            #line 166 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(conditionIter.Value.Index);


            #line default
            #line hidden
                            WriteLiteral("\"");

                            WriteLiteral(">\r\n                <td>\r\n                    <div");

                            WriteAttribute("class", Tuple.Create(" class=\"", 9475), Tuple.Create("\"", 9545)
                                           , Tuple.Create(Tuple.Create("", 9483), Tuple.Create("sf-auth-tree", 9483), true)

            #line 168 "..\..\AuthAdmin\Views\Types.cshtml"
                                           , Tuple.Create(Tuple.Create(" ", 9495), Tuple.Create <System.Object, System.Int32>(iter.IsLast ? "sf-auth-blank" : "sf-auth-line"

            #line default
            #line hidden
                                                                                                                              , 9496), false)
                                           );

                            WriteLiteral(">\r\n                    </div>\r\n                    <div");

                            WriteAttribute("class", Tuple.Create(" class=\"", 9601), Tuple.Create("\"", 9672)
                                           , Tuple.Create(Tuple.Create("", 9609), Tuple.Create("sf-auth-tree", 9609), true)

            #line 170 "..\..\AuthAdmin\Views\Types.cshtml"
                                           , Tuple.Create(Tuple.Create(" ", 9621), Tuple.Create <System.Object, System.Int32>(iter2.IsLast ? "sf-auth-blank" : "sf-auth-line"

            #line default
            #line hidden
                                                                                                                              , 9622), false)
                                           );

                            WriteLiteral(">\r\n                    </div>\r\n                    <div");

                            WriteAttribute("class", Tuple.Create(" class=\"", 9728), Tuple.Create("\"", 9811)
                                           , Tuple.Create(Tuple.Create("", 9736), Tuple.Create("sf-auth-tree", 9736), true)

            #line 172 "..\..\AuthAdmin\Views\Types.cshtml"
                                           , Tuple.Create(Tuple.Create(" ", 9748), Tuple.Create <System.Object, System.Int32>(conditionIter.IsLast ? "sf-auth-leaf-last" : "sf-auth-leaf"

            #line default
            #line hidden
                                                                                                                              , 9749), false)
                                           );

                            WriteLiteral(">\r\n                    </div>\r\n                    <a");

                            WriteLiteral(" class=\"sf-line-button sf-remove sf-auth-condition-button\"");

                            WriteAttribute("title", Tuple.Create(" title=\"", 9923), Tuple.Create("\"", 9986)

            #line 174 "..\..\AuthAdmin\Views\Types.cshtml"
                                           , Tuple.Create(Tuple.Create("", 9931), Tuple.Create <System.Object, System.Int32>(AuthMessage.AuthAdmin_RemoveCondition.NiceToString()

            #line default
            #line hidden
                                                                                                                             , 9931), false)
                                           );

                            WriteLiteral(">\r\n                        <span");

                            WriteLiteral(" class=\"glyphicon glyphicon-remove\"");

                            WriteLiteral("></span></a>\r\n                    <span");

                            WriteLiteral(" class=\"sf-auth-label\"");

                            WriteLiteral(">");


            #line 176 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(condition.TypeCondition.NiceToString());


            #line default
            #line hidden
                            WriteLiteral("</span>\r\n");

                            WriteLiteral("                    ");


            #line 177 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(Html.Hidden(TypeContextUtilities.Compose(prefix, "ConditionName"), condition.TypeCondition.Key));


            #line default
            #line hidden
                            WriteLiteral("\r\n                </td>\r\n\r\n");


            #line 180 "..\..\AuthAdmin\Views\Types.cshtml"


            #line default
            #line hidden

            #line 180 "..\..\AuthAdmin\Views\Types.cshtml"
                            var allowed = TypeContextUtilities.Compose(prefix, "Allowed");

            #line default
            #line hidden
                            WriteLiteral("\r\n\r\n                <td>\r\n                    <a");

                            WriteLiteral(" class=\"sf-auth-chooser sf-auth-create\"");

                            WriteLiteral(">\r\n");

                            WriteLiteral("                        ");


            #line 184 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(Html.CheckBox(TypeContextUtilities.Compose(allowed, "Create"), condition.Allowed.IsActive(TypeAllowedBasic.Create), new Dictionary <string, object> {
                                { "data-tag", "Create" }
                            }));


            #line default
            #line hidden
                            WriteLiteral("\r\n                    </a>\r\n                </td>\r\n                <td>\r\n        " +
                                         "            <a");

                            WriteLiteral(" class=\"sf-auth-chooser sf-auth-modify\"");

                            WriteLiteral(">\r\n");

                            WriteLiteral("                        ");


            #line 189 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(Html.CheckBox(TypeContextUtilities.Compose(allowed, "Modify"), condition.Allowed.IsActive(TypeAllowedBasic.Modify), new Dictionary <string, object> {
                                { "data-tag", "Modify" }
                            }));


            #line default
            #line hidden
                            WriteLiteral("\r\n                    </a>\r\n                </td>\r\n                <td>\r\n        " +
                                         "            <a");

                            WriteLiteral(" class=\"sf-auth-chooser sf-auth-read\"");

                            WriteLiteral(">\r\n");

                            WriteLiteral("                        ");


            #line 194 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(Html.CheckBox(TypeContextUtilities.Compose(allowed, "Read"), condition.Allowed.IsActive(TypeAllowedBasic.Read), new Dictionary <string, object> {
                                { "data-tag", "Read" }
                            }));


            #line default
            #line hidden
                            WriteLiteral("\r\n                    </a>\r\n                </td>\r\n                <td>\r\n        " +
                                         "            <a");

                            WriteLiteral(" class=\"sf-auth-chooser sf-auth-none\"");

                            WriteLiteral(">\r\n");

                            WriteLiteral("                        ");


            #line 199 "..\..\AuthAdmin\Views\Types.cshtml"
                            Write(Html.CheckBox(TypeContextUtilities.Compose(allowed, "None"), condition.Allowed.IsActive(TypeAllowedBasic.None), new Dictionary <string, object> {
                                { "data-tag", "None" }
                            }));


            #line default
            #line hidden
                            WriteLiteral("\r\n                    </a>\r\n                </td>\r\n\r\n                <td");

                            WriteAttribute("colspan", Tuple.Create(" colspan=\"", 11749), Tuple.Create("\"", 11839)

            #line 203 "..\..\AuthAdmin\Views\Types.cshtml"
                                           , Tuple.Create(Tuple.Create("", 11759), Tuple.Create <System.Object, System.Int32>(1 + (propertyRules ? 1 : 0) + (operationRules ? 1 : 0) + (queryRules ? 1 : 0)

            #line default
            #line hidden
                                                                                                                              , 11759), false)
                                           );

                            WriteLiteral("></td>\r\n            </tr>\r\n");


            #line 205 "..\..\AuthAdmin\Views\Types.cshtml"
                        }
                    }
                }


            #line default
            #line hidden
                WriteLiteral("    </table>\r\n");


            #line 209 "..\..\AuthAdmin\Views\Types.cshtml"
            }


            #line default
            #line hidden
        }
Example #16
0
        public override void Execute()
        {
            #line 6 "..\..\Dashboard\Views\PanelPartView.cshtml"

            string prefix = "r{0}c{1}".FormatWith(Model.Row, Model.StartColumn);
            DashboardClient.PartViews config = DashboardClient.PanelPartViews[Model.Content.GetType()];
            var link = config.TitleLink == null ? null : config.TitleLink(Model.Content);


            #line default
            #line hidden
            WriteLiteral("\r\n<div");

            WriteAttribute("class", Tuple.Create(" class=\"", 387), Tuple.Create("\"", 440)
                           , Tuple.Create(Tuple.Create("", 395), Tuple.Create("panel", 395), true)
                           , Tuple.Create(Tuple.Create(" ", 400), Tuple.Create("panel-", 401), true)

            #line 11 "..\..\Dashboard\Views\PanelPartView.cshtml"
                           , Tuple.Create(Tuple.Create("", 407), Tuple.Create <System.Object, System.Int32>(Model.Style.ToString().ToLower()

            #line default
            #line hidden
                                                                                                            , 407), false)
                           );

            WriteLiteral(">\r\n    <div");

            WriteLiteral(" class=\"panel-heading\"");

            WriteLiteral(">\r\n");


            #line 13 "..\..\Dashboard\Views\PanelPartView.cshtml"


            #line default
            #line hidden

            #line 13 "..\..\Dashboard\Views\PanelPartView.cshtml"
            if (link == null)
            {
            #line default
            #line hidden

            #line 15 "..\..\Dashboard\Views\PanelPartView.cshtml"
                Write(Model.ToString());


            #line default
            #line hidden

            #line 15 "..\..\Dashboard\Views\PanelPartView.cshtml"
            }
            else
            {
            #line default
            #line hidden
                WriteLiteral("            <a");

                WriteAttribute("href", Tuple.Create(" href=\"", 597), Tuple.Create("\"", 609)

            #line 19 "..\..\Dashboard\Views\PanelPartView.cshtml"
                               , Tuple.Create(Tuple.Create("", 604), Tuple.Create <System.Object, System.Int32>(link

            #line default
            #line hidden
                                                                                                                , 604), false)
                               );

                WriteLiteral(">");


            #line 19 "..\..\Dashboard\Views\PanelPartView.cshtml"
                Write(Model.ToString());


            #line default
            #line hidden
                WriteLiteral("</a>\r\n");


            #line 20 "..\..\Dashboard\Views\PanelPartView.cshtml"
            }


            #line default
            #line hidden
            WriteLiteral("        ");


            #line 21 "..\..\Dashboard\Views\PanelPartView.cshtml"
            if (config.HasFullScreenLink)
            {
            #line default
            #line hidden
                WriteLiteral("            <a");

                WriteAttribute("id", Tuple.Create(" id=\"", 710), Tuple.Create("\"", 768)

            #line 23 "..\..\Dashboard\Views\PanelPartView.cshtml"
                               , Tuple.Create(Tuple.Create("", 715), Tuple.Create <System.Object, System.Int32>(TypeContextUtilities.Compose(prefix, "sfFullScreen")

            #line default
            #line hidden
                                                                                                                , 715), false)
                               );

                WriteLiteral(" class=\"sf-ftbl-header-fullscreen\"");

                WriteLiteral(" href=\"#\"");

                WriteLiteral(">\r\n                <span");

                WriteLiteral(" class=\"glyphicon glyphicon-new-window\"");

                WriteLiteral("></span>\r\n            </a>\r\n");


            #line 26 "..\..\Dashboard\Views\PanelPartView.cshtml"
            }


            #line default
            #line hidden
            WriteLiteral("    </div>\r\n\r\n    <div");

            WriteLiteral(" class=\"panel-body\"");

            WriteLiteral(">\r\n");


            #line 30 "..\..\Dashboard\Views\PanelPartView.cshtml"


            #line default
            #line hidden

            #line 30 "..\..\Dashboard\Views\PanelPartView.cshtml"
            Html.RenderPartial(config.FrontEndView, TypeContextUtilities.UntypedNew(Model.Content, prefix));

            #line default
            #line hidden
            WriteLiteral("\r\n    </div>\r\n\r\n</div>\r\n");
        }
Example #17
0
        public JsonNetResult UploadDropped()
        {
            string prefix = Request.Headers["X-Prefix"];

            RuntimeInfo info = RuntimeInfo.FromFormValue((string)Request.Headers["X-" + TypeContextUtilities.Compose(prefix, EntityBaseKeys.RuntimeInfo)]);

            string fileName = Request.Headers["X-FileName"];

            byte[] bytes               = Request.InputStream.ReadAllBytes();
            string fileType            = (string)Request.Headers["X-" + FileLineKeys.FileType];
            string calculatedDirectory = (string)Request.Headers["X-" + FileLineKeys.CalculatedDirectory];

            IFile file = FilesClient.ConstructFile(info.EntityType, new UploadedFileData
            {
                FileName            = fileName,
                Content             = bytes,
                FileType            = fileType,
                CalculatedDirectory = calculatedDirectory
            });

            RuntimeInfo ri = file is EmbeddedEntity ? new RuntimeInfo((EmbeddedEntity)file) : new RuntimeInfo((IEntity)file);

            return(this.JsonNet(new
            {
                file.FileName,
                FullWebPath = FilesClient.GetDownloadUrl(file),
                RuntimeInfo = ri.ToString(),
                EntityState = info.EntityType.IsEmbeddedEntity() ? Navigator.Manager.SerializeEntity((EmbeddedEntity)file) : null,
            }));
        }