Esempio n. 1
0
 /// <summary>
 /// Fixed:
 /// </summary>
 public SysLogModel(string errorMessage)
 {
     Class      = Routes.Controller();
     Method     = Routes.Action();
     ErrMessage = errorMessage;
     WriteSysLog();
 }
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "MailAddresses_OwnerId": OwnerId = Forms.Data(controlId).ToLong(); break;

                case "MailAddresses_OwnerType": OwnerType = Forms.Data(controlId).ToString(); break;

                case "MailAddresses_MailAddress": MailAddress = Forms.Data(controlId).ToString(); break;

                case "MailAddresses_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments = Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default: break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Esempio n. 3
0
        public string ToNotice(string saved, Column column, bool updated, bool update)
        {
            var body = string.Empty;

            if (Routes.Action() == "deletecomment")
            {
                body = Displays.CommentDeleted() + "\n";
            }
            if (this.Any())
            {
                body += this.FirstOrDefault(o => o.Created)?
                        .Body
                        .ToNoticeLine(
                    string.Empty,
                    column,
                    updated,
                    update);
                this.Where(o => o.Updated).ForEach(comment =>
                                                   body += comment.Body
                                                           .ToNoticeLine(
                                                       string.Empty,
                                                       column,
                                                       updated,
                                                       update,
                                                       Displays.CommentUpdated()));
                return(body);
            }
            else
            {
                return(string.Empty);
            }
        }
Esempio n. 4
0
        public void SetByForm(SiteSettings ss)
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Depts_DeptCode": DeptCode = Forms.Data(controlId).ToString(); break;

                case "Depts_DeptName": DeptName = Forms.Data(controlId).ToString(); break;

                case "Depts_Body": Body = Forms.Data(controlId).ToString(); break;

                case "Depts_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments = Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default: break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Esempio n. 5
0
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Binaries_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Esempio n. 6
0
 /// <summary>
 /// Fixed:
 /// </summary>
 public SysLogModel(Exception e)
 {
     Class         = Routes.Controller();
     Method        = Routes.Action();
     ErrMessage    = e.Message;
     ErrStackTrace = e.StackTrace;
     WriteSysLog();
 }
Esempio n. 7
0
 private static HtmlBuilder NavigationMenu(
     this HtmlBuilder hb,
     SiteSettings ss,
     long siteId,
     string referenceType,
     bool useNavigationMenu)
 {
     return(hb.Ul(
                id: "NavigationMenu",
                action: () => hb
                .Li(
                    action: () => hb
                    .Div(action: () => hb
                         .A(
                             href: NewHref(ss),
                             attributes: SiteIndex(ss)
                                 ? new HtmlAttributes()
                             .OnClick("$p.openTemplateDialog($(this));")
                             .DataAction("OpenTemplateDialog")
                             .DataMethod("post")
                                 : null,
                             action: () => hb
                             .Span(css: "ui-icon ui-icon-plus")
                             .Text(text: Displays.New()))),
                    _using: ss.ReferenceType == "Sites" && Routes.Action() == "index"
                     ? ss.CanManageSite()
                     : ss.CanCreate() && ss.ReferenceType != "Wikis")
                .Li(
                    css: "sub-menu",
                    action: () => hb
                    .Div(
                        attributes: new HtmlAttributes().DataId("ViewModeMenu"),
                        action: () => hb
                        .Span(css: "ui-icon ui-icon-triangle-1-e")
                        .Text(text: Displays.View()))
                    .ViewModeMenu(ss: ss),
                    _using: Def.ViewModeDefinitionCollection
                    .Any(o => o.ReferenceType == referenceType))
                .Li(
                    css: "sub-menu",
                    action: () => hb
                    .Div(
                        attributes: new HtmlAttributes().DataId("SettingsMenu"),
                        action: () => hb
                        .Span(css: "ui-icon ui-icon-gear")
                        .Text(text: Displays.Setting()))
                    .SettingsMenu(siteId: siteId, ss: ss))
                .Li(
                    css: "sub-menu",
                    action: () => hb
                    .Div(
                        attributes: new HtmlAttributes().DataId("AccountMenu"),
                        action: () => hb
                        .Span(css: "ui-icon ui-icon-person")
                        .Text(text: SiteInfo.UserName((
                                                          Sessions.UserId()))))
                    .AccountMenu())));
 }
