コード例 #1
0
ファイル: IndexViewModel.cs プロジェクト: DennisSangmo/ICom
 public IndexViewModel(IEnumerable<User> users)
 {
     Users = users.OrderByName();
 }
        void ControlTreeDataLoader.LoadData()
        {
            CssClass = CssClass.ConcatenateWithSpace( "ewfStandardFileCollectionManager" );

            if( AppRequestState.Instance.Browser.IsInternetExplorer() ) {
                base.Controls.Add(
                    new HtmlGenericControl( "p" )
                        {
                            InnerText =
                                "Because you are using Internet Explorer, clicking on a file below will result in a yellow warning bar appearing near the top of the browser.  You will need to then click the warning bar and tell Internet Explorer you are sure you want to download the file."
                        } );
            }

            var columnSetups = new List<ColumnSetup>();
            if( ThumbnailResourceInfoCreator != null )
                columnSetups.Add( new ColumnSetup { Width = Unit.Percentage( 10 ) } );
            columnSetups.Add( new ColumnSetup { CssClassOnAllCells = "ewfOverflowedCell" } );
            columnSetups.Add( new ColumnSetup { Width = Unit.Percentage( 13 ) } );
            columnSetups.Add( new ColumnSetup { Width = Unit.Percentage( 7 ) } );
            columnSetups.Add( new ColumnSetup { Width = Unit.Percentage( 23 ), CssClassOnAllCells = "ewfRightAlignCell" } );

            var table = new DynamicTable( columnSetups.ToArray() ) { Caption = Caption };

            files = BlobFileOps.SystemProvider.GetFilesLinkedToFileCollection( fileCollectionId );
            files = ( sortByName ? files.OrderByName() : files.OrderByUploadedDateDescending() ).ToArray();

            var deletePb = PostBack.CreateFull( id: PostBack.GetCompositeId( postBackIdBase, "delete" ) );
            var deleteModMethods = new List<Func<bool>>();
            foreach( var file in files )
                addFileRow( table, file, deletePb, deleteModMethods );
            if( !ReadOnly ) {
                table.AddRow(
                    getUploadControlList().ToCell( new TableCellSetup( fieldSpan: ThumbnailResourceInfoCreator != null ? 3 : 2 ) ),
                    ( files.Any() ? new PostBackButton( deletePb, new ButtonActionControlStyle( "Delete Selected Files" ), usesSubmitBehavior: false ) : null ).ToCell(
                        new TableCellSetup( fieldSpan: 2, classes: "ewfRightAlignCell".ToSingleElementArray() ) ) );
            }
            deletePb.AddModificationMethod(
                () => {
                    if( deleteModMethods.Aggregate( false, ( deletesOccurred, method ) => method() || deletesOccurred ) )
                        EwfPage.AddStatusMessage( StatusMessageType.Info, "Selected files deleted successfully." );
                } );

            Controls.Add( table );

            if( ReadOnly && !files.Any() )
                Visible = false;
        }
コード例 #3
0
        void ControlTreeDataLoader.LoadData()
        {
            CssClass = CssClass.ConcatenateWithSpace("ewfStandardFileCollectionManager");

            if (AppRequestState.Instance.Browser.IsInternetExplorer())
            {
                base.Controls.Add(
                    new HtmlGenericControl("p")
                {
                    InnerText =
                        "Because you are using Internet Explorer, clicking on a file below will result in a yellow warning bar appearing near the top of the browser.  You will need to then click the warning bar and tell Internet Explorer you are sure you want to download the file."
                });
            }

            var columnSetups = new List <ColumnSetup>();

            if (ThumbnailResourceInfoCreator != null)
            {
                columnSetups.Add(new ColumnSetup {
                    Width = Unit.Percentage(10)
                });
            }
            columnSetups.Add(new ColumnSetup {
                CssClassOnAllCells = "ewfOverflowedCell"
            });
            columnSetups.Add(new ColumnSetup {
                Width = Unit.Percentage(13)
            });
            columnSetups.Add(new ColumnSetup {
                Width = Unit.Percentage(7)
            });
            columnSetups.Add(new ColumnSetup {
                Width = Unit.Percentage(23), CssClassOnAllCells = "ewfRightAlignCell"
            });

            var table = new DynamicTable(columnSetups.ToArray())
            {
                Caption = Caption
            };

            files = BlobFileOps.SystemProvider.GetFilesLinkedToFileCollection(fileCollectionId);
            files = (sortByName ? files.OrderByName() : files.OrderByUploadedDateDescending()).ToArray();

            var deletePb         = PostBack.CreateFull(id: PostBack.GetCompositeId(postBackIdBase, "delete"));
            var deleteModMethods = new List <Func <bool> >();

            foreach (var file in files)
            {
                addFileRow(table, file, deletePb, deleteModMethods);
            }
            if (!ReadOnly)
            {
                table.AddRow(
                    getUploadControlList().ToCell(new TableCellSetup(fieldSpan: ThumbnailResourceInfoCreator != null ? 3 : 2)),
                    (files.Any() ? new PostBackButton(deletePb, new ButtonActionControlStyle("Delete Selected Files"), usesSubmitBehavior: false) : null).ToCell(
                        new TableCellSetup(fieldSpan: 2, classes: "ewfRightAlignCell".ToSingleElementArray())));
            }
            deletePb.AddModificationMethod(
                () => {
                if (deleteModMethods.Aggregate(false, (deletesOccurred, method) => method() || deletesOccurred))
                {
                    EwfPage.AddStatusMessage(StatusMessageType.Info, "Selected files deleted successfully.");
                }
            });

            Controls.Add(table);

            if (ReadOnly && !files.Any())
            {
                Visible = false;
            }
        }
コード例 #4
0
 public IndexViewModel(IEnumerable <User> users)
 {
     Users = users.OrderByName();
 }