Beispiel #1
0
        protected void extensionsGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            DataGridItem item = e.Item;

            if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.SelectedItem)
            {
                var editHyperlink = item.Controls[8].Controls[0] as HyperLink;
                if (editHyperlink != null)
                {
                    var package = (PackageInfo)item.DataItem;
                    if (ModuleContext.PortalSettings.ActiveTab.IsSuperTab)
                    {
                        editHyperlink.Visible = !package.IsSystemPackage && PackageController.CanDeletePackage(package, ModuleContext.PortalSettings);
                    }
                    else
                    {
                        editHyperlink.Visible = false;
                    }
                }
                editHyperlink = item.Controls[0].Controls[0] as HyperLink;
                if (editHyperlink != null)
                {
                    editHyperlink.Visible = ModuleContext.IsEditable;
                }
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Page_Load runs when the page loads
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]   07/26/2007    Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            cmdUninstall.Click += cmdUninstall_Click;
            CheckSecurity();
            try
            {
                if (Package != null && string.IsNullOrEmpty(Package.Manifest))
                {
                    deleteRow.Visible = false;
                }

                //Make Uninstall and Delete Files option unavailable if package cannot be deleted. Also display a message to the user
                if (Package != null && !PackageController.CanDeletePackage(Package, ModuleContext.PortalSettings))
                {
                    cmdUninstall.Visible = false;
                    deleteRow.Visible    = false;
                    lblMessage.CssClass  = "NormalRed";
                    switch (Package.PackageType)
                    {
                    case "Skin":
                        lblMessage.Text = Localization.GetString("CannotDeleteSkin.ErrorMessage", LocalResourceFile);
                        break;

                    case "Container":
                        lblMessage.Text = Localization.GetString("CannotDeleteContainer.ErrorMessage", LocalResourceFile);
                        break;

                    case "Provider":
                        lblMessage.Text = Localization.GetString("CannotDeleteProvider.ErrorMessage", LocalResourceFile);
                        break;
                    }
                }
                else
                {
                    lblMessage.CssClass = "Normal";
                    lblMessage.Text     = "";
                }
                packageForm.DataSource = Package;
                packageForm.DataBind();
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #3
0
        public PackageInfoDto(int portalId, PackageInfo package)
        {
            PackageType      = package.PackageType;
            FriendlyName     = package.FriendlyName;
            Name             = package.Name;
            PackageId        = package.PackageID;
            Description      = package.Description;
            IsInUse          = ExtensionsController.IsPackageInUse(package, portalId);
            Version          = package.Version.ToString(3);
            UpgradeUrl       = ExtensionsController.UpgradeRedirect(package.Version, package.PackageType, package.Name);
            UpgradeIndicator = ExtensionsController.UpgradeIndicator(package.Version, package.PackageType, package.Name);
            PackageIcon      = ExtensionsController.GetPackageIcon(package);
            License          = package.License;
            ReleaseNotes     = package.ReleaseNotes;
            Owner            = package.Owner;
            Organization     = package.Organization;
            Url       = package.Url;
            Email     = package.Email;
            CanDelete = !package.IsSystemPackage &&
                        package.PackageID > 0 &&
                        PackageController.CanDeletePackage(package, PortalSettings.Current);

            var authService = AuthenticationController.GetAuthenticationServiceByPackageID(PackageId);

            ReadOnly = authService != null && authService.AuthenticationType == Constants.DnnAuthTypeName;

            var locale  = LocaleController.Instance.GetLocale(PortalController.Instance.GetCurrentPortalSettings().DefaultLanguage);
            var tabId   = TabController.GetTabByTabPath(portalId, "//Admin//Extensions", locale.Culture.Name);
            var tabInfo = TabController.Instance.GetTab(tabId, portalId);
            var module  = tabInfo.Modules.OfType <ModuleInfo>().First();

            SiteSettingsLink = (module == null)
                ? ""
                : Globals.NavigateURL(tabId, "Edit",
                                      new[]
            {
                $"mid={module.ModuleID}",
                $"packageid={PackageId}",
                "Display=editor",
                "popUp=true",
            });
        }
Beispiel #4
0
        public PackageInfoDto(int portalId, PackageInfo package)
        {
            NavigationManager = Globals.DependencyProvider.GetRequiredService <INavigationManager>();

            PackageType      = package.PackageType;
            FriendlyName     = package.FriendlyName;
            Name             = package.Name;
            PackageId        = package.PackageID;
            Description      = package.Description;
            IsInUse          = ExtensionsController.IsPackageInUse(package, portalId);
            Version          = package.Version.ToString(3);
            UpgradeUrl       = ExtensionsController.UpgradeRedirect(package.Version, package.PackageType, package.Name);
            UpgradeIndicator = ExtensionsController.UpgradeIndicator(package.Version, package.PackageType, package.Name);
            PackageIcon      = ExtensionsController.GetPackageIcon(package);
            License          = package.License;
            ReleaseNotes     = package.ReleaseNotes;
            Owner            = package.Owner;
            Organization     = package.Organization;
            Url       = package.Url;
            Email     = package.Email;
            CanDelete = !package.IsSystemPackage &&
                        package.PackageID > 0 &&
                        PackageController.CanDeletePackage(package, PortalSettings.Current);

            var authService = AuthenticationController.GetAuthenticationServiceByPackageID(PackageId);

            ReadOnly = authService != null && authService.AuthenticationType == Constants.DnnAuthTypeName;

            var portalSettings = PortalController.Instance.GetCurrentPortalSettings();
            var tabId          = portalSettings.ActiveTab.TabID;

            SiteSettingsLink = NavigationManager.NavigateURL(tabId, "EditExtension",
                                                             new[]
            {
                $"packageid={PackageId}",
                "Display=editor",
                "popUp=true",
            });
        }
        private void BindData()
        {
            email.ValidationExpression = Globals.glbEmailRegEx;
            trLanguagePackType.Visible = false;
            switch (Mode)
            {
            case "All":
                lblHelp.Text   = Localization.GetString("EditHelp", LocalResourceFile);
                cmdUpdate.Text = Localization.GetString("cmdUpdate", LocalResourceFile);
                break;

            case "LanguagePack":
                lblHelp.Text   = Localization.GetString("EditLanguageHelp", LocalResourceFile);
                cmdUpdate.Text = Localization.GetString("cmdUpdateLanguage", LocalResourceFile);
                break;

            case "Module":
                lblHelp.Text   = Localization.GetString("EditModuleHelp", LocalResourceFile);
                cmdUpdate.Text = Localization.GetString("cmdUpdateModule", LocalResourceFile);
                break;

            case "Skin":
                lblHelp.Text   = Localization.GetString("EditSkinHelp", LocalResourceFile);
                cmdUpdate.Text = Localization.GetString("cmdUpdateSkin", LocalResourceFile);
                break;
            }

            cmdPackage.Visible = IsSuperTab;
            cmdUpdate.Visible  = IsSuperTab;
            if (Package != null)
            {
                if (PackageEditor == null || PackageID == Null.NullInteger)
                {
                    extensionSection.Visible = false;
                }
                else
                {
                    phEditor.Controls.Clear();
                    phEditor.Controls.Add(PackageEditor as Control);
                    var moduleControl = PackageEditor as IModuleControl;
                    if (moduleControl != null)
                    {
                        moduleControl.ModuleContext.Configuration = ModuleContext.Configuration;
                    }
                    PackageEditor.PackageID = PackageID;
                    PackageEditor.Initialize();

                    Package.IconFile = Util.ParsePackageIconFileName(Package);
                }

                switch (Package.PackageType)
                {
                case "Auth_System":
                case "Container":
                case "Module":
                case "Skin":
                    iconFile.Enabled = true;
                    Package.IconFile = Util.ParsePackageIconFileName(Package);
                    break;

                default:
                    iconFile.Enabled = false;
                    Package.IconFile = "Not Available";
                    break;
                }

                if (Mode != "All")
                {
                    packageType.Visible = false;
                }
                //Determine if Package is ready for packaging
                PackageWriterBase writer = PackageWriterFactory.GetWriter(Package);
                cmdPackage.Visible = IsSuperTab && writer != null && Directory.Exists(Path.Combine(Globals.ApplicationMapPath, writer.BasePath));

                cmdDelete.Visible = IsSuperTab && (!Package.IsSystemPackage) && (PackageController.CanDeletePackage(Package, ModuleContext.PortalSettings));
                ctlAudit.Entity   = Package;

                packageForm.DataSource         = Package;
                packageFormReadOnly.DataSource = Package;
                if (!Page.IsPostBack)
                {
                    packageForm.DataBind();
                    packageFormReadOnly.DataBind();
                }
                packageForm.Visible         = IsSuperTab;
                packageFormReadOnly.Visible = !IsSuperTab;
            }
        }
        public PackageInfoSlimDto(int portalId, PackageInfo package)
        {
            this.PackageId        = package.PackageID;
            this.FriendlyName     = package.FriendlyName;
            this.Name             = package.Name;
            this.FileName         = package.FileName;
            this.Description      = package.Description;
            this.Version          = package.Version.ToString(3);
            this.IsInUse          = ExtensionsController.IsPackageInUse(package, portalId);
            this.UpgradeUrl       = ExtensionsController.UpgradeRedirect(package.Version, package.PackageType, package.Name);
            this.UpgradeIndicator = ExtensionsController.UpgradeIndicator(package.Version, package.PackageType, package.Name);
            this.PackageIcon      = ExtensionsController.GetPackageIcon(package);
            this.Url       = package.Url;
            this.CanDelete = package.PackageID != Null.NullInteger && !package.IsSystemPackage && PackageController.CanDeletePackage(package, PortalSettings.Current);

            if (package.PackageID != Null.NullInteger)
            {
                var authService = AuthenticationController.GetAuthenticationServiceByPackageID(this.PackageId);
                this.ReadOnly = authService != null && authService.AuthenticationType == Constants.DnnAuthTypeName;
            }
        }