Esempio n. 8
0
        private int DisplayCount()
        {
            switch (Routes.Action())
            {
            case "histories": return(1);

            default: return(3);
            }
        }
Esempio n. 9
0
        private static string ViewModeTemplate(
            this HtmlBuilder hb,
            SiteSettings ss,
            GridData gridData,
            View view,
            string viewMode,
            Action viewModeBody)
        {
            var invalid = GroupValidators.OnEntry(ss);

            switch (invalid)
            {
            case Error.Types.None: break;

            default: return(HtmlTemplates.Error(invalid));
            }
            return(hb.Template(
                       ss: ss,
                       verType: Versions.VerTypes.Latest,
                       methodType: BaseModel.MethodTypes.Index,
                       siteId: ss.SiteId,
                       parentId: ss.ParentId,
                       referenceType: "Groups",
                       script: Libraries.Scripts.JavaScripts.ViewMode(viewMode),
                       userScript: ss.ViewModeScripts(Routes.Action()),
                       userStyle: ss.ViewModeStyles(Routes.Action()),
                       action: () => hb
                       .Form(
                           attributes: new HtmlAttributes()
                           .Id("GroupsForm")
                           .Class("main-form")
                           .Action(Locations.ItemAction(ss.SiteId)),
                           action: () => hb
                           .ViewSelector(ss: ss, view: view)
                           .ViewFilters(ss: ss, view: view)
                           .Aggregations(
                               ss: ss,
                               aggregations: gridData.Aggregations)
                           .Div(id: "ViewModeContainer", action: () => viewModeBody())
                           .MainCommands(
                               ss: ss,
                               siteId: ss.SiteId,
                               verType: Versions.VerTypes.Latest,
                               bulkMoveButton: true,
                               bulkDeleteButton: true,
                               importButton: true,
                               exportButton: true)
                           .Div(css: "margin-bottom")
                           .Hidden(controlId: "TableName", value: "Groups")
                           .Hidden(controlId: "BaseUrl", value: Locations.BaseUrl()))
                       .MoveDialog(bulk: true)
                       .Div(attributes: new HtmlAttributes()
                            .Id("ExportSelectorDialog")
                            .Class("dialog")
                            .Title(Displays.Export())))
                   .ToString());
        }
Esempio n. 10
0
 /// <summary>
 /// Fixed:
 /// </summary>
 public SysLogModel(Microsoft.AspNetCore.Mvc.Filters.ExceptionContext filterContext)
 {
     Class  = Routes.Controller();
     Method = Routes.Action();
     WriteSysLog();
     SysLogType    = SysLogTypes.Execption;
     ErrMessage    = filterContext.Exception.Message;
     ErrStackTrace = filterContext.Exception.StackTrace;
     Finish();
 }
Esempio n. 11
0
 public Context()
 {
     TenantId     = Sessions.TenantId();
     UserId       = Sessions.UserId();
     DeptId       = Sessions.DeptId();
     Controller   = Routes.Controller();
     Action       = Routes.Action();
     Id           = Routes.Id();
     HasPrivilege = Permissions.HasPrivilege();
 }
Esempio n. 12
0
 /// <summary>
 /// Fixed:
 /// </summary>
 public SysLogModel(Exception e, Logs logs = null)
 {
     Class      = Routes.Controller();
     Method     = Routes.Action();
     ErrMessage = e.Message + (logs?.Any() == true
         ? "\n" + logs.Select(o => o.Name + ": " + o.Value).Join("\n")
         : string.Empty);
     ErrStackTrace = e.StackTrace;
     WriteSysLog();
 }
