Example #1
0
        public DocumentFilterView()
        {
            toolFilter = new ToolSearchEntry()
            {
                Name = "Filter", FillWidth = true
            };

            fields = new LayoutList()
            {
                EditMode        = EditModes.ByClick,
                GenerateFields  = false,
                GenerateColumns = false,
                FieldInfo       = new LayoutFieldInfo(
                    new LayoutField {
                    Name = nameof(DocumentFilter.IsWork)
                },
                    new LayoutField {
                    Name = nameof(DocumentFilter.IsCurrent)
                },
                    new LayoutField {
                    Name = nameof(DocumentFilter.Number)
                },
                    new LayoutField {
                    Name = nameof(DocumentFilter.Title)
                },
                    new LayoutField {
                    Name = nameof(DocumentFilter.Customer)
                },
                    new LayoutField {
                    Name = nameof(DocumentFilter.DateType)
                },
                    new LayoutField {
                    Name = nameof(DocumentFilter.Date)
                }
                    ),
                Name = "Basic"
            };

            templates = new FlowTree
            {
                ShowListNode = false,
                FlowKeys     = FlowTreeKeys.Template,
                Name         = "Templates",
                FilterEntry  = toolFilter.Entry
            };
            templates.ListInfo.Columns.Add(
                new LayoutColumn
            {
                Name    = nameof(TableItemNode.Count),
                Width   = 35,
                Style   = GuiEnvironment.Theme["CellFar"],
                Invoker = countInvoker
            });
            works = new FlowTree
            {
                ShowListNode = false,
                FlowKeys     = FlowTreeKeys.Work | FlowTreeKeys.Stage,
                Name         = "Works_Stage"
            };
            //dates = new VBox();
            //dates.PackStart(dateType)

            users = new UserTree()
            {
                ShowListNode = false,
                UserKeys     = UserTreeKeys.Department | UserTreeKeys.Position | UserTreeKeys.User | UserTreeKeys.Current,
                Name         = "Users"
            };

            box = new GroupBox(
                new GroupBoxItem {
                Widget = templates, Name = "Document Type", FillWidth = true, FillHeight = true
            },
                //new GroupBoxItem { Widget = fields, Row = 1, Name = "Parameters", FillWidth = true, Height = 160, Autosize = false, Expand = false },
                new GroupBoxItem {
                Widget = works, Row = 2, Name = "Workflow & Stage", FillWidth = true, FillHeight = true, Expand = false
            },
                new GroupBoxItem {
                Widget = users, Row = 3, Name = "Staff", FillWidth = true, FillHeight = true, Expand = false
            })
            {
                Name = "Map"
            };

            PackStart(box, true, true);
            MinWidth = 330;

            var nodeSend = new TableItemNode()
            {
                Name = "Send",
                Tag  = new DocumentFilter()
                {
                    Staff    = (User)GuiEnvironment.User,
                    DateType = DocumentSearchDate.WorkEnd,
                    Date     = new DateInterval(DateTime.Today),
                    IsWork   = CheckedState.Unchecked
                }
            };

            GuiService.Localize(nodeSend, "DocumentWorker", nodeSend.Name);

            var nodeRecent = new TableItemNode()
            {
                Name = "Recent",
                Tag  = new DocumentFilter()
                {
                    Staff    = (User)GuiEnvironment.User,
                    DateType = DocumentSearchDate.WorkEnd,
                    Date     = new DateInterval(DateTime.Today)
                }
            };

            GuiService.Localize(nodeRecent, "DocumentWorker", nodeRecent.Name);

            var nodeSearch = new TableItemNode()
            {
                Name = "Search",
                Tag  = new DocumentFilter()
                {
                }
            };

            GuiService.Localize(nodeSearch, "DocumentWorker", nodeSearch.Name);

            Name = nameof(DocumentFilterView);
        }
