Exemple #1
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                base.OnInit(e);

                jQuery.RequestDnnPluginsRegistration();

                var folderId = Convert.ToInt32(Request.Params["FolderId"]);
                Folder = FolderManager.Instance.GetFolder(folderId);
                if (string.IsNullOrEmpty(Folder.FolderPath))
                {
                    folderViewModel = controller.GetRootFolder();
                    isRootFolder    = true;
                }
                else
                {
                    folderViewModel = controller.GetFolder(folderId);
                }

                // Setup controls
                CancelButton.Click += OnCancelClick;
                SaveButton.Click   += OnSaveClick;
                PrepareFolderPreviewInfo();

                var mef = new ExtensionPointManager();
                var folderFieldsExtension = mef.GetUserControlExtensionPointFirstByPriority("DigitalAssets", "FolderFieldsControlExtensionPoint");
                if (folderFieldsExtension != null)
                {
                    folderFieldsControl    = Page.LoadControl(folderFieldsExtension.UserControlSrc);
                    folderFieldsControl.ID = folderFieldsControl.GetType().BaseType.Name;
                    FolderDynamicFieldsContainer.Controls.Add(folderFieldsControl);
                    var fieldsControl = folderFieldsControl as IFieldsControl;
                    if (fieldsControl != null)
                    {
                        fieldsControl.SetController(controller);
                        fieldsControl.SetItemViewModel(new ItemViewModel()
                        {
                            ItemID   = folderViewModel.FolderID,
                            IsFolder = true,
                            PortalID = folderViewModel.PortalID,
                            ItemName = folderViewModel.FolderName
                        });
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
 public EventHandlersContainer()
 {
     try
     {
         if (GetCurrentStatus() != Globals.UpgradeStatus.None)
         {
             return;
         }
         ExtensionPointManager.ComposeParts(this);
     }
     catch (Exception ex)
     {
         Logger.Error(ex.Message, ex);
     }
 }
#pragma warning restore 649

        public Factory()
        {
            ExtensionPointManager.ComposeParts(this);
        }
Exemple #4
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                base.OnInit(e);

                JavaScript.RequestRegistration(CommonJs.DnnPlugins);

                var folderId = Convert.ToInt32(this.Request.Params["FolderId"]);
                this.Folder         = FolderManager.Instance.GetFolder(folderId);
                this.HasFullControl = this.UserInfo.IsSuperUser || FolderPermissionController.HasFolderPermission(this.Folder.FolderPermissions, "FULLCONTROL");

                FolderViewModel rootFolder;
                switch (SettingsRepository.GetMode(this.ModuleId))
                {
                case DigitalAssestsMode.Group:
                    var groupId = Convert.ToInt32(this.Request.Params["GroupId"]);
                    rootFolder = this.controller.GetGroupFolder(groupId, this.PortalSettings);
                    if (rootFolder == null)
                    {
                        throw new Exception("Invalid group folder");
                    }

                    break;

                case DigitalAssestsMode.User:
                    rootFolder = this.controller.GetUserFolder(this.PortalSettings.UserInfo);
                    break;

                default:
                    rootFolder = this.controller.GetRootFolder(this.ModuleId);
                    break;
                }

                this.isRootFolder    = rootFolder.FolderID == folderId;
                this.folderViewModel = this.isRootFolder ? rootFolder : this.controller.GetFolder(folderId);

                // Setup controls
                this.CancelButton.Click += this.OnCancelClick;
                this.SaveButton.Click   += this.OnSaveClick;
                this.PrepareFolderPreviewInfo();
                this.cmdCopyPerm.Click += this.cmdCopyPerm_Click;

                var mef = new ExtensionPointManager();
                var folderFieldsExtension = mef.GetUserControlExtensionPointFirstByPriority("DigitalAssets", "FolderFieldsControlExtensionPoint");
                if (folderFieldsExtension != null)
                {
                    this.folderFieldsControl    = this.Page.LoadControl(folderFieldsExtension.UserControlSrc);
                    this.folderFieldsControl.ID = this.folderFieldsControl.GetType().BaseType.Name;
                    this.FolderDynamicFieldsContainer.Controls.Add(this.folderFieldsControl);
                    var fieldsControl = this.folderFieldsControl as IFieldsControl;
                    if (fieldsControl != null)
                    {
                        fieldsControl.SetController(this.controller);
                        fieldsControl.SetItemViewModel(new ItemViewModel
                        {
                            ItemID   = this.folderViewModel.FolderID,
                            IsFolder = true,
                            PortalID = this.folderViewModel.PortalID,
                            ItemName = this.folderViewModel.FolderName,
                        });
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        protected override void OnInit(EventArgs e)
        {
            try
            {
                base.OnInit(e);

                JavaScript.RequestRegistration(CommonJs.DnnPlugins);

                var fileId = Convert.ToInt32(Request.Params["FileId"]);
                file     = FileManager.Instance.GetFile(fileId, true);
                fileItem = controller.GetFile(fileId);
                folder   = FolderManager.Instance.GetFolder(file.FolderId);

                SaveButton.Click   += OnSaveClick;
                CancelButton.Click += OnCancelClick;

                if (FolderPermissionController.CanViewFolder((FolderInfo)folder))
                {
                    var mef = new ExtensionPointManager();
                    var preViewPanelExtension = mef.GetUserControlExtensionPointFirstByPriority("DigitalAssets", "PreviewInfoPanelExtensionPoint");
                    previewPanelControl = Page.LoadControl(preViewPanelExtension.UserControlSrc);
                    PreviewPanelContainer.Controls.Add(previewPanelControl);

                    var fileFieldsExtension = mef.GetUserControlExtensionPointFirstByPriority("DigitalAssets", "FileFieldsControlExtensionPoint");
                    fileFieldsControl    = Page.LoadControl(fileFieldsExtension.UserControlSrc);
                    fileFieldsControl.ID = fileFieldsControl.GetType().BaseType.Name;
                    FileFieldsContainer.Controls.Add(fileFieldsControl);

                    PrepareFilePreviewInfoControl();
                    PrepareFileFieldsControl();

                    // Tab Extension Point
                    var tabContentControlsInstances = new List <PropertiesTabContentControl>();
                    foreach (var extension in mef.GetEditPageTabExtensionPoints("DigitalAssets", "FilePropertiesTab"))
                    {
                        if (FolderPermissionController.HasFolderPermission(folder.FolderPermissions, extension.Permission))
                        {
                            var liElement = new HtmlGenericControl("li")
                            {
                                InnerHtml = "<a href=\"#" + extension.EditPageTabId + "\">" + extension.Text + "</a>",
                            };
                            liElement.Attributes.Add("class", extension.CssClass);
                            liElement.Attributes.Add("id", extension.EditPageTabId + "_tab");
                            Tabs.Controls.Add(liElement);

                            var container = new PanelTabExtensionControl {
                                PanelId = extension.EditPageTabId
                            };
                            var control = (PortalModuleBase)Page.LoadControl(extension.UserControlSrc);
                            control.ID = Path.GetFileNameWithoutExtension(extension.UserControlSrc);
                            control.ModuleConfiguration = ModuleConfiguration;
                            var contentControl = control as PropertiesTabContentControl;
                            if (contentControl != null)
                            {
                                contentControl.OnItemUpdated += OnItemUpdated;
                                tabContentControlsInstances.Add(contentControl);
                            }
                            container.Controls.Add(control);
                            TabsPanel.Controls.Add(container);
                        }
                    }
                    tabContentControls = tabContentControlsInstances.ToList();
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Exemple #6
0
 public ControlBarController()
 {
     mef = new ExtensionPointManager();
 }