Esempio n. 13
0
 /// <summary>
 /// Fixed:
 /// </summary>
 public SysLogModel(System.Web.Mvc.ExceptionContext filterContext)
 {
     Class  = Routes.Controller();
     Method = Routes.Action();
     WriteSysLog();
     SysLogType    = SysLogTypes.Execption;
     ErrMessage    = filterContext.Exception.Message;
     ErrStackTrace = filterContext.Exception.StackTrace;
     Finish();
 }
 private static bool EditorActions()
 {
     return(Routes.Action(
                "new",
                "create",
                "edit",
                "copy",
                "move",
                "separate",
                "history"));
 }
Esempio n. 15
0
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Binaries_ReferenceId": ReferenceId = Forms.Data(controlId).ToLong(); break;

                case "Binaries_BinaryType": BinaryType = Forms.Data(controlId).ToString(); break;

                case "Binaries_Title": Title = new Title(BinaryId, Forms.Data(controlId)); break;

                case "Binaries_Body": Body = Forms.Data(controlId).ToString(); break;

                case "Binaries_FileName": FileName = Forms.Data(controlId).ToString(); break;

                case "Binaries_Extension": Extension = Forms.Data(controlId).ToString(); break;

                case "Binaries_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments = Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Binaries_Bin": Bin = Forms.File(controlId); break;

                case "Binaries_Thumbnail": Thumbnail = Forms.File(controlId); break;

                case "Binaries_Icon": Icon = Forms.File(controlId); break;

                default: break;
                }
            });
        }
 private static bool PostBack(SiteSettings ss)
 {
     return(new List <string>
     {
         "new",
         "create",
         "edit",
         "copy",
         "move",
         "separate",
         "history"
     }.Contains(Routes.Action()) || ss.Scripts?.Any() == true || ss.Styles.Any() == true);
 }
Esempio n. 17
0
 private static bool EditorActions()
 {
     return(new List <string>
     {
         "new",
         "create",
         "edit",
         "copy",
         "move",
         "separate",
         "history"
     }.Contains(Routes.Action()));
 }
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "OutgoingMails_To": To = Forms.List(controlId).Join(";"); break;

                case "OutgoingMails_Cc": Cc = Forms.List(controlId).Join(";"); break;

                case "OutgoingMails_Bcc": Bcc = Forms.List(controlId).Join(";"); break;

                case "OutgoingMails_Title": Title = new Title(OutgoingMailId, Forms.Data(controlId)); break;

                case "OutgoingMails_Body": Body = Forms.Data(controlId).ToString(); break;

                case "OutgoingMails_SentTime": SentTime = new Time(Forms.Data(controlId).ToDateTime(), byForm: true); break;

                case "OutgoingMails_DestinationSearchRange": DestinationSearchRange = Forms.Data(controlId).ToString(); break;

                case "OutgoingMails_DestinationSearchText": DestinationSearchText = Forms.Data(controlId).ToString(); break;

                case "OutgoingMails_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Esempio n. 19
0
        public static string Key()
        {
            var callerOfMethod = Routes.Action();

            if (Sessions.Created())
            {
                var path = Url.AbsolutePath().ToLower()
                           .Split('/').Where(o => o != string.Empty).ToList();
                var methodIndex = path.IndexOf(callerOfMethod.ToLower());
                return(methodIndex != -1
                    ? path.Take(methodIndex).Join("/")
                    : path.Join("/"));
            }
            return(string.Empty);
        }
Esempio n. 20
0
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Demos_TenantId": TenantId = Forms.Data(controlId).ToInt(); break;

                case "Demos_Title": Title = new Title(DemoId, Forms.Data(controlId)); break;

                case "Demos_Passphrase": Passphrase = Forms.Data(controlId).ToString(); break;

                case "Demos_MailAddress": MailAddress = Forms.Data(controlId).ToString(); break;

                case "Demos_Initialized": Initialized = Forms.Data(controlId).ToBool(); break;

                case "Demos_TimeLag": TimeLag = Forms.Data(controlId).ToInt(); break;

                case "Demos_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Esempio n. 21