Example #2
0
        public PermissionEditor()
        {
            toolLogs = new ToolItem(ToolLogsClick)
            {
                Name = "Logs", Glyph = GlyphType.History
            };
            toolSave = new ToolItem(ToolSaveClick)
            {
                Name = "Save", Sensitive = false, Glyph = GlyphType.SaveAlias
            };
            toolReject = new ToolItem(ToolCancelClick)
            {
                Name = "Cancel", Glyph = GlyphType.Undo
            };
            toolExport = new ToolItem(ToolExportClick)
            {
                Name = "Export", Glyph = GlyphType.FileTextO
            };
            toolFilterText = new ToolTextEntry {
                Name = "FilterText"
            };

            list = new LayoutList()
            {
                EditMode         = EditModes.ByClick,
                EditState        = EditListState.Edit,
                GenerateColumns  = false,
                GenerateToString = false,
                Grouping         = false,
                Mode             = LayoutListMode.List,
                Name             = "list",
                Text             = "columns"
            };

            bar = new Toolsbar(
                toolSave,
                toolReject,
                toolExport,
                toolLogs,
                new ToolSeparator {
                FillWidth = true
            },
                toolFilterText)
            {
                Name = "Bar"
            };

            var listInfo = new LayoutListInfo(
                new LayoutColumn
            {
                Name      = nameof(Node.ToString),
                Editable  = false,
                Width     = 120,
                FillWidth = true,
                Invoker   = ToStringInvoker.Instance
            },
                new LayoutColumn
            {
                Name    = "View",
                Width   = 60,
                Invoker = new ActionInvoker <TableItemNode, bool?>("View",
                                                                   (item) => item.Access?.Get(Group).Read,
                                                                   (item, value) => CheckSave(item, AccessType.Read, value))
            },
                new LayoutColumn
            {
                Name    = "Edit",
                Width   = 60,
                Invoker = new ActionInvoker <TableItemNode, bool?>("Edit",
                                                                   (item) => item.Access?.Get(Group).Update,
                                                                   (item, value) => CheckSave(item, AccessType.Update, value))
            },
                new LayoutColumn
            {
                Name    = "Create",
                Width   = 60,
                Invoker = new ActionInvoker <TableItemNode, bool?>("Create",
                                                                   (item) => item.Access?.Get(Group).Create,
                                                                   (item, value) => CheckSave(item, AccessType.Create, value))
            },
                new LayoutColumn
            {
                Name    = "Delete",
                Width   = 60,
                Invoker = new ActionInvoker <TableItemNode, bool?>("Delete",
                                                                   (item) => item.Access?.Get(Group).Delete,
                                                                   (item, value) => CheckSave(item, AccessType.Delete, value))
            },
                new LayoutColumn
            {
                Name    = "Admin",
                Width   = 60,
                Invoker = new ActionInvoker <TableItemNode, bool?>("Admin",
                                                                   (item) => item.Access?.Get(Group).Admin,
                                                                   (item, value) => CheckSave(item, AccessType.Admin, value))
            },
                new LayoutColumn
            {
                Name    = "Accept",
                Width   = 60,
                Invoker = new ActionInvoker <TableItemNode, bool?>("Accept",
                                                                   (item) => item.Access?.Get(Group).Accept,
                                                                   (item, value) => CheckSave(item, AccessType.Accept, value))
            },
                new LayoutColumn
            {
                Name    = "Table",
                Visible = false,
                Invoker = new PropertyInvoker <TableItemNode, string>("TableName")
            })
            {
                Tree           = true,
                ColumnsVisible = true,
                HeaderVisible  = true,
                GroupCount     = false
            };

            listInfo.Sorters.Add(new LayoutSort("Order"));
            var nodeInfo = new LayoutNodeInfo {
                Columns = listInfo
            };

            tree = new FlowTree
            {
                NodeInfo    = nodeInfo,
                Name        = "tree",
                EditState   = EditListState.Edit,
                EditMode    = EditModes.ByF2,
                UserKeys    = UserTreeKeys.Department | UserTreeKeys.User | UserTreeKeys.Group | UserTreeKeys.Permission,
                FlowKeys    = FlowTreeKeys.Template | FlowTreeKeys.TemplateData | FlowTreeKeys.Work | FlowTreeKeys.Stage | FlowTreeKeys.StageParam,
                FilterEntry = toolFilterText.Entry
            };
            tree.SelectionChanged += TreeSelectionChanged;

            map = new GroupBox(
                new GroupBoxItem
            {
                Text      = "Params",
                Widget    = list,
                FillWidth = true
            },
                new GroupBoxItem
            {
                Text       = "Permissions",
                Widget     = tree,
                FillWidth  = true,
                FillHeight = true,
                Row        = 1
            });

            Name = "PermissionEditor";
            Text = "Permissions";
            PackStart(bar, false, false);
            PackStart(map, true, true);

            UserReg.RowLoged += FlowEnvirRowLoged;

            Localize();
        }