0
        public string ToNotice(string saved, Column column, bool updated, bool update)
        {
            switch (Routes.Action())
            {
            case "deletecomment":
                return(Displays.CommentDeleted());

            default:
                return(this.Any()
                        ? this.FirstOrDefault().Body.ToNoticeLine(
                           string.Empty,
                           column,
                           updated,
                           update)
                        : string.Empty);
            }
        }
Esempio n. 22
0
        public static HtmlBuilder Breadcrumb(
            this HtmlBuilder hb, SiteSettings ss, long siteId, bool _using)
        {
            if (!Sessions.LoggedIn() || !_using)
            {
                return(hb);
            }
            var controller = Routes.Controller();

            switch (controller)
            {
            case "admins":
                return(Breadcrumb(hb, controller));

            case "depts":
                return(Breadcrumb(hb, controller, Displays.Depts()));

            case "groups":
                return(Permissions.CanManageTenant()
                        ? Breadcrumb(hb, controller, Displays.Groups())
                        : Breadcrumb(hb));

            case "users":
                switch (Routes.Action())
                {
                case "editapi":
                    return(hb.Breadcrumb(new Dictionary <string, string>
                    {
                        { Locations.Get("Users", "EditApi"), Displays.ApiSettings() }
                    }));

                default:
                    return(Permissions.CanManageTenant()
                                ? Breadcrumb(hb, controller, Displays.Users())
                                : Breadcrumb(hb));
                }

            case "items":
            case "permissions":
                return(hb.Breadcrumb(siteId));

            default:
                return(hb);
            }
        }
Esempio n. 23
0
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Tenants_TenantName": TenantName = Forms.Data(controlId).ToString(); break;

                case "Tenants_Title": Title = new Title(TenantId, Forms.Data(controlId)); break;

                case "Tenants_Body": Body = Forms.Data(controlId).ToString(); break;

                case "Tenants_ContractDeadline": ContractDeadline = Forms.Data(controlId).ToDateTime().ToUniversal(); break;

                case "Tenants_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments = Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "ExportSettings_ReferenceType": ReferenceType = Forms.Data(controlId).ToString(); break;

                case "ExportSettings_ReferenceId": ReferenceId = Forms.Data(controlId).ToLong(); break;

                case "ExportSettings_Title": Title = new Title(ExportSettingId, Forms.Data(controlId)); break;

                case "ExportSettings_AddHeader": AddHeader = Forms.Data(controlId).ToBool(); break;

                case "ExportSettings_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
        public void SetByForm(SiteSettings ss)
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Wikis_Title": Title = new Title(WikiId, Forms.Data(controlId)); break;

                case "Wikis_Body": Body = Forms.Data(controlId).ToString(); break;

                case "Wikis_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default:
                    if (controlId.RegexExists("Comment[0-9]+"))
                    {
                        Comments.Update(
                            controlId.Substring("Comment".Length).ToInt(),
                            Forms.Data(controlId));
                    }
                    break;
                }
            });
            SetByFormula(ss);
            SetChoiceHash(ss);
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
        public void SetByForm()
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Healths_TenantCount": TenantCount = Forms.Data(controlId).ToInt(); break;

                case "Healths_UserCount": UserCount = Forms.Data(controlId).ToInt(); break;

                case "Healths_ItemCount": ItemCount = Forms.Data(controlId).ToInt(); break;

                case "Healths_ErrorCount": ErrorCount = Forms.Data(controlId).ToInt(); break;

                case "Healths_Elapsed": Elapsed = Forms.Data(controlId).ToDouble(); break;

                case "Healths_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments = Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default: break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