Example #3
0
        public DocumentSender()
        {
            styleComplete.Alternate             = false;
            styleComplete.BackBrush.Color       = Colors.Green.WithAlpha(80 / 255);
            styleComplete.BackBrush.ColorSelect = Colors.Green.WithAlpha(150 / 255);

            styleDefault.Alternate             = false;
            styleDefault.BackBrush.Color       = Colors.White.WithAlpha(80 / 255);
            styleDefault.BackBrush.ColorSelect = Colors.White.WithAlpha(150 / 255);

            styleError.Alternate             = false;
            styleError.BackBrush.Color       = Colors.Red.WithAlpha(80 / 255);
            styleError.BackBrush.ColorSelect = Colors.Red.WithAlpha(150 / 255);

            listUsers = new FlowTree()
            {
                AllowCheck     = true,
                CheckRecursive = false,
                CheckClearBase = true,
                ShowUser       = true
            };

            toolNext = new ToolMenuItem {
                Name = "Next", DropDown = new Menubar {
                    Name = "Next"
                }
            };
            toolNext.ItemClick += ToolNextItemClick;
            toolForward         = new ToolMenuItem {
                Name = "Forward"
            };
            toolReturn = new ToolMenuItem {
                Name = "Return"
            };
            toolComplete = new ToolMenuItem {
                Name = "Complete"
            };
            toolRecovery = new ToolMenuItem()
            {
                Name = "Recovery"
            };

            toolType = new ToolDropDown(
                toolNext,
                toolForward,
                toolReturn,
                toolComplete,
                toolRecovery)
            {
                Name         = "Type",
                DisplayStyle = ToolItemDisplayStyle.Text
            };
            toolType.ItemClick += ToolTypeItemClicked;

            toolAccept.Name = "Send";
            toolPrint       = new ToolItem(ToolPrintClick)
            {
                Name = "Print", DisplayStyle = ToolItemDisplayStyle.Text
            };

            toolProgress = new ToolProgressBar()
            {
                Name = "Progress", Visible = false
            };

            bar.Items[0].InsertAfter(new ToolItem[] {
                toolType,
                toolProgress
            });

            listDocuments = new DocumentLayoutList()
            {
                EditState        = EditListState.ReadOnly,
                GenerateToString = false,
                GenerateColumns  = false,
                Name             = "Documents",
                ReadOnly         = true,
                ListInfo         = new LayoutListInfo(
                    new LayoutColumn()
                {
                    Name = "Document", Width = 250
                },
                    new LayoutColumn()
                {
                    Name = "Work", Width = 150
                },
                    new LayoutColumn()
                {
                    Name = "Message", FillWidth = true
                })
                {
                    StyleRow = styleDefault
                },
                ListSource = new SelectableListView <DocumentSendItem>(items)
            };
            listDocuments.GetCellStyle += OnListDocumentsGetCellStyle;

            groupBox = new GroupBox(
                new GroupBoxItem()
            {
                Widget = listDocuments, Name = "Documents", FillHeight = true, FillWidth = true
            },
                new GroupBoxItem()
            {
                Widget = listUsers, Name = "Users", FillHeight = true, FillWidth = true, Row = 1
            })
            {
                Name = "GroupMap"
            };

            Mode   = ToolShowMode.Dialog;
            Name   = "DocumentSender";
            Target = groupBox;
            Size   = new Size(640, 640);
        }