Esempio n. 27
0
        public void SetByForm(SiteSettings ss)
        {
            Forms.Keys().ForEach(controlId =>
            {
                switch (controlId)
                {
                case "Users_LoginId": LoginId = Forms.Data(controlId).ToString(); break;

                case "Users_GlobalId": GlobalId = Forms.Data(controlId).ToString(); break;

                case "Users_Name": Name = Forms.Data(controlId).ToString(); break;

                case "Users_UserCode": UserCode = Forms.Data(controlId).ToString(); break;

                case "Users_Password": Password = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_PasswordValidate": PasswordValidate = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_PasswordDummy": PasswordDummy = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_RememberMe": RememberMe = Forms.Data(controlId).ToBool(); break;

                case "Users_LastName": LastName = Forms.Data(controlId).ToString(); break;

                case "Users_FirstName": FirstName = Forms.Data(controlId).ToString(); break;

                case "Users_Birthday": Birthday = new Time(Forms.Data(controlId).ToDateTime(), byForm: true); break;

                case "Users_Gender": Gender = Forms.Data(controlId).ToString(); break;

                case "Users_Language": Language = Forms.Data(controlId).ToString(); break;

                case "Users_TimeZone": TimeZone = Forms.Data(controlId).ToString(); break;

                case "Users_DeptId": DeptId = Forms.Data(controlId).ToInt(); break;

                case "Users_FirstAndLastNameOrder": FirstAndLastNameOrder = (Names.FirstAndLastNameOrders)Forms.Data(controlId).ToInt(); break;

                case "Users_Body": Body = Forms.Data(controlId).ToString(); break;

                case "Users_LastLoginTime": LastLoginTime = new Time(Forms.Data(controlId).ToDateTime(), byForm: true); break;

                case "Users_PasswordExpirationTime": PasswordExpirationTime = new Time(Forms.Data(controlId).ToDateTime(), byForm: true); break;

                case "Users_PasswordChangeTime": PasswordChangeTime = new Time(Forms.Data(controlId).ToDateTime(), byForm: true); break;

                case "Users_NumberOfLogins": NumberOfLogins = Forms.Data(controlId).ToInt(); break;

                case "Users_NumberOfDenial": NumberOfDenial = Forms.Data(controlId).ToInt(); break;

                case "Users_TenantManager": TenantManager = Forms.Data(controlId).ToBool(); break;

                case "Users_Disabled": Disabled = Forms.Data(controlId).ToBool(); break;

                case "Users_OldPassword": OldPassword = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_ChangedPassword": ChangedPassword = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_ChangedPasswordValidator": ChangedPasswordValidator = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_AfterResetPassword": AfterResetPassword = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_AfterResetPasswordValidator": AfterResetPasswordValidator = Forms.Data(controlId).ToString().Sha512Cng(); break;

                case "Users_DemoMailAddress": DemoMailAddress = Forms.Data(controlId).ToString(); break;

                case "Users_SessionGuid": SessionGuid = Forms.Data(controlId).ToString(); break;

                case "Users_Timestamp": Timestamp = Forms.Data(controlId).ToString(); break;

                case "Comments": Comments = Comments.Prepend(Forms.Data("Comments")); break;

                case "VerUp": VerUp = Forms.Data(controlId).ToBool(); break;

                default: break;
                }
            });
            if (Routes.Action() == "deletecomment")
            {
                DeleteCommentId = Forms.ControlId().Split(',')._2nd().ToInt();
                Comments.RemoveAll(o => o.CommentId == DeleteCommentId);
            }
            Forms.FileKeys().ForEach(controlId =>
            {
                switch (controlId)
                {
                default: break;
                }
            });
        }
        private static HtmlBuilder NavigationMenu(
            this HtmlBuilder hb,
            SiteSettings ss,
            long siteId,
            string referenceType,
            bool useNavigationMenu)
        {
            var canManageGroups = Sessions.UserSettings().DisableGroupAdmin != true;
            var canManageSite   = siteId != 0 && ss.CanManageSite(site: true);
            var canManageDepts  = Permissions.CanManageTenant();
            var canManageUsers  = Permissions.CanManageTenant();

            return(hb.Ul(
                       id: "NavigationMenu",
                       action: () => hb
                       .Li(
                           action: () => hb
                           .Div(action: () => hb
                                .A(
                                    href: NewHref(ss),
                                    attributes: SiteIndex(ss)
                                        ? new HtmlAttributes()
                                    .OnClick("$p.templates($(this));")
                                    .DataAction("Templates")
                                    .DataMethod("post")
                                        : null,
                                    action: () => hb
                                    .Span(css: "ui-icon ui-icon-plus")
                                    .Text(text: Displays.New()))),
                           _using: ss.ReferenceType == "Sites" && Routes.Action() == "index"
                            ? ss.CanManageSite()
                            : ss.CanCreate() && ss.ReferenceType != "Wikis")
                       .Li(
                           css: "sub-menu",
                           action: () => hb
                           .Div(
                               attributes: new HtmlAttributes().DataId("ViewModeMenu"),
                               action: () => hb
                               .Span(css: "ui-icon ui-icon-triangle-1-e")
                               .Text(text: Displays.View()))
                           .ViewModeMenu(ss: ss),
                           _using: Def.ViewModeDefinitionCollection
                           .Any(o => o.ReferenceType == referenceType))
                       .Li(
                           css: "sub-menu",
                           action: () => hb
                           .Div(
                               attributes: new HtmlAttributes().DataId("SettingsMenu"),
                               action: () => hb
                               .Span(css: "ui-icon ui-icon-gear")
                               .Text(text: Displays.Manage()))
                           .SettingsMenu(
                               ss: ss,
                               siteId: siteId,
                               canManageSite: canManageSite,
                               canManageDepts: canManageDepts,
                               canManageGroups: canManageGroups,
                               canManageUsers: canManageUsers),
                           _using:
                           canManageSite ||
                           canManageDepts ||
                           canManageGroups ||
                           canManageUsers)
                       .Li(
                           css: "sub-menu",
                           action: () => hb
                           .Div(
                               attributes: new HtmlAttributes().DataId("AccountMenu"),
                               action: () => hb
                               .Span(css: "ui-icon ui-icon-person")
                               .Text(text: SiteInfo.UserName((
                                                                 Sessions.UserId()))))
                           .AccountMenu())));
        }