Example #4
0
        public FlowExplorer()
            : base()
        {
            contextTools = new Menubar(
                new ToolMenuItem(ToolMainRefreshClick)
            {
                Name = "Refresh", Glyph = GlyphType.Refresh
            },
                new ToolMenuItem(ToolGenerateDBClick)
            {
                Name = "Generate database", Glyph = GlyphType.Database
            },
                new ToolMenuItem(ToolStatClick)
            {
                Name = "Stats", Glyph = GlyphType.Link
            })
            {
                Name = "FlowExplorer"
            };

            contextAdd = new Menubar(
                new ToolMenuItem
            {
                Name      = "Template",
                Sensitive = Template.DBTable?.Access.GetFlag(AccessType.Create, GuiEnvironment.User) ?? false,
                Glyph     = GlyphType.Book
            },
                new ToolMenuItem
            {
                Name      = "Template Data",
                Sensitive = TemplateData.DBTable?.Access.GetFlag(AccessType.Create, GuiEnvironment.User) ?? false,
                Glyph     = GlyphType.File
            },
                new ToolMenuItem
            {
                Name      = "Work",
                Sensitive = Work.DBTable?.Access.GetFlag(AccessType.Create, GuiEnvironment.User) ?? false,
                Glyph     = GlyphType.GearsAlias
            },
                new ToolMenuItem
            {
                Name      = "Work Stage",
                Sensitive = Stage.DBTable?.Access.GetFlag(AccessType.Create, GuiEnvironment.User) ?? false,
                Glyph     = GlyphType.EditAlias
            },
                new ToolMenuItem
            {
                Name      = "Stage Parameter",
                Sensitive = StageParam.DBTable?.Access.GetFlag(AccessType.Create, GuiEnvironment.User) ?? false,
                Glyph     = GlyphType.Columns,
                DropDown  = new Menubar(
                    new ToolMenuItem
                {
                    Name      = "Stage Procedure",
                    Sensitive = StageParam.DBTable?.Access.GetFlag(AccessType.Create, GuiEnvironment.User) ?? false,
                    Glyph     = GlyphType.EditAlias
                },
                    new ToolMenuItem
                {
                    Name      = "Stage Reference",
                    Sensitive = StageParam.DBTable?.Access.GetFlag(AccessType.Create, GuiEnvironment.User) ?? false,
                    Glyph     = GlyphType.EditAlias
                }
                    )
            },
                new ToolMenuItem
            {
                Name      = "Group",
                Sensitive = UserGroup.DBTable?.Access.GetFlag(AccessType.Create, GuiEnvironment.User) ?? false,
                Glyph     = GlyphType.Users
            },
                new ToolMenuItem
            {
                Name      = "Department",
                Sensitive = Department.DBTable?.Access.GetFlag(AccessType.Create, GuiEnvironment.User) ?? false,
                Glyph     = GlyphType.Home
            },
                new ToolMenuItem
            {
                Name      = "Position",
                Sensitive = Position.DBTable?.Access.GetFlag(AccessType.Create, GuiEnvironment.User) ?? false,
                Glyph     = GlyphType.UserMd
            },
                new ToolMenuItem
            {
                Name      = "User",
                Sensitive = User.DBTable?.Access.GetFlag(AccessType.Create, GuiEnvironment.User) ?? false,
                Glyph     = GlyphType.User
            },
                new ToolMenuItem
            {
                Name      = "Scheduler",
                Sensitive = Scheduler.DBTable?.Access.GetFlag(AccessType.Create, GuiEnvironment.User) ?? false,
                Glyph     = GlyphType.ClockO
            })
            {
                Name = "FlowExplorer"
            };
            contextAdd.Bar.ItemClick += ContextAddItemClicked;

            barMain = new Toolsbar(
                new ToolDropDown {
                Name = "Add", GlyphColor = Colors.DarkGreen, DropDown = contextAdd, Glyph = GlyphType.PlusCircle
            },
                new ToolItem(ToolMainRemoveClick)
            {
                Name = "Remove", GlyphColor = Colors.DarkRed, Glyph = GlyphType.MinusCircle
            },
                new ToolItem(ToolMainCopyClick)
            {
                Name = "Copy", Glyph = GlyphType.CopyAlias
            },
                new ToolDropDown {
                Name = "Tools", DropDown = contextTools, Glyph = GlyphType.Wrench
            },
                new ToolSearchEntry()
            {
                Name = "FilterText", FillWidth = true
            })
            {
                Name = "FlowExplorer"
            };

            se = new ListEditor();

            ose = new ToolWindow {
                Target = se
            };
            ose.ButtonAcceptClick += AcceptOnActivated;

            var userKeys = UserTreeKeys.None;

            if (Department.DBTable?.Access.GetFlag(AccessType.Read, GuiEnvironment.User) ?? false)
            {
                userKeys |= UserTreeKeys.Department;
            }
            if (Position.DBTable?.Access.GetFlag(AccessType.Read, GuiEnvironment.User) ?? false)
            {
                userKeys |= UserTreeKeys.Position;
            }
            if (GroupPermission.DBTable?.Access.GetFlag(AccessType.Read, GuiEnvironment.User) ?? false)
            {
                userKeys |= UserTreeKeys.Permission;
            }
            if (User.DBTable?.Access.GetFlag(AccessType.Read, GuiEnvironment.User) ?? false)
            {
                userKeys |= UserTreeKeys.User;
            }
            if (UserGroup.DBTable?.Access.GetFlag(AccessType.Read, GuiEnvironment.User) ?? false)
            {
                userKeys |= UserTreeKeys.Group;
            }
            if (Scheduler.DBTable?.Access.GetFlag(AccessType.Read, GuiEnvironment.User) ?? false)
            {
                userKeys |= UserTreeKeys.Scheduler;
            }
            var keys = FlowTreeKeys.None;

            //if (TemplateParam.DBTable?.Access.View ?? false) keys |= FlowTreeKeys.TemplateParam;
            if (Template.DBTable?.Access.GetFlag(AccessType.Read, GuiEnvironment.User) ?? false)
            {
                keys |= FlowTreeKeys.Template;
            }
            if (StageParam.DBTable?.Access.GetFlag(AccessType.Read, GuiEnvironment.User) ?? false)
            {
                keys |= FlowTreeKeys.StageParam;
            }
            if (Stage.DBTable?.Access.GetFlag(AccessType.Read, GuiEnvironment.User) ?? false)
            {
                keys |= FlowTreeKeys.Stage;
            }
            if (Work.DBTable?.Access.GetFlag(AccessType.Read, GuiEnvironment.User) ?? false)
            {
                keys |= FlowTreeKeys.Work;
            }
            tree = new FlowTree
            {
                FlowKeys    = keys,
                UserKeys    = userKeys,
                FilterEntry = ((ToolSearchEntry)barMain["FilterText"]).Entry
            };
            tree.ListInfo.HeaderVisible = true;
            tree.ListInfo.HeaderWidth   = 35;
            tree.SelectionChanged      += TreeAfterSelect;
            tree.CellMouseClick        += TreeNodeMouseClick;
            tree.CellDoubleClick       += TreeNodeMouseDoubleClick;

            Name = "FlowExplorer";
            PackStart(barMain, false, false);
            PackStart(tree, true, true);
        }