Esempio n. 29
0
 /// <summary>
 /// Fixed:
 /// </summary>
 public SysLogModel()
 {
     Class  = Routes.Controller();
     Method = Routes.Action();
     WriteSysLog();
 }
Esempio n. 30
0
        public static HtmlBuilder MainCommands(
            this HtmlBuilder hb,
            SiteSettings ss,
            long siteId,
            Versions.VerTypes verType,
            long referenceId  = 0,
            bool backButton   = true,
            bool updateButton = false,
            bool copyButton   = false,
            bool moveButton   = false,
            bool mailButton   = false,
            bool deleteButton = false,
            Action extensions = null)
        {
            return(hb.Div(id: "MainCommandsContainer", action: () => hb
                          .Div(id: "MainCommands", action: () =>
            {
                if (backButton)
                {
                    hb.Button(
                        controlId: "GoBack",
                        text: Displays.GoBack(),
                        controlCss: "button-icon",
                        accessKey: "q",
                        onClick: "$p.back();",
                        icon: "ui-icon-circle-arrow-w");
                }
                if (Routes.Action() == "new")
                {
                    hb.Button(
                        text: Displays.Create(),
                        controlCss: "button-icon validate",
                        accessKey: "s",
                        onClick: "$p.send($(this));",
                        icon: "ui-icon-disk",
                        action: "Create",
                        method: "post");
                }
                else if (ss.CanRead() && verType == Versions.VerTypes.Latest)
                {
                    hb
                    .Button(
                        text: Displays.Update(),
                        controlCss: "button-icon validate",
                        accessKey: "s",
                        onClick: "$p.send($(this));",
                        icon: "ui-icon-disk",
                        action: "Update",
                        method: "put",
                        _using: updateButton && ss.CanUpdate())
                    .Button(
                        text: Displays.Copy(),
                        controlCss: "button-icon open-dialog",
                        accessKey: "c",
                        onClick: "$p.openDialog($(this));",
                        icon: "ui-icon-copy",
                        selector: "#CopyDialog",
                        _using: copyButton && ss.CanCreate())
                    .Button(
                        text: Displays.Move(),
                        controlCss: "button-icon open-dialog",
                        accessKey: "o",
                        onClick: "$p.moveTargets($(this));",
                        icon: "ui-icon-transferthick-e-w",
                        selector: "#MoveDialog",
                        action: "MoveTargets",
                        method: "get",
                        _using: moveButton && ss.CanUpdate())
                    .Button(
                        controlId: "EditOutgoingMail",
                        text: Displays.Mail(),
                        controlCss: "button-icon",
                        onClick: "$p.openOutgoingMailDialog($(this));",
                        icon: "ui-icon-mail-closed",
                        action: "Edit",
                        method: "put",
                        accessKey: "m",
                        _using: mailButton && ss.CanSendMail())
                    .Button(
                        text: Displays.Delete(),
                        controlCss: "button-icon",
                        accessKey: "r",
                        onClick: "$p.send($(this));",
                        icon: "ui-icon-trash",
                        action: "Delete",
                        method: "delete",
                        confirm: "ConfirmDelete",
                        _using: deleteButton && ss.CanDelete() && !ss.IsSite())
                    .Button(
                        text: Displays.DeleteSite(),
                        controlCss: "button-icon",
                        accessKey: "r",
                        onClick: "$p.openDeleteSiteDialog($(this));",
                        icon: "ui-icon-trash",
                        _using: deleteButton && ss.CanDelete() && ss.IsSite());
                    if (Routes.Controller() == "items" && ss.ReferenceType != "Sites")
                    {
                        switch (Routes.Action())
                        {
                        case "index":
                            hb
                            .Button(
                                text: Displays.BulkMove(),
                                controlCss: "button-icon open-dialog",
                                accessKey: "o",
                                onClick: "$p.moveTargets($(this));",
                                icon: "ui-icon-transferthick-e-w",
                                selector: "#MoveDialog",
                                action: "MoveTargets",
                                method: "get",
                                _using: ss.CanUpdate())
                            .Button(
                                text: Displays.BulkDelete(),
                                controlCss: "button-icon",
                                accessKey: "r",
                                onClick: "$p.send($(this));",
                                icon: "ui-icon-trash",
                                action: "BulkDelete",
                                method: "delete",
                                confirm: "ConfirmDelete",
                                _using: ss.CanDelete())
                            .Button(
                                controlId: "EditImportSettings",
                                text: Displays.Import(),
                                controlCss: "button-icon",
                                accessKey: "w",
                                onClick: "$p.openImportSettingsDialog($(this));",
                                icon: "ui-icon-arrowreturnthick-1-e",
                                selector: "#ImportSettingsDialog",
                                _using: ss.CanImport())
                            .Button(
                                text: Displays.Export(),
                                controlCss: "button-icon",
                                accessKey: "x",
                                onClick: "$p.openExportSelectorDialog($(this));",
                                icon: "ui-icon-arrowreturnthick-1-w",
                                action: "OpenExportSelectorDialog",
                                method: "post",
                                _using: ss.CanExport());
                            break;

                        case "crosstab":
                            hb.Button(
                                text: Displays.Export(),
                                controlCss: "button-icon",
                                accessKey: "x",
                                onClick: "$p.exportCrosstab();",
                                icon: "ui-icon-arrowreturnthick-1-w",
                                _using: ss.CanExport());
                            break;
                        }
                    }
                }
                extensions?.Invoke();
            })));